Skip to content

Feat: 결제 도메인 모델을 정의한다#38

Merged
inpink merged 1 commit intoinpink/payment-modulefrom
inpink/payment-core-domain
Oct 12, 2025
Merged

Feat: 결제 도메인 모델을 정의한다#38
inpink merged 1 commit intoinpink/payment-modulefrom
inpink/payment-core-domain

Conversation

@inpink
Copy link
Member

@inpink inpink commented Oct 4, 2025

참조

Closes #4

  • PG사 독립적인 PaymentMethod 설계 (추후 Adapter에서 PG사의 상태값 매핑 예정)
  • 결제 완료 이후 상품 지급 등은 추후 Order 도메인에서 상태를 관리합니다.
  • payment는 pg사를 이용한 “결제”에 집중하는 도메인입니다.

Summary by CodeRabbit

  • 신기능
    • 결제 엔터티 도입으로 결제 금액, 주문/사용자 연동, 거래 식별자, 결제/정산 시점 등을 체계적으로 관리합니다.
    • 결제 상태 범위 확대(예: 준비, 결제 진행, 결제 완료, 부분 취소, 취소, 실패)로 상태 추적과 표시가 더 정교해졌습니다.
    • 다양한 결제 수단(신용카드, 계좌이체, 가상계좌, 모바일, 간편결제, 상품권)을 지원합니다.
    • 결제대행사 선택 범위를 확대해 주요 PG사와의 연동 준비가 강화되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Oct 4, 2025

Walkthrough

결제 도메인 모델이 신규 추가되었다. Payment 데이터 클래스와 이를 구성하는 열거형 PaymentMethod, PaymentStatus, PgProvider가 도메인 패키지에 생성되었으며, 주요 필드와 상태를 정의한다. 행위 로직은 포함되지 않았다.

Changes

Cohort / File(s) Summary
Payment 엔티티 추가
payment/payment-core/domain/src/main/kotlin/app/payment/core/domain/Payment.kt
결제 도메인 클래스 Payment 신규 추가. 식별자, 주문/사용자, 금액, 결제수단/PG, 상태, 트랜잭션 ID, 결제시각/생성/수정 시각 필드 정의. 일부 필드(status, paidAt, updatedAt)는 가변.
결제 도메인 보조 Enum 추가
.../app/payment/core/domain/PaymentMethod.kt, .../app/payment/core/domain/PaymentStatus.kt, .../app/payment/core/domain/PgProvider.kt
PaymentMethod(CREDIT_CARD, BANK_TRANSFER, VIRTUAL_ACCOUNT, MOBILE, EASY_PAY, GIFT_CERTIFICATE), PaymentStatus(READY, PAY_PENDING, PAID, PARTIAL_CANCELLED, CANCELLED, FAILED), PgProvider(TOSS_PAYMENTS, KAKAO_PAY) 정의.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

토끼는 귀를 쫑긋, 결제 길을 연다
상태와 방법, 프로바이더 줄 맞춘다
숫자는 반짝, 시간은 고이 담고
주문과 사용자, 한 곳에 묶어 안고
삐빅—새 도메인, hop! 배포로 간다 🐇💳

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues Check ✅ Passed 이 PR은 Payment 클래스와 PaymentMethod, PaymentStatus, PgProvider enum을 정의하여 #4 이슈의 결제 도메인 모델 정의 요구사항을 충족하고 있습니다.
Out of Scope Changes Check ✅ Passed 이 PR에서 변경된 파일들은 모두 결제 도메인 모델 정의와 직접적으로 연관되어 있으며 연결된 이슈의 범위를 벗어나는 변경이 없습니다.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Title Check ✅ Passed 제목이 결제 도메인 모델 정의라는 핵심 변경 사항을 명확하고 간결하게 요약하고 있어 PR의 주요 목적을 잘 전달합니다.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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 inpink/payment-core-domain

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

@inpink inpink changed the base branch from develop to inpink/payment-module October 4, 2025 16:35
@inpink inpink force-pushed the inpink/payment-core-domain branch 2 times, most recently from 26000fe to d8d6c87 Compare October 5, 2025 09:45
@inpink inpink marked this pull request as ready for review October 5, 2025 09:45
@inpink
Copy link
Member Author

inpink commented Oct 5, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Oct 5, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@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

🧹 Nitpick comments (3)
payment/payment-core/domain/src/main/kotlin/app/payment/core/domain/PaymentStatus.kt (1)

3-10: 결제 상태 열거형이 적절하게 정의되었습니다.

결제 흐름을 잘 표현하는 6가지 상태가 정의되어 있으며, 부분 취소(PARTIAL_CANCELLED) 상태도 포함되어 있어 실무 요구사항을 반영하고 있습니다.

