Commit 189a2b57 by G

change PaymentOptions type to match the returned ones from api

parent a40b4e6a
...@@ -2,15 +2,7 @@ import { images } from "@styles/Commons"; ...@@ -2,15 +2,7 @@ import { images } from "@styles/Commons";
import { Image, TouchableOpacity } from "react-native"; import { Image, TouchableOpacity } from "react-native";
import Box from "./bases/Box"; import Box from "./bases/Box";
export enum PaymentMethods { type PaymentOptions = "ORANGE" | "MTN" | "FLOOZ" | "WAVE" | "CB";
OrangeMoney = 1,
MtnMoney = 2,
MoobMoney = 3,
WaveMoney = 4,
VisaCard = 5,
}
type PaymentOptions = "OrangeMoney" | "MtnMoney" | "MoovMoney" | "WaveMoney" | "VisaCard";
type Props = { type Props = {
onPress: () => void; onPress: () => void;
...@@ -32,7 +24,7 @@ const PaymentOptionContainer = ({ children }: { children: React.ReactNode }) => ...@@ -32,7 +24,7 @@ const PaymentOptionContainer = ({ children }: { children: React.ReactNode }) =>
); );
}; };
const OrangeMoney = () => { const Orange = () => {
return ( return (
<PaymentOptionContainer> <PaymentOptionContainer>
<Image <Image
...@@ -43,7 +35,7 @@ const OrangeMoney = () => { ...@@ -43,7 +35,7 @@ const OrangeMoney = () => {
); );
}; };
const MtnMoney = () => { const Mtn = () => {
return ( return (
<PaymentOptionContainer> <PaymentOptionContainer>
<Image source={require("../../assets/operators/mtn_money.png")} style={images.cover} /> <Image source={require("../../assets/operators/mtn_money.png")} style={images.cover} />
...@@ -51,7 +43,7 @@ const MtnMoney = () => { ...@@ -51,7 +43,7 @@ const MtnMoney = () => {
); );
}; };
const MoovMoney = () => { const Flooz = () => {
return ( return (
<PaymentOptionContainer> <PaymentOptionContainer>
<Image source={require("../../assets/operators/moov_money.png")} style={images.cover} /> <Image source={require("../../assets/operators/moov_money.png")} style={images.cover} />
...@@ -59,7 +51,7 @@ const MoovMoney = () => { ...@@ -59,7 +51,7 @@ const MoovMoney = () => {
); );
}; };
const WaveMoney = () => { const Wave = () => {
return ( return (
<PaymentOptionContainer> <PaymentOptionContainer>
<Image source={require("../../assets/operators/wave_money.png")} style={images.cover} /> <Image source={require("../../assets/operators/wave_money.png")} style={images.cover} />
...@@ -67,7 +59,7 @@ const WaveMoney = () => { ...@@ -67,7 +59,7 @@ const WaveMoney = () => {
); );
}; };
const VisaCard = () => { const Cb = () => {
return ( return (
<PaymentOptionContainer> <PaymentOptionContainer>
<Image source={require("../../assets/operators/visa_card.png")} style={images.cover} /> <Image source={require("../../assets/operators/visa_card.png")} style={images.cover} />
...@@ -78,11 +70,11 @@ const VisaCard = () => { ...@@ -78,11 +70,11 @@ const VisaCard = () => {
const PaymentOption = ({ onPress, paymentMethod }: Props) => { const PaymentOption = ({ onPress, paymentMethod }: Props) => {
return ( return (
<TouchableOpacity style={{ width: "100%", height: "100%" }} onPress={onPress}> <TouchableOpacity style={{ width: "100%", height: "100%" }} onPress={onPress}>
{paymentMethod === "OrangeMoney" && <OrangeMoney />} {paymentMethod === "ORANGE" && <Orange />}
{paymentMethod === "MtnMoney" && <MtnMoney />} {paymentMethod === "MTN" && <Mtn />}
{paymentMethod === "MoovMoney" && <MoovMoney />} {paymentMethod === "FLOOZ" && <Flooz />}
{paymentMethod === "WaveMoney" && <WaveMoney />} {paymentMethod === "WAVE" && <Wave />}
{paymentMethod === "VisaCard" && <VisaCard />} {paymentMethod === "CB" && <Cb />}
</TouchableOpacity> </TouchableOpacity>
); );
}; };
......
...@@ -66,7 +66,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith ...@@ -66,7 +66,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
onPress={() => onPress={() =>
navigation.navigate("paymentAmountInputScreen") navigation.navigate("paymentAmountInputScreen")
} }
paymentMethod={"OrangeMoney"} paymentMethod={"ORANGE"}
/> />
</PaymentOptionContainer> </PaymentOptionContainer>
<PaymentOptionContainer> <PaymentOptionContainer>
...@@ -74,7 +74,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith ...@@ -74,7 +74,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
onPress={() => onPress={() =>
navigation.navigate("paymentAmountInputScreen") navigation.navigate("paymentAmountInputScreen")
} }
paymentMethod={"MtnMoney"} paymentMethod={"MTN"}
/> />
</PaymentOptionContainer> </PaymentOptionContainer>
<PaymentOptionContainer> <PaymentOptionContainer>
...@@ -82,7 +82,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith ...@@ -82,7 +82,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
onPress={() => onPress={() =>
navigation.navigate("paymentAmountInputScreen") navigation.navigate("paymentAmountInputScreen")
} }
paymentMethod={"MoovMoney"} paymentMethod={"FLOOZ"}
/> />
</PaymentOptionContainer> </PaymentOptionContainer>
...@@ -91,7 +91,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith ...@@ -91,7 +91,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
onPress={() => onPress={() =>
navigation.navigate("paymentAmountInputScreen") navigation.navigate("paymentAmountInputScreen")
} }
paymentMethod={"WaveMoney"} paymentMethod={"WAVE"}
/> />
</PaymentOptionContainer> </PaymentOptionContainer>
...@@ -100,7 +100,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith ...@@ -100,7 +100,7 @@ const HomePageWithPaymentOptions: PaymentStackScreenComponentProps<"homePageWith
onPress={() => onPress={() =>
navigation.navigate("paymentAmountInputScreen") navigation.navigate("paymentAmountInputScreen")
} }
paymentMethod={"VisaCard"} paymentMethod={"CB"}
/> />
</PaymentOptionContainer> </PaymentOptionContainer>
</Box> </Box>
......
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