Loading...
Area: Episerver B2B Commerce

Invoices API handler

Recommended reading 

HTTP Verb: GET

URL: /api/v1/invoices

Description: Return a collection of invoices

Base: HandlerBase<GetInvoiceCollectionParameter, GetInvoiceCollectionResult>

Handlers:

Order Handler

Description

500 GetRealTimeInvoiceCollectionHandler

If RealTime invoice history is enabled (application settings RealTimeCallsEnabled and Web_UseRealTimeInvoiceHistory), then this handler executes. If no job definition is found in the JobDefinition database table for running real time invoice history, then a Not Found error result is returned. If no job definition step parameters are found with a customer number prompt, then a Not Found error result is returned. Otherwise, real time integration job is run and invoice results returned.

550 GetStoredInvoiceCollectionHandler

If this is NOT real time, then gets all stored invoices based on ERP_LookBackDays application setting and other filter parameters.

Order Handler Description
500 GetSettings Gets UseRealTimeCalls and ShowErpOrderNumber settings
600 GetRealTimeJobDefinition Gets real time invoice history integration job and sets parameters, if UseRealTimeCalls setting equals "true".
700 ExecuteRealTimeJob Executes real time invoice history integration job and save result dataset, if UseRealTimeCalls setting equals "true".
800 MapRealTimeDataSet Parses InvoiceHistory and InvoiceHistoryLine dataset's tables and creates InvoiceHistory and InvoiceHistoryLine lists, which are saved as InvoicesQuery property, if UseRealTimeCalls setting equals "true".
900 GetStoredCollectionQuery Gets all InvoiceHistories with InvoiceHistoryLines, which belong to current customer, and save them to InvoicesQuery, if UseRealTimeCalls setting equals "false".
1000 ApplyFilteringToStoredCollectionQuery

Filters the InvoicesQuery, if specified in the parameter and UseRealTimeCalls setting equals "false".

if StatusCollection property has any statuses, returns InvoiceHistories if StatusCollection contains their statusif InvoiceNumber property has value, returns InvoiceHistories if their invoice number equals InvoiceNumber propertyif OrderNumber property has value, returns InvoiceHistories if their order number equals OrderNumber propertyif CustomerPO property has value, returns InvoiceHistories if their CustomerPO equals CustomerPO propertyif CustomerSequence property doesn't equal "-1", returns InvoiceHistories if their CustomerSequence equals CustomerSequence property or emptyif ToDate property has value, returns InvoiceHistories if their InvoiceDate less or equals ToDate propertyif FromDate property has value, returns InvoiceHistories if their InvoiceDate more or equals FromDate propertyif ShowOpenOnly property equals "true", returns InvoiceHistories if they are open.
1100 ApplySort Applies a sort to the InvoicesQuery. The query is sorted using the Sort property on the parameter object (in ascending order).
1200 ApplyPaging Applies paging to the InvoicesQuery. If the PageSize property on the parameter object has a value, the query is paged using the PageSize and Page properties on the parameter object.
1300 ExecuteQuery Executes the InvoicesQuery after the query has been filtered, sorted, and paged. The result is stored in the InvoiceHistoryCollection property on the result object.
1400 CreateGetInvoiceResults If InvoiceHistoryCollection property on the result object has values, they are transformed into a collection of GetInvoiceResults objects using the GetInvoiceHandler handler. The result is stored in the GetInvoiceResults property on the result object.

 

HTTP Verb: GET

URL: /api/v1/ invoices/{invoiceId}

Description: Return a single invoice record

Base: HandlerBase<GetInvoiceParameter, GetInvoiceResult>

Handlers:

Order Handler

Description

500 GetRealTimeInvoiceHandler

If RealTime invoice history is enabled (application settings RealTimeCallsEnabled and Web_UseRealTimeInvoiceHistory), then this handler executes. If no job definition is found in the JobDefinition database table for running real time invoice history, then a Not Found error result is returned. If no Job Definition step parameters are found with a customer number prompt, then a Not Found error result is returned. Otherwise runs real time integration job, if no invoice is found, InvoiceHistoryServiceInvoiceHistoryNotFlound error result is returned, otherwise returns found invoice.

550 GetStoredInvoiceHandler

If this is NOT real time, then gets invoice history record based on the invoiceId and customer number. If no invoice is found, then InvoiceHistoryServiceInvoiceHistoryNotFound error result is returned.

Do you find this information helpful? Please log in to provide feedback.

Last updated: Dec 11, 2020

Recommended reading