Skip to main content

Order Service

The Order Service handles actions such as creating, updating, and canceling orders. To perform these actions, it relies on the integrations with OmnitronIntegration and ChannelIntegration.

class OrderService (object)

Fetch and Create Order

(self, is_success_log=True)

This function first connects to the Sales Channel and fetches any existing orders. Afterward, it sends the orders to Akinon via the create_order function. If an error occurs during the process, an error_report is generated in the Sales Channel logs.

Create Order

(self, omnitron_integration: OmnitronIntegration, channel_order: ChannelCreateOrderDto) → Union[Order, None]

This function enables the transfer of orders from the Sales Channel to Akinon. It sequentially writes the customer and address information from the Sales Channel to Akinon, capturing the responses returned. It also reads the corresponding shipping carrier information from Akinon, ensuring that all the necessary details for creating the order are collected. Finally, the order information is sent to Akinon.

Update Orders

(self, is_sync=True, is_success_log=True)

This function first connects to Akinon Omnitron and fetches the updated orders that can be transmitted to the Sales Channel. Afterward, it sends these orders to the Sales Channel via the send_updated_orders command. Based on the value of the is_sync parameter, it determines whether the communication with the Sales Channel will be synchronous or asynchronous. If asynchronous, the necessary records are created via the batch_service. If an error occurs during the process, an error_report is generated in the Sales Channel logs.

Get Order Batch Requests

(self, is_success_log=False)

This function first connects to Akinon Omnitron and retrieves the batch_requests that have been sent to create or update orders and are currently in process. It then queries the Sales Channel using the check_orderscommand. If an error occurs during this process, an error_report is generated in the Sales Channel logs. Finally, the response from the Sales Channel is forwarded to Akinon Omnitron, completing the flow.

Fetch and Create Cancel

(self, is_success_log=True)

This function first connects to the Sales Channel and retrieves any canceled orders. It then sends the cancellations to Akinon via the create_cancel function. If an error occurs during this process, an error_report is generated in the Sales Channel logs.

Create Cancel

(self, omnitron_integration: OmnitronIntegration, cancel_order_dto: CancelOrderDto)

This function enables the transfer of order cancellations from the Sales Channel to Akinon. It sends the cancellations to Akinon through the create_order_cancelcommand, passing the relevant order cancellations as parameters.

Fetch and Update Order Items

(self, is_success_log=True)

This function first connects to the Sales Channel and fetches the updated orders. It then sends the updates to Omnitron via the update_order_items command, updating the details on an OrderItem basis. If an error occurs during this process, an error_report is generated in the Sales Channel logs.