Skip to content

[FIX] 버그 수정 - #716

Merged
mosungjin merged 4 commits into
developfrom
feature/sooyoung0927-payfix
Jul 22, 2026
Merged

[FIX] 버그 수정#716
mosungjin merged 4 commits into
developfrom
feature/sooyoung0927-payfix

Conversation

@sooyoung0927

@sooyoung0927 sooyoung0927 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • 버그 수정
    • 프로필 이미지 아이템이 설정되지 않은 경우 불필요한 URL 조회를 수행하지 않도록 개선했습니다.
    • 취소/환불 처리 결과에 따라 멤버십 상태가 정확히 반영되도록 보정했습니다.
  • 개선 사항
    • 환불 가능 기간 및 결제 상태 조합(PRO/PLUS)에 따라 취소 결과 멤버십 플랜과 시작 시점을 더 일관되게 계산하도록 업데이트했습니다.
    • 멤버십 기간 산정 방식을 정밀하게 조정해 갱신 금액 및 잔여 기간 계산의 정확도를 높였습니다.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@sooyoung0927, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ba3e05c9-607e-473c-ba93-dc6f9edf6772

📥 Commits

Reviewing files that changed from the base of the PR and between 39ad9f3 and 54753d2.

📒 Files selected for processing (8)
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/CancelPolicy.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/PaymentPolicy.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/application/service/PaymentCommandService.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/application/supporter/PaymentStatusUpdater.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/domain/repository/PaymentRepository.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/infrastructure/persistence/PaymentRepositoryAdapter.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/infrastructure/persistence/SpringDataPaymentRepository.java
  • legend-momo-city/src/main/java/com/wanted/momocity/user/application/service/UserCommandService.java
📝 Walkthrough

Walkthrough

사용자 정보 수정 시 itemName이 null이면 URL 조회를 생략한다. 결제 취소는 여러 환불 대상을 처리하고, 환불 이력 조회와 부분 성공에 따른 멤버십 갱신을 지원한다. 멤버십 금액 계산은 초 단위 기준으로 변경됐다.

Changes

사용자 프로필 수정

Layer / File(s) Summary
조건부 프로필 이미지 URL 조회
legend-momo-city/src/main/java/com/wanted/momocity/user/application/service/UserCommandService.java
URL을 null로 초기화하고 itemName이 null이 아닐 때만 getItemUrl을 호출한다.

결제 환불 및 멤버십 갱신

