CreditCardPack

com.keyoti.creditCard.logic.ejb
Interface CreditCard


public interface CreditCard
extends javax.ejb.EJBObject

Remote interface of CreditCardEJB.

Author:
Keyoti

Method Summary
 String[] getBillingAddress()
          Gets the card billing address.
 String getCardName()
          Gets the card owners name.
 String getCardNumber()
          Gets the credit card number.
 CardType getCardType()
          Gets the card type.
 String getCardVerificationNumber()
          Gets the Card Verification Number, this is not be stored in long term persistence.
 String getComments()
          Gets the card comments
 Integer getExpiryMonth()
          Gets the card expiry date month.
 Integer getExpiryYear()
          Gets the card expiry date year.
 Integer getIssueNumber()
          Gets the card issue number.
 String getIssuer()
          Gets the card issuer.
 Integer getStartMonth()
          Gets the card start date month.
 Integer getStartYear()
          Gets the card start date year.
 boolean isCardNameValid()
          Determines if the card holders name is valid, this is a very simple method, that just checks if the card name field is longer than 0 chars.
 boolean isCardNumberValid()
          Determines if the card number is valid, according to a MOD10 check and character validity check.
 boolean isCardTypeValid()
          Determines if the card type corresponds with the credit card number.
 boolean isCardVerificationNumberValid()
          Determines if the card verification number is 3 or 4 digits long and only includes numeric characters.
 boolean isExpiryMonthValid()
          Determines if the expiry month is valid, simply by checking that it is between 1 and 12 inclusive.
 boolean isExpiryYearValid()
          Determines if the expiry year is valid , simply by checking that it is between 0 and 99 inclusive (since credit card expiry dates are 2 digits long).
 boolean isMinimumValid()
          Convenience method, checks that card number, expiry date, type and card name are valid.
 boolean isStartMonthValid()
          Determines if the start month is valid, simply by checking that it is between 1 and 12 inclusive.
 boolean isStartYearValid()
          Determines if the start year is valid , simply by checking that it is between 0 and 99 inclusive (since credit card start dates are 2 digits long).
 void setBillingAddress(String[] billingAddress)
          Sets the card billingAddress array.
 void setCardName(String cardName)
          Sets the card owners name.
 void setCardType(CardType cardType)
          Sets the card type.
 void setCardVerificationNumber(String cvn)
          Sets the Card Verification Number (CVN), this is NOT stored in long term persistence.
 void setComments(String comments)
          Sets the card comments.
 void setExpiryMonth(int expiryMonth)
          Sets the card expiry date month, using setExpiryMonth(Integer).
 void setExpiryMonth(Integer expiryMonth)
          Sets the card expiry date month.
 void setExpiryYear(int expiryYear)
          Sets the card expiry date year, using setExpiryYear(Integer).
 void setExpiryYear(Integer expiryYear)
          Sets the card expiry date year, because credit cards usually specify 2 digit year values this is mirrored here.
 void setIssueNumber(int issueNumber)
          Sets the card issue number, using setIssueNumber(Integer).
 void setIssueNumber(Integer issueNumber)
          Sets the card issue number.
 void setIssuer(String issuer)
          Sets the card issuer's name.
 void setStartMonth(int startMonth)
          Sets the card start date month, using setStartMonth(Integer).
 void setStartMonth(Integer startMonth)
          Sets the card start date month.
 void setStartYear(int startYear)
          Sets the card start date year, using setStartYear(Integer).
 void setStartYear(Integer startYear)
          Sets the card start date year, because credit cards usually specify 2 digit year values this is mirrored here.
 
Methods inherited from interface javax.ejb.EJBObject
getEJBHome, getHandle, getPrimaryKey, isIdentical, remove
 

Method Detail

getCardNumber

public String getCardNumber()
                     throws RemoteException
Gets the credit card number.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

isCardNumberValid

public boolean isCardNumberValid()
                          throws RemoteException
Determines if the card number is valid, according to a MOD10 check and character validity check.
Returns:
true if the card number is valid, false if the card number is not valid (or has not been set yet).
Throws:
RemoteException - if an exception occurred remotely (such as a network error).
Postconditions:
return == LuhnChecker.isValid(getCardNumber())

getCardName

public String getCardName()
                   throws RemoteException
Gets the card owners name.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

setCardName

public void setCardName(String cardName)
                 throws RemoteException
Sets the card owners name.
Returns:
void
Throws:
NullPointerException - if cardName is null.
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
cardName != null
Postconditions:
getCardName() == cardName

isCardNameValid

public boolean isCardNameValid()
                        throws RemoteException
Determines if the card holders name is valid, this is a very simple method, that just checks if the card name field is longer than 0 chars.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

getExpiryMonth

public Integer getExpiryMonth()
                       throws RemoteException
Gets the card expiry date month.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

