init method

Future<AmwalWalletSdk> init({
  1. required String token,
  2. required String merchantId,
  3. required List<String> terminalIds,
  4. String? secureHashValue,
  5. required String transactionRefNo,
  6. required NetworkService service,
  7. String? merchantName,
  8. bool isMocked = false,
  9. Locale? locale,
})

Initialize the Amwal Wallet SDK with merchant configuration.

This method sets up the SDK with all necessary credentials and configuration parameters required for wallet payment processing.

Parameters

  • token - Authentication token for API access
  • merchantId - Unique identifier for the merchant
  • terminalIds - List of terminal IDs for payment processing
  • secureHashValue - Optional secure hash for additional validation
  • transactionRefNo - Reference number for the transaction
  • service - Network service instance for API communication
  • merchantName - Optional display name for the merchant
  • isMocked - Enable mock mode for testing (default: false)
  • locale - Locale for internationalization

Returns

Returns the initialized AmwalWalletSdk instance.

Example

final sdk = await AmwalWalletSdk.instance.init(
  token: 'auth_token_123',
  merchantId: 'merchant_456',
  terminalIds: ['term_1', 'term_2'],
  transactionRefNo: 'txn_789',
  service: networkService,
  merchantName: 'My Wallet Store',
  locale: Locale('en', 'US'),
);

Implementation

Future<AmwalWalletSdk> init({
  required String token,
  required String merchantId,
  required List<String> terminalIds,
  String? secureHashValue,
  required String transactionRefNo,
  required NetworkService service,
  String? merchantName,
  bool isMocked = false,
  Locale? locale,
}) async {
  await WalletInjector.instance.onSdkInit(
    () async => await _sdkInitialization(
      token,
      terminalIds,
      secureHashValue,
      merchantId,
      isMocked,
      service,
      locale: locale,
      merchantName: merchantName,
    ),
  );
  return this;
}