[interchange] Updates to handle new MasterCard BIN-2 numbers
David Christensen <[email protected]> Wed, 20 Jul 2016 21:38:04 +0000
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 0b3381746dae6e9561c3199b2961d88a7e923429 Author: David Christensen <[email protected]> Date: Wed Jul 20 16:32:59 2016 -0500 Updates to handle new MasterCard BIN-2 numbers WHATSNEW-5.11 | 7 +++++++ dist/lib/UI/pages/admin/entry.html | 4 +++- dist/strap/include/checkout/payment_info | 4 +++- lib/Vend/Order.pm | 2 +- lib/Vend/Payment/Protx2.pm | 1 + 5 files changed, 15 insertions(+), 3 deletions(-) --- diff --git a/WHATSNEW-5.11 b/WHATSNEW-5.11 index b15bb01..dc9ed60 100644 --- a/WHATSNEW-5.11 +++ b/WHATSNEW-5.11 @@ -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 -------- diff --git a/dist/lib/UI/pages/admin/entry.html b/dist/lib/UI/pages/admin/entry.html index 235d35a..6dffe4d 100644 --- a/dist/lib/UI/pages/admin/entry.html +++ b/dist/lib/UI/pages/admin/entry.html @@ -789,7 +789,9 @@ function visible (selnam) { 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'; diff --git a/dist/strap/include/checkout/payment_info b/dist/strap/include/checkout/payment_info index 6c23cb7..d0835d5 100644 --- a/dist/strap/include/checkout/payment_info +++ b/dist/strap/include/checkout/payment_info @@ -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)'; } diff --git a/lib/Vend/Order.pm b/lib/Vend/Order.pm index 239de7d..7880263 100644 --- a/lib/Vend/Order.pm +++ b/lib/Vend/Order.pm @@ -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 ( diff --git a/lib/Vend/Payment/Protx2.pm b/lib/Vend/Payment/Protx2.pm index 3d5648b..99ede5e 100644 --- a/lib/Vend/Payment/Protx2.pm +++ b/lib/Vend/Payment/Protx2.pm @@ -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'} }