From 63fd59688c870062d4a01f077136bb0736f01f29 Mon Sep 17 00:00:00 2001 From: Joowon Lim Date: Mon, 25 Mar 2024 23:23:39 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20cancel=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../readyverydemo/src/order/OrderServiceImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/readyvery/readyverydemo/src/order/OrderServiceImpl.java b/src/main/java/com/readyvery/readyverydemo/src/order/OrderServiceImpl.java index e5c14e8..1fe17ae 100644 --- a/src/main/java/com/readyvery/readyverydemo/src/order/OrderServiceImpl.java +++ b/src/main/java/com/readyvery/readyverydemo/src/order/OrderServiceImpl.java @@ -386,7 +386,11 @@ public CurrentRes getCurrent(String orderId) { public Object cancelTossPayment(CustomUserDetails userDetails, TossCancelReq tossCancelReq) { UserInfo user = userServiceFacade.getUserInfoWithPessimisticLock(userDetails.getId()); Order order = getOrder(tossCancelReq.getOrderId()); - Point point = pointServiceFacade.getPointByOrder(order); + + if (order.getPoint() < 0L) { + Point point = pointServiceFacade.getPointByOrder(order); + pointServiceFacade.cancelPoint(point); + } verifyCancel(order, user); TosspaymentDto tosspaymentDto = null; @@ -398,7 +402,6 @@ public Object cancelTossPayment(CustomUserDetails userDetails, TossCancelReq tos applyCancelTosspaymentDto(order, tosspaymentDto); userServiceFacade.saveUserPoint(user, user.getPoint() - order.getPoint()); - pointServiceFacade.cancelPoint(point); ordersRepository.save(order); return orderMapper.tosspaymentDtoToCancelRes();