8000 [Validator] Update MIR card scheme · symfony/symfony@fb15542 · GitHub
[go: up one dir, main page]

Skip to content

Commit fb15542

Browse files
committed
[Validator] Update MIR card scheme
1 parent 4df1173 commit fb15542

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ class CardSchemeValidator extends ConstraintValidator
7777
'/^5[1-5][0-9]{14}$/',
7878
'/^2(22[1-9][0-9]{12}|2[3-9][0-9]{13}|[3-6][0-9]{14}|7[0-1][0-9]{13}|720[0-9]{12})$/',
7979
],
80-
// Payment system MIR numbers start with 220, then 1 digit from 0 to 4, then 12 digits
80+
// Payment system MIR numbers start with 220, then 1 digit from 0 to 4, then between 12 and 15 digits
8181
'MIR' => [
82-
'/^220[0-4][0-9]{12}$/',
82+
'/^220[0-4][0-9]{12,15}$/',
8383
],
8484
// All UATP card numbers start with a 1 and have a length of 15 digits.
8585
'UATP' => [

src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ public function getValidNumbers()
104104
['MASTERCARD', '2709999999999999'],
105105
['MASTERCARD', '2720995105105100'],
106106
['MIR', '2200381427330082'],
107+
['MIR', '22003814273300821'],
108+
['MIR', '220038142733008212'],
109+
['MIR', '2200381427330082123'],
107110
['UATP', '110165309696173'],
108111
['VISA', '4111111111111111'],
109112
['VISA', '4012888888881881'],
@@ -136,7 +139,8 @@ public function getInvalidNumbers()
136139
['MASTERCARD', '2721001234567890', CardScheme::INVALID_FORMAT_ERROR], // Not assigned yet
137140
['MASTERCARD', '2220991234567890', CardScheme::INVALID_FORMAT_ERROR], // Not assigned yet
138141
['UATP', '11016530969617', CardScheme::INVALID_FORMAT_ERROR], // invalid length
139-
['MIR', '22003814273300821', CardScheme::INVALID_FORMAT_ERROR], // invalid length
142+
['MIR', '220038142733008', CardScheme::INVALID_FORMAT_ERROR], // invalid length
143+
['MIR', '22003814273300821234', CardScheme::INVALID_FORMAT_ERROR], // invalid length
140144
];
141145
}
142146
}

0 commit comments

Comments
 (0)
0