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 { ...@@ -5,6 +5,7 @@ import {
getTransactionsData, getTransactionsData,
} from "@/utils/requests/orangePayment"; } from "@/utils/requests/orangePayment";
import ErrorModal from "@components/modals/ErrorModal"; import ErrorModal from "@components/modals/ErrorModal";
import InformationModal from "@components/modals/InformationModal";
import LoadingModal from "@components/modals/LoadingModal"; import LoadingModal from "@components/modals/LoadingModal";
import { LOG } from "@logger"; import { LOG } from "@logger";
...@@ -65,13 +66,13 @@ const useOrangeMoney = () => { ...@@ -65,13 +66,13 @@ const useOrangeMoney = () => {
onError: (err) => { onError: (err) => {
log.error("transactionsStatusMutation |", err); log.error("transactionsStatusMutation |", err);
}, },
retry: (failureCount, error) => { // retry: (failureCount, error) => {
log.warn("transactionsStatusMutation | retrying", failureCount, error); // log.warn("transactionsStatusMutation | retrying", failureCount, error);
return failureCount < maxRetry; // return failureCount < maxRetry;
}, // },
retryDelay(_failureCount, _error) { // retryDelay(_failureCount, _error) {
return retryDelay; // return retryDelay;
}, // },
}); });
const openBrowserThenCheckStatus = async (paymentUrl: string, orderId: string) => { const openBrowserThenCheckStatus = async (paymentUrl: string, orderId: string) => {
...@@ -85,7 +86,15 @@ const useOrangeMoney = () => { ...@@ -85,7 +86,15 @@ const useOrangeMoney = () => {
if (error instanceof Error) { if (error instanceof Error) {
if (error.name === "ORANGE_PAYMENT_IN_PROGRESS") { if (error.name === "ORANGE_PAYMENT_IN_PROGRESS") {
log.warn("handlePaymentButton | 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") { } else if (error.name === "ORANGE_PAYMENT_FAILED") {
showModal(<ErrorModal message="Le paiment à échoué." />); showModal(<ErrorModal message="Le paiment à échoué." />);
log.error("handlePaymentButton | ORANGE_PAYMENT_FAILED"); 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