AmwalSdkArguments constructor

AmwalSdkArguments({
  1. void onResponse(
    1. String?
    )?,
  2. String? customerId,
  3. void customerCallback(
    1. String?
    )?,
  4. required GetTransactionFunction getTransactionFunction,
  5. required OnPayCallback onPay,
  6. OnPayCallback? onCountComplete,
  7. Locale locale = const Locale('en'),
  8. bool is3DS = false,
  9. required String amount,
  10. required String terminalId,
  11. required String currency,
  12. required int currencyId,
  13. required int merchantId,
  14. String? transactionId,
})

Creates a new AmwalSdkArguments instance.

Parameters:

  • onResponse - Optional callback for payment response handling
  • customerId - Optional customer identifier
  • customerCallback - Optional callback for customer actions
  • getTransactionFunction - Required function to get transaction details
  • onPay - Required callback for payment completion
  • onCountComplete - Optional callback for countdown completion
  • locale - Locale setting (defaults to English)
  • is3DS - Whether to enable 3D Secure (defaults to false)
  • amount - Required payment amount
  • terminalId - Required terminal identifier
  • currency - Required currency code
  • currencyId - Required numeric currency identifier
  • merchantId - Required merchant identifier
  • transactionId - Optional transaction identifier

Required Parameters

The following parameters are required and must be provided:

  • getTransactionFunction
  • onPay
  • amount
  • terminalId
  • currency
  • currencyId
  • merchantId

Example

final args = AmwalSdkArguments(
  amount: '150.00',
  currency: 'SAR',
  currencyId: 512,
  merchantId: 12345,
  terminalId: 'terminal_001',
  onPay: (listener, [transactionId]) {
    // Handle payment completion
  },
  getTransactionFunction: (transactionId) async {
    // Fetch transaction details
    return await getTransactionDetails(transactionId);
  },
  locale: const Locale('ar'), // Arabic locale
  is3DS: true, // Enable 3D Secure
);

Implementation

AmwalSdkArguments({
  this.onResponse,
  this.customerId,
  this.customerCallback,
  required this.getTransactionFunction,
  required this.onPay,
  this.onCountComplete,
  this.locale = const Locale('en'),
  this.is3DS = false,
  required this.amount,
  required this.terminalId,
  required this.currency,
  required this.currencyId,
  required this.merchantId,
  this.transactionId,
});