Table of Contents

Class OmieApiClient

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

Default implementation of the Omie ERP API client.

public class OmieApiClient : IOmieApiClient
Inheritance
OmieApiClient
Implements
Inherited Members

Constructors

OmieApiClient(IOptions<OmieApiClientConfig>, ILogger<OmieApiClient>)

Default implementation of the Omie ERP API client.

public OmieApiClient(IOptions<OmieApiClientConfig> options, ILogger<OmieApiClient> logger)

Parameters

options IOptions<OmieApiClientConfig>
logger ILogger<OmieApiClient>

Methods

ChangeOSAsync(IncludeOSParam, CancellationToken)

Updates an existing Service Order (AlterarOS). Send the full item list — Omie replaces the OS items. The header must carry OsCode (nCodOS) or cCodIntOS.

public Task<IResult<IncludeOSResponse>> ChangeOSAsync(IncludeOSParam param, CancellationToken cancellationToken = default)

Parameters

param IncludeOSParam
cancellationToken CancellationToken

Returns

Task<IResult<IncludeOSResponse>>

ChangeOSStageAsync(ChangeOSStageParam, CancellationToken)

Moves a Service Order to another Kanban stage (TrocarEtapaOS). Feature-flag the "billing" stage.

public Task<IResult<ChangeOSStageResponse>> ChangeOSStageAsync(ChangeOSStageParam param, CancellationToken cancellationToken = default)

Parameters

param ChangeOSStageParam
cancellationToken CancellationToken

Returns

Task<IResult<ChangeOSStageResponse>>

ConsultClientAsync(long, CancellationToken)

Checks whether a client exists in Omie by its code.

public Task<IResult<bool>> ConsultClientAsync(long omieClientCode, CancellationToken cancellationToken = default)

Parameters

omieClientCode long
cancellationToken CancellationToken

Returns

Task<IResult<bool>>

ConsultContractAsync(long, CancellationToken)

Reads a Service Contract (ConsultarContrato) to obtain the negotiated unit price per service item. The contract is a price registry only — it must never be billed through.

public Task<IResult<ConsultContractResponse>> ConsultContractAsync(long omieContractCode, CancellationToken cancellationToken = default)

Parameters

omieContractCode long
cancellationToken CancellationToken

Returns

Task<IResult<ConsultContractResponse>>

ConsultOSAsync(long?, string?, CancellationToken)

Reads the current state/stage of a Service Order (ConsultarOS). Provide exactly one identifier.

public Task<IResult<ConsultOSResponse>> ConsultOSAsync(long? nCodOS = null, string? cCodIntOS = null, CancellationToken cancellationToken = default)

Parameters

nCodOS long?
cCodIntOS string
cancellationToken CancellationToken

Returns

Task<IResult<ConsultOSResponse>>

ConsultServiceRegistrationAsync(long, CancellationToken)

Retrieves the registration data of a service in Omie.

public Task<IResult<ConsultServiceRegistrationResponse>> ConsultServiceRegistrationAsync(long omieServiceCode, CancellationToken cancellationToken = default)

Parameters

omieServiceCode long
cancellationToken CancellationToken

Returns

Task<IResult<ConsultServiceRegistrationResponse>>

GenerateBilletAsync(long?, string?, CancellationToken)

Generates the billet of an existing Accounts Receivable entry in Omie. At least one of the two identifiers must be provided.

public Task<IResult<GenerateBilletResponse>> GenerateBilletAsync(long? nCodTitulo = null, string? cCodIntTitulo = null, CancellationToken cancellationToken = default)

Parameters

nCodTitulo long?
cCodIntTitulo string
cancellationToken CancellationToken

Returns

Task<IResult<GenerateBilletResponse>>

GetBilletAsync(long?, string?, CancellationToken)

Retrieves the billet link/details for an existing Accounts Receivable entry in Omie. Use after GenerateBillet to fetch the actual download URL, barcode, etc.

public Task<IResult<GetBilletResponse>> GetBilletAsync(long? nCodTitulo = null, string? cCodIntTitulo = null, CancellationToken cancellationToken = default)

Parameters

nCodTitulo long?
cCodIntTitulo string
cancellationToken CancellationToken

Returns

Task<IResult<GetBilletResponse>>

IncludeOSAsync(IncludeOSParam, CancellationToken)

Includes a Service Order (OS) in Omie.

public Task<IResult<IncludeOSResponse>> IncludeOSAsync(IncludeOSParam param, CancellationToken cancellationToken = default)

Parameters

param IncludeOSParam
cancellationToken CancellationToken

Returns

Task<IResult<IncludeOSResponse>>

IncludeReceivableAsync(IncludeReceivableParam, CancellationToken)

Includes an Accounts Receivable entry in Omie.

public Task<IResult<IncludeReceivableResponse>> IncludeReceivableAsync(IncludeReceivableParam param, CancellationToken cancellationToken = default)

Parameters

param IncludeReceivableParam
cancellationToken CancellationToken

Returns

Task<IResult<IncludeReceivableResponse>>

ListBillingStagesAsync(CancellationToken)

Lists the OS Kanban stage catalog (ListarEtapasFaturamento) to discover stage codes.

public Task<IResult<ListBillingStagesResponse>> ListBillingStagesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<IResult<ListBillingStagesResponse>>

ListCategoryRegistrationAsync(int, int, string, CancellationToken)

Lists registered categories (ListarCategorias) to resolve a service's cCodCateg to its category name.

public Task<IResult<ListCategoryRegistrationResponse>> ListCategoryRegistrationAsync(int page = 1, int recordsPerPage = 1000, string description = "", CancellationToken cancellationToken = default)

Parameters

page int
recordsPerPage int
description string
cancellationToken CancellationToken

Returns

Task<IResult<ListCategoryRegistrationResponse>>

ListContractsAsync(int, int, CancellationToken)

Lists Service Contracts (ListarContratos) so a contract can be resolved by the number the user knows (cNumCtr) — Omie offers no search by contract number. List once and index in memory: consulting contract by contract is what trips Omie's "Consumo redundante" gate.

public Task<IResult<ListContractsResponse>> ListContractsAsync(int page = 1, int recordsPerPage = 100, CancellationToken cancellationToken = default)

Parameters

page int
recordsPerPage int
cancellationToken CancellationToken

Returns

Task<IResult<ListContractsResponse>>

ListServiceRegistrationAsync(int, int, CancellationToken)

Lists registered services (ListarCadastroServico) to resolve/validate a nCodServico.

public Task<IResult<ListServiceRegistrationResponse>> ListServiceRegistrationAsync(int page = 1, int recordsPerPage = 50, CancellationToken cancellationToken = default)

Parameters

page int
recordsPerPage int
cancellationToken CancellationToken

Returns

Task<IResult<ListServiceRegistrationResponse>>