Loading...
Area: Episerver B2B Commerce

Orders API handler

Recommended reading 

HTTP Verb: GET

URL: /api/v1/orders

Description: Return a collection of orders

Base: HandlerBase<GetOrderCollectionParameter, GetOrderCollectionResult>

Handlers:

Order Handler

Description

500 GetRealTimeOrderCollectionHandler

If this is not a real time request (checks the application setting "RealTimeCallsEnabled" and "Web_UseRealTimeOrderHistory"), then moves on to the next handler. If there are no job definitions for real time orders or job definition steps or job definition step parameters that have a customer number prompt, then a Not Found error message is returned. Otherwise gets the collection of orders from running the real time job. If none are returned, then Not Found error message is returned.

550 GetStoredOrderCollectionHandler

If this is a real time request, then just moves on to the next handler. Otherwise, gets a collection of orders based on "ERP_LookBackDays" and paging/filtering values.

 

HTTP Verb: GET

URL: /api/v1/orders/{orderid}

Description: Return a single order record

Base: HandlerBase<GetOrderParameter, GetOrderResult>

Handlers:

Order Handler

Description

500 GetRealTimeOrderHandler

If this is not a real time request (checks the application setting "RealTimeCallsEnabled" and "Web_UseRealTimeOrderHistory"), then moves on to the next handler. If there are no job definitions for real time orders or job definition steps or job definition step parameters that have a customer number prompt or job definition step parameters for an order number prompt, then a Not Found error message is returned. Otherwise gets the order from running the real time job for the matching ordered/ordernumber.

550 GetStoredOrderHandler

If this is a real time request, then just moves on to the next handler. Otherwise, gets a collection of orders based on the matching ordered/ordernumber and bill to customer.

 

HTTP Verb: GET

URL: /api/v1/orders/{orderid}

Description: Return a single order record

Base: HandlerBase<GetOrderParameter, GetOrderResult>

Handlers:

Order Handler Description
500 GetSettings Populate IsRealTime, ReturnReasons and GetOrderLines properties of the result object
600 GetRealTimeJobDefinition Gets real time order historydetail integration job and sets its parameters, if IsRealTime equals "true".
700 ExecuteRealTimeJob Executes real time order history detail integration job and save result dataset to RealTimeDataSet property on the result object, if IsRealTime equals "true".
800 MapRealTimeDataSet Parses OrderHistory and OrderHistoryLine dataset's tables and creates OrderHistory and OrderHistoryLine lists, which are saved as OrderHistory property, if IsRealTime equals "true".
900 GetStoredOrderHistory Gets OrderHistory with OrderHistoryLine by OrderNumber and current customer number, save it to OrderHistory property and populate ShipViaDescription if OrderHistory has ShipCode, if IsRealTime equals "false".
1000 GetLines If GetOrderLines property of the parameter object equals "true", maps OrderHistoryLines to GetOrderLineResults property on the result object and populates CanAddToCart, CanAddAllToCart, ShowTaxAndShipping properties of the result object.
1100 GetShipments If GetShipments property of the parameter object equals "true", populates Shipments property of the result object by order history ErpOrderNumber or WebOrderNumber using shipmentService.
1200 GetCurrency Populate Currency property on the result object by OrderHistory's CurrencyCode.
1300 GetStatusMapping Populate OrderStatusMapping property on the result object by OrderHistory's Status.
1400 CopyCustomPropertiesToResult Copy order history custom properties and order history lines custom properties to the result object.

 

HTTP Verb: GET

URL: /api/v1/orders

Description: Return a collection of orders

Base: HandlerBase<GetOrderCollectionParameter, GetOrderCollectionResult>

Handlers:

Order Handler Description
500 GetSettings Populate IsRealTime, ShowErpOrderNumber and GetOrderLines property of the result object
600 GetRealTimeJobDefinition Gets real time order history integration job and sets its parameters, if IsRealTime equals "true".
700 ExecuteRealTimeJob Executes real time order history integration job and save result dataset into RealTimeDataSet property of the result object, if IsRealTime equals "true".
800 MapRealTimeDataSet Parses OrderHistory and OrderHistoryLine dataset's tables and creates OrderHistory and OrderHistoryLine lists, which are saved as OrdersQuery property, if IsRealTime equals "true".
900 GetStoredCollectionQuery Gets all OrderHistories with OrderHistoryLines, which belong to current customer, and save them to OrdersQuery, if IsRealTime equals "false".
1000 ApplyFilteringToStoredCollectionQuery

Filters the OrdersQuery, if specified in the parameter and IsRealTime equals "false".

if StatusCollection property has any statuses, returns OrderHistories if StatusCollection contains their statusif OrderNumberproperty has value, returns OrderHistories if their order number equals OrderNumber propertyif OrderNumber property has value, returns OrderHistories if their order number equals OrderNumber propertyif CustomerPO property has value, returns OrderHistories if their CustomerPO equals CustomerPO propertyif CustomerSequence property doesn't equal "-1", returns OrderHistories if their CustomerSequence equals CustomerSequence property or emptyif ToDate property has value, returns OrderHistories if their OrderDate less or equals ToDate propertyif FromDate property has value, returns OrderHistories if their OrderDate more or equals FromDate propertyif OrderTotalOperator property has value, returns OrderHistories if their OrderTotal meets OrderTotalOperator propertyif Search property has value, returns OrderHistories if their properties contain Search property
1100 ApplySort Applies a sort to the OrdersQuery. The query is sorted using the Sort property on the parameter object (in ascending order), otherwise the query is sorted by OrderDate (in descending order).
1200 ApplyPaging Applies paging to the OrdersQuery. 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 OrdersQuery after the query has been filtered, sorted, and paged. The result is stored in the OrderHistoryCollection property on the result object.
1400 CreateGetOrderResults If OrderHistoryCollection property on the result object has values, they are transformed into a collection of OrderHistoryCollection objects using the GetOrderHandler handler. The result is stored in the GetOrderResults property on the result object.

HTTP Verb: GET

URL: /api/v1/orders/{orderid}?expand=shipments

Description: Gets the shipments for the order.

Base: HandlerBase<GetShipmentCollectionParameter, GetShipmentCollectionResult>

Handlers:

Order Handler Description
500 GetShipmentQuery Creates the shipment query that returns list of shipments by WebOrderNumber or ErpOrderNumber. The query is stored in the ShipmentQuery property on the result object.
600 ApplySort Applies sorting to the ShipmentQuery property on the result object. If the Sort property on the parameter object has a value, the query will be sorted with that value. If the Sort property is empty, the query will be sorted by the ShipmentNumber property.
700 ApplyPaging Applies paging to the ShipmentQuery. 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.
800 ExecuteQuery Executes the ShipmentQuery after the query has been expanded, filtered, sorted, and paged. The result is stored in the Shipments property on the result object.
900 CreateShipmentDtos If the Shipments property has values on the result object, they are transformed into a collection of getShipmentResult objects using the shipmentService. The result is stored in the ShipmentDtos property on the result object.

HTTP Verb: PATCH

URL: /api/v1/orders/{orderid}

Description: Updates a single order

Base: HandlerBase<UpdateOrderParameter, UpdateOrderResult>

Handlers:

Order Handler Description
500 UpdateOrder Retrieves an order using the OrderNumber property on the parameter object. If a order is not found, an error is returned. If parameter object has Status property, updates order status. Retrieves OrderStatusMapping according to the status. The order is stored in the OrderResult property on the result object.

 

HTTP Verb: POST

URL: /api/v1/orders/{orderid}/returns

Description: Creates and sends an RMA request email

Base: HandlerBase<AddRmaParameter, AddRmaResult>

Handlers:

Order Handler Description
500 AddRmaHandler If there is no logged in user or customer then Not Found error result is returned. If there are any invalid rma order lines, then validation messages are returned. Otherwise, creates and sends an email with the RMA request.
Order Handler Description
500 ValidateContext Validates UserProfileDto or Customer is not null in site context, otherwise return NotFound
600 ValidateRma Validates each RMA line quantity and also reasonCode, if code is required.
700 PopulateEmailModel Populates EmailModel property on the result object by order's and orderLines' information.
800 SendEmail Sends "Request RMA" email using email service.
Do you find this information helpful? Please log in to provide feedback.

Last updated: Dec 11, 2020

Recommended reading