[interchange] Allow Union Pay cards to skip luhn-10
Mark Johnson <[email protected]>
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 47b83ecbd1adf1f374ac1aca5b297b1a2df6f577 Author: Mark Johnson <[email protected]> Date: Tue Jan 7 21:56:56 2014 -0500 Allow Union Pay cards to skip luhn-10 UP does not enforce luhn-10 on their numbers: - http://code.google.com/p/chromium/issues/detail?id=242274 - http://en.wikipedia.org/wiki/Bank_card_number lib/Vend/Order.pm | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) --- diff --git a/lib/Vend/Order.pm b/lib/Vend/Order.pm index b002787..11d8afd 100644 --- a/lib/Vend/Order.pm +++ b/lib/Vend/Order.pm @@ -379,6 +379,13 @@ sub validate_whole_cc { $expire = $_ if m:/: ; } return 0 unless valid_exp_date($expire); + + # UnionPay (cards that /^62/) does not enforce Luhn + # References: + # - http://code.google.com/p/chromium/issues/detail?id=242274 + # - http://en.wikipedia.org/wiki/Bank_card_number + return 1 if $num =~ /^62/; + return luhn($num); } @@ -633,7 +640,11 @@ sub encrypt_standard_cc { return @return; } - unless ($valid = luhn($num) || $force ) { + # UnionPay (cards that /^62/) does not enforce Luhn + # References: + # - http://code.google.com/p/chromium/issues/detail?id=242274 + # - http://en.wikipedia.org/wiki/Bank_card_number + unless ($valid = luhn($num) || $force || $num =~ /^62/) { my $msg = errmsg("Credit card number fails LUHN-10 check."); $Vend::Session->{errors}{mv_credit_card_valid} = $msg; push @return, $msg;