From 029c5aa96d57d683038806f680aef2e00bb49d07 Mon Sep 17 00:00:00 2001 From: G Date: Tue, 28 May 2024 15:39:39 +0000 Subject: [PATCH] show information modal when payment is still in progress and give the opportunity to the user to retry (opening the browser again). --- src/hooks/useOrangeMoney.tsx | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/hooks/useOrangeMoney.tsx b/src/hooks/useOrangeMoney.tsx index 3612365..f8dba8a 100644 --- a/src/hooks/useOrangeMoney.tsx +++ b/src/hooks/useOrangeMoney.tsx @@ -5,6 +5,7 @@ import { getTransactionsData, } from "@/utils/requests/orangePayment"; import ErrorModal from "@components/modals/ErrorModal"; +import InformationModal from "@components/modals/InformationModal"; import LoadingModal from "@components/modals/LoadingModal"; import { LOG } from "@logger"; @@ -65,13 +66,13 @@ const useOrangeMoney = () => { onError: (err) => { log.error("transactionsStatusMutation |", err); }, - retry: (failureCount, error) => { - log.warn("transactionsStatusMutation | retrying", failureCount, error); - return failureCount < maxRetry; - }, - retryDelay(_failureCount, _error) { - return retryDelay; - }, + // retry: (failureCount, error) => { + // log.warn("transactionsStatusMutation | retrying", failureCount, error); + // return failureCount < maxRetry; + // }, + // retryDelay(_failureCount, _error) { + // return retryDelay; + // }, }); const openBrowserThenCheckStatus = async (paymentUrl: string, orderId: string) => { @@ -85,7 +86,15 @@ const useOrangeMoney = () => { if (error instanceof Error) { if (error.name === "ORANGE_PAYMENT_IN_PROGRESS") { log.warn("handlePaymentButton | ORANGE_PAYMENT_IN_PROGRESS"); - showModal(); + showModal( + + await openBrowserThenCheckStatus(paymentUrl, orderId) + } + />, + ); } else if (error.name === "ORANGE_PAYMENT_FAILED") { showModal(); log.error("handlePaymentButton | ORANGE_PAYMENT_FAILED"); -- libgit2 0.27.1