![]() |
VOOZH | about |
dotnet add package Acontplus.Billing --version 1.3.0
NuGet\Install-Package Acontplus.Billing -Version 1.3.0
<PackageReference Include="Acontplus.Billing" Version="1.3.0" />
<PackageVersion Include="Acontplus.Billing" Version="1.3.0" />Directory.Packages.props
<PackageReference Include="Acontplus.Billing" />Project file
paket add Acontplus.Billing --version 1.3.0
#r "nuget: Acontplus.Billing, 1.3.0"
#:package Acontplus.Billing@1.3.0
#addin nuget:?package=Acontplus.Billing&version=1.3.0Install as a Cake Addin
#tool nuget:?package=Acontplus.Billing&version=1.3.0Install as a Cake Tool
A comprehensive .NET library for electronic invoicing and digital document handling in Ecuador, fully compliant with SRI (Servicio de Rentas Internas) normatives v2.32. Provides complete support for all electronic document types, XML generation, validation, parsing, and web service integration.
All 6 electronic document types according to SRI Ficha Técnica v2.32:
Install-Package Acontplus.Billing
dotnet add package Acontplus.Billing
<ItemGroup>
<PackageReference Include="Acontplus.Billing" Version="1.3.0" />
</ItemGroup>
// In Program.cs - register Billing services
services.AddSingleton<IWebServiceSri, WebServiceSri>();
services.AddSingleton<IDocumentConverter, DocumentConverter>();
services.AddSingleton<IElectronicDocumentService, ElectronicDocumentService>();
// Add other services as needed
{
"Billing": {
"Environment": "Development",
"ValidateBeforeSend": true,
"DefaultTimeoutSeconds": 30,
"DocumentStoragePath": "Documents",
"CompanyRuc": "0991234567001",
"CompanyLegalName": "ACME COMPANY S.A.",
"CompanyCommercialName": "ACME",
"EnableCaching": true,
"CacheDurationMinutes": 60,
"SriConnection": {
"BaseUrl": "https://celcer.sri.gob.ec/",
"TimeoutSeconds": 30,
"MaxRetryAttempts": 3,
"ValidateSslCertificate": true
}
}
}
public class DocumentParser
{
private readonly IElectronicDocumentService _documentService;
public DocumentParser(IElectronicDocumentService documentService) => _documentService = documentService;
public ComprobanteElectronico? Parse(string xmlContent)
{
var xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xmlContent);
return _documentService.TryParseDocument(xmlDoc, out var comprobante, out _) ? comprobante : null;
}
}
public class DocumentSender
{
private readonly IWebServiceSri _sriService;
public DocumentSender(IWebServiceSri sriService) => _sriService = sriService;
public async Task<ResponseSri> ReceiveAsync(string xmlSigned, string receptionUrl)
=> await _sriService.ReceptionAsync(xmlSigned, receptionUrl);
public async Task<ResponseSri> AuthorizeAsync(string claveAcceso, string authorizationUrl)
=> await _sriService.AuthorizationAsync(claveAcceso, authorizationUrl);
}
public class DocumentRenderer
{
private readonly IDocumentConverter _converter;
public DocumentRenderer(IDocumentConverter converter) => _converter = converter;
public string RenderDocument(string xmlContent) => _converter.ConvertToHtml(xmlContent);
}
using Acontplus.Billing.Constants;
// Access document type codes
DocumentTypes.Factura; // "01"
DocumentTypes.LiquidacionCompra; // "03"
DocumentTypes.NotaCredito; // "04"
DocumentTypes.NotaDebito; // "05"
DocumentTypes.GuiaRemision; // "06"
DocumentTypes.ComprobanteRetencion; // "07"
// Get document name
var name = DocumentTypes.GetDocumentName("01"); // "Factura"
// Validate document code
bool isValid = DocumentTypes.IsValidDocumentCode("01"); // true
IWebServiceSri - SRI SOAP web service: document reception, authorization, and XML retrievalIDocumentConverter - XML to HTML/PDF conversion for all document typesIXmlDocumentParser - Parse SRI-authorized XML documentsIAtsXmlService - Generate ATS (Anexo Transaccional Simplificado) XMLIElectronicDocumentService - High-level document managementIDocumentValidator - XSD schema validationISriSigner - XAdES-BES electronic signature for SRI EcuadorAll document types include complete model classes:
ComprobanteElectronico - Base electronic document containerInfoFactura - Invoice informationInfoLiquidacionCompra - Purchase settlement informationInfoNotaCredito - Credit note informationInfoNotaDebito - Debit note information with motivosInfoGuiaRemision - Delivery guide informationInfoCompRetencion - Withholding informationDestinatario - Delivery guide recipients with detailsDocSustento - Supporting documents with retentions and reimbursementsSriSigner provides a native, cross-platform implementation of the XAdES-BES signature required by SRI Ecuador, replicating the MITyCLibXADES output format.
services.AddSingleton<ISriSigner, SriSigner>();
public class SigningService(ISriSigner signer)
{
/// <summary>
/// Signs the comprobante XML and sends it to SRI for reception.
/// </summary>
public string SignAndSend(string xmlUnsigned, string claveAcceso)
{
// Load the PFX certificate from disk or a secret store.
byte[] pfxBytes = File.ReadAllBytes("certificate.p12");
string password = Environment.GetEnvironmentVariable("CERT_PASSWORD")!;
// Returns the signed XML string ready for SriService.ReceptionAsync().
return signer.Sign(xmlUnsigned, password, pfxBytes, claveAcceso);
}
}
public class ElectronicInvoiceWorkflow(ISriSigner signer, IWebServiceSri sri)
{
private const string ReceptionUrl = "https://celcer.sri.gob.ec/comprobantes-electronicos-ws/RecepcionComprobantesOffline";
private const string AuthUrl = "https://celcer.sri.gob.ec/comprobantes-electronicos-ws/AutorizacionComprobantesOffline";
public async Task<string> ProcessAsync(
string xmlUnsigned, string claveAcceso,
byte[] pfxBytes, string pfxPassword)
{
// 1. Sign
string xmlSigned = signer.Sign(xmlUnsigned, pfxPassword, pfxBytes, claveAcceso);
// 2. Send to SRI
ResponseSri reception = await sri.ReceptionAsync(xmlSigned, ReceptionUrl);
if (reception.Estado != "RECIBIDA")
throw new InvalidOperationException($"SRI rejected the document: {reception.Estado}");
// 3. Authorize
ResponseSri auth = await sri.AuthorizationAsync(claveAcceso, AuthUrl);
return auth.NumeroAutorizacion ?? throw new InvalidOperationException("Authorization failed.");
}
}
| Property | Value |
|---|---|
| Signature algorithm | RSA PKCS#1 v1.5 + SHA-1 (xmldsig#rsa-sha1) |
| Digest algorithm | SHA-1 (xmldsig#sha1) |
| Canonicalization | C14N (REC-xml-c14n-20010315) |
| References | etsi:SignedProperties · ds:KeyInfo · comprobante (enveloped) |
| Format | XAdES-BES v1.3.2 (etsi namespace) |
| Serial number | Hex → decimal conversion (XAdES-compliant) |
| Signing time | Ecuador (UTC-5): IANA → Windows → fixed-offset fallback |
| Key storage | EphemeralKeySet — no disk write on Linux/macOS |
| Random IDs | RandomNumberGenerator.GetInt32 — cryptographically secure |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.3.0 | 93 | 5/31/2026 |
| 1.2.5 | 113 | 5/17/2026 |
| 1.2.4 | 96 | 5/17/2026 |
| 1.2.3 | 109 | 5/3/2026 |
| 1.2.2 | 115 | 4/16/2026 |
| 1.2.0 | 121 | 3/23/2026 |
| 1.1.11 | 138 | 3/17/2026 |
| 1.1.10 | 119 | 3/8/2026 |
| 1.1.9 | 131 | 2/22/2026 |
| 1.1.8 | 154 | 1/16/2026 |
| 1.1.7 | 136 | 1/11/2026 |
| 1.1.6 | 225 | 12/25/2025 |
| 1.1.5 | 182 | 12/11/2025 |
| 1.1.4 | 200 | 12/5/2025 |
| 1.1.3 | 240 | 12/4/2025 |
| 1.1.2 | 237 | 12/3/2025 |
| 1.1.1 | 215 | 11/27/2025 |
| 1.1.0 | 234 | 11/23/2025 |
| 1.0.9 | 432 | 11/17/2025 |
v1.3.0: Added ISriSigner / SriSigner — native XAdES-BES electronic
signature
for SRI Ecuador (RSA-SHA1, C14N, three-reference structure). Cryptographically
secure IDs, cross-platform support (Windows / Linux / macOS), EphemeralKeySet
to prevent key material persisting to disk. No extra NuGet required — uses the
System.Security.Cryptography.Xml type included in Microsoft.AspNetCore.App.