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 sections describe each processor in the pipeline chain.
verifyApproval
This processor checks whether the given order has already been approved.
Transactional mode: TX_MANDATORY
Nucleus component: /atg/commerce/approval/processor/VerifyApproval
PipelineProcessor object: atg.commerce.approval.processor.ProcVerifyApproval
Transitions: Returns a value of 0 (STOP_CHAIN_EXECUTION_AND_COMMIT) if the order has already been approved; this stops execution of the approveOrder chain and resumes the processOrder chain to complete checkout. Returns a value of 1 if the order has not already been approved; this executes the next processor, runCheckRequiresApprovalChain.
runCheckRequiresApprovalChain
This processor executes the checkRequiresApproval pipeline chain. The properties file for the /atg/commerce/approval/processor/RunCheckRequiresApproval component specifies checkRequiresApproval in the chainToRun property.
Transactional mode: TX_MANDATORY
Nucleus component: /atg/commerce/approval/processor/RunCheckRequiresApprovalChain
PipelineProcessor object: atg.commerce.order.processor.ProcExecuteChain
Transitions: Returns a value of 0 (STOP_CHAIN_EXECUTION_AND_COMMIT) if the order does not require approval; this stops execution of approveOrder so the order can proceed through checkout. Returns a value of 1 if the order requires approval; this executes the next processor, addApproverIdsToOrder.
addApproverIdsToOrder
This 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 approvers profile property and is added to the order’s authorizedApproverIds property.
If the customer’s approvers profile property is unset and the AddApproverIdsToOrder.allowCheckoutIfApproversNotDefined property is set to false (which it is by default), then an ApprovalException is thrown.
Transactional mode: TX_MANDATORY
Nucleus component: /atg/commerce/approval/processor/AddApproverIdsToOrder
PipelineProcessor object: atg.commerce.approval.processor.ProcAddApproverIdsToOrder
Transitions: Return value of 1 executes changeOrderToPendingApproval next. However, if the customer’s approvers profile property is unset and the AddApproverIdsToOrder.allowCheckoutIfApproversNotDefined property is set to true, the processor returns a value of 0 (STOP_CHAIN_EXECUTION_AND_COMMIT); this stops execution of approveOrder so the order can proceed through checkout.
changeOrderToPendingApproval
This processor sets the order’s state to PENDING_APPROVAL.
Transactional mode: TX_MANDATORY
Nucleus component: /atg/commerce/approval/processor/ChangeOrderToPendingApproval
PipelineProcessor object: atg.commerce.order.processor.ProcChangeOrderState
Transitions: Return value of 1 executes addApprovalSystemMessagesToOrder next.
addApprovalSystemMessagesToOrder
This 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 approvalSystemMessages property. The system messages are defined by the processors in the checkRequiresApproval pipeline chain.
Transactional mode: TX_MANDATORY
Nucleus component: /atg/commerce/approval/processor/AddApprovalSystemMessagesToOrder
PipelineProcessor object: atg.commerce.approval.processor.ProcAddApprovalSystemMessagesToOrder
Transitions: Return value of 1 executes saveOrder next.
saveOrder
This processor saves the order in its present state to the Order Repository.
Transactional mode: TX_MANDATORY
Nucleus component: /atg/commerce/order/processor/UpdateOrder
PipelineProcessor object: atg.commerce.order.processor.ProcUpdateOrder
Transitions: Return value of 1 executes sendApprovalRequiredMessage next.
sendApprovalRequiredMessage
This processor sends a message to the /Approval/Scenarios JMS 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/SendApprovalRequiredMessage
PipelineProcessor object: atg.commerce.approval.processor.ProcSendApprovalRequiredMessage
Transitions: None. This is the last processor in the pipeline, which causes the ApprovalPipelineManager to return to the caller.

