makePayment method

  1. @override
Future<PaymentResponse> makePayment({
  1. required double amount,
  2. required MyPosCurrency currency,
  3. bool printMerchantReceipt = true,
  4. bool printCustomerReceipt = true,
  5. bool fixedPinPad = false,
  6. bool giftCardTransaction = false,
  7. String? eReceiptReceiver,
  8. String? reference,
})
override

Implementation

@override
Future<PaymentResponse> makePayment({
  required double amount,
  required MyPosCurrency currency,
  bool printMerchantReceipt = true,
  bool printCustomerReceipt = true,
  bool fixedPinPad = false,
  bool giftCardTransaction = false,
  String? eReceiptReceiver,
  String? reference,
}) async {
  final Map<String, dynamic> args = {
    'amount': amount,
    'currency': currency.name,
    'printMerchantReceipt': printMerchantReceipt,
    'printCustomerReceipt': printCustomerReceipt,
    'fixedPinpad': fixedPinPad,
    'giftCardTransaction': giftCardTransaction,
    'eReceiptReceiver': eReceiptReceiver,
    'reference': reference,
  };
  final res = await methodChannel.invokeMethod<String>('makePayment', args);
  switch (res) {
    case 'SUCCESS':
      return PaymentResponse.success;
    case 'CANCEL':
      return PaymentResponse.cancel;
    case 'ERROR':
      return PaymentResponse.error;
    case 'TIMEOUT':
      return PaymentResponse.timeout;
    case 'DECLINED':
      return PaymentResponse.declined;
    case 'UNKNOWN':
      return PaymentResponse.unknown;
  }
  return PaymentResponse.unknown;
}