org.broadleafcommerce.core.payment.service.module
Class NullCreditCardPaymentModule

java.lang.Object
  extended by org.broadleafcommerce.core.payment.service.module.AbstractModule
      extended by org.broadleafcommerce.core.payment.service.module.NullCreditCardPaymentModule
All Implemented Interfaces:
PaymentModule

public class NullCreditCardPaymentModule
extends AbstractModule

The following methods simulates a PaymentModule by overriding the process methods of the PaymentModule. This NullCreditCardModule will: validate a credit card number against the Apache Commons CreditCardValidator. validate the expiration date. validate that the cvv != "000" in order to demonstrate a PaymentException. set the TransactionSuccess to false on the PaymentResponseItem if any of the conditions above are invalid. creates a PaymentInfoDetail logging the transaction and puts it on the PaymentInfo This does NOT integrate with any Payment Gateway and should not be used in any production environment. This class is for demonstration purposes only.


Constructor Summary
NullCreditCardPaymentModule()
           
 
Method Summary
 Boolean isValidCandidate(PaymentInfoType paymentType)
           
 PaymentResponseItem processAuthorize(PaymentContext paymentContext, Money amountToAuthorize, PaymentResponseItem responseItem)
           
 PaymentResponseItem processAuthorizeAndDebit(PaymentContext paymentContext, Money amountToDebit, PaymentResponseItem responseItem)
           
 PaymentResponseItem processBalance(PaymentContext paymentContext, PaymentResponseItem responseItem)
           
 PaymentResponseItem processCredit(PaymentContext paymentContext, Money amountToCredit, PaymentResponseItem responseItem)
           
 PaymentResponseItem processDebit(PaymentContext paymentContext, Money amountToDebit, PaymentResponseItem responseItem)
           
 PaymentResponseItem processPartialPayment(PaymentContext paymentContext, Money amountToDebit, PaymentResponseItem responseItem)
           
 PaymentResponseItem processReverseAuthorize(PaymentContext paymentContext, Money amountToReverseAuthorize, PaymentResponseItem responseItem)
           
 PaymentResponseItem processVoidPayment(PaymentContext paymentContext, Money amountToVoid, PaymentResponseItem responseItem)
           
protected  String validateCardType(String ccNumber)
           
protected  Map<String,String> validateNullCreditCard(PaymentContext paymentContext)
           
 
Methods inherited from class org.broadleafcommerce.core.payment.service.module.AbstractModule
authorize, authorizeAndDebit, balance, credit, debit, findPaymentInfoFromContext, getAmountAvailableToCredit, getAmountAvailableToDebit, getAmountAvailableToReverseAuthorize, getNewCapturePaymentInfoDetail, getNewPaymentInfoDetail, getNewRefundPaymentInfoDetail, getNewResponseItem, getNewResponseItem, getNewReverseAuthPaymentInfoDetail, partialPayment, reverseAuthorize, voidPayment
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullCreditCardPaymentModule

public NullCreditCardPaymentModule()
Method Detail

processAuthorize

public PaymentResponseItem processAuthorize(PaymentContext paymentContext,
                                            Money amountToAuthorize,
                                            PaymentResponseItem responseItem)
                                     throws PaymentException
Throws:
PaymentException

processReverseAuthorize

public PaymentResponseItem processReverseAuthorize(PaymentContext paymentContext,
                                                   Money amountToReverseAuthorize,
                                                   PaymentResponseItem responseItem)
                                            throws PaymentException
Throws:
PaymentException

processAuthorizeAndDebit

public PaymentResponseItem processAuthorizeAndDebit(PaymentContext paymentContext,
                                                    Money amountToDebit,
                                                    PaymentResponseItem responseItem)
                                             throws PaymentException
Throws:
PaymentException

processDebit

public PaymentResponseItem processDebit(PaymentContext paymentContext,
                                        Money amountToDebit,
                                        PaymentResponseItem responseItem)
                                 throws PaymentException
Throws:
PaymentException

processCredit

public PaymentResponseItem processCredit(PaymentContext paymentContext,
                                         Money amountToCredit,
                                         PaymentResponseItem responseItem)
                                  throws PaymentException
Throws:
PaymentException

processVoidPayment

public PaymentResponseItem processVoidPayment(PaymentContext paymentContext,
                                              Money amountToVoid,
                                              PaymentResponseItem responseItem)
                                       throws PaymentException
Throws:
PaymentException

processBalance

public PaymentResponseItem processBalance(PaymentContext paymentContext,
                                          PaymentResponseItem responseItem)
                                   throws PaymentException
Throws:
PaymentException

processPartialPayment

public PaymentResponseItem processPartialPayment(PaymentContext paymentContext,
                                                 Money amountToDebit,
                                                 PaymentResponseItem responseItem)
                                          throws PaymentException
Throws:
PaymentException

isValidCandidate

public Boolean isValidCandidate(PaymentInfoType paymentType)

validateCardType

protected String validateCardType(String ccNumber)

validateNullCreditCard

protected Map<String,String> validateNullCreditCard(PaymentContext paymentContext)


Copyright © 2013. All Rights Reserved.