Tuesday, May 17, 2011

WebSphere Commerce Order Flow process

WCS Order management flow
Place an order.
  • A customer(use store front) or an administrator(Use accelerator/MC) who has the authority to act on behalf of the customer places an order with the store.
  • While adding items to shopping cart order status will be Pending state
Check out:
  • After the shopper completes the order checkout sequence, the order moves from a Pending state (P) to M state (pending payment approval). Here the order can also go into the state of M or C (for some payment method) or L (no inventory and no back order) or B (some backordered orderitems).
  •  When the order checkout sequence is complete the order moves to one of the following states:
    •  A:Payment authorization requires review
    •  B:Backordered
    •  C:Payment authorization complete
Order Approval
  • B2B required Order Approval , B2C not required
  • Approve payment for the order, if required. Payment methods such as COD (Cash on Delivery) and Bill Me do not need approval.
Order Process
  • If the order contains products that are to be backordered, then it moves to state B (backordered).
  • Orders can be backordered with the command ProcessBackorders, or by a scheduler.
  • For reauthorization, the order goes back to state M or a state such as A, I, B, or C. After a backorder is approved, it should be allocated and not reordered, or else it may go back for approval again.
  • Order process includes following task -using accelerator
    • Finding Order
    • Change the quantity of the product in the order
    • Changing the purchase order number for an order in a B2B direct store
    • Add/Remove a product to an order
    • Selecting another shipping address/Shipping method/billing address for an order
    • Changing the total price of an order
    • Editing an order level adjustment
    • Changing the payment options/payment processing for an order
    • Add comments
    • View -Order summary/payment status/Order invoice
    • Cancel the orders
    • Apply Order Blocks
Order Release:
  • Release the order to fulfillment. The Scheduler Job ReleaseToFulfillment releases the orders to fulfillment.
  • When all order items for the order are released, the order moves to state R (Released).
Order Fullfillment:
  • Create a pick batch for all orders released to the specified fulfillment center using Websphere commerce Accelerator
  • View and print pick tickets.
  • View and print packaging slips.
  • Pick and pack products specified in the pick ticket and packing slip.
  • Create package.
  • Ship goods. Ship the order to the customer. (No action from wcs)
Order Completion:
  • Confirm shipment has been sent. When all order items are shipped, the order moves to S (Shipped) status.
  • Finalize the order.
    • The BalancePayment scheduled job initiates payment deposit. The order state moves to D (Deposited).
    • The OrderClose checks whether the shipped order is totally deposited. If YES, the order status is changed to 'D';
    • OrderPaymentSynchronize:Checks whether the order is totally authorized. If YES, the order status is changed to 'C'
Note:
Order Process flow another look
http://www.albeesonline.com/blog/category/websphere/websphere-commerce-websphere/

Some Order Command tips:

OrderItemAddCmdImpl
Call ResolveSKUCmdImpl:
+--Check the product attributes and based on that values locate the items , which is ready for order
  -check catentry is buyable or not
  -Check customer is entitlement to buy this catentry id
  -if all above params correct contine
  -if fails but continue=1 then skip to next order
  -if orderitemId is provided update the
  -if partnum/catentry provided new orderitem id
  -if address_id not specified use default(P,nickname)
  -if quantity is 0 delete
  -if shipmod id not availabnle use default
  -Call GetContractUnitPriceCmd to calcuate the price
-OrderItemUpdateCmdImpl
-OrderCreateCmdImpl
-UpdateShippingAddressCmd
+--call findAddressIdForOrderItem() to find the shipping address for orderitem
+--call ValidateOrderAddressCmd to validate billingaddress and shipping address
+--updateShippingAddress() 
-ValidateTradingPaymentCmd
+--This command checks whether the payment method to be added comply with the BOPIS (Buy Online Pick In Store) rules. 
-DoInventoryActionCmd
+--To do all inventory operations
+--There are 10 usages identified as interfaces between the order commands and this interface command.
+--For every usage, different parameters are required
+--Action and parameters together will help to do further processing
-UpdateShipInfoCmdImpl
+--Update SHIPINFO table(ship carrier act number,ship charge type,ship instructions,ship mod)
-RaiseOrderEventCmdImpl
+--This Order task command is used to raise an order related event
+--raiseOrderCancellationEvent()
+--raiseOrderItemUpdateEvent()
 OrderCalculateCmdImpl

This command is called by OrderItemBaseCmdImpl and OrderItemDeleteCmdImpl to refresh the order price, charges and freebie items after Add, Update and Delete order item.
The default implementation of this command is OrderCalculateCmdImpl. But in out-of-the-box CMDREG table, the implementation of this command is mapped to PromotionEngineOrderCalculateCmdImp

-Unlock the order
-initialize the specified CalculationUsages that are enabled
-if RulesBasedDiscount component is enabled
-call discount service to obtain the list of catalogentry to add to order
-if ATP is disabled and there is insufficient inventory
-remove catalogentry from the list
-add catalogentry identifier to outOfInventoryCatalogEntryId list
-Recalculate specified calculation usages
-call the OrderItemAdd
-update the productTotal attributes of the Order and its OrderItems
-update the SubOrders for the Order
-apply the specified CalculationUsages that are enabled
-summarize the specified CalculationUsages that are enabled
-Finally, call the setResponseProperties() method.
-ResolveOrderCmd
-Promotion engine to determine the catalog entries to add
-Recalculate Order
 OrderPrepareCmdImpl
  -prepare order by
  -determine prices
  -discounts
  -shipping charges
  -shipping adjustment
  -taxes
  -Lock the order(1)
  -ensure all orderitems are buyable
  -update order item address
  -update order item validation
  -update order item prices
  -update order item total
  -update auto added order items
  -check order inventory
 OrderProcessCmdImpl

 OrderPrepareCmdImpl
  -Prepares the orders for Display(OrderDisplayCmd)
  -Prepares the orders for OrderProcess
  -if no orderId then use Current pending order
  -Default error view OrderNoneErrorView
  -if commit=1 start new db transaction for every order
  -status should P WINE (bipins formula :)
  -Call PrepareOrder task command
  --Delete generated orderitems(PREPAREFLAG)
  --check CATENTRY.BUYABLE=1
  --If ATP inventory allocation is enabled/disabled, call the DoInventoryActionCmd
  --Call the ValidateDynamicKitConfiguration task command.
  --Obtain new unit price(GetContractSpecialPrice/GetBaseSpecialPrice)
  --Do not refresh prices for order items whose prepareFlags attributes specify "quotation
  -prepare order by
  -determine prices
  -discounts
  -shipping charges
  -shipping adjustment
  -taxes
  -lock the order
  -ensure all orderitems are buyable
  -update order item address
  -update order item validation
  -update order item prices
  -update order item total
  -update auto added order items
  -check order inventory