8000 bug #42341 [Validator] Update MIR card scheme (ossinkine) · symfony/symfony@2cee75b · GitHub
[go: up one dir, main page]

Skip to content

Commit 2cee75b

Browse files
committed
bug #42341 [Validator] Update MIR card scheme (ossinkine)
This PR was merged into the 4.4 branch. Discussion ---------- [Validator] Update MIR card scheme | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT Update card scheme validator for MIR cards, it's allowing 16-19 numbers length Commits ------- fb15542 [Validator] Update MIR card scheme
2 parents 4df1173 + fb15542 commit 2cee75b

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