File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -192,3 +192,25 @@ def discover(value: str, /):
192192 """
193193 pattern = re .compile (r"^(60|64|65)" )
194194 return card_number (value ) and len (value ) == 16 and pattern .match (value )
195+
196+
197+ @validator
198+ def mir (value : str , / ):
199+ """Return whether or not given value is a valid Mir card number.
200+
201+ Examples:
202+ >>> mir('2200123456789012')
203+ # Output: True
204+ >>> mir('4242424242424242')
205+ # Output: ValidationError(func=mir, args={'value': '4242424242424242'})
206+
207+ Args:
208+ value:
209+ Mir card number string to validate.
210+
211+ Returns:
212+ (Literal[True]): If `value` is a valid Mir card number.
213+ (ValidationError): If `value` is an invalid Mir card number.
214+ """
215+ pattern = re .compile (r"^(220[0-4])" )
216+ return card_number (value ) and len (value ) == 16 and pattern .match (value )
You can’t perform that action at this time.
0 commit comments