implementPaymentCustomUISTC function

Future<PaymentResultData> implementPaymentCustomUISTC({
  1. required PaymentMode paymentMode,
  2. required String checkoutId,
  3. required String channelName,
  4. required String shopperResultUrl,
  5. required String phoneNumber,
  6. required String lang,
})

implementPaymentCustomUISTC is a method used to make online payments. It requires the paymentMode, checkoutId, channelName, shopperResultUrl, phoneNumber and lang to be passed as arguments for successful implementation. It returns a PaymentResultData object with the paymentResult and errorString.

Implementation

Future<PaymentResultData> implementPaymentCustomUISTC({
  required PaymentMode paymentMode,
  required String checkoutId,
  required String channelName,
  required String shopperResultUrl,
  required String phoneNumber,
  required String lang,
}) async {
  String transactionStatus;
  var platform = MethodChannel(channelName);
  try {
    final String? result = await platform.invokeMethod(
      PaymentConst.methodCall,
      getCustomUiSTCModelCards(
          checkoutId: checkoutId,
          shopperResultUrl: shopperResultUrl,
          paymentMode: paymentMode,
          phoneNumber: phoneNumber,
          lang: lang),
    );
    transactionStatus = '$result';
    return PaymentResultManger.getPaymentResult(transactionStatus);
  } on PlatformException catch (e) {
    transactionStatus = "${e.message}";
    return PaymentResultData(
        errorString: e.message, paymentResult: PaymentResult.error);
  }
}