Sales Order API
home
Sales Order API
This API is used for creating sales orders for partner facilities as well as patient sales orders.
Introduction
The Sales Order API allows to create/update/get details from ICS account. API is secured by OAuth authentication, allowing customer to access records for specific facility depending on the API use case:
- Fetch Sales Order details.
- Create Sales Order for partner facilities or for patient sale.
- Update Sales Order.
Overview
The Sales Order API has below endpoints,
/ping: This endpoint returns API health.
This endpoint consists of GET method, which gives the health status of the API.
/SalesOrder: This endpoint returns transfer details from the ICS.
This endpoint consists of GET, PUT methods, these are used to fetch, create/update the Sales Orders in ICS system.
GET: This method returns Sales Order details by using below query parameters.
- sourceSystem: It is mandatory parameter used for querying the SalesOrder details.
- sourceSystemSalesOrderId: This is an external (source) salesOrder Ids used for querying the SalesOrder details.
- icsSalesOrderId: This is the ICS transfer ID generated by the ICS system. This is an optional field.
- pageNumber: It is an optional field used for querying the SalesOrder details with specific page number.
- toDate & fromDate: These are optional parameters to extract sales order based on specific creattion date range in ICS system.
PUT: This method creates/updates SalesOrder details in ICS system.
Key features and benefits
The following are features and benefits of the Sales Order API:
- Provides access to Sales Order data based on client id and source system code.
- Puts customers in control of their data sharing permissions and grants through API Security.
- Data validation against while modifying orders.
- No PII or secure information is logged during transaction.
How it works
The following diagram illustrates how the Sales Order API works.
- The customer sends client ID and Secret requesting authorization token from Mule OAuth provider API.
- Send the security token with valid JSON request to Sales Order endpoint.
- If the access is successful, API will perform the operations and create/update/get the records to/from ICS.
- Response from ICS is captured and return to source system.
- If any error in the flow or validation error, Mule API handles and reverts the specific error with the customer along with standard error codes.
Validations
The following are the validations for data transformation in Sales Orders API.
- sourceSystem and sourceSystemSalesOrderId are mandatory parameters while SO creation.
- order Items is mandatory in Sales order and payment Information is optional.
- icsPackageId is mandatory for pharmacy sales order and it is optional for cultivators and processors.
- Cultivators/processors can either pass icsPackageId or itemProduct values in order item.
- For pharmacy, package must have packageSize and valid test result.
- If package is used at order item level, package quantity is reserved while order status is in progress. It gets reduce to zero after receive transfer is complete.
- Order item quantity and package remaining quantity should match while creating the order.
- Order Item quantity cannot be more than package quantity.
- Tax information is optional for all facilities, however valid tax name along with either tax rate or tax amount to be passed in input.
- If facility is using credit memo for payment, it should be valid.
Use cases
The Sales Order API supports data access for the following use cases.
Use cases | Examples |
---|---|
GET - Fetch Sales Order details | customer can fetch all Sales Order details using sourceSystem and date range |
GET - Fetch Sales Order details with specific query parameters | customer can fetch a particular Sales Order detail with sales order number. |
PUT - Create Sales Order record | customer can create a Sales Order record with valid JSON request along with paymentInfo and OrderItems. |
PUT - Update Sales Order record | customer can update a Sales Order record with specific changes by using sourceSystemSalesOrderId. - Can update Sales Order related information. - Can consist of single or multiple payment information records and order item records. |