com.softslate.commerce.businessobjects.payment
Class PayflowProProcessor

java.lang.Object
  extended bycom.softslate.commerce.businessobjects.core.BaseBusinessObject
      extended bycom.softslate.commerce.businessobjects.core.BaseBusinessProcessor
          extended bycom.softslate.commerce.businessobjects.payment.BasePaymentProcessor
              extended bycom.softslate.commerce.businessobjects.payment.PayflowProProcessor
All Implemented Interfaces:
BusinessObject, BusinessProcessor, PaymentProcessor

public class PayflowProProcessor
extends BasePaymentProcessor
implements PaymentProcessor

Processes a payment in the store for a given user's cart. This implementation processes a request through VeriSign Payflow Pro. The process() method manages the process of sending a request to Payflow Pro, and handling the response appropriately. Steps include:

  1. Figures out the transaction type (sale, authorize, authorize/authenticate, or authorize/authenticate/sale) from the database settings and the user's current state.
  2. Builds the request to Payflow Pro as a Map, taking as input the current user's state, and various database settings.
  3. Converts the request into a url-encoded query string to pass as Payflow Pro's "parmlist" parameter.
  4. Initializes the connection to Payflow Pro and sends the request.
  5. Handles any errors by setting "resultCode" appropriately in the Map that is returned. If no response comes back from Payflow Pro, a result code 10000 is used. If the Payflow Pro result code is not 0, which also indicates an error, that code is used as this method's "resultCode" and this method returns it.
  6. If a successful response is received, checks if the transaction type for the user is AA or AAS (authorize/authenticate, or authorize/authenticate/sale), in which the response must be "authenticated". This means the AVS and CSC responses are checked against what's defined as acceptable in the Payflow Pro Advanced Settings in the administrator.
  7. If the user is not deemed authenticated, a "resultCode" of 10001 is returned.
  8. If the user is authenticated and the transaction type in effect is AAS (authorize/authenticate/sale), an immediate delayed capture on the previous authorization is performed, using the same parameters. Any errors from this second request are handled in the same way as above.
  9. Assuming the transaction succeeds, a new record is written to the npcPayment database table and a resultCode of 0 is returned.

Author:
David Tobey

Field Summary
(package private) static org.apache.commons.logging.Log log
           
 
Fields inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
 
Constructor Summary
PayflowProProcessor()
           
 
Method Summary
 java.lang.String getTransAuthLevel()
           
 void initializeConnection(com.Verisign.payment.PFProAPI payflowProConnection, java.lang.String certPath)
           
 boolean isAuthenticated(java.lang.String transAuthLevel, java.util.Map responseMap)
           
 boolean levelMatchFound(java.lang.String cust, java.lang.String floor, java.lang.String ceiling, java.lang.String countries)
           
 java.util.Map parsePayflowProResponse(java.lang.String response)
           
 java.util.Map preparePayflowProRequest(java.util.Map parameters)
           
 java.util.Map process(java.util.Map parameters)
           
 void processSuccessfulTransaction(java.util.Map parameters, java.util.Map responseMap)
           
 
Methods inherited from class com.softslate.commerce.businessobjects.payment.BasePaymentProcessor
processPayment
 
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
formatPrice, getBusinessObjectFactory, getDaoFactory, getSettingsBean, getUser, initialize, setBusinessObjectFactory, setDaoFactory, setSettingsBean, setUser
 
Methods inherited from class com.softslate.commerce.businessobjects.core.BaseBusinessObject
formatDateTime, parseDateTime, prepareRequestData, sendHTTPPost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.softslate.commerce.businessobjects.payment.PaymentProcessor
processPayment
 
Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject
initialize
 

Field Detail

log

static org.apache.commons.logging.Log log
Constructor Detail

PayflowProProcessor

public PayflowProProcessor()
Method Detail

process

public java.util.Map process(java.util.Map parameters)
                      throws java.lang.Exception
Specified by:
process in class BasePaymentProcessor
Throws:
java.lang.Exception

getTransAuthLevel

public java.lang.String getTransAuthLevel()
                                   throws java.lang.Exception
Throws:
java.lang.Exception

levelMatchFound

public boolean levelMatchFound(java.lang.String cust,
                               java.lang.String floor,
                               java.lang.String ceiling,
                               java.lang.String countries)

preparePayflowProRequest

public java.util.Map preparePayflowProRequest(java.util.Map parameters)
                                       throws java.lang.Exception
Throws:
java.lang.Exception

initializeConnection

public void initializeConnection(com.Verisign.payment.PFProAPI payflowProConnection,
                                 java.lang.String certPath)
                          throws java.lang.Exception
Throws:
java.lang.Exception

parsePayflowProResponse

public java.util.Map parsePayflowProResponse(java.lang.String response)

isAuthenticated

public boolean isAuthenticated(java.lang.String transAuthLevel,
                               java.util.Map responseMap)
                        throws java.lang.Exception
Throws:
java.lang.Exception

processSuccessfulTransaction

public void processSuccessfulTransaction(java.util.Map parameters,
                                         java.util.Map responseMap)
                                  throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © SoftSlate, Inc. 2003–2005