cancelVivaFiscalGreece method

Future<TransactionResponse> cancelVivaFiscalGreece({
  1. required int amount,
  2. String? orderCode,
  3. bool showReceipt = true,
  4. bool showTransactionResult = true,
  5. String? fiscalisationData,
})

Implementation

Future<TransactionResponse> cancelVivaFiscalGreece({
  required int amount,
  String? orderCode,
  bool showReceipt = true,
  bool showTransactionResult = true,
  String? fiscalisationData,
}) async {
  final Map<String, dynamic> params = <String, dynamic>{
    'amount': amount,
    'orderCode': orderCode,
    'show_receipt': showReceipt,
    'show_transaction_result': showTransactionResult,
    'fiscalisationData': fiscalisationData,
  };

  String data = await _invokePosMethod('cancelVivaFiscalGreece', params);

  // When using pin if user presses back button and cancels to enter pin
  // POS response is just empty so change it to cancel
  if (data.isEmpty) {
    data = 'cb:?status=userCanceled&message=User canceled';
  }

  return TransactionResponse.create(_callbackScheme, data);
}