Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HotFix : 환불 실패 예외 코드 추가 #322

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<String, String> getRefundRequestBody(CertificationResponse response, Payment payment) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading