From c2b186ce723f3051cc35ddcfa01533f540ed406f Mon Sep 17 00:00:00 2001 From: yang Date: Wed, 6 Nov 2024 00:21:53 +0900 Subject: [PATCH] =?UTF-8?q?HotFix=20:=20=ED=99=98=EB=B6=88=20=EC=8B=A4?= =?UTF-8?q?=ED=8C=A8=20=EC=98=88=EC=99=B8=20=EC=BD=94=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../usecase/PaymentManageUseCase.java | 17 ++++++++++++----- .../payment/exception/RefundFailException.java | 5 +++-- .../constant/PaymentResponseCode.java | 3 ++- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/postgraduate/domain/payment/application/usecase/PaymentManageUseCase.java b/src/main/java/com/postgraduate/domain/payment/application/usecase/PaymentManageUseCase.java index b2ee8c0f..a673e5a4 100644 --- a/src/main/java/com/postgraduate/domain/payment/application/usecase/PaymentManageUseCase.java +++ b/src/main/java/com/postgraduate/domain/payment/application/usecase/PaymentManageUseCase.java @@ -101,8 +101,10 @@ public void refundPayBySenior(Senior senior, String orderId) { } public void refundPayByAdmin(User user, Long paymentId) { - if (user.getRole() != ADMIN) - throw new RefundFailException("NOT ADMIN"); + if (user.getRole() != ADMIN) { + log.error("Refund Fail : NOT ADMIN"); + throw new RefundFailException(); + } Payment payment = paymentGetService.byId(paymentId); log.info("ν™˜λΆˆ 진행 paymentId : {}", paymentId); refundPay(payment); @@ -154,9 +156,14 @@ private void refundProcess(CertificationResponse response, Payment payment) { .retrieve() .bodyToMono(RefundResponse.class) .block()) - .orElseThrow(() -> new RefundFailException("NPE")); - if (!refundResponse.PCD_PAY_RST().equals(SUCCESS.getName())) - throw new RefundFailException(refundResponse.PCD_PAY_CODE()); + .orElseThrow(() -> { + log.error("RefundFail : NPE"); + throw new RefundFailException(); + }); + if (!refundResponse.PCD_PAY_RST().equals(SUCCESS.getName())) { + log.error("Refund fail : {}", refundResponse.PCD_PAY_CODE()); + throw new RefundFailException(); + } } private Map getRefundRequestBody(CertificationResponse response, Payment payment) { diff --git a/src/main/java/com/postgraduate/domain/payment/exception/RefundFailException.java b/src/main/java/com/postgraduate/domain/payment/exception/RefundFailException.java index b132c135..f75b4207 100644 --- a/src/main/java/com/postgraduate/domain/payment/exception/RefundFailException.java +++ b/src/main/java/com/postgraduate/domain/payment/exception/RefundFailException.java @@ -3,11 +3,12 @@ import com.postgraduate.global.exception.ApplicationException; import static com.postgraduate.domain.payment.presentation.constant.PaymentResponseMessage.FAIL_REFUND; +import static com.postgraduate.domain.payment.presentation.constant.PaymentResponseCode.REFUND_FAIL; public class RefundFailException extends ApplicationException { - public RefundFailException(String code) { - super(FAIL_REFUND.getMessage(), code); + public RefundFailException() { + super(FAIL_REFUND.getMessage(), REFUND_FAIL.getCode()); } } diff --git a/src/main/java/com/postgraduate/domain/payment/presentation/constant/PaymentResponseCode.java b/src/main/java/com/postgraduate/domain/payment/presentation/constant/PaymentResponseCode.java index a52b6990..952bdd0d 100644 --- a/src/main/java/com/postgraduate/domain/payment/presentation/constant/PaymentResponseCode.java +++ b/src/main/java/com/postgraduate/domain/payment/presentation/constant/PaymentResponseCode.java @@ -12,7 +12,8 @@ public enum PaymentResponseCode { PAYMENT_DELETE("PM203"), PAYMENT_NOT_FOUND("EX600"), - PAYMENT_FAIL("EX601"); + PAYMENT_FAIL("EX601"), + REFUND_FAIL("EX602"); private final String code; }