Credit Card Number

Credit Card Number is a library that can provide details of a bank issued credit card number. All classes are immutable and thread-safe. The standard `toString()` function formats data in a readable form.

License

License

GroupId

GroupId

pl.droidsonroids
ArtifactId

ArtifactId

credit_card_number
Last Version

Last Version

2.01.03-alpha03
Release Date

Release Date

Type

Type

jar
Description

Description

Credit Card Number
Credit Card Number is a library that can provide details of a bank issued credit card number. All classes are immutable and thread-safe. The standard `toString()` function formats data in a readable form.
Project URL

Project URL

https://github.com/sualeh/credit_card_number
Project Organization

Project Organization

Sualeh Fatehi

Download credit_card_number

How to add to project

<!-- https://jarcasting.com/artifacts/pl.droidsonroids/credit_card_number/ -->
<dependency>
    <groupId>pl.droidsonroids</groupId>
    <artifactId>credit_card_number</artifactId>
    <version>2.01.03-alpha03</version>
</dependency>
// https://jarcasting.com/artifacts/pl.droidsonroids/credit_card_number/
implementation 'pl.droidsonroids:credit_card_number:2.01.03-alpha03'
// https://jarcasting.com/artifacts/pl.droidsonroids/credit_card_number/
implementation ("pl.droidsonroids:credit_card_number:2.01.03-alpha03")
'pl.droidsonroids:credit_card_number:jar:2.01.03-alpha03'
<dependency org="pl.droidsonroids" name="credit_card_number" rev="2.01.03-alpha03">
  <artifact name="credit_card_number" type="jar" />
</dependency>
@Grapes(
@Grab(group='pl.droidsonroids', module='credit_card_number', version='2.01.03-alpha03')
)
libraryDependencies += "pl.droidsonroids" % "credit_card_number" % "2.01.03-alpha03"
[pl.droidsonroids/credit_card_number "2.01.03-alpha03"]

Dependencies

compile (1)

Group / Artifact Type Version
org.apache.commons : commons-lang3 jar 3.4

provided (1)

Group / Artifact Type Version
org.threeten : threetenbp jar 1.3.2

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Build Status Maven Central

Credit Card Number

Credit Card Number is a Java library that can provide details of a bank issued credit card number.

The goal of this project is to use publicly and freely available documentation to create a reliable Java library to provide information about credit card numbers.

All classes are immutable and thread-safe. Secure data follows standards in the Java Cryptography Architecture (JCA) Reference Guide. The standard toString() function formats data in a readable form. Validity is enforced by JUnit tests.

Java 6 or newer is required. This library deliberately supports Java 6, to make it usable in Android apps. In order to be Java 8 ready, Credit Card Number depends on Stephen Colebourne's ThreeTen backport project, a port of JSR 310 to Java 6.

Some resources consulted are:

Download

You can download the jar on the Maven Central Repository.

Maven Build

To use Credit Card Number in your Maven build, include the following dependency. No repositories references are needed, since the jars are in the Maven Central Repository.

<dependency>
    <groupId>us.fatehi</groupId>
    <artifactId>credit_card_number</artifactId>
    <version>2.01.02</version>
</dependency>

Examples

How to Get Bank Card Information

To get bank card information, use code like:

AccountNumber pan = new AccountNumber("5266-0922-0141-6174");
ExpirationDate expiration = new ExpirationDate(2015, 4);
Name name = new Name("Sualeh", "Fatehi");
BankCard card = new BankCard(pan, expiration, name);
System.out.println(card);

and you will get this output:

Bank Card Information: 
  Raw Account Number: 5266-0922-0141-6174
  Primary Account Number: 5266092201416174
    Major Industry Identifier: 5 - Banking and financial
    Issuer Identification Number: 526609
    Card Brand: MasterCard
    Last Four Digits: 6174
    Passes Luhn Check? Yes
    Is Primary Account Number Valid? Yes
  Expiration Date: 1504
    Is Expired: No
  Name: Sualeh Fatehi

How to Secure the Credit Card Number

If you need the account number information, but want to be secure by not storing the actual primary account number in memory, you can use code like:

AccountNumber pan = new AccountNumber("5266-0922-0141-6174");
pan.dispose();
System.out.println(pan);

and you will get this output:

MasterCard-6174

Internationalization is Supported

You can use code like:

AccountNumber pan = new AccountNumber("५२६६ ०९२२ ०१४१ ६१७४");
System.out.println(pan);

and you will get this output:

5266092201416174
pl.droidsonroids

Droids On Roids

Mobile & Web App Development Company

Versions

Version
2.01.03-alpha03
2.01.03-alpha02
2.01.03-alpha01