This section describes how to extend ATG Commerce to use additional credit card types that the payment system might accept.

By default, ATG Commerce considers only common credit cards valid. These cards include Visa, MasterCard, etc. Many payment systems handle many other credit and debit cards, such as Switch/Solo. Many of these other cards have more validation parameters than the standard cards. If your commerce site needs to accept these cards, you can extend ATG Commerce to handle these card types.

The following sections describe the three parts to extending ATG Commerce to include new credit card types:

Extending the ATG Commerce CreditCard Class

The following steps describe how to extend the CreditCard class and modify ATG Commerce to use the new class. For general information on extending a class and modifying the ATG Commerce purchase process, see the Extending the Purchase Process section of this chapter.

  1. Create a subclass of atg.commerce.order.CreditCard and include any new properties you need for the credit card type. Add get/set methods for each of these properties. The get and set methods need to use super.getPropertyValue() and super.setPropertyValue(), so that the underlying repository item is updated correctly.

    For example, the following code sample creates a property for the issue number of the credit card:

    //------------------------------------------------------
       // property:IssueNumber
    //------------------------------------------------------
       public void setIssueNumber(String pIssueNumber) {
         setPropertyValue("issueNumber",
                 (pIssueNumber == null ? pIssueNumber :
                  StringUtils.removeWhiteSpace(pIssueNumber)));
       }

       /**
        * The issue number of this credit card
        * @beaninfo description: The issue number of this credit card
        **/
       public String getIssueNumber() {
         return (String) getPropertyValue("issueNumber");
       }

  2. Add columns to the dcspp_credit_card table to store your new properties for the CreditCard subclass.

  3. Extend orderrepository.xml to add the new properties in your CreditCard subclass to the existing creditCard item descriptor.

  4. Modify /atg/commerce/order/OrderTools to make ATG Commerce use your new CreditCard subclass instead of the default class. For example:

    beanNameToItemDescriptorMap+=\
       my.class.dir.myCreditCard=creditCard

    paymentTypeClassMap+=\
       creditCard=my.class.dir.myCreditCard

  5. Modify /atg/commerce/payment/PaymentManger.paymentGroupToChainNameMap to contain a pointer to your new class:

    paymentGroupToChainNameMap+=\
    my.class.dir.myCreditCard=creditCardProcessorChain

  6. Edit the following properties of /atg/commerce/payment/CreditCardTools to include appropriate values for your new CreditCard:

    • cardCodesMap

    • cardLengthsMap

    • cardPrefixesMap

    • cardTypesMap

Extending the ATG Commerce CreditCardInfo Class

The following steps describe how to extend the CreditCardInfo class to accommodate the new credit card type.

Extending the Payment System Integration

The final part of the process of adding a new credit card type is to extend the credit card processor for your payment system to use your new card type’s properties in its validation mechanisms. The payment system integration will have an implementation of atg.payment.creditcard.CreditCardProcessor.

You need to extend this class and recreate most of the methods, adding logic to use the new properties you added. In addition, the $class line in the properties file for the credit card processor must be changed to use your new subclass.

 
loading table of contents...