From 6f3c320d537a53e0a325aaebdab06e73b83f1fcc Mon Sep 17 00:00:00 2001 From: Alessandro Izzo Date: Mon, 10 Jun 2024 09:58:38 +0200 Subject: [PATCH] fix: [IOBP-684] Navigation to the payments home when payment success (#5835) ## Short description This PR fixes the navigation behavior when a payment is successfully executed by showing the payments homepage. (With the implementation of biz events you will have to show the transaction details) ## List of changes proposed in this pull request - Added the `onSuccess` property with the "showTransaction` set that actually it will redirect to the payments homepage ## How to test Complete a new payment with the new flow and when it is success, you should be able to go back to the payments homepage and not to the barcode screen. ## Preview https://github.com/pagopa/io-app/assets/34343582/6aeace0f-e279-46af-80ba-247f546a363c --- .../payments/barcode/screens/PaymentsBarcodeChoiceScreen.tsx | 4 +++- .../payments/barcode/screens/PaymentsBarcodeScanScreen.tsx | 4 +++- .../checkout/screens/WalletPaymentInputFiscalCodeScreen.tsx | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ts/features/payments/barcode/screens/PaymentsBarcodeChoiceScreen.tsx b/ts/features/payments/barcode/screens/PaymentsBarcodeChoiceScreen.tsx index 06fbd849435..3003d7b49b6 100644 --- a/ts/features/payments/barcode/screens/PaymentsBarcodeChoiceScreen.tsx +++ b/ts/features/payments/barcode/screens/PaymentsBarcodeChoiceScreen.tsx @@ -70,7 +70,9 @@ const PaymentsBarcodeChoiceScreen = () => { analytics.trackBarcodeMultipleCodesSelection(); if (isNewWalletSectionEnabled) { - startPaymentFlowWithRptId(barcode.rptId); + startPaymentFlowWithRptId(barcode.rptId, { + onSuccess: "showTransaction" + }); } else { dispatch(paymentInitializeState()); navigation.navigate(ROUTES.WALLET_NAVIGATOR, { diff --git a/ts/features/payments/barcode/screens/PaymentsBarcodeScanScreen.tsx b/ts/features/payments/barcode/screens/PaymentsBarcodeScanScreen.tsx index d7fe4365fd0..77b95b6ec97 100644 --- a/ts/features/payments/barcode/screens/PaymentsBarcodeScanScreen.tsx +++ b/ts/features/payments/barcode/screens/PaymentsBarcodeScanScreen.tsx @@ -94,7 +94,9 @@ const PaymentsBarcodeScanScreen = () => { if (barcode.type === "PAGOPA") { if (isNewWalletSectionEnabled) { - startPaymentFlowWithRptId(barcode.rptId); + startPaymentFlowWithRptId(barcode.rptId, { + onSuccess: "showTransaction" + }); } else { dispatch(paymentInitializeState()); switch (barcode.format) { diff --git a/ts/features/payments/checkout/screens/WalletPaymentInputFiscalCodeScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentInputFiscalCodeScreen.tsx index 03580b0834e..4366599121b 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentInputFiscalCodeScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentInputFiscalCodeScreen.tsx @@ -93,7 +93,7 @@ const WalletPaymentInputFiscalCodeScreen = () => { navigation.pop(); // Navigate to the payment details screen (payment verification) if (isNewWalletSectionEnabled) { - startPaymentFlowWithRptId(rptId); + startPaymentFlowWithRptId(rptId, { onSuccess: "showTransaction" }); } else { dispatch(paymentInitializeState()); navigation.navigate(ROUTES.WALLET_NAVIGATOR, {