Git Product home page Git Product logo

pycard's Introduction

pycard (pronounced picard)

pycard is a payment card validation library with a simple interface and no external dependencies.

Installation

pip install captain-pycard  # pycard was taken in PyPi

That's it, and there are no dependencies!

Usage

import pycard

# Create a card
card = pycard.Card(
    number='4444333322221111',
    month=1,
    year=2020,
    cvc=123
)

# Validate the card (checks that the card isn't expired and is mod10 valid)
assert card.is_valid

# Perform validation checks individually
assert not card.is_expired
assert card.is_mod10_valid

# The card is a visa
assert card.brand == 'visa'
assert card.friendly_brand == 'Visa'
assert card.mask == 'XXXX-XXXX-XXXX-1111'

# The card is a known test card
assert card.is_test

pycard's People

Contributors

fevral13 avatar joshkel avatar orokusaki avatar samox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pycard's Issues

iteritems is no longer supported in python 3

Hi! Please fix a simple issue - as in subj - it does not run in 3.4 and probably any 3x as:

the dict.iterkeys(), dict.iteritems() and dict.itervalues() methods are no longer supported.

line 93 to:
for brand, regexp in self.BRANDS.items():

thanks and regards,
Anton

What is the license?

What license have you released this under? Can you please include something in the repo to clarify?

Set up unit testing

Even though this library is small, it still lacks unit testing. Pytest might be the best choice to pick due to its simplicity.

Add support for new MasterCard BINs (2-series)

MasterCard has just introduced their new Bank Identification Number series, which will start with the number 2. According to their explanation page:

Mastercard® has received an additional range of 2-series numbers to add to the 5-series that we currently provide. The 2-series BINs operate in the same way as the 5-series and we have made changes to our systems to accommodate the new numbers. Readiness for the 2-series across our issuers, merchants and other partners is tracking on target dates listed below. Mastercard customer financial institutions can expect to be issued 2-series BINs starting in 2017.

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.