diff --git a/src/components/orders-row/orders-row.component.tsx b/src/components/orders-row/orders-row.component.tsx index e0a90c3..8213147 100644 --- a/src/components/orders-row/orders-row.component.tsx +++ b/src/components/orders-row/orders-row.component.tsx @@ -28,7 +28,6 @@ const OrderRow: React.FC = ({ order, index, method, status }) => { ))} ₹ {calculateTotalPrice(order)} - {method.toUpperCase()} {status.toUpperCase()} diff --git a/src/components/payment-form/payment-form.component.tsx b/src/components/payment-form/payment-form.component.tsx index 391fd04..fbc593a 100644 --- a/src/components/payment-form/payment-form.component.tsx +++ b/src/components/payment-form/payment-form.component.tsx @@ -21,8 +21,8 @@ const PaymentForm = () => { dispatch(setOrder(cartItems)); }; - const setUserPayment = (method: string, status: string) => { - dispatch(setPaymentDetails({ method, status })); + const setUserPayment = (status: string) => { + dispatch(setPaymentDetails({ status })); }; const paymentHandler = async (event: React.MouseEvent) => { @@ -61,19 +61,13 @@ const PaymentForm = () => { }, }); - console.log(payment); - const myPaymentStatus = payment.data.items[0]?.status; - if (myPaymentStatus) { + const myPaymentStatus = payment.status; + if (myPaymentStatus === 200) { setUserOrder(); + setUserPayment("successful"); } else { console.log("PAYMENT FAILED"); } - - const { method, status } = payment.data.items[0]; - setUserPayment( - method, - status === "captured" ? "successful" : "failed" - ); }, prefill: { diff --git a/src/store/orders/orders.types.ts b/src/store/orders/orders.types.ts index 79a2012..0d76f0c 100644 --- a/src/store/orders/orders.types.ts +++ b/src/store/orders/orders.types.ts @@ -7,7 +7,6 @@ export type OrdersType = { }[]; export type PaymentDetailsType = { - method: string; status: string; };