-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
documentation문서수정(README,PullRequestTemplate등)문서수정(README,PullRequestTemplate등)
Description
어떤 기능인가요?
아래 순서로 호출하면 됩니다. (단건/장바구니 분기 포함, 실 URL 반영)
상세 페이지(미리보기)
- 할인 견적
GET /b1/discounts/quote?productId={pid}&userId={uid}
- 용도: 브랜드 할인 등 “현재가” 미리보기.
- 적용/다운로드 가능한 쿠폰 목록
GET /b1/coupons/products/{pid}/claimables?normalUserId={uid?}
-
용도: 해당 상품에 대해 보유/다운로드/적용 가능 쿠폰 미리보기.
-
비로그인 시 normalUserId 생략 가능.
-
(예시)
curl -X GET 'http://basilium.co.kr:8080/b1/discounts/quote?productId=1&userId=1' curl -X GET 'http://basilium.co.kr:8080/b1/coupons/products/1/claimables?normalUserId=hansol_user'
재고 선점
A) 단건 즉시구매
POST /b1/payment/request
- Params: productId, count, productSize, productColor
- 권한: ROLE_NORMAL & 본인
- 응답: reserveTaskOrderPayId (RID), expiresAt, items[]
B) 장바구니 일괄
POST /b1/payment/request-batch
- Body:
{"items":[{"productId", "count", "productSize", "productColor"}, ...]} - 권한: ROLE_NORMAL & 본인
- 응답: RID, expiresAt, items[]
(옵션) 예약 상태 폴링
GET /b1/payment/reservations/{rid} → ACTIVATED/INACTIVE, expiresAt
결제 의도 생성(최종 금액 스냅샷: 할인+쿠폰+포인트)
POST /b1/payment/intents
- Body:
{
"orderId": "<RID>", // 위 단계 RID를 그대로 사용
"currency": "KRW",
"pointsToUse": 0,
"expiresAt": null,
"lines": [
{
"productId": 1,
"size": "M",
"color": "BLACK",
"quantity": 2,
"couponWalletId": 999 // 선택(주문당 1개 제한, 서버 검증)
}
]
}- 권한: ROLE_NORMAL & 본인
- 응답: paymentId, orderId(=RID), serverTotal, pgAmount, intentExpiresAt
PG 승인 시도(외부)
- PG에 amount = pgAmount, orderId = RID 로 승인 요청
결제 결과 반영(프론트→백엔드 콜백)
성공 콜백
GET /b1/payment/success?paymentType={CARD...}&amount={pgAmount}&orderId={RID}&paymentKey={...}
- 권한: ROLE_NORMAL & 본인
- 서버 처리: 금액 일치 검증 → (권장 순서) 지갑 DEBIT → 라인 APPROVE → Payment APPROVE
실패 콜백
GET /b1/payment/fail?code=...&message=...&orderId={RID}
- 권한: ROLE_NORMAL & 본인
- 서버 처리: 라인 INIT→CANCELLED, Payment FAILED 기록
재고 예약 정리(필수)
성공 확정 → 복구 없이 인덱스만 제거
POST /b1/payment/response-by-reserve?reserveTaskOrderPayId={RID}&success=true
실패 확정 → 즉시 재고 복구
POST /b1/payment/response-by-reserve?reserveTaskOrderPayId={RID}&success=false
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
documentation문서수정(README,PullRequestTemplate등)문서수정(README,PullRequestTemplate등)