setExpiryMonth

public void setExpiryMonth(Integer expiryMonth)
                    throws RemoteException
Sets the card expiry date month.
Returns:
void
Throws:
NullPointerException - if expiryMonth is null.
IllegalArgumentException - if 0 < expiryMonth <= 12 is not true.
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
expiryMonth != null AND expiryMonth >= 1 AND expiryMonth <= 12
Postconditions:
getExpiryMonth() == expiryMonth AND isExpiryMonthValid() == true

getExpiryYear

public Integer getExpiryYear()
                      throws RemoteException
Gets the card expiry date year.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

setExpiryYear

public void setExpiryYear(Integer expiryYear)
                   throws RemoteException
Sets the card expiry date year, because credit cards usually specify 2 digit year values this is mirrored here. Expiry year must be between 0 and 99 inclusive, otherwise an IllegalArgumentException is thrown.
Returns:
void
Throws:
NullPointerException - if expiryYear is null.
IllegalArgumentException - if 0 <= expiryYear <= 99 is not true
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
expiryYear != null AND expiryYear >= 0 AND expiryYear <= 99
Postconditions:
getExpiryYear() == expiryYear AND isExpiryYearValid() == true

setExpiryMonth

public void setExpiryMonth(int expiryMonth)
                    throws RemoteException
Sets the card expiry date month, using setExpiryMonth(Integer).
Throws:
IllegalArgumentException - if 1<=expiryMonth<=12 is not true.
RemoteException - if an exception occurred remotely (such as a network error).
See Also:
setExpiryMonth(Integer)

setExpiryYear

public void setExpiryYear(int expiryYear)
                   throws RemoteException
Sets the card expiry date year, using setExpiryYear(Integer).
Throws:
IllegalArgumentException - if 0<=expiryYear<=99 is not true.
RemoteException - if an exception occurred remotely (such as a network error).
See Also:
setExpiryYear(Integer)

isExpiryMonthValid

public boolean isExpiryMonthValid()
                           throws RemoteException
Determines if the expiry month is valid, simply by checking that it is between 1 and 12 inclusive.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

isExpiryYearValid

public boolean isExpiryYearValid()
                          throws RemoteException
Determines if the expiry year is valid , simply by checking that it is between 0 and 99 inclusive (since credit card expiry dates are 2 digits long).
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

getStartMonth

public Integer getStartMonth()
                      throws RemoteException
Gets the card start date month.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

setStartMonth

public void setStartMonth(Integer startMonth)
                   throws RemoteException
Sets the card start date month.
Returns:
void
Throws:
NullPointerException - if startMonth is null.
IllegalArgumentException - if 0 < startMonth <= 12 is not true.
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
startMonth != null AND startMonth >= 1 AND startMonth <= 12
Postconditions:
getStartMonth() == startMonth AND isStartMonthValid() == true

getStartYear

public Integer getStartYear()
                     throws RemoteException
Gets the card start date year.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

setStartYear

public void setStartYear(Integer startYear)
                  throws RemoteException
Sets the card start date year, because credit cards usually specify 2 digit year values this is mirrored here. Start year must be between 0 and 99 inclusive, otherwise an IllegalArgumentException is thrown.
Returns:
void
Throws:
NullPointerException - if startYear is null.
IllegalArgumentException - if 0 <= startYear <= 99 is not true
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
startYear != null AND startYear >= 0 AND startYear <= 99
Postconditions:
getStartYear() == startYear AND isStartYearValid() == true

setStartMonth

public void setStartMonth(int startMonth)
                   throws RemoteException
Sets the card start date month, using setStartMonth(Integer).
Throws:
IllegalArgumentException - if 1<=startMonth<=12 is not true.
RemoteException - if an exception occurred remotely (such as a network error).
See Also:
setStartMonth(Integer)

setStartYear

public void setStartYear(int startYear)
                  throws RemoteException
Sets the card start date year, using setStartYear(Integer).
Throws:
IllegalArgumentException - if 0<=startYear<=99 is not true.
RemoteException - if an exception occurred remotely (such as a network error).
See Also:
setStartYear(Integer)

isStartMonthValid

public boolean isStartMonthValid()
                          throws RemoteException
Determines if the start month is valid, simply by checking that it is between 1 and 12 inclusive.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

isStartYearValid

public boolean isStartYearValid()
                         throws RemoteException
Determines if the start year is valid , simply by checking that it is between 0 and 99 inclusive (since credit card start dates are 2 digits long).
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

getIssueNumber

public Integer getIssueNumber()
                       throws RemoteException
Gets the card issue number.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

setIssueNumber

public void setIssueNumber(Integer issueNumber)
                    throws RemoteException
