Commit 029c5aa9 by G

show information modal when payment is still in progress and give the…

show information modal when payment is still in progress and give the opportunity to the user to retry (opening the browser again).
parent de216ba5
......@@ -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(<ErrorModal message="Le payment est toujours en cours." />);
showModal(
<InformationModal
message="Le payment est toujours en cours."
actionLabel="Rééssayer"
onPress={async () =>
await openBrowserThenCheckStatus(paymentUrl, orderId)
}
/>,
);
} else if (error.name === "ORANGE_PAYMENT_FAILED") {
showModal(<ErrorModal message="Le paiment à échoué." />);
log.error("handlePaymentButton | ORANGE_PAYMENT_FAILED");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment