NAME
BZS::CCCheck - Credit Card Check numbers
SYNOPSIS
use BZS::CCCheck qw(
@CC_months
CC_year
CC_expired
CC_is_zip
CC_is_name
CC_is_addr
CC_clean
CC_digits
CC_format
);
DESCRIPTION
This module checks the validity of the numbers and dates for a credit card entry, including the parity of the CC number itself.
- @CC_months
-
An array of 3 character text months. i.e. Jan, Feb....
- $scalar = CC_year
-
Returns the localtime calendar year.
- $scalar = CC_expired(numeric_month,20xx)
-
Returns true if card is expired or month year has bad fromat else false
- $scalar = CC_is_zip(zipcode);
-
Check for valid zip code, returns false or the zipcode.
- $scalar = CC_is_name(name);
-
Check for a name string greater than three characters. Return false if short, otherwise return the name.
- $scalar = CC_is_addr(address);
-
Check for a string containing at least 3 words and one endline. Return false if short, otherwise return the address.
- $scalar = CC_clean(credit_card_number);
-
Remove blanks and dashes, verify numeric content. Returns false if invalid characters are present, otherwise the cleaned credit card number.
- $scalar = CC_digits(credit_card_number);
-
Pre-process with CC_clean.
Returns false if the card number fails the check digit match (except for enRoute which does not require a check digit) otherwise returns exact text identifying the card issuer that is one of:
MasterCard VISA AmericanExpress DinersClub/Carteblanche Discover enRoute JCB
- $scalar = CC_format(credit_card_number);
-
Pre-process with CC_clean, CC_digits.
Returns the credit card number as a group of quadruples separated by spaces. The trailing (right hand) group will contain any remaining non-quad number set.
HOW IT WORKS
MOD10 Check Digit calculation
Credit Card Validation - Check Digits
This document outlines procedures and algorithms for Verifying the accuracy and validity of credit card numbers. Most credit card numbers are encoded with a "Check Digit". A check digit is a digit added to a number (either at the end or the beginning) that validates the authenticity of the number. A simple algorithm is applied to the other digits of the number which yields the check digit. By running the algorithm, and comparing the check digit you get from the algorithm with the check digit encoded with the credit card number, you can verify that you have correctly read all of the digits and that they make a valid combination.
Possible uses for this information:
When a user has keyed in a credit card number (or scanned it)
and you want to validate it before sending it our for debit
authorization. When issuing cards, say an affinity card, you
might want to add a check digit using the MOD 10 method.
LUHN Formula (Mod 10) for Validation of Primary Account Number
The following steps are required to validate the primary account number:
- Step 1:
-
Double the value of alternate digits of the primary account number beginning with the second digit from the right (the first right--hand digit is the check digit.)
- Step 2:
-
Add the individual digits comprising the products obtained in Step 1 to each of the unaffected digits in the original number.
- Step 3:
-
The total obtained in Step 2 must be a number ending in zero (30, 40, 50, etc.) for the account number to be validated.
For example, to validate the primary account number 49927398716:
Note: Card is valid because the 70/10 yields no remainder.
The validation applied (last known date 3/96) is the so called LUHN Formula (Mod 10) for Validation of Primary Account Number Validation criteria are:
1. number prefix
2. number of digits
3. mod10 (for all but enRoute which uses only 1 & 2)
... according to the following list of criteria requirements:
Card Type Prefix Length Check-Digit Algoritm
MC 51 - 55 16 mod 10
VISA 4 13, 16 mod 10
AMX 34, 37 15 mod 10
Diners Club / 300-305, 36, 38 14 mod 10
Carte Blanche
Discover 6011 16 mod 10
enRoute 2014, 2149 16 - any -
JCB 3 16 mod 10
JCB 2131, 1800 15 mod 10
- EXPORT_OK
-
@CC_months CC_clean CC_digits CC_format CC_year CC_gen_date CC_is_name CC_is_addr CC_is_zip CC_expired
COPYRIGHT
Copyright 2001 - 2006, Michael Robinton <michael@bizsystems.com>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (except as noted otherwise in individuals sub modules) published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
AUTHOR
Michael Robinton, <michael@bizsystems.com>
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 351:
'=item' outside of any '=over'
- Around line 365:
You forgot a '=back' before '=head1'