Sets the card issue number.
Returns:
void
Throws:
NullPointerException - if issueNumber is null.
IllegalArgumentException - if 0 <= issueNumber <= 999 is not true.
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
issueNumber != null AND issueNumber >=0 AND issueNumber <= 999
Postconditions:
getIssueNumber() == issueNumber

setIssueNumber

public void setIssueNumber(int issueNumber)
                    throws RemoteException
Sets the card issue number, using setIssueNumber(Integer).
Throws:
IllegalArgumentException - if 0<=issueNumber<=999 is not true.
RemoteException - if an exception occurred remotely (such as a network error).
See Also:
setIssueNumber(Integer)

getCardType

public CardType getCardType()
                     throws RemoteException
Gets the card type.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

setCardType

public void setCardType(CardType cardType)
                 throws RemoteException
Sets the card type.
Returns:
void
Throws:
NullPointerException - if cardType is null.
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
cardType != null
Postconditions:
getCardType() == cardType

isCardTypeValid

public boolean isCardTypeValid()
                        throws RemoteException
Determines if the card type corresponds with the credit card number. Each card type has a pattern defined for the card number to obey, eg; MasterCard cards start "51xxxx"
Returns:
true if the card type is correct, false otherwise
Throws:
RemoteException - if an exception occurred remotely (such as a network error).
See Also:
CardType

getComments

public String getComments()
                   throws RemoteException
Gets the card comments
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

getIssuer

public String getIssuer()
                 throws RemoteException
Gets the card issuer.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

getBillingAddress

public String[] getBillingAddress()
                           throws RemoteException
Gets the card billing address.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

getCardVerificationNumber

public String getCardVerificationNumber()
                                 throws RemoteException
Gets the Card Verification Number, this is not be stored in long term persistence. It is a misuse to store this number because it is intended that it be verified by the issuer and not be held any where other than on the physical card.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).

setCardVerificationNumber

public void setCardVerificationNumber(String cvn)
                               throws RemoteException
Sets the Card Verification Number (CVN), this is NOT stored in long term persistence. It is a misuse to store this number because it is intended that it be verified by the issuer and not be held any where other than on the physical card. The CVN must be either 3 or 4 digits in length or empty.
Parameters:
cvn - the card verification number String.
Returns:
void
Throws:
NullPointerException - if cvn is null.
IllegalArgumentException - if cvn is not 3 or 4 numeric characters or an empty String.
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
cvn != null AND ((3 <= cvn.length() <= 4 AND cvn.equals(LuhnChecker.getDigitsOnly(cvn))) OR cvn == "" )
Postconditions:
getCardVerificationNumber() == cvn

isCardVerificationNumberValid

public boolean isCardVerificationNumberValid()
                                      throws RemoteException
Determines if the card verification number is 3 or 4 digits long and only includes numeric characters. Note: that only the card processor can determine if the card verification number is truly 'valid', this only provides pre-processing checks.
Returns:
true if card verification number is 3 or 4 digits long, false otherwise (including if getCardVerificationNumber() is null).
Throws:
RemoteException - if an exception occurred remotely (such as a network error).
Postconditions:
return == (true AND getCardVerificationNumber() != null AND 3 <= getCardVerificationNumber().length() <= 4 AND LuhnChecker.getDigitsOnly(getCardVerificationNumber()).equals(getCardVerificationNumber())) OR false

setIssuer

public void setIssuer(String issuer)
               throws RemoteException
Sets the card issuer's name. Notifies any property change listeners if new value is different to the current value.
Returns:
void
Throws:
NullPointerException - if issuer is null.
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
issuer != null
Postconditions:
getIssuer() == issuer

setComments

public void setComments(String comments)
                 throws RemoteException
Sets the card comments. Notifies any property change listeners if new value is different to the current value.
Returns:
void
Throws:
NullPointerException - if comments is null.
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
comments != null
Postconditions:
getComments() == comments

setBillingAddress

public void setBillingAddress(String[] billingAddress)
                       throws RemoteException
Sets the card billingAddress array. Notifies any property change listeners if new value is different to the current value.
Returns:
void
Throws:
NullPointerException - if billingAddress is null.
IllegalArgumentException - if billingAddress.length > 5
RemoteException - if an exception occurred remotely (such as a network error).
Preconditions:
billingAddress != null
Postconditions:
getBillingAddress() == billingAddress

isMinimumValid

public boolean isMinimumValid()
                       throws RemoteException
Convenience method, checks that card number, expiry date, type and card name are valid. Calls isCardNumberValid(), isExpiryMonthValid(), isExpiryYearValid(), isCardNameValid() and isCardTypeValid(). Fields are determined as valid according to the individual methods.
Returns:
true if all fields are valid, false otherwise.
Throws:
RemoteException - if an exception occurred remotely (such as a network error).
RemoteException - if an exception occurred remotely (such as a network error).

CreditCardPack

Copyright © 2002 Keyoti All Rights Reserved.