Skip to content

Commit

Permalink
Updates to handle new MasterCard BIN-2 numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
David Christensen committed Jul 20, 2016
1 parent 372f515 commit 0b33817
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions WHATSNEW-5.11
Expand Up @@ -8,6 +8,13 @@
------------------------------------------------------------------------------


Payments
--------

* Add BIN-2 MasterCard number support to Vend::Order, catalog templates,
admin, and Vend::Payment modules which require it.


Database
--------

Expand Down
4 changes: 3 additions & 1 deletion dist/lib/UI/pages/admin/entry.html
Expand Up @@ -789,7 +789,9 @@
num.substr(0,2) == '52' ||
num.substr(0,2) == '53' ||
num.substr(0,2) == '54' ||
num.substr(0,2) == '55'
num.substr(0,2) == '55' ||
( num.substr(0,6) >= 222100 &&
num.substr(0,6) <= 272099)
)
{
type = 'mc';
Expand Down
4 changes: 3 additions & 1 deletion dist/strap/include/checkout/payment_info
Expand Up @@ -72,7 +72,9 @@
num.substr(0,2) == '52' ||
num.substr(0,2) == '53' ||
num.substr(0,2) == '54' ||
num.substr(0,2) == '55'
num.substr(0,2) == '55' ||
( num.substr(0,6) >= 222100 &&
num.substr(0,6) <= 272099)
) {
type = 'mc'; desc = '(Mastercard)';
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Vend/Order.pm
Expand Up @@ -480,7 +480,7 @@ sub guess_cc_type {
elsif ($ccnum =~ /^4(?:\d{12}|\d{15})$/)
{ return 'visa' }

elsif ($ccnum =~ /^5[1-5]\d{14}$/)
elsif ($ccnum =~ /^5[1-5]\d{14}$/ || ($ccnum =~ /^(2\d{5})\d{10}$/ && ($1 >= 222100 && $1 < 272100)))
{ return 'mc' }

elsif (
Expand Down
1 change: 1 addition & 0 deletions lib/Vend/Payment/Protx2.pm
Expand Up @@ -716,6 +716,7 @@ sub protx {

elsif ($ccnum =~ /^4(?:\d{12}|\d{15})$/) {$cardType = 'Visa'}
elsif ($ccnum =~ /^5[1-5]\d{14}$/) {$cardType = 'MC'}
elsif ($ccnum =~ /^(2\d{5})\d{10}$/ && $1 >= 222100 && $1 < 272100) {$cardType = 'MC'}
elsif ($ccnum =~ /^3[47]\d{13}$/) {$cardType = 'Amex'}
}

Expand Down

0 comments on commit 0b33817

Please sign in to comment.