1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 01:33:33 +00:00

[PM-1823] Defining the card brand according to its number (#5204)

* Defining the card brand according to its number

* Moving cardBrandByPatterns function to Card View

* Getting Card brand via cardBrandByPatterns function

* Changing cardBrandByPatterns method to static. See:
The reason being that someone wanting to use this outside of the onCardNumberChange would need to know to set the cc-number on the view-model before calling cardBrandByPatterns

* Defining the card brand according to its number on Desktop

* Defining the card brand according to its number on Web
This commit is contained in:
Thales Augusto
2023-06-09 15:44:33 -03:00
committed by GitHub
parent ab260a3653
commit c70d67bad3
22 changed files with 89 additions and 79 deletions

View File

@@ -1,5 +1,6 @@
import { SecureNoteType } from "@bitwarden/common/enums";
import { CipherType } from "@bitwarden/common/vault/enums/cipher-type";
import { CardView } from "@bitwarden/common/vault/models/view/card.view";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { LoginView } from "@bitwarden/common/vault/models/view/login.view";
@@ -66,7 +67,7 @@ export class NordPassCsvImporter extends BaseImporter implements Importer {
cipher.card.cardholderName = this.getValueOrDefault(record.cardholdername);
cipher.card.number = this.getValueOrDefault(record.cardnumber);
cipher.card.code = this.getValueOrDefault(record.cvc);
cipher.card.brand = this.getCardBrand(cipher.card.number);
cipher.card.brand = CardView.getCardBrandByPatterns(cipher.card.number);
this.setCardExpiration(cipher, record.expirydate);
break;