ahmedelkhyary / hyperpay

MIT License
9 stars 19 forks source link

Could not cast value of type 'NSError' (0x1ec9f7728) to 'NSString' (0x1ec9f2cf8). #48

Open atul4530 opened 1 month ago

atul4530 commented 1 month ago

I'm getting above error while integration of hyperpay_plugin for flutter

Flutter SDK: Flutter 3.24.0 • channel stable • https://github.com/flutter/flutter.git Framework • revision 80c2e84975 (7 weeks ago) • 2024-07-30 23:06:49 +0700 Engine • revision b8800d88be Tools • Dart 3.5.0 • DevTools 2.37.2

initialization: init() { flutterHyperPay = FlutterHyperPay( shopperResultUrl: InAppPaymentSetting.shopperResultUrl, paymentMode: PaymentMode.test, lang: InAppPaymentSetting.getLang(), ); }

calling :

`payRequestNowCustomUi( {required String brandName, required String checkoutId, required String cardName, required String cardCvv, required String cardMonth, required String cardYear, required String cardNumber}) async { PaymentResultData paymentResultData;

paymentResultData = await flutterHyperPay.customUICards(
  customUI: CustomUI(
    brandName: brandName,
    checkoutId: checkoutId,
    cardNumber: cardNumber.replaceAll(" ", ""),
    holderName: cardName,
    month: cardMonth,
    year: cardYear,
    cvv: cardCvv,
    enabledTokenization: false, // default
  ));

ToastMsg.showToast("${paymentResultData.paymentResult.name}");
if (paymentResultData.paymentResult == PaymentResult.success ||
    paymentResultData.paymentResult == PaymentResult.sync) {

}

}`

I'm running this in IOS Simulator and APP is going carshed with this error: Could not cast value of type 'NSError' (0x1ec9f7728) to 'NSString' (0x1ec9f2cf8).