Commit 9d4c6ff4 by G

navigate to payment result screen when transaction is a success

parent 6ce2a3d6
...@@ -2,6 +2,7 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack"; ...@@ -2,6 +2,7 @@ import { createNativeStackNavigator } from "@react-navigation/native-stack";
import HomePageWithPaymentOptions from "@screens/HomePageWithPaymentOptions"; import HomePageWithPaymentOptions from "@screens/HomePageWithPaymentOptions";
import NumberAndOtpForPaymentScreen from "@screens/NumberAndOtpForPaymentScreen"; import NumberAndOtpForPaymentScreen from "@screens/NumberAndOtpForPaymentScreen";
import PaymentAmountInputScreen from "@screens/PaymentAmountInputScreen"; import PaymentAmountInputScreen from "@screens/PaymentAmountInputScreen";
import PaymentResultScreen from "@screens/PaymentResultScreen";
import type { PaymentStackParamList } from "./Types"; import type { PaymentStackParamList } from "./Types";
const Stack = createNativeStackNavigator<PaymentStackParamList>(); const Stack = createNativeStackNavigator<PaymentStackParamList>();
...@@ -21,6 +22,13 @@ const PaymentStackNavigator = () => { ...@@ -21,6 +22,13 @@ const PaymentStackNavigator = () => {
component={NumberAndOtpForPaymentScreen} component={NumberAndOtpForPaymentScreen}
/> />
<Stack.Screen name="paymentAmountInputScreen" component={PaymentAmountInputScreen} /> <Stack.Screen name="paymentAmountInputScreen" component={PaymentAmountInputScreen} />
<Stack.Screen
name="paymentResultScreen"
component={PaymentResultScreen}
options={{
headerShown: false,
}}
/>
</Stack.Navigator> </Stack.Navigator>
); );
}; };
......
...@@ -65,8 +65,13 @@ const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountI ...@@ -65,8 +65,13 @@ const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountI
log.info("result of transactions", JSON.stringify(status, null, 2)); log.info("result of transactions", JSON.stringify(status, null, 2));
if (status === "SUCCESS") { if (status === "SUCCESS") {
log.info("Transaction was a success, navigating to success page"); log.info("Transaction was a success, navigating to success page");
navigation.navigate("paymentResultScreen");
} else if (status === "FAILED") { } else if (status === "FAILED") {
log.warn("Transaction was a failed, navigating to error page"); log.warn("Transaction was a failed, navigating to error page");
} else if (status === "INITIATED") {
log.warn(
"Transaction status was still 'INITIATED' after timeout, throwing an error",
);
} }
} catch (error) { } catch (error) {
log.error("handlePaymentButton |", error); log.error("handlePaymentButton |", error);
......
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