encryptCard method

Future<AdyenEncryptedCardMdl?> encryptCard({
  1. required CreditCardMdl card,
  2. required String adyenKey,
})

Implementation

Future<AdyenEncryptedCardMdl?> encryptCard(
    {required CreditCardMdl card, required String adyenKey}) async {
  try {
    dynamic adyenEncryptedCardFields =
        await _channel.invokeMethod('encryptCreditCard', <String, String>{
      "number": card.number,
      "holderName": card.holderName,
      "expiryMonth": card.expiryMonth,
      "expiryYear": card.expiryYear,
      "cvc": card.cvc,
      "adyenKey": adyenKey
    });

    AdyenEncryptedCardMdl encryptedCard = AdyenEncryptedCardMdl(
        encryptedExpiryMonth:
            adyenEncryptedCardFields["EncryptedExpiryMonth"] ?? '',
        encryptedCardNumber:
            adyenEncryptedCardFields["EncryptedCardNumber"] ?? '',
        encryptedExpiryYear:
            adyenEncryptedCardFields["EncryptedExpiryYear"] ?? '',
        encryptedSecurityCode:
            adyenEncryptedCardFields["EncryptedSecurityCode"] ?? '');

    return encryptedCard;
  } catch (e) {
    return Future.error(e);
  }
}