Skip to content

refactor: 지갑 주문 작업 경계 분리#108

Merged
ohhalim merged 1 commit into
developfrom
refactor/107/wallet-order-boundary
May 29, 2026
Merged

refactor: 지갑 주문 작업 경계 분리#108
ohhalim merged 1 commit into
developfrom
refactor/107/wallet-order-boundary

Conversation

@ohhalim

@ohhalim ohhalim commented May 29, 2026

Copy link
Copy Markdown
Owner

목적

  • order 패키지의 wallet repository 직접 접근 제거
  • 주문 생성, 취소, 거절, 정산 흐름의 지갑 작업 경계 정리
  • 후속 주문 정산 책임 세분화 전 wallet 도메인 경계 정리

배경

  • #105에서 주문 취소 경로의 market lock 사용 방식 통일 완료
  • 현재 order 패키지의 주문 생성/취소/거절/정산 흐름에서 wallet repository 직접 접근 존재
  • 지갑 잔고 잠금, locked asset 해제, 원장 생성 규칙이 order 서비스 내부에 분산
  • cancel/reject 경로의 locked asset 해제와 ledger 생성 흐름 중복 존재
  • 정산 로직 세분화 전 wallet 작업 경계 분리 필요

변경 사항

  • WalletOrderOperationService 추가
  • 주문 자산 잠금과 ORDER_LOCK 원장 생성 책임 이동
  • 주문 취소 locked asset 해제와 ORDER_CANCEL_RELEASE 원장 생성 책임 이동
  • 비동기 주문 거절 locked asset 해제와 ORDER_REJECT_RELEASE 원장 생성 책임 이동
  • 체결 정산 wallet lock 조회와 ledger batch 저장을 wallet 서비스 경유로 변경
  • order 패키지의 WalletRepository, WalletLedgerRepository, WalletLedgerJdbcRepository 직접 의존 제거
  • cancel 경로 기존 에러 코드 유지

성능 영향

  • DB 쿼리 횟수 변경 없음
  • transaction 경계 변경 없음
  • wallet row lock 획득 순서 변경 없음
  • service delegation 추가에 따른 런타임 오버헤드는 DB I/O 대비 무시 가능한 수준
  • 성능 개선 목적 PR이 아니라 모듈 경계 정리 목적 PR

검증

./gradlew test

후속 작업

  • 주문 정산 책임 세분화
  • sync/async processor afterCommit 중복 제거
  • 도메인 이벤트 payload 생성 책임 분리

closes #107

- WalletOrderOperationService 추가
- 주문 자산 잠금과 ORDER_LOCK 원장 생성 책임 이동
- 주문 취소 locked asset 해제와 ORDER_CANCEL_RELEASE 원장 생성 책임 이동
- 비동기 주문 거절 locked asset 해제와 ORDER_REJECT_RELEASE 원장 생성 책임 이동
- 체결 정산 wallet lock 조회와 ledger batch 저장을 wallet 서비스 경유로 변경
- order 패키지의 wallet repository 직접 의존 제거
- cancel 경로 기존 에러 코드 유지
- 검증: ./gradlew test
@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ohhalim, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 11 minutes and 39 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 088d8f67-6c1f-4a86-9384-a474f984c111

📥 Commits

Reviewing files that changed from the base of the PR and between a735e30 and 5e3db75.

📒 Files selected for processing (5)
  • src/main/java/com/coinflow/order/service/cancel/OrderCancelService.java
  • src/main/java/com/coinflow/order/service/lock/OrderAssetLockService.java
  • src/main/java/com/coinflow/order/service/processor/AcceptedOrderProcessor.java
  • src/main/java/com/coinflow/order/service/settlement/OrderSettlementService.java
  • src/main/java/com/coinflow/wallet/service/WalletOrderOperationService.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/107/wallet-order-boundary

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.

@ohhalim ohhalim merged commit 70e3eb4 into develop May 29, 2026
2 checks passed
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.

refactor: 지갑 주문 작업 경계 분리

1 participant