@sayren/storefront-sdk 0.11.0 → 0.11.1
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/auth/index.mjs +2 -2
- package/dist/{checkout-CHpxo2Ap.mjs → checkout-BeZKjYJz.mjs} +10 -10
- package/dist/{client-CHfCafer.mjs → client-Do4cw2Ez.mjs} +3 -3
- package/dist/index.mjs +2 -2
- package/dist/payments/index.mjs +8 -8
- package/package.json +1 -1
- package/src/auth/index.ts +1 -1
- package/src/payments/index.ts +7 -7
- package/src/schemas/checkout.ts +13 -13
- package/src/schemas/order.ts +1 -1
- package/src/schemas/review.ts +1 -1
package/dist/auth/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { pt as ApiError, t as createStorefrontClient } from "../client-
|
|
1
|
+
import { pt as ApiError, t as createStorefrontClient } from "../client-Do4cw2Ez.mjs";
|
|
2
2
|
//#region src/auth/index.ts
|
|
3
3
|
/** 소셜 로그인 실패 — 구매자가 취소했거나(`access_denied`) state가 맞지 않는다 */
|
|
4
4
|
var IdpCallbackError = class extends Error {
|
|
5
5
|
reason;
|
|
6
6
|
constructor(reason) {
|
|
7
|
-
super(`소셜 로그인을 마치지
|
|
7
|
+
super(`소셜 로그인을 마치지 못했습니다 (${reason})`);
|
|
8
8
|
this.reason = reason;
|
|
9
9
|
this.name = "IdpCallbackError";
|
|
10
10
|
}
|
|
@@ -53,14 +53,14 @@ const checkoutSessionSchema = z.object({
|
|
|
53
53
|
delivery: checkoutDeliverySchema.describe("배송비 내역. 배송지를 입력하면 금액이 바뀔 수 있다 — 최종 금액은 결제 시작 응답의 `amounts`다"),
|
|
54
54
|
expiresAt: z.string(),
|
|
55
55
|
paymentOptions: z.lazy(() => paymentOptionListSchema).describe("이 주문서에서 고를 수 있는 결제 옵션, PG 우선순위순. 셀러가 켠 PG·결제수단·간편결제만 담긴다. 비어 있으면 지금 결제할 수 없다"),
|
|
56
|
-
testPayment: z.boolean().describe("지금 결제하면 테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지
|
|
56
|
+
testPayment: z.boolean().describe("지금 결제하면 테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지 않습니다 — 주문서에 테스트 결제 안내를 표시합니다. 결제 요청 시점에 스토어 결제 설정으로 다시 정해지니 최종 값은 결제 요청 응답의 `testPayment`입니다")
|
|
57
57
|
});
|
|
58
58
|
/**
|
|
59
59
|
* 배송비 미리보기 요청 — 배송지 우편번호로 배송비를 다시 계산한다. 주문서를 바꾸지 않는다(읽기 계산이다).
|
|
60
60
|
*
|
|
61
61
|
* 구매자가 배송지를 입력하거나 고칠 때 부르면 제주·도서산간 추가 배송비가 반영된 금액을 미리 보여 줄 수 있다.
|
|
62
62
|
*/
|
|
63
|
-
const deliveryQuoteRequestSchema = z.object({ zipCode: z.string().regex(/^[0-9]{5}$/, "우편번호 5자리를 입력해
|
|
63
|
+
const deliveryQuoteRequestSchema = z.object({ zipCode: z.string().regex(/^[0-9]{5}$/, "우편번호 5자리를 입력해 주십시오").describe("배송지 우편번호 5자리") });
|
|
64
64
|
/** 배송비 미리보기 응답 — 이 배송지로 결제하면 나갈 금액이다 */
|
|
65
65
|
const deliveryQuoteSchema = z.object({
|
|
66
66
|
amounts: checkoutSessionSchema.shape.amounts.describe("이 배송지 기준 금액"),
|
|
@@ -134,10 +134,10 @@ function paymentOptionKey(option) {
|
|
|
134
134
|
}
|
|
135
135
|
const shippingAddressInputSchema = z.object({
|
|
136
136
|
addressId: z.string().optional(),
|
|
137
|
-
receiverName: z.string().min(1, "수령인명을
|
|
137
|
+
receiverName: z.string().min(1, "수령인명을 입력해주십시오").max(50),
|
|
138
138
|
phone: z.string().regex(/^01[0-9]{8,9}$/, "연락처 형식이 아닙니다 (예: 01012345678)"),
|
|
139
139
|
zipCode: z.string().regex(/^[0-9]{5}$/, "우편번호는 5자리 숫자입니다"),
|
|
140
|
-
address1: z.string().min(1, "기본 주소를
|
|
140
|
+
address1: z.string().min(1, "기본 주소를 입력해주십시오"),
|
|
141
141
|
address2: z.string().optional(),
|
|
142
142
|
deliveryMemo: z.string().max(100).optional(),
|
|
143
143
|
entranceCode: z.string().max(20).optional()
|
|
@@ -213,14 +213,14 @@ const cashReceiptRequestSchema = z.object({
|
|
|
213
213
|
ctx.addIssue({
|
|
214
214
|
code: "custom",
|
|
215
215
|
path: ["identityNumber"],
|
|
216
|
-
message: "주민등록번호는 현금영수증 식별 번호로 쓸 수
|
|
216
|
+
message: "주민등록번호는 현금영수증 식별 번호로 쓸 수 없습니다. 휴대폰 번호 또는 현금영수증카드 번호를 입력해주십시오 (RESIDENT_NUMBER_NOT_ALLOWED)"
|
|
217
217
|
});
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
220
|
if (!cashReceiptIdentityTypeOf(value.type, value.identityNumber)) ctx.addIssue({
|
|
221
221
|
code: "custom",
|
|
222
222
|
path: ["identityNumber"],
|
|
223
|
-
message: value.type === "INCOME_DEDUCTION" ? "휴대폰 번호 또는 현금영수증카드 번호를
|
|
223
|
+
message: value.type === "INCOME_DEDUCTION" ? "휴대폰 번호 또는 현금영수증카드 번호를 입력해주십시오" : "사업자등록번호(10자리) 또는 현금영수증카드 번호를 입력해주십시오"
|
|
224
224
|
});
|
|
225
225
|
});
|
|
226
226
|
const cashReceiptField = cashReceiptRequestSchema.optional().describe("현금영수증 신청. 계좌이체·가상계좌 옵션에서만 보낼 수 있다(그 밖의 옵션이면 400 `CASH_RECEIPT_NOT_AVAILABLE`). 결제가 승인되면 발급한다");
|
|
@@ -284,16 +284,16 @@ const PAYMENT_RESULT_VALUES = [
|
|
|
284
284
|
];
|
|
285
285
|
const paymentStatusSchema = z.object({
|
|
286
286
|
paymentId: z.string(),
|
|
287
|
-
status: z.string().describe("결제 상태. 현재 값은 `pending` 결제 대기 · `processing` 승인 확인 중 · `completed` 결제 완료(주문 생성) · `failed` 실패 · `expired`
|
|
288
|
-
result: z.string().describe("화면 분기용 결과. `COMPLETED` 결제 완료 · `PROCESSING` 결과 확인 중 · `CANCELED` 구매자가 결제창을 닫음 · `FAILED` 결제 실패(다른 결제 옵션으로 재시도 가능) · `EXPIRED` 결제 요청 만료 · `PENDING` 결제
|
|
287
|
+
status: z.string().describe("결제 상태. 현재 값은 `pending` 결제 대기 · `processing` 승인 확인 중 · `completed` 결제 완료(주문 생성) · `failed` 실패 · `expired` 만료입니다. 상태가 추가될 수 있어 문자열로 받습니다 — 모르는 값은 `processing`처럼 다루고 계속 조회하십시오"),
|
|
288
|
+
result: z.string().describe("화면 분기용 결과. `COMPLETED` 결제 완료 · `PROCESSING` 결과 확인 중 · `CANCELED` 구매자가 결제창을 닫음 · `FAILED` 결제 실패(다른 결제 옵션으로 재시도 가능) · `EXPIRED` 결제 요청 만료 · `PENDING` 결제 전입니다. 값이 추가될 수 있어 문자열로 받습니다 — 모르는 값은 `PROCESSING`처럼 다루십시오"),
|
|
289
289
|
orderId: z.string().nullable().describe("결제가 완료됐으면 주문 번호, 그 외에는 null"),
|
|
290
290
|
lastFailure: z.object({
|
|
291
291
|
attemptId: z.string(),
|
|
292
292
|
category: z.string().describe("`PREPARE_FAILURE`·`DECLINED`·`USER_CANCELED`(값이 추가될 수 있다)"),
|
|
293
|
-
code: z.string().nullable().describe("PG가 준 실패 코드. 내부 사유는 null
|
|
293
|
+
code: z.string().nullable().describe("PG가 준 실패 코드. 내부 사유는 null입니다. 화면 분기는 `category`로 하십시오"),
|
|
294
294
|
message: z.string().nullable().describe("구매자에게 보여 줄 안내 문구")
|
|
295
295
|
}).nullable().describe("현재 결제 시도가 실패·취소로 끝났으면 그 내용, 아니면 null"),
|
|
296
|
-
testPayment: z.boolean().describe("테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지
|
|
296
|
+
testPayment: z.boolean().describe("테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지 않았습니다"),
|
|
297
297
|
expiresAt: z.string().describe("결제 요청 만료 시각")
|
|
298
298
|
});
|
|
299
299
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as ANALYTICS_VISITOR_HEADER, r as ANALYTICS_SESSION_HEADER } from "./analytics-CgD70OqH.mjs";
|
|
2
|
-
import { A as startPaymentRequestSchema, C as paymentStartSchema, O as retryPaymentRequestSchema, d as createCheckoutRequestSchema, f as deliveryQuoteRequestSchema, m as easyPayProviderResponseSchema, p as deliveryQuoteSchema, u as checkoutSessionSchema, w as paymentStatusSchema, y as paymentMethodSchema } from "./checkout-
|
|
2
|
+
import { A as startPaymentRequestSchema, C as paymentStartSchema, O as retryPaymentRequestSchema, d as createCheckoutRequestSchema, f as deliveryQuoteRequestSchema, m as easyPayProviderResponseSchema, p as deliveryQuoteSchema, u as checkoutSessionSchema, w as paymentStatusSchema, y as paymentMethodSchema } from "./checkout-BeZKjYJz.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/http.ts
|
|
5
5
|
/** 표준 엔벨로프의 $.error 상세 */
|
|
@@ -636,7 +636,7 @@ const myOrderSchema = z.object({
|
|
|
636
636
|
paidAt: z.string().nullable(),
|
|
637
637
|
receiptUrl: z.url().nullable()
|
|
638
638
|
}),
|
|
639
|
-
testPayment: z.boolean().describe("테스트 결제(샌드박스 결제) 주문인가. true면 실제로 돈이 나가지
|
|
639
|
+
testPayment: z.boolean().describe("테스트 결제(샌드박스 결제) 주문인가. true면 실제로 돈이 나가지 않았습니다 — 주문 화면에 테스트 결제 배지를 표시합니다")
|
|
640
640
|
});
|
|
641
641
|
/**
|
|
642
642
|
* 택배 추적 단계. 응답에서는 문자열로 받는다(값이 추가될 수 있다) — 현재 값은 `ACCEPTED`(접수)·`IN_TRANSIT`(이동 중)·
|
|
@@ -697,7 +697,7 @@ const writableReviewSchema = z.object({
|
|
|
697
697
|
});
|
|
698
698
|
const createReviewRequestSchema = z.object({
|
|
699
699
|
rating: z.number().int().min(1).max(5),
|
|
700
|
-
content: z.string().min(10, "리뷰는 10자 이상
|
|
700
|
+
content: z.string().min(10, "리뷰는 10자 이상 작성해주십시오").max(2e3),
|
|
701
701
|
images: z.array(z.url()).max(5).optional()
|
|
702
702
|
});
|
|
703
703
|
const createReviewResultSchema = z.object({
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as ANALYTICS_VISITOR_HEADER, c as analyticsClientEventSchema, i as ANALYTICS_VISITOR_COOKIE, l as analyticsIdSchema, n as ANALYTICS_SESSION_COOKIE, o as analyticsBatchSchema, r as ANALYTICS_SESSION_HEADER, s as analyticsClientEventNameSchema, t as ANALYTICS_MAX_BATCH_BYTES, u as analyticsServerEventNameSchema } from "./analytics-CgD70OqH.mjs";
|
|
2
2
|
import { t as analyticsIdsFromCookie } from "./analytics-ids-COElZiI3.mjs";
|
|
3
|
-
import { $ as updateCartItemRequestSchema, A as consentSourceSchema, B as categoryNodeSchema, C as createInquiryResultSchema, D as customerInquirySchema, E as customerInquiryCategorySchema, F as claimReturnAddressSchema, G as productSortSchema, H as productDetailSchema, I as claimTypeSchema, J as pageInfoSchema, K as claimStatusSchema, L as createClaimRequestSchema, M as consentUpdateRequestSchema, N as memberConsentsSchema, O as consentActionSchema, P as claimReasonSchema, Q as cartSchema, R as createClaimResultSchema, S as createInquiryRequestSchema, T as createCustomerInquiryRequestSchema, U as productFacetsSchema, V as productCardSchema, W as productPageSchema, X as addCartItemRequestSchema, Y as pageSchema, Z as cartItemSchema, _ as memberAddressRequestSchema, a as publicReviewSchema, at as linkIdentityRequestSchema, b as updateProfileRequestSchema, c as updateReviewRequestSchema, ct as signupRequestSchema, d as deliveryTrackingSchema, dt as withdrawRequestSchema, et as anonymousSessionSchema, f as myOrderItemSchema, ft as withdrawalBlockedDetailsSchema, g as trackingStageResponseSchema, gt as unwrapData, h as purchaseDecisionResultSchema, ht as toApiError, i as createReviewResultSchema, it as idpTokenRequestSchema, j as consentStateSchema, k as consentKindSchema, l as updateReviewResultSchema, lt as socialProviderSchema, m as orderShippingAddressSchema, mt as buildQuery, n as storefrontStoreSchema, nt as idpAuthorizeRequestSchema, o as reviewPageSchema, ot as loginRequestSchema, p as myOrderSchema, pt as ApiError, q as orderItemStatusSchema, r as createReviewRequestSchema, rt as idpAuthorizeResponseSchema, s as reviewSummarySchema, st as memberIdentitiesSchema, t as createStorefrontClient, tt as idpAgreementsSchema, u as writableReviewSchema, ut as tokenPairSchema, v as memberAddressSchema, w as publicInquirySchema, x as wishlistAddResultSchema, y as memberSchema, z as myClaimSchema } from "./client-
|
|
4
|
-
import { A as startPaymentRequestSchema, C as paymentStartSchema, D as residentNumberLike, E as remoteAreaSchema, O as retryPaymentRequestSchema, S as paymentOptionSchema, T as pgProviderSchema, _ as paymentFailureCategorySchema, a as cashReceiptAvailable, b as paymentOptionKey, c as cashReceiptTypeSchema, d as createCheckoutRequestSchema, f as deliveryQuoteRequestSchema, g as guestInfoSchema, h as easyPayProviderSchema, i as availablePaymentOptionSchema, k as shippingAddressInputSchema, l as checkoutDeliverySchema, m as easyPayProviderResponseSchema, n as PAYMENT_RESULT_VALUES, o as cashReceiptIdentityTypeOf, p as deliveryQuoteSchema, r as PAYMENT_STATUS_VALUES, s as cashReceiptRequestSchema, t as CASH_RECEIPT_METHODS, u as checkoutSessionSchema, v as paymentMessageSchema, w as paymentStatusSchema, x as paymentOptionListSchema, y as paymentMethodSchema } from "./checkout-
|
|
3
|
+
import { $ as updateCartItemRequestSchema, A as consentSourceSchema, B as categoryNodeSchema, C as createInquiryResultSchema, D as customerInquirySchema, E as customerInquiryCategorySchema, F as claimReturnAddressSchema, G as productSortSchema, H as productDetailSchema, I as claimTypeSchema, J as pageInfoSchema, K as claimStatusSchema, L as createClaimRequestSchema, M as consentUpdateRequestSchema, N as memberConsentsSchema, O as consentActionSchema, P as claimReasonSchema, Q as cartSchema, R as createClaimResultSchema, S as createInquiryRequestSchema, T as createCustomerInquiryRequestSchema, U as productFacetsSchema, V as productCardSchema, W as productPageSchema, X as addCartItemRequestSchema, Y as pageSchema, Z as cartItemSchema, _ as memberAddressRequestSchema, a as publicReviewSchema, at as linkIdentityRequestSchema, b as updateProfileRequestSchema, c as updateReviewRequestSchema, ct as signupRequestSchema, d as deliveryTrackingSchema, dt as withdrawRequestSchema, et as anonymousSessionSchema, f as myOrderItemSchema, ft as withdrawalBlockedDetailsSchema, g as trackingStageResponseSchema, gt as unwrapData, h as purchaseDecisionResultSchema, ht as toApiError, i as createReviewResultSchema, it as idpTokenRequestSchema, j as consentStateSchema, k as consentKindSchema, l as updateReviewResultSchema, lt as socialProviderSchema, m as orderShippingAddressSchema, mt as buildQuery, n as storefrontStoreSchema, nt as idpAuthorizeRequestSchema, o as reviewPageSchema, ot as loginRequestSchema, p as myOrderSchema, pt as ApiError, q as orderItemStatusSchema, r as createReviewRequestSchema, rt as idpAuthorizeResponseSchema, s as reviewSummarySchema, st as memberIdentitiesSchema, t as createStorefrontClient, tt as idpAgreementsSchema, u as writableReviewSchema, ut as tokenPairSchema, v as memberAddressSchema, w as publicInquirySchema, x as wishlistAddResultSchema, y as memberSchema, z as myClaimSchema } from "./client-Do4cw2Ez.mjs";
|
|
4
|
+
import { A as startPaymentRequestSchema, C as paymentStartSchema, D as residentNumberLike, E as remoteAreaSchema, O as retryPaymentRequestSchema, S as paymentOptionSchema, T as pgProviderSchema, _ as paymentFailureCategorySchema, a as cashReceiptAvailable, b as paymentOptionKey, c as cashReceiptTypeSchema, d as createCheckoutRequestSchema, f as deliveryQuoteRequestSchema, g as guestInfoSchema, h as easyPayProviderSchema, i as availablePaymentOptionSchema, k as shippingAddressInputSchema, l as checkoutDeliverySchema, m as easyPayProviderResponseSchema, n as PAYMENT_RESULT_VALUES, o as cashReceiptIdentityTypeOf, p as deliveryQuoteSchema, r as PAYMENT_STATUS_VALUES, s as cashReceiptRequestSchema, t as CASH_RECEIPT_METHODS, u as checkoutSessionSchema, v as paymentMessageSchema, w as paymentStatusSchema, x as paymentOptionListSchema, y as paymentMethodSchema } from "./checkout-BeZKjYJz.mjs";
|
|
5
5
|
//#region src/session.ts
|
|
6
6
|
/** 세션 키 상수 — SDK가 소유한다. store-sdk와 겹치지 않는 별도 네임스페이스. */
|
|
7
7
|
const STOREFRONT_SESSION_KEYS = {
|
package/dist/payments/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as paymentMessageSchema } from "../checkout-
|
|
1
|
+
import { v as paymentMessageSchema } from "../checkout-BeZKjYJz.mjs";
|
|
2
2
|
//#region src/payments/index.ts
|
|
3
3
|
/** 복귀 주소에 결제 서비스가 붙이는 쿼리 */
|
|
4
4
|
const RETURN_PAYMENT_ID = "sayrenPaymentId";
|
|
@@ -51,19 +51,19 @@ function paymentResultOf(status, options = {}) {
|
|
|
51
51
|
status: "CANCELED",
|
|
52
52
|
paymentId,
|
|
53
53
|
code: lastFailure?.code ?? "USER_CANCELED",
|
|
54
|
-
message: lastFailure?.message ?? "결제를
|
|
54
|
+
message: lastFailure?.message ?? "결제를 취소했습니다"
|
|
55
55
|
};
|
|
56
56
|
if (result === "FAILED" || result === "EXPIRED") return {
|
|
57
57
|
status: "FAILED",
|
|
58
58
|
paymentId,
|
|
59
59
|
code: lastFailure?.code ?? result,
|
|
60
|
-
message: lastFailure?.message ?? (result === "EXPIRED" ? "결제 요청이
|
|
60
|
+
message: lastFailure?.message ?? (result === "EXPIRED" ? "결제 요청이 만료됐습니다" : "결제에 실패했습니다")
|
|
61
61
|
};
|
|
62
62
|
if (result === "PENDING") return options.popupClosed ? {
|
|
63
63
|
status: "CANCELED",
|
|
64
64
|
paymentId,
|
|
65
65
|
code: "POPUP_CLOSED",
|
|
66
|
-
message: "결제창을
|
|
66
|
+
message: "결제창을 닫았습니다"
|
|
67
67
|
} : {
|
|
68
68
|
status: "PROCESSING",
|
|
69
69
|
paymentId
|
|
@@ -147,7 +147,7 @@ function createPayments(options) {
|
|
|
147
147
|
} catch {
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
console.warn(`[sayren] returnUrl(${returnUrl})의 origin이 지금 페이지와
|
|
150
|
+
console.warn(`[sayren] returnUrl(${returnUrl})의 origin이 지금 페이지와 다릅니다 — 결제 서비스는 그 origin으로 결과 메시지를 보내므로 팝업 결과가 도달하지 않고 결제 상태 조회로만 끝납니다`);
|
|
151
151
|
}
|
|
152
152
|
function prepareWindow(prepareOptions = {}) {
|
|
153
153
|
stopWatch();
|
|
@@ -165,7 +165,7 @@ function createPayments(options) {
|
|
|
165
165
|
*/
|
|
166
166
|
function resolvePrepared(given, mode) {
|
|
167
167
|
if (!given) return prepareWindow({ mode });
|
|
168
|
-
if (given[PREPARED_WINDOW] !== brand) throw new TypeError("window는 같은 createPayments의 prepareWindow()가 돌려준 핸들이어야
|
|
168
|
+
if (given[PREPARED_WINDOW] !== brand) throw new TypeError("window는 같은 createPayments의 prepareWindow()가 돌려준 핸들이어야 합니다");
|
|
169
169
|
return given;
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
@@ -281,7 +281,7 @@ function createPayments(options) {
|
|
|
281
281
|
const returnUrl = startOptions.returnUrl ?? options.returnUrl;
|
|
282
282
|
if (!returnUrl) {
|
|
283
283
|
prepared.close();
|
|
284
|
-
return Promise.reject(/* @__PURE__ */ new Error("returnUrl이
|
|
284
|
+
return Promise.reject(/* @__PURE__ */ new Error("returnUrl이 필요합니다 — createPayments 또는 start에 넘겨 주십시오"));
|
|
285
285
|
}
|
|
286
286
|
warnReturnOrigin(returnUrl, prepared.mode);
|
|
287
287
|
return startWith(prepared, () => client.checkout.startPayment(checkoutId, {
|
|
@@ -312,7 +312,7 @@ function createPayments(options) {
|
|
|
312
312
|
}
|
|
313
313
|
if (!paymentId) return {
|
|
314
314
|
status: "INVALID",
|
|
315
|
-
message: "결제 정보가 없는
|
|
315
|
+
message: "결제 정보가 없는 주소입니다"
|
|
316
316
|
};
|
|
317
317
|
return paymentResultOf(await client.payments.getStatus(paymentId));
|
|
318
318
|
}
|
package/package.json
CHANGED
package/src/auth/index.ts
CHANGED
|
@@ -48,7 +48,7 @@ export class IdpCallbackError extends Error {
|
|
|
48
48
|
constructor(
|
|
49
49
|
public readonly reason: "access_denied" | "state_mismatch" | "missing_code" | string,
|
|
50
50
|
) {
|
|
51
|
-
super(`소셜 로그인을 마치지
|
|
51
|
+
super(`소셜 로그인을 마치지 못했습니다 (${reason})`);
|
|
52
52
|
this.name = "IdpCallbackError";
|
|
53
53
|
}
|
|
54
54
|
}
|
package/src/payments/index.ts
CHANGED
|
@@ -168,7 +168,7 @@ export function paymentResultOf(
|
|
|
168
168
|
status: "CANCELED",
|
|
169
169
|
paymentId,
|
|
170
170
|
code: lastFailure?.code ?? "USER_CANCELED",
|
|
171
|
-
message: lastFailure?.message ?? "결제를
|
|
171
|
+
message: lastFailure?.message ?? "결제를 취소했습니다",
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
if (result === "FAILED" || result === "EXPIRED") {
|
|
@@ -178,13 +178,13 @@ export function paymentResultOf(
|
|
|
178
178
|
code: lastFailure?.code ?? result,
|
|
179
179
|
message:
|
|
180
180
|
lastFailure?.message ??
|
|
181
|
-
(result === "EXPIRED" ? "결제 요청이
|
|
181
|
+
(result === "EXPIRED" ? "결제 요청이 만료됐습니다" : "결제에 실패했습니다"),
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
184
|
if (result === "PENDING") {
|
|
185
185
|
// 결제창이 닫혔는데 아직 결제 전이면 구매자가 닫은 것이다
|
|
186
186
|
return options.popupClosed
|
|
187
|
-
? { status: "CANCELED", paymentId, code: "POPUP_CLOSED", message: "결제창을
|
|
187
|
+
? { status: "CANCELED", paymentId, code: "POPUP_CLOSED", message: "결제창을 닫았습니다" }
|
|
188
188
|
: { status: "PROCESSING", paymentId };
|
|
189
189
|
}
|
|
190
190
|
return { status: "PROCESSING", paymentId };
|
|
@@ -340,7 +340,7 @@ export function createPayments(options: PaymentsOptions): Payments {
|
|
|
340
340
|
return; // 주소를 읽지 못하면 검사하지 않는다
|
|
341
341
|
}
|
|
342
342
|
console.warn(
|
|
343
|
-
`[sayren] returnUrl(${returnUrl})의 origin이 지금 페이지와
|
|
343
|
+
`[sayren] returnUrl(${returnUrl})의 origin이 지금 페이지와 다릅니다 — 결제 서비스는 그 origin으로 결과 메시지를 보내므로 팝업 결과가 도달하지 않고 결제 상태 조회로만 끝납니다`,
|
|
344
344
|
);
|
|
345
345
|
}
|
|
346
346
|
|
|
@@ -369,7 +369,7 @@ export function createPayments(options: PaymentsOptions): Payments {
|
|
|
369
369
|
if (!given) return prepareWindow({ mode });
|
|
370
370
|
if ((given as Partial<PreparedWindowInternal>)[PREPARED_WINDOW] !== brand) {
|
|
371
371
|
throw new TypeError(
|
|
372
|
-
"window는 같은 createPayments의 prepareWindow()가 돌려준 핸들이어야
|
|
372
|
+
"window는 같은 createPayments의 prepareWindow()가 돌려준 핸들이어야 합니다",
|
|
373
373
|
);
|
|
374
374
|
}
|
|
375
375
|
return given as PreparedWindowInternal;
|
|
@@ -517,7 +517,7 @@ export function createPayments(options: PaymentsOptions): Payments {
|
|
|
517
517
|
if (!returnUrl) {
|
|
518
518
|
prepared.close();
|
|
519
519
|
return Promise.reject(
|
|
520
|
-
new Error("returnUrl이
|
|
520
|
+
new Error("returnUrl이 필요합니다 — createPayments 또는 start에 넘겨 주십시오"),
|
|
521
521
|
);
|
|
522
522
|
}
|
|
523
523
|
warnReturnOrigin(returnUrl, prepared.mode);
|
|
@@ -554,7 +554,7 @@ export function createPayments(options: PaymentsOptions): Payments {
|
|
|
554
554
|
} catch {
|
|
555
555
|
paymentId = null;
|
|
556
556
|
}
|
|
557
|
-
if (!paymentId) return { status: "INVALID", message: "결제 정보가 없는
|
|
557
|
+
if (!paymentId) return { status: "INVALID", message: "결제 정보가 없는 주소입니다" };
|
|
558
558
|
return paymentResultOf(await client.payments.getStatus(paymentId));
|
|
559
559
|
},
|
|
560
560
|
};
|
package/src/schemas/checkout.ts
CHANGED
|
@@ -86,7 +86,7 @@ export const checkoutSessionSchema = z.object({
|
|
|
86
86
|
testPayment: z
|
|
87
87
|
.boolean()
|
|
88
88
|
.describe(
|
|
89
|
-
"지금 결제하면 테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지
|
|
89
|
+
"지금 결제하면 테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지 않습니다 — 주문서에 테스트 결제 안내를 표시합니다. 결제 요청 시점에 스토어 결제 설정으로 다시 정해지니 최종 값은 결제 요청 응답의 `testPayment`입니다",
|
|
90
90
|
),
|
|
91
91
|
});
|
|
92
92
|
|
|
@@ -100,7 +100,7 @@ export type CheckoutSession = z.infer<typeof checkoutSessionSchema>;
|
|
|
100
100
|
export const deliveryQuoteRequestSchema = z.object({
|
|
101
101
|
zipCode: z
|
|
102
102
|
.string()
|
|
103
|
-
.regex(/^[0-9]{5}$/, "우편번호 5자리를 입력해
|
|
103
|
+
.regex(/^[0-9]{5}$/, "우편번호 5자리를 입력해 주십시오")
|
|
104
104
|
.describe("배송지 우편번호 5자리"),
|
|
105
105
|
});
|
|
106
106
|
|
|
@@ -190,10 +190,10 @@ export function paymentOptionKey(option: PaymentOption): string {
|
|
|
190
190
|
|
|
191
191
|
export const shippingAddressInputSchema = z.object({
|
|
192
192
|
addressId: z.string().optional(),
|
|
193
|
-
receiverName: z.string().min(1, "수령인명을
|
|
193
|
+
receiverName: z.string().min(1, "수령인명을 입력해주십시오").max(50),
|
|
194
194
|
phone: z.string().regex(/^01[0-9]{8,9}$/, "연락처 형식이 아닙니다 (예: 01012345678)"),
|
|
195
195
|
zipCode: z.string().regex(/^[0-9]{5}$/, "우편번호는 5자리 숫자입니다"),
|
|
196
|
-
address1: z.string().min(1, "기본 주소를
|
|
196
|
+
address1: z.string().min(1, "기본 주소를 입력해주십시오"),
|
|
197
197
|
address2: z.string().optional(),
|
|
198
198
|
deliveryMemo: z.string().max(100).optional(),
|
|
199
199
|
entranceCode: z.string().max(20).optional(),
|
|
@@ -302,8 +302,8 @@ export const cashReceiptRequestSchema = z
|
|
|
302
302
|
code: "custom",
|
|
303
303
|
path: ["identityNumber"],
|
|
304
304
|
message:
|
|
305
|
-
"주민등록번호는 현금영수증 식별 번호로 쓸 수
|
|
306
|
-
"휴대폰 번호 또는 현금영수증카드 번호를
|
|
305
|
+
"주민등록번호는 현금영수증 식별 번호로 쓸 수 없습니다. " +
|
|
306
|
+
"휴대폰 번호 또는 현금영수증카드 번호를 입력해주십시오 (RESIDENT_NUMBER_NOT_ALLOWED)",
|
|
307
307
|
});
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
@@ -313,8 +313,8 @@ export const cashReceiptRequestSchema = z
|
|
|
313
313
|
path: ["identityNumber"],
|
|
314
314
|
message:
|
|
315
315
|
value.type === "INCOME_DEDUCTION"
|
|
316
|
-
? "휴대폰 번호 또는 현금영수증카드 번호를
|
|
317
|
-
: "사업자등록번호(10자리) 또는 현금영수증카드 번호를
|
|
316
|
+
? "휴대폰 번호 또는 현금영수증카드 번호를 입력해주십시오"
|
|
317
|
+
: "사업자등록번호(10자리) 또는 현금영수증카드 번호를 입력해주십시오",
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
320
|
});
|
|
@@ -422,14 +422,14 @@ export const paymentStatusSchema = z.object({
|
|
|
422
422
|
.string()
|
|
423
423
|
.describe(
|
|
424
424
|
"결제 상태. 현재 값은 `pending` 결제 대기 · `processing` 승인 확인 중 · `completed` 결제 완료(주문 생성) · `failed` 실패 · " +
|
|
425
|
-
"`expired`
|
|
425
|
+
"`expired` 만료입니다. 상태가 추가될 수 있어 문자열로 받습니다 — 모르는 값은 `processing`처럼 다루고 계속 조회하십시오",
|
|
426
426
|
),
|
|
427
427
|
result: z
|
|
428
428
|
.string()
|
|
429
429
|
.describe(
|
|
430
430
|
"화면 분기용 결과. `COMPLETED` 결제 완료 · `PROCESSING` 결과 확인 중 · `CANCELED` 구매자가 결제창을 닫음 · " +
|
|
431
|
-
"`FAILED` 결제 실패(다른 결제 옵션으로 재시도 가능) · `EXPIRED` 결제 요청 만료 · `PENDING` 결제
|
|
432
|
-
"값이 추가될 수 있어 문자열로
|
|
431
|
+
"`FAILED` 결제 실패(다른 결제 옵션으로 재시도 가능) · `EXPIRED` 결제 요청 만료 · `PENDING` 결제 전입니다. " +
|
|
432
|
+
"값이 추가될 수 있어 문자열로 받습니다 — 모르는 값은 `PROCESSING`처럼 다루십시오",
|
|
433
433
|
),
|
|
434
434
|
orderId: z.string().nullable().describe("결제가 완료됐으면 주문 번호, 그 외에는 null"),
|
|
435
435
|
lastFailure: z
|
|
@@ -441,14 +441,14 @@ export const paymentStatusSchema = z.object({
|
|
|
441
441
|
code: z
|
|
442
442
|
.string()
|
|
443
443
|
.nullable()
|
|
444
|
-
.describe("PG가 준 실패 코드. 내부 사유는 null
|
|
444
|
+
.describe("PG가 준 실패 코드. 내부 사유는 null입니다. 화면 분기는 `category`로 하십시오"),
|
|
445
445
|
message: z.string().nullable().describe("구매자에게 보여 줄 안내 문구"),
|
|
446
446
|
})
|
|
447
447
|
.nullable()
|
|
448
448
|
.describe("현재 결제 시도가 실패·취소로 끝났으면 그 내용, 아니면 null"),
|
|
449
449
|
testPayment: z
|
|
450
450
|
.boolean()
|
|
451
|
-
.describe("테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지
|
|
451
|
+
.describe("테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지 않았습니다"),
|
|
452
452
|
expiresAt: z.string().describe("결제 요청 만료 시각"),
|
|
453
453
|
});
|
|
454
454
|
|
package/src/schemas/order.ts
CHANGED
package/src/schemas/review.ts
CHANGED
|
@@ -40,7 +40,7 @@ export type WritableReview = z.infer<typeof writableReviewSchema>;
|
|
|
40
40
|
|
|
41
41
|
export const createReviewRequestSchema = z.object({
|
|
42
42
|
rating: z.number().int().min(1).max(5),
|
|
43
|
-
content: z.string().min(10, "리뷰는 10자 이상
|
|
43
|
+
content: z.string().min(10, "리뷰는 10자 이상 작성해주십시오").max(2000),
|
|
44
44
|
images: z.array(z.url()).max(5).optional(),
|
|
45
45
|
});
|
|
46
46
|
|