org.starhope.appius.pay.util
Class PaymentCredential

java.lang.Object
  extended by org.starhope.appius.pay.util.PaymentCredential

public class PaymentCredential
extends Object

Author:
brpocock

Field Summary
private  UserAddress address
           
private  String buyerCompany
           
private  String buyerFamilyName
           
private  String buyerGivenName
           
private  BigDecimal cardCode
          The CCV, Card Code.
private  String cardCodeString
          The CCV, Card Code.
private  BigDecimal cardNumber
          The credit-card number
private  CredentialType credentialType
          The type of credentials presented.
private  Date expiry
          The expiry date of a credit card (used for validation)
 
Constructor Summary
PaymentCredential()
           
 
Method Summary
 void applyTo(net.authorize.admc.authnet.AimTransaction xact)
           Apply a (credit-card only) set of payment credentials to an Authorize.Net one-time-purchase (AIM, Advanced Integration Method) object.
 void applyTo(net.authorize.arb.ARBNameAndAddress billTo)
          TODO: document this method (brpocock, Sep 11, 2009)
 void applyTo(net.authorize.arb.ARBPayment payment)
           Apply the credit-card information to the Authorize.net ARBPayment object.
 UserAddress getAddress()
           
 String getBuyerCompany()
           
 String getBuyerFamilyName()
           
 String getBuyerGivenName()
           
 CredentialType getCredentialType()
           
 int getExpiryMonth()
          TODO: document this method (brpocock, Sep 11, 2009)
 int getExpiryYear()
          TODO: document this method (brpocock, Sep 11, 2009)
static String getFriendlyName(CredentialType type)
           
private  String getLastFour()
           
 void populate(com.paypal.sdk.core.nvp.NVPEncoder encoder)
          Apply credentials to a PayPal transaction
 void setBuyerCompany(String company)
          TODO: document this method (brpocock, Sep 11, 2009)
 void setBuyerInfo(String buyerGivenName1, String buyerFamilyName1, UserAddress address1)
          TODO: document this method (brpocock, Sep 23, 2009)
 void setCardCode(BigDecimal num)
           
 void setCardCodeAsString(String code)
           
 void setCardNumber(BigDecimal num)
           
 void setCardNumber(String num)
          Set a card number from a user-supplied string.
 void setCredentialType(CredentialType credentialType1)
           
 void setExpiry(Date d)
           
 void setIBCCard(String ibcCode)
           
 void shred()
          Discard all credential information
 String toString()
          This is an overriding method.
 void verifyCredentials()
          TODO: document this method (brpocock, Oct 13, 2009)
