Skip to content

fix: 결제 성공 로그 포맷 변경 및 환불 기한 추가 - #241#242

Merged
sjk4618 merged 4 commits into
devfrom
fix/#241
Feb 6, 2026
Merged

fix: 결제 성공 로그 포맷 변경 및 환불 기한 추가 - #241#242
sjk4618 merged 4 commits into
devfrom
fix/#241

Conversation

@sjk4618
Copy link
Copy Markdown
Member

@sjk4618 sjk4618 commented Feb 6, 2026

🔥Pull requests

⛳️ 작업한 브랜치

👷 작업한 내용

  • 결제 로그 포맷 수정
  • 환불 기간 검증 추가

🚨 참고 사항

@sjk4618 sjk4618 self-assigned this Feb 6, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 6, 2026

📝 Walkthrough

Summary by CodeRabbit

릴리스 노트

  • Bug Fixes

    • 결제 취소 시 환불 가능 기간 검증 추가: 행사 시작일 기준 3일 전까지만 환불 가능하도록 제한
  • New Features

    • 환불 기간 만료 시 사용자 대상의 명확한 오류 메시지 추가
  • Chores

    • 결제 관련 로그 표준화 및 결제 키 마스킹 적용으로 로그 가독성·보안성 향상

Walkthrough

결제 취소 시 환불 가능 기간(행사 시작일 기준 3일 전) 검증 로직이 추가되고, 결제 관련 로그 포맷과 로그 헬퍼 시그니처가 단순화되었으며, 해당 오류 코드와 로깅 유틸 변경이 반영되었습니다.

Changes

Cohort / File(s) Summary
결제 서비스 로직 및 검증
src/main/java/com/permitseoul/permitserver/domain/payment/api/service/PaymentService.java
환불 가능 기간 검증(private validateCancelAvailablePeriod) 추가 및 cancelPayment에 사전 검증 추가, EventNotfoundException -> NOT_FOUND_EVENT 매핑, 결제 성공 로그 포맷 단순화 및 logPaymentSuccessButTicketIssueFailed 시그니처 변경·호출 업데이트, 예외 처리 및 로그 호출 정비.
오류 코드 정의
src/main/java/com/permitseoul/permitserver/global/response/code/ErrorCode.java
환불 기간 만료 상황용 새 에러 코드 BAD_REQUEST_CANCEL_PERIOD_EXPIRED(HTTP 400, 코드 40019) 추가.
로깅 유틸리티
src/main/java/com/permitseoul/permitserver/global/util/LogFormUtil.java
구조화된 paymentLog(...) 제거, maskPaymentKey(...) 정적 사용으로 정리 및 관련 import/사용부 변경.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 변경사항의 핵심을 명확하게 설명하고 있습니다: 결제 로그 포맷 변경과 환불 기한 추가라는 두 가지 주요 변경사항을 잘 나타냅니다.
Description check ✅ Passed PR 설명이 결제 로그 포맷 수정과 환불 기간 검증 추가라는 변경사항과 관련이 있으며, 이는 코드 변경사항과 일치합니다.
Linked Issues check ✅ Passed 결제 로그 포맷 변경(logPaymentSuccessButTicketIssueFailed 메서드 서명 변경 및 로깅 형식 업데이트), 환불 기간 검증(validateCancelAvailablePeriod 메서드 추가, BAD_REQUEST_CANCEL_PERIOD_EXPIRED 에러 코드 추가) 등 링크된 이슈 #241의 목표가 코드 변경사항에서 구현되었습니다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 결제 로그 포맷 변경 및 환불 기간 검증 추가라는 이슈 #241의 범위 내에 있으며, 관련 없는 변경사항은 없습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/#241

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@src/main/java/com/permitseoul/permitserver/domain/payment/api/service/PaymentService.java`:
- Around line 270-285: The validation in validateCancelAvailablePeriod uses
LocalDate.now() without a timezone which can mismatch event.getStartAt()
(causing wrong refund decisions); change the logic to compute today in the same
timezone as the event by deriving the ZoneId from the event timestamp (or
explicitly using ZoneId.of("Asia/Seoul") if event times are KST) and use that
zone when obtaining the current date so daysUntilEvent =
ChronoUnit.DAYS.between(todayInEventZone, eventDateInEventZone) compares
like-for-like (update references around event.getStartAt(), eventDate, today and
daysUntilEvent calculation in validateCancelAvailablePeriod).
🧹 Nitpick comments (1)
src/main/java/com/permitseoul/permitserver/domain/payment/api/service/PaymentService.java (1)

326-335: maskPaymentKey 호출 방식 불일치 (minor)

Line 362에서는 static import된 maskPaymentKey(paymentKey)를 사용하고, Line 138과 332에서는 LogFormUtil.maskPaymentKey(...)를 명시적으로 호출합니다. 동작상 차이는 없지만, 한 가지 방식으로 통일하면 가독성이 향상됩니다.

♻️ static import 방식으로 통일
-                    LogFormUtil.maskPaymentKey(tossPaymentResponse.paymentKey()),
+                    maskPaymentKey(tossPaymentResponse.paymentKey()),
-                LogFormUtil.maskPaymentKey(paymentKey),
+                maskPaymentKey(paymentKey),

Also applies to: 136-141, 362-362

@sjk4618 sjk4618 merged commit 7659691 into dev Feb 6, 2026
2 checks passed
@sjk4618 sjk4618 deleted the fix/#241 branch February 6, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: 결제 성공 로그 포맷 변경 및 환불 기한 추가

1 participant