185 lines
4.5 KiB
JavaScript
185 lines
4.5 KiB
JavaScript
import { faArrowLeft } from "@fortawesome/free-solid-svg-icons";
|
|
import { FontAwesomeIcon } from "@fortawesome/react-native-fontawesome";
|
|
import { useNavigation, useRoute } from "@react-navigation/native";
|
|
import React from "react";
|
|
import { useState } from "react";
|
|
import {
|
|
Dimensions,
|
|
StyleSheet,
|
|
Text,
|
|
TouchableOpacity,
|
|
View,
|
|
} from "react-native";
|
|
import { useToast } from "react-native-toast-notifications";
|
|
import Accordion from "../../components/checkout/Accordion";
|
|
const width = Dimensions.get("window").width;
|
|
|
|
const PaymentoptionMulti = () => {
|
|
const navigation = useNavigation();
|
|
const [selected, setselected] = useState("Obananapay");
|
|
const [orderIdC, setorderIdC] = useState("Visa");
|
|
const toast = useToast();
|
|
|
|
const route = useRoute();
|
|
const { product, shipMethod, payMethod, address, orderId } = route.params;
|
|
console.log("paymentmethod " + product);
|
|
const paymentMethods = [
|
|
{
|
|
methodName: "Obananapay",
|
|
// methodID: "visa123",
|
|
},
|
|
{
|
|
methodName: "Cash On Delivery",
|
|
// methodID: "visa123",
|
|
},
|
|
// {
|
|
// type: "Obanana",
|
|
// methods: [
|
|
// {
|
|
// methodName: "Obananapay",
|
|
// // methodID: "visa123",
|
|
// },
|
|
// ],
|
|
// },
|
|
// {
|
|
// type: "Digital Wallet",
|
|
// methods: [
|
|
// {
|
|
// methodName: "PayPal",
|
|
// methodID: "paypal789",
|
|
// },
|
|
// {
|
|
// methodName: "Apple Pay",
|
|
// methodID: "applepay987",
|
|
// },
|
|
// ],
|
|
// },
|
|
// {
|
|
// type: "Bank Transfer",
|
|
// methods: [
|
|
// {
|
|
// methodName: "Chase Bank",
|
|
// methodID: "chase789",
|
|
// },
|
|
// ],
|
|
// },
|
|
// Add more payment method types and methods as needed
|
|
];
|
|
return (
|
|
<View style={styles.container}>
|
|
<View style={styles.header}>
|
|
<TouchableOpacity
|
|
onPress={() =>
|
|
navigation.navigate("CheckOutMultiple", {
|
|
shipMethod: shipMethod,
|
|
product: product,
|
|
payMethod: payMethod,
|
|
address: address,
|
|
orderId: orderId ? orderId : null,
|
|
})
|
|
}
|
|
style={styles.backIcon}
|
|
>
|
|
<FontAwesomeIcon icon={faArrowLeft} color={"#d4c600"} size={25} />
|
|
</TouchableOpacity>
|
|
<Text style={styles.headerText}>Payment Options</Text>
|
|
</View>
|
|
<View style={styles.wrapper}>
|
|
<Accordion
|
|
sections={paymentMethods}
|
|
sel={selected}
|
|
selected={setselected}
|
|
/>
|
|
</View>
|
|
<View style={styles.footer}>
|
|
<TouchableOpacity
|
|
style={styles.footerBtn}
|
|
onPress={() => {
|
|
toast.show("Successfully Changed Payment Method!", {
|
|
type: "success",
|
|
placement: "top",
|
|
duration: 2000,
|
|
offset: 30,
|
|
animationType: "slide-in",
|
|
});
|
|
navigation.navigate("CheckOutMultiple", {
|
|
shipMethod: shipMethod,
|
|
product: product,
|
|
payMethod: selected ? selected : payMethod,
|
|
address: address,
|
|
orderId: orderId,
|
|
});
|
|
}}
|
|
>
|
|
<Text style={styles.footerBtnText}>Confirm</Text>
|
|
</TouchableOpacity>
|
|
</View>
|
|
</View>
|
|
);
|
|
};
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
backgroundColor: "#fff",
|
|
height: "100%",
|
|
width: width,
|
|
},
|
|
header: {
|
|
alignItems: "center",
|
|
width: "100%",
|
|
top: 0,
|
|
paddingLeft: 15,
|
|
|
|
flexDirection: "row",
|
|
borderColor: "#ddd",
|
|
paddingBottom: 15,
|
|
borderBottomWidth: 1,
|
|
},
|
|
headerText: {
|
|
fontSize: 16,
|
|
fontWeight: "600",
|
|
marginLeft: 25,
|
|
},
|
|
headerWrap: {
|
|
justifyContent: "center",
|
|
alignItems: "center",
|
|
width: "100%",
|
|
height: "100%",
|
|
// flexDirection: "row",
|
|
},
|
|
footer: {
|
|
position: "absolute",
|
|
bottom: 0,
|
|
width: "100%",
|
|
justifyContent: "center",
|
|
alignItems: "center",
|
|
paddingVertical: 10,
|
|
},
|
|
footerBtn: {
|
|
backgroundColor: "#ff5e00",
|
|
width: "90%",
|
|
paddingVertical: 10,
|
|
justifyContent: "center",
|
|
alignItems: "center",
|
|
borderRadius: 20,
|
|
},
|
|
footerBtnText: {
|
|
color: "#fff",
|
|
fontSize: 16,
|
|
},
|
|
wrapper: {
|
|
// height: "85%",
|
|
paddingTop: 25,
|
|
width: "100%",
|
|
// justifyContent: "center",
|
|
alignItems: "center",
|
|
height: "100%",
|
|
},
|
|
content: {
|
|
width: "100%",
|
|
justifyContent: "center",
|
|
alignItems: "center",
|
|
},
|
|
});
|
|
|
|
export default PaymentoptionMulti;
|