@pisell/pisellos 2.2.264 → 2.2.265
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/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.js +167 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.js +780 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/dist/model/strategy/adapter/dataVariant/examples.js +277 -0
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/dist/model/strategy/adapter/dataVariant/index.js +4 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/dist/model/strategy/adapter/dataVariant/type.js +54 -0
- package/dist/model/strategy/adapter/index.d.ts +4 -0
- package/dist/model/strategy/adapter/index.js +5 -1
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/dist/model/strategy/adapter/promotion/adapter.js +0 -23
- package/dist/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/dist/model/strategy/adapter/promotion/evaluator.js +6 -279
- package/dist/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/dist/model/strategy/adapter/promotion/examples.js +0 -99
- package/dist/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/dist/model/strategy/adapter/promotion/index.js +9 -0
- package/dist/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +16 -10
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +2 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.js +32 -1
- package/dist/modules/Discount/index.d.ts +5 -2
- package/dist/modules/Discount/index.js +30 -7
- package/dist/modules/Discount/types.d.ts +4 -0
- package/dist/modules/Order/index.d.ts +41 -10
- package/dist/modules/Order/index.js +1370 -808
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/payment-utils.js +225 -0
- package/dist/modules/Order/types.d.ts +49 -1
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.js +410 -0
- package/dist/modules/Order/utils.d.ts +4 -3
- package/dist/modules/Order/utils.js +62 -66
- package/dist/modules/Payment/index.d.ts +2 -0
- package/dist/modules/Payment/index.js +78 -49
- package/dist/modules/Payment/types.d.ts +26 -24
- package/dist/modules/Payment/types.js +2 -0
- package/dist/modules/Product/types.d.ts +22 -0
- package/dist/modules/ProductList/index.d.ts +1 -1
- package/dist/modules/ProductList/index.js +4 -2
- package/dist/modules/ProductList/types.d.ts +2 -0
- package/dist/modules/Rules/index.d.ts +2 -9
- package/dist/modules/Rules/index.js +69 -43
- package/dist/modules/Rules/types.d.ts +10 -1
- package/dist/server/index.d.ts +71 -0
- package/dist/server/index.js +2504 -1187
- package/dist/server/modules/order/index.d.ts +56 -5
- package/dist/server/modules/order/index.js +1718 -834
- package/dist/server/modules/order/types.d.ts +15 -3
- package/dist/server/modules/order/types.js +1 -1
- package/dist/server/modules/products/index.d.ts +31 -8
- package/dist/server/modules/products/index.js +549 -390
- package/dist/server/modules/products/types.d.ts +18 -0
- package/dist/solution/BaseSales/index.d.ts +54 -4
- package/dist/solution/BaseSales/index.js +1448 -788
- package/dist/solution/BaseSales/types.d.ts +6 -1
- package/dist/solution/BaseSales/types.js +1 -1
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +50 -97
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +9 -4
- package/dist/solution/BaseSales/utils/parseSalesResponse.js +6 -8
- package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +14 -1
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/BookingTicket/index.js +61 -26
- package/dist/solution/BookingTicket/types.d.ts +2 -0
- package/dist/solution/Sales/index.d.ts +1 -0
- package/dist/solution/Sales/index.js +10 -2
- package/dist/solution/ScanOrder/index.js +20 -31
- package/dist/solution/ShopDiscount/index.js +15 -14
- package/dist/solution/VenueBooking/index.js +19 -30
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/payment-number.js +69 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.js +149 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +89 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.js +583 -0
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/lib/model/strategy/adapter/dataVariant/examples.js +293 -0
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/lib/model/strategy/adapter/dataVariant/index.js +38 -0
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +148 -0
- package/lib/model/strategy/adapter/dataVariant/type.js +31 -0
- package/lib/model/strategy/adapter/index.d.ts +4 -0
- package/lib/model/strategy/adapter/index.js +13 -2
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +0 -4
- package/lib/model/strategy/adapter/promotion/adapter.js +0 -20
- package/lib/model/strategy/adapter/promotion/evaluator.d.ts +0 -17
- package/lib/model/strategy/adapter/promotion/evaluator.js +0 -235
- package/lib/model/strategy/adapter/promotion/examples.d.ts +0 -86
- package/lib/model/strategy/adapter/promotion/examples.js +0 -91
- package/lib/model/strategy/adapter/promotion/index.d.ts +1 -1
- package/lib/model/strategy/adapter/promotion/index.js +0 -2
- package/lib/model/strategy/adapter/promotion/type.d.ts +2 -90
- package/lib/model/strategy/adapter/promotion/type.js +0 -2
- package/lib/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +5 -0
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +1 -1
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.js +23 -2
- package/lib/modules/Discount/index.d.ts +5 -2
- package/lib/modules/Discount/index.js +23 -3
- package/lib/modules/Discount/types.d.ts +4 -0
- package/lib/modules/Order/index.d.ts +41 -10
- package/lib/modules/Order/index.js +505 -119
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/payment-utils.js +224 -0
- package/lib/modules/Order/types.d.ts +49 -1
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +53 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.js +418 -0
- package/lib/modules/Order/utils.d.ts +4 -3
- package/lib/modules/Order/utils.js +27 -26
- package/lib/modules/Payment/index.d.ts +2 -0
- package/lib/modules/Payment/index.js +33 -12
- package/lib/modules/Payment/types.d.ts +26 -24
- package/lib/modules/Product/types.d.ts +22 -0
- package/lib/modules/ProductList/index.d.ts +1 -1
- package/lib/modules/ProductList/index.js +4 -2
- package/lib/modules/ProductList/types.d.ts +2 -0
- package/lib/modules/Rules/index.d.ts +2 -9
- package/lib/modules/Rules/index.js +61 -29
- package/lib/modules/Rules/types.d.ts +10 -1
- package/lib/server/index.d.ts +71 -0
- package/lib/server/index.js +1002 -52
- package/lib/server/modules/order/index.d.ts +56 -5
- package/lib/server/modules/order/index.js +798 -148
- package/lib/server/modules/order/types.d.ts +15 -3
- package/lib/server/modules/products/index.d.ts +31 -8
- package/lib/server/modules/products/index.js +134 -35
- package/lib/server/modules/products/types.d.ts +18 -0
- package/lib/solution/BaseSales/index.d.ts +54 -4
- package/lib/solution/BaseSales/index.js +475 -50
- package/lib/solution/BaseSales/types.d.ts +6 -1
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +25 -64
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +9 -4
- package/lib/solution/BaseSales/utils/parseSalesResponse.js +4 -5
- package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +8 -0
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/BookingTicket/index.js +35 -9
- package/lib/solution/BookingTicket/types.d.ts +2 -0
- package/lib/solution/Sales/index.d.ts +1 -0
- package/lib/solution/Sales/index.js +5 -3
- package/lib/solution/ScanOrder/index.js +0 -8
- package/lib/solution/ShopDiscount/index.js +2 -1
- package/lib/solution/VenueBooking/index.js +0 -8
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/payment-number.js +64 -0
- package/package.json +1 -1
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/modules/Order/utils/orderCollectionIdentity.ts
|
|
20
|
+
var orderCollectionIdentity_exports = {};
|
|
21
|
+
__export(orderCollectionIdentity_exports, {
|
|
22
|
+
applyOrderCollectionUidRemaps: () => applyOrderCollectionUidRemaps,
|
|
23
|
+
buildOrderCollectionFallbackUid: () => buildOrderCollectionFallbackUid,
|
|
24
|
+
createUuidV4: () => createUuidV4,
|
|
25
|
+
getOrderCollectionPersistentId: () => getOrderCollectionPersistentId,
|
|
26
|
+
getOrderCollectionReferenceUid: () => getOrderCollectionReferenceUid,
|
|
27
|
+
getOrderCollectionUid: () => getOrderCollectionUid,
|
|
28
|
+
isBlankOrderCollectionIdentity: () => isBlankOrderCollectionIdentity,
|
|
29
|
+
isSameOrderCollectionItem: () => isSameOrderCollectionItem,
|
|
30
|
+
mergeOrderCollectionItems: () => mergeOrderCollectionItems,
|
|
31
|
+
normalizeOrderCollection: () => normalizeOrderCollection,
|
|
32
|
+
normalizeOrderCollections: () => normalizeOrderCollections,
|
|
33
|
+
setOrderCollectionUid: () => setOrderCollectionUid
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(orderCollectionIdentity_exports);
|
|
36
|
+
var import_lodash_es = require("lodash-es");
|
|
37
|
+
var IDENTITY_CONFIG = {
|
|
38
|
+
product: {
|
|
39
|
+
persistentIdField: "order_detail_id",
|
|
40
|
+
uidField: "unique_identification_number",
|
|
41
|
+
fallbackPrefix: "os-fallback:product:order-detail"
|
|
42
|
+
},
|
|
43
|
+
booking: {
|
|
44
|
+
persistentIdField: "schedule_event_id",
|
|
45
|
+
uidField: "unique_identification_number",
|
|
46
|
+
fallbackPrefix: "os-fallback:booking:schedule-event"
|
|
47
|
+
},
|
|
48
|
+
payment: {
|
|
49
|
+
persistentIdField: "order_payment_id",
|
|
50
|
+
uidField: "unique_payment_number",
|
|
51
|
+
fallbackPrefix: "os-fallback:payment:order-payment"
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
function createUuidV4() {
|
|
55
|
+
const template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
56
|
+
return template.replace(/[xy]/g, (char) => {
|
|
57
|
+
const randomValue = Math.floor(Math.random() * 16);
|
|
58
|
+
const value = char === "x" ? randomValue : randomValue & 3 | 8;
|
|
59
|
+
return value.toString(16);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function isBlankOrderCollectionIdentity(value) {
|
|
63
|
+
return value === void 0 || value === null || value === "";
|
|
64
|
+
}
|
|
65
|
+
function getOrderCollectionPersistentId(kind, item) {
|
|
66
|
+
const record = item;
|
|
67
|
+
if (!record)
|
|
68
|
+
return null;
|
|
69
|
+
const value = record[IDENTITY_CONFIG[kind].persistentIdField];
|
|
70
|
+
if (isBlankOrderCollectionIdentity(value))
|
|
71
|
+
return null;
|
|
72
|
+
return String(value);
|
|
73
|
+
}
|
|
74
|
+
function getOrderCollectionUid(kind, item) {
|
|
75
|
+
var _a;
|
|
76
|
+
const record = item;
|
|
77
|
+
if (!record)
|
|
78
|
+
return null;
|
|
79
|
+
const uidField = IDENTITY_CONFIG[kind].uidField;
|
|
80
|
+
const metadataValue = (_a = record.metadata) == null ? void 0 : _a[uidField];
|
|
81
|
+
if (!isBlankOrderCollectionIdentity(metadataValue))
|
|
82
|
+
return String(metadataValue);
|
|
83
|
+
const topLevelValue = record[uidField];
|
|
84
|
+
if (isBlankOrderCollectionIdentity(topLevelValue))
|
|
85
|
+
return null;
|
|
86
|
+
return String(topLevelValue);
|
|
87
|
+
}
|
|
88
|
+
function buildOrderCollectionFallbackUid(kind, persistentId) {
|
|
89
|
+
return `${IDENTITY_CONFIG[kind].fallbackPrefix}:${String(persistentId)}`;
|
|
90
|
+
}
|
|
91
|
+
function getOrderCollectionReferenceUid(kind, item) {
|
|
92
|
+
const uid = getOrderCollectionUid(kind, item);
|
|
93
|
+
if (uid)
|
|
94
|
+
return uid;
|
|
95
|
+
const persistentId = getOrderCollectionPersistentId(kind, item);
|
|
96
|
+
return persistentId ? buildOrderCollectionFallbackUid(kind, persistentId) : null;
|
|
97
|
+
}
|
|
98
|
+
function setOrderCollectionUid(kind, item, uid) {
|
|
99
|
+
const record = (0, import_lodash_es.cloneDeep)(item || {});
|
|
100
|
+
const uidField = IDENTITY_CONFIG[kind].uidField;
|
|
101
|
+
record.metadata = {
|
|
102
|
+
...record.metadata && typeof record.metadata === "object" ? record.metadata : {},
|
|
103
|
+
[uidField]: uid
|
|
104
|
+
};
|
|
105
|
+
delete record[uidField];
|
|
106
|
+
return record;
|
|
107
|
+
}
|
|
108
|
+
function isSameOrderCollectionItem(kind, left, right) {
|
|
109
|
+
const leftPersistentId = getOrderCollectionPersistentId(kind, left);
|
|
110
|
+
const rightPersistentId = getOrderCollectionPersistentId(kind, right);
|
|
111
|
+
if (leftPersistentId && rightPersistentId) {
|
|
112
|
+
return leftPersistentId === rightPersistentId;
|
|
113
|
+
}
|
|
114
|
+
const leftUid = getOrderCollectionUid(kind, left);
|
|
115
|
+
const rightUid = getOrderCollectionUid(kind, right);
|
|
116
|
+
return Boolean(leftUid && rightUid && leftUid === rightUid);
|
|
117
|
+
}
|
|
118
|
+
function mergeOrderCollectionItems(kind, currentItem, incomingItem, options) {
|
|
119
|
+
var _a;
|
|
120
|
+
const current = (0, import_lodash_es.cloneDeep)(currentItem || {});
|
|
121
|
+
const incoming = (0, import_lodash_es.cloneDeep)(incomingItem || {});
|
|
122
|
+
const persistentIdField = IDENTITY_CONFIG[kind].persistentIdField;
|
|
123
|
+
const currentPersistentIdValue = current[persistentIdField];
|
|
124
|
+
const incomingPersistentIdValue = incoming[persistentIdField];
|
|
125
|
+
const incomingUid = getOrderCollectionUid(kind, incoming);
|
|
126
|
+
const currentUid = getOrderCollectionUid(kind, current);
|
|
127
|
+
const persistentId = getOrderCollectionPersistentId(kind, incoming) || getOrderCollectionPersistentId(kind, current);
|
|
128
|
+
const merged = {
|
|
129
|
+
...current,
|
|
130
|
+
...incoming,
|
|
131
|
+
metadata: {
|
|
132
|
+
...current.metadata && typeof current.metadata === "object" ? current.metadata : {},
|
|
133
|
+
...incoming.metadata && typeof incoming.metadata === "object" ? incoming.metadata : {}
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
if (!isBlankOrderCollectionIdentity(incomingPersistentIdValue)) {
|
|
137
|
+
merged[persistentIdField] = incomingPersistentIdValue;
|
|
138
|
+
} else if (!isBlankOrderCollectionIdentity(currentPersistentIdValue)) {
|
|
139
|
+
merged[persistentIdField] = currentPersistentIdValue;
|
|
140
|
+
}
|
|
141
|
+
const incomingUidIsDerived = Boolean(
|
|
142
|
+
incomingUid && persistentId && (incomingUid === buildOrderCollectionFallbackUid(kind, persistentId) || incomingUid.startsWith(`${buildOrderCollectionFallbackUid(kind, persistentId)}:conflict:`))
|
|
143
|
+
);
|
|
144
|
+
const uid = (incomingUid && !incomingUidIsDerived ? incomingUid : null) || currentUid || incomingUid || ((options == null ? void 0 : options.ensureUid) === false ? null : persistentId ? buildOrderCollectionFallbackUid(kind, persistentId) : ((_a = options == null ? void 0 : options.createAnonymousUid) == null ? void 0 : _a.call(options)) || createUuidV4());
|
|
145
|
+
return uid ? setOrderCollectionUid(kind, merged, uid) : merged;
|
|
146
|
+
}
|
|
147
|
+
function createEmptyIdentityStats() {
|
|
148
|
+
return {
|
|
149
|
+
backfilledUidCount: 0,
|
|
150
|
+
collapsedDuplicateCount: 0,
|
|
151
|
+
uidConflictCount: 0,
|
|
152
|
+
anonymousRowCount: 0
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function allocateAnonymousUid(occupiedUids, createAnonymousUid) {
|
|
156
|
+
let uid = createAnonymousUid();
|
|
157
|
+
while (occupiedUids.has(uid))
|
|
158
|
+
uid = createAnonymousUid();
|
|
159
|
+
return uid;
|
|
160
|
+
}
|
|
161
|
+
function allocatePersistentConflictUid(kind, persistentId, occupiedUids) {
|
|
162
|
+
const fallbackUid = buildOrderCollectionFallbackUid(kind, persistentId);
|
|
163
|
+
if (!occupiedUids.has(fallbackUid))
|
|
164
|
+
return fallbackUid;
|
|
165
|
+
let suffix = 1;
|
|
166
|
+
let candidate = `${fallbackUid}:conflict:${suffix}`;
|
|
167
|
+
while (occupiedUids.has(candidate)) {
|
|
168
|
+
suffix += 1;
|
|
169
|
+
candidate = `${fallbackUid}:conflict:${suffix}`;
|
|
170
|
+
}
|
|
171
|
+
return candidate;
|
|
172
|
+
}
|
|
173
|
+
function normalizeOrderCollection(kind, items, options) {
|
|
174
|
+
var _a, _b;
|
|
175
|
+
const stats = createEmptyIdentityStats();
|
|
176
|
+
const uidRemaps = [];
|
|
177
|
+
const result = [];
|
|
178
|
+
const ensureUid = (options == null ? void 0 : options.ensureUid) !== false;
|
|
179
|
+
const createAnonymousUid = (options == null ? void 0 : options.createAnonymousUid) || createUuidV4;
|
|
180
|
+
for (const rawItem of items || []) {
|
|
181
|
+
const item = (0, import_lodash_es.cloneDeep)(rawItem);
|
|
182
|
+
const existingIndex = result.findIndex(
|
|
183
|
+
(existing) => isSameOrderCollectionItem(kind, existing, item)
|
|
184
|
+
);
|
|
185
|
+
if (existingIndex === -1) {
|
|
186
|
+
result.push(item);
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
const previousReferenceUid = getOrderCollectionReferenceUid(
|
|
190
|
+
kind,
|
|
191
|
+
result[existingIndex]
|
|
192
|
+
);
|
|
193
|
+
const incomingReferenceUid = getOrderCollectionReferenceUid(kind, item);
|
|
194
|
+
result[existingIndex] = mergeOrderCollectionItems(
|
|
195
|
+
kind,
|
|
196
|
+
result[existingIndex],
|
|
197
|
+
item,
|
|
198
|
+
{ ensureUid: false }
|
|
199
|
+
);
|
|
200
|
+
const nextUid = getOrderCollectionUid(kind, result[existingIndex]);
|
|
201
|
+
if (nextUid) {
|
|
202
|
+
for (const from of /* @__PURE__ */ new Set([previousReferenceUid, incomingReferenceUid])) {
|
|
203
|
+
if (!from || from === nextUid)
|
|
204
|
+
continue;
|
|
205
|
+
uidRemaps.push({
|
|
206
|
+
kind,
|
|
207
|
+
from,
|
|
208
|
+
to: nextUid,
|
|
209
|
+
persistentId: getOrderCollectionPersistentId(kind, result[existingIndex])
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
stats.collapsedDuplicateCount += 1;
|
|
214
|
+
}
|
|
215
|
+
if (!ensureUid)
|
|
216
|
+
return { items: result, stats, uidRemaps };
|
|
217
|
+
const occupiedUids = /* @__PURE__ */ new Set();
|
|
218
|
+
for (let index = 0; index < result.length; index += 1) {
|
|
219
|
+
let item = result[index];
|
|
220
|
+
const persistentId = getOrderCollectionPersistentId(kind, item);
|
|
221
|
+
let uid = getOrderCollectionUid(kind, item);
|
|
222
|
+
if (!uid) {
|
|
223
|
+
if (kind === "payment" && !isBlankOrderCollectionIdentity(item == null ? void 0 : item.payment_number)) {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
uid = persistentId ? buildOrderCollectionFallbackUid(kind, persistentId) : allocateAnonymousUid(occupiedUids, createAnonymousUid);
|
|
227
|
+
item = setOrderCollectionUid(kind, item, uid);
|
|
228
|
+
result[index] = item;
|
|
229
|
+
stats.backfilledUidCount += 1;
|
|
230
|
+
if (!persistentId)
|
|
231
|
+
stats.anonymousRowCount += 1;
|
|
232
|
+
}
|
|
233
|
+
if (occupiedUids.has(uid)) {
|
|
234
|
+
const replacementUid = persistentId ? allocatePersistentConflictUid(kind, persistentId, occupiedUids) : allocateAnonymousUid(occupiedUids, createAnonymousUid);
|
|
235
|
+
result[index] = setOrderCollectionUid(kind, item, replacementUid);
|
|
236
|
+
uidRemaps.push({
|
|
237
|
+
kind,
|
|
238
|
+
from: uid,
|
|
239
|
+
to: replacementUid,
|
|
240
|
+
persistentId,
|
|
241
|
+
scope: "linked-owner",
|
|
242
|
+
referenceOwnerUid: kind === "product" ? String(
|
|
243
|
+
(item == null ? void 0 : item.booking_uid) || ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.booking_uid) || ""
|
|
244
|
+
) || null : kind === "booking" ? String(
|
|
245
|
+
(item == null ? void 0 : item.product_uid) || ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.product_uid) || ""
|
|
246
|
+
) || null : null
|
|
247
|
+
});
|
|
248
|
+
uid = replacementUid;
|
|
249
|
+
stats.uidConflictCount += 1;
|
|
250
|
+
}
|
|
251
|
+
occupiedUids.add(uid);
|
|
252
|
+
}
|
|
253
|
+
return { items: result, stats, uidRemaps };
|
|
254
|
+
}
|
|
255
|
+
function applyOrderCollectionUidRemaps(sourceOrder, uidRemaps) {
|
|
256
|
+
var _a, _b, _c, _d, _e;
|
|
257
|
+
if (!uidRemaps.length)
|
|
258
|
+
return sourceOrder;
|
|
259
|
+
const order = (0, import_lodash_es.cloneDeep)(sourceOrder);
|
|
260
|
+
const hasAmbiguousLinkedOwner = (remap) => {
|
|
261
|
+
if (remap.scope !== "linked-owner" || !remap.referenceOwnerUid)
|
|
262
|
+
return false;
|
|
263
|
+
const ownerKind = remap.kind === "product" ? "booking" : remap.kind === "booking" ? "product" : null;
|
|
264
|
+
if (!ownerKind)
|
|
265
|
+
return false;
|
|
266
|
+
return uidRemaps.some(
|
|
267
|
+
(candidate) => candidate.scope === "linked-owner" && candidate.kind === ownerKind && candidate.from === remap.referenceOwnerUid
|
|
268
|
+
);
|
|
269
|
+
};
|
|
270
|
+
for (const remap of uidRemaps) {
|
|
271
|
+
if (remap.from === remap.to)
|
|
272
|
+
continue;
|
|
273
|
+
const linkedOwnerIsAmbiguous = hasAmbiguousLinkedOwner(remap);
|
|
274
|
+
if (remap.kind === "product") {
|
|
275
|
+
for (const booking of order.bookings || []) {
|
|
276
|
+
if (remap.scope === "linked-owner" && (linkedOwnerIsAmbiguous || getOrderCollectionUid("booking", booking) !== remap.referenceOwnerUid)) {
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
279
|
+
if (String((booking == null ? void 0 : booking.product_uid) || "") === remap.from) {
|
|
280
|
+
booking.product_uid = remap.to;
|
|
281
|
+
}
|
|
282
|
+
if (String(((_a = booking == null ? void 0 : booking.metadata) == null ? void 0 : _a.product_uid) || "") === remap.from) {
|
|
283
|
+
booking.metadata = { ...booking.metadata || {}, product_uid: remap.to };
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (remap.scope !== "linked-owner") {
|
|
287
|
+
for (const product of order.products || []) {
|
|
288
|
+
if (String(((_b = product == null ? void 0 : product.metadata) == null ? void 0 : _b.parent_unique_identification_number) || "") === remap.from) {
|
|
289
|
+
product.metadata = {
|
|
290
|
+
...product.metadata || {},
|
|
291
|
+
parent_unique_identification_number: remap.to
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
const giftInfo = (_c = product == null ? void 0 : product.metadata) == null ? void 0 : _c._giftInfo;
|
|
295
|
+
if (giftInfo && typeof giftInfo === "object") {
|
|
296
|
+
const sourceProductIds = Array.isArray(giftInfo.sourceProductIds) ? giftInfo.sourceProductIds.map(
|
|
297
|
+
(uid) => String(uid) === remap.from ? remap.to : uid
|
|
298
|
+
) : giftInfo.sourceProductIds;
|
|
299
|
+
const sourceProductId = String(giftInfo.sourceProductId || "") === remap.from ? remap.to : giftInfo.sourceProductId;
|
|
300
|
+
product.metadata = {
|
|
301
|
+
...product.metadata || {},
|
|
302
|
+
_giftInfo: {
|
|
303
|
+
...giftInfo,
|
|
304
|
+
...sourceProductIds !== void 0 ? { sourceProductIds } : {},
|
|
305
|
+
...sourceProductId !== void 0 ? { sourceProductId } : {}
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const productsByUid = (_d = order._extend) == null ? void 0 : _d.productsByUid;
|
|
312
|
+
const cachedProduct = productsByUid == null ? void 0 : productsByUid[remap.from];
|
|
313
|
+
const cachedPersistentId = getOrderCollectionPersistentId(
|
|
314
|
+
"product",
|
|
315
|
+
(cachedProduct == null ? void 0 : cachedProduct.origin) || cachedProduct
|
|
316
|
+
);
|
|
317
|
+
if (productsByUid && remap.scope === "linked-owner") {
|
|
318
|
+
const retainedProduct = (order.products || []).find(
|
|
319
|
+
(product) => getOrderCollectionUid("product", product) === remap.from
|
|
320
|
+
);
|
|
321
|
+
const remappedProduct = (order.products || []).find(
|
|
322
|
+
(product) => getOrderCollectionUid("product", product) === remap.to
|
|
323
|
+
);
|
|
324
|
+
if (cachedProduct && remap.persistentId && cachedPersistentId === remap.persistentId) {
|
|
325
|
+
productsByUid[remap.to] = {
|
|
326
|
+
...cachedProduct || {},
|
|
327
|
+
...productsByUid[remap.to] || {}
|
|
328
|
+
};
|
|
329
|
+
if (retainedProduct) {
|
|
330
|
+
productsByUid[remap.from] = {
|
|
331
|
+
...cachedProduct || {},
|
|
332
|
+
origin: (0, import_lodash_es.cloneDeep)(retainedProduct)
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
} else if (remappedProduct && !productsByUid[remap.to]) {
|
|
336
|
+
productsByUid[remap.to] = { origin: (0, import_lodash_es.cloneDeep)(remappedProduct) };
|
|
337
|
+
}
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
if (cachedProduct && remap.scope !== "linked-owner") {
|
|
341
|
+
productsByUid[remap.to] = {
|
|
342
|
+
...cachedProduct || {},
|
|
343
|
+
...productsByUid[remap.to] || {}
|
|
344
|
+
};
|
|
345
|
+
delete productsByUid[remap.from];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (remap.kind === "booking") {
|
|
349
|
+
for (const product of order.products || []) {
|
|
350
|
+
if (remap.scope === "linked-owner" && (linkedOwnerIsAmbiguous || getOrderCollectionUid("product", product) !== remap.referenceOwnerUid)) {
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
if (String((product == null ? void 0 : product.booking_uid) || "") === remap.from) {
|
|
354
|
+
product.booking_uid = remap.to;
|
|
355
|
+
}
|
|
356
|
+
if (String(((_e = product == null ? void 0 : product.metadata) == null ? void 0 : _e.booking_uid) || "") === remap.from) {
|
|
357
|
+
product.metadata = { ...product.metadata || {}, booking_uid: remap.to };
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return order;
|
|
363
|
+
}
|
|
364
|
+
function normalizeOrderCollections(sourceOrder, options) {
|
|
365
|
+
let order = (0, import_lodash_es.cloneDeep)(sourceOrder || {});
|
|
366
|
+
const orderRecord = order;
|
|
367
|
+
const productResult = normalizeOrderCollection(
|
|
368
|
+
"product",
|
|
369
|
+
Array.isArray(orderRecord.products) ? orderRecord.products : [],
|
|
370
|
+
options
|
|
371
|
+
);
|
|
372
|
+
const bookingResult = normalizeOrderCollection(
|
|
373
|
+
"booking",
|
|
374
|
+
Array.isArray(orderRecord.bookings) ? orderRecord.bookings : [],
|
|
375
|
+
options
|
|
376
|
+
);
|
|
377
|
+
const paymentResult = normalizeOrderCollection(
|
|
378
|
+
"payment",
|
|
379
|
+
Array.isArray(orderRecord.payments) ? orderRecord.payments : [],
|
|
380
|
+
options
|
|
381
|
+
);
|
|
382
|
+
if (Array.isArray(orderRecord.products))
|
|
383
|
+
orderRecord.products = productResult.items;
|
|
384
|
+
if (Array.isArray(orderRecord.bookings))
|
|
385
|
+
orderRecord.bookings = bookingResult.items;
|
|
386
|
+
if (Array.isArray(orderRecord.payments))
|
|
387
|
+
orderRecord.payments = paymentResult.items;
|
|
388
|
+
const uidRemaps = [
|
|
389
|
+
...productResult.uidRemaps,
|
|
390
|
+
...bookingResult.uidRemaps,
|
|
391
|
+
...paymentResult.uidRemaps
|
|
392
|
+
];
|
|
393
|
+
order = applyOrderCollectionUidRemaps(order, uidRemaps);
|
|
394
|
+
return {
|
|
395
|
+
order,
|
|
396
|
+
stats: {
|
|
397
|
+
product: productResult.stats,
|
|
398
|
+
booking: bookingResult.stats,
|
|
399
|
+
payment: paymentResult.stats
|
|
400
|
+
},
|
|
401
|
+
uidRemaps
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
405
|
+
0 && (module.exports = {
|
|
406
|
+
applyOrderCollectionUidRemaps,
|
|
407
|
+
buildOrderCollectionFallbackUid,
|
|
408
|
+
createUuidV4,
|
|
409
|
+
getOrderCollectionPersistentId,
|
|
410
|
+
getOrderCollectionReferenceUid,
|
|
411
|
+
getOrderCollectionUid,
|
|
412
|
+
isBlankOrderCollectionIdentity,
|
|
413
|
+
isSameOrderCollectionItem,
|
|
414
|
+
mergeOrderCollectionItems,
|
|
415
|
+
normalizeOrderCollection,
|
|
416
|
+
normalizeOrderCollections,
|
|
417
|
+
setOrderCollectionUid
|
|
418
|
+
});
|
|
@@ -3,6 +3,7 @@ import type { CartItem } from "../Cart";
|
|
|
3
3
|
import type { OrderProductDiscountItem, OrderProduct, OrderSubmitPayload, OrderSubmitProduct, OrderSummary, OrderTempOrder } from './types';
|
|
4
4
|
import type { RulesParamsHooks } from '../Rules/types';
|
|
5
5
|
import type { MapOrderPaymentsOptions, OrderPaymentData, OrderPaymentSource } from './types';
|
|
6
|
+
import { createUuidV4 } from './utils/orderCollectionIdentity';
|
|
6
7
|
export interface OrderProductsDepositProtocol {
|
|
7
8
|
id: number;
|
|
8
9
|
title: string;
|
|
@@ -67,8 +68,8 @@ export declare function sumOptionUnitPrice(options?: Array<{
|
|
|
67
68
|
/**
|
|
68
69
|
* 仅基于 tempOrder.products 重算整单定金。
|
|
69
70
|
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
71
|
+
* 商品折扣在进入定金计算前已体现在商品行价格字段中,
|
|
72
|
+
* 因此这里只按商品定金规则汇总,不再扣减 discount_list;tempOrder.bookings 不参与这里的计算。
|
|
72
73
|
*/
|
|
73
74
|
export declare function calculateOrderProductsDeposit(products?: OrderProduct[], options?: {
|
|
74
75
|
productsByUid?: Record<string, Record<string, any>>;
|
|
@@ -177,7 +178,7 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
177
178
|
form_record_ids: number[];
|
|
178
179
|
}[];
|
|
179
180
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
180
|
-
export
|
|
181
|
+
export { createUuidV4 };
|
|
181
182
|
export declare function isTempOrder(data: any): data is OrderTempOrder;
|
|
182
183
|
export declare function formatDateTime(date: Date): string;
|
|
183
184
|
export declare function normalizeBookingIsAll(booking: Record<string, any>): 0 | 1;
|
|
@@ -37,7 +37,7 @@ __export(utils_exports, {
|
|
|
37
37
|
createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
|
|
38
38
|
createDefaultTempOrder: () => createDefaultTempOrder,
|
|
39
39
|
createEmptySummary: () => import_utils2.createEmptySummary,
|
|
40
|
-
createUuidV4: () => createUuidV4,
|
|
40
|
+
createUuidV4: () => import_orderCollectionIdentity.createUuidV4,
|
|
41
41
|
ensureManualProductDiscountList: () => import_manualProductDiscount.ensureManualProductDiscountList,
|
|
42
42
|
ensureProductSku: () => ensureProductSku,
|
|
43
43
|
findManualProductDiscountItem: () => import_manualProductDiscount.findManualProductDiscountItem,
|
|
@@ -86,6 +86,7 @@ module.exports = __toCommonJS(utils_exports);
|
|
|
86
86
|
var import_dayjs = __toESM(require("dayjs"));
|
|
87
87
|
var import_decimal = __toESM(require("decimal.js"));
|
|
88
88
|
var import_utils = require("../../solution/ScanOrder/utils");
|
|
89
|
+
var import_orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
89
90
|
var import_utils2 = require("../../solution/ScanOrder/utils");
|
|
90
91
|
var import_manualProductDiscount = require("./utils/manualProductDiscount");
|
|
91
92
|
function composeLinePrice(params) {
|
|
@@ -286,9 +287,6 @@ function calculateOrderProductsDeposit(products = [], options) {
|
|
|
286
287
|
if (!(deposit == null ? void 0 : deposit.total) || Number(deposit.total) <= 0)
|
|
287
288
|
continue;
|
|
288
289
|
total = total.plus(deposit.total);
|
|
289
|
-
for (const discount of product.discount_list || []) {
|
|
290
|
-
total = total.minus((discount == null ? void 0 : discount.amount) || 0);
|
|
291
|
-
}
|
|
292
290
|
for (const protocol of deposit.protocols || []) {
|
|
293
291
|
if (!protocolMap.has(protocol.id))
|
|
294
292
|
protocolMap.set(protocol.id, protocol);
|
|
@@ -446,12 +444,7 @@ function resolveEffectivePerUnitDiscount(product) {
|
|
|
446
444
|
(sum, discount) => sum + Number((discount == null ? void 0 : discount.amount) || 0),
|
|
447
445
|
0
|
|
448
446
|
);
|
|
449
|
-
const hasPromoDiscountItem = discountList.some(
|
|
450
|
-
(item) => {
|
|
451
|
-
var _a, _b;
|
|
452
|
-
return (item == null ? void 0 : item.type) === "promotion" || (item == null ? void 0 : item.type) === "product" && ((_a = item == null ? void 0 : item.metadata) == null ? void 0 : _a.source) === "promotion" && ((_b = item == null ? void 0 : item.metadata) == null ? void 0 : _b.actionType) === "ITEM_REWARD";
|
|
453
|
-
}
|
|
454
|
-
);
|
|
447
|
+
const hasPromoDiscountItem = discountList.some((item) => (item == null ? void 0 : item.type) === "promotion");
|
|
455
448
|
if (hasPromoDiscountItem)
|
|
456
449
|
return fromList;
|
|
457
450
|
const metadata = (product == null ? void 0 : product.metadata) || {};
|
|
@@ -500,13 +493,17 @@ function createDefaultOrderRulesHooks() {
|
|
|
500
493
|
const current = currentByIdentity.get(getBundleIdentity(bundle));
|
|
501
494
|
if (!current)
|
|
502
495
|
return bundle;
|
|
496
|
+
const bundleWithDisplayFields = {
|
|
497
|
+
...bundle,
|
|
498
|
+
...isEmptyOrderProductDisplayValue(bundle.cover) && !isEmptyOrderProductDisplayValue(current.cover) ? { cover: current.cover } : {}
|
|
499
|
+
};
|
|
503
500
|
const isProductPriceBundle = (bundle.price_type_ext ?? current.price_type_ext) === "product_price";
|
|
504
501
|
if (!isProductPriceBundle)
|
|
505
|
-
return
|
|
502
|
+
return bundleWithDisplayFields;
|
|
506
503
|
const sourcePrice = current.price ?? current.custom_price ?? current.original_price ?? current.bundle_selling_price;
|
|
507
504
|
const originalPrice = current.original_price ?? current.product_price ?? current.price ?? current.custom_price ?? sourcePrice;
|
|
508
505
|
return {
|
|
509
|
-
...
|
|
506
|
+
...bundleWithDisplayFields,
|
|
510
507
|
...sourcePrice !== void 0 ? { price: sourcePrice } : {},
|
|
511
508
|
...originalPrice !== void 0 ? { original_price: originalPrice } : {},
|
|
512
509
|
...current.original_total !== void 0 ? { original_total: current.original_total } : {}
|
|
@@ -645,14 +642,6 @@ var getAllDiscountList = (cartItem) => {
|
|
|
645
642
|
});
|
|
646
643
|
return discountList;
|
|
647
644
|
};
|
|
648
|
-
function createUuidV4() {
|
|
649
|
-
const template = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";
|
|
650
|
-
return template.replace(/[xy]/g, (char) => {
|
|
651
|
-
const randomValue = Math.floor(Math.random() * 16);
|
|
652
|
-
const value = char === "x" ? randomValue : randomValue & 3 | 8;
|
|
653
|
-
return value.toString(16);
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
645
|
function isTempOrder(data) {
|
|
657
646
|
if (!data || typeof data !== "object")
|
|
658
647
|
return false;
|
|
@@ -750,6 +739,7 @@ function formatSubmitBundleItems(bundle) {
|
|
|
750
739
|
bundle_group_id: (rawBundle == null ? void 0 : rawBundle.bundle_group_id) ?? (rawBundle == null ? void 0 : rawBundle.group_id),
|
|
751
740
|
bundle_id: (rawBundle == null ? void 0 : rawBundle.bundle_id) ?? (rawBundle == null ? void 0 : rawBundle.id),
|
|
752
741
|
bundle_product_id: (rawBundle == null ? void 0 : rawBundle.bundle_product_id) ?? (rawBundle == null ? void 0 : rawBundle._bundle_product_id),
|
|
742
|
+
cover: rawBundle.cover,
|
|
753
743
|
metadata: {
|
|
754
744
|
...submitMetadata,
|
|
755
745
|
...hasSubmitBundleDiscounts && bundleMapId !== void 0 ? { custom_product_bundle_map_id: bundleMapId } : {},
|
|
@@ -808,6 +798,9 @@ function normalizeSubmitProduct(product) {
|
|
|
808
798
|
if (rawMetadata.is_rule !== void 0) {
|
|
809
799
|
cleanMetadata.is_rule = rawMetadata.is_rule;
|
|
810
800
|
}
|
|
801
|
+
if (rawMetadata.holder_config !== void 0) {
|
|
802
|
+
cleanMetadata.holder_config = rawMetadata.holder_config;
|
|
803
|
+
}
|
|
811
804
|
const productSku = {
|
|
812
805
|
...submitProduct.product_sku && typeof submitProduct.product_sku === "object" ? submitProduct.product_sku : {},
|
|
813
806
|
option: formatSubmitOptionItems((_a = submitProduct.product_sku) == null ? void 0 : _a.option)
|
|
@@ -938,7 +931,7 @@ function buildSubmitPayload(params) {
|
|
|
938
931
|
enhance
|
|
939
932
|
} = params;
|
|
940
933
|
const scheduleDate = tempOrder.schedule_date || tempOrder.created_at || formatDateTime(now);
|
|
941
|
-
const bookingUuid = createUuidV4();
|
|
934
|
+
const bookingUuid = (0, import_orderCollectionIdentity.createUuidV4)();
|
|
942
935
|
const {
|
|
943
936
|
_extend,
|
|
944
937
|
relation_id: _relationId,
|
|
@@ -972,6 +965,9 @@ function buildSubmitPayload(params) {
|
|
|
972
965
|
...tempOrderRest,
|
|
973
966
|
customer_id: tempOrder.customer_id ?? 1,
|
|
974
967
|
customer_name: tempOrder.customer_name || "Walk-In",
|
|
968
|
+
country_calling_code: String(tempOrder.country_calling_code ?? ""),
|
|
969
|
+
phone: String(tempOrder.phone ?? ""),
|
|
970
|
+
email: String(tempOrder.email ?? ""),
|
|
975
971
|
order_number: tempOrder.order_number ?? null,
|
|
976
972
|
shop_order_number: tempOrder.shop_order_number ?? null,
|
|
977
973
|
shop_full_order_number: tempOrder.shop_full_order_number ?? null,
|
|
@@ -1027,9 +1023,7 @@ function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
1027
1023
|
const item = paymentItem;
|
|
1028
1024
|
const customPaymentId = item.custom_payment_id ?? item.id;
|
|
1029
1025
|
const metadata = item.metadata && typeof item.metadata === "object" ? { ...item.metadata } : {};
|
|
1030
|
-
|
|
1031
|
-
metadata.unique_payment_number = String(item.uuid);
|
|
1032
|
-
}
|
|
1026
|
+
const paymentNumber = item.payment_number;
|
|
1033
1027
|
const paymentMetadataKeys = [
|
|
1034
1028
|
"rounding_rule",
|
|
1035
1029
|
"shop_wallet_pass_id",
|
|
@@ -1046,6 +1040,7 @@ function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
1046
1040
|
const createdAt = item.created_at ?? timestamp;
|
|
1047
1041
|
return {
|
|
1048
1042
|
...item.order_payment_id !== void 0 ? { order_payment_id: item.order_payment_id } : {},
|
|
1043
|
+
...paymentNumber !== void 0 && paymentNumber !== null && paymentNumber !== "" ? { payment_number: String(paymentNumber) } : {},
|
|
1049
1044
|
amount: String(item.amount ?? "0.00"),
|
|
1050
1045
|
code: String(item.code || ""),
|
|
1051
1046
|
custom_payment_id: Number(customPaymentId ?? 0),
|
|
@@ -1086,7 +1081,7 @@ function formatV1Product(products) {
|
|
|
1086
1081
|
note: String(product.note ?? ""),
|
|
1087
1082
|
rowKey: product.product_id,
|
|
1088
1083
|
session: null,
|
|
1089
|
-
unique: createUuidV4()
|
|
1084
|
+
unique: (0, import_orderCollectionIdentity.createUuidV4)()
|
|
1090
1085
|
};
|
|
1091
1086
|
});
|
|
1092
1087
|
}
|
|
@@ -1164,11 +1159,16 @@ function isHolderConfigRequired(holderConfig) {
|
|
|
1164
1159
|
return Number(holderConfig.required) === 1;
|
|
1165
1160
|
}
|
|
1166
1161
|
function productRequiresFormSubject(tempOrder, product) {
|
|
1162
|
+
var _a, _b;
|
|
1163
|
+
const _orderProduct = (_a = tempOrder == null ? void 0 : tempOrder.products) == null ? void 0 : _a.find((item) => {
|
|
1164
|
+
return item.metadata.unique_identification_number === product._id || item.product_id === product.id;
|
|
1165
|
+
});
|
|
1167
1166
|
const runtimeOrigin = getRuntimeProductOrigin(tempOrder, product);
|
|
1168
|
-
return isHolderConfigRequired(
|
|
1167
|
+
return isHolderConfigRequired((_b = _orderProduct == null ? void 0 : _orderProduct.metadata) == null ? void 0 : _b.holder_config) || isHolderConfigRequired(runtimeOrigin == null ? void 0 : runtimeOrigin.holder_config) || isHolderConfigRequired(product == null ? void 0 : product.holder_config);
|
|
1169
1168
|
}
|
|
1170
1169
|
function resolveIsFormSubject(tempOrder, product) {
|
|
1171
1170
|
var _a;
|
|
1171
|
+
debugger;
|
|
1172
1172
|
if (((_a = tempOrder == null ? void 0 : tempOrder.holder) == null ? void 0 : _a.type) === "form")
|
|
1173
1173
|
return true;
|
|
1174
1174
|
if (product)
|
|
@@ -1197,6 +1197,7 @@ function mergeOrderProductDisplayFields(previous, next) {
|
|
|
1197
1197
|
"product_name",
|
|
1198
1198
|
"product_cover",
|
|
1199
1199
|
"cover",
|
|
1200
|
+
"product_cover",
|
|
1200
1201
|
"variant_title",
|
|
1201
1202
|
"product_sku",
|
|
1202
1203
|
"payment_price"
|
|
@@ -20,6 +20,7 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
20
20
|
protected defaultVersion: string;
|
|
21
21
|
request: RequestPlugin;
|
|
22
22
|
private app;
|
|
23
|
+
private appPlugin;
|
|
23
24
|
private store;
|
|
24
25
|
window: WindowPlugin;
|
|
25
26
|
private dbManager;
|
|
@@ -40,6 +41,7 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
40
41
|
* paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
|
|
41
42
|
*/
|
|
42
43
|
updateOtherParams(params: Record<string, any>): void;
|
|
44
|
+
private getPaymentNumberAppData;
|
|
43
45
|
/**
|
|
44
46
|
* 记录信息日志
|
|
45
47
|
*/
|