PalmeaGroup.DGII.Client 1.0.4

dotnet add package PalmeaGroup.DGII.Client --version 1.0.4
                    
NuGet\Install-Package PalmeaGroup.DGII.Client -Version 1.0.4
                    
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="PalmeaGroup.DGII.Client" Version="1.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PalmeaGroup.DGII.Client" Version="1.0.4" />
                    
Directory.Packages.props
<PackageReference Include="PalmeaGroup.DGII.Client" />
                    
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 PalmeaGroup.DGII.Client --version 1.0.4
                    
#r "nuget: PalmeaGroup.DGII.Client, 1.0.4"
                    
#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 PalmeaGroup.DGII.Client@1.0.4
                    
#: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=PalmeaGroup.DGII.Client&version=1.0.4
                    
Install as a Cake Addin
#tool nuget:?package=PalmeaGroup.DGII.Client&version=1.0.4
                    
Install as a Cake Tool

PalmeaGroup.Dgii.Client

Cliente para consultas web a la DGII (Republica Dominicana).

Caracteristicas

  • Realiza consultas RNC, NCF y e-NCF contra la pagina de consultas publicas de la DGII.
  • Implementado como cliente HTTP con IHttpClientFactory y politicas de reintento (Polly).
  • Parsing tolerante de HTML a XML con helpers seguros (evita NullReference/ParseException).
  • Logging estructurado para diagnosticos cuando el parseo falla.

Instalaci�n

  • Anade el proyecto al Solution o compilalo como paquete NuGet. El ensamblado/namespace raiz es PalmeaGroup.Dgii.Client.

Registro en DI (ejemplo)

En Program.cs / startup:

using PalmeaGroup.Dgii.Client.Extensions;
using PalmeaGroup.Dgii.Client;

var builder = WebApplication.CreateBuilder(args);

// Registra named HttpClient con Polly y soporte de cookies
builder.Services.AddDgiiWrapper();

// Registra servicio
builder.Services.AddTransient<IServicioConsultasDgii, ServicioConsultasWebDgii>();

var app = builder.Build();

Uso (ejemplo)

public class Example
{
    private readonly IServicioConsultasDgii _dgii;

    public Example(IServicioConsultasDgii dgii) => _dgii = dgii;

    public async Task Run(CancellationToken ct)
    {
        var result = await _dgii.ConsultarENcf("123456789", "E0000000001", "", "", ct);
        if (result.Success)
        {
            Console.WriteLine($"Estado: {result.Estado}");
        }
        else
        {
            Console.WriteLine($"Mensaje: {result.Message}");
        }
    }
}

Notas sobre modelos (DTOs)

  • Los DTOs estan en PalmeaGroup.Dgii.Client.Dtos.
  • Propiedades importantes son anulables (string?, decimal?, DateTime?) porque la pagina puede devolver valores ausentes o con formato distinto.
  • Se eliminaron acentos en nombres de propiedades publicas para interoperabilidad. Ejemplos:
    • ValidoHasta (antes ValidoHasta)
    • NombreORazonSocial (antes NombreORazonSocial)
    • Categoria (antes Categoria)

Logging y seguridad

  • El servicio acepta ILogger<ServicioConsultasWebDgii> para registrar advertencias cuando el parseo falla.
  • Evita loggear datos sensibles en produccion; se recomienda configurar un sink separado para diagnosticos y/o aplicar redaccion sobre RNC y codigos de seguridad.

Tests

  • Hay un proyecto de tests de ejemplo en tests/PalmeaGroup.Dgii.Client.Tests.
  • Ejecutar:
dotnet test ./tests/PalmeaGroup.Dgii.Client.Tests

Sugerencias futuras

  • A�adir m�s pol�ticas Polly (circuit-breaker, jitter), configuraci�n desde IConfiguration.
  • Mayor cobertura de tests con HTML de ejemplo (fixtures) y tests de integraci�n con handler mock.
  • Empaquetar como NuGet y publicar con metadata adecuada.

Licencia

  • C�digo del repositorio: revisa la licencia del proyecto (no incluida por defecto en este repo).
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
1.0.4 228 3/29/2026
1.0.3 126 1/20/2026
1.0.2 140 1/20/2026 1.0.2 is deprecated because it is no longer maintained.
1.0.1 153 1/14/2026 1.0.1 is deprecated because it is no longer maintained.