Table of Contents

Class OmieClientDirectoryProvider

Namespace
NuvTools.Payment.Omie.ApiClient.Services
Assembly
NuvTools.Payment.Omie.ApiClient.dll

Omie client registration indexed by document (CNPJ/CPF) — the way to discover the client code (codigo_cliente_omie), and the only one: Omie does not look a client up by document, and the typed client (IOmieApiClient) only consults by the very code one is trying to discover. The whole registration is listed (ListarClientes, paginated) and searched by document.

The document is compared by digits only: in Omie it usually comes formatted ("12.345.678/0001-99") while applications tend to store it clean — comparing as text would find nobody.

The listing is expensive, so it is cached for NuvTools.Payment.Omie.ApiClient.Services.OmieClientDirectoryProvider.CacheDuration. A client just registered in Omie may, for that long, still not be found.

public class OmieClientDirectoryProvider
Inheritance
OmieClientDirectoryProvider
Inherited Members

Constructors

OmieClientDirectoryProvider(OmieDirectApiClient, IMemoryCache, ILogger<OmieClientDirectoryProvider>)

Omie client registration indexed by document (CNPJ/CPF) — the way to discover the client code (codigo_cliente_omie), and the only one: Omie does not look a client up by document, and the typed client (IOmieApiClient) only consults by the very code one is trying to discover. The whole registration is listed (ListarClientes, paginated) and searched by document.

The document is compared by digits only: in Omie it usually comes formatted ("12.345.678/0001-99") while applications tend to store it clean — comparing as text would find nobody.

The listing is expensive, so it is cached for NuvTools.Payment.Omie.ApiClient.Services.OmieClientDirectoryProvider.CacheDuration. A client just registered in Omie may, for that long, still not be found.

public OmieClientDirectoryProvider(OmieDirectApiClient omie, IMemoryCache cache, ILogger<OmieClientDirectoryProvider> logger)

Parameters

omie OmieDirectApiClient
cache IMemoryCache
logger ILogger<OmieClientDirectoryProvider>

Methods

GetClientCodeAsync(string, CancellationToken)

Omie client code for the informed document.

public Task<IResult<long>> GetClientCodeAsync(string clientDocument, CancellationToken cancellationToken)

Parameters

clientDocument string
cancellationToken CancellationToken

Returns

Task<IResult<long>>