Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 81faf42

Browse filesBrowse files
feature #30377 [Validator] add MIR card scheme (antonch1989)
This PR was squashed before being merged into the 4.3-dev branch (closes #30377). Discussion ---------- [Validator] add MIR card scheme | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #30376 | License | MIT Commits ------- aecb33a [Validator] add MIR card scheme
2 parents 5b38e17 + aecb33a commit 81faf42
Copy full SHA for 81faf42

File tree

2 files changed

+6
-0
lines changed
Filter options

2 files changed

+6
-0
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/CardSchemeValidator.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ class CardSchemeValidator extends ConstraintValidator
7878
'/^5[1-5][0-9]{14}$/',
7979
'/^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})$/',
8080
],
81+
// Payment system MIR numbers start with 220, then 1 digit from 0 to 4, then 12 digits
82+
'MIR' => [
83+
'/^220[0-4][0-9]{12}$/',
84+
],
8185
// All UATP card numbers start with a 1 and have a length of 15 digits.
8286
'UATP' => [
8387
'/^1[0-9]{14}$/',

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/CardSchemeValidatorTest.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ public function getValidNumbers()
103103
['MASTERCARD', '2699999999999999'],
104104
['MASTERCARD', '2709999999999999'],
105105
['MASTERCARD', '2720995105105100'],
106+
['MIR', '2200381427330082'],
106107
['UATP', '110165309696173'],
107108
['VISA', '4111111111111111'],
108109
['VISA', '4012888888881881'],
@@ -135,6 +136,7 @@ public function getInvalidNumbers()
135136
['MASTERCARD', '2721001234567890', CardScheme::INVALID_FORMAT_ERROR], // Not assigned yet
136137
['MASTERCARD', '2220991234567890', CardScheme::INVALID_FORMAT_ERROR], // Not assigned yet
137138
['UATP', '11016530969617', CardScheme::INVALID_FORMAT_ERROR], // invalid length
139+
['MIR', '22003814273300821', CardScheme::INVALID_FORMAT_ERROR], // invalid length
138140
];
139141
}
140142
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.