C# / .NET
| Requisitos | |
|---|---|
| Pacote | UhuruCompliance.Zuia |
| Ambiente | .NET 8 |
| Dependências | none (System.Text.Json) |
| Testes | 8 testes unitários + teste de contrato contra a API real |
Instalar
dotnet add package UhuruCompliance.Zuia
dotnet pack sdks/dotnet/src/Zuia.Sdk -c Release -o ./nupkgs e depois dotnet nuget add source ./nupkgs.Configurar
Autentique-se com uma chave de API com âmbito ou com um fornecedor de tokens OAuth2 (client credentials). Ver Autenticação.
// Register once (singleton). Pass an HttpClient from IHttpClientFactory if you use one.
builder.Services.AddSingleton(sp => new ZuiaClient(new ZuiaClientOptions
{
BaseUrl = new Uri("https://api.zuia.uhurucompliance.com"),
ApiKey = builder.Configuration["Zuia:ApiKey"], // or TokenProvider = ct => tokenCache.GetAsync(ct)
Language = "pt-AO",
Timeout = TimeSpan.FromSeconds(30),
MaxRetries = 3,
}));
Triagem de uma pessoa ou entidade
var r = await zuia.ScreenPartyAsync(
new PartyQuery("Joao Manuel Exemplo", PartyType.INDIVIDUAL, DateOfBirth: "1975-08-14",
Nationality: "Utopia", DocumentNumber: "UT1234567", ClientId: "C001"),
new RequestOptions(IdempotencyKey: "onboarding-C001", CorrelationId: "crm-7f3a9c21"), ct);
switch (r.Outcome)
{
case ScreeningOutcome.NO_MATCH: OpenAccount(); break;
case ScreeningOutcome.POTENTIAL_MATCH: HoldOnboarding(r.CaseId!); break;
case ScreeningOutcome.CONFIRMED_MATCH: RejectAndReport(r.CaseId!); break;
}
Triagem de uma transacção
HOLD significa: não executar.
var tx = await zuia.ScreenTransactionAsync(
TransactionRequest.Transfer("T002",
new PartyQuery("Kwanza Demo Investimentos, S.A.", PartyType.ENTITY, ClientId: "C014"),
new PartyQuery("Northwind Holdings", Nationality: "Utopia"),
45000.00m, "USD"),
new RequestOptions(IdempotencyKey: "T002-attempt-1"), ct);
if (tx.Decision == TransactionDecision.HOLD) HoldTransfer(tx);
Erros
Cada erro da API passa a uma excepção tipada com o estado HTTP, o code estável, a mensagem traduzida, o correlationId e Retry-After. Ver Erros e novas tentativas.
try
{
await zuia.GetCaseAsync("CASE-0001");
}
catch (ZuiaApiException e) // RFC 9457 problem document
{
logger.LogWarning("{Status} {Code} {Message} correlation={Cid}", e.Status, e.Code, e.Message, e.CorrelationId);
if (e.Status == 402) AlertAdministrators(); // trial or licence ended
}
catch (ZuiaConnectionException) // after retries
{
HoldAndRetryLater();
}
Novas tentativas
Os pedidos que podem ser repetidos com segurança — GET e chamadas de triagem com chave de idempotência — são repetidos até 3 vezes em 429, 502, 503, 504 e erros de rede, esperando Retry-After ou com espera exponencial. As chamadas sem chave de idempotência nunca são repetidas automaticamente.
Paginação
Cada chamada de lista devolve uma página com o total de X-Total-Count; o iterador lê todas as páginas por si.
var page = await zuia.ListCasesAsync(CaseStatus.OPEN, limit: 50); // page.Total from X-Total-Count
await foreach (var c in zuia.AllCasesAsync(CaseStatus.OPEN)) // every page
Console.WriteLine($"{c.Id} {c.Status}{(c.PastSla ? " ▲ past SLA" : "")}");
Relatórios e auditoria
var pdf = await zuia.DownloadReportAsync(ReportType.Cases, "pdf", new DateOnly(2026, 10, 1), new DateOnly(2026, 10, 31));
await File.WriteAllBytesAsync("cases_2026-10.pdf", pdf);
var audit = await zuia.VerifyAuditAsync(); // audit.Valid, audit.Entries
Webhooks
Verifique cada entrega com o corpo original; depois ignore X-Event-Id duplicados. Exemplos completos de receptores: Webhooks.
var ev = Webhooks.Verify(secret, request.Headers["X-Signature"], rawBody); // throws WebhookVerificationException
Referência
| Método | Endpoint |
|---|---|
ScreenPartyAsync(party, options, ct) | POST /screen/party |
ScreenTransactionAsync(tx, options, ct) | POST /screen/transaction |
GetScreeningAsync(id) | GET /screenings/{id} |
ListScreeningsAsync(offset, limit) | GET /screenings |
RescreenAllAsync() | POST /screen/rescreen |
ImportClientsAsync(fileName, bytes) | POST /clients/import |
ListCasesAsync(…) / AllCasesAsync(…) | GET /cases |
GetCaseAsync(id) | GET /cases/{id} |
ListUpdatesAsync(…) / AllListUpdatesAsync() | GET /lists/updates |
GetListUpdateAsync(id) | GET /lists/updates/{id} |
DownloadReportAsync(type, format, from, to) | GET /reports/{type} |
VerifyAuditAsync() | GET /audit/verify |
RequestAsync(method, path, query, body) | qualquer outro endpoint |
Webhooks.Verify(secret, header, body) | assinatura de webhook |
Qualquer outro endpoint está disponível através do método genérico de pedido — ver a referência da API.
Java
Cliente oficial Java da API do Zuia: triagem, casos, actualizações de listas, relatórios, novas tentativas, paginação, erros tipados e verificação de webhooks.
Python
Cliente oficial Python da API do Zuia: triagem, casos, actualizações de listas, relatórios, novas tentativas, paginação, erros tipados e verificação de webhooks.