The approveOrder pipeline determines whether the given order already is approved. If the order isn’t already approved, it determines whether an approval for the order is required.
The approveOrder pipeline chain is executed by the executeApproveOrderChain processor in the processOrder pipeline chain. The approveOrder() method adds the given Order and the ApprovalPipelineManager to its parameter list, which is supplied to the executing chain. The pipeline chain’s transaction mode is TX_REQUIRED.
The following list describes each processor in the pipeline chain:
PipelineLink name:
verifyApprovalThis processor checks whether the given order has already been approved.
Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/VerifyApprovalPipelineProcessor object:
atg.b2bcommerce.approval.processor.ProcVerifyApprovalTransitions: Returns a value of 0 (STOP_CHAIN_EXECUTION_AND_COMMIT) if the order has already been approved; this stops execution of the
approveOrderchain and resumes theprocessOrderchain to complete checkout. Returns a value of 1 if the order has not already been approved; this executes the next processor,runCheckRequiresApprovalChain.PipelineLink name:
runCheckRequiresApprovalChainThis processor executes the
checkRequiresApprovalpipeline chain. The properties file for the/atg/commerce/approval/processor/RunCheckRequiresApprovalcomponent specifiescheckRequiresApprovalin thechainToRunproperty.Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/RunCheckRequiresApprovalChainPipelineProcessor object:
atg.commerce.order.processor.ProcExecuteChainTransitions: Returns a value of 0 (STOP_CHAIN_EXECUTION_AND_COMMIT) if the order does not require approval; this stops execution of
approveOrderso the order can proceed through checkout. Returns a value of 1 if the order requires approval; this executes the next processor,addApproverIdsToOrder.PipelineLink name:
addApproverIdsToOrderThis processor adds to the order the list of profile IDs for the users who can approve the customer’s order. This list is obtained from the customer’s
approversprofile property and is added to the order’sauthorizedApproverIdsproperty.If the customer’s
approversprofile property is unset and theAddApproverIdsToOrder.allowCheckoutIfApproversNotDefinedproperty is set to false (which it is by default), then anApprovalExceptionis thrown.Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/AddApproverIdsToOrderPipelineProcessor object:
atg.b2bcommerce.approval.processor.ProcAddApproverIdsToOrderTransitions: Return value of 1 executes
changeOrderToPendingApprovalnext. However, if the customer’sapproversprofile property is unset and theAddApproverIdsToOrder.allowCheckoutIfApproversNotDefinedproperty is set to true, the processor returns a value of 0 (STOP_CHAIN_EXECUTION_AND_COMMIT); this stops execution ofapproveOrderso the order can proceed through checkout.PipelineLink name:
changeOrderToPendingApprovalThis processor sets the order’s state to PENDING_APPROVAL.
Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/ChangeOrderToPendingApprovalPipelineProcessor object:
atg.commerce.order.processor.ProcChangeOrderStateTransitions: Return value of 1 executes
addApprovalSystemMessagesToOrdernext.PipelineLink name:
addApprovalSystemMessagesToOrderThis processor adds to the order the list of system messages that correspond to the conditions that triggered an approval being required. An example might be “order limit exceeded.” This list is added to the order’s
approvalSystemMessagesproperty. The system messages are defined by the processors in thecheckRequiresApprovalpipeline chain.Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/AddApprovalSystemMessagesToOrderPipelineProcessor object:
atg.b2bcommerce.approval.processor.ProcAddApprovalSystemMessagesToOrderTransitions: Return value of 1 executes
saveOrdernext.PipelineLink name:
saveOrderThis processor saves the order in its present state to the Order Repository.
Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/order/processor/UpdateOrderPipelineProcessor object:
atg.commerce.order.processor.ProcUpdateOrderTransitions: Return value of 1 executes
sendApprovalRequiredMessagenext.PipelineLink name:
sendApprovalRequiredMessageThis processor sends a message to the
/Approval/ScenariosJMS message topic; the message includes the order requiring approval and the profile repository item for the customer associated with the order. The message can then be used to execute scenarios.Transactional mode: TX_MANDATORY
Nucleus component:
/atg/commerce/approval/processor/SendApprovalRequiredMessagePipelineProcessor object:
atg.b2bcommerce.approval.processor.ProcSendApprovalRequiredMessageTransitions: None. This is the last processor in the pipeline, which causes the
ApprovalPipelineManagerto return to the caller.

