Friday, February 28, 2014

Simple Way To Create Payment Group : ATG

 

Creating a Payment Group



A PaymentGroup contain information about the payment method that will be used to purchase a group of commerce items.


1. By default, a new Order has one default PaymentGroup.

2. As items are added to the Order, these items automatically become part of the default      PaymentGroup.

3. Once a second PaymentGroup is added to the Order, all the items in the Order are removed from the default PaymentGroup and must be explicitly added to one of the two payment groups.

4. Relationships must now be created to associate the items with payment groups.

5. Payment groups also contain a requisitionNumber property for orders that require approval before a means of payment can be specified.

6. Orders with requisition numbers are automatically assumed to require approval.



Follow these steps to create a new PaymentGroup and add it to an Order:



1. Call PaymentGroupManager.createPaymentGroup().

2. Make any changes to the PaymentGroup. For example, you could set the credit card number and expiration date.

3. Call PaymentGroupManager.addPaymentGroupToOrder(pOrder, pPaymentGroup) to add the payment group to the order.


Refer to the following example:



// Get a reference to the OrderManager
OrderManager orderManager = (OrderManager)
             request.resolveName("/atg/commerce/order/OrderManager");


// Create the PaymentGroup
PaymentGroup paymentGroup = paymentGroupManager.createPaymentGroup();

// Add the PaymentGroup to the Order
paymentGroupManager.addPaymentGroupToOrder(pOrder, paymentGroup);


Tips For Creating Multiple Payment Groups



1. Multiple payment groups (which implement Multipayment) on a commerce site permit a customer to split the cost of an order by amount and/or items. For example, suppose a customer begins the checkout process on a site that supports multiple payment methods for a single order. The customer chooses to partition payment by putting the first $1000 of a $1250 order on a Visa credit card. The customer then chooses to pay for the remaining $250 using points earned on the site during previous visits.


The following assumptions were made regarding Multipayment:



1. Customers can divide payment for an order or individual items by item quantity, percentage, or amount.

2. Customers can pay for part of a purchase using one payment method and use another payment method for the rest of the purchases.

3. Gift certificates are implemented as payment methods.


Note: The base commerce classes have built-in support for multiple payment methods. Multipayment allows customers to pay for purchases using multiple payment methods. For example, a customer can choose to pay for an order using two or more credit cards and a gift certificate. While customers can select payment methods by item level, amount level, or any combination of the two, you can limit the ways in which an order’s costs can be split, if necessary. The product UI for this component is entirely JSP-based.


No comments:

Popular Posts