Conversation
- GET /api/settlements/pending-amount 신규 - Settlement.status='Pending' 행의 amount 합계 + 건수 반환 - sumPendingAmount repo 함수 추가 (prisma.aggregate) - utils/payple-settlement.ts 신규 - fetchPaypleSettlementAuth: PCD_SETTLEMENT_FLAG=Y 파트너 인증, AuthKey/PAY_HOST/PAY_URL을 Redis 25분 캐시 - fetchPaypleSettlements: 정산내역 조회 (페이지네이션 PCD_HAS_MORE/PCD_LASTKEY 처리) - 본 PR에서는 내부 유틸로만 추가, endpoint 노출 없음 - 환경변수 PAYPLE_SETTLEMENT_AUTH_PATH (기본값 /php/auth.php, sandbox 검증 후 정정 가능)⚠️ 갭 보고 - 코드에 Settlement.status를 'Succeed'로 업데이트하는 로직이 없음 (결제 시 'Pending' 생성만) - 본 API의 pending_amount는 정산 완료 처리 흐름 구현 전까지 모든 미정산 누계가 반환됨 - 정산 완료 동기화는 별도 이슈에서 Payple 정산내역 조회를 활용해 구현
This was referenced May 22, 2026
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.
Summary
정산관리 화면 대시보드의 "정산 예정 금액"을 위한 신규 API와, 향후 정산 완료 동기화/환불/리포트에 재사용할 Payple 정산내역 조회 인프라를 추가.
핵심 변경
/api/settlements/pending-amount신규 —Settlement.status='Pending'행의 amount 합계 + 건수 반환prisma.settlement.aggregate로 단일 쿼리, rate-limit 무관utils/payple-settlement.ts신규 (내부 유틸)fetchPaypleSettlementAuth:PCD_SETTLEMENT_FLAG=Y파트너 인증, AuthKey/PAY_HOST/PAY_URL을 Redis에 25분 캐시fetchPaypleSettlements: 정산내역 조회,PCD_HAS_MORE/PCD_LASTKEY페이지네이션 처리코드 점검 결과
Settlement.status를Succeed로 업데이트하는 로직이 어디에도 없음. 결제 완료 시purchase.complete.service.ts/purchase.webhook.service.ts에서status='Pending'으로만 생성됨. 따라서:GET /pending-amount는 모든 미정산 거래의 누계가 반환됨 (정산이 실제로 완료됐는지와 무관)fetchPaypleSettlements를 활용해PCD_SETTLE_DATE기준 동기화하는 스케줄러/Webhook 처리가 필요→ 별도 이슈로 분리해 정산 완료 처리 흐름 구현 권고.
환경변수
(
PAYPLE_CPAY_URL,PAYPLE_CST_ID,PAYPLE_CUST_KEY는 기존 사용)API 변경 (프론트엔드 동기화)
GET /api/settlements/pending-amount{ message, pending_amount, pending_count, statusCode }Test plan
pnpm build/pnpm tsc --noEmit통과GET /pending-amount응답 동작 확인 (Settlement 행 있는 사용자/없는 사용자)fetchPaypleSettlementAuth호출 성공 확인 (PAYPLE_SETTLEMENT_AUTH_PATH 정정)fetchPaypleSettlements페이지네이션 동작 sandbox 검증 (PCD_HAS_MORE=true 케이스)Closes #479