aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-10-16 16:18:13 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-10-16 16:18:13 +0530
commit5d6b82fd07ad6ef34e26443d0e363d8401cb489f (patch)
treec6adb671bb39df3e567b3797d01343edb5d026d6
parent035d1e036359e8e590f2e17c0390e5d3ffec1728 (diff)
downloadmall-app-5d6b82fd07ad6ef34e26443d0e363d8401cb489f.tar.gz
mall-app-5d6b82fd07ad6ef34e26443d0e363d8401cb489f.tar.bz2
mall-app-5d6b82fd07ad6ef34e26443d0e363d8401cb489f.zip
Add CheckoutScreen with payment and invoice email
-rw-r--r--src/screens/Checkout/CheckoutScreen.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/screens/Checkout/CheckoutScreen.js b/src/screens/Checkout/CheckoutScreen.js
new file mode 100644
index 0000000..a8645d2
--- /dev/null
+++ b/src/screens/Checkout/CheckoutScreen.js
@@ -0,0 +1,26 @@
+import React, { useContext } from 'react';
+import { View, Text, Button } from 'react-native';
+import { CartContext } from '../../context/CartContext';
+import emailService from '../../services/emailService';
+
+const CheckoutScreen = ({ navigation }) => {
+ const { cart } = useContext(CartContext);
+
+ const handlePayment = async () => {
+ // Simulate payment processing
+ alert('Payment successful!');
+ await emailService.sendInvoice(cart);
+ navigation.navigate('Invoice');
+ };
+
+ return (
+ <View>
+ {cart.map((item, index) => (
+ <Text key={index}>{item.name} - ${item.price * item.quantity}</Text>
+ ))}
+ <Button title="Confirm and Pay" onPress={handlePayment} />
+ </View>
+ );
+};
+
+export default CheckoutScreen;