Navigation Menu

Split Pricing

Adding Payment Groups to an Order


PaymentGroupFormHandler to add payment groups to an Order

  • The payment groups for potential use in the Order have been created via CreateCreditCardFormHandler, CreateInvoiceRequestFormHandler, and/or PaymentGroupDroplet
  • The payment groups have been added to the PaymentGroupMapContainer.
  • The CommerceIdentifierPaymentInfo objects for the CommerceIdentifiers in the Order have been created via PaymentGroupDroplet. The CommerceIdentifierPaymentInfo objects have been added to the CommerceIdentifierPaymentInfoContainer.


PaymentGroupDroplet -

  • Initilizes OrderPaymentInfo and add to CommerceIdentifierPaymentInfoContainer
  • Associates each CommerceIdentifierPaymentInfo object with the default payment group in the PaymentGroupMapContainer.


PaymentGroupFormHandler.listId (OrderId)

CommerceIdentifierPaymentInfo

  • splitPaymentMethod 
  • splitAmount 

Save submit button invokes the handleSplitPaymentInfos method of PaymentGroupFormHandler

handleApplyPaymentGroups method of PaymentGroupFormHandler

Example 

Creates CreditCard, StoreCredit, and GiftCertificate PaymentGroup objects based on their availability for the current user.

Retrieve available Payment Types :

<dsp:droplet name="AuthorizedPaymentTypesDroplet">
      <dsp:param bean="Profile" name="profile"/>

Additionally, it creates CommerceItemPaymentInfo objects, ShippingGroupPaymentInfo objects, and a TaxPaymentInfo object.
The example enables the user to pay for the CommerceIdentifiers in the Order at the line item level with any of the available PaymentGroup objects.

<dsp:droplet name="PaymentGroupDroplet">
  <dsp:param value="true" name="clear"/>
  <dsp:param value="giftCertificates, storeCredit, creditCard"
       name="paymentGroupTypes"/>
  <dsp:param value="true" name="initPaymentGroups"/>
  <dsp:param value="true" name="initItemPayment"/>
  <dsp:param value="true" name="initTaxPayment"/>
  <dsp:param value="true" name="initShippingPayment"/>
  <dsp:oparam name="output">Manipulation of objects here...
  </output>
</dsp:droplet>


Example


The total cost of the order is $100.
The user’s profile has two credit cards stored in it, Credit Card A and Credit Card B as well as a store credit.
Credit Card A is the default payment method for the user.

In this scenario, PaymentGroupDroplet creates three OrderPaymentInfo objects, one for each credit card and another for the store credit. The amount property for the OrderPaymentInfo associated with Credit Card A is set to 100. The amount properties for the OrderPaymentInfo objects associated with Credit Card B and the store credit are set to 0.

If the user adds additional PaymentGroups during the checkout process, you should call the PaymentGroupDroplet again to create OrderPaymentInfo objects for the newly added PaymentGroups.



No comments :