When the PaymentManager’s authorize/credit/debit method is called, it takes the Order and a single PaymentGroup or List of PaymentGroups as parameters. It then calls its authorize/credit/debit method that takes an additional amount parameter, passing in the amount in the current PaymentGroup. This second authorize/credit/debit method performs the actual payment operation for the current PaymentGroup by looking up the pipeline appropriate for the current PaymentGroup class type and then calling that pipeline.

To obtain the appropriate pipeline to run, the authorize/credit/debit method calls getXXXChainName(PaymentGroup), for example, getCreditChainName(PaymentGroup). In turn, this method calls getChainName(PaymentGroup), which uses the class name of the given PaymentGroup as the key to look up the appropriate pipeline to run in PaymentManager.paymentGroupToChainNameMap. This property stores a map of PaymentGroup class types to the names of the pipelines that perform the payment actions for the payment methods. By default, this property is configured as follows:


Thus, the creditCardProcessorChain pipeline handles authorization, debit, and credit work for the atg.commerce.order.CreditCard class, the giftCertificateProcessorChain pipeline handles authorization, debit, and credit work for the atg.commerce.order.GiftCertificate class, and so on.

By default, each of the pipelines in PaymentManager.paymentGroupToChainNameMap is composed of two processors. The first processor aggregates the necessary information for performing the requested payment action (for example, CREDIT) and creates an XXXInfo object (for example, CreditCardInfo) for use in that action. The second processor performs the actual operation – authorizing, debiting, or crediting the appropriate payment method. Note that while a single pipeline exists to perform authorize, debit, and credit actions for a single PaymentGroup type, you can split these actions into separate pipelines if your processing needs for a given payment action are unusual.

Once the appropriate pipeline to run has been obtained (for example, the creditCardProcessorChain pipeline), the authorize/credit/debit method calls into the PaymentPipelineManager to execute the pipeline. It passes in the PaymentManagerPipelineArgs Dictionary object as an argument to the runProcess() method of the pipeline. This Dictionary object contains the information required to perform the transaction, which is as follows:

The PaymentStatus object represents the results of the authorize, credit, or debit transaction performed by the pipeline; it contains properties such as amount, errorMessage, transactionId, transactionSuccess, and transactionTimestamp. When the PaymentManager’s authorize/credit/debit method is called, the method performs the payment operation and then adds a PaymentStatus object to the given PaymentGroup. The PaymentStatus object is discussed in more detail at the end of this section.

Note: The PaymentManager is also used by the Fulfillment system. For information about the Fulfillment system, see the Configuring the Order Fulfillment Framework chapter.