getCardType method

Future<void> getCardType(
  1. String cardNumber
)

Implementation

Future<void> getCardType(String cardNumber) async {
  String? encodedMerchantId = CryptoUtils.encrypt(
      MerchantConstants.merchantId, KeywordConstants.internalKey);
  await appRepository.getCardType(cardNumber, encodedMerchantId!).then(
      (Response response) async {
    //debugPrint('Get card type api response is ${response.body}');
    CardTypeResponse cardTypeResponse =
        CardTypeResponse.fromJson(json.decode(response.body));
    if (cardTypeResponse.cardType != null &&
        cardTypeResponse.cardType!.isNotEmpty) {
      String? cardTypeJson = CryptoUtils.decrypt(
          cardTypeResponse.cardType!, MerchantConstants.merchantKey);
      Map<String, dynamic> map = json.decode(cardTypeJson!);
      selectedCardType = map['card_type'];
      //debugPrint('Card type is $selectedCardType');
    }
  }, onError: (dynamic e) {
    //debugPrint('Get card type api exception is ${e.toString()}');
  });
}