@la-bete/ccgen
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

CCGen

codecov BuildStatus

A simple credit card generator.

Installation

    $ npm install @la-bete/ccgen

Basic Usage

import { CCGen } from "@la-bete/ccgen";
const ccgen = new CCGen();

const CC = ccgen.generateCC();
/*
    CC => {
        name: [string],
        cvv: [string],
        pan: [string],
        expiryDate: [string],
        brand: [string]
    }
*/

const pan = 12345678934567;
const isPANValid = ccgen.validatePAN(pan);
// isPANValid => false

GenerateCC

The generateCC method takes an optional Options argument. PAN(Primary Account Number) refers to the 16-digit number generated, BIN(Bank Identification Number) is the first 6 digits of a PAN and can be used to identify the PAN's brand and issuer. CC refers to the credit card generated as well as other details, such as name, cvv, expiry date

Name Description Default
brand This should be one of visa, mastercard or verve ""
startsWith A string of numbers the generated PAN should start with A random BIN
endsWith A string of numbers the generated PAN should end with ""
contains A string of numbers the generated PAN should include ""
amount The quantity of CCs to generate. If this is greater than 1, an array is returned else, the single CC is returned 1
attributes The properties that should be present in the CC returned, you can pass a single string or an array of strings ["name", "cvv", "pan", "expiryDate", "brand", "issuer"]
issuer The bank issuing the CC. Find below the list of acceptable strings for this argument ""

Available Issuers

For the options.issuer argument, you have to pass one of the keys of the object below. The corresponding bank is also shown below.

{
    "fcmb": "First City Monument Bank",
    "wema": "Wema Bank PLC",
    "union": "Union Bank of Nigeria",
    "access": "Access Bank PLC",
    "zenith": "Zenith Bank PLC",
    "gtb": "Guaranty Trust Bank PLC",
    "ecobank": "Ecobank Nigeria PLC",
    "stanbic": "Stanbic IBTC Bank",
    "uba": "United Bank for Africa PLC",
    "intercontinental": "Intercontinental Bank PLC",
    "polaris": "Polaris Bank PLC",
    "fbn": "First Bank of Nigeria PLC",
    "scbn": "Standard Chartered Bank"
};

ValidatePAN

This method can accept a single PAN or an array of PANs. If a single PAN is passed in, a boolean is returned which tells whether the PAN is Luhn-valid. If an array of PANs is passed in, an object is returned whose keys are the passed-in PANs while the entries are booleans showing the Luhn-validity of each key.

Readme

Keywords

Package Sidebar

Install

npm i @la-bete/ccgen

Weekly Downloads

1

Version

0.1.2

License

MIT

Unpacked Size

465 kB

Total Files

19

Last publish

Collaborators

  • la-bete