diff --git a/enatega-multivendor-app/src/apollo/mutations.js b/enatega-multivendor-app/src/apollo/mutations.js index a1366060..edaf6483 100644 --- a/enatega-multivendor-app/src/apollo/mutations.js +++ b/enatega-multivendor-app/src/apollo/mutations.js @@ -20,6 +20,7 @@ export const placeOrder = ` placeOrder(restaurant:$restaurant,orderInput: $orderInput,paymentMethod:$paymentMethod,couponCode:$couponCode,tipping:$tipping, taxationAmount: $taxationAmount, address:$address, orderDate: $orderDate,isPickedUp: $isPickedUp, deliveryCharges:$deliveryCharges, instructions: $instructions) { _id orderId + id restaurant{ _id name @@ -34,20 +35,24 @@ export const placeOrder = ` } items{ _id + id title food description quantity variation{ _id + id title price discounted } addons{ _id + id options{ _id + id title description price diff --git a/enatega-multivendor-app/src/screens/Checkout/Checkout.js b/enatega-multivendor-app/src/screens/Checkout/Checkout.js index 49475d32..6fec8040 100644 --- a/enatega-multivendor-app/src/screens/Checkout/Checkout.js +++ b/enatega-multivendor-app/src/screens/Checkout/Checkout.js @@ -168,7 +168,7 @@ function Checkout(props) { const { loading: loadingTip, data: dataTip } = useQuery(TIPPING, { fetchPolicy: 'network-only' }) - + const [mutateOrder] = useMutation(PLACEORDER, { onCompleted, onError, @@ -348,6 +348,7 @@ function Checkout(props) { function update(cache, { data: { placeOrder } }) { try { if (placeOrder && placeOrder.paymentMethod === 'COD') { + // console.log(JSON.stringify(placeOrder, null, 2)) cache.modify({ fields: { orders(existingOrders = []) { @@ -400,6 +401,7 @@ function Checkout(props) { currency: configuration.currency }) } else if (paymentMode === 'STRIPE') { + console.log("stripe") props.navigation.replace('StripeCheckout', { _id: data.placeOrder.orderId, amount: data.placeOrder.orderAmount, @@ -421,6 +423,7 @@ function Checkout(props) { message: error.message }) } + console.log('Order placed successfully:', data); } function calculateTip() { @@ -439,8 +442,9 @@ function Checkout(props) { } else { return 0 } + } - + function taxCalculation() { const tax = data.restaurant ? +data.restaurant.tax : 0 if (tax === 0) { diff --git a/enatega-multivendor-restaurant/environment.js b/enatega-multivendor-restaurant/environment.js index fd7bd38f..492d1b11 100644 --- a/enatega-multivendor-restaurant/environment.js +++ b/enatega-multivendor-restaurant/environment.js @@ -22,8 +22,8 @@ const getEnvVars = (env = Updates.releaseChannel) => { return { // GRAPHQL_URL: 'http://192.168.0.109:8001/graphql', // WS_GRAPHQL_URL: 'ws://192.168.0.109:8001/graphql', - GRAPHQL_URL: 'https://enatega-multivendor.up.railway.app/graphql', - WS_GRAPHQL_URL: 'wss://enatega-multivendor.up.railway.app/graphql', + GRAPHQL_URL: 'https://enatega-multivendor.up.railway.app/graphql', + WS_GRAPHQL_URL: 'wss://enatega-multivendor.up.railway.app/graphql', SENTRY_DSN: configuration.restaurantAppSentryUrl // SENTRY_DSN: // 'https://91b55f514a2c4708845789d6e79abf10@o1103026.ingest.sentry.io/6131933' diff --git a/enatega-multivendor-restaurant/src/apollo/queries.js b/enatega-multivendor-restaurant/src/apollo/queries.js index c21c406b..49a7fd4e 100644 --- a/enatega-multivendor-restaurant/src/apollo/queries.js +++ b/enatega-multivendor-restaurant/src/apollo/queries.js @@ -15,6 +15,7 @@ export const orders = `query Orders{ deliveryAddress details label + id } items{ _id diff --git a/enatega-multivendor-restaurant/src/components/OrderDetails/OrderDetails.js b/enatega-multivendor-restaurant/src/components/OrderDetails/OrderDetails.js index ba5295af..50e3c108 100644 --- a/enatega-multivendor-restaurant/src/components/OrderDetails/OrderDetails.js +++ b/enatega-multivendor-restaurant/src/components/OrderDetails/OrderDetails.js @@ -42,7 +42,7 @@ export default function OrderDetails({ orderData }) { ) } function OrderItems({ orderData }) { - // // console.log("OrderData",orderData) + const { t } = useTranslation() const { instructions,