Skip to content

Commit 3a0433f

Browse files
committed
feat: extend Mastercard brand validation to include new BIN range
1 parent 66caa98 commit 3a0433f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pydantic_extra_types/payment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def validate_brand(card_number: str) -> PaymentCardBrand:
147147
if card_number[0] == '4':
148148
brand = PaymentCardBrand.visa
149149
required_length = [13, 16, 19]
150-
elif 51 <= int(card_number[:2]) <= 55:
150+
elif (51 <= int(card_number[:2]) <= 55) or (2221 <= int(card_number[:4]) <= 2720):
151151
brand = PaymentCardBrand.mastercard
152152
required_length = [16]
153153
elif card_number[:2] in {'34', '37'}:

0 commit comments

Comments
 (0)