Layer / File(s) Summary
환불 정책 및 결과 플랜 계산
legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/CancelPolicy.java, legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/PaymentPolicy.java
환불 가능 기간과 결과 플랜 계산을 추가하고, 멤버십 잔여 기간 및 업그레이드 금액 계산을 초 단위 기준으로 변경한다.
미환불 성공 결제 조회
legend-momo-city/src/main/java/com/wanted/momocity/payment/domain/repository/PaymentRepository.java, legend-momo-city/src/main/java/com/wanted/momocity/payment/infrastructure/persistence/*
환불 또는 취소 실패 이력이 없는 성공 결제를 조회하는 저장소 메서드와 JPQL 구현을 추가한다.
복수 환불 대상 취소 처리
legend-momo-city/src/main/java/com/wanted/momocity/payment/application/service/PaymentCommandService.java, legend-momo-city/src/main/java/com/wanted/momocity/payment/application/supporter/PaymentStatusUpdater.java
여러 결제 대상을 순차 취소하고 환불·실패 결과를 별도 트랜잭션으로 저장하며, 부분 성공 결과에 따라 멤버십을 갱신한다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PaymentCommandService
  participant CancelPolicy
  participant PaymentRepository
  participant PaymentStatusUpdater
  participant SetUserMembershipPort
  PaymentCommandService->>PaymentRepository: 미환불 성공 결제 조회
  PaymentCommandService->>CancelPolicy: 환불 대상 및 결과 플랜 계산
  PaymentCommandService->>PaymentStatusUpdater: 환불 또는 취소 실패 저장
  PaymentCommandService->>PaymentStatusUpdater: 멤버십 독립 갱신 요청
  PaymentStatusUpdater->>SetUserMembershipPort: 멤버십 업데이트
Loading

Possibly related PRs

Suggested labels: 🔴 priority: 높음

Poem

당근 토끼 환불길을 뛰어
여러 결제 차례로 살피고
남은 플랜을 다시 정하네
프로필 이름 없으면 쉬고
깡충, 계산도 새로워졌네! 🐰

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive 제목이 '[FIX] 버그 수정'으로 매우 일반적이라 변경의 핵심 내용을 알기 어렵습니다. 결제 취소/환불 및 멤버십 처리 변경처럼 주요 수정 내용을 반영한 구체적인 제목으로 바꿔 주세요.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/sooyoung0927-payfix

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/CancelPolicy.java (1)

48-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

환불 가능 기간 판정 로직 중복.

isWithinRefundPeriodpayment.getCreatedAt().plusDays(REFUNDABLE_DAYS).isAfter(LocalDateTime.now())checkRefundable(Line 31-32)의 동일 식과 중복됩니다. 향후 환불 기간 계산 로직 변경 시 두 곳을 모두 수정해야 하는 부담이 있습니다.

♻️ 공통 헬퍼로 추출 제안
+    private boolean isRefundPeriodValid(Payment payment) {
+        return payment.getCreatedAt().plusDays(REFUNDABLE_DAYS).isAfter(LocalDateTime.now());
+    }
+
     public void checkRefundable(Payment payment) {
-        boolean withinPeriod = payment.getStatus() == Status.SUCCESS
-                && payment.getCreatedAt().plusDays(REFUNDABLE_DAYS).isAfter(LocalDateTime.now());
+        boolean withinPeriod = payment.getStatus() == Status.SUCCESS
+                && isRefundPeriodValid(payment);
         ...
     }

     public boolean isWithinRefundPeriod(Payment payment) {
-        return payment.getCreatedAt().plusDays(REFUNDABLE_DAYS).isAfter(LocalDateTime.now());
+        return isRefundPeriodValid(payment);
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/CancelPolicy.java`
around lines 48 - 51, Extract the shared refund-period calculation from
checkRefundable and isWithinRefundPeriod into a single private helper in
CancelPolicy, then have both methods reuse it. Preserve the current comparison
behavior and refund eligibility semantics.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/CancelPolicy.java`:
- Around line 53-71: Update resolveResultPlan so a PRO-only refund returns BASIC
rather than PLUS when no succeeded payment has Plan.PLUS; only return PLUS when
plusRefunded is true and the existing PRO refund condition is met, while
preserving the current BASIC outcomes.

---

Nitpick comments:
In
`@legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/CancelPolicy.java`:
- Around line 48-51: Extract the shared refund-period calculation from
checkRefundable and isWithinRefundPeriod into a single private helper in
CancelPolicy, then have both methods reuse it. Preserve the current comparison
behavior and refund eligibility semantics.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a03944e1-cc1b-42f7-bace-7322c1939d2b

📥 Commits

Reviewing files that changed from the base of the PR and between 7c7b9db and b7cb9c5.

📒 Files selected for processing (7)
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/CancelPolicy.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/PaymentPolicy.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/application/service/PaymentCommandService.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/application/supporter/PaymentStatusUpdater.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/domain/repository/PaymentRepository.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/infrastructure/persistence/PaymentRepositoryAdapter.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/infrastructure/persistence/SpringDataPaymentRepository.java
@sooyoung0927

Copy link
Copy Markdown
Contributor Author

@CodeRabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

@sooyoung0927 전체 변경 사항을 다시 검토하겠습니다.

✅ Action performed

Full review finished.


Your plan includes PR reviews subject to rate limits. More reviews will be available in 44 minutes.

@mosungjin mosungjin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

확인했습니다.

@mosungjin
mosungjin merged commit 9db5509 into develop Jul 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants