Skip to content

[FEAT] 결제 내역 생성 시 Buyer는 자동 Approve#28

Merged
Takch02 merged 4 commits into
mainfrom
feat/auto-buyer-approval
May 10, 2026
Merged

[FEAT] 결제 내역 생성 시 Buyer는 자동 Approve#28
Takch02 merged 4 commits into
mainfrom
feat/auto-buyer-approval

Conversation

@Takch02

@Takch02 Takch02 commented May 10, 2026

Copy link
Copy Markdown
Contributor

개요

결제 내역 생성 시 Buyer가 승인할 필요 없이 생성 시 승인되도록 수정

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 에스크로우 결제 생성 시 구매자가 자동으로 승인됩니다. 승인 타임스탬프가 함께 기록됩니다.
  • 개선사항

    • 결제 승인 프로세스가 단순화되었으며, 이제 판매자 승인만으로 거래가 완료됩니다.

Review Change Stack

Takch02 and others added 3 commits May 10, 2026 21:30
생성자(buyer)는 결제 내역을 직접 작성하므로 승인이 불필요하다.
create 시 buyerApproved: true, buyerApprovedAt을 자동으로 설정한다.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
buyerApproved: true, buyerApprovedAt이 설정되는지 검증하는 케이스를 추가한다.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
buyer는 생성 시 자동 승인되므로 approve 엔드포인트 호출 시 400을 반환한다.
seller 단독 승인만으로 APPROVED에 도달하도록 모든 e2e 플로우를 수정한다.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented May 10, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Takch02 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 53 minutes and 24 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b9b9aa58-f418-4493-bc19-f4dc9150425a

📥 Commits

Reviewing files that changed from the base of the PR and between 190a202 and 6fe078d.

📒 Files selected for processing (1)
  • test/escrow-mock.e2e-spec.ts
📝 Walkthrough

Walkthrough

EscrowPaymentsCrudService.create에서 현재 타임스탬프를 캡처하고 buyerApprovedtrue로 설정한 후 buyerApprovedAt을 초기화합니다. 이 변경에 따라 모든 mock, RLUSD, testnet e2e 테스트가 구매자 자동 승인 워크플로우를 반영하도록 업데이트되었습니다.

Changes

Buyer Auto-Approval Flow

Layer / File(s) Summary
Core Implementation
src/modules/escrow-payments/escrow-payments-crud.service.ts
create 메서드에서 now 타임스탐프를 캡처하고 buyerApproved: true, buyerApprovedAt: now를 문서에 설정합니다.
Unit Test
src/modules/escrow-payments/__tests__/create.spec.ts
buyerApproved 기본값이 true이고 buyerApprovedAt이 Date 인스턴스로 설정되는지 검증합니다.
Mock E2E Tests
test/escrow-mock.e2e-spec.ts
createActiveEscrowedPayment 헬퍼에서 구매자 승인 호출 제거, POST /escrow-payments 응답 검증을 buyerApproved: true 기대로 변경, POST /escrow-payments/:id/approve에서 구매자 승인 시도는 400 반환, 판매자 승인만으로 APPROVED 상태로 전환 확인, 이벤트 흐름 테스트에서 중복된 구매자 승인 제거.
RLUSD Mock E2E Tests
test/escrow-rlusd-mock.e2e-spec.ts
createRlusdEscrowedPayment 헬퍼와 3개 pre-flight 테스트에서 구매자 승인 호출 제거, 구매자 자동 승인 주석 추가, 판매자 승인만 수행.
Testnet E2E Tests
test/escrow-rlusd-testnet.e2e-spec.ts, test/escrow-testnet.e2e-spec.ts
결제 생성 후 buyerApproved === truebuyerApprovedAt 정의 검증 추가, 구매자 승인 호출 제거, 판매자 승인만으로 최종 APPROVED 상태 확인.

Possibly Related PRs

  • K-Statra/backend#25: 동일한 EscrowPaymentsCrudService.create 수정 영역에서 판매자 지갑 해석 관련 변경사항 포함.
  • K-Statra/backend#21: 본 PR에서 수정한 EscrowPaymentsCrudService.create CRUD 구현과 직결된 선행 변경사항 포함.

Estimated Code Review Effort

🎯 1 (Trivial) | ⏱️ ~8 minutes

Poem

🔐 구매자는 이제 약속할 때 이미 승인 완료
타임스탬프와 함께 결제는 시작되고
판매자만 남겨서 한 번의 승인
이중 검증의 무게에서 가볍게 날다
XRPL 위에 그려진 신뢰의 서명 🌊

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경사항의 핵심을 명확하게 설명합니다. 결제 생성 시 Buyer의 자동 승인이라는 주요 기능 변경을 정확히 반영하고 있으며, 코드 변경과 일치합니다.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/auto-buyer-approval

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.

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
test/escrow-mock.e2e-spec.ts (1)

1020-1031: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

ESCROWED 항목 취소 테스트의 승인 로직 불일치

Line 1022-1026에서 buyer와 seller 모두 approvePayment를 호출하고 있는데, 이는 현재 PR의 변경사항과 맞지 않습니다. Buyer는 이미 자동 승인되었으므로 line 1022-1024는 제거되어야 합니다.

🔧 수정 제안
     it("ESCROWED 항목 취소 시도 → 400", async () => {
-      await request(app.getHttpServer())
-        .post(`/escrow-payments/${paymentId}/approve`)
-        .set(asBuyer());
       await request(app.getHttpServer())
         .post(`/escrow-payments/${paymentId}/approve`)
         .set(asSeller());
🤖 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 `@test/escrow-mock.e2e-spec.ts` around lines 1020 - 1031, The test "ESCROWED 항목
취소 시도 → 400" currently calls approve twice (approve as buyer and approve as
seller) but per the PR buyer approval is automatic; remove the buyer approve
call (the
request(...).post(`/escrow-payments/${paymentId}/approve`).set(asBuyer())
invocation) so only the seller approval (the
request(...).post(`/escrow-payments/${paymentId}/approve`).set(asSeller()))
remains before calling POST /pay and waiting for ESCROWED via
waitForEscrowStatus(paymentId, escrowItemId, "ESCROWED").
🤖 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.

Outside diff comments:
In `@test/escrow-mock.e2e-spec.ts`:
- Around line 1020-1031: The test "ESCROWED 항목 취소 시도 → 400" currently calls
approve twice (approve as buyer and approve as seller) but per the PR buyer
approval is automatic; remove the buyer approve call (the
request(...).post(`/escrow-payments/${paymentId}/approve`).set(asBuyer())
invocation) so only the seller approval (the
request(...).post(`/escrow-payments/${paymentId}/approve`).set(asSeller()))
remains before calling POST /pay and waiting for ESCROWED via
waitForEscrowStatus(paymentId, escrowItemId, "ESCROWED").

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 839c6bbd-8830-4399-bedc-1f70825ddc14

📥 Commits

Reviewing files that changed from the base of the PR and between cd8d5dc and 190a202.

📒 Files selected for processing (6)
  • src/modules/escrow-payments/__tests__/create.spec.ts
  • src/modules/escrow-payments/escrow-payments-crud.service.ts
  • test/escrow-mock.e2e-spec.ts
  • test/escrow-rlusd-mock.e2e-spec.ts
  • test/escrow-rlusd-testnet.e2e-spec.ts
  • test/escrow-testnet.e2e-spec.ts

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.

1 participant