static int verifyIBC(String ibcCode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

address

private volatile UserAddress address

buyerCompany

private volatile String buyerCompany

buyerFamilyName

private volatile String buyerFamilyName

buyerGivenName

private volatile String buyerGivenName

cardCode

private volatile BigDecimal cardCode
The CCV, Card Code.


cardCodeString

private volatile String cardCodeString
The CCV, Card Code.


cardNumber

private volatile BigDecimal cardNumber
The credit-card number


credentialType

private CredentialType credentialType
The type of credentials presented. See CredentialType for all valid values. Note that at present we only actually support credit cards and gift cards.


expiry

private Date expiry
The expiry date of a credit card (used for validation)

Constructor Detail

PaymentCredential

public PaymentCredential()
Method Detail

getFriendlyName

public static String getFriendlyName(CredentialType type)
Parameters:
type - a type of credentials
Returns:
a "friendly" (but possibly verbose) description of the type of transaction credentials, suitable for displaying to the end-user. This is used by, e.g. UnsupportedCredentialException to display "pretty" error messages.

verifyIBC

public static int verifyIBC(String ibcCode)
                     throws NotImplementedException,
                            AlreadyUsedException,
                            NotFoundException
Parameters:
ibcCode - WRITEME
Returns:
WRITEME
Throws:
NotImplementedException - WRITEME
AlreadyUsedException - WRITEME
NotFoundException - WRITEME

applyTo

public void applyTo(net.authorize.admc.authnet.AimTransaction xact)

Apply a (credit-card only) set of payment credentials to an Authorize.Net one-time-purchase (AIM, Advanced Integration Method) object.

At present, this (or applyTo(ARBPayment)) are the only supported way to extract the card information once it's entered into this object; however, the last 4 digits of the card number are visible via #toString()

Parameters:
xact - An Authorize.Net transaction in the form of AimTransaction

applyTo

public void applyTo(net.authorize.arb.ARBNameAndAddress billTo)
TODO: document this method (brpocock, Sep 11, 2009)

Parameters:
billTo - WRITEME

applyTo

public void applyTo(net.authorize.arb.ARBPayment payment)
             throws UnsupportedCredentialException

Apply the credit-card information to the Authorize.net ARBPayment object.

At present, this (or applyTo(AimTransaction)) are the only supported way to extract the card information once it's entered into this object; however, the last 4 digits of the card number are visible via #toString()

Parameters:
payment - The ARB Payment object to which we want to append the card information.
Throws:
UnsupportedCredentialException - if this is not a credit-card credentials bundle

getAddress

public UserAddress getAddress()
Returns:
UserAddress address

getBuyerCompany

public String getBuyerCompany()
Returns:
the buyerCompany

getBuyerFamilyName

public String getBuyerFamilyName()
Returns:
String buyerFamilyName

getBuyerGivenName

public String getBuyerGivenName()
Returns:
String buyerGivenName

getCredentialType

public CredentialType getCredentialType()
Returns:
the credentialType

getExpiryMonth

public int getExpiryMonth()
TODO: document this method (brpocock, Sep 11, 2009)

Returns:
WRITEME

getExpiryYear

public int getExpiryYear()
TODO: document this method (brpocock, Sep 11, 2009)

Returns:
WRITEME

getLastFour

private String getLastFour()
Returns:
The last four digits of a credit-card number. Used by toString() and only accessible thereby.

populate

public void populate(com.paypal.sdk.core.nvp.NVPEncoder encoder)
Apply credentials to a PayPal transaction

Parameters:
encoder - the PayPal transaction-in-progress

setBuyerCompany

public void setBuyerCompany(String company)
TODO: document this method (brpocock, Sep 11, 2009)

Parameters:
company - WRITEME

setBuyerInfo

public void setBuyerInfo(String buyerGivenName1,
                         String buyerFamilyName1,
                         UserAddress address1)
TODO: document this method (brpocock, Sep 23, 2009)

Parameters:
buyerGivenName1 - WRITEME
buyerFamilyName1 - WRITEME
address1 - WRITEME

setCardCode

public void setCardCode(BigDecimal num)
Parameters:
num - The CCV, Card Code Verification, number (3 or 4 digits)

setCardCodeAsString

public void setCardCodeAsString(String code)
Parameters:
code - The CCV, Card Code Verification, number (3 or 4 digits)

setCardNumber

public void setCardNumber(BigDecimal num)
Parameters:
num - The credit-card number (usually 16 digits)

setCardNumber

public void setCardNumber(String num)
                   throws NumberFormatException
Set a card number from a user-supplied string. This method removes non-digit contents before attempting to store the value as a BigDecimal, so it should be used for user-supplied inputs that might contain spaces or dashes, or other random line noise.

Parameters:
num - The presumed credit-card number, possibly containing spaces or dashes.
Throws:
NumberFormatException - WRITEME

setCredentialType

public void setCredentialType(CredentialType credentialType1)
Parameters:
credentialType1 - the credentialType to set

setExpiry

public void setExpiry(Date d)
Parameters:
d - The expiration date. Only the month and year are used: the day can be "1" for validity

setIBCCard

public void setIBCCard(String ibcCode)
                throws NotImplementedException
Parameters:
ibcCode - WRITEME
Throws:
NotImplementedException - WRITEME

shred

public void shred()
Discard all credential information


toString

public String toString()
This is an overriding method.

Overrides:
toString in class Object
See Also:
Object.toString()

verifyCredentials

public void verifyCredentials()
                       throws DataException
TODO: document this method (brpocock, Oct 13, 2009)

Throws:
DataException - WRITEME