org.davesag.generica.util
Class CreditCardUtils

java.lang.Object
  extended byorg.davesag.generica.util.CreditCardUtils
All Implemented Interfaces:
Serializable

public class CreditCardUtils
extends Object
implements Serializable

The CreditCardUtils utils provide simple methods for determining details of a credit card.

Since:
Generica 1.0
Version:
CVS Revision $Id: CreditCardUtils.java,v 1.7 2004/03/30 13:00:43 davesag Exp $
Author:
Dave Sag http://www.davesag.com
See Also:
Serialized Form

Nested Class Summary
 class CreditCardUtils.CardType
          An inner class that holds handy information about each type of credit card.
 
Field Summary
static CreditCardUtils.CardType[] CARD_TYPES
          Array of all card types
 
Constructor Summary
CreditCardUtils()
          Default constructor that builds a list of card types for us.
 
Method Summary
static String getCardBrand(BigInteger number)
          Get the Card's usual name given the card number.
static CreditCardUtils.CardType getCardType(BigInteger number)
          Get the CardType given the card number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CARD_TYPES

public static CreditCardUtils.CardType[] CARD_TYPES
Array of all card types

Constructor Detail

CreditCardUtils

public CreditCardUtils()
Default constructor that builds a list of card types for us. The known cards are as follows. perhaps this data should go into a config file or property file.

Method Detail

getCardType

public static CreditCardUtils.CardType getCardType(BigInteger number)
Get the CardType given the card number.

Parameters:
number - The card number.
Returns:
The CardType that describes the card number.

getCardBrand

public static String getCardBrand(BigInteger number)
Get the Card's usual name given the card number.

Parameters:
number - The card number.
Returns:
The typical name of the card baring the number provided. Eg Visa.


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.