improvement: Add RuPay credit card #365

This commit is contained in:
Artem Chepurnoy 2024-05-28 20:01:09 +03:00
parent 58e2840373
commit f4c4b2ded9
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,44 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="780dp"
android:height="780dp"
android:viewportWidth="780"
android:viewportHeight="780">
<path
android:pathData="M0,0h780v780h-780z"
android:fillColor="#ffffff"/>
<path
android:pathData="m717.47,308.19 l41.9,83.19 -88.07,83.23z"
android:fillColor="#008c44"
android:strokeColor="#00000000"
android:fillType="nonZero"/>
<path
android:pathData="M688.45,308.19 L730.29,391.38 642.27,474.61Z"
android:fillColor="#f47920"
android:strokeColor="#00000000"
android:fillType="nonZero"/>
<path
android:pathData="m16.75,444.35 l41.77,-150.49l66.78,-0c20.87,-0 34.81,3.3 41.91,10.11 7.04,6.75 8.4,17.78 4.15,33.27 -2.57,9.13 -6.47,16.79 -11.83,22.84 -5.32,6.06 -12.33,10.86 -20.97,14.39 7.33,1.76 11.99,5.26 14.08,10.5 2.08,5.24 1.84,12.89 -0.69,22.92L146.88,428.91 146.87,429.48C145.4,435.37 145.84,438.52 148.22,438.77L146.69,444.35L101.51,444.35c0.15,-3.54 0.43,-6.71 0.73,-9.37 0.33,-2.72 0.73,-4.83 1.13,-6.28l4.21,-15.03c2.12,-7.82 2.25,-13.27 0.28,-16.41 -1.99,-3.22 -6.44,-4.81 -13.46,-4.81L75.42,392.46L60.95,444.35ZM84.82,358.54l20.34,-0c7.13,-0 12.39,-1.02 15.63,-3.12 3.26,-2.12 5.67,-5.71 7.09,-10.89 1.47,-5.27 1.11,-8.95 -1,-11.04 -2.1,-2.12 -7.14,-3.15 -15.06,-3.15l-19.17,-0z"
android:fillColor="#1b3281"
android:strokeColor="#00000000"
android:fillType="nonZero"/>
<path
android:pathData="m295.36,333.29 l-30.79,111.05l-37.42,-0l4.6,-16.27c-6.59,6.47 -13.33,11.38 -20.12,14.52 -6.74,3.19 -13.85,4.77 -21.34,4.77 -6.19,-0 -11.5,-1.12 -15.78,-3.35 -4.33,-2.22 -7.55,-5.6 -9.72,-10.05 -1.93,-3.9 -2.76,-8.71 -2.44,-14.46 0.35,-5.66 2.34,-15.21 6.05,-28.58L184.35,333.29l40.93,-0l-15.93,57.36c-2.33,8.4 -2.88,14.3 -1.75,17.51 1.18,3.24 4.34,4.92 9.46,4.92 5.16,-0 9.49,-1.87 13.07,-5.68 3.63,-3.78 6.44,-9.41 8.54,-16.91L254.48,333.29Z"
android:fillColor="#1b3281"
android:strokeColor="#00000000"
android:fillType="nonZero"/>
<path
android:pathData="m280.51,444.35 l41.73,-150.49l57.4,-0c12.67,-0 22.47,0.75 29.46,2.39 6.98,1.57 12.45,4.12 16.51,7.72 5.09,4.71 8.22,10.54 9.5,17.53 1.21,6.99 0.49,15.13 -2.15,24.7C428.29,363.01 420.09,375.9 408.41,384.91 396.7,393.8 382.21,398.27 364.91,398.27L338.05,398.27L325.28,444.35ZM348.22,361.52l14.43,-0c9.33,-0 15.89,-1.15 19.74,-3.38 3.72,-2.25 6.36,-6.26 7.98,-11.95 1.61,-5.77 1.2,-9.8 -1.24,-12.06 -2.34,-2.24 -8.34,-3.38 -17.92,-3.38l-14.41,-0z"
android:fillColor="#1b3281"
android:strokeColor="#00000000"
android:fillType="nonZero"/>
<path
android:pathData="m481.11,444.35 l0.42,-10.55c-6.6,4.94 -13.29,8.68 -20.01,11.01 -6.69,2.38 -13.82,3.58 -21.45,3.58 -11.59,-0 -19.68,-3.15 -24.35,-9.25 -4.62,-6.11 -5.38,-14.88 -2.22,-26.07 3.02,-11.04 8.38,-19.17 16.12,-24.37 7.7,-5.26 20.55,-9.02 38.58,-11.43 2.29,-0.37 5.35,-0.67 9.19,-1.13 13.33,-1.54 20.81,-5.09 22.43,-10.89 0.84,-3.17 0.33,-5.51 -1.64,-6.95 -1.9,-1.49 -5.45,-2.22 -10.58,-2.22 -4.26,-0 -7.68,0.88 -10.49,2.72 -2.8,1.85 -4.9,4.56 -6.32,8.37l-39.91,-0c3.6,-12.5 10.97,-21.95 22.02,-28.26 11.01,-6.43 25.54,-9.52 43.52,-9.52 8.46,-0 16.03,0.79 22.73,2.51 6.71,1.64 11.61,3.99 14.79,6.83 3.91,3.54 6.23,7.58 6.89,12.04 0.76,4.45 -0.07,10.84 -2.41,19.19L521.24,431.86C520.69,433.89 520.59,435.69 520.88,437.34 521.24,438.91 521.93,440.25 523.14,441.21L522.22,444.35ZM491.06,394.76C486.72,396.5 481.07,398.18 474.05,400.02 463.02,402.97 456.82,406.92 455.48,411.8 454.55,414.94 454.92,417.36 456.46,419.2c1.51,1.75 4.14,2.63 7.85,2.63 6.79,-0 12.25,-1.72 16.32,-5.11 4.08,-3.44 7.13,-8.83 9.26,-16.27 0.37,-1.58 0.7,-2.72 0.91,-3.57z"
android:fillColor="#1b3281"
android:strokeColor="#00000000"
android:fillType="nonZero"/>
<path
android:pathData="m522.53,488.1 l9.08,-32.87l11.71,-0c3.91,-0 6.99,-0.77 9.17,-2.18 2.21,-1.46 3.72,-3.93 4.59,-7.25 0.43,-1.46 0.7,-3 0.88,-4.75 0.12,-1.85 0.12,-3.81 0,-6.08L551.72,333.29L593.15,333.29L592.51,400.67 628.68,333.29L667.21,333.29L603.26,443.81C596.01,456.16 590.73,464.65 587.38,469.28 584.08,473.85 580.94,477.41 577.9,479.82 573.95,483.15 569.55,485.5 564.79,486.88 560.03,488.28 552.77,488.98 543.01,488.98c-2.81,-0 -6.04,-0.05 -9.53,-0.24C530.01,488.61 526.31,488.4 522.53,488.1"
android:fillColor="#1b3281"
android:strokeColor="#00000000"
android:fillType="nonZero"/>
</vector>

