WebSphere Commerce Enterprise

Calculate order

The CalculateOrder outbound service interface is used to calculate charges for an order in the external system. The request BOD usually comes from inbound GetOrder service (IBM_Details) and contains both order level information and order item level information. The expected response business object document (BOD) contains order calculation results, including order amount.

Request

A request to this outbound service interface is a ProcessOrder BOD with the action code CalculateOrder. The definition of the ProcessOrder BOD can be found in the XML schema file WC_eardir/WebServicesRouter.war/component-services/xsd/OAGIS/9.0/Overlays/IBM/Commerce/BODs/ProcessOrder.xsd. The service data object (SDO) interface of the ProcessOrder BOD is com.ibm.commerce.order.datatypes.ProcessOrderType.

Response

The response to a successful request is an AcknowledgeOrder BOD with no response criteria. The XML schema of the AcknowledgeOrder BOD can be found in the XML schema file WC_eardir/WebServicesRouter.war/component-services/xsd/OAGIS/9.0/Overlays/IBM/Commerce/BODs/AcknowledgeOrder.xsd. The service data object (SDO) interface of the AcknowledgeOrder BOD is com.ibm.commerce.order.datatypes.AcknowledgeOrderType.

Message type

This outbound service interface is mapped to the message type com.ibm.commerce.order.external.

Usage scenario

When an order's cost needs to be calculated during the shopping flow com.ibm.commerce.order.commands.OrderCalculateCmd is called. For example, when a shopper fills in shipping and billing information and then clicks the Next button, theOrderPrepareCmd is called and calls the OrderCalculateCmd. The implementation of OrderCalculateCmd in this integration model is com.ibm.commerce.order.commands.ExternalOrderCalculateCmdImpl. The OrderCalculateCmd calls the CalculateOrder service using the following steps:
  1. OrderCalculateCmd calls the inbound GetOrder Service to compose the order noun from the local database by the order id. The method of façade client used is com.ibm.commerce.order.facade.client.OrderFacadeClient.findByOrderId(String[] orderIdTypes, boolean isSummary).
  2. OrderCalculateCmd calls the outbound service with the action code CalculateOrder to calculate the order in the external system. The facade client method used to call the outbound service is com.ibm.commerce.order.facade.server.external.ExternalOrderFacadeClient.calculateOrder(OrderType order).
  3. OrderCalculateCmd gets the calculation result from response and saves the result to a local database.
Note: ExternalOrderCalculateCmdImpl.performExecute() is a recommended extension point to customize the invocation to the outbound CalculateOrder service.