Skip to content

[PR] 결제 정책 확정 및 프론트 요청 사항 반영 - #679

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

[PR] 결제 정책 확정 및 프론트 요청 사항 반영#679
mosungjin merged 4 commits into
developfrom
feature/sooyoung0927-payfix

Conversation

@sooyoung0927

@sooyoung0927 sooyoung0927 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

작업내용

  1. 플랜 다운그레이드 시 예외처리 메시지 수정
  2. 결제 조회 응답에 paymentId 칼럼 추가
  3. 결제 정책 수정 및 추가

Summary by CodeRabbit

  • 새 기능

    • 결제 내역에 결제 식별자가 표시됩니다.
    • 플랜 변경 시 멤버십 잔여 기간을 반영해 결제 금액이 계산됩니다.
    • 만료 임박한 동일 플랜 갱신 시 정가 결제가 지원됩니다.
  • 개선 사항

    • 플랜 갱신 및 업그레이드 시 멤버십 시작일과 종료일이 상황에 맞게 처리됩니다.
    • 유료 플랜 간 변경 시 잔여 기간에 따른 차액이 적용됩니다.
    • 멤버십 만료 후 재가입 및 BASIC에서 유료 플랜으로의 전환 흐름이 개선되었습니다.
@sooyoung0927 sooyoung0927 self-assigned this Jul 19, 2026
@sooyoung0927 sooyoung0927 added ♻️ type: 리팩토링 ♻️ type: 리팩토링 ⚙️ type: 기능 프로젝트 기능 개발 🔴 priority: 높음 기능 우선순위 높음 labels Jul 19, 2026
@coderabbitai

coderabbitai Bot commented Jul 19, 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: 28 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: 9b16f925-cdff-48a8-bd73-fafafd9fe14e

📥 Commits

Reviewing files that changed from the base of the PR and between ca9f89d and 311646f.

📒 Files selected for processing (7)
  • legend-momo-city/docker/promtail/promtail-config.yml
  • 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/service/PaymentConfirmService.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/domain/model/PersonalPaymentItem.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/presentation/api/response/PersonalPaymentListResponse.java
📝 Walkthrough

Walkthrough

결제 정책이 멤버십 잔여일과 시작 시각을 반영하도록 변경되고, 결제 성공 후 멤버십 시작일 계산이 세분화되었습니다. 개인 결제 목록 응답에 paymentId가 추가되었으며, Docker 로그 수집을 위한 Promtail 설정이 추가되었습니다.

Changes

결제 금액 및 멤버십 갱신

Layer / File(s) Summary
잔여일 기반 결제 금액 정책
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
결제 금액 계산에 membershipStart를 전달합니다.
결제 성공 후 멤버십 시작일 갱신
legend-momo-city/src/main/java/com/wanted/momocity/payment/application/service/PaymentConfirmService.java
플랜과 만료 상태에 따른 멤버십 시작일 분기를 추가했습니다.

결제 목록 식별자 노출

Layer / File(s) Summary
결제 식별자 응답 매핑
legend-momo-city/src/main/java/com/wanted/momocity/payment/domain/model/PersonalPaymentItem.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/presentation/api/response/PersonalPaymentListResponse.java
개인 결제 항목과 API 응답에 paymentId를 추가하고 저장 엔티티의 값을 매핑합니다.

Promtail 로그 수집

Layer / File(s) Summary
Docker 로그 수집 및 Loki 전송
legend-momo-city/docker/promtail/promtail-config.yml
Docker 소켓 기반 로그 스크랩, Loki 전송, 체크포인트 저장 및 컨테이너 라벨 매핑을 설정합니다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested reviewers: mosungjin

Poem

당근처럼 결제가 알맞게 자라고
남은 날 따라 금액도 달라져요.
토끼가 건넨 paymentId 하나,
목록 속 길을 밝혀주네요.
Loki엔 로그가 폴짝, 폴짝!

🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 결제 정책 조정과 결제 조회 응답의 프론트 요청 반영이라는 핵심 변경을 잘 요약합니다.
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: 5

