From 7509003dd045773b62c035e16df1fbc853310146 Mon Sep 17 00:00:00 2001 From: KKangHHee <137751841+KKangHHee@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:29:51 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20=ED=8F=AC=EC=9D=B8=ED=8A=B8=20=EA=B2=B0?= =?UTF-8?q?=EC=A0=9C=20=EB=B0=8F=200=EC=9B=90=20=EA=B2=B0=EC=A0=9C=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useRequestPayment.jsx | 12 +++++------- src/pages/PaymentPage/PaymentPage.jsx | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/hooks/useRequestPayment.jsx b/src/hooks/useRequestPayment.jsx index 433a69e..5128931 100644 --- a/src/hooks/useRequestPayment.jsx +++ b/src/hooks/useRequestPayment.jsx @@ -1,23 +1,21 @@ import axios from "axios"; -import useRequestZoreCostPayment from "./useRequestPaymentZeroCost"; const apiRoot = process.env.REACT_APP_API_ROOT; const apiVer = "api/v1"; const apiUrl = `${apiRoot}/${apiVer}/order/toss`; const useRequestPayment = () => { - const requestZoreCostPayment = useRequestZoreCostPayment(); - const requestPayment = async (cartId, couponId, paymentWidget) => { + const requestPayment = async (cartId, couponId, paymentWidget, point) => { try { - const body = { cartId, couponId }; + const body = { cartId, couponId, point }; const response = await axios.post(apiUrl, body, { withCredentials: true, }); if (response.data.amount <= 0) { - const orderIds = response.data.orderId; - const amounts = response.data.amount; - requestZoreCostPayment({ orderId: orderIds, amount: amounts }); + window.location.href = + response.data.successUrl + + `?paymentType=NORMAL&orderId=${response.data.orderId}&paymentKey=membership&amount=${response.data.amount}`; return; } paymentWidget?.requestPayment(response.data); diff --git a/src/pages/PaymentPage/PaymentPage.jsx b/src/pages/PaymentPage/PaymentPage.jsx index e052ee3..8dbb404 100644 --- a/src/pages/PaymentPage/PaymentPage.jsx +++ b/src/pages/PaymentPage/PaymentPage.jsx @@ -26,7 +26,7 @@ const PaymentPage = () => { const point = useGetPoint(); const paymentRequest = () => { const paymentWidget = paymentWidgetRef.current; - requestPayment(cartId, couponId, paymentWidget); + requestPayment(cartId, couponId, paymentWidget, usedPoint); }; const handleSetPoint = () => { if (usedPoint !== 0) {