LibreDteDotNet.RestRequest
1.1.8
dotnet add package LibreDteDotNet.RestRequest --version 1.1.8
NuGet\Install-Package LibreDteDotNet.RestRequest -Version 1.1.8
<PackageReference Include="LibreDteDotNet.RestRequest" Version="1.1.8" />
paket add LibreDteDotNet.RestRequest --version 1.1.8
#r "nuget: LibreDteDotNet.RestRequest, 1.1.8"
// Install LibreDteDotNet.RestRequest as a Cake Addin #addin nuget:?package=LibreDteDotNet.RestRequest&version=1.1.8 // Install LibreDteDotNet.RestRequest as a Cake Tool #tool nuget:?package=LibreDteDotNet.RestRequest&version=1.1.8
LibreDteDotNet.RestRequest
This solution tries to show how to access the information published by the Servicio de Impuestos Internos through REST services. The services are packaged in "Library Class" and can be accessed through Dependency Injection.
This repository has no relationship with the government entity SII, only for educational purposes.
📦 Details
Reference | version |
---|---|
.Net Core | 6.0 |
Autofac | 7.0.0 |
Autofac.Extensions.DependencyInjection | 8.0.0 |
Security.Cryptography.Xml | 7.0.1 |
🚩 RoadMap
- Consulta de Documentos Tributarios Electrónicos.
- Documentos Electrónicos Mis DTE en el SII
- Consulta Emitidos.
- Consulta Recibidos.
- Exporta a CSV.
- Boletas Electrónicas: Consultar estado de resumen de ventas diarias de boletas Electrónicas
- Consultar antecedentes de un Contribuyente Electrónico Consultar entre empresas autorizadas
- Verificar contenido de un documento Verificar contenido de un documento emitido por una empresa autorizada
- Consultar validez de un documento Consultar validez de un documento emitido por una empresa autorizada
- Documentos Electrónicos Mis DTE en el SII
- Timbraje Electrónico.
- Obtiene y descarga archivo CAF Solicitar timbraje electrónico
- Re obtiene y descarga archivo CAF Reobtención de folios
- Anula CAF. Anular folios
- Anula CAF. Anulación masiva de folios
- Consulta anulación CAF. Consultar folios anulados
- Libros Contables Electrónicos.
- Envío de documentos Envío LCE
- Estado de envío Consulta estado de un Envío
- Estado libros electrónicos Consulta estado Libros Electrónicos
- Envío de DTE y libros de compras y ventas.
- Enviar DTE y libros electrónicos Enviar DTE
- Consultar estado de envío Consulta estado de un envío
- Consultar libros aceptados Consultar mis libros electrónicos aceptados
- Historial de envíos Historial de envíos
🚀 Usage
This Class is accessed via dependency injection:
IHost host = Host.CreateDefaultBuilder()
.RestRequestBuild() // This is important!
.ConfigureServices(
(c, s) => {
// your config
}
)
.Build();
For calling you needs implements Json Options pattern in your project. The -digital certificate- must be installed in your system, this project does not need to know the password.
{
"Rut": "16000555-2"
}
🐾 Examples
📖 Libro.GetResumen()
Restorna lista de objetos.
var resumencompras = await restRequest.Libro.GetResumen(
tkn, // token
"99000111", // rut company
"4", // dv company
"2023-03", // period
TipoOperacion.Emitidos
);
📖 Libro.GetDetalle()
var detalleventas = await restRequest.Libro.GetDetalle(
tkn, // token
"99000111", // rut company
"4", // dv company
"2023-03", // period
TipoDoc.FacturaAfectaElectronica, // 33-34-61
TipoOperacion.Recibidos
);
📖 Libro.GetCsvFile()
Descarga un archivo texto plano listo para usar.
var csvemitidos = await restRequest.Libro
.GetCsvFile(
tkn, // token
"99000111", // rut company
"4", // dv company
"2023-03", // period
TipoDoc.FacturaAfectaElectronica, // 33-34-61
TipoOperacion.Emitidos
);
if (csvemitidos!.Data != null) {
File.WriteAllLines(csvemitidos.NombreArchivo!, csvemitidos!.Data!);
}
📖 Boleta.GetConsumoByFecha()
var htmlcontent = await restRequest.Boleta
.Conectar() // Important!
.GetConsumoByFecha(
"2022", // period year inicio
"03", // period mes inicio
"2023", // period year final
"02", // period mes final
"99000111", // rut company
"4", // dv company
);
📖 Contribuyente.GetInfo()
var info = await restRequest.Contribuyente
.Conectar() // Important!
.GetInfo("99000111", "4");
📖 Contribuyente.GetInfoDocumento()
var infodoc = await restRequest.Contribuyente
.Conectar()
.GetInfoDocumento(
"77888000", // rut emisor
"0",
"765005555", // rut receptor
"4",
TipoDoc.FacturaAfectaElectronica,
"5",
"27022023", // fecha emisión ddMMyyyy
"929379" // monto total
);
📖 Contribuyente.GetInfoDocumento()
var infodoc = await restRequest.Contribuyente
.Conectar()
.GetInfoDocumento(
"77888000", // rut emisor
"0",
TipoDoc.FacturaAfectaElectronica,
"5" // folio
);
📖 FolioCaf.Obtener()
Descarga un archivo CAF en formato XML. Previamente se debe solicitar el rango máximo.
var max = await restRequest.FolioCaf
.Conectar()
.GetRangoMax("77888000", "4", TipoDoc.FacturaAfectaElectronica);
XDocument nuevocaf = await restRequest.FolioCaf
.Conectar()
.Obtener(
"77888000",
"4",
"1", // cantidad a solicitar
max["MAX_AUTOR"], // canidad máxima
TipoDoc.FacturaAfectaElectronica
)
.Confirmar()
.Descargar();
📖 FolioCaf.GetHistorial()
Muestra historial de últimas solicitudes de archivos de folios CAF.
var cafhisto = await restRequest.FolioCaf
.Conectar() // Important!
.GetHistorial("77888000", "4", TipoDoc.FacturaAfectaElectronica);
📖 FolioCaf.ReObtener()
Re obtiene un archivo CAF previamente solicitado y/o descargado. Parámetros debeb ser obtenidos desde la función FolioCaf.GetHistorial().
XDocument caf = await restRequest.FolioCaf
.Conectar() // Important!
.ReObtener(
"77888000", // rut company
"5",
"126", // cantidad
"27", //dia
"03", //mes
"2023", // year
"9059", // folio inicio
"9184", // folio final
TipoDoc.FacturaAfectaElectronica
)
.Descargar();
📖 DocumentoTributario.Enviar()
Envía nodo EnvioDTE
previamente validado con los esquemas vigentes. (esquemas)
string resID = await restRequest.DocumentoTributario
.Conectar() // Important!
.Validar(@"C:\Users\DevPc\Desktop\651_33_2234.xml", CancellationToken.None) // path file
.Enviar("76888555", "1"); // rut company
📫 Have a question? Found a Bug?
Feel free to file a new issue with a respective title and description on the LibreDteDotNet.RestRequest/issues repository.
❤️ Community and Contributions
I think that Knowledge Doesn’t Belong to Just Any One Person, and I always intend to share my knowledge with other developers, a voluntary monetary contribution or contribute ideas and/or comments to improve these tools would be appreciated.
📘 License
All my repository content is released under the terms of the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net6.0
- AngleSharp (>= 1.0.1)
- Autofac (>= 7.0.0)
- Autofac.Extensions.DependencyInjection (>= 8.0.0)
- Enums.NET (>= 4.0.1)
- LibreDteDotNet.Common (>= 1.0.0)
- Microsoft.Extensions.Hosting.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Http (>= 7.0.0)
- RestSharp (>= 109.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|