다만, Kotlin 관례상 마지막 enum 상수 뒤에 trailing comma를 추가하는 것이 권장됩니다:

 enum class PaymentStatus {
     READY,
     PAY_PENDING,
     PAID,
     PARTIAL_CANCELLED,
     CANCELLED,
-    FAILED,
+    FAILED,
 }
payment/payment-core/domain/src/main/kotlin/app/payment/core/domain/PgProvider.kt (1)

3-6: PG 제공자 열거형이 정의되었습니다.

현재 지원하는 2개의 PG사가 명확하게 정의되어 있습니다.

PaymentMethod.kt와의 일관성을 위해 마지막 상수 뒤에 trailing comma를 추가하는 것을 고려해보세요:

 enum class PgProvider {
     TOSS_PAYMENTS,
-    KAKAO_PAY,
+    KAKAO_PAY,
 }
payment/payment-core/domain/src/main/kotlin/app/payment/core/domain/Payment.kt (1)

10-10: 금액 검증 로직을 추가하세요.

amount 필드에 대한 유효성 검증이 없어 음수나 0 값이 허용될 수 있습니다. 금융 도메인에서는 금액에 대한 명확한 제약사항이 필요합니다.

초기화 블록에서 검증 로직을 추가하세요:

data class Payment(
    val id: Long,
    val orderId: String,
    val userId: Long,
    val amount: BigDecimal,
    val method: PaymentMethod,
    val pgProvider: PgProvider,
    val status: PaymentStatus,
    val transactionId: String?,
    val pgTransactionId: String?,
    val paidAt: OffsetDateTime?,
    val createdAt: OffsetDateTime,
    val updatedAt: OffsetDateTime?
) {
    init {
        require(amount > BigDecimal.ZERO) { "결제 금액은 0보다 커야 합니다" }
    }
}
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4eef8c and d8d6c87.

📒 Files selected for processing (4)
  • payment/payment-core/domain/src/main/kotlin/app/payment/core/domain/Payment.kt (1 hunks)
  • payment/payment-core/domain/src/main/kotlin/app/payment/core/domain/PaymentMethod.kt (1 hunks)
  • payment/payment-core/domain/src/main/kotlin/app/payment/core/domain/PaymentStatus.kt (1 hunks)
  • payment/payment-core/domain/src/main/kotlin/app/payment/core/domain/PgProvider.kt (1 hunks)
🔇 Additional comments (2)
payment/payment-core/domain/src/main/kotlin/app/payment/core/domain/PaymentMethod.kt (1)

3-10: 결제 수단 열거형이 올바르게 정의되었습니다.

한국 결제 시스템에서 일반적으로 사용되는 결제 수단들이 포함되어 있으며, trailing comma를 사용하여 Kotlin 코딩 규칙을 준수하고 있습니다.

payment/payment-core/domain/src/main/kotlin/app/payment/core/domain/Payment.kt (1)

6-19: data class 키워드가 누락되었습니다.

Payment는 일반 class로 선언되었지만, 도메인 모델의 특성상 data class로 정의되어야 합니다. data class는 equals(), hashCode(), toString(), copy() 메서드를 자동으로 제공하여 값 객체로서의 동작을 보장합니다.

다음과 같이 수정하세요:

-class Payment(
+data class Payment(
     val id: Long,
     val orderId: String,
     val userId: Long,
     val amount: BigDecimal,
     val method: PaymentMethod,
     val pgProvider: PgProvider,
-    var status: PaymentStatus,
+    val status: PaymentStatus,
     val transactionId: String?,
     val pgTransactionId: String?,
-    var paidAt: OffsetDateTime?,
+    val paidAt: OffsetDateTime?,
     val createdAt: OffsetDateTime,
-    var updatedAt: OffsetDateTime
+    val updatedAt: OffsetDateTime?
 )

Likely an incorrect or invalid review comment.

@inpink inpink force-pushed the inpink/payment-core-domain branch from d8d6c87 to bc740cc Compare October 5, 2025 09:52
- PG사 독립적인 PaymentMethod 설계 (추후 Adapter에서 매핑 예정)
- 결제 완료 이후 상품 지급 등은 Order 도메인에서 상태를 관리합니다.
- payment는 pg사를 이용한 “결제”에 집중하는 도메인입니다.
@inpink inpink force-pushed the inpink/payment-core-domain branch from bc740cc to 1df4674 Compare October 5, 2025 09:54
@inpink inpink changed the title Inpink/payment core domain Feat: 결제 도메인 모델을 정의한다 Oct 5, 2025
@inpink inpink self-assigned this Oct 5, 2025
@inpink inpink merged commit 8cd8629 into inpink/payment-module Oct 12, 2025
5 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.

결제 도메인 모델을 정의한다

2 participants

Comments