GithubHelp home page GithubHelp logo

thaingo / magnetictrackparser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sualeh/magnetictrackparser

0.0 1.0 0.0 500 KB

Java 6 library that can parse magnetic stripes from a bank issued credit card.

License: GNU Lesser General Public License v3.0

Java 100.00%

magnetictrackparser's Introduction

Build Status Maven Central

Magnetic Track Parser

Magnetic Track Parser is a Java library that can parse magnetic track data from a bank issued credit card, such as might be returned from a USB magnetic card stripe reader.

The goal of this project is to use publicly and freely available documentation to create a reliable Java library to provide information about magnetic tracks and 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.

Magnetic Track Parser depends on the Credit Card Number library.

Java 6 or newer is required. This library deliberately supports Java 6, to make it usable in Android apps.

Some resources consulted are:

Download

You can download the jar on the Maven Central Repository.

Maven Build

To use Magnetic Track Parser 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>magnetictrackparser</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("371449635398431");
BankCard card = new BankCard(pan);
System.out.println(card);

and you will get this output:

Bank Card Information: 
  Raw Account Number: 371449635398431
  Primary Account Number: 371449635398431
    Major Industry Identifier: 3 - Travel and entertainment and banking/financial
    Issuer Identification Number: 371449
    Card Brand: AmericanExpress
    Last Four Digits: 8431
    Passes Luhn Check? Yes
    Is Primary Account Number Valid? Yes

How to Parse Magnetic Track Data

To parse a magnetic track, use code like:

BankCardMagneticTrack track = 
  BankCardMagneticTrack.from("%B5350290149345177^FATEHI/SUALEH^16042010000000000000000000000000000567001000?;5350290149345177=16042010000056700100?");
System.out.println(track);

and you will get this output:

TRACK 1: %B5350290149345177^FATEHI/SUALEH^16042010000000000000000000000000000567001000?
  Primary Account Number: 5350290149345177
  Expiration Date: 2016-04
  Name: Sualeh Fatehi
  Service Code: 201
  Discretionary Data: 0000000000000000000000000000567001000
TRACK 2: ;5350290149345177=16042010000056700100?
  Primary Account Number: 5350290149345177
  Expiration Date: 2016-04
  Service Code: 201
  Discretionary Data: 0000056700100
TRACK 3:  Not Available.

Bank Card Information: 
  Raw Account Number: 5350290149345177
  Primary Account Number: 5350290149345177
    Major Industry Identifier: 5 - Banking and financial
    Issuer Identification Number: 535029
    Card Brand: MasterCard
    Last Four Digits: 5177
    Passes Luhn Check? Yes
    Is Primary Account Number Valid? Yes
  Expiration Date: 2016-04
    Is Expired: Yes
  Name: Sualeh Fatehi
  Service Code: 
    2 - Interchange: International interchange. Technology: Integrated circuit card.
    0 - Authorization Processing: Normal.
    1 - Allowed Services: No restrictions. PIN Requirements: None.

Who Uses

  • Dmitry Holodov's excellent Android app, SwipeYours uses magnetictrackparser. See details in SetCardActivity.java. This Android app helps developers understand the new Android Host Card Emulation feature for payments, and is written with open source, in the same spirit as magnetictrackparser.

magnetictrackparser's People

Contributors

sualeh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.