BankCard.fromMap constructor

BankCard.fromMap(
  1. Map map,
  2. bool isV2
)

This is used to parse the card object returned from the charge response. Use BankCard.fromJson to parse saved card object

Implementation

BankCard.fromMap(Map map, bool isV2)
    : id = map['id'] ??
          "${DateTime.now().microsecondsSinceEpoch}_${map["last_4digits"]}",
      token = isV2
          ? map['card_tokens'] != null
              ? (map['card_tokens'] as List).first['embedtoken']
              : null
          : map['token'],
      first6digits = isV2 ? map['cardBIN'] : map['first_6digits'],
      last4digits = isV2 ? map['last4digits'] : map['last_4digits'],
      expiry =
          isV2 ? "${map["expirymonth"]}/${map["expiryyear"]}" : map['expiry'],
      type = map['type'],
      country = map['country'],
      issuer = isV2 ? map['brand'] : map['issuer'];