TransactionRequest constructor

TransactionRequest({
  1. required TransactionType transactionType,
  2. required int amountMinorUnits,
  3. required String currency,
  4. required String idempotencyKey,
  5. String? referenceId,
  6. String? description,
  7. List<EntryMode> allowedEntryModes = const [EntryMode.chip, EntryMode.tap, EntryMode.swipe],
  8. List<EntryMode> preferredEntryModes = const [],
  9. bool requestSignature = false,
  10. Duration? timeout,
  11. Map<String, dynamic>? metadata,
})

Implementation

TransactionRequest({
  required this.transactionType,
  required this.amountMinorUnits,
  required this.currency,
  required this.idempotencyKey,
  this.referenceId,
  this.description,
  this.allowedEntryModes = const [
    EntryMode.chip,
    EntryMode.tap,
    EntryMode.swipe,
  ],
  this.preferredEntryModes = const [],
  this.requestSignature = false,
  this.timeout,
  this.metadata,
}) {
  if (amountMinorUnits < 0) {
    throw ArgumentError.value(
      amountMinorUnits,
      'amountMinorUnits',
      'must be >= 0',
    );
  }
  if (currency.length != 3) {
    throw ArgumentError.value(
      currency,
      'currency',
      'must be a 3-letter ISO 4217 code',
    );
  }
  if (idempotencyKey.isEmpty) {
    throw ArgumentError.value(
      idempotencyKey,
      'idempotencyKey',
      'must not be empty',
    );
  }
}