🤖 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/docker/promtail/promtail-config.yml`:
- Around line 13-14: Promtail’s docker_sd_configs currently accesses the host
Docker socket directly, creating excessive host-level privileges. Replace the
direct socket usage in the Promtail configuration and its docker-compose service
mount with a restricted socket-proxy endpoint or another non-socket collection
method, ensuring Promtail retains the required container discovery and log
collection behavior.
- Around line 5-6: Update the Promtail positions configuration to use a
persistent path such as /var/lib/promtail/positions.yaml instead of
/tmp/positions.yaml, then add the corresponding volume mount in the
docker-compose configuration so the positions file survives container restarts
and redeployments.
- Around line 11-19: Update the Promtail deployment references in
docker-compose.yml, docker-compose.monitor.yml, and docker-compose.backend.yml
from the unsupported grafana/promtail:latest image to Grafana Alloy, and adjust
the related configuration and service commands so log collection continues to
work. If retaining Promtail instead, replace the floating latest tag with an
explicitly approved pinned version and document the exception.

In
`@legend-momo-city/src/main/java/com/wanted/momocity/payment/application/policy/PaymentPolicy.java`:
- Around line 46-49: Update the upgrade-price calculation in PaymentPolicy’s
method around calculateRemainingDays and MEMBERSHIP_PERIOD_DAYS so zero or
sub-minimum amounts are handled before returning. Ensure upgrades with less than
24 hours remaining do not produce a 0원 payment, and enforce the PG minimum
payment amount of 100L or apply the project’s established restriction for
near-expiry upgrades.
- Around line 35-39: PaymentPolicy의 다운그레이드 거부 조건을 활성 구독에만 적용하도록 수정하세요.
targetPlan.isDowngradeFrom(currentPlan) 검사에 기존 플랜의 남은 기간 여부(hasRemainingTime)를
함께 반영해, 만료된 플랜에서는 결제가 진행되고 활성 플랜의 다운그레이드만 PaymentDowngradeNotAllowedException을
발생시키도록 하세요.
🪄 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: a329a7ed-0f3b-4e18-bb18-e7684c5e50f1

📥 Commits

Reviewing files that changed from the base of the PR and between ca9f89d and b03bd1c.

📒 Files selected for processing (7)
  • legend-momo-city/docker/promtail/promtail-config.yml
  • 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/service/PaymentConfirmService.java
  • legend-momo-city/src/main/java/com/wanted/momocity/payment/domain/model/PersonalPaymentItem.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/presentation/api/response/PersonalPaymentListResponse.java
Comment thread legend-momo-city/docker/promtail/promtail-config.yml
Comment thread legend-momo-city/docker/promtail/promtail-config.yml
Comment on lines +13 to +14
docker_sd_configs:
- host: unix:///var/run/docker.sock

@coderabbitai coderabbitai Bot Jul 19, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== Files ==\n'
git ls-files 'legend-momo-city/docker/promtail/promtail-config.yml' 'legend-momo-city/docker-compose.yml'

printf '\n== promtail-config.yml ==\n'
cat -n legend-momo-city/docker/promtail/promtail-config.yml

printf '\n== docker-compose.yml relevant lines ==\n'
sed -n '1,140p' legend-momo-city/docker-compose.yml | cat -n

Repository: MoMoFighters/BACK-Fighters

Length of output: 4183


Docker 소켓 직접 마운트를 제거하세요. legend-momo-city/docker-compose.yml:65-68에서 Promtail에 /var/run/docker.sock를 직접 붙이고, legend-momo-city/docker/promtail/promtail-config.yml:13-15docker_sd_configs가 이를 사용합니다. Promtail이 침해되면 Docker API로 호스트 수준 권한까지 이어질 수 있으니, socket proxy로 허용 API를 제한하거나 다른 수집 방식으로 바꾸세요.

🤖 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/docker/promtail/promtail-config.yml` around lines 13 - 14,
Promtail’s docker_sd_configs currently accesses the host Docker socket directly,
creating excessive host-level privileges. Replace the direct socket usage in the
Promtail configuration and its docker-compose service mount with a restricted
socket-proxy endpoint or another non-socket collection method, ensuring Promtail
retains the required container discovery and log collection behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

이 파일은 로컬 테스트용이라 배포에는 안 쓰여

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@sooyoung0927, 로컬 테스트 전용이며 배포 경로에 포함되지 않는 점 확인했습니다. 따라서 운영 환경에 대한 보안 이슈로 보기는 어렵습니다.

다만 로컬 환경에서도 Promtail 컨테이너가 Docker 소켓에 대한 광범위한 권한을 갖는 구조인 점만 인지하고 사용하면 될 것 같습니다. 필요하다면 설정 파일 또는 Compose 서비스에 “로컬 전용”임을 주석으로 남겨 의도를 명확히 해두는 정도를 권장합니다.

🐇💭


✏️ Learnings added
Learnt from: sooyoung0927
Repo: MoMoFighters/BACK-Fighters PR: 679
File: legend-momo-city/docker/promtail/promtail-config.yml:13-14
Timestamp: 2026-07-19T11:02:54.298Z
Learning: `legend-momo-city/docker/promtail/promtail-config.yml` 및 해당 Promtail Docker Compose 구성은 운영 배포에 사용하지 않는 로컬 테스트 전용 설정이다. Docker 소켓 직접 마운트는 로컬 개발 편의를 위한 의도된 트레이드오프이므로, 운영 환경 보안 이슈로 판단하지 않는다.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@sooyoung0927

Copy link
Copy Markdown
Contributor Author

@CodeRabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 19, 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 28 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 9b3df5e into develop Jul 19, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in MoMocityproject Jul 19, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔴 priority: 높음 기능 우선순위 높음 ♻️ type: 리팩토링 ♻️ type: 리팩토링 ⚙️ type: 기능 프로젝트 기능 개발

2 participants