org.starhope.appius.pay
Class PayPalGateway

java.lang.Object
  extended by org.starhope.appius.pay.PayPalGateway
All Implemented Interfaces:
PaymentGatewayReal

public class PayPalGateway
extends Object
implements PaymentGatewayReal

Author:
brpocock@star-hope.org

Field Summary
private  com.paypal.sdk.services.NVPCallerServices caller
           
private  com.paypal.sdk.profiles.APIProfile profile
           
 
Constructor Summary
PayPalGateway()
           
 
Method Summary
 void alterEnrolment(Payment payment, UserEnrolment newForm)
           
 void endEnrolment(Payment payment)
           
 List<CredentialType> enumerateCredentialTypes()
          Provides a list of all credential types supported by the given payment gateway.
 Payment getPayment(BigDecimal bigDecimal)
           Get the status of a prior transaction from the gateway.
 boolean isAvailable()
           
 void setTitle(String title)
           
 void setUser(GeneralUser userPurchasing)
           
 void startEnrolment(Payment payment)
           
 void startTransaction(Payment payment)
           
 void transactPayment(Payment payment)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

caller

private com.paypal.sdk.services.NVPCallerServices caller

profile

private com.paypal.sdk.profiles.APIProfile profile
Constructor Detail

PayPalGateway

public PayPalGateway()
Method Detail

alterEnrolment

public void alterEnrolment(Payment payment,
                           UserEnrolment newForm)
                    throws UnsupportedCurrencyException,
                           NotFoundException,
                           UnsupportedCredentialException,
                           IOException,
                           RetryPaymentException,
                           GameLogicException
Specified by:
alterEnrolment in interface PaymentGatewayReal
Parameters:
payment - WRITEME
newForm - WRITEME
Throws:
UnsupportedCurrencyException - WRITEME
NotFoundException - WRITEME
UnsupportedCredentialException - WRITEME
IOException - WRITEME
RetryPaymentException - WRITEME
GameLogicException - WRITEME
See Also:
PaymentGatewayReal.alterEnrolment(org.starhope.appius.mb.Payment, org.starhope.appius.mb.UserEnrolment)

endEnrolment

public void endEnrolment(Payment payment)
                  throws UnsupportedCurrencyException,
                         NotFoundException,
                         UnsupportedCredentialException,
                         IOException,
                         RetryPaymentException,
                         GameLogicException
Specified by:
endEnrolment in interface PaymentGatewayReal
Parameters:
payment - WRITEME
Throws:
UnsupportedCurrencyException - WRITEME
NotFoundException - WRITEME
UnsupportedCredentialException - WRITEME
IOException - WRITEME
RetryPaymentException - WRITEME
GameLogicException - WRITEME
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()

getPayment

public Payment getPayment(BigDecimal bigDecimal)
Description copied from interface: PaymentGatewayReal

Get the status of a prior transaction from the gateway. This method should not be based upon our internal database.

It is not necessary for every gateway to provide details of failed transactions. If possible, however, they should be returned as well.

It is an implementation requirement that all successful transactions must return valid results information. An auditing subsystem (TODO) should validate this information on a periodic basis (say, weekly?) against our internal database to ensure conformance.

Specified by:
getPayment in interface PaymentGatewayReal
Parameters:
bigDecimal - 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)

isAvailable

public boolean isAvailable()
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()

setTitle

public void setTitle(String title)
Parameters:
title - WRITEME

setUser

public void setUser(GeneralUser userPurchasing)
Parameters:
userPurchasing - WRITEME

startEnrolment

public void startEnrolment(Payment payment)
                    throws UnsupportedCurrencyException,
                           NotFoundException,
                           UnsupportedCredentialException,
                           IOException,
                           RetryPaymentException,
                           GameLogicException
Specified by:
startEnrolment in interface PaymentGatewayReal
Parameters:
payment - WRITEME
Throws:
UnsupportedCurrencyException - WRITEME
NotFoundException - WRITEME
UnsupportedCredentialException - WRITEME
IOException - WRITEME
RetryPaymentException - WRITEME
GameLogicException - WRITEME
See Also:
PaymentGatewayReal.startEnrolment(org.starhope.appius.mb.Payment)

startTransaction

public void startTransaction(Payment payment)
                      throws UnsupportedCurrencyException,
                             NotFoundException,
                             UnsupportedCredentialException,
                             IOException,
                             RetryPaymentException,
                             GameLogicException,
                             AlreadyUsedException
Specified by:
startTransaction in interface PaymentGatewayReal
Parameters:
payment - WRITEME
Throws:
UnsupportedCurrencyException - WRITEME
NotFoundException - WRITEME
UnsupportedCredentialException - WRITEME
IOException - WRITEME
RetryPaymentException - WRITEME
GameLogicException - WRITEME
AlreadyUsedException - WRITEME
See Also:
PaymentGatewayReal.startTransaction(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 - WRITEME
Throws:
UnsupportedCurrencyException - WRITEME
NotFoundException - WRITEME
UnsupportedCredentialException - WRITEME
IOException - WRITEME
RetryPaymentException - WRITEME
GameLogicException - WRITEME
AlreadyUsedException - WRITEME
See Also:
PaymentGatewayReal.transactPayment(org.starhope.appius.mb.Payment)