executeDirectPayment method

Future<MFDirectPaymentResponse> executeDirectPayment(
  1. MFDirectPaymentRequest directPaymentRequest,
  2. String lang,
  3. dynamic onInvoiceCreated(
    1. String invoiceId
    )?
)

Implementation

Future<MFDirectPaymentResponse> executeDirectPayment(
    MFDirectPaymentRequest directPaymentRequest,
    String lang,
    Function(String invoiceId)? onInvoiceCreated) async {
  if (onInvoiceCreated != null) {
    eventChannel.receiveBroadcastStream().listen((invoiceId) {
      onInvoiceCreated(invoiceId);
    });
  }

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