AmwalSdkArguments constructor
AmwalSdkArguments({
- void onResponse()?,
- String? customerId,
- void customerCallback()?,
- required GetTransactionFunction getTransactionFunction,
- required OnPayCallback onPay,
- OnPayCallback? onCountComplete,
- Locale locale = const Locale('en'),
- bool is3DS = false,
- required String amount,
- required String terminalId,
- required String currency,
- required int currencyId,
- required int merchantId,
- String? transactionId,
Creates a new AmwalSdkArguments instance.
Parameters:
onResponse
- Optional callback for payment response handlingcustomerId
- Optional customer identifiercustomerCallback
- Optional callback for customer actionsgetTransactionFunction
- Required function to get transaction detailsonPay
- Required callback for payment completiononCountComplete
- Optional callback for countdown completionlocale
- Locale setting (defaults to English)is3DS
- Whether to enable 3D Secure (defaults to false)amount
- Required payment amountterminalId
- Required terminal identifiercurrency
- Required currency codecurrencyId
- Required numeric currency identifiermerchantId
- Required merchant identifiertransactionId
- 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,
});