diff --git a/stripe/src/main/java/com/stripe/android/model/CardBrand.kt b/stripe/src/main/java/com/stripe/android/model/CardBrand.kt index 1398fff74d8..d5afad3cc35 100644 --- a/stripe/src/main/java/com/stripe/android/model/CardBrand.kt +++ b/stripe/src/main/java/com/stripe/android/model/CardBrand.kt @@ -117,7 +117,10 @@ enum class CardBrand( "mastercard", "Mastercard", R.drawable.stripe_ic_mastercard, - pattern = Pattern.compile("^(2221|2222|2223|2224|2225|2226|2227|2228|2229|223|224|225|226|227|228|229|23|24|25|26|270|271|2720|50|51|52|53|54|55|67)[0-9]*$") + pattern = Pattern.compile("^(2221|2222|2223|2224|2225|2226|2227|2228|2229|222|223|224|225|226|227|228|229|23|24|25|26|270|271|2720|50|51|52|53|54|55|56|57|58|59|67)[0-9]*$"), + partialPatterns = mapOf( + 2 to Pattern.compile("^(22|23|24|25|26|27|50|51|52|53|54|55|56|57|58|59|67)$") + ) ), UnionPay( diff --git a/stripe/src/test/java/com/stripe/android/model/CardBrandTest.kt b/stripe/src/test/java/com/stripe/android/model/CardBrandTest.kt index 6e23546a36a..00e0cd48119 100644 --- a/stripe/src/test/java/com/stripe/android/model/CardBrandTest.kt +++ b/stripe/src/test/java/com/stripe/android/model/CardBrandTest.kt @@ -311,4 +311,10 @@ class CardBrandTest { assertThat(CardBrand.fromCardNumber("352800")) .isEqualTo(CardBrand.JCB) } + + @Test + fun fromCardNumber_withMaestroBin_shouldReturnMastercard() { + assertThat(CardBrand.fromCardNumber("561243")) + .isEqualTo(CardBrand.MasterCard) + } }