showWalletReceipt method

Future<void> showWalletReceipt({
  1. required BuildContext context,
  2. required TransactionDetailsSettings settings,
})

Shows the wallet payment receipt dialog.

Displays a modal dialog containing transaction details for wallet payments. The dialog is non-dismissible and includes proper navigation handling.

Parameters:

  • context: The build context for showing the dialog
  • settings: Configuration for the transaction details display

Example:

await ReceiptHandler.instance.showWalletReceipt(
  context: context,
  settings: TransactionDetailsSettings(
    transactionId: 'TXN123',
    amount: 100.0,
  ),
);

Implementation

Future<void> showWalletReceipt({
  required BuildContext context,
  required TransactionDetailsSettings settings,
}) async {
  Logar.debug('showWalletReceipt starting', tag: 'RECEIPT_HANDLER');
  try {
    Logar.debug('Pushing dialog route', tag: 'RECEIPT_HANDLER');
    await Navigator.of(context).push(
      DialogRoute(
        context: context,
        builder: (_) {
          Logar.debug(
            'Building TransactionStatusDialog',
            tag: 'RECEIPT_HANDLER',
          );
          return TransactionStatusDialog(
            settings: settings.copyWith(
              onClose: () {
                Logar.debug(
                  'Dialog closed, popping navigators',
                  tag: 'RECEIPT_HANDLER',
                );
                Navigator.of(context).pop();
                Logar.info(
                  'Navigator popped from receipt handler context',
                  tag: 'NAVIGATION',
                );
                Navigator.of(context).pop();
                Logar.info(
                  'Navigator popped from receipt handler context',
                  tag: 'NAVIGATION',
                );
                if (AmwalSdkNavigator.amwalNavigatorObserver.navigator !=
                    null) {
                  AmwalSdkNavigator.amwalNavigatorObserver.navigator!.pop();
                  Logar.info(
                    'Navigator popped from receipt handler',
                    tag: 'NAVIGATION',
                  );
                }
              },
            ),
          );
        },
        barrierDismissible: false,
      ),
    );
    Logar.debug('Dialog route pushed successfully', tag: 'RECEIPT_HANDLER');
  } catch (e, stackTrace) {
    Logar.error(
      'showWalletReceipt error',
      tag: 'RECEIPT_HANDLER',
      error: e,
      stackTrace: stackTrace,
    );
  }
}