com.elasticpath.domain.payment.impl
Class AuthorizeNetPaymentGatewayImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractTransientImpl
          extended by com.elasticpath.domain.payment.impl.AbstractPaymentGatewayImpl
              extended by com.elasticpath.domain.payment.impl.AbstractCreditCardPaymentGatewayImpl
                  extended by com.elasticpath.domain.payment.impl.AuthorizeNetPaymentGatewayImpl
All Implemented Interfaces:
EpDomain, CreditCardPaymentGateway, PaymentGateway, Transient, java.io.Serializable

public class AuthorizeNetPaymentGatewayImpl
extends AbstractCreditCardPaymentGatewayImpl
implements CreditCardPaymentGateway

Implements a payment gateway for Authorize.Net. Supports the following gateway properties in commerce-config.xml:

Parameter NameRequired?Comments/example
authorizeNetURLYEShttps://certification.authorize.net/gateway/transact.dll
testModeYEStrue
loginIdYESXXXX
transKeyYESXXXX
versionYES3.1
delimCharNOdefaults to "|"
encapCharNOcharacter used to encapsulate the fields in a transaction response. Defaults to "".

See Also:
Serialized Form

Field Summary
static java.lang.String PROP_DELIMCHAR
          "Request/Response Delimiting Character" property key.
static java.lang.String PROP_ENCAPCHAR
          "Request/Response Encapsulation Character" property key.
static java.lang.String PROP_LOGINID
          "Login ID" property key.
static java.lang.String PROP_TESTMODE
          "Test Mode" property key.
static java.lang.String PROP_TRANSKEY
          "Transaction Key" property key.
static java.lang.String PROP_URL
          "Connection URL" property key.
static java.lang.String PROP_VERSION
          "API Version" property key.
static long serialVersionUID
          Serial version id.
 
Constructor Summary
AuthorizeNetPaymentGatewayImpl()
           
 
Method Summary
 void capture(OrderPayment payment)
          Captures a payment on a previously authorized card.
 PaymentType getPaymentType()
          Get the type of this payment gateway.
 void preAuthorize(OrderPayment payment, Address billingAddress)
          Pre-authorize a payment.
 void reversePreAuthorization(OrderPayment payment)
          Reverse a previous pre-authorization.
 void sale(OrderPayment payment, Address billingAddress)
          Immediately process a payment.
 void voidCaptureOrCredit(OrderPayment payment)
          Void a previous capture or credit.
 
Methods inherited from class com.elasticpath.domain.payment.impl.AbstractCreditCardPaymentGatewayImpl
getSupportedCardTypes, setSupportedCardTypes, setValidateCvv2, validateCvv2
 
Methods inherited from class com.elasticpath.domain.payment.impl.AbstractPaymentGatewayImpl
getName, getProperties, getSupportedCurrencies, refund, setName, setProperties, setSupportedCurrencies
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.payment.CreditCardPaymentGateway
getSupportedCardTypes, setSupportedCardTypes, setValidateCvv2, validateCvv2
 
Methods inherited from interface com.elasticpath.domain.payment.PaymentGateway
getName, getProperties, getSupportedCurrencies, refund, setName, setProperties, setSupportedCurrencies
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Field Detail

PROP_DELIMCHAR

public static final java.lang.String PROP_DELIMCHAR
"Request/Response Delimiting Character" property key. NOTE: This is used in a regular expression, so if default is overridden then special characters must be escaped. e.g. "\\|"

See Also:
Constant Field Values

PROP_ENCAPCHAR

public static final java.lang.String PROP_ENCAPCHAR
"Request/Response Encapsulation Character" property key. NOTE: This is used in a regular expression, so if default is overriden then special characters must be escaped. e.g. "\\|"

See Also:
Constant Field Values

PROP_LOGINID

public static final java.lang.String PROP_LOGINID
"Login ID" property key.

See Also:
Constant Field Values

PROP_TESTMODE

public static final java.lang.String PROP_TESTMODE
"Test Mode" property key.

See Also:
Constant Field Values

PROP_TRANSKEY

public static final java.lang.String PROP_TRANSKEY
"Transaction Key" property key.

See Also:
Constant Field Values

PROP_URL

public static final java.lang.String PROP_URL
"Connection URL" property key.

See Also:
Constant Field Values

PROP_VERSION

public static final java.lang.String PROP_VERSION
"API Version" property key.

See Also:
Constant Field Values

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

AuthorizeNetPaymentGatewayImpl

public AuthorizeNetPaymentGatewayImpl()
Method Detail

capture

public void capture(OrderPayment payment)
Captures a payment on a previously authorized card. If CVV2 is required and fails, the payment reason code will be set to the Authorize.Net response code.

Specified by:
capture in interface PaymentGateway
Parameters:
payment - the payment to be captured
Throws:
CardExpiredException - if the card has expired
CardErrorException - if there was an error processing the given information
PaymentGatewayException - if the payment processing fails

getPaymentType

public PaymentType getPaymentType()
Get the type of this payment gateway.

Specified by:
getPaymentType in interface PaymentGateway
Returns:
the payment type

preAuthorize

public void preAuthorize(OrderPayment payment,
                         Address billingAddress)
Pre-authorize a payment. If CVV2 is required and fails, the payment reason code will be set to the Authorize.Net response code.

Specified by:
preAuthorize in interface PaymentGateway
Parameters:
payment - the payment to be preauthorized
billingAddress - the name and address of the person being billed
Throws:
CardDeclinedException - if the card is declined
CardExpiredException - if the card has expired
CardErrorException - if there was an error processing the given information
PaymentGatewayException - if the payment processing fails

reversePreAuthorization

public void reversePreAuthorization(OrderPayment payment)
Reverse a previous pre-authorization. This can only be executed on Visas using the "Vital" processor. If CVV2 is required and fails, the payment reason code will be set to the Authorize.Net response code.

Specified by:
reversePreAuthorization in interface PaymentGateway
Parameters:
payment - the payment that was previously pre-authorized
Throws:
CardExpiredException - if the card has expired
CardErrorException - if there was an error processing the given information
PaymentGatewayException - if the payment processing fails

sale

public void sale(OrderPayment payment,
                 Address billingAddress)
Immediately process a payment. If CVV2 is required and fails, the payment reason code will be set to the Authorize.Net response code.

Specified by:
sale in interface PaymentGateway
Parameters:
payment - the payment to be preauthorized
billingAddress - the name and address of the person being billed
Throws:
CardDeclinedException - if the card is declined
CardExpiredException - if the card has expired
CardErrorException - if there was an error processing the given information
PaymentGatewayException - if the payment processing fails

voidCaptureOrCredit

public void voidCaptureOrCredit(OrderPayment payment)
Void a previous capture or credit. Can usually only be executed on the same day of the original transaction. If CVV2 is required and fails, the payment reason code will be set to the Authorize.Net response code.

Specified by:
voidCaptureOrCredit in interface PaymentGateway
Parameters:
payment - the payment to be voided
Throws:
CardExpiredException - if the card has expired
CardErrorException - if there was an error processing the given information
PaymentGatewayException - if the payment processing fails