Commit c9ebead9 by G

the screen will now require the full wave response.

parent d105daec
...@@ -113,9 +113,7 @@ const useWave = ( ...@@ -113,9 +113,7 @@ const useWave = (
// log.info("Opening browser for payment..."); // log.info("Opening browser for payment...");
log.info("Navigating to the qr code screen..."); log.info("Navigating to the qr code screen...");
closeModal(); closeModal();
navigation navigation?.getParent()?.navigate("waveQrCodePaymentScreen", { data: response });
?.getParent()
?.navigate("waveQrCodePaymentScreen", { paymentUrl: response.wave_launch_url });
// await openBrowserThenCheckStatus(response.wave_launch_url, response.id); // await openBrowserThenCheckStatus(response.wave_launch_url, response.id);
} catch (error) { } catch (error) {
...@@ -124,9 +122,26 @@ const useWave = ( ...@@ -124,9 +122,26 @@ const useWave = (
} }
}; };
const handlePaymentVerification = async (id: string) => {
log.info("handlePaymentVerification |", id);
try {
showModal(<LoadingModal message="Vérification du statut de la transaction..." />);
const response = await waveTransactionStatusMutation.mutateAsync(id);
closeModal();
} catch (error) {
log.error("handlePaymentVerification |", error);
// closeModal();
// showModal(<ErrorModal message="Le paiment a été echoué." />);
} finally {
// TODO : remove this finally block once a proper implementation workflow is set. currently we close the modal after logging whatever response we get from the request
closeModal();
}
};
return { return {
waveTransactionInitializerMutation, waveTransactionInitializerMutation,
waveTransactionHandler, waveTransactionHandler,
handlePaymentVerification,
}; };
}; };
......
import type { PaymentCode } from "@/utils/requests/Types"; import type { PaymentCode } from "@/utils/requests/Types";
import type { IwaveStarterRespone } from "@/utils/requests/wavePayment";
import type { NativeStackScreenProps } from "@react-navigation/native-stack"; import type { NativeStackScreenProps } from "@react-navigation/native-stack";
export type IpaymentStackNavigator = { export type IpaymentStackNavigator = {
...@@ -22,7 +23,7 @@ export type ImainStackNavigator = { ...@@ -22,7 +23,7 @@ export type ImainStackNavigator = {
appBottomTabsNavigator: undefined; appBottomTabsNavigator: undefined;
paymentResultScreen: undefined; paymentResultScreen: undefined;
waveQrCodePaymentScreen: { waveQrCodePaymentScreen: {
paymentUrl: string; data: IwaveStarterRespone;
}; };
}; };
......
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