Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitaecb33a

Browse files
antonch1989nicolas-grekas
authored andcommitted
[Validator] add MIR card scheme
1 parentd2e9a70 commitaecb33a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

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

Lines 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‎

Lines 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)

[8]ページ先頭

©2009-2025 Movatter.jp