Skip to content

Commit 5736ce7

Browse files
author
Robert He
committed
MAGETWO-68868: [Backport] Updated Discover and Maestro/Mastercard BINs - for 2.0.x
- back porting changes
1 parent 8dafb2c commit 5736ce7

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

app/code/Magento/Payment/Model/Method/Cc.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,18 @@ public function validate()
133133
// Visa
134134
'VI' => '/^4[0-9]{12}([0-9]{3})?$/',
135135
// Master Card
136-
'MC' => '/^5[1-5][0-9]{14}$/',
136+
'MC' => '/^(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/',
137137
// American Express
138138
'AE' => '/^3[47][0-9]{13}$/',
139139
// Discover
140-
'DI' => '/^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})' .
141-
'|36[0-9]{12}|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}' .
142-
'|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}' .
143-
'|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}' .
144-
'|5[0-9]{14}))$/',
140+
'DI' => '/^(6011((0|9|[2-4])[0-9]{11,14}|(74|7[7-9]|8[6-9])[0-9]{10,13})' .
141+
'|6(4[4-9][0-9]{13,16}|5[0-9]{14,17}))/',
142+
'DN' => '/^3(0[0-5][0-9]{13,16}|095[0-9]{12,15}|(6|[8-9])[0-9]{14,17})/',
143+
// UnionPay
144+
'UN' => '/^622(1(2[6-9][0-9]{10,13}|[3-9][0-9]{11,14})|[3-8][0-9]{12,15}' .
145+
'|9([[0-1][0-9]{11,14}|2[0-5][0-9]{10,13}))|62[4-6][0-9]{13,16}|628[2-8][0-9]{12,15}/',
145146
// JCB
146-
'JCB' => '/^(30[0-5][0-9]{13}|3095[0-9]{12}|35(2[8-9][0-9]{12}|[3-8][0-9]{13})|36[0-9]{12}' .
147-
'|3[8-9][0-9]{14}|6011(0[0-9]{11}|[2-4][0-9]{11}|74[0-9]{10}|7[7-9][0-9]{10}' .
148-
'|8[6-9][0-9]{10}|9[0-9]{11})|62(2(12[6-9][0-9]{10}|1[3-9][0-9]{11}|[2-8][0-9]{12}' .
149-
'|9[0-1][0-9]{11}|92[0-5][0-9]{10})|[4-6][0-9]{13}|8[2-8][0-9]{12})|6(4[4-9][0-9]{13}' .
150-
'|5[0-9]{14}))$/',
147+
'JCB' => '/^35(2[8-9][0-9]{12,15}|[3-8][0-9]{13,16})/',
151148
'MI' => '/^(5(0|[6-9])|63|67(?!59|6770|6774))[0-9]{10,17}/',
152149
'MD' => '/^(6759(?!24|38|40|6[3-9]|70|76)[0-9]{8,15}|(676770|676774)[0-9]{6,13})/',
153150
];
@@ -214,6 +211,8 @@ public function getVerificationRegEx()
214211
'MC' => '/^[0-9]{3}$/',
215212
'AE' => '/^[0-9]{4}$/',
216213
'DI' => '/^[0-9]{3}$/',
214+
'DN' => '/^[0-9]{3}$/',
215+
'UN' => '/^[0-9]{3}$/',
217216
'SS' => '/^[0-9]{3,4}$/',
218217
'SM' => '/^[0-9]{3,4}$/',
219218
'SO' => '/^[0-9]{3,4}$/',

dev/tests/js/jasmine/tests/lib/mage/validation.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright © 2016 Magento. All rights reserved.
2+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
55
define([

0 commit comments

Comments
 (0)