org.starhope.appius.pay
Class AuthorizeNetGateway
java.lang.Object
org.starhope.appius.pay.AuthorizeNetGateway
- All Implemented Interfaces:
- PaymentGatewayReal
public class AuthorizeNetGateway
- extends Object
- implements PaymentGatewayReal
- Author:
- brpocock
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
address
private UserAddress address
buyerCompany
private String buyerCompany
buyerFamilyName
private String buyerFamilyName
buyerGivenName
private String buyerGivenName
AuthorizeNetGateway
public AuthorizeNetGateway()
alterEnrolment
public void alterEnrolment(Payment payment,
UserEnrolment newForm)
throws UnsupportedCurrencyException,
NotFoundException,
UnsupportedCredentialException,
IOException,
RetryPaymentException,
GameLogicException
- Specified by:
alterEnrolment
in interface PaymentGatewayReal
- Throws:
UnsupportedCurrencyException
NotFoundException
UnsupportedCredentialException
IOException
RetryPaymentException
GameLogicException
- See Also:
PaymentGatewayReal.alterEnrolment(org.starhope.appius.mb.Payment,
org.starhope.appius.mb.UserEnrolment)
endEnrolment
public void endEnrolment(Payment payment)
throws IllegalStateException,
NotFoundException
- Specified by:
endEnrolment
in interface PaymentGatewayReal
- Throws:
IllegalStateException
- if you try to cancel something that
you can't
NotFoundException
- if some party to the transaction
doesn't exist (e.g. no such user)- See Also:
PaymentGatewayReal.endEnrolment(org.starhope.appius.mb.Payment)
enumerateCredentialTypes
public List<CredentialType> enumerateCredentialTypes()
- Description copied from interface:
PaymentGatewayReal
- Provides a list of all credential types supported by the given
payment gateway.
- Specified by:
enumerateCredentialTypes
in interface PaymentGatewayReal
- Returns:
- all supported
CredentialType
:s - See Also:
PaymentGatewayReal.enumerateCredentialTypes()
getARBAPI
private ARBAPI getARBAPI()
- Returns:
- a valid ARBAPI object, properly configured
getPayment
public Payment getPayment(BigDecimal id)
- This is an overriding method.
- Specified by:
getPayment
in interface PaymentGatewayReal
- Parameters:
id
- The identifier used by the implementing payment
gateway to uniquely identify the transaction in question.
- Returns:
- the results information available about that transaction
- See Also:
PaymentGatewayReal.getPayment(java.math.BigDecimal)
getPayment
public Payment getPayment(String gatewayTransactionCode)
- Parameters:
gatewayTransactionCode
- The transaction code of the payment
in question
- Returns:
- As much information as possible about the past
transaction
isAvailable
public boolean isAvailable()
- Submits a known-good test transaction.
- Specified by:
isAvailable
in interface PaymentGatewayReal
- Returns:
- true, if the payment gateway appears to be online and
functioning (or was known to be online and functioning
recently enough)
- See Also:
PaymentGatewayReal.isAvailable()
setUser
public void setUser(User p)
- Parameters:
p
-
startEnrolment
public void startEnrolment(Payment payment)
throws UnsupportedCurrencyException,
NotFoundException,
UnsupportedCredentialException,
IOException,
RetryPaymentException,
GameLogicException,
AlreadyUsedException
- Start an Authorize.Net subscription through their
(now-beautiful!! WTF?) Automated Recurring Billing engine.
- Specified by:
startEnrolment
in interface PaymentGatewayReal
- Throws:
AlreadyUsedException
UnsupportedCurrencyException
NotFoundException
UnsupportedCredentialException
IOException
RetryPaymentException
GameLogicException
- See Also:
PaymentGatewayReal.startEnrolment(org.starhope.appius.mb.Payment)
transactPayment
public void transactPayment(Payment payment)
throws UnsupportedCurrencyException,
NotFoundException,
UnsupportedCredentialException,
IOException,
RetryPaymentException,
GameLogicException,
AlreadyUsedException
- Specified by:
transactPayment
in interface PaymentGatewayReal
- Parameters:
payment
- payment
- Throws:
UnsupportedCurrencyException
- if the payment is not
expressed in USD or if the scale is less than 1¢. We
re-throw an ArithmeticException
from
BigDecimal.setScale(int, java.math.RoundingMode)
(q.v. for remarks)
if setting the scale to "2" (thus, 1¢ increments) would
induce rounding.
NotFoundException
- if the buyer or address aren't found or
mismatch in some exciting way
UnsupportedCredentialException
- if a type of payment
credentials are presented which we don't support. This
shouldn't happen, since we enumerate supported types in
enumerateCredentialTypes specifically to prevent that.
IOException
- if a connection to Authorize.Net can't be
established due to a network failure or similar problem.
RetryPaymentException
- if the payment can't be processed
right now, but we should retry after a few minutes.
GameLogicException
- if the payment has already been
completed
AlreadyUsedException
- if the Payment object is already
closed (used)