Table of Contents

Class OmieServiceOrderBillingProvider

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

Invoicing of a single service order in Omie — the documented path to issue the NFS-e of one OS, which IOmieApiClient does not cover and therefore goes through the direct client:

  1. StatusOS (servicos/os/): fiscal state of the order — stage, whether it was cancelled, whether it was already invoiced and the NFS-e that came out of it. It is the query that says whether there is anything to do, and the one that confirms the result afterwards.
  2. ValidarOS (servicos/osp/): Omie's validation before invoicing. It is what points out, in the API's own words, which required data is missing on the order or on the client registration — instead of finding out through the city hall's rejection, after the invoice was already requested.
  3. FaturarOS (servicos/osp/): invoices that order. The equivalent of "Faturar Selecionada" in the Omie UI — not to be confused with FaturarLoteOS (servicos/oslote/), which invoices every order of a stage and, triggered for one client, would take the others along.

None of them invents data: the invoice content is the order's. What is decided here is only when to ask for the invoice.

public class OmieServiceOrderBillingProvider
Inheritance
OmieServiceOrderBillingProvider
Inherited Members

Constructors

OmieServiceOrderBillingProvider(OmieDirectApiClient, ILogger<OmieServiceOrderBillingProvider>)

Invoicing of a single service order in Omie — the documented path to issue the NFS-e of one OS, which IOmieApiClient does not cover and therefore goes through the direct client:

  1. StatusOS (servicos/os/): fiscal state of the order — stage, whether it was cancelled, whether it was already invoiced and the NFS-e that came out of it. It is the query that says whether there is anything to do, and the one that confirms the result afterwards.
  2. ValidarOS (servicos/osp/): Omie's validation before invoicing. It is what points out, in the API's own words, which required data is missing on the order or on the client registration — instead of finding out through the city hall's rejection, after the invoice was already requested.
  3. FaturarOS (servicos/osp/): invoices that order. The equivalent of "Faturar Selecionada" in the Omie UI — not to be confused with FaturarLoteOS (servicos/oslote/), which invoices every order of a stage and, triggered for one client, would take the others along.

None of them invents data: the invoice content is the order's. What is decided here is only when to ask for the invoice.

public OmieServiceOrderBillingProvider(OmieDirectApiClient omie, ILogger<OmieServiceOrderBillingProvider> logger)

Parameters

omie OmieDirectApiClient
logger ILogger<OmieServiceOrderBillingProvider>

Methods

GetStatusAsync(string, CancellationToken)

Fiscal state of the order by integration code. Returns null in Data when the order does not exist in Omie — absence is not a failure: it is the case of whoever has not created the order yet.

public Task<IResult<OmieServiceOrderStatus?>> GetStatusAsync(string integrationCode, CancellationToken cancellationToken)

Parameters

integrationCode string
cancellationToken CancellationToken

Returns

Task<IResult<OmieServiceOrderStatus>>

InvoiceAsync(long, string, CancellationToken)

Invoices the order (FaturarOS) — this request is what makes Omie issue that order's NFS-e.

public Task<IResult> InvoiceAsync(long osCode, string integrationCode, CancellationToken cancellationToken)

Parameters

osCode long
integrationCode string
cancellationToken CancellationToken

Returns

Task<IResult>

ValidateAsync(long, string, CancellationToken)

Validates the order for invoicing (ValidarOS). A failure carries Omie's own text, which is what knows the missing required data — passing it through raw is more useful than translating it by approximation.

public Task<IResult> ValidateAsync(long osCode, string integrationCode, CancellationToken cancellationToken)

Parameters

osCode long
integrationCode string
cancellationToken CancellationToken

Returns

Task<IResult>