transaction method

  1. @override
Future<Transaction?> transaction({
  1. required double value,
  2. required TypeTransactionEnum typeTransaction,
  3. int installment = 1,
  4. bool? printReceipt,
  5. ValueChanged<String>? onPixQrCode,
})
override

Transaction

Implementation

@override
Future<Transaction?> transaction({
  required double value,
  required TypeTransactionEnum typeTransaction,
  int installment = 1,
  bool? printReceipt,
  ValueChanged<String>? onPixQrCode,
}) async {
  try {
    if (_paymentInProgress) {
      return null;
    }

    _paymentInProgress = true;

    _currentOnPixQrCode = onPixQrCode;

    final result = await methodChannel.invokeMethod<String>(
      'transaction',
      <String, dynamic>{
        'value': value,
        'typeTransaction': typeTransaction.value,
        'installment': installment,
        'printReceipt': printReceipt,
      },
    );

    if (result == null) {
      return null;
    }

    _paymentInProgress = false;

    return Transaction.fromJson(result);
  } catch (e) {
    _paymentInProgress = false;
    rethrow;
  }
}