FacturaE.Sdk 3.3.3

dotnet add package FacturaE.Sdk --version 3.3.3
                    
NuGet\Install-Package FacturaE.Sdk -Version 3.3.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FacturaE.Sdk" Version="3.3.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FacturaE.Sdk" Version="3.3.3" />
                    
Directory.Packages.props
<PackageReference Include="FacturaE.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FacturaE.Sdk --version 3.3.3
                    
#r "nuget: FacturaE.Sdk, 3.3.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FacturaE.Sdk@3.3.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FacturaE.Sdk&version=3.3.3
                    
Install as a Cake Addin
#tool nuget:?package=FacturaE.Sdk&version=3.3.3
                    
Install as a Cake Tool

FacturaE SDK

SDK .NET para facturación electrónica en Colombia y eventos RADIAN con integración a la DIAN.

Instalación

dotnet add package FacturaE.Sdk

Inicio Rápido

Factura Electrónica

var dianClient = new DianClient(new DianClientOptions 
{
    ConnectionString = "Endpoint=https://...",
    Software = new SoftwareDian { ... }
});

var service = new FacturaElectronicaService(dianClient, AmbienteDian.Pruebas);

var factura = new FacturaElectronica { ... };
var response = await service.EnvieAsync(factura);

Eventos RADIAN

Enviar Eventos
var radianService = new RadianService(dianClient, AmbienteDian.Pruebas);

// Inscribir título
var inscripcion = new InscripcionTitulo { ... };
await radianService.EnvieAsync(inscripcion);

// Endosar
var endoso = new Endoso { ... };
await radianService.EnvieAsync(endoso);

// Pagar
var pago = new Pago { ... };
await radianService.EnvieAsync(pago);
Consultar Eventos
// Obtener un evento
var evento = await radianService.GetEventoAsync(cude);

// Obtener evento con tipo específico
var pago = await radianService.GetEventoAsync<Pago>(cude);
var endoso = await radianService.GetEventoAsync<Endoso>(cude);

// Obtener todos los eventos de un título
var eventos = await radianService.GetEventosAsync(cufe);

Eventos RADIAN Soportados

  • 034 - AceptacionTacita
  • 036 - InscripcionTituloValor
  • 037-039, 047 - Endoso (propiedad, garantía, procuración, ordinario)
  • 040 - CancelacionEndoso
  • 043 - Mandato
  • 045 - Pago
  • 046 - InformePago
  • 048 - Protesto
  • 049 - TransferenciaDerechos
  • 050 - NotificacionTransferenciaDerechos

Ejemplos de Uso

Inscribir Título Valor Electrónico

var inscripcion = new InscripcionTitulo
{
    Titular = new EntidadTributaria
    {
        Identificacion = "900123456",
        TipoIdentificacion = "31",
        RazonSocial = "MI EMPRESA SAS"
    },
    ValorTotal = 10000000m,
    ValorPagado = 0m,
    FechaEmision = DateTimeOffset.Now.ToOffset(TimeSpan.FromHours(-5))
};

var response = await radianService.EnvieAsync(inscripcion);
if (response.Succeeded)
{
    Console.WriteLine($"Título inscrito: {response.Cude}");
}

Endosar un Título

var endoso = new Endoso
{
    Efecto = EfectoEndoso.EnPropiedad,
    ReferenciaId = "cude-evento-previo",
    Endosante = new EntidadTributaria { ... },
    Endosatario = new EntidadTributaria { ... },
    ValorTotal = 10000000m,
    ValorPagar = 10000000m,
    FechaEmision = DateTimeOffset.Now.ToOffset(TimeSpan.FromHours(-5))
};

await radianService.EnvieAsync(endoso);

Registrar Mandato

var mandato = new Mandato
{
    Mandante = new EntidadTributaria { ... },
    TiempoMandato = TiempoMandato.Ilimitado,
    TipoMandato = TipoMandato.DocumentoGeneral,
    FechaEmision = DateTimeOffset.Now.ToOffset(TimeSpan.FromHours(-5)),
    FechaEfectiva = DateTime.Now
};

await radianService.EnvieAsync(mandato);

Registrar Pago

var pago = new Pago
{
    ReferenciaId = "cude-titulo",
    TipoPago = TipoPago.PagoTotalTitulo,
    PagoTotal = true,
    ValorPagado = 10000000m,
    ValorActual = 10000000m,
    ValorPendiente = 0m,
    FechaEfectiva = DateTime.Now,
    FechaEmision = DateTimeOffset.Now.ToOffset(TimeSpan.FromHours(-5))
};

