Table of Contents

Class OmieServiceCatalogProvider

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

Omie service catalog, read whole (ListarCadastroServico, paginated) and indexed by the business code (cCodigo) — the code applications store in their own configuration. This is how the nCodServico, the description and the unit price of a service are discovered: Omie exposes no search by cCodigo, so the catalog is listed and searched in memory.

The result is cached for NuvTools.Payment.Omie.ApiClient.Services.OmieServiceCatalogProvider.CacheDuration because Omie refuses repeated ListarCadastroServico calls in a short window ("Consumo redundante detectado") — without the cache, opening a screen and generating a service order right after would drop the second call.

public class OmieServiceCatalogProvider
Inheritance
OmieServiceCatalogProvider
Inherited Members

Constructors

OmieServiceCatalogProvider(IOmieApiClient, IMemoryCache)

Omie service catalog, read whole (ListarCadastroServico, paginated) and indexed by the business code (cCodigo) — the code applications store in their own configuration. This is how the nCodServico, the description and the unit price of a service are discovered: Omie exposes no search by cCodigo, so the catalog is listed and searched in memory.

The result is cached for NuvTools.Payment.Omie.ApiClient.Services.OmieServiceCatalogProvider.CacheDuration because Omie refuses repeated ListarCadastroServico calls in a short window ("Consumo redundante detectado") — without the cache, opening a screen and generating a service order right after would drop the second call.

public OmieServiceCatalogProvider(IOmieApiClient omie, IMemoryCache cache)

Parameters

omie IOmieApiClient
cache IMemoryCache

Methods

GetByCodeAsync(bool, CancellationToken)

Catalog indexed by cCodigo. With forceRefresh the cache is ignored and rewritten with whatever Omie returns.

public Task<IResult<IReadOnlyDictionary<string, OmieServiceInfo>>> GetByCodeAsync(bool forceRefresh, CancellationToken cancellationToken)

Parameters

forceRefresh bool
cancellationToken CancellationToken

Returns

Task<IResult<IReadOnlyDictionary<string, OmieServiceInfo>>>

GetByServiceCodeAsync(CancellationToken)

The same catalog indexed by the internal identifier (nCodServico) — the way back, used when reading a service order from Omie, where items carry only the nCodServico and the caller needs the service name.

public Task<IResult<IReadOnlyDictionary<long, OmieServiceInfo>>> GetByServiceCodeAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task<IResult<IReadOnlyDictionary<long, OmieServiceInfo>>>

GetServiceDetailAsync(long, CancellationToken)

Full registration of a service (ConsultarCadastroServico) — it carries what the listing does not and the service order inclusion requires: LC 116, municipal code and tax classification. Cached per service, because the same two or three services repeat across every client.

public Task<IResult<OmieServiceDetail>> GetServiceDetailAsync(long serviceCode, CancellationToken cancellationToken)

Parameters

serviceCode long
cancellationToken CancellationToken

Returns

Task<IResult<OmieServiceDetail>>