View File

@ -133,7 +133,7 @@ val creditCardMaestro = CreditCardType(
name = "Maestro",
icon = Res.drawable.ic_card_maestro,
digits = 12..19,
pattern = "^(?:5[06789]\\d\\d|(?!6011[0234])(?!60117[4789])(?!60118[6789])(?!60119)(?!64[456789])(?!65)6\\d{3})\\d{8,15}\$".toRegex(),
pattern = "^(5018|5020|5038|5893|6304|6759|6761|6762|6763)\\d{8,15}\$".toRegex(),
eagerPattern = "^(5(018|0[23]|[68])|6[37]|60111|60115|60117([56]|7[56])|60118[0-5]|64[0-3]|66)".toRegex(),
groupPattern = "(\\d{1,4})(\\d{1,4})?(\\d{1,4})?(\\d{1,4})?(\\d{1,3})?".toRegex(),
)
@ -183,6 +183,14 @@ val creditCardUnionPay = CreditCardType(
groupPattern = "(\\d{1,4})(\\d{1,4})?(\\d{1,4})?(\\d{1,4})?(\\d{1,3})?".toRegex(),
)
val creditCardRupay = CreditCardType(
name = "RuPay",
icon = Res.drawable.ic_card_rupay,
pattern = "^(60\\d|65\\d|81\\d|82\\d|508|353|356)\\d{13}\$".toRegex(),
eagerPattern = "^(60|65|81|82|508|353|356)".toRegex(),
groupPattern = "(\\d{1,4})(\\d{1,4})?(\\d{1,4})?(\\d{1,4})?".toRegex(),
)
// Sorted by popularity
val creditCards = persistentListOf(
creditCardVisa,
@ -201,6 +209,7 @@ val creditCards = persistentListOf(
creditCardUATP,
creditCardMada,
creditCardMeeza,
creditCardRupay,
)
fun List<CreditCardType>.firstOrNullByBrand(