pay method

Future<MFGetPaymentStatusResponse> pay(
  1. MFExecutePaymentRequest executePaymentRequest,
  2. String lang,
  3. dynamic onInvoiceCreated(
    1. String invoiceId
    )?
)

Implementation

Future<MFGetPaymentStatusResponse> pay(
    MFExecutePaymentRequest executePaymentRequest,
    String lang,
    Function(String invoiceId)? onInvoiceCreated) async {
  if (onInvoiceCreated != null) {
    eventChannel.receiveBroadcastStream().listen((invoiceId) {
      onInvoiceCreated(invoiceId);
    });
  }

  final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
      MFConstants.channelName.pay, codec,
      binaryMessenger: _binaryMessenger);
  final List<Object?>? replyList = await channel
      .send(<Object?>[executePaymentRequest, lang]) as List<Object?>?;
  return modelParser<MFGetPaymentStatusResponse>(replyList);
}