await radianService.EnvieAsync(pago);

Transferir Derechos Económicos

var transferencia = new TransferenciaDerechos
{
    ReferenciaId = "cude-titulo",
    Emisor = new EntidadTributaria { ... }, // Tenedor actual
    Receptor = new EntidadTributaria { ... }, // Nuevo tenedor
    ConResponsabilidad = false,
    EsTransferenciaParcial = false,
    ValorTotal = 10000000m,
    FechaEmision = DateTimeOffset.Now.ToOffset(TimeSpan.FromHours(-5))
};

await radianService.EnvieAsync(transferencia);

Consultar y Procesar Eventos

// Obtener todos los eventos de un título
var eventos = await radianService.GetEventosAsync(cufe);

foreach (var evento in eventos)
{
    switch (evento)
    {
        case InscripcionTitulo inscripcion:
            Console.WriteLine($"Título: {inscripcion.ValorTotal:C}");
            break;
        case Endoso endoso:
            Console.WriteLine($"Endosado a: {endoso.Endosatario.RazonSocial}");
            break;
        case Pago pago:
            Console.WriteLine($"Pago: {pago.ValorPagado:C}");
            break;
    }
}

// Obtener un evento específico con tipo
var endoso = await radianService.GetEventoAsync<Endoso>(cude);
if (endoso != null)
{
    Console.WriteLine($"Endosante: {endoso.Endosante.RazonSocial}");
    Console.WriteLine($"Endosatario: {endoso.Endosatario.RazonSocial}");
    Console.WriteLine($"Efecto: {endoso.Efecto}");
    Console.WriteLine($"Valor: {endoso.ValorPagar:C}");
}

Generación de Attached Document

// Generar documento adjunto para notificación de evento
var attachedDoc = await radianService.GenereAttachedDocument(cufe, cude);

// Enviar por correo u otro canal
using var reader = new StreamReader(attachedDoc);
var xml = await reader.ReadToEndAsync();

Almacenamiento y Caché de Eventos

// Implementar almacenamiento personalizado
public class DatabaseArchivosRadianSink : IArchivosRadianSink
{
    public async Task StoreAsync(string key, Stream content)
    {
        // Guardar en base de datos
    }

    public async Task<Stream> LoadAsync(string key)
    {
        // Cargar desde base de datos o retornar null
    }
}

// Usar almacenamiento personalizado
var radianService = new RadianService(
    dianClient, 
    AmbienteDian.Pruebas,
    archivosSink: new DatabaseArchivosRadianSink()
);

Callbacks de Eventos

// Reaccionar a envíos exitosos de eventos
var radianService = new RadianService(
    dianClient,
    AmbienteDian.Pruebas,
    onEventoEnviado: async (evento, response) =>
    {
        Console.WriteLine($"Evento {evento.TipoEvento} enviado: {response.Cude}");
        await NotificarInteresados(evento, response);
    }
);

Firmas Digitales

Todos los documentos se firman con XAdES-EPES. Instale su certificado DIAN en el almacén CurrentUser y configure la huella digital:

Software = new SoftwareDian 
{
    Thumbprint = "HUELLA_DIGITAL_CERTIFICADO",
    ...
}

Configuración

var options = new DianClientOptions
{
    ConnectionString = "Endpoint=https://...;AccessKey=...",
    Software = new SoftwareDian
    {
        SoftwareId = Guid.Parse("..."),
        Pin = "...",
        ProviderId = "...",
        Thumbprint = "..."
    }
};
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
3.3.3 222 10/13/2026
3.3.2 108 10/9/2026
3.3.1 127 10/5/2026
3.3.0 114 10/2/2026
3.2.0.2 195 8/6/2026
3.2.0.1 142 8/2/2026
3.1.7.3 137 7/29/2026
3.1.7.2 135 7/29/2026
3.1.7.1 134 7/23/2026
3.1.7 144 7/8/2026
3.1.6-alpha-001 254 11/22/2025
3.1.5-alpha-001 328 10/29/2025
3.1.4 323 10/23/2025
3.1.3 306 10/15/2025
3.1.1 312 9/30/2025
2.1.4-alpha-001 393 10/29/2025
2.1.3 310 10/23/2025
2.1.2 295 10/15/2025
Loading failed