@yolo-croket-dev/entity-v2 0.3.58-beta.2 → 0.3.58-beta.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.
@@ -0,0 +1,184 @@
1
+ /** @author jun @description Buyma MVP의 주문·이력 영속 계약. @process 상품·사입·배송은 주문에 내장하고 변경 근거를 별도 저장한다. */
2
+ import { Types } from 'mongoose';
3
+ export declare const BUYMA_PAYMENT_STATUSES: readonly ["UNVERIFIED", "PENDING_PAYMENT", "PAID"];
4
+ export type BuymaPaymentStatus = (typeof BUYMA_PAYMENT_STATUSES)[number];
5
+ export declare const BUYMA_ORDER_STATUSES: readonly ["ORDER_CHECKING", "STOCK_CHECKING", "PREPARING_SHIPMENT", "LOCAL_IN_TRANSIT", "INTERNATIONAL_IN_TRANSIT", "DELIVERED", "REFUNDED"];
6
+ export type BuymaOrderStatus = (typeof BUYMA_ORDER_STATUSES)[number];
7
+ export declare const BUYMA_PROCUREMENT_WORK_STATUSES: readonly ["UNSPECIFIED", "NOT_REQUIRED", "SELLER_DIRECT_INQUIRY", "STOCK_INQUIRY", "ALTERNATIVE_STOCK_CHECK", "EXTRA_PAYMENT_INQUIRY", "OPTION_CHANGE_INQUIRY", "PROCURED", "ALTERNATIVE_PROCURED", "ISSUE"];
8
+ export type BuymaProcurementWorkStatus = (typeof BUYMA_PROCUREMENT_WORK_STATUSES)[number];
9
+ export interface BuymaMoney {
10
+ amount: number;
11
+ currency: string;
12
+ }
13
+ export interface BuymaBuyer {
14
+ buymaBuyerId: string | null;
15
+ name: string | null;
16
+ }
17
+ export interface BuymaRecipient {
18
+ name: string | null;
19
+ phone: string | null;
20
+ countryCode: string | null;
21
+ postalCode: string | null;
22
+ address1: string | null;
23
+ address2: string | null;
24
+ address3: string | null;
25
+ address4: string | null;
26
+ }
27
+ export interface BuymaProductSnapshot {
28
+ buymaProductId: string | null;
29
+ croketItemId: Types.ObjectId | null;
30
+ storeName: string | null;
31
+ sourceCountry: string | null;
32
+ croketName: string | null;
33
+ buymaName: string | null;
34
+ brandName: string | null;
35
+ optionName: string | null;
36
+ weightGrams: number | null;
37
+ croketItemUrl: string | null;
38
+ buymaItemUrl: string | null;
39
+ }
40
+ export interface BuymaPayment {
41
+ status: BuymaPaymentStatus;
42
+ reportedStatus: string | null;
43
+ preOrderedAt: Date | null;
44
+ paidAt: Date | null;
45
+ confirmationSource: 'BUYMA_ORDERED_AT' | 'ADMIN' | null;
46
+ confirmedAt: Date | null;
47
+ confirmedBy: Types.ObjectId | null;
48
+ evidence: string | null;
49
+ }
50
+ export interface BuymaLocalShipment {
51
+ invoiceRegisteredAt: Date | null;
52
+ carrierName: string | null;
53
+ trackingNumber: string | null;
54
+ }
55
+ /** 실제 배정만 ACTIVE로 기록한다. 기존 미검증 자료는 null을 유지한다. */
56
+ export type BuymaProcurementAllocationStatus = 'ACTIVE' | 'RELEASED';
57
+ export interface BuymaProcurementLockEntity {
58
+ _id: Types.ObjectId;
59
+ revision: number;
60
+ }
61
+ export interface BuymaProcurement {
62
+ allocationStatus?: BuymaProcurementAllocationStatus | null;
63
+ croketOptionName?: string | null;
64
+ source: 'CROKET' | 'MANUAL';
65
+ orderUrl: string;
66
+ croketPurchaseReceiptId: Types.ObjectId | null;
67
+ croketPurchasedInfoId: Types.ObjectId | null;
68
+ croketPurchasedInfoPublicId: string | null;
69
+ /** 원래 완료된 결제의 개당 기본 상품 가격. */
70
+ croketProductPrice: BuymaMoney | null;
71
+ /** 선택 구매 건에 청구한 배송비. */
72
+ croketShippingCost: BuymaMoney | null;
73
+ /** 시트 AG 대응 금액. 위 두 금액의 합으로 덮어쓰지 않는다. */
74
+ purchaseCost: BuymaMoney | null;
75
+ sellerSettlementCost: BuymaMoney | null;
76
+ sourceStatus: string | null;
77
+ localShipment: BuymaLocalShipment | null;
78
+ }
79
+ export interface BuymaInternationalShipment {
80
+ carrierName: string;
81
+ trackingNumber: string;
82
+ trackingUrl: string | null;
83
+ /** 운송장 전체 금액이 아닌 해당 주문에 배분한 비용. */
84
+ shippingCost: BuymaMoney | null;
85
+ deliveredAt: Date | null;
86
+ deliveryEvidence: string | null;
87
+ }
88
+ export interface BuymaCommunications {
89
+ stockSecuredNotified: boolean | null;
90
+ forwarderDispatchNotified: boolean | null;
91
+ }
92
+ export interface BuymaRefundRecord {
93
+ amount: BuymaMoney;
94
+ refundedAt: Date;
95
+ evidence: string;
96
+ }
97
+ export interface BuymaLegacySettlement {
98
+ appliedExchangeRate: string | null;
99
+ exchangeRateUnit: string | null;
100
+ feeRateText: string | null;
101
+ buymaFee: BuymaMoney | null;
102
+ sellerSettlementJPY: BuymaMoney | null;
103
+ productMargin: BuymaMoney | null;
104
+ productMarginRate: string | null;
105
+ shippingFee: BuymaMoney | null;
106
+ outboundShippingJPY: BuymaMoney | null;
107
+ shippingMargin: BuymaMoney | null;
108
+ shippingMarginRate: string | null;
109
+ totalMargin: BuymaMoney | null;
110
+ totalMarginRate: string | null;
111
+ memo: string | null;
112
+ }
113
+ export interface BuymaRecipientChange {
114
+ status: 'PENDING' | 'APPLIED' | 'UNVERIFIED';
115
+ reportedStatus: string | null;
116
+ sourceOrderStatus: string | null;
117
+ previousAddress: string | null;
118
+ previousPhone: string | null;
119
+ requestedAddress: string | null;
120
+ requestedPhone: string | null;
121
+ }
122
+ export interface BuymaLegacySheetData {
123
+ sourceRecordedLocalDate: string | null;
124
+ sourceDispatchDate: string | null;
125
+ sourceDeliveredDate: string | null;
126
+ sourceOrderStatus: string | null;
127
+ sourceProcurementWorkStatus: string | null;
128
+ legacySettlement: BuymaLegacySettlement | null;
129
+ recipientChange: BuymaRecipientChange | null;
130
+ }
131
+ export interface BuymaOrderEntity {
132
+ _id: Types.ObjectId;
133
+ buymaAccountId: string;
134
+ buymaOrderNumber: string;
135
+ buymaOrderUrl: string | null;
136
+ buyer: BuymaBuyer;
137
+ recipient: BuymaRecipient | null;
138
+ productSnapshot: BuymaProductSnapshot;
139
+ quantity: number;
140
+ productRevenue: BuymaMoney | null;
141
+ shippingRevenue: BuymaMoney | null;
142
+ reportedTotalRevenue: BuymaMoney | null;
143
+ payment: BuymaPayment;
144
+ /** null은 상태를 매핑하지 못한 기존 시트 주문에만 허용한다. */
145
+ orderStatus: BuymaOrderStatus | null;
146
+ procurementWorkStatus: BuymaProcurementWorkStatus;
147
+ procurement: BuymaProcurement | null;
148
+ internationalShipment: BuymaInternationalShipment | null;
149
+ communications: BuymaCommunications;
150
+ refundRecord: BuymaRefundRecord | null;
151
+ holdReason: string | null;
152
+ memo: string | null;
153
+ slackThreadUrls: string[];
154
+ revision: number;
155
+ createdAt: Date;
156
+ updatedAt: Date;
157
+ legacySheetData: BuymaLegacySheetData | null;
158
+ }
159
+ export type BuymaJsonValue = string | number | boolean | null | BuymaJsonValue[] | {
160
+ [key: string]: BuymaJsonValue;
161
+ };
162
+ export interface BuymaFieldChange {
163
+ field: string;
164
+ before: BuymaJsonValue;
165
+ after: BuymaJsonValue;
166
+ }
167
+ export interface BuymaOrderEventEntity {
168
+ _id: Types.ObjectId;
169
+ orderId: Types.ObjectId | null;
170
+ buymaAccountId: string;
171
+ buymaOrderNumber: string;
172
+ source: 'BUYMA_WEBHOOK' | 'ADMIN' | 'SHEET_IMPORT';
173
+ eventId: string;
174
+ eventType: string;
175
+ receivedAt: Date;
176
+ actorId: Types.ObjectId | null;
177
+ changes: BuymaFieldChange[];
178
+ reason: string | null;
179
+ payload: {
180
+ [key: string]: BuymaJsonValue;
181
+ } | null;
182
+ result: 'APPLIED' | 'FAILED' | 'EXCLUDED';
183
+ errorMessage: string | null;
184
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BUYMA_PROCUREMENT_WORK_STATUSES = exports.BUYMA_ORDER_STATUSES = exports.BUYMA_PAYMENT_STATUSES = void 0;
4
+ exports.BUYMA_PAYMENT_STATUSES = [
5
+ 'UNVERIFIED',
6
+ 'PENDING_PAYMENT',
7
+ 'PAID',
8
+ ];
9
+ exports.BUYMA_ORDER_STATUSES = [
10
+ 'ORDER_CHECKING',
11
+ 'STOCK_CHECKING',
12
+ 'PREPARING_SHIPMENT',
13
+ 'LOCAL_IN_TRANSIT',
14
+ 'INTERNATIONAL_IN_TRANSIT',
15
+ 'DELIVERED',
16
+ 'REFUNDED',
17
+ ];
18
+ exports.BUYMA_PROCUREMENT_WORK_STATUSES = [
19
+ 'UNSPECIFIED',
20
+ 'NOT_REQUIRED',
21
+ 'SELLER_DIRECT_INQUIRY',
22
+ 'STOCK_INQUIRY',
23
+ 'ALTERNATIVE_STOCK_CHECK',
24
+ 'EXTRA_PAYMENT_INQUIRY',
25
+ 'OPTION_CHANGE_INQUIRY',
26
+ 'PROCURED',
27
+ 'ALTERNATIVE_PROCURED',
28
+ 'ISSUE',
29
+ ];
@@ -0,0 +1 @@
1
+ export * from './buyma-order.entity';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./buyma-order.entity"), exports);
package/index.d.ts CHANGED
@@ -86,3 +86,4 @@ export * from './store-pending-settle';
86
86
  export * from './admin-settlement-limit';
87
87
  export * from './settle-adjustment-plan';
88
88
  export * from './notification-campaign';
89
+ export * from './buyma-order';
package/index.js CHANGED
@@ -100,3 +100,4 @@ __exportStar(require("./store-pending-settle"), exports);
100
100
  __exportStar(require("./admin-settlement-limit"), exports);
101
101
  __exportStar(require("./settle-adjustment-plan"), exports);
102
102
  __exportStar(require("./notification-campaign"), exports);
103
+ __exportStar(require("./buyma-order"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-croket-dev/entity-v2",
3
- "version": "0.3.58-beta.2",
3
+ "version": "0.3.58-beta.4",
4
4
  "main": "index.js",
5
5
  "author": "Yolo Co., Ltd.",
6
6
  "description": "크로켓 nest 용 entity-v3",
@@ -23,4 +23,4 @@
23
23
  },
24
24
  "license": "UNLICENSED",
25
25
  "dependencies": {}
26
- }
26
+ }