feat: PortOne SDK v2 결제 시스템 통합 및 웹훅 처리 구현#6
Merged
DongHyeonka merged 3 commits intoSynapsesa:developfrom Jun 25, 2025
Merged
Conversation
프론트엔드에서 결제창을 호출하기 전에 필요한 정보(주문번호, 결제 금액)를 생성하여 제공하는 '결제 준비 API'를 구현합니다. 주요 변경사항: - **PaymentController:** - `POST /api/payments/request` 엔드포인트를 추가하여 결제 준비 요청을 처리합니다. - **PaymentService:** - 사용자의 구독 요청(tier)에 따라 `Order`를 `PENDING` 상태로 생성하고, `merchant_uid`와 결제 금액을 포함한 `PaymentPreparationResponse`를 반환하는 로직을 구현합니다. - **PortOne V2 Client:** - 최신 포트원 V2 API와 연동하기 위해 `WebClient` 기반의 클라이언트를 구성합니다. - `@ConfigurationProperties`를 사용하여 API Secret Key, Base URL 등의 설정을 외부화하고, `application-local.yml`에 로컬 환경 설정을 추가합니다. - `AbstractPortOneClient`에 API Secret을 사용하여 Access Token과 Refresh Token을 발급받고, 만료 시 자동으로 갱신하는 토큰 관리 로직을 구현합니다. - **보안 및 인증:** - API Gateway로부터 전달받은 사용자 ID(`X-Authenticated-Member-Id`)를 `MemberAuthenticationFilter`에서 파싱하여 `SecurityContext`에 저장, 이후 서비스 로직에서 `@AuthenticationPrincipal`로 주입받아 사용하도록 구성합니다. 마이크로 서비스 패턴인 신원 정보 전파를 활용하여 인증의 책임을 api-gateway에서 처리하고 전파 받도록 하였습니다.
- PortOne V2 공식 SDK 도입 - 결제 검증 API 추가 (/verify) - 전략 패턴 기반 결제 상태별 처리 로직 분리 - 새로운 결제 상태값 추가 및 도메인 메서드 확장
- PortOne SDK v2버전으로 구현 - 웹훅 처리를 위한 PaymentWebhookRequest record 구현 - 결제 완료 시 구독 티어 자동 업그레이드 로직 추가 - PaymentStatusConverter 팩토리 패턴으로 리팩토링 - 통합 테스트 환경 구축 및 전체 결제 플로우 검증
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 관련 이슈
✨ PR 작업 내용
PortOne SDK v2 구현
iamport-rest-client-java제거,io.portone:server-sdk:0.19.0추가PortOneClientConfig에 WebhookVerifier 빈 추가웹훅 처리 시스템 구현
결제 처리 로직 개선
데이터베이스 스키마 변경
iamportUid→iamPortTransactionIdmerchantUid→paymentIdactivate(SubscriptionTier)메서드 추가통합 테스트 구현
이미지 첨부
다음 할 일