@sayren/store-sdk 0.29.2 → 0.29.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +384 -115
- package/dist/index.mjs +232 -17
- package/package.json +1 -1
- package/src/schemas/claim.ts +18 -0
- package/src/schemas/collection.ts +99 -7
- package/src/schemas/order.ts +26 -0
- package/src/schemas/payment.ts +7 -1
- package/src/schemas/points.ts +111 -3
- package/src/schemas/promotion.ts +140 -4
- package/src/schemas/webhook-event.ts +26 -0
package/dist/index.mjs
CHANGED
|
@@ -838,6 +838,7 @@ const claimSchema = z.object({
|
|
|
838
838
|
claimDeliveryFee: z.number().int().describe("구매자가 부담하는 반품·교환 배송비. 원 단위"),
|
|
839
839
|
expectedRefundAmount: z.number().int().nullable().describe("접수 시점에 계산한 예상 환불액 — 수량 비율 상품 금액 − 반품 배송비 − 조건부 무료배송 미달 차감. **배송비 환불은 포함되지 않고 `expectedDeliveryFeeRefundAmount`로 따로 온다**(승인 시점의 배송 묶음 상태로 확정되기 때문이다). 교환은 환불이 없어 null이다"),
|
|
840
840
|
expectedDeliveryFeeRefundAmount: z.number().int().nullable().describe("접수 시점에 계산한 예상 배송비 환불액. 배송 묶음(같은 상품의 주문상품)이 모두 취소되거나 판매자 귀책일 때만 0보다 크다. 이 필드가 생기기 전에 접수된 클레임은 null이다"),
|
|
841
|
+
expectedPointRefundAmount: z.number().int().optional().default(0).describe("예상 반환 적립금 (원, #93) — 결제에 쓴 적립금 중 이 수량의 몫이다. 예상 환불액(현금)과 별개이고, 차감은 현금에서 먼저 뺀다. 교환·적립금을 쓰지 않은 주문은 0이다. 서버는 항상 싣는다"),
|
|
841
842
|
exchangeOption: z.object({
|
|
842
843
|
optionId: z.string(),
|
|
843
844
|
optionName: z.string()
|
|
@@ -900,6 +901,7 @@ const approveClaimResultSchema = z.object({
|
|
|
900
901
|
deliveryFeeChargeAmount: z.number().int().describe("환불액에서 뺀 **배송비** — 반품·교환 배송비 + 조건부 무료배송 미달 차감. 추가 차감(`deductAmount`)은 포함하지 않는다"),
|
|
901
902
|
couponChargeAmount: z.number().int().optional().default(0).describe("환불액에서 뺀 쿠폰 조건 미달 차감. 남은 주문상품이 쿠폰 조건을 잃었을 때만 0보다 크다. 서버는 항상 싣는다"),
|
|
902
903
|
couponChargeRefundAmount: z.number().int().optional().default(0).describe("환불액에 더한, 앞선 환불에서 뺀 쿠폰 차감을 되돌린 몫. 서버는 항상 싣는다"),
|
|
904
|
+
pointRefundAmount: z.number().int().optional().default(0).describe("돌려준 적립금 (원, #93) — 결제에 쓴 적립금 중 이번 취소·반품 수량의 몫이다. 현금 환불(`refundAmount`)과 별개다. 차감은 현금에서 먼저 빼고 모자란 몫만 여기서 뺀다. 적립금을 쓰지 않은 주문과 이 필드가 없는 이전 응답·이벤트는 0으로 읽는다"),
|
|
903
905
|
refundedAt: z.string()
|
|
904
906
|
});
|
|
905
907
|
//#endregion
|
|
@@ -1098,11 +1100,34 @@ const purchaseEarnPolicySchema = z.object({
|
|
|
1098
1100
|
enabled: z.boolean().describe("구매 적립 사용 여부"),
|
|
1099
1101
|
rateBp: pointEarnRateBpSchema.describe("상점 기본 구매 적립률(만분율, 100 = 1%). 0~3000. 상품의 `pointEarnRateBp`가 있으면 그 값이 우선한다")
|
|
1100
1102
|
});
|
|
1103
|
+
/** 사용 단위 — 1·10·100원 */
|
|
1104
|
+
const POINT_USE_UNITS = [
|
|
1105
|
+
1,
|
|
1106
|
+
10,
|
|
1107
|
+
100
|
|
1108
|
+
];
|
|
1109
|
+
/**
|
|
1110
|
+
* 적립금 사용 규칙(P3) — 주문서에서 결제 금액을 줄인다. 적용 순서는 즉시할인 → 쿠폰 → 적립금이고, 상품 금액(쿠폰 뒤)에 먼저 쓰고
|
|
1111
|
+
* 남으면 배송비에 쓴다(`includeDeliveryFee`). 결제 금액이 100원 아래로 내려가지 않게 적립금을 줄인다.
|
|
1112
|
+
*/
|
|
1113
|
+
const pointUsePolicySchema = z.object({
|
|
1114
|
+
enabled: z.boolean().describe("적립금 사용 여부. 꺼도 잔액은 남는다"),
|
|
1115
|
+
minBalance: z.number().int().min(0).max(1e7).describe("이 잔액 이상이어야 쓸 수 있다(원). 0이면 제한 없음"),
|
|
1116
|
+
minAmount: z.number().int().min(0).max(1e7).describe("한 번에 쓰는 최소 금액(원). 0이면 제한 없음"),
|
|
1117
|
+
unit: z.union([
|
|
1118
|
+
z.literal(1),
|
|
1119
|
+
z.literal(10),
|
|
1120
|
+
z.literal(100)
|
|
1121
|
+
]).describe("사용 단위(원). 요청 금액을 이 단위로 내린다"),
|
|
1122
|
+
maxRatioBp: z.number().int().min(1).max(1e4).describe("결제 기준 금액(쿠폰 뒤) 대비 최대 사용 비율(만분율, 10000 = 100%)"),
|
|
1123
|
+
includeDeliveryFee: z.boolean().describe("배송비에도 쓰는가. 끄면 상품 금액(쿠폰 뒤)에만 쓴다")
|
|
1124
|
+
});
|
|
1101
1125
|
const expiryDays = z.number().int().min(30).max(POINT_EXPIRY_DAYS_MAX).describe("적립금 유효 기간(일, 30~1825). 적립한 날로부터 이 기간이 지난 날의 끝(한국 시간 23:59:59)에 소멸한다. 바꿔도 이미 적립된 적립금의 유효 기간은 바뀌지 않는다");
|
|
1102
1126
|
/** 저장된 상점 정책(`stores.point_policy`) — 해석은 `resolvePointPolicy` */
|
|
1103
1127
|
const pointPolicySchema = z.object({
|
|
1104
1128
|
reviewReward: reviewRewardPolicySchema,
|
|
1105
1129
|
purchaseEarn: purchaseEarnPolicySchema,
|
|
1130
|
+
use: pointUsePolicySchema,
|
|
1106
1131
|
expiryDays: expiryDays.nullable().describe("적립금 유효 기간(일). 정하지 않았으면 null")
|
|
1107
1132
|
});
|
|
1108
1133
|
/** 정책이 없을 때 — 모두 끔 */
|
|
@@ -1116,6 +1141,14 @@ const POINT_POLICY_DEFAULTS = {
|
|
|
1116
1141
|
enabled: false,
|
|
1117
1142
|
rateBp: 0
|
|
1118
1143
|
},
|
|
1144
|
+
use: {
|
|
1145
|
+
enabled: false,
|
|
1146
|
+
minBalance: 0,
|
|
1147
|
+
minAmount: 0,
|
|
1148
|
+
unit: 10,
|
|
1149
|
+
maxRatioBp: 1e4,
|
|
1150
|
+
includeDeliveryFee: true
|
|
1151
|
+
},
|
|
1119
1152
|
expiryDays: null
|
|
1120
1153
|
};
|
|
1121
1154
|
/**
|
|
@@ -1127,10 +1160,12 @@ function resolvePointPolicy(stored) {
|
|
|
1127
1160
|
const raw = stored;
|
|
1128
1161
|
const review = reviewRewardPolicySchema.safeParse(raw.reviewReward);
|
|
1129
1162
|
const purchase = purchaseEarnPolicySchema.safeParse(raw.purchaseEarn);
|
|
1163
|
+
const use = pointUsePolicySchema.safeParse(raw.use);
|
|
1130
1164
|
const expiry = expiryDays.nullable().safeParse(raw.expiryDays ?? null);
|
|
1131
1165
|
return {
|
|
1132
1166
|
reviewReward: review.success ? review.data : POINT_POLICY_DEFAULTS.reviewReward,
|
|
1133
1167
|
purchaseEarn: purchase.success ? purchase.data : POINT_POLICY_DEFAULTS.purchaseEarn,
|
|
1168
|
+
use: use.success ? use.data : POINT_POLICY_DEFAULTS.use,
|
|
1134
1169
|
expiryDays: expiry.success ? expiry.data : null
|
|
1135
1170
|
};
|
|
1136
1171
|
}
|
|
@@ -1177,7 +1212,7 @@ const POINT_LOT_SOURCES = [
|
|
|
1177
1212
|
"REFUND_RESTORE",
|
|
1178
1213
|
"OPENING"
|
|
1179
1214
|
];
|
|
1180
|
-
/** 원장 항목
|
|
1215
|
+
/** 원장 항목 유형 */
|
|
1181
1216
|
const POINT_ENTRY_TYPES = [
|
|
1182
1217
|
"EARN_REVIEW",
|
|
1183
1218
|
"REVOKE_REVIEW",
|
|
@@ -1197,6 +1232,8 @@ const storePointPolicySchema = z.object({
|
|
|
1197
1232
|
configured: z.boolean().describe("셀러가 정책을 저장한 적이 있는가. false면 기본(모두 끔)이다"),
|
|
1198
1233
|
reviewReward: reviewRewardPolicySchema.describe("리뷰 적립. 정하지 않았으면 끔·0원"),
|
|
1199
1234
|
purchaseEarn: purchaseEarnPolicySchema.describe("구매 적립. 구매확정 때 주문상품 실결제 금액(배송비 제외) × 적립률을 준다. 정하지 않았으면 끔·0"),
|
|
1235
|
+
useAvailable: z.boolean().optional().default(false).describe("적립금 사용(결제에 쓰기)을 켤 수 있는가 (#93). false면 준비 중이라 `use.enabled`를 켜는 저장이 409 `POINTS_UNAVAILABLE`이다. 필드가 없는 이전 응답은 false로 읽는다"),
|
|
1236
|
+
use: pointUsePolicySchema.optional().default(POINT_POLICY_DEFAULTS.use).describe("적립금 사용 규칙. 적용 순서는 즉시할인 → 쿠폰 → 적립금이다. 정하지 않았으면 끔. 필드가 없는 이전 응답은 끔으로 읽는다"),
|
|
1200
1237
|
expiryDays: pointPolicySchema.shape.expiryDays,
|
|
1201
1238
|
notice: pointPolicyNoticeSchema
|
|
1202
1239
|
});
|
|
@@ -1207,10 +1244,11 @@ const storePointPolicySchema = z.object({
|
|
|
1207
1244
|
const updatePointPolicyRequestSchema = z.object({
|
|
1208
1245
|
reviewReward: reviewRewardPolicySchema.optional(),
|
|
1209
1246
|
purchaseEarn: purchaseEarnPolicySchema.optional(),
|
|
1247
|
+
use: pointUsePolicySchema.optional(),
|
|
1210
1248
|
expiryDays: expiryDays.optional()
|
|
1211
1249
|
});
|
|
1212
1250
|
/** 응답의 원장 유형 — 값이 추가될 수 있어 문자열로 받는다 */
|
|
1213
|
-
const responsePointEntryTypeSchema = z.union([z.enum(POINT_ENTRY_TYPES), z.string()]).describe("유형. `EARN_REVIEW` 리뷰 적립 · `REVOKE_REVIEW` 리뷰 삭제 회수 · `EARN_PURCHASE` 구매 적립 · `EXPIRE` 소멸 · `ADJUST` 셀러 지급·차감 · `OPENING` 기존 잔액
|
|
1251
|
+
const responsePointEntryTypeSchema = z.union([z.enum(POINT_ENTRY_TYPES), z.string()]).describe("유형. `EARN_REVIEW` 리뷰 적립 · `REVOKE_REVIEW` 리뷰 삭제 회수 · `EARN_PURCHASE` 구매 적립 · `EXPIRE` 소멸 · `ADJUST` 셀러 지급·차감 · `OPENING` 기존 잔액 이전 · `USE_RESERVE` 결제 사용(결제 시작 때 빠짐) · `USE_RELEASE` 결제가 실패·만료되어 되돌림 · `REFUND_RESTORE` 취소·반품 환불로 반환. 값이 추가될 수 있어 문자열로 받는다");
|
|
1214
1252
|
/** 원장 항목 — 셀러 조회용(사유·행위자 포함) */
|
|
1215
1253
|
const pointEntrySchema = z.object({
|
|
1216
1254
|
entryId: z.string(),
|
|
@@ -1227,7 +1265,7 @@ const pointEntrySchema = z.object({
|
|
|
1227
1265
|
/** 적립 묶음 요약 — 남은 금액이 있는 묶음 */
|
|
1228
1266
|
const pointLotSchema = z.object({
|
|
1229
1267
|
lotId: z.string(),
|
|
1230
|
-
source: z.union([z.enum(POINT_LOT_SOURCES), z.string()]).describe("출처. `REVIEW`·`PURCHASE`·`ADJUST`·`OPENING` 등"),
|
|
1268
|
+
source: z.union([z.enum(POINT_LOT_SOURCES), z.string()]).describe("출처. `REVIEW`·`PURCHASE`·`ADJUST`·`REFUND_RESTORE`·`OPENING` 등"),
|
|
1231
1269
|
amount: z.number().int().describe("적립한 금액"),
|
|
1232
1270
|
remaining: z.number().int().describe("남은 금액"),
|
|
1233
1271
|
expiresAt: z.string().nullable().describe("소멸 시각. null이면 소멸 없음"),
|
|
@@ -1267,6 +1305,37 @@ const pointAdjustmentResultSchema = z.object({
|
|
|
1267
1305
|
entry: pointEntrySchema,
|
|
1268
1306
|
balance: z.number().int().describe("조정 뒤 잔액")
|
|
1269
1307
|
});
|
|
1308
|
+
const RESTORE_GRACE_MS = 30 * DAY_MS$1;
|
|
1309
|
+
/**
|
|
1310
|
+
* 환불로 돌려주는 적립금의 만료 — 결제에 쓴 묶음 중 가장 늦은 만료이고, 그 시각이 이미 지났으면 지금 + 30일(KST 날짜 끝)이다.
|
|
1311
|
+
* 쓴 묶음 중 만료 없는 묶음(기존 잔액 등)이 있으면 만료 없음(null)이다. 쓴 기록이 없으면 지금 + 30일이다(사용자 결정 2026-10-02).
|
|
1312
|
+
*/
|
|
1313
|
+
function pointRestoreExpiresAtOf(usages, now) {
|
|
1314
|
+
if (usages.some((usage) => usage.expiresAt === null)) return null;
|
|
1315
|
+
const latest = usages.reduce((max, usage) => {
|
|
1316
|
+
const at = Date.parse(usage.expiresAt);
|
|
1317
|
+
return Number.isFinite(at) && (max === null || at > max) ? at : max;
|
|
1318
|
+
}, null);
|
|
1319
|
+
if (latest !== null && latest > now.getTime()) return new Date(latest);
|
|
1320
|
+
return pointExpiresAtOf(new Date(now.getTime() + RESTORE_GRACE_MS), 0);
|
|
1321
|
+
}
|
|
1322
|
+
/**
|
|
1323
|
+
* 환불 금액 나누기 — 현금 몫·적립금 몫에서 차감(반품 배송비·쿠폰 조건 미달·추가 차감)을 **현금에서 먼저** 빼고 모자란 몫만 적립금에서 뺀다.
|
|
1324
|
+
* 둘 다 모자라면 0에서 멈추고 못 받은 차감액(`uncollected`)을 돌려준다(호출부가 감사 로그에 남긴다).
|
|
1325
|
+
*/
|
|
1326
|
+
function splitRefund(input) {
|
|
1327
|
+
const cash = Math.max(0, input.cash);
|
|
1328
|
+
const points = Math.max(0, input.points);
|
|
1329
|
+
const charges = Math.max(0, input.charges);
|
|
1330
|
+
const fromCash = Math.min(cash, charges);
|
|
1331
|
+
const rest = charges - fromCash;
|
|
1332
|
+
const fromPoints = Math.min(points, rest);
|
|
1333
|
+
return {
|
|
1334
|
+
cashRefund: cash - fromCash,
|
|
1335
|
+
pointRefund: points - fromPoints,
|
|
1336
|
+
uncollected: rest - fromPoints
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1270
1339
|
//#endregion
|
|
1271
1340
|
//#region src/schemas/refund-policy.ts
|
|
1272
1341
|
/**
|
|
@@ -1901,7 +1970,7 @@ const COLLECTION_SLUG_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
|
1901
1970
|
/** 유형 — `MANUAL`(직접 선택)·`AUTOMATIC`(조건 자동) */
|
|
1902
1971
|
const COLLECTION_TYPES = ["MANUAL", "AUTOMATIC"];
|
|
1903
1972
|
/**
|
|
1904
|
-
* 상품 정렬 — `MANUAL`은 직접 정한 순서(직접 선택 컬렉션만)다. `BEST_SELLING`(판매량순)은
|
|
1973
|
+
* 상품 정렬 — `MANUAL`은 직접 정한 순서(직접 선택 컬렉션만)다. `BEST_SELLING`(판매량순)은 판매 수량이 많은 순이다(M3).
|
|
1905
1974
|
* 저장 값 전체 목록이고, 쓰기에서 받는 값은 `collectionProductSortRequestSchema`다.
|
|
1906
1975
|
*/
|
|
1907
1976
|
const COLLECTION_PRODUCT_SORTS = [
|
|
@@ -1917,12 +1986,13 @@ const COLLECTION_PRODUCT_SORTS = [
|
|
|
1917
1986
|
const collectionProductSortRequestSchema = z.enum([
|
|
1918
1987
|
"MANUAL",
|
|
1919
1988
|
"LATEST",
|
|
1989
|
+
"BEST_SELLING",
|
|
1920
1990
|
"PRICE_ASC",
|
|
1921
1991
|
"PRICE_DESC",
|
|
1922
1992
|
"REVIEW_COUNT",
|
|
1923
1993
|
"RATING_DESC",
|
|
1924
1994
|
"RECOMMEND"
|
|
1925
|
-
]).describe("스토어프론트 상품 기본 정렬. `MANUAL`(직접 정한 순서)·`LATEST`(최신순)·`PRICE_ASC`·`PRICE_DESC`·`REVIEW_COUNT`·`RATING_DESC`·`RECOMMEND`(추천순)");
|
|
1995
|
+
]).describe("스토어프론트 상품 기본 정렬. `MANUAL`(직접 정한 순서)·`LATEST`(최신순)·`BEST_SELLING`(판매량순)·`PRICE_ASC`·`PRICE_DESC`·`REVIEW_COUNT`·`RATING_DESC`·`RECOMMEND`(추천순). 판매량순의 기간은 판매량 상위 조건의 기간이고, 조건이 없으면 최근 30일이다");
|
|
1926
1996
|
/** 노출 상태 — 노출 여부와 기간에서 나온 값이다. 숨김이 기간보다 앞선다 */
|
|
1927
1997
|
const collectionStateSchema = z.enum([
|
|
1928
1998
|
"ACTIVE",
|
|
@@ -1946,6 +2016,16 @@ const MAX_COLLECTION_RULE_CATEGORIES = 20;
|
|
|
1946
2016
|
const MAX_COLLECTION_CREATED_WITHIN_DAYS = 365;
|
|
1947
2017
|
/** 미리보기(`POST /v1/collections/preview`)가 싣는 상품 최대 개수 */
|
|
1948
2018
|
const COLLECTION_PREVIEW_SIZE = 20;
|
|
2019
|
+
/** 판매량 상위 조건의 기간 선택지(일, 오늘 포함 한국 날짜) */
|
|
2020
|
+
const COLLECTION_BEST_SELLING_DAYS = [
|
|
2021
|
+
7,
|
|
2022
|
+
30,
|
|
2023
|
+
90
|
|
2024
|
+
];
|
|
2025
|
+
/** 판매량 상위 조건이 담는 상품 최대 개수 */
|
|
2026
|
+
const MAX_COLLECTION_BEST_SELLING_TOP = 100;
|
|
2027
|
+
/** 판매량순(`BEST_SELLING`) 정렬의 기간 — 판매량 상위 조건이 없을 때 쓴다 */
|
|
2028
|
+
const COLLECTION_SALES_SORT_DEFAULT_DAYS = 30;
|
|
1949
2029
|
const createdWithinDaysRuleSchema = z.object({
|
|
1950
2030
|
field: z.literal("createdWithinDays"),
|
|
1951
2031
|
value: z.number().int().min(1).max(365).describe("등록한 지 N일 안의 상품(1~365). 조회 시각에서 N일을 뺀 시각 이후에 등록한 상품이다")
|
|
@@ -1963,15 +2043,26 @@ const discountedRuleSchema = z.object({
|
|
|
1963
2043
|
field: z.literal("discounted"),
|
|
1964
2044
|
value: z.literal(true).describe("즉시할인이 지금 적용되는 상품")
|
|
1965
2045
|
});
|
|
2046
|
+
const bestSellingRuleSchema = z.object({
|
|
2047
|
+
field: z.literal("bestSelling"),
|
|
2048
|
+
days: z.union([
|
|
2049
|
+
z.literal(7),
|
|
2050
|
+
z.literal(30),
|
|
2051
|
+
z.literal(90)
|
|
2052
|
+
]).describe("판매량을 세는 기간(일). 7·30·90 중 하나이고 오늘을 포함한 한국 날짜 기준이다"),
|
|
2053
|
+
top: z.number().int().min(1).max(100).describe("담을 상품 수(1~100). 다른 조건을 만족하는 상품 중 판매 수량 상위 N개다")
|
|
2054
|
+
});
|
|
1966
2055
|
/**
|
|
1967
2056
|
* 조건 하나 — `field`로 가른다. 가격은 즉시할인을 반영한 판매가(`discountedPrice ?? salePrice`)다.
|
|
1968
|
-
* 판매량 상위(`bestSelling`)는
|
|
2057
|
+
* 판매량 상위(`bestSelling`)는 술어가 아니라 순위 자르기다. 다른 조건을 모두 만족한 상품 중 판매 수량 상위 N개만 남긴다(`rankBestSelling`).
|
|
2058
|
+
* 판매 수량은 실결제 주문의 결제 수량에서 취소·반품 수량을 뺀 값이고, 날짜는 주문 시각의 한국 날짜다. 집계는 최대 10분 늦다.
|
|
1969
2059
|
*/
|
|
1970
2060
|
const collectionRuleSchema = z.discriminatedUnion("field", [
|
|
1971
2061
|
createdWithinDaysRuleSchema,
|
|
1972
2062
|
categoryRuleSchema,
|
|
1973
2063
|
priceRuleSchema,
|
|
1974
|
-
discountedRuleSchema
|
|
2064
|
+
discountedRuleSchema,
|
|
2065
|
+
bestSellingRuleSchema
|
|
1975
2066
|
]).superRefine((rule, ctx) => {
|
|
1976
2067
|
if (rule.field !== "price") return;
|
|
1977
2068
|
if (rule.min === void 0 && rule.max === void 0) ctx.addIssue({
|
|
@@ -2005,6 +2096,7 @@ const collectionRuleViewSchema = z.union([
|
|
|
2005
2096
|
categoryRuleSchema,
|
|
2006
2097
|
priceRuleSchema,
|
|
2007
2098
|
discountedRuleSchema,
|
|
2099
|
+
bestSellingRuleSchema,
|
|
2008
2100
|
z.looseObject({ field: z.string() })
|
|
2009
2101
|
]);
|
|
2010
2102
|
const DAY_MS = 864e5;
|
|
@@ -2029,6 +2121,7 @@ function descendantCategoryIdsOf(roots, categories) {
|
|
|
2029
2121
|
/**
|
|
2030
2122
|
* 조건 판정 함수를 만든다 — 모든 조건을 만족해야 true다(AND). 카테고리 트리는 여기서 한 번만 푼다.
|
|
2031
2123
|
* 알 수 없는 조건(`field`)은 만족하지 않는 것으로 본다. 모르는 조건을 건너뛰면 상품이 예고 없이 늘어난다.
|
|
2124
|
+
* 판매량 상위(`bestSelling`)는 여기서 모두 통과시킨다. 순위 자르기는 판매량을 아는 호출부가 `rankBestSelling`으로 한다.
|
|
2032
2125
|
* 판매 상태는 보지 않는다. 판매 중만 거르는 것은 호출부다.
|
|
2033
2126
|
*/
|
|
2034
2127
|
function collectionRulesPredicate(rules, context) {
|
|
@@ -2050,6 +2143,7 @@ function collectionRulesPredicate(rules, context) {
|
|
|
2050
2143
|
return (parsed.min === void 0 || price >= parsed.min) && (parsed.max === void 0 || price <= parsed.max);
|
|
2051
2144
|
};
|
|
2052
2145
|
case "discounted": return (product) => product.discountedPrice !== null && product.discountedPrice < product.salePrice;
|
|
2146
|
+
case "bestSelling": return () => true;
|
|
2053
2147
|
default: return () => false;
|
|
2054
2148
|
}
|
|
2055
2149
|
});
|
|
@@ -2059,6 +2153,31 @@ function collectionRulesPredicate(rules, context) {
|
|
|
2059
2153
|
function matchesCollectionRules(product, rules, context) {
|
|
2060
2154
|
return collectionRulesPredicate(rules, context)(product);
|
|
2061
2155
|
}
|
|
2156
|
+
/** 판매량 상위 조건 — 없으면 null. 같은 조건은 한 번만 쓰므로 첫 번째다 */
|
|
2157
|
+
function bestSellingRuleOf(rules) {
|
|
2158
|
+
for (const rule of rules) {
|
|
2159
|
+
const parsed = bestSellingRuleSchema.safeParse(rule);
|
|
2160
|
+
if (parsed.success) return {
|
|
2161
|
+
days: parsed.data.days,
|
|
2162
|
+
top: parsed.data.top
|
|
2163
|
+
};
|
|
2164
|
+
}
|
|
2165
|
+
return null;
|
|
2166
|
+
}
|
|
2167
|
+
/**
|
|
2168
|
+
* 판매량 비교 — 판매 수량이 많은 순, 같으면 최근 등록 순, 그것도 같으면 상품 id 순이다. 결과가 입력 순서에 기대지 않는다.
|
|
2169
|
+
* `sales`에 없는 상품은 0개다.
|
|
2170
|
+
*/
|
|
2171
|
+
function compareBySales(sales) {
|
|
2172
|
+
return (a, b) => (sales.get(b.productId) ?? 0) - (sales.get(a.productId) ?? 0) || Date.parse(b.createdAt) - Date.parse(a.createdAt) || (a.productId < b.productId ? -1 : a.productId > b.productId ? 1 : 0);
|
|
2173
|
+
}
|
|
2174
|
+
/**
|
|
2175
|
+
* 판매량 상위 자르기 — 다른 조건을 통과한 상품 중 판매 수량이 1개 이상인 상품을 `compareBySales` 순으로 `top`개 남긴다.
|
|
2176
|
+
* 판매가 없는 상품은 넣지 않는다.
|
|
2177
|
+
*/
|
|
2178
|
+
function rankBestSelling(products, sales, top) {
|
|
2179
|
+
return products.filter((product) => (sales.get(product.productId) ?? 0) > 0).sort(compareBySales(sales)).slice(0, Math.max(0, top));
|
|
2180
|
+
}
|
|
2062
2181
|
/** 조건이 참조하는 카테고리 id — 카테고리 삭제의 참조 검사에 쓴다 */
|
|
2063
2182
|
function collectionRuleCategoryIds(rules) {
|
|
2064
2183
|
const ids = [];
|
|
@@ -2084,6 +2203,7 @@ const collectionSchema = z.object({
|
|
|
2084
2203
|
metaTitle: z.string().nullable(),
|
|
2085
2204
|
metaDescription: z.string().nullable(),
|
|
2086
2205
|
state: collectionStateSchema.describe("지금 노출 상태"),
|
|
2206
|
+
salesComputedAt: z.string().nullable().default(null).describe("판매량 기준 시각. 판매량 상위 조건이나 판매량순 정렬을 쓰는 컬렉션은 이 시각까지의 주문을 센다(최대 10분 늦다). 판매량을 쓰지 않거나 아직 집계 전이면 null"),
|
|
2087
2207
|
productCount: z.number().int().describe("상품 수. 직접 선택은 담긴 상품 수(판매 상태 무관), 조건 자동은 지금 조건을 만족하는 판매 중 상품 수"),
|
|
2088
2208
|
revision: z.number().int().describe("수정 번호. 쓰기마다 1씩 오른다. 수정 본문에 주면 그 사이 다른 수정이 있을 때 409다"),
|
|
2089
2209
|
createdAt: z.string(),
|
|
@@ -2113,7 +2233,7 @@ const periodRefine = (body, ctx) => {
|
|
|
2113
2233
|
/**
|
|
2114
2234
|
* `POST /v1/collections` — 컬렉션을 만든다. `slug`를 생략하면 `c-{id 뒤 8자}`로 만든다.
|
|
2115
2235
|
* 직접 선택(`MANUAL`)은 `productIds`가 처음 담을 상품과 순서다. 조건 자동(`AUTOMATIC`)은 `rules`가 있어야 하고 `productIds`를 받지 않는다.
|
|
2116
|
-
* `productSort`를 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST
|
|
2236
|
+
* `productSort`를 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST`(판매량 상위 조건이 있으면 `BEST_SELLING`)다. 조건 자동은 `MANUAL`을 쓸 수 없다.
|
|
2117
2237
|
*/
|
|
2118
2238
|
const collectionCreateRequestSchema = z.object({
|
|
2119
2239
|
title: z.string().trim().min(1).max(60).describe("제목"),
|
|
@@ -2122,7 +2242,7 @@ const collectionCreateRequestSchema = z.object({
|
|
|
2122
2242
|
rules: collectionRulesSchema.optional().describe("조건 자동 컬렉션의 조건(AND). 조건 자동이면 필수, 직접 선택이면 줄 수 없다"),
|
|
2123
2243
|
description: commonFields.description.default(""),
|
|
2124
2244
|
imageUrl: commonFields.imageUrl.optional(),
|
|
2125
|
-
productSort: commonFields.productSort.optional().describe("스토어프론트 상품 기본 정렬. 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST
|
|
2245
|
+
productSort: commonFields.productSort.optional().describe("스토어프론트 상품 기본 정렬. 생략하면 직접 선택은 `MANUAL`, 조건 자동은 `LATEST`(판매량 상위 조건이 있으면 `BEST_SELLING`)다. 조건 자동은 `MANUAL`을 쓸 수 없다"),
|
|
2126
2246
|
visible: commonFields.visible.default(true),
|
|
2127
2247
|
startsAt: commonFields.startsAt,
|
|
2128
2248
|
endsAt: commonFields.endsAt,
|
|
@@ -2196,12 +2316,13 @@ const collectionProductListQuerySchema = z.object({ ...pageQueryShape({
|
|
|
2196
2316
|
/** `POST /v1/collections/preview` — 저장하지 않고 조건으로 나오는 상품을 본다 */
|
|
2197
2317
|
const collectionPreviewRequestSchema = z.object({
|
|
2198
2318
|
rules: collectionRulesSchema,
|
|
2199
|
-
productSort: collectionProductSortRequestSchema.optional().describe("미리보기 순서.
|
|
2319
|
+
productSort: collectionProductSortRequestSchema.optional().describe("미리보기 순서. 생략하면 `LATEST`(판매량 상위 조건이 있으면 `BEST_SELLING`)이고, `MANUAL`이면 `LATEST`다")
|
|
2200
2320
|
});
|
|
2201
2321
|
/** 미리보기 응답 — 조건을 만족하는 판매 중 상품 수와 앞 20개 */
|
|
2202
2322
|
const collectionPreviewSchema = z.object({
|
|
2203
2323
|
count: z.number().int().describe("조건을 만족하는 판매 중 상품 수(조회 시각 기준)"),
|
|
2204
|
-
products: z.array(collectionProductSchema).describe("앞 20개(정렬 순)")
|
|
2324
|
+
products: z.array(collectionProductSchema).describe("앞 20개(정렬 순)"),
|
|
2325
|
+
salesComputedAt: z.string().nullable().default(null).describe("판매량 기준 시각. 판매량 상위 조건이나 판매량순 정렬을 쓰면 이 시각까지의 주문을 센다. 판매량을 쓰지 않거나 집계 전이면 null")
|
|
2205
2326
|
});
|
|
2206
2327
|
//#endregion
|
|
2207
2328
|
//#region src/schemas/promotion.ts
|
|
@@ -2533,7 +2654,8 @@ function quotePricing(input) {
|
|
|
2533
2654
|
const deliveryBundles = input.delivery?.bundles ?? [];
|
|
2534
2655
|
const bundles = deliveryBundles.map((bundle) => ({
|
|
2535
2656
|
bundleKey: bundle.bundleKey,
|
|
2536
|
-
couponDiscount: 0
|
|
2657
|
+
couponDiscount: 0,
|
|
2658
|
+
pointAllocation: 0
|
|
2537
2659
|
}));
|
|
2538
2660
|
let deliverySlot = false;
|
|
2539
2661
|
let deliveryDiscountAmount = 0;
|
|
@@ -2565,11 +2687,33 @@ function quotePricing(input) {
|
|
|
2565
2687
|
lineId: entry.line.lineId,
|
|
2566
2688
|
amount: entry.line.amount,
|
|
2567
2689
|
couponDiscount: entry.allocations.reduce((sum, a) => sum + a.amount, 0),
|
|
2568
|
-
allocations: entry.allocations
|
|
2690
|
+
allocations: entry.allocations,
|
|
2691
|
+
pointAllocation: 0
|
|
2569
2692
|
}));
|
|
2570
2693
|
const productAmount = lines.reduce((sum, entry) => sum + entry.line.amount, 0);
|
|
2571
2694
|
const couponDiscountAmount = lineResults.reduce((sum, line) => sum + line.couponDiscount, 0);
|
|
2572
2695
|
const deliveryFee = deliveryBundles.reduce((sum, bundle) => sum + bundle.fee + bundle.remoteSurcharge, 0);
|
|
2696
|
+
const beforePoints = productAmount - couponDiscountAmount + deliveryFee - deliveryDiscountAmount;
|
|
2697
|
+
const productWeights = lineResults.map((line) => Math.max(0, line.amount - line.couponDiscount));
|
|
2698
|
+
const bundleWeights = deliveryBundles.map((bundle, index) => Math.max(0, bundle.fee + bundle.remoteSurcharge - (bundles[index]?.couponDiscount ?? 0)));
|
|
2699
|
+
const points = pointUseOf(input.points ?? null, {
|
|
2700
|
+
productPaid: productWeights.reduce((sum, w) => sum + w, 0),
|
|
2701
|
+
deliveryPaid: bundleWeights.reduce((sum, w) => sum + w, 0),
|
|
2702
|
+
total: beforePoints
|
|
2703
|
+
});
|
|
2704
|
+
if (points.amount > 0) {
|
|
2705
|
+
const productPaid = productWeights.reduce((sum, w) => sum + w, 0);
|
|
2706
|
+
const toLines = Math.min(points.amount, productPaid);
|
|
2707
|
+
allocateByWeight(toLines, productWeights).forEach((share, i) => {
|
|
2708
|
+
const line = lineResults[i];
|
|
2709
|
+
if (line) line.pointAllocation = share;
|
|
2710
|
+
});
|
|
2711
|
+
const toBundles = points.amount - toLines;
|
|
2712
|
+
if (toBundles > 0) allocateByWeight(toBundles, bundleWeights).forEach((share, i) => {
|
|
2713
|
+
const bundle = bundles[i];
|
|
2714
|
+
if (bundle) bundle.pointAllocation = share;
|
|
2715
|
+
});
|
|
2716
|
+
}
|
|
2573
2717
|
return {
|
|
2574
2718
|
lines: lineResults,
|
|
2575
2719
|
coupons: results,
|
|
@@ -2578,7 +2722,64 @@ function quotePricing(input) {
|
|
|
2578
2722
|
couponDiscountAmount,
|
|
2579
2723
|
deliveryFee,
|
|
2580
2724
|
deliveryDiscountAmount,
|
|
2581
|
-
|
|
2725
|
+
pointAmount: points.amount,
|
|
2726
|
+
pointMaxUsable: points.maxUsable,
|
|
2727
|
+
pointAdjustReason: points.adjustReason,
|
|
2728
|
+
pointRejectReason: points.rejectReason,
|
|
2729
|
+
totalAmount: beforePoints - points.amount
|
|
2730
|
+
};
|
|
2731
|
+
}
|
|
2732
|
+
/**
|
|
2733
|
+
* 사용 적립금 금액(순수) — 요청·잔액·최대 비율·「결제 금액 100원 남기기」 중 작은 값을 단위로 내린다.
|
|
2734
|
+
* 최소 보유액·최소 사용액에 못 미치면 0이다. 결제 금액이 0원이 되는 사용(적립금 전액 결제)은 아직 받지 않는다(P4).
|
|
2735
|
+
*/
|
|
2736
|
+
function pointUseOf(points, amounts) {
|
|
2737
|
+
const none = {
|
|
2738
|
+
amount: 0,
|
|
2739
|
+
maxUsable: 0,
|
|
2740
|
+
adjustReason: null,
|
|
2741
|
+
rejectReason: null
|
|
2742
|
+
};
|
|
2743
|
+
if (!points) return none;
|
|
2744
|
+
const { rules } = points;
|
|
2745
|
+
const unit = Math.max(1, Math.floor(rules.unit));
|
|
2746
|
+
const base = amounts.productPaid + (rules.includeDeliveryFee ? amounts.deliveryPaid : 0);
|
|
2747
|
+
const byRatio = Math.floor(base * rules.maxRatioBp / 1e4);
|
|
2748
|
+
const byPayment = Math.max(0, amounts.total - 100);
|
|
2749
|
+
const balance = Math.max(0, points.balance);
|
|
2750
|
+
const floorUnit = (value) => Math.floor(Math.max(0, value) / unit) * unit;
|
|
2751
|
+
const eligible = balance >= rules.minBalance;
|
|
2752
|
+
const ceiling = Math.min(balance, byRatio, byPayment);
|
|
2753
|
+
const maxUsable = eligible && floorUnit(ceiling) >= rules.minAmount ? floorUnit(ceiling) : 0;
|
|
2754
|
+
const requested = Math.max(0, Math.floor(points.requested));
|
|
2755
|
+
if (requested === 0) return {
|
|
2756
|
+
...none,
|
|
2757
|
+
maxUsable
|
|
2758
|
+
};
|
|
2759
|
+
if (!eligible) return {
|
|
2760
|
+
amount: 0,
|
|
2761
|
+
maxUsable,
|
|
2762
|
+
adjustReason: null,
|
|
2763
|
+
rejectReason: "MIN_BALANCE"
|
|
2764
|
+
};
|
|
2765
|
+
const amount = floorUnit(Math.min(requested, balance, byRatio, byPayment));
|
|
2766
|
+
if (amount <= 0) return {
|
|
2767
|
+
amount: 0,
|
|
2768
|
+
maxUsable,
|
|
2769
|
+
adjustReason: null,
|
|
2770
|
+
rejectReason: "NOT_PAYABLE"
|
|
2771
|
+
};
|
|
2772
|
+
if (amount < rules.minAmount) return {
|
|
2773
|
+
amount: 0,
|
|
2774
|
+
maxUsable,
|
|
2775
|
+
adjustReason: null,
|
|
2776
|
+
rejectReason: "MIN_AMOUNT"
|
|
2777
|
+
};
|
|
2778
|
+
return {
|
|
2779
|
+
amount,
|
|
2780
|
+
maxUsable,
|
|
2781
|
+
adjustReason: floorUnit(Math.min(requested, balance, byRatio)) > amount ? "MIN_PAYMENT" : null,
|
|
2782
|
+
rejectReason: null
|
|
2582
2783
|
};
|
|
2583
2784
|
}
|
|
2584
2785
|
const NO_COUPON_SETTLEMENT = {
|
|
@@ -2711,7 +2912,14 @@ function settleCouponShortfall(input) {
|
|
|
2711
2912
|
* 바로 나누면 몫이 항상 0 이상이고 전량 취소의 합이 실결제 금액과 정확히 같다.
|
|
2712
2913
|
*/
|
|
2713
2914
|
function proratedPaidRefundBase(item, settledQuantity, cancelQuantity) {
|
|
2714
|
-
return proratedRefundBase(Math.max(0, item.totalPrice - (item.couponDiscountAmount ?? 0)), item.quantity, settledQuantity, cancelQuantity);
|
|
2915
|
+
return proratedRefundBase(Math.max(0, item.totalPrice - (item.couponDiscountAmount ?? 0) - (item.pointAllocation ?? 0)), item.quantity, settledQuantity, cancelQuantity);
|
|
2916
|
+
}
|
|
2917
|
+
/**
|
|
2918
|
+
* 주문상품의 사용 적립금 중 이번 취소 수량의 몫(#93 P3) — 누적 내림의 차분이라 나눠 취소해도 합이 배분액과 같다.
|
|
2919
|
+
* 현금 환불(`proratedPaidRefundBase`)과 따로 돌려준다(`pointRefundAmount`).
|
|
2920
|
+
*/
|
|
2921
|
+
function proratedPointRefund(item, settledQuantity, cancelQuantity) {
|
|
2922
|
+
return proratedRefundBase(item.pointAllocation ?? 0, item.quantity, settledQuantity, cancelQuantity);
|
|
2715
2923
|
}
|
|
2716
2924
|
//#endregion
|
|
2717
2925
|
//#region src/schemas/coupon.ts
|
|
@@ -3767,7 +3975,8 @@ const paymentAttemptRecordSchema = z.object({
|
|
|
3767
3975
|
});
|
|
3768
3976
|
const paymentRefundRecordSchema = z.object({
|
|
3769
3977
|
refundId: z.string(),
|
|
3770
|
-
amount: z.number().int(),
|
|
3978
|
+
amount: z.number().int().describe("PG로 돌려준 현금"),
|
|
3979
|
+
pointRefundAmount: z.number().int().optional().default(0).describe("같은 환불에서 돌려준 적립금 (#93). 적립금을 쓰지 않은 결제는 0"),
|
|
3771
3980
|
reason: z.string().describe("환불 사유 코드"),
|
|
3772
3981
|
kind: z.string().describe("환불 원인 — SELLER_CANCEL·CLAIM·COMPENSATION·DUPLICATE. 새 값이 추가될 수 있다"),
|
|
3773
3982
|
status: z.string().describe("SUCCEEDED·FAILED"),
|
|
@@ -3845,6 +4054,7 @@ const orderItemSchema = z.object({
|
|
|
3845
4054
|
discountAmount: z.number().int(),
|
|
3846
4055
|
totalPrice: z.number().int().describe("주문상품 금액 (즉시할인 반영 단가 × 주문 수량). 쿠폰 할인 전 금액이다"),
|
|
3847
4056
|
couponDiscountAmount: z.number().int().optional().default(0).describe("이 주문상품에 배분된 쿠폰 할인 — 상품 쿠폰 + 주문 쿠폰 배분. 실결제 금액은 `totalPrice − couponDiscountAmount`이고 취소·반품 환불은 실결제 금액을 수량 비율로 나눈다. 쿠폰이 없으면 0. 서버는 항상 싣는다"),
|
|
4057
|
+
pointAllocation: z.number().int().optional().default(0).describe("이 주문상품에 배분된 사용 적립금 (원, #93). 현금 실결제는 `totalPrice − couponDiscountAmount − pointAllocation`이고 취소·반품은 현금과 적립금을 따로 수량 비율로 돌려준다. 적립금을 쓰지 않았으면 0. 서버는 항상 싣는다"),
|
|
3848
4058
|
hold: z.object({
|
|
3849
4059
|
reason: z.string(),
|
|
3850
4060
|
expectedDispatchDate: z.string()
|
|
@@ -3891,6 +4101,7 @@ const orderSchema = z.object({
|
|
|
3891
4101
|
discountAmount: z.number().int().describe("즉시할인 합 (정가 − 할인 단가) × 수량. 쿠폰 할인은 `couponDiscountAmount`로 따로 온다"),
|
|
3892
4102
|
couponDiscountAmount: z.number().int().optional().default(0).describe("상품·주문 쿠폰 할인 합계. 쿠폰이 없으면 0. 서버는 항상 싣는다"),
|
|
3893
4103
|
deliveryDiscountAmount: z.number().int().optional().default(0).describe("배송비 쿠폰 할인. 쿠폰이 없으면 0. 서버는 항상 싣는다"),
|
|
4104
|
+
pointAmount: z.number().int().optional().default(0).describe("사용 적립금 (원, #93) — 쿠폰 뒤 금액에서 뺐다. `totalAmount`는 적립금을 뺀 결제(현금) 금액이다. 적립금을 쓰지 않았으면 0. 서버는 항상 싣는다"),
|
|
3894
4105
|
discounts: z.array(orderDiscountSchema).optional().default([]).describe("주문이 받은 쿠폰. 쿠폰이 없으면 빈 배열. 서버는 항상 싣는다"),
|
|
3895
4106
|
totalAmount: z.number().int().describe("결제 금액 = productAmount + deliveryFee − couponDiscountAmount − deliveryDiscountAmount. 쿠폰이 없는 주문은 productAmount + deliveryFee다"),
|
|
3896
4107
|
paidAt: z.string().nullable(),
|
|
@@ -4037,6 +4248,7 @@ const cancelBySellerResultSchema = z.object({
|
|
|
4037
4248
|
deliveryFeeChargeAmount: z.number().int().describe("조건부 무료배송 기준 미달로 환불액에서 뺀 배송비. 정책이 꺼져 있으면 항상 0이다"),
|
|
4038
4249
|
couponChargeAmount: z.number().int().optional().default(0).describe("쿠폰 조건 미달 차감. 판매자 취소는 차감하지 않으므로 늘 0이다. 서버는 항상 싣는다"),
|
|
4039
4250
|
couponChargeRefundAmount: z.number().int().optional().default(0).describe("환불액에 더한, 앞선 환불에서 뺀 쿠폰 차감을 되돌린 몫. 서버는 항상 싣는다"),
|
|
4251
|
+
pointRefundAmount: z.number().int().optional().default(0).describe("돌려준 적립금 (원, #93) — 결제에 쓴 적립금 중 이번 취소·반품 수량의 몫이다. 현금 환불(`refundAmount`)과 별개다. 차감은 현금에서 먼저 빼고 모자란 몫만 여기서 뺀다. 적립금을 쓰지 않은 주문과 이 필드가 없는 이전 응답·이벤트는 0으로 읽는다"),
|
|
4040
4252
|
refundedAt: z.string()
|
|
4041
4253
|
});
|
|
4042
4254
|
/** `PUT /v1/order-items/{orderItemId}/memo` 응답 — 빈 문자열로 저장하면 메모가 지워져 `null`이다 */
|
|
@@ -6909,6 +7121,7 @@ const orderWebhookEventDataSchema = z.object({
|
|
|
6909
7121
|
status: orderItemStatusSchema.describe("이벤트 발생 시점의 주문 대표 상태"),
|
|
6910
7122
|
testPayment: z.boolean().optional().default(false).describe("테스트 결제(샌드박스 결제) 주문인가. true면 실제로 돈이 오가지 않았다. 이 필드가 없는 이전 이벤트는 false로 읽는다"),
|
|
6911
7123
|
couponDiscountAmount: z.number().int().optional().default(0).describe("주문이 받은 상품·주문 쿠폰 할인 합계 (원). 즉시할인(`discountAmount`)과 별개다. 쿠폰이 없거나 이 필드가 없는 이전 이벤트는 0으로 읽는다"),
|
|
7124
|
+
pointAmount: z.number().int().optional().default(0).describe("주문에 쓴 적립금 (원, #93). 적립금을 쓰지 않았거나 이 필드가 없는 이전 이벤트는 0으로 읽는다"),
|
|
6912
7125
|
orderItemId: z.string().optional().describe("이벤트를 만든 주문상품 ID. 배송 없는 상품 제공으로 보내는 `ORDER.DELIVERED`에만 실린다. 택배 배송완료와 그 밖의 주문 이벤트에는 없다"),
|
|
6913
7126
|
fulfillmentSnapshot: orderItemFulfillmentSnapshotResponseSchema.optional().describe("이벤트를 만든 주문상품의 주문 시점 이행 스냅샷(주문상품 응답의 `fulfillmentSnapshot`과 같다, 이슈 #57). 배송 없는 상품의 제공 완료는 `ORDER.DELIVERED`로도 오고 `type`이 `MANUAL`이다. `orderItemId`가 있는 이벤트에만 실린다"),
|
|
6914
7127
|
itemOptions: z.array(z.object({
|
|
@@ -6948,6 +7161,7 @@ const orderCanceledWebhookEventDataSchema = z.object({
|
|
|
6948
7161
|
deliveryFeeChargeAmount: z.number().int().describe("환불액에서 뺀 배송비 (원) — 조건부 무료배송 기준 미달 차감"),
|
|
6949
7162
|
couponChargeAmount: z.number().int().optional().default(0).describe("환불액에서 뺀 쿠폰 조건 미달 차감 (원). 판매자 취소는 차감하지 않으므로 늘 0이다. 이 필드가 없는 이전 이벤트는 0으로 읽는다"),
|
|
6950
7163
|
couponChargeRefundAmount: z.number().int().optional().default(0).describe("환불액에 더한 금액 (원) — 앞선 환불에서 뺀 쿠폰 조건 미달 차감을 되돌린 몫이다. 전량 취소면 누적 차감이 모두 되돌아간다. 이 필드가 없는 이전 이벤트는 0으로 읽는다"),
|
|
7164
|
+
pointRefundAmount: z.number().int().optional().default(0).describe("돌려준 적립금 (원, #93) — 결제에 쓴 적립금 중 이번 취소·반품 수량의 몫이다. 현금 환불(`refundAmount`)과 별개다. 차감은 현금에서 먼저 빼고 모자란 몫만 여기서 뺀다. 적립금을 쓰지 않은 주문과 이 필드가 없는 이전 응답·이벤트는 0으로 읽는다"),
|
|
6951
7165
|
testPayment: z.boolean().describe("테스트 결제(샌드박스 결제) 주문인가. true면 실제로 돈이 오가지 않았다")
|
|
6952
7166
|
});
|
|
6953
7167
|
const claimWebhookEventDataSchema = z.object({
|
|
@@ -6963,6 +7177,7 @@ const claimWebhookEventDataSchema = z.object({
|
|
|
6963
7177
|
deductAmount: z.number().int().optional().default(0).describe("환불액에서 뺀 추가 차감 (원) — 셀러가 클레임 승인에 넣은 금액이다(상품 훼손 등). 배송비 차감과 별개이므로 `deliveryFeeChargeAmount`와 더해서 뺀다. 접수 이벤트와 이 필드가 없는 이전 이벤트는 0이다"),
|
|
6964
7178
|
couponChargeAmount: z.number().int().optional().default(0).describe("환불액에서 뺀 쿠폰 조건 미달 차감 (원) — 일부 취소·반품으로 남은 주문상품이 쿠폰 조건(최소 주문 금액 등)을 잃어 남은 주문상품이 받던 할인을 뺀 금액이다. 배송비 차감·추가 차감과 별개다. 접수 이벤트는 예상값이다. 이 필드가 없는 이전 이벤트는 0으로 읽는다"),
|
|
6965
7179
|
couponChargeRefundAmount: z.number().int().optional().default(0).describe("환불액에 더한 금액 (원) — 앞선 환불에서 뺀 쿠폰 조건 미달 차감을 되돌린 몫이다. 접수 이벤트는 예상값이다. 이 필드가 없는 이전 이벤트는 0으로 읽는다"),
|
|
7180
|
+
pointRefundAmount: z.number().int().optional().default(0).describe("돌려준 적립금 (원, #93) — 결제에 쓴 적립금 중 이번 취소·반품 수량의 몫이다. 현금 환불(`refundAmount`)과 별개다. 차감은 현금에서 먼저 빼고 모자란 몫만 여기서 뺀다. 적립금을 쓰지 않은 주문과 이 필드가 없는 이전 응답·이벤트는 0으로 읽는다"),
|
|
6966
7181
|
testPayment: z.boolean().optional().default(false).describe("테스트 결제(샌드박스 결제) 주문의 클레임인가. 이 필드가 없는 이전 이벤트는 false로 읽는다")
|
|
6967
7182
|
});
|
|
6968
7183
|
const inquiryWebhookEventDataSchema = z.object({
|
|
@@ -7215,4 +7430,4 @@ function createStoreSession(options) {
|
|
|
7215
7430
|
};
|
|
7216
7431
|
}
|
|
7217
7432
|
//#endregion
|
|
7218
|
-
export { APPROVAL_ALREADY_DECIDED_CODE, APPROVAL_REQUIRED_CODE, ApiError, ApprovalPendingError, BUSINESS_INFO_MAX_LENGTH, BUSINESS_NUMBER_PATTERN, CASH_RECEIPT_STATUS_VALUES, COLLECTION_PREVIEW_SIZE, COLLECTION_PRODUCT_SORTS, COLLECTION_SLUG_PATTERN, COLLECTION_TYPES, COUPON_CODE_PATTERN, COUPON_CONDITIONS_DEFAULTS, COUPON_TARGET_ALL, COUPON_TARGET_LIST_MAX, CUSTOM_INPUT_FORBIDDEN_WORDS, FULFILLMENT_RULES, MAX_ADDON_GROUPS, MAX_ANALYTICS_ALLOWED_ORIGINS, MAX_AUTO_TRANSITION_DAYS, MAX_COLLECTIONS, MAX_COLLECTION_CREATED_WITHIN_DAYS, MAX_COLLECTION_DESCRIPTION, MAX_COLLECTION_PRODUCTS, MAX_COLLECTION_PRODUCTS_PER_ADD, MAX_COLLECTION_RULES, MAX_COLLECTION_RULE_CATEGORIES, MAX_COLLECTION_TITLE, MAX_CUSTOM_INPUTS, MAX_CUSTOM_INPUT_LENGTH, MAX_OPTION_GROUPS, MAX_PRODUCT_IMAGES, MAX_SAVED_OPTION_SETS, MAX_SAVED_OPTION_SET_NAME, MAX_VALUES_PER_GROUP, MAX_VARIANTS, MCP_TELEMETRY_MAX_RESULTS, MIN_PAYMENT_AMOUNT, NO_COUPON_SETTLEMENT, NO_SHIPPING_BUNDLE_KEY, PAYMENT_ROUTING_EXCLUSION_CODES, POINT_ADJUSTMENT_MAX, POINT_EARN_RATE_BP_MAX, POINT_ENTRY_TYPES, POINT_EXPIRY_DAYS_MAX, POINT_EXPIRY_DAYS_MIN, POINT_LOT_SOURCES, POINT_POLICY_DEFAULTS, POINT_REVIEW_REWARD_MAX, PORTONE_CHANNEL_NAME_MAX_LENGTH, PORTONE_MAX_CHANNELS, PORTONE_MIN_CHANNELS, REFUND_POLICY_DEFAULTS, REFUND_POLICY_DELIVERY_FEE_KEYS, REMOTE_AREA_ZIP_RANGES, RESERVED_STOREFRONT_SLUGS, RESERVED_STORE_CODES, SHIPPING_POLICY_DEFAULTS, STOREFRONT_BLOCKED_PATH_SEGMENTS, STOREFRONT_BUILD_STAGES, STOREFRONT_BUILD_TERMINAL_STATUSES, STOREFRONT_CHECK_TERMINAL_STATUSES, STOREFRONT_CUSTOM_DOMAIN_LIMIT_DEFAULT, STOREFRONT_DOMAIN_DNS_GRACE_DAYS, STOREFRONT_DOMAIN_DNS_WAIT_DAYS, STOREFRONT_DOMAIN_TXT_LABEL, STOREFRONT_EDIT_ACTIVITY_TIMEOUT_MINUTES, STOREFRONT_EDIT_CAPACITY, STOREFRONT_EDIT_IDLE_MINUTES, STOREFRONT_EDIT_PREVIEW_SUFFIX, STOREFRONT_EDIT_START_STAGES, STOREFRONT_FILE_BATCH_MAX, STOREFRONT_FILE_MAX_BYTES, STOREFRONT_PATH_SEGMENT_PATTERN, STOREFRONT_PLATFORM_DOMAINS, STOREFRONT_PUBLIC_SUFFIXES, STOREFRONT_SEARCH_REGEX_MAX_LENGTH, STOREFRONT_SHOWCASE_SLUG_PREFIX, STOREFRONT_SITE_CREATE_LIMIT, STOREFRONT_SLUG_CHANGE_LIMIT, STOREFRONT_SLUG_CHANGE_WINDOW_DAYS, STOREFRONT_SLUG_HOLD_DAYS, STOREFRONT_SLUG_PATTERN, STOREFRONT_SOURCE_BLOB_BATCH_MAX, STOREFRONT_SOURCE_PART_BYTES, STOREFRONT_WORKSPACE_MAX_BYTES, STOREFRONT_WORKSPACE_MAX_FILES, STORE_CODE_PATTERN, STORE_ROLE_SCOPES, STORE_SCOPE_RESOURCES, STORE_SESSION_KEYS, TOSS_WIDGET_CLIENT_KEY_PATTERN, TOSS_WIDGET_KEY_MESSAGE, TOSS_WIDGET_SECRET_KEY_PATTERN, UPLOAD_PURPOSE_LIMITS, VARIANT_COUNT_WARNING, VARIANT_STOCK_EXCLUSIVE_MESSAGE, WEBHOOK_DEFAULT_TOLERANCE_SEC, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_FAILURE_REASONS, WEBHOOK_HEADERS, WEBHOOK_PAYLOAD_EXCERPT_MAX_BYTES, WEBHOOK_RESOURCE_TYPES, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_USER_AGENT, addStorefrontDomainRequestSchema, addonGroupRequestSchema, addonGroupSchema, addonValueRequestSchema, addonValueSchema, addressChangeRequestListSchema, addressTypeSchema, agentPolicyDecisionSchema, allocateByWeight, analyticsChannelSchema, analyticsCheckoutOutcomeSchema, analyticsCheckoutSchema, analyticsDeviceRowSchema, analyticsDevicesSchema, analyticsFunnelStepSchema, analyticsOriginSchema, analyticsOverviewSchema, analyticsPagesQuerySchema, analyticsPagesSchema, analyticsProductRowSchema, analyticsProductSortSchema, analyticsProductsQuerySchema, analyticsProductsSchema, analyticsRangeQuerySchema, analyticsRealtimeSchema, analyticsSearchQuerySchema, analyticsSearchSchema, analyticsSourceGroupBySchema, analyticsSourceRowSchema, analyticsSourcesQuerySchema, analyticsSourcesSchema, analyticsTotalsSchema, apiLogErrorSchema, apiLogListQuerySchema, apiLogPageSchema, apiLogPrincipalSchema, apiLogPrincipalTypeSchema, apiLogSchema, apiLogStatusFilterSchema, apiLogSummarySchema, approvalDecisionRequestSchema, approvalListQuerySchema, approvalPageSchema, approvalRequestSchema, approvalStatusSchema, approveClaimResultSchema, auditActorSchema, auditActorTypeSchema, auditLogListQuerySchema, auditLogOutcomeSchema, auditLogPageSchema, auditLogSchema, auditLogSourceSchema, buildAuthorizeUrl, buildQuery, bulkResultSchema, businessInfoPatchShape, businessInfoResponseShape, businessNumberSchema, cancelBySellerRequestSchema, cancelBySellerResultSchema, carrierSchema, cashReceiptSchema, categoryAttributeSchema, categoryCreateRequestSchema, categoryDeleteQuerySchema, categoryDeleteStrategySchema, categoryListQuerySchema, categoryPatchRequestSchema, categoryProductSortSchema, categorySchema, categorySearchResultSchema, categoryTreeNodeSchema, categoryWithPathSchema, changeStorefrontSlugRequestSchema, changeStorefrontTemplateRequestSchema, changeTypeSchema, claimDetailSchema, claimHoldResultSchema, claimListQuerySchema, claimReasonSchema, claimReturnAddressSchema, claimSchema, claimStatusSchema, claimTypeSchema, claimWebhookEventDataSchema, claimWebhookEventSchema, collectionCreateRequestSchema, collectionListQuerySchema, collectionPageSchema, collectionPatchRequestSchema, collectionPreviewRequestSchema, collectionPreviewSchema, collectionProductListQuerySchema, collectionProductSchema, collectionProductSortRequestSchema, collectionProductsAddRequestSchema, collectionProductsReplaceRequestSchema, collectionRuleCategoryIds, collectionRuleSchema, collectionRuleViewSchema, collectionRulesPredicate, collectionRulesSchema, collectionSchema, collectionStateCountsSchema, collectionStateOf, collectionStateSchema, consentActionSchema, consentKindSchema, consentSourceSchema, couponBenefitSchema, couponConditionsInputSchema, couponConditionsSchema, couponDiscountOf, couponIssueListQuerySchema, couponIssueMethodSchema, couponIssueSchema, couponIssueStatusSchema, couponKindSchema, couponListQuerySchema, couponRedemptionListQuerySchema, couponRedemptionSchema, couponRejectReasonSchema, couponRuleSchema, couponSchema, couponStatsSchema, couponStatusSchema, couponTargetInputSchema, couponTargetSchema, createCouponRequestSchema, createPkcePair, createStoreClient, createStoreSession, createStorefrontEditPreviewLinkRequestSchema, createStorefrontPreviewLinkRequestSchema, createStorefrontSiteRequestSchema, createStorefrontVersionRequestSchema, customInputLabelForbiddenWord, customInputRequestSchema, customInputSchema, customInputValueSchema, customerAddressSchema, customerConsentListQuerySchema, customerConsentSchema, customerConsentStateSchema, customerConsentsSchema, customerCouponSchema, customerDelegationRequestSchema, customerDelegationSchema, customerDetailSchema, customerInquiryCategorySchema, customerInquiryListQuerySchema, customerListQuerySchema, customerOrderSchema, customerPointsSchema, customerSortSchema, customerStatsSchema, customerSummarySchema, customerWithdrawalBlockedDetailsSchema, deleteStorefrontFileRequestSchema, deliveryBundleKeyOf, deliveryFeeWaiverSchema, deliveryInfoSchema, deliveryMethodSchema, deliveryStatusSchema, deliveryTypeSchema, descendantCategoryIdsOf, disableStorefrontHostingRequestSchema, discountRequestSchema, discountSchema, dispatchRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, eventTypeSchema, exchangeAuthorizationCode, fulfillBulkRequestSchema, fulfillRequestSchema, fulfillmentRuleOf, fulfillmentTypeOf, fulfillmentTypeResponseSchema, fulfillmentTypeSchema, holdOrderItemRequestSchema, inquiryListQuerySchema, inquirySchema, inquiryWebhookEventDataSchema, inquiryWebhookEventSchema, invitationDeliveryStatusSchema, invitationListQuerySchema, invitationSchema, inviteMemberRequestSchema, isCouponTargetLine, isEditableStorefrontPath, isReservedStoreCode, isReservedStorefrontSlug, isShowcaseStorefrontSlug, isStoreScope, isWebOrigin, issueCouponRequestSchema, issueCouponResultSchema, liveGateConditionCodeSchema, liveGateConditionSchema, liveGateErrorDetailsSchema, liveGateSchema, loginProviderSchema, loginProviderStatusSchema, loginProviderTestSchema, loginSettingsSchema, maskedSecretSchema, matchesCollectionRules, mcpRuleResultSchema, mcpToolEventSchema, moveStorefrontFileRequestSchema, myAccountSchema, myStoreSchema, normalizeBusinessNumber, normalizeCouponCode, normalizeStorefrontHostname, normalizeStorefrontPath, oauthTokenResponseSchema, openFulfillmentUnion, optionGroupKindSchema, optionGroupRequestSchema, optionGroupSchema, optionModelRequestSchema, optionModelSchema, optionSelectionSchema, optionSortSchema, optionValueRequestSchema, optionValueSchema, orderCanceledWebhookEventDataSchema, orderCanceledWebhookEventSchema, orderDiscountSchema, orderFulfilledWebhookEventDataSchema, orderFulfilledWebhookEventSchema, orderItemFulfillmentSchema, orderItemFulfillmentSnapshotResponseSchema, orderItemFulfillmentSnapshotSchema, orderItemListQuerySchema, orderItemMemoResultSchema, orderItemPageSchema, orderItemSchema, orderItemStatusSchema, orderListQuerySchema, orderSchema, orderSummaryPageSchema, orderSummarySchema, orderWebhookEventDataSchema, orderWebhookEventSchema, pageInfoSchema, pageQueryShape, pageSchema, paymentAttemptRecordSchema, paymentAttemptStatusSchema, paymentCredentialSetSchema, paymentFailureWarningSchema, paymentListQuerySchema, paymentProviderSchema, paymentProviderVerificationSchema, paymentRecordDetailSchema, paymentRecordPageSchema, paymentRecordSchema, paymentRecordStatusSchema, paymentRefundRecordSchema, paymentSettingsSchema, pgEnvironmentSchema, pgPaymentMethodSchema, pgProviderSchema, pgVerificationResultSchema, planCodeSchema, planEntitlementsSchema, planErrorDetailsSchema, pointAdjustmentRequestSchema, pointAdjustmentResultSchema, pointEarnOf, pointEarnRateBpSchema, pointEarningEnabled, pointEntrySchema, pointExpiresAtOf, pointHistoryQuerySchema, pointLotSchema, pointPolicyNoticeSchema, pointPolicySchema, policyDocumentUrlSchema, policyVersionSchema, portOneChannelSchema, portOneCredentialsInputSchema, productCreateRequestSchema, productFulfillmentCreateSchema, productFulfillmentResponseSchema, productFulfillmentSchema, productFulfillmentUpdateSchema, productImageRejection, productImageUrlSchema, productListQuerySchema, productOutOfStockWebhookEventDataSchema, productOutOfStockWebhookEventSchema, productPatchRequestSchema, productRefundPolicyOverride, productRefundPolicyPatchSchema, productReplaceRequestSchema, productSchema, productSortSchema, productStatusSchema, productSummarySchema, productVariantRequestSchema, productVariantSchema, proratedPaidRefundBase, proratedRefundBase, publicPlanSchema, publicPlansSchema, publishStorefrontVersionRequestSchema, purchaseDecisionExtendResultSchema, purchaseDecisionRequestResultSchema, purchaseEarnPolicySchema, purchaseEarnRateOf, quoteDelivery, quotePricing, refreshUserToken, refundPolicyPatchSchema, refundPolicySchema, rejectClaimRequestSchema, remoteAreaLabelOf, remoteAreaOf, remoteAreaSchema, remoteSurchargeOf, replaceStorefrontSourceRequestSchema, requiresCollection, requiresShipping, resolvePointPolicy, resolveRefundPolicy, resolveShippingPolicy, responsePlanCodeSchema, responsePointEntryTypeSchema, reviewListQuerySchema, reviewReportResultSchema, reviewRewardPointOf, reviewRewardPolicySchema, reviewSchema, reviewSortSchema, reviewWebhookEventDataSchema, reviewWebhookEventSchema, rollbackStorefrontRequestSchema, runStorefrontCheckRequestSchema, salesReportGroupBySchema, salesReportQuerySchema, salesReportRowSchema, salesReportSchema, salesTotalsSchema, saveLoginProviderRequestSchema, savedCustomInputRequestSchema, savedCustomInputSchema, savedOptionGroupRequestSchema, savedOptionGroupSchema, savedOptionSetCompositionSchema, savedOptionSetFromProductRequestSchema, savedOptionSetFromProductResultSchema, savedOptionSetListQuerySchema, savedOptionSetRequestSchema, savedOptionSetSchema, savedOptionSetSortSchema, savedOptionValueRequestSchema, savedOptionValueSchema, scopeAccessSchema, searchStorefrontFilesRequestSchema, sellerAddressListQuerySchema, sellerAddressRequestSchema, sellerAddressSchema, sellerCustomerInquirySchema, setStorefrontVisibilityRequestSchema, settleCouponShortfall, settlementDetailQuerySchema, settlementDetailSchema, settlementListQuerySchema, settlementStatusSchema, settlementSummarySchema, settlementWithDetailsSchema, shippingAddressSchema, shippingPolicyPatchSchema, shippingPolicySchema, storeCodeSchema, storeMemberRoleUpdatedSchema, storeMemberSchema, storePointPolicySchema, storeRoleSchema, storeSchema, storeScopeResourceSchema, storeSubscriptionSchema, storefrontBuildDependenciesSchema, storefrontBuildListQuerySchema, storefrontBuildSchema, storefrontBuildStatusSchema, storefrontCheckSchema, storefrontCheckStatusSchema, storefrontCustomDomainStatusSchema, storefrontCustomHostnameProblem, storefrontDependencyFindingSchema, storefrontDeploymentLogSchema, storefrontDeploymentSchema, storefrontDeploymentStepSchema, storefrontDnsRecordSchema, storefrontDomainSchema, storefrontDomainTxtNameOf, storefrontEditPreviewLabelOf, storefrontEditPreviewSchema, storefrontEditSessionSchema, storefrontEditSessionStatusSchema, storefrontEditingSchema, storefrontFileConflictDetailsSchema, storefrontFileContentQuerySchema, storefrontFileContentSchema, storefrontFileDeleteResultSchema, storefrontFileEncodingSchema, storefrontFileEntrySchema, storefrontFileHashSchema, storefrontFileListQuerySchema, storefrontFileListSchema, storefrontFileMoveResultSchema, storefrontFilePathSchema, storefrontFileSearchResultSchema, storefrontFileWriteResultSchema, storefrontHostingSchema, storefrontPreviewLinkSchema, storefrontProvisioningSchema, storefrontRuleResultSchema, storefrontRuleSeveritySchema, storefrontSiteDomainSchema, storefrontSiteDomainsSchema, storefrontSiteSchema, storefrontSiteStatusSchema, storefrontSlugAvailabilityQuerySchema, storefrontSlugAvailabilitySchema, storefrontSlugSchema, storefrontSourceArchivePartSchema, storefrontSourceArchiveQuerySchema, storefrontSourceBlobsResultSchema, storefrontSourceModeSchema, storefrontSourceRefSchema, storefrontSourceReplacedSchema, storefrontSourceSchema, storefrontSuspensionSchema, storefrontTemplateSchema, storefrontVerifyReportSchema, storefrontVersionCreatedSchema, storefrontVersionSchema, storefrontVersionStatusSchema, storefrontVisibilitySchema, subscriptionLimitsSchema, subscriptionStatusSchema, subscriptionUsageSchema, tossPaymentsCredentialsInputSchema, trackingStageResponseSchema, trackingUpdateResultSchema, updateCouponRequestSchema, updateLoginProviderRequestSchema, updateLoginSettingsRequestSchema, updateMemberRoleRequestSchema, updatePaymentProviderRequestSchema, updatePaymentSettingsRequestSchema, updatePointPolicyRequestSchema, updateStoreRequestSchema, uploadExtensionOf, uploadPurposeSchema, uploadRejection, uploadRequestSchema, uploadStorefrontSourceBlobsRequestSchema, uploadTicketSchema, upsertPortOneProviderRequestSchema, upsertTossPaymentsProviderRequestSchema, variantStockRequestSchema, variantStockSchema, verifyPaymentProviderRequestSchema, webhookCreatedSchema, webhookDeliveryDetailSchema, webhookDeliveryErrorCodeSchema, webhookDeliveryListQuerySchema, webhookDeliveryResourceSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEventSchema, webhookFailureReasonSchema, webhookRedeliverFailedResultSchema, webhookRequestHeaderSchema, webhookRequestSchema, webhookResourceTypeSchema, webhookSchema, webhookSecretRotatedSchema, webhookStatusSchema, webhookTestRequestSchema, webhookTestResultSchema, withdrawCustomerRequestSchema, writeDryRunResultSchema, writePreviewSchema, writeStorefrontFilesRequestSchema };
|
|
7433
|
+
export { APPROVAL_ALREADY_DECIDED_CODE, APPROVAL_REQUIRED_CODE, ApiError, ApprovalPendingError, BUSINESS_INFO_MAX_LENGTH, BUSINESS_NUMBER_PATTERN, CASH_RECEIPT_STATUS_VALUES, COLLECTION_BEST_SELLING_DAYS, COLLECTION_PREVIEW_SIZE, COLLECTION_PRODUCT_SORTS, COLLECTION_SALES_SORT_DEFAULT_DAYS, COLLECTION_SLUG_PATTERN, COLLECTION_TYPES, COUPON_CODE_PATTERN, COUPON_CONDITIONS_DEFAULTS, COUPON_TARGET_ALL, COUPON_TARGET_LIST_MAX, CUSTOM_INPUT_FORBIDDEN_WORDS, FULFILLMENT_RULES, MAX_ADDON_GROUPS, MAX_ANALYTICS_ALLOWED_ORIGINS, MAX_AUTO_TRANSITION_DAYS, MAX_COLLECTIONS, MAX_COLLECTION_BEST_SELLING_TOP, MAX_COLLECTION_CREATED_WITHIN_DAYS, MAX_COLLECTION_DESCRIPTION, MAX_COLLECTION_PRODUCTS, MAX_COLLECTION_PRODUCTS_PER_ADD, MAX_COLLECTION_RULES, MAX_COLLECTION_RULE_CATEGORIES, MAX_COLLECTION_TITLE, MAX_CUSTOM_INPUTS, MAX_CUSTOM_INPUT_LENGTH, MAX_OPTION_GROUPS, MAX_PRODUCT_IMAGES, MAX_SAVED_OPTION_SETS, MAX_SAVED_OPTION_SET_NAME, MAX_VALUES_PER_GROUP, MAX_VARIANTS, MCP_TELEMETRY_MAX_RESULTS, MIN_PAYMENT_AMOUNT, NO_COUPON_SETTLEMENT, NO_SHIPPING_BUNDLE_KEY, PAYMENT_ROUTING_EXCLUSION_CODES, POINT_ADJUSTMENT_MAX, POINT_EARN_RATE_BP_MAX, POINT_ENTRY_TYPES, POINT_EXPIRY_DAYS_MAX, POINT_EXPIRY_DAYS_MIN, POINT_LOT_SOURCES, POINT_POLICY_DEFAULTS, POINT_REVIEW_REWARD_MAX, POINT_USE_UNITS, PORTONE_CHANNEL_NAME_MAX_LENGTH, PORTONE_MAX_CHANNELS, PORTONE_MIN_CHANNELS, REFUND_POLICY_DEFAULTS, REFUND_POLICY_DELIVERY_FEE_KEYS, REMOTE_AREA_ZIP_RANGES, RESERVED_STOREFRONT_SLUGS, RESERVED_STORE_CODES, SHIPPING_POLICY_DEFAULTS, STOREFRONT_BLOCKED_PATH_SEGMENTS, STOREFRONT_BUILD_STAGES, STOREFRONT_BUILD_TERMINAL_STATUSES, STOREFRONT_CHECK_TERMINAL_STATUSES, STOREFRONT_CUSTOM_DOMAIN_LIMIT_DEFAULT, STOREFRONT_DOMAIN_DNS_GRACE_DAYS, STOREFRONT_DOMAIN_DNS_WAIT_DAYS, STOREFRONT_DOMAIN_TXT_LABEL, STOREFRONT_EDIT_ACTIVITY_TIMEOUT_MINUTES, STOREFRONT_EDIT_CAPACITY, STOREFRONT_EDIT_IDLE_MINUTES, STOREFRONT_EDIT_PREVIEW_SUFFIX, STOREFRONT_EDIT_START_STAGES, STOREFRONT_FILE_BATCH_MAX, STOREFRONT_FILE_MAX_BYTES, STOREFRONT_PATH_SEGMENT_PATTERN, STOREFRONT_PLATFORM_DOMAINS, STOREFRONT_PUBLIC_SUFFIXES, STOREFRONT_SEARCH_REGEX_MAX_LENGTH, STOREFRONT_SHOWCASE_SLUG_PREFIX, STOREFRONT_SITE_CREATE_LIMIT, STOREFRONT_SLUG_CHANGE_LIMIT, STOREFRONT_SLUG_CHANGE_WINDOW_DAYS, STOREFRONT_SLUG_HOLD_DAYS, STOREFRONT_SLUG_PATTERN, STOREFRONT_SOURCE_BLOB_BATCH_MAX, STOREFRONT_SOURCE_PART_BYTES, STOREFRONT_WORKSPACE_MAX_BYTES, STOREFRONT_WORKSPACE_MAX_FILES, STORE_CODE_PATTERN, STORE_ROLE_SCOPES, STORE_SCOPE_RESOURCES, STORE_SESSION_KEYS, TOSS_WIDGET_CLIENT_KEY_PATTERN, TOSS_WIDGET_KEY_MESSAGE, TOSS_WIDGET_SECRET_KEY_PATTERN, UPLOAD_PURPOSE_LIMITS, VARIANT_COUNT_WARNING, VARIANT_STOCK_EXCLUSIVE_MESSAGE, WEBHOOK_DEFAULT_TOLERANCE_SEC, WEBHOOK_DELIVERY_ID_HEADER, WEBHOOK_EVENT_ID_HEADER, WEBHOOK_EVENT_TYPE_HEADER, WEBHOOK_FAILURE_REASONS, WEBHOOK_HEADERS, WEBHOOK_PAYLOAD_EXCERPT_MAX_BYTES, WEBHOOK_RESOURCE_TYPES, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_USER_AGENT, addStorefrontDomainRequestSchema, addonGroupRequestSchema, addonGroupSchema, addonValueRequestSchema, addonValueSchema, addressChangeRequestListSchema, addressTypeSchema, agentPolicyDecisionSchema, allocateByWeight, analyticsChannelSchema, analyticsCheckoutOutcomeSchema, analyticsCheckoutSchema, analyticsDeviceRowSchema, analyticsDevicesSchema, analyticsFunnelStepSchema, analyticsOriginSchema, analyticsOverviewSchema, analyticsPagesQuerySchema, analyticsPagesSchema, analyticsProductRowSchema, analyticsProductSortSchema, analyticsProductsQuerySchema, analyticsProductsSchema, analyticsRangeQuerySchema, analyticsRealtimeSchema, analyticsSearchQuerySchema, analyticsSearchSchema, analyticsSourceGroupBySchema, analyticsSourceRowSchema, analyticsSourcesQuerySchema, analyticsSourcesSchema, analyticsTotalsSchema, apiLogErrorSchema, apiLogListQuerySchema, apiLogPageSchema, apiLogPrincipalSchema, apiLogPrincipalTypeSchema, apiLogSchema, apiLogStatusFilterSchema, apiLogSummarySchema, approvalDecisionRequestSchema, approvalListQuerySchema, approvalPageSchema, approvalRequestSchema, approvalStatusSchema, approveClaimResultSchema, auditActorSchema, auditActorTypeSchema, auditLogListQuerySchema, auditLogOutcomeSchema, auditLogPageSchema, auditLogSchema, auditLogSourceSchema, bestSellingRuleOf, buildAuthorizeUrl, buildQuery, bulkResultSchema, businessInfoPatchShape, businessInfoResponseShape, businessNumberSchema, cancelBySellerRequestSchema, cancelBySellerResultSchema, carrierSchema, cashReceiptSchema, categoryAttributeSchema, categoryCreateRequestSchema, categoryDeleteQuerySchema, categoryDeleteStrategySchema, categoryListQuerySchema, categoryPatchRequestSchema, categoryProductSortSchema, categorySchema, categorySearchResultSchema, categoryTreeNodeSchema, categoryWithPathSchema, changeStorefrontSlugRequestSchema, changeStorefrontTemplateRequestSchema, changeTypeSchema, claimDetailSchema, claimHoldResultSchema, claimListQuerySchema, claimReasonSchema, claimReturnAddressSchema, claimSchema, claimStatusSchema, claimTypeSchema, claimWebhookEventDataSchema, claimWebhookEventSchema, collectionCreateRequestSchema, collectionListQuerySchema, collectionPageSchema, collectionPatchRequestSchema, collectionPreviewRequestSchema, collectionPreviewSchema, collectionProductListQuerySchema, collectionProductSchema, collectionProductSortRequestSchema, collectionProductsAddRequestSchema, collectionProductsReplaceRequestSchema, collectionRuleCategoryIds, collectionRuleSchema, collectionRuleViewSchema, collectionRulesPredicate, collectionRulesSchema, collectionSchema, collectionStateCountsSchema, collectionStateOf, collectionStateSchema, compareBySales, consentActionSchema, consentKindSchema, consentSourceSchema, couponBenefitSchema, couponConditionsInputSchema, couponConditionsSchema, couponDiscountOf, couponIssueListQuerySchema, couponIssueMethodSchema, couponIssueSchema, couponIssueStatusSchema, couponKindSchema, couponListQuerySchema, couponRedemptionListQuerySchema, couponRedemptionSchema, couponRejectReasonSchema, couponRuleSchema, couponSchema, couponStatsSchema, couponStatusSchema, couponTargetInputSchema, couponTargetSchema, createCouponRequestSchema, createPkcePair, createStoreClient, createStoreSession, createStorefrontEditPreviewLinkRequestSchema, createStorefrontPreviewLinkRequestSchema, createStorefrontSiteRequestSchema, createStorefrontVersionRequestSchema, customInputLabelForbiddenWord, customInputRequestSchema, customInputSchema, customInputValueSchema, customerAddressSchema, customerConsentListQuerySchema, customerConsentSchema, customerConsentStateSchema, customerConsentsSchema, customerCouponSchema, customerDelegationRequestSchema, customerDelegationSchema, customerDetailSchema, customerInquiryCategorySchema, customerInquiryListQuerySchema, customerListQuerySchema, customerOrderSchema, customerPointsSchema, customerSortSchema, customerStatsSchema, customerSummarySchema, customerWithdrawalBlockedDetailsSchema, deleteStorefrontFileRequestSchema, deliveryBundleKeyOf, deliveryFeeWaiverSchema, deliveryInfoSchema, deliveryMethodSchema, deliveryStatusSchema, deliveryTypeSchema, descendantCategoryIdsOf, disableStorefrontHostingRequestSchema, discountRequestSchema, discountSchema, dispatchRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, eventTypeSchema, exchangeAuthorizationCode, fulfillBulkRequestSchema, fulfillRequestSchema, fulfillmentRuleOf, fulfillmentTypeOf, fulfillmentTypeResponseSchema, fulfillmentTypeSchema, holdOrderItemRequestSchema, inquiryListQuerySchema, inquirySchema, inquiryWebhookEventDataSchema, inquiryWebhookEventSchema, invitationDeliveryStatusSchema, invitationListQuerySchema, invitationSchema, inviteMemberRequestSchema, isCouponTargetLine, isEditableStorefrontPath, isReservedStoreCode, isReservedStorefrontSlug, isShowcaseStorefrontSlug, isStoreScope, isWebOrigin, issueCouponRequestSchema, issueCouponResultSchema, liveGateConditionCodeSchema, liveGateConditionSchema, liveGateErrorDetailsSchema, liveGateSchema, loginProviderSchema, loginProviderStatusSchema, loginProviderTestSchema, loginSettingsSchema, maskedSecretSchema, matchesCollectionRules, mcpRuleResultSchema, mcpToolEventSchema, moveStorefrontFileRequestSchema, myAccountSchema, myStoreSchema, normalizeBusinessNumber, normalizeCouponCode, normalizeStorefrontHostname, normalizeStorefrontPath, oauthTokenResponseSchema, openFulfillmentUnion, optionGroupKindSchema, optionGroupRequestSchema, optionGroupSchema, optionModelRequestSchema, optionModelSchema, optionSelectionSchema, optionSortSchema, optionValueRequestSchema, optionValueSchema, orderCanceledWebhookEventDataSchema, orderCanceledWebhookEventSchema, orderDiscountSchema, orderFulfilledWebhookEventDataSchema, orderFulfilledWebhookEventSchema, orderItemFulfillmentSchema, orderItemFulfillmentSnapshotResponseSchema, orderItemFulfillmentSnapshotSchema, orderItemListQuerySchema, orderItemMemoResultSchema, orderItemPageSchema, orderItemSchema, orderItemStatusSchema, orderListQuerySchema, orderSchema, orderSummaryPageSchema, orderSummarySchema, orderWebhookEventDataSchema, orderWebhookEventSchema, pageInfoSchema, pageQueryShape, pageSchema, paymentAttemptRecordSchema, paymentAttemptStatusSchema, paymentCredentialSetSchema, paymentFailureWarningSchema, paymentListQuerySchema, paymentProviderSchema, paymentProviderVerificationSchema, paymentRecordDetailSchema, paymentRecordPageSchema, paymentRecordSchema, paymentRecordStatusSchema, paymentRefundRecordSchema, paymentSettingsSchema, pgEnvironmentSchema, pgPaymentMethodSchema, pgProviderSchema, pgVerificationResultSchema, planCodeSchema, planEntitlementsSchema, planErrorDetailsSchema, pointAdjustmentRequestSchema, pointAdjustmentResultSchema, pointEarnOf, pointEarnRateBpSchema, pointEarningEnabled, pointEntrySchema, pointExpiresAtOf, pointHistoryQuerySchema, pointLotSchema, pointPolicyNoticeSchema, pointPolicySchema, pointRestoreExpiresAtOf, pointUseOf, pointUsePolicySchema, policyDocumentUrlSchema, policyVersionSchema, portOneChannelSchema, portOneCredentialsInputSchema, productCreateRequestSchema, productFulfillmentCreateSchema, productFulfillmentResponseSchema, productFulfillmentSchema, productFulfillmentUpdateSchema, productImageRejection, productImageUrlSchema, productListQuerySchema, productOutOfStockWebhookEventDataSchema, productOutOfStockWebhookEventSchema, productPatchRequestSchema, productRefundPolicyOverride, productRefundPolicyPatchSchema, productReplaceRequestSchema, productSchema, productSortSchema, productStatusSchema, productSummarySchema, productVariantRequestSchema, productVariantSchema, proratedPaidRefundBase, proratedPointRefund, proratedRefundBase, publicPlanSchema, publicPlansSchema, publishStorefrontVersionRequestSchema, purchaseDecisionExtendResultSchema, purchaseDecisionRequestResultSchema, purchaseEarnPolicySchema, purchaseEarnRateOf, quoteDelivery, quotePricing, rankBestSelling, refreshUserToken, refundPolicyPatchSchema, refundPolicySchema, rejectClaimRequestSchema, remoteAreaLabelOf, remoteAreaOf, remoteAreaSchema, remoteSurchargeOf, replaceStorefrontSourceRequestSchema, requiresCollection, requiresShipping, resolvePointPolicy, resolveRefundPolicy, resolveShippingPolicy, responsePlanCodeSchema, responsePointEntryTypeSchema, reviewListQuerySchema, reviewReportResultSchema, reviewRewardPointOf, reviewRewardPolicySchema, reviewSchema, reviewSortSchema, reviewWebhookEventDataSchema, reviewWebhookEventSchema, rollbackStorefrontRequestSchema, runStorefrontCheckRequestSchema, salesReportGroupBySchema, salesReportQuerySchema, salesReportRowSchema, salesReportSchema, salesTotalsSchema, saveLoginProviderRequestSchema, savedCustomInputRequestSchema, savedCustomInputSchema, savedOptionGroupRequestSchema, savedOptionGroupSchema, savedOptionSetCompositionSchema, savedOptionSetFromProductRequestSchema, savedOptionSetFromProductResultSchema, savedOptionSetListQuerySchema, savedOptionSetRequestSchema, savedOptionSetSchema, savedOptionSetSortSchema, savedOptionValueRequestSchema, savedOptionValueSchema, scopeAccessSchema, searchStorefrontFilesRequestSchema, sellerAddressListQuerySchema, sellerAddressRequestSchema, sellerAddressSchema, sellerCustomerInquirySchema, setStorefrontVisibilityRequestSchema, settleCouponShortfall, settlementDetailQuerySchema, settlementDetailSchema, settlementListQuerySchema, settlementStatusSchema, settlementSummarySchema, settlementWithDetailsSchema, shippingAddressSchema, shippingPolicyPatchSchema, shippingPolicySchema, splitRefund, storeCodeSchema, storeMemberRoleUpdatedSchema, storeMemberSchema, storePointPolicySchema, storeRoleSchema, storeSchema, storeScopeResourceSchema, storeSubscriptionSchema, storefrontBuildDependenciesSchema, storefrontBuildListQuerySchema, storefrontBuildSchema, storefrontBuildStatusSchema, storefrontCheckSchema, storefrontCheckStatusSchema, storefrontCustomDomainStatusSchema, storefrontCustomHostnameProblem, storefrontDependencyFindingSchema, storefrontDeploymentLogSchema, storefrontDeploymentSchema, storefrontDeploymentStepSchema, storefrontDnsRecordSchema, storefrontDomainSchema, storefrontDomainTxtNameOf, storefrontEditPreviewLabelOf, storefrontEditPreviewSchema, storefrontEditSessionSchema, storefrontEditSessionStatusSchema, storefrontEditingSchema, storefrontFileConflictDetailsSchema, storefrontFileContentQuerySchema, storefrontFileContentSchema, storefrontFileDeleteResultSchema, storefrontFileEncodingSchema, storefrontFileEntrySchema, storefrontFileHashSchema, storefrontFileListQuerySchema, storefrontFileListSchema, storefrontFileMoveResultSchema, storefrontFilePathSchema, storefrontFileSearchResultSchema, storefrontFileWriteResultSchema, storefrontHostingSchema, storefrontPreviewLinkSchema, storefrontProvisioningSchema, storefrontRuleResultSchema, storefrontRuleSeveritySchema, storefrontSiteDomainSchema, storefrontSiteDomainsSchema, storefrontSiteSchema, storefrontSiteStatusSchema, storefrontSlugAvailabilityQuerySchema, storefrontSlugAvailabilitySchema, storefrontSlugSchema, storefrontSourceArchivePartSchema, storefrontSourceArchiveQuerySchema, storefrontSourceBlobsResultSchema, storefrontSourceModeSchema, storefrontSourceRefSchema, storefrontSourceReplacedSchema, storefrontSourceSchema, storefrontSuspensionSchema, storefrontTemplateSchema, storefrontVerifyReportSchema, storefrontVersionCreatedSchema, storefrontVersionSchema, storefrontVersionStatusSchema, storefrontVisibilitySchema, subscriptionLimitsSchema, subscriptionStatusSchema, subscriptionUsageSchema, tossPaymentsCredentialsInputSchema, trackingStageResponseSchema, trackingUpdateResultSchema, updateCouponRequestSchema, updateLoginProviderRequestSchema, updateLoginSettingsRequestSchema, updateMemberRoleRequestSchema, updatePaymentProviderRequestSchema, updatePaymentSettingsRequestSchema, updatePointPolicyRequestSchema, updateStoreRequestSchema, uploadExtensionOf, uploadPurposeSchema, uploadRejection, uploadRequestSchema, uploadStorefrontSourceBlobsRequestSchema, uploadTicketSchema, upsertPortOneProviderRequestSchema, upsertTossPaymentsProviderRequestSchema, variantStockRequestSchema, variantStockSchema, verifyPaymentProviderRequestSchema, webhookCreatedSchema, webhookDeliveryDetailSchema, webhookDeliveryErrorCodeSchema, webhookDeliveryListQuerySchema, webhookDeliveryResourceSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEventSchema, webhookFailureReasonSchema, webhookRedeliverFailedResultSchema, webhookRequestHeaderSchema, webhookRequestSchema, webhookResourceTypeSchema, webhookSchema, webhookSecretRotatedSchema, webhookStatusSchema, webhookTestRequestSchema, webhookTestResultSchema, withdrawCustomerRequestSchema, writeDryRunResultSchema, writePreviewSchema, writeStorefrontFilesRequestSchema };
|
package/package.json
CHANGED
package/src/schemas/claim.ts
CHANGED
|
@@ -77,6 +77,15 @@ export const claimSchema = z.object({
|
|
|
77
77
|
"접수 시점에 계산한 예상 배송비 환불액. 배송 묶음(같은 상품의 주문상품)이 모두 취소되거나 " +
|
|
78
78
|
"판매자 귀책일 때만 0보다 크다. 이 필드가 생기기 전에 접수된 클레임은 null이다",
|
|
79
79
|
),
|
|
80
|
+
expectedPointRefundAmount: z
|
|
81
|
+
.number()
|
|
82
|
+
.int()
|
|
83
|
+
.optional()
|
|
84
|
+
.default(0)
|
|
85
|
+
.describe(
|
|
86
|
+
"예상 반환 적립금 (원, #93) — 결제에 쓴 적립금 중 이 수량의 몫이다. 예상 환불액(현금)과 별개이고, 차감은 현금에서 먼저 뺀다. " +
|
|
87
|
+
"교환·적립금을 쓰지 않은 주문은 0이다. 서버는 항상 싣는다",
|
|
88
|
+
),
|
|
80
89
|
exchangeOption: z.object({ optionId: z.string(), optionName: z.string() }).nullable(),
|
|
81
90
|
collect: z
|
|
82
91
|
.object({
|
|
@@ -201,6 +210,15 @@ export const approveClaimResultSchema = z.object({
|
|
|
201
210
|
.optional()
|
|
202
211
|
.default(0)
|
|
203
212
|
.describe("환불액에 더한, 앞선 환불에서 뺀 쿠폰 차감을 되돌린 몫. 서버는 항상 싣는다"),
|
|
213
|
+
pointRefundAmount: z
|
|
214
|
+
.number()
|
|
215
|
+
.int()
|
|
216
|
+
.optional()
|
|
217
|
+
.default(0)
|
|
218
|
+
.describe(
|
|
219
|
+
"돌려준 적립금 (원, #93) — 결제에 쓴 적립금 중 이번 취소·반품 수량의 몫이다. 현금 환불(`refundAmount`)과 별개다. " +
|
|
220
|
+
"차감은 현금에서 먼저 빼고 모자란 몫만 여기서 뺀다. 적립금을 쓰지 않은 주문과 이 필드가 없는 이전 응답·이벤트는 0으로 읽는다",
|
|
221
|
+
),
|
|
204
222
|
refundedAt: z.string(),
|
|
205
223
|
});
|
|
206
224
|
|