6.0.0.2 Prepare an order
This service calculates charges, performs inventory actions, and locks the price of the order to indicate that the order can be submitted. Before using this service, the client must have a reference to the order facade client, a shopping cart must exist on the server side, and there must be some payment instructions.
Usage scenario
- The client calls the order facade client method prepareOrder() with the parameters(orderId) parameter.
- The OrderFacadeClient composes an SDO then calls the ProcessOrder service using the action code Prepare.
- WebSphere Commerce Server prepares the order.
- The order component responds with an AcknowledgeOrder BOD with order Id.
Request
Request BOD prepareOrder business object document (BOD) Schema Order-DataObjects/xsd/OAGIS/9.0/Overlays/IBM/Commerce/BODs/ProcessOrder.xsd Service data object com.ibm.commerce.order.facade.datatypes.ProcessOrderType
Sample request BOD
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken><wsse:Username>wcsadmin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">passw0rd</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><_ord:ProcessOrder xmlns:Oagis9="http://www.openapplications.org/oagis/9" xmlns:_ord="http://www.ibm.com/xmlns/prod/commerce/9/order" xmlns:_wcf="http://www.ibm.com/xmlns/prod/commerce/9/foundation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Oagis9:ApplicationArea xsi:type="_wcf:ApplicationAreaType"> <Oagis9:CreationDateTime>2007-04-24T11:00:31.078Z</Oagis9:CreationDateTime> <Oagis9:BODID>f622d230-f20f-11db-bad0-8232462d727f</Oagis9:BODID> <_wcf:BusinessContext> <_wcf:ContextData name="storeId">10001</_wcf:ContextData> </_wcf:BusinessContext> </Oagis9:ApplicationArea> <_ord:DataArea> <Oagis9:Process> <Oagis9:ActionCriteria> <Oagis9:ActionExpression actionCode="Prepare"/> </Oagis9:ActionCriteria> </Oagis9:Process> <_ord:Order> <_ord:OrderIdentifier> <_wcf:UniqueID>18501</_wcf:UniqueID> </_ord:OrderIdentifier> </_ord:Order> </_ord:DataArea> </_ord:ProcessOrder></soapenv:Body></soapenv:Envelope>
Response
The response is the AcknowledgeOrder BOD with order ID.
Response BOD AcknowledgeOrder Schema Order-DataObjects/xsd/OAGIS/9.0/Overlays/IBM/Commerce/BODs/AcknowledgeOrder.xsd Service data object
com.ibm.commerce.order.facade.datatypes.AcknowledgeOrderTypeThe response contains the following information:
/Order/OrderIdentifier/UniqueID
Sample response BOD
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><_ord:AcknowledgeOrder xmlns:_ord="http://www.ibm.com/xmlns/prod/commerce/9/order" xmlns:_wcf="http://www.ibm.com/xmlns/prod/commerce/9/foundation"> <_ord:DataArea> <_ord:Order> <_ord:OrderIdentifier> <_wcf:UniqueID>18501</_wcf:UniqueID> </_ord:OrderIdentifier> </_ord:Order> </_ord:DataArea> </_ord:AcknowledgeOrder></soapenv:Body></soapenv:Envelope>
Exceptions
If there is something wrong with the parameter, the Order component fails to prepare the Order. The Order component responds with an AcknowledgeOrder BOD with ChangeStatus, which indicates that the action failed.
See the exception conditions for
OrderPrepare URL.
Customization
The following extensions are supported:
- Extend the methods buildOrderIdentifier of OrderFacadeClient to handle the input parameters.
- Extend the command
AcknowledgeOrderBuildCmdImpl to populate information into the response.- Customize the messaging mapping file ProcessOrderSOIBODMapping.xml, find the section:
<Command CommandName="com.ibm.commerce.order.commands.OrderPrepareCmd" Condition='actionCode="Prepare"'> <Constant Field="URL">NoURL</Constant> <Constant Field="ReUrl">NoReURL</Constant> <Constant Field="reverse">*n</Constant> <Constant FieldInfo='CONTROL' Field='flattenMessageClass'>com.ibm.commerce.messaging.programadapter.messagemapper.ecsax.ECSAXOrderMessageFlattener</Constant> <Constant FieldInfo='CONTROL' Field='responseCommand'>com.ibm.commerce.order.facade.server.commands.AcknowledgeOrderBuildCmdImpl</Constant> <Constant FieldInfo='CONTROL' Field='errorCommand'>com.ibm.commerce.order.facade.server.commands.AcknowledgeOrderErrorBuildCmdImpl</Constant> </Command>Replace AcknowledgeOrderBuildCmdImpl with a new command that extends AcknowledgeOrderBuildCmdImpl.
Related concepts
Service Data Objects (SDO)
Related Reference
WebSphere Commerce services
Order services
GetData tag configuration