Feat: 토스 페이 연동 [JDDEV-73] - #118
Merged
Merged
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe credit payment flow now uses checkout URLs, dedicated result and cancellation routes, payment-status polling, toast feedback, and shared Zustand credit balance state. ChangesCredit payment flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CreditCard
participant PaymentResultPage
participant CreditPage
participant PaymentAPI
participant CreditStore
CreditCard->>PaymentResultPage: Redirect using checkoutPage
PaymentResultPage->>CreditPage: Redirect with payment identifier
CreditPage->>PaymentAPI: Poll payment status with paymentId
PaymentAPI-->>CreditPage: Return payment status
CreditPage->>CreditStore: Store refreshed credit balance
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
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.
🔗 관련 이슈
JDDEV-73
📝 개요
⌨️ 작업 상세 내용
💡 코드 설명 및 참고사항
1. 포트원 결제 SDK 연동 및 플로우 구현
src/lib/api/credit.ts내 결제 준비(preparePurchase), 결제 요청(requestPortOnePayment), 결제 검증(completePortOnePayment) API 통신 로직 구현2. Next.js App Router 기반 결제 리다이렉트 페이지 추가
src/app/credit/payment-result/page.tsx: 결제 완료 시orderId를 파싱하여 메인 크레딧 페이지로 전달src/app/credit/payment-cancel/page.tsx: 사용자의 결제 취소 시cancel=true플래그를 달아 복귀 처리3. 상태 기반 결제 결과 폴링(Polling) 로직 구현 (`CreditContent`)
orderId를 감지하여 2초 주기로 백엔드에 결제 상태(checkPaymentStatus) 확인UNKNOWN상태 반환) 적용4. Zustand를 활용한 크레딧 잔액 전역 상태 관리
src/store/useCreditStore.ts생성하여 크레딧 상태 중앙화fetchCreditBalance를 호출해 최신 잔액을 가져온 뒤 스토어 업데이트Lnb컴포넌트 등 크레딧 잔액을 표시하는 모든 컴포넌트가 새로고침 없이 즉시 리렌더링되도록 UX 개선5. UI/UX 개선 (Toast 알림 적용)
alert대신Toast컴포넌트를 활용하여 성공/실패/취소 알림 적용useEffect내부의 동기적 상태 업데이트로 인한 React 렌더링 경고(Cascading renders)를 해결하기 위해setTimeout을 활용한 비동기 알림 처리 적용📸 스크린샷 (UI 변경 시)
🔍 리뷰 요구사항 (Reviewers)
Summary by CodeRabbit
New Features
Bug Fixes