Skip to content

Conversation

@IISweetHeartII
Copy link
Contributor

Summary

결제 생성 및 결제 상태 조회 API를 추가해 결제 요청 생성과 사용자 소유 결제건 상태 조회를 지원하도록 구현했습니다.

Changes

  • POST /payments 결제 생성 엔드포인트 추가
  • GET /payments/:id/status 상태 조회 엔드포인트 추가
  • Payment DTO 및 PaymentFacade 신규 추가로 도메인 조합 계층 분리
  • 결제 소유권 검증용 에러코드(PAYMENT_NOT_OWNER) 추가
  • 결제 저장/조회 Repository 메서드 보강

Type of Change

해당하는 항목에 체크해주세요:

  • Bug fix (기존 기능을 수정하는 변경)
  • New feature (새로운 기능 추가)
  • Breaking change (기존 기능에 영향을 주는 변경)
  • Refactoring (기능 변경 없이 코드 개선)
  • Documentation (문서 변경)
  • Chore (빌드, 설정 등)

Target Environment

배포 대상 브랜치를 선택해주세요:

  • Dev (dev)
  • Prod (main)

Related Issues

관련 이슈를 연결해주세요:

Testing

테스트 방법을 작성해주세요:

  • Postman/Swagger로 API 호출 확인
  • 단위 테스트 통과
  • E2E 테스트 통과
  • pnpm run lint 통과
  • pnpm run build 통과
  • pnpm exec jest --passWithNoTests 통과

Checklist

PR 생성 전 확인사항:

  • 코드 컨벤션을 준수했습니다 (docs/development/CODE_STYLE.md)
  • Git 컨벤션을 준수했습니다 (docs/development/GIT_CONVENTIONS.md)
  • 네이밍 컨벤션을 준수했습니다 (docs/development/NAMING_CONVENTIONS.md)
  • 로컬에서 빌드가 성공합니다 (pnpm run build)
  • 로컬에서 린트가 통과합니다 (pnpm run lint)
  • (API 변경 시) Swagger 문서가 업데이트되었습니다
  • (필요 시) 테스트 코드를 작성했습니다

Screenshots (Optional)

N/A

Additional Notes

Service 간 교차 의존을 제거하고 Facade에서 오케스트레이션하도록 아키텍처 규칙을 맞췄습니다.

@IISweetHeartII IISweetHeartII self-assigned this Feb 12, 2026
@IISweetHeartII IISweetHeartII added ✨ feature New feature or request 덕환 labels Feb 12, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @IISweetHeartII, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 결제 생성 및 결제 상태 조회 기능을 제공하는 새로운 API 엔드포인트를 구현합니다. 사용자가 티켓 상품에 대한 결제를 요청하고, 생성된 결제 건의 현재 상태를 조회할 수 있도록 지원합니다. 이를 통해 결제 관련 핵심 비즈니스 로직을 처리하고, 서비스 간 교차 의존성을 줄이기 위해 Facade 패턴을 적용하여 아키텍처를 개선했습니다.

Highlights

  • 결제 API 추가: 결제 생성(POST /payments) 및 결제 상태 조회(GET /payments/:id/status)를 위한 새로운 API 엔드포인트가 추가되었습니다.
  • 아키텍처 개선: Payment DTO 및 PaymentFacade를 신규 추가하여 도메인 조합 계층을 분리하고, 서비스 간 교차 의존성을 제거했습니다.
  • 에러 처리 강화: 결제 소유권 검증을 위한 PAYMENT_NOT_OWNER 에러 코드가 추가되었습니다.
  • Repository 기능 보강: 결제 저장 및 조회를 위한 Repository 메서드가 확장되었습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/common/exceptions/error-code.enum.ts
    • PAYMENT_NOT_OWNER 에러 코드가 추가되었습니다.
  • src/common/exceptions/error-code.ts
    • PAYMENT_NOT_OWNER 에러 코드에 대한 메시지와 HTTP 상태 코드가 정의되었습니다.
  • src/modules/payment/application/dtos/payment.dto.ts
    • 결제 생성 요청(CreatePaymentReqDTO) 및 응답(PaymentResDTO)을 위한 DTO가 정의되었습니다.
  • src/modules/payment/application/facades/payment.facade.ts
    • PaymentFacade 클래스가 추가되어 결제 생성 로직을 오케스트레이션합니다.
  • src/modules/payment/application/services/payment.service.ts
    • 결제 생성(createPayment), 고유 번호 생성(generateMulNo), 사용자 ID 기반 결제 조회(findByIdAndUserIdOrThrow) 메서드가 추가되었습니다.
  • src/modules/payment/infrastructure/repositories/payment.repository.ts
    • 사용자 ID와 결제 ID로 결제를 조회하는 findByIdAndUserId 및 고유 번호 존재 여부를 확인하는 existsByMulNo 메서드가 추가되었습니다.
  • src/modules/payment/payment.module.ts
    • TicketModule이 임포트되고 PaymentFacade가 프로바이더에 추가되었습니다.
  • src/modules/payment/presentation/payment.controller.ts
    • POST /payments (결제 생성) 및 GET /payments/:paymentId (결제 상태 조회) 엔드포인트가 추가되었습니다.
Activity
  • 새로운 기능(New feature)으로 분류되었습니다.
  • dev 브랜치를 대상으로 배포됩니다.
  • 관련 이슈 #83이 닫혔습니다.
  • 코드 컨벤션, Git 컨벤션, 네이밍 컨벤션을 준수했으며 로컬 빌드 및 린트가 통과되었습니다.
  • Service 간 교차 의존성을 제거하고 Facade에서 오케스트레이션하도록 아키텍처 규칙을 맞췄습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

결제 생성 및 상태 조회 API 구현에 대한 PR을 검토했습니다. 전반적으로 새로운 기능이 잘 구현되었으며, DTO, Facade 패턴, Repository 메서드 보강 등 아키텍처 규칙을 잘 준수하고 있습니다. 특히 PaymentFacade를 도입하여 서비스 간 교차 의존성을 제거하고 오케스트레이션 역할을 수행하도록 한 점은 긍정적입니다. ErrorCode 및 ErrorMap에 새로운 에러 코드를 추가하고 ApiCommonErrorResponse 데코레이터를 사용하여 Swagger 문서화를 강화한 점도 좋습니다. 다만, PaymentService의 generateMulNo 메서드에서 mulNo를 생성하는 로직에 잠재적인 경쟁 조건(race condition)이 있어 데이터 무결성 문제가 발생할 수 있습니다. 이 부분에 대한 개선이 필요합니다.

@IISweetHeartII
Copy link
Contributor Author

Correction note (formatted):

  • Root cause: mulNo used Date.now() in milliseconds; this can exceed PostgreSQL integer range and caused COMMON500 during payment creation.
  • Fix: switched generation to Math.floor(Date.now() / 1000) while keeping the duplicate-avoidance increment loop.
  • Commit: 49c3ccb

Verification:

  • lsp_diagnostics on modified file: clean
  • pnpm run lint: pass
  • pnpm exec jest --passWithNoTests: pass (no test files)
  • pnpm run build: fails due to pre-existing repository-wide src/metadata.ts TS2307 resolution issue (not introduced by this change)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feature New feature or request 덕환

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat] 결제 요청 생성/상태 조회 API 구현

1 participant