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