From 0a4b8b15bc49e336ac668b2e80484a31194e5e5a Mon Sep 17 00:00:00 2001 From: Vitaly Baev Date: Tue, 19 Jul 2022 13:20:37 +0300 Subject: [PATCH] [PS-1122] Adds Mir payment system (#3079) * Adds Mir payment system * Fixes Mir regex pattern and formatting * Changes Mir logos to Russian ones * Localize Mir in select --- apps/browser/src/_locales/en/messages.json | 3 +++ apps/desktop/src/locales/en/messages.json | 5 ++++- apps/web/src/locales/en/messages.json | 3 +++ libs/angular/src/components/add-edit.component.ts | 1 + libs/angular/src/components/icon.component.ts | 1 + libs/angular/src/images/cards/mir-dark.png | Bin 0 -> 505 bytes libs/angular/src/images/cards/mir-light.png | Bin 0 -> 644 bytes libs/angular/src/pipes/credit-card-number.pipe.ts | 6 ++++++ libs/angular/src/scss/icons.scss | 2 ++ libs/common/src/importers/baseImporter.ts | 6 ++++++ 10 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 libs/angular/src/images/cards/mir-dark.png create mode 100644 libs/angular/src/images/cards/mir-light.png diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json index 8211f8eeb6..4592e295b8 100644 --- a/apps/browser/src/_locales/en/messages.json +++ b/apps/browser/src/_locales/en/messages.json @@ -1973,5 +1973,8 @@ }, "disabledOrganizationFilterError" : { "message" : "Items in disabled Organizations cannot be accessed. Contact your Organization owner for assistance." + }, + "cardBrandMir": { + "message": "Mir" } } diff --git a/apps/desktop/src/locales/en/messages.json b/apps/desktop/src/locales/en/messages.json index 7d12b136e6..c86c37522e 100644 --- a/apps/desktop/src/locales/en/messages.json +++ b/apps/desktop/src/locales/en/messages.json @@ -1972,5 +1972,8 @@ }, "neverLockWarning": { "message": "Are you sure you want to use the \"Never\" option? Setting your lock options to \"Never\" stores your vault's encryption key on your device. If you use this option you should ensure that you keep your device properly protected." - } + }, + "cardBrandMir": { + "message": "Mir" + } } diff --git a/apps/web/src/locales/en/messages.json b/apps/web/src/locales/en/messages.json index 48d6f7fdf3..3a44482eb1 100644 --- a/apps/web/src/locales/en/messages.json +++ b/apps/web/src/locales/en/messages.json @@ -5267,5 +5267,8 @@ }, "on": { "message": "On" + }, + "cardBrandMir": { + "message": "Mir" } } diff --git a/libs/angular/src/components/add-edit.component.ts b/libs/angular/src/components/add-edit.component.ts index bac45023a9..da7862cc01 100644 --- a/libs/angular/src/components/add-edit.component.ts +++ b/libs/angular/src/components/add-edit.component.ts @@ -110,6 +110,7 @@ export class AddEditComponent implements OnInit { { name: "Maestro", value: "Maestro" }, { name: "UnionPay", value: "UnionPay" }, { name: "RuPay", value: "RuPay" }, + { name: i18nService.t("cardBrandMir"), value: "Mir" }, { name: i18nService.t("other"), value: "Other" }, ]; this.cardExpMonthOptions = [ diff --git a/libs/angular/src/components/icon.component.ts b/libs/angular/src/components/icon.component.ts index e715c57ec8..0696649e1f 100644 --- a/libs/angular/src/components/icon.component.ts +++ b/libs/angular/src/components/icon.component.ts @@ -20,6 +20,7 @@ const cardIcons: Record = { Maestro: "card-maestro", UnionPay: "card-union-pay", RuPay: "card-ru-pay", + Mir: "card-mir", }; @Component({ diff --git a/libs/angular/src/images/cards/mir-dark.png b/libs/angular/src/images/cards/mir-dark.png new file mode 100644 index 0000000000000000000000000000000000000000..e158470db06b450ca10dc6f339aa2ba832609397 GIT binary patch literal 505 zcmV> z001vDJuomhFfc$bGd(XfJTEjoE;KzbH99XdJuNalFEl;>|NmoWZp+NhmzthQPFAtA zw&msLeSn6FjgnScV)F9yq^GKIbb35NN<2YH*xA~bnV#6$+rGcT$qYuS0000CbW%=J zKmgw$5bw{wfH0q6YC4H#0003zNklu!S}7zSXdR&D!&BA#m7?f&m_AG9m5 zB`ll#S<0LEDN!Ern7}wMn;KhE9ShDm_P)bNilVE!_^+N4+qKyeuKNEp^VbX#!3L8jMCAs>(s~6AcTO6|epaaOALkchb z56}WSK7^EbKxlnQ#vu(XU!eX8U9<-+aY!h==sx~pZrX=J8{t&_}`0MU|00000NkvXXu0mjfqjk}r literal 0 HcmV?d00001 diff --git a/libs/angular/src/images/cards/mir-light.png b/libs/angular/src/images/cards/mir-light.png new file mode 100644 index 0000000000000000000000000000000000000000..e49974152055802e5765ac170948031ed2b4aa4c GIT binary patch literal 644 zcmV-~0(BHUAOP6|SsgO&U zdc)n)Erw*J%e}BQUmy^G ze}MiGVE_ODYDq*vR9M69*J*EpFc`q`a)^5#pooLXP6xZxdF;NA@Bgj#v__#@(q*eJ zw%C8-0}biVzAz>*#)1tGjdFb^YB^|}(;|qRGBTLa zLbQ;DEM%d-3Gqav+!taNv@WJ}Glk0@wI$O)X(;LdH4A01DJI!Gn?JfbKRGBG=mgZ1}E^Dvm4bo?UgIGmIm59y?-?Ay+ eHDkPXz}N@yNTwLm_9*rM0000 = { { cardLength: 19, blocks: [6, 13] }, ], Amex: [{ cardLength: 15, blocks: [4, 6, 5] }], + Mir: [ + { cardLength: 16, blocks: [4, 4, 4, 4] }, + { cardLength: 17, blocks: [5, 4, 4, 4] }, + { cardLength: 18, blocks: [6, 4, 4, 4] }, + { cardLength: 19, blocks: [7, 4, 4, 4] }, + ], Other: [{ cardLength: 16, blocks: [4, 4, 4, 4] }], }; diff --git a/libs/angular/src/scss/icons.scss b/libs/angular/src/scss/icons.scss index 58c860ff7e..eaf061912d 100644 --- a/libs/angular/src/scss/icons.scss +++ b/libs/angular/src/scss/icons.scss @@ -9,6 +9,7 @@ $card-icons: ( "mastercard": $card-icons-base + "mastercard-light.png", "union-pay": $card-icons-base + "union_pay-light.png", "ru-pay": $card-icons-base + "ru_pay-light.png", + "mir": $card-icons-base + "mir-light.png", ); $card-icons-dark: ( @@ -21,6 +22,7 @@ $card-icons-dark: ( "mastercard": $card-icons-base + "mastercard-dark.png", "union-pay": $card-icons-base + "union_pay-dark.png", "ru-pay": $card-icons-base + "ru_pay-dark.png", + "mir": $card-icons-base + "mir-dark.png", ); .credit-card-icon { diff --git a/libs/common/src/importers/baseImporter.ts b/libs/common/src/importers/baseImporter.ts index 122b34724d..0e1192a652 100644 --- a/libs/common/src/importers/baseImporter.ts +++ b/libs/common/src/importers/baseImporter.ts @@ -301,6 +301,12 @@ export abstract class BaseImporter { return "Visa"; } + // Mir + re = new RegExp("^220[0-4]"); + if (cardNum.match(re) != null) { + return "Mir"; + } + return null; }