@pisell/pisellos 2.3.38 → 2.3.39
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/core/index.d.ts +0 -2
- package/dist/core/index.js +0 -7
- 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/type.d.ts +2 -90
- package/dist/model/strategy/adapter/promotion/type.js +0 -45
- package/dist/modules/BookingContext/utils/buildCacheItemFromOrderLine.js +3 -5
- package/dist/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +3 -6
- package/dist/modules/Discount/index.d.ts +1 -0
- package/dist/modules/Discount/index.js +40 -11
- package/dist/modules/Discount/types.d.ts +1 -0
- package/dist/modules/Holder/index.d.ts +48 -0
- package/dist/modules/Holder/index.js +640 -0
- package/dist/modules/Holder/types.d.ts +123 -0
- package/dist/modules/Holder/types.js +1 -0
- package/dist/modules/Holder/utils.d.ts +13 -0
- package/dist/modules/Holder/utils.js +34 -0
- package/dist/modules/OpenData/index.d.ts +0 -2
- package/dist/modules/OpenData/index.js +2 -10
- package/dist/modules/Order/index.d.ts +11 -28
- package/dist/modules/Order/index.js +509 -750
- package/dist/modules/Order/types.d.ts +10 -33
- package/dist/modules/Order/utils/orderCollectionIdentity.js +2 -7
- package/dist/modules/Order/utils.d.ts +10 -0
- package/dist/modules/Order/utils.js +41 -13
- package/dist/modules/Payment/index.d.ts +0 -2
- package/dist/modules/Payment/index.js +50 -79
- package/dist/modules/Payment/types.d.ts +28 -99
- package/dist/modules/Payment/types.js +3 -20
- package/dist/modules/Payment/walletpass.d.ts +1 -25
- package/dist/modules/Payment/walletpass.js +157 -707
- package/dist/modules/Product/types.d.ts +1 -0
- package/dist/modules/ProductList/index.js +33 -14
- package/dist/modules/Quotation/index.d.ts +1 -1
- package/dist/modules/Quotation/index.js +2 -2
- package/dist/modules/ResourcePlanner/index.d.ts +24 -0
- package/dist/modules/ResourcePlanner/index.js +181 -0
- package/dist/modules/ResourcePlanner/planner.d.ts +14 -0
- package/dist/modules/ResourcePlanner/planner.js +1069 -0
- package/dist/modules/ResourcePlanner/types.d.ts +227 -0
- package/dist/modules/ResourcePlanner/types.js +1 -0
- package/dist/modules/Rules/index.d.ts +0 -1
- package/dist/modules/Rules/index.js +96 -89
- package/dist/modules/SalesSummary/index.js +12 -13
- package/dist/modules/ScanOrderLogger/index.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/index.js +15 -2
- package/dist/modules/ScanOrderLogger/providers/feishu.js +45 -27
- package/dist/modules/ScanOrderLogger/types.d.ts +1 -0
- package/dist/modules/Schedule/index.d.ts +3 -1
- package/dist/modules/Schedule/index.js +21 -16
- package/dist/modules/Summary/utils.js +38 -13
- package/dist/modules/index.d.ts +2 -0
- package/dist/modules/index.js +3 -1
- package/dist/plugins/window.d.ts +1 -0
- package/dist/server/index.d.ts +14 -16
- package/dist/server/index.js +1148 -1930
- package/dist/server/modules/order/index.d.ts +4 -54
- package/dist/server/modules/order/index.js +695 -1595
- package/dist/server/modules/order/types.d.ts +3 -11
- package/dist/server/modules/order/types.js +1 -1
- package/dist/solution/BaseSales/index.d.ts +20 -109
- package/dist/solution/BaseSales/index.js +481 -1797
- package/dist/solution/BaseSales/types.d.ts +0 -52
- package/dist/solution/BaseSales/types.js +1 -2
- package/dist/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/dist/solution/BaseSales/utils/cartPromotion.js +31 -90
- package/dist/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/dist/solution/BookingByStep/index.d.ts +17 -2
- package/dist/solution/BookingByStep/index.js +294 -215
- package/dist/solution/BookingByStep/types.d.ts +2 -1
- package/dist/solution/BookingByStep/types.js +3 -1
- package/dist/solution/BookingByStep/utils/capacity.js +17 -1
- package/dist/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/dist/solution/BookingByStep/utils/timeslots.js +19 -12
- package/dist/solution/BookingTicket/index.d.ts +3 -7
- package/dist/solution/BookingTicket/index.js +49 -132
- package/dist/solution/BookingTicket/utils/addProductDecision.js +0 -6
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/dist/solution/BookingTicket/utils/scan/applyGlobalScan.js +82 -172
- package/dist/solution/Sales/index.d.ts +0 -1
- package/dist/solution/Sales/index.js +2 -10
- package/dist/solution/ScanOrder/index.d.ts +26 -14
- package/dist/solution/ScanOrder/index.js +1148 -756
- package/dist/solution/ScanOrder/types.d.ts +21 -1
- package/dist/solution/ScanOrder/utils.d.ts +8 -0
- package/dist/solution/ScanOrder/utils.js +66 -25
- package/dist/solution/ShopDiscount/index.d.ts +1 -0
- package/dist/solution/ShopDiscount/index.js +125 -87
- package/dist/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/dist/solution/UnifiedBookingSales/index.js +1871 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/dist/solution/UnifiedBookingSales/types.js +11 -0
- package/dist/solution/VenueBooking/index.d.ts +39 -11
- package/dist/solution/VenueBooking/index.js +1176 -860
- package/dist/solution/VenueBooking/types.d.ts +3 -0
- package/dist/solution/VenueBooking/utils/resource.js +1 -0
- package/dist/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/dist/solution/VenueBooking/utils/slotMerge.js +10 -5
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +2 -1
- package/dist/types/index.d.ts +1 -1
- package/lib/core/index.d.ts +0 -2
- package/lib/core/index.js +0 -4
- 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 -51
- 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 +1 -2
- package/lib/modules/BookingContext/utils/buildNormalProductCacheItemFromOrderLine.js +1 -2
- package/lib/modules/Discount/index.d.ts +1 -0
- package/lib/modules/Discount/index.js +9 -0
- package/lib/modules/Discount/types.d.ts +1 -0
- package/lib/modules/Holder/index.d.ts +48 -0
- package/lib/modules/Holder/index.js +402 -0
- package/lib/modules/Holder/types.d.ts +123 -0
- package/lib/modules/Holder/types.js +17 -0
- package/lib/modules/Holder/utils.d.ts +13 -0
- package/lib/modules/Holder/utils.js +71 -0
- package/lib/modules/OpenData/index.d.ts +0 -2
- package/lib/modules/OpenData/index.js +1 -6
- package/lib/modules/Order/index.d.ts +11 -28
- package/lib/modules/Order/index.js +86 -196
- package/lib/modules/Order/types.d.ts +10 -33
- package/lib/modules/Order/utils/orderCollectionIdentity.js +0 -3
- package/lib/modules/Order/utils.d.ts +10 -0
- package/lib/modules/Order/utils.js +40 -16
- package/lib/modules/Payment/index.d.ts +0 -2
- package/lib/modules/Payment/index.js +13 -34
- package/lib/modules/Payment/types.d.ts +28 -99
- package/lib/modules/Payment/types.js +3 -4
- package/lib/modules/Payment/walletpass.d.ts +1 -25
- package/lib/modules/Payment/walletpass.js +21 -470
- package/lib/modules/Product/types.d.ts +1 -0
- package/lib/modules/ProductList/index.js +40 -31
- package/lib/modules/Quotation/index.d.ts +1 -1
- package/lib/modules/Quotation/index.js +2 -2
- package/lib/modules/ResourcePlanner/index.d.ts +24 -0
- package/lib/modules/ResourcePlanner/index.js +148 -0
- package/lib/modules/ResourcePlanner/planner.d.ts +14 -0
- package/lib/modules/ResourcePlanner/planner.js +933 -0
- package/lib/modules/ResourcePlanner/types.d.ts +227 -0
- package/lib/modules/ResourcePlanner/types.js +17 -0
- package/lib/modules/Rules/index.d.ts +0 -1
- package/lib/modules/Rules/index.js +40 -47
- package/lib/modules/SalesSummary/index.js +6 -7
- package/lib/modules/ScanOrderLogger/index.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/index.js +13 -1
- package/lib/modules/ScanOrderLogger/providers/feishu.js +15 -6
- package/lib/modules/ScanOrderLogger/types.d.ts +1 -0
- package/lib/modules/Schedule/index.d.ts +3 -1
- package/lib/modules/Schedule/index.js +10 -8
- package/lib/modules/Summary/utils.js +21 -1
- package/lib/modules/index.d.ts +2 -0
- package/lib/modules/index.js +5 -1
- package/lib/plugins/window.d.ts +1 -0
- package/lib/server/index.d.ts +14 -16
- package/lib/server/index.js +83 -675
- package/lib/server/modules/order/index.d.ts +4 -54
- package/lib/server/modules/order/index.js +66 -679
- package/lib/server/modules/order/types.d.ts +3 -11
- package/lib/solution/BaseSales/index.d.ts +20 -109
- package/lib/solution/BaseSales/index.js +70 -881
- package/lib/solution/BaseSales/types.d.ts +0 -52
- package/lib/solution/BaseSales/types.js +1 -2
- package/lib/solution/BaseSales/utils/cartPromotion.d.ts +1 -3
- package/lib/solution/BaseSales/utils/cartPromotion.js +12 -63
- package/lib/solution/BaseSales/utils/parseSalesResponse.d.ts +1 -6
- package/lib/solution/BookingByStep/index.d.ts +17 -2
- package/lib/solution/BookingByStep/index.js +60 -18
- package/lib/solution/BookingByStep/types.d.ts +2 -1
- package/lib/solution/BookingByStep/types.js +5 -0
- package/lib/solution/BookingByStep/utils/capacity.js +20 -1
- package/lib/solution/BookingByStep/utils/timeslots.d.ts +3 -1
- package/lib/solution/BookingByStep/utils/timeslots.js +19 -11
- package/lib/solution/BookingTicket/index.d.ts +3 -7
- package/lib/solution/BookingTicket/index.js +9 -62
- package/lib/solution/BookingTicket/utils/addProductDecision.js +0 -4
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.d.ts +0 -8
- package/lib/solution/BookingTicket/utils/scan/applyGlobalScan.js +4 -36
- package/lib/solution/Sales/index.d.ts +0 -1
- package/lib/solution/Sales/index.js +3 -5
- package/lib/solution/ScanOrder/index.d.ts +26 -14
- package/lib/solution/ScanOrder/index.js +449 -190
- package/lib/solution/ScanOrder/types.d.ts +21 -1
- package/lib/solution/ScanOrder/utils.d.ts +8 -0
- package/lib/solution/ScanOrder/utils.js +31 -0
- package/lib/solution/ShopDiscount/index.d.ts +1 -0
- package/lib/solution/ShopDiscount/index.js +14 -0
- package/lib/solution/UnifiedBookingSales/index.d.ts +183 -0
- package/lib/solution/UnifiedBookingSales/index.js +1076 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +143 -0
- package/lib/solution/UnifiedBookingSales/types.js +33 -0
- package/lib/solution/VenueBooking/index.d.ts +39 -11
- package/lib/solution/VenueBooking/index.js +328 -123
- package/lib/solution/VenueBooking/types.d.ts +3 -0
- package/lib/solution/VenueBooking/utils/resource.js +1 -0
- package/lib/solution/VenueBooking/utils/slotMerge.d.ts +4 -4
- package/lib/solution/VenueBooking/utils/slotMerge.js +6 -4
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +3 -1
- package/lib/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/modules/Order/payment-utils.d.ts +0 -26
- package/dist/modules/Order/payment-utils.js +0 -225
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/dist/solution/BookingTicket/utils/weighingProductSku.js +0 -45
- package/dist/utils/payment-number.d.ts +0 -9
- package/dist/utils/payment-number.js +0 -69
- package/lib/modules/Order/payment-utils.d.ts +0 -26
- package/lib/modules/Order/payment-utils.js +0 -224
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +0 -5
- package/lib/solution/BookingTicket/utils/weighingProductSku.js +0 -63
- package/lib/utils/payment-number.d.ts +0 -9
- package/lib/utils/payment-number.js +0 -64
|
@@ -394,6 +394,7 @@ export interface CommitOrderParams {
|
|
|
394
394
|
type: 'virtual' | 'appointment_booking';
|
|
395
395
|
platform?: string;
|
|
396
396
|
extraData?: Record<string, any>;
|
|
397
|
+
business_code?: string;
|
|
397
398
|
};
|
|
398
399
|
}
|
|
399
400
|
export interface OrderSubmitBooking {
|
|
@@ -468,8 +469,6 @@ export interface SubmitSalesOrderParams {
|
|
|
468
469
|
export interface PaymentItemData {
|
|
469
470
|
/** 当前支付项的唯一 ID */
|
|
470
471
|
uuid: string;
|
|
471
|
-
/** 支付项稳定唯一号 */
|
|
472
|
-
payment_number?: string;
|
|
473
472
|
/** 当前支付方式付出去多少钱 */
|
|
474
473
|
amount: string;
|
|
475
474
|
/** 支付类型代码 */
|
|
@@ -492,22 +491,13 @@ export interface PaymentItemData {
|
|
|
492
491
|
export interface OrderPaymentMetadata {
|
|
493
492
|
rounding_rule?: Record<string, any>;
|
|
494
493
|
unique_payment_number?: string;
|
|
495
|
-
/** 刷卡机设备快照;OS 不解析内部字段,仅透传并持久化 */
|
|
496
|
-
card_reader_snapshot?: Record<string, unknown>;
|
|
497
494
|
shop_wallet_pass_id?: number | string;
|
|
498
495
|
actual_paid_amount?: number | string;
|
|
499
496
|
change_given_amount?: number | string;
|
|
500
|
-
transactions?: OrderPaymentTransaction[];
|
|
501
497
|
[key: string]: any;
|
|
502
498
|
}
|
|
503
|
-
export interface OrderPaymentTransaction {
|
|
504
|
-
number: string;
|
|
505
|
-
status: 'success' | 'fail';
|
|
506
|
-
}
|
|
507
499
|
export interface OrderPaymentData {
|
|
508
500
|
order_payment_id?: number | string;
|
|
509
|
-
/** 支付项稳定唯一号;历史支付项允许缺失 */
|
|
510
|
-
payment_number?: string;
|
|
511
501
|
amount: string;
|
|
512
502
|
code: string;
|
|
513
503
|
custom_payment_id: number;
|
|
@@ -534,15 +524,6 @@ export interface OrderPaymentData {
|
|
|
534
524
|
created_at?: string;
|
|
535
525
|
updated_at?: string;
|
|
536
526
|
}
|
|
537
|
-
export interface OrderPaymentUpdateOptions {
|
|
538
|
-
matchBy?: 'payment_number' | 'compat' | 'legacy';
|
|
539
|
-
}
|
|
540
|
-
export interface OrderPaymentUpdateResult {
|
|
541
|
-
updated: boolean;
|
|
542
|
-
payment: OrderPaymentData | null;
|
|
543
|
-
payments: OrderPaymentData[];
|
|
544
|
-
summary: OrderSummary | null;
|
|
545
|
-
}
|
|
546
527
|
export type OrderPaymentSource = PaymentItem | OrderPaymentData | Record<string, any>;
|
|
547
528
|
export interface MapOrderPaymentsOptions {
|
|
548
529
|
includeVoided?: boolean;
|
|
@@ -569,6 +550,12 @@ export interface SyncPaymentsToOrderParams {
|
|
|
569
550
|
payments: OrderPaymentSource[];
|
|
570
551
|
paymentStatus?: SubmitSalesOrderParams['query']['payment_status'];
|
|
571
552
|
submitWhenPaid?: boolean;
|
|
553
|
+
/**
|
|
554
|
+
* Whether the checkout should be queued as the local `sync_sales` task.
|
|
555
|
+
* Defaults to true to preserve the WebPOS retry path. Set to false when
|
|
556
|
+
* the caller must wait for the cloud checkout response before proceeding.
|
|
557
|
+
*/
|
|
558
|
+
checkoutSyncTaskEnabled?: boolean;
|
|
572
559
|
smallTicketDataFlag?: number;
|
|
573
560
|
businessCode?: string;
|
|
574
561
|
channel?: string;
|
|
@@ -693,14 +680,6 @@ export interface OrderModuleAPI {
|
|
|
693
680
|
channel?: string;
|
|
694
681
|
type?: string;
|
|
695
682
|
}) => OrderSubmitPayload;
|
|
696
|
-
saveTempOrderAsDraft: <T = any>(params?: {
|
|
697
|
-
cacheId?: string;
|
|
698
|
-
platform?: string;
|
|
699
|
-
businessCode?: string;
|
|
700
|
-
channel?: string;
|
|
701
|
-
type?: string;
|
|
702
|
-
enhancePayload?: SubmitPayloadEnhancer;
|
|
703
|
-
}) => Promise<T>;
|
|
704
683
|
applyLocalPrintOrderNumbers: (order?: Record<string, any> | null) => Promise<OrderTempOrder>;
|
|
705
684
|
getTempOrderNote: () => string;
|
|
706
685
|
updateTempOrderNote: {
|
|
@@ -731,6 +710,8 @@ export interface OrderModuleAPI {
|
|
|
731
710
|
setEnableTempOrderPersist: (enabled: boolean) => void;
|
|
732
711
|
/** 是否允许 saveDraft 写入 IndexedDB 草稿。 */
|
|
733
712
|
isTempOrderPersistEnabled: () => boolean;
|
|
713
|
+
/** 提交 tempOrder 变更并触发 `{moduleName}:changed` 事件 */
|
|
714
|
+
notifyTempOrderChanged: () => void;
|
|
734
715
|
submitTempOrder: <T = any>(params?: {
|
|
735
716
|
cacheId?: string;
|
|
736
717
|
platform?: string;
|
|
@@ -758,15 +739,11 @@ export interface OrderModuleAPI {
|
|
|
758
739
|
getOrderPayments: () => OrderPaymentData[];
|
|
759
740
|
setOrderPayments: (payments: OrderPaymentSource[]) => OrderPaymentData[];
|
|
760
741
|
addOrderPayment: (payment: OrderPaymentSource) => OrderPaymentData[];
|
|
761
|
-
|
|
762
|
-
updateOrderPayment: (paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>, options?: OrderPaymentUpdateOptions) => Promise<OrderPaymentUpdateResult>;
|
|
742
|
+
updateOrderPayment: (paymentIdentity: string | number, updates: Partial<OrderPaymentData> & Record<string, any>) => OrderPaymentData[];
|
|
763
743
|
deleteOrderPayment: (paymentIdentity: string | number) => OrderPaymentData[];
|
|
764
744
|
updateVoucherOrderPayments: (payments: OrderPaymentSource[], options?: {
|
|
765
745
|
status?: 'paid' | 'payment_pending';
|
|
766
746
|
}) => OrderPaymentData[];
|
|
767
|
-
updateVoucherOrderPaymentsAsync: (payments: OrderPaymentSource[], options?: {
|
|
768
|
-
status?: 'paid' | 'payment_pending';
|
|
769
|
-
}) => Promise<OrderPaymentData[]>;
|
|
770
747
|
confirmPendingVoucherPayments: (options?: {
|
|
771
748
|
persist?: boolean;
|
|
772
749
|
recalculateSummary?: boolean;
|
|
@@ -220,9 +220,6 @@ function normalizeOrderCollection(kind, items, options) {
|
|
|
220
220
|
const persistentId = getOrderCollectionPersistentId(kind, item);
|
|
221
221
|
let uid = getOrderCollectionUid(kind, item);
|
|
222
222
|
if (!uid) {
|
|
223
|
-
if (kind === "payment" && !isBlankOrderCollectionIdentity(item == null ? void 0 : item.payment_number)) {
|
|
224
|
-
continue;
|
|
225
|
-
}
|
|
226
223
|
uid = persistentId ? buildOrderCollectionFallbackUid(kind, persistentId) : allocateAnonymousUid(occupiedUids, createAnonymousUid);
|
|
227
224
|
item = setOrderCollectionUid(kind, item, uid);
|
|
228
225
|
result[index] = item;
|
|
@@ -15,6 +15,7 @@ export interface OrderProductsDepositSummary {
|
|
|
15
15
|
deposit_policy_ids: number[];
|
|
16
16
|
hasDeposit: boolean;
|
|
17
17
|
}
|
|
18
|
+
import type { WindowPlugin } from '../../plugins';
|
|
18
19
|
/**
|
|
19
20
|
* 把"含 option 的主商品单价"与 bundle 合成"单行 composite 单价"。
|
|
20
21
|
*
|
|
@@ -177,6 +178,15 @@ export declare const mergeRelationForms: (relationForms: {
|
|
|
177
178
|
form_id: number;
|
|
178
179
|
form_record_ids: number[];
|
|
179
180
|
}[];
|
|
181
|
+
export interface CartOrderHolder {
|
|
182
|
+
customer_id?: number;
|
|
183
|
+
form_id: number | string;
|
|
184
|
+
form_record: (number | string)[] | null;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 为购物车行补齐订单所需的 holder 信息(与 cartAccount 结构保持一致)
|
|
188
|
+
*/
|
|
189
|
+
export declare function ensureCartItemOriginHolder(cartItem: CartItem, window?: WindowPlugin): void;
|
|
180
190
|
export declare const getAllDiscountList: (cartItem: CartItem) => any;
|
|
181
191
|
export { createUuidV4 };
|
|
182
192
|
export declare function isTempOrder(data: any): data is OrderTempOrder;
|
|
@@ -36,8 +36,9 @@ __export(utils_exports, {
|
|
|
36
36
|
composeLinePrice: () => composeLinePrice,
|
|
37
37
|
createDefaultOrderRulesHooks: () => createDefaultOrderRulesHooks,
|
|
38
38
|
createDefaultTempOrder: () => createDefaultTempOrder,
|
|
39
|
-
createEmptySummary: () =>
|
|
39
|
+
createEmptySummary: () => import_utils3.createEmptySummary,
|
|
40
40
|
createUuidV4: () => import_orderCollectionIdentity.createUuidV4,
|
|
41
|
+
ensureCartItemOriginHolder: () => ensureCartItemOriginHolder,
|
|
41
42
|
ensureManualProductDiscountList: () => import_manualProductDiscount.ensureManualProductDiscountList,
|
|
42
43
|
ensureProductSku: () => ensureProductSku,
|
|
43
44
|
findManualProductDiscountItem: () => import_manualProductDiscount.findManualProductDiscountItem,
|
|
@@ -85,9 +86,10 @@ __export(utils_exports, {
|
|
|
85
86
|
module.exports = __toCommonJS(utils_exports);
|
|
86
87
|
var import_dayjs = __toESM(require("dayjs"));
|
|
87
88
|
var import_decimal = __toESM(require("decimal.js"));
|
|
88
|
-
var import_utils = require("
|
|
89
|
-
var import_orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
89
|
+
var import_utils = require("../Holder/utils");
|
|
90
90
|
var import_utils2 = require("../../solution/ScanOrder/utils");
|
|
91
|
+
var import_orderCollectionIdentity = require("./utils/orderCollectionIdentity");
|
|
92
|
+
var import_utils3 = require("../../solution/ScanOrder/utils");
|
|
91
93
|
var import_manualProductDiscount = require("./utils/manualProductDiscount");
|
|
92
94
|
function composeLinePrice(params) {
|
|
93
95
|
const { mainPrice, bundle, useOriginalBundle } = params;
|
|
@@ -444,12 +446,7 @@ function resolveEffectivePerUnitDiscount(product) {
|
|
|
444
446
|
(sum, discount) => sum + Number((discount == null ? void 0 : discount.amount) || 0),
|
|
445
447
|
0
|
|
446
448
|
);
|
|
447
|
-
const hasPromoDiscountItem = discountList.some(
|
|
448
|
-
(item) => {
|
|
449
|
-
var _a, _b;
|
|
450
|
-
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";
|
|
451
|
-
}
|
|
452
|
-
);
|
|
449
|
+
const hasPromoDiscountItem = discountList.some((item) => (item == null ? void 0 : item.type) === "promotion");
|
|
453
450
|
if (hasPromoDiscountItem)
|
|
454
451
|
return fromList;
|
|
455
452
|
const metadata = (product == null ? void 0 : product.metadata) || {};
|
|
@@ -546,7 +543,7 @@ function createDefaultOrderRulesHooks() {
|
|
|
546
543
|
// 否则同 SKU 不同小料会在 calcDiscount 重组时互相覆盖。
|
|
547
544
|
// 不透明 identity 契约下,normalizeOrderProduct / hydrate 已保证唯一值存在;
|
|
548
545
|
// 留 fingerprint 分支仅作 Rules 单测里直接传裸 product 时的兜底。
|
|
549
|
-
_id: ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ? `${product.product_id}_${product.product_variant_id}_${product.metadata.unique_identification_number}` : `${product.product_id}_${product.product_variant_id}_${(0,
|
|
546
|
+
_id: ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ? `${product.product_id}_${product.product_variant_id}_${product.metadata.unique_identification_number}` : `${product.product_id}_${product.product_variant_id}_${(0, import_utils2.buildProductLineFingerprint)(
|
|
550
547
|
getProductSkuOptions(product),
|
|
551
548
|
product.product_bundle
|
|
552
549
|
)}`,
|
|
@@ -638,6 +635,34 @@ var mergeRelationForms = (relationForms) => {
|
|
|
638
635
|
}, {})
|
|
639
636
|
).filter((item) => item.form_record_ids.length > 0);
|
|
640
637
|
};
|
|
638
|
+
function getCustomerIdFromStorage(window) {
|
|
639
|
+
var _a;
|
|
640
|
+
try {
|
|
641
|
+
const customer = JSON.parse(((_a = window == null ? void 0 : window.getLocalStorage) == null ? void 0 : _a.call(window, "customer")) || "{}");
|
|
642
|
+
const customerId = Number(customer == null ? void 0 : customer.id);
|
|
643
|
+
return Number.isFinite(customerId) && customerId > 0 ? customerId : void 0;
|
|
644
|
+
} catch {
|
|
645
|
+
return void 0;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function ensureCartItemOriginHolder(cartItem, window) {
|
|
649
|
+
var _a;
|
|
650
|
+
if ((_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.holder) {
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
const holderConfig = (0, import_utils.getProductHolderConfig)(
|
|
654
|
+
(cartItem == null ? void 0 : cartItem._productInit) ?? (cartItem == null ? void 0 : cartItem._productOrigin)
|
|
655
|
+
);
|
|
656
|
+
const formRecordId = cartItem == null ? void 0 : cartItem.holder_id;
|
|
657
|
+
if (!(holderConfig == null ? void 0 : holderConfig.resource_id) || formRecordId == null) {
|
|
658
|
+
return;
|
|
659
|
+
}
|
|
660
|
+
cartItem._origin.holder = {
|
|
661
|
+
customer_id: getCustomerIdFromStorage(window),
|
|
662
|
+
form_id: holderConfig.resource_id,
|
|
663
|
+
form_record: [formRecordId]
|
|
664
|
+
};
|
|
665
|
+
}
|
|
641
666
|
var getAllDiscountList = (cartItem) => {
|
|
642
667
|
var _a, _b, _c, _d;
|
|
643
668
|
let discountList = ((_b = (_a = cartItem == null ? void 0 : cartItem._origin) == null ? void 0 : _a.product) == null ? void 0 : _b.discount_list) || [];
|
|
@@ -970,9 +995,6 @@ function buildSubmitPayload(params) {
|
|
|
970
995
|
...tempOrderRest,
|
|
971
996
|
customer_id: tempOrder.customer_id ?? 1,
|
|
972
997
|
customer_name: tempOrder.customer_name || "Walk-In",
|
|
973
|
-
country_calling_code: String(tempOrder.country_calling_code ?? ""),
|
|
974
|
-
phone: String(tempOrder.phone ?? ""),
|
|
975
|
-
email: String(tempOrder.email ?? ""),
|
|
976
998
|
order_number: tempOrder.order_number ?? null,
|
|
977
999
|
shop_order_number: tempOrder.shop_order_number ?? null,
|
|
978
1000
|
shop_full_order_number: tempOrder.shop_full_order_number ?? null,
|
|
@@ -1003,7 +1025,7 @@ function buildSubmitPayload(params) {
|
|
|
1003
1025
|
// contacts: tempOrder.contacts || [],
|
|
1004
1026
|
contacts_info: tempOrder.contacts_info && !Array.isArray(tempOrder.contacts_info) ? tempOrder.contacts_info : null,
|
|
1005
1027
|
// holder: tempOrder.holder || null,
|
|
1006
|
-
summary: summary || tempOrder.summary || (0,
|
|
1028
|
+
summary: summary || tempOrder.summary || (0, import_utils2.createEmptySummary)(),
|
|
1007
1029
|
metadata: (() => {
|
|
1008
1030
|
const {
|
|
1009
1031
|
collect_pax: _collectPax,
|
|
@@ -1028,7 +1050,9 @@ function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
1028
1050
|
const item = paymentItem;
|
|
1029
1051
|
const customPaymentId = item.custom_payment_id ?? item.id;
|
|
1030
1052
|
const metadata = item.metadata && typeof item.metadata === "object" ? { ...item.metadata } : {};
|
|
1031
|
-
|
|
1053
|
+
if (item.uuid && !metadata.unique_payment_number) {
|
|
1054
|
+
metadata.unique_payment_number = String(item.uuid);
|
|
1055
|
+
}
|
|
1032
1056
|
const paymentMetadataKeys = [
|
|
1033
1057
|
"rounding_rule",
|
|
1034
1058
|
"shop_wallet_pass_id",
|
|
@@ -1045,7 +1069,6 @@ function mapPaymentItemToOrderPayment(paymentItem) {
|
|
|
1045
1069
|
const createdAt = item.created_at ?? timestamp;
|
|
1046
1070
|
return {
|
|
1047
1071
|
...item.order_payment_id !== void 0 ? { order_payment_id: item.order_payment_id } : {},
|
|
1048
|
-
...paymentNumber !== void 0 && paymentNumber !== null && paymentNumber !== "" ? { payment_number: String(paymentNumber) } : {},
|
|
1049
1072
|
amount: String(item.amount ?? "0.00"),
|
|
1050
1073
|
code: String(item.code || ""),
|
|
1051
1074
|
custom_payment_id: Number(customPaymentId ?? 0),
|
|
@@ -1252,6 +1275,7 @@ function indexOrderProductsByUid(products) {
|
|
|
1252
1275
|
createDefaultTempOrder,
|
|
1253
1276
|
createEmptySummary,
|
|
1254
1277
|
createUuidV4,
|
|
1278
|
+
ensureCartItemOriginHolder,
|
|
1255
1279
|
ensureManualProductDiscountList,
|
|
1256
1280
|
ensureProductSku,
|
|
1257
1281
|
findManualProductDiscountItem,
|
|
@@ -20,7 +20,6 @@ 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;
|
|
24
23
|
private store;
|
|
25
24
|
window: WindowPlugin;
|
|
26
25
|
private dbManager;
|
|
@@ -41,7 +40,6 @@ export declare class PaymentModule extends BaseModule implements Module, Payment
|
|
|
41
40
|
* paymentModule.updateOtherParams({ fatherModule: 'bookingTicket' });
|
|
42
41
|
*/
|
|
43
42
|
updateOtherParams(params: Record<string, any>): void;
|
|
44
|
-
private getPaymentNumberAppData;
|
|
45
43
|
/**
|
|
46
44
|
* 记录信息日志
|
|
47
45
|
*/
|
|
@@ -31,9 +31,6 @@ var import_cash = require("./cash");
|
|
|
31
31
|
var import_eftpos = require("./eftpos");
|
|
32
32
|
var import_walletpass = require("./walletpass");
|
|
33
33
|
var import_decimal = require("decimal.js");
|
|
34
|
-
var import_payment_utils = require("../Order/payment-utils");
|
|
35
|
-
var import_utils2 = require("../Order/utils");
|
|
36
|
-
var import_payment_number = require("../../utils/payment-number");
|
|
37
34
|
__reExport(Payment_exports, require("./types"), module.exports);
|
|
38
35
|
function formatAmount(amount) {
|
|
39
36
|
try {
|
|
@@ -115,15 +112,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
115
112
|
this.store = options.store;
|
|
116
113
|
this.otherParams = options.otherParams || {};
|
|
117
114
|
this.request = core.getPlugin("request");
|
|
118
|
-
|
|
115
|
+
const appPlugin = core.getPlugin("app");
|
|
119
116
|
this.window = core.getPlugin("window");
|
|
120
117
|
if (!this.request) {
|
|
121
118
|
throw new Error("支付模块需要 request 插件支持");
|
|
122
119
|
}
|
|
123
|
-
if (!
|
|
120
|
+
if (!appPlugin) {
|
|
124
121
|
throw new Error("支付模块需要 app 插件支持");
|
|
125
122
|
}
|
|
126
|
-
this.app =
|
|
123
|
+
this.app = appPlugin.getApp();
|
|
127
124
|
this.dbManager = this.app.dbManager;
|
|
128
125
|
this.logger = this.app.logger;
|
|
129
126
|
this.registerNetworkHandlers();
|
|
@@ -139,14 +136,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
139
136
|
updateOtherParams(params) {
|
|
140
137
|
this.otherParams = params || {};
|
|
141
138
|
}
|
|
142
|
-
getPaymentNumberAppData(key) {
|
|
143
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
144
|
-
const getData = (_b = (_a = this.appPlugin) == null ? void 0 : _a.getData) == null ? void 0 : _b.call(_a);
|
|
145
|
-
if (typeof getData === "function")
|
|
146
|
-
return getData(key);
|
|
147
|
-
const coreData = (_g = (_e = (_d = (_c = this.app) == null ? void 0 : _c.models) == null ? void 0 : _d.getStore) == null ? void 0 : (_f = _e.call(_d)).getDataByModel) == null ? void 0 : _g.call(_f, "core", "core");
|
|
148
|
-
return coreData == null ? void 0 : coreData[key];
|
|
149
|
-
}
|
|
150
139
|
/**
|
|
151
140
|
* 记录信息日志
|
|
152
141
|
*/
|
|
@@ -532,20 +521,15 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
532
521
|
});
|
|
533
522
|
throw new Error(warningMessage);
|
|
534
523
|
}
|
|
535
|
-
|
|
524
|
+
let paymentUuid;
|
|
525
|
+
if ((_a = paymentItem.metadata) == null ? void 0 : _a.unique_payment_number) {
|
|
526
|
+
paymentUuid = paymentItem.metadata.unique_payment_number;
|
|
527
|
+
} else {
|
|
528
|
+
paymentUuid = (0, import_utils.getUniqueId)("payment_");
|
|
529
|
+
}
|
|
536
530
|
const currentTime = formatDateTime(/* @__PURE__ */ new Date());
|
|
537
|
-
const hasPaymentNumber = String(paymentItem.payment_number || "").trim() !== "";
|
|
538
|
-
const paymentNumberDevicePrefix = hasPaymentNumber ? "LOCAL" : await (0, import_payment_number.resolvePaymentNumberDevicePrefix)(
|
|
539
|
-
(key) => this.getPaymentNumberAppData(key)
|
|
540
|
-
);
|
|
541
|
-
const paymentNumber = (0, import_payment_utils.ensureOrderPaymentNumber)(
|
|
542
|
-
paymentItem,
|
|
543
|
-
paymentNumberDevicePrefix,
|
|
544
|
-
import_utils2.createUuidV4
|
|
545
|
-
).payment_number;
|
|
546
531
|
const newPaymentItem = {
|
|
547
532
|
uuid: paymentUuid,
|
|
548
|
-
payment_number: paymentNumber,
|
|
549
533
|
custom_payment_id: normalizeCustomPaymentId(paymentItem),
|
|
550
534
|
name: paymentItem.name,
|
|
551
535
|
code: paymentItem.code,
|
|
@@ -565,8 +549,10 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
565
549
|
updated_at: currentTime,
|
|
566
550
|
// 更新时间
|
|
567
551
|
metadata: {
|
|
568
|
-
...paymentItem.metadata
|
|
552
|
+
...paymentItem.metadata,
|
|
569
553
|
// 保留传入的所有 metadata 字段
|
|
554
|
+
unique_payment_number: paymentUuid
|
|
555
|
+
// 设置唯一支付号为支付项的 uuid
|
|
570
556
|
}
|
|
571
557
|
};
|
|
572
558
|
order.payment.push(newPaymentItem);
|
|
@@ -781,12 +767,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
781
767
|
if ("amount" in formattedParams && formattedParams.amount !== void 0) {
|
|
782
768
|
formattedParams.amount = formatAmount(formattedParams.amount);
|
|
783
769
|
}
|
|
784
|
-
if (formattedParams.metadata && typeof formattedParams.metadata === "object") {
|
|
785
|
-
formattedParams.metadata = {
|
|
786
|
-
...paymentItem.metadata || {},
|
|
787
|
-
...formattedParams.metadata
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
770
|
Object.assign(paymentItem, formattedParams);
|
|
791
771
|
this.recalculateOrderAmount(order);
|
|
792
772
|
await this.dbManager.update("order", order);
|
|
@@ -844,7 +824,6 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
844
824
|
const paymentData = {
|
|
845
825
|
payments: order.payment.map((payment) => ({
|
|
846
826
|
uuid: payment.uuid,
|
|
847
|
-
payment_number: payment.payment_number,
|
|
848
827
|
amount: payment.amount,
|
|
849
828
|
code: payment.code,
|
|
850
829
|
custom_payment_id: payment.custom_payment_id,
|
|
@@ -1088,7 +1067,7 @@ var PaymentModule = class extends import_BaseModule.BaseModule {
|
|
|
1088
1067
|
roundedValue = this.standardRound(baseValue, true);
|
|
1089
1068
|
break;
|
|
1090
1069
|
case import_types.RoundingRule.StandardDown:
|
|
1091
|
-
case "
|
|
1070
|
+
case "standard_down":
|
|
1092
1071
|
roundedValue = this.standardRound(baseValue, false);
|
|
1093
1072
|
break;
|
|
1094
1073
|
case import_types.RoundingRule.AlwaysUp:
|
|
@@ -40,11 +40,11 @@ export declare enum RoundingRule {
|
|
|
40
40
|
/** 标准舍入(中点向上) */
|
|
41
41
|
Standard = "standard_rounding",
|
|
42
42
|
/** 标准舍入(中点向下) */
|
|
43
|
-
StandardDown = "
|
|
43
|
+
StandardDown = "standard_down",
|
|
44
44
|
/** 总是向上舍入 */
|
|
45
|
-
AlwaysUp = "
|
|
45
|
+
AlwaysUp = "always_up",
|
|
46
46
|
/** 总是向下舍入 */
|
|
47
|
-
AlwaysDown = "
|
|
47
|
+
AlwaysDown = "always_down"
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* 舍入结果
|
|
@@ -87,30 +87,12 @@ export interface PaymentMethod {
|
|
|
87
87
|
/** 其他配置信息 */
|
|
88
88
|
[key: string]: any;
|
|
89
89
|
}
|
|
90
|
-
/** 支付项扩展元数据 */
|
|
91
|
-
export interface PaymentItemMetadata {
|
|
92
|
-
/** 钱箱 ID */
|
|
93
|
-
shop_wallet_pass_id?: string;
|
|
94
|
-
/** 三方支付交易流水号 */
|
|
95
|
-
unique_payment_number?: string;
|
|
96
|
-
/** 刷卡机设备快照;PaymentModule 不解析内部字段 */
|
|
97
|
-
card_reader_snapshot?: Record<string, unknown>;
|
|
98
|
-
/** rounding 规则 */
|
|
99
|
-
rounding_rule?: any;
|
|
100
|
-
/** 实付金额(现金支付时的实际给出金额) */
|
|
101
|
-
actual_paid_amount?: number;
|
|
102
|
-
/** 找零金额(现金支付时的找零金额) */
|
|
103
|
-
change_given_amount?: number;
|
|
104
|
-
[key: string]: unknown;
|
|
105
|
-
}
|
|
106
90
|
/**
|
|
107
91
|
* 支付项
|
|
108
92
|
*/
|
|
109
93
|
export interface PaymentItem {
|
|
110
94
|
/** 当前支付项的唯一 ID */
|
|
111
95
|
uuid: string;
|
|
112
|
-
/** 支付项稳定唯一号 */
|
|
113
|
-
payment_number?: string;
|
|
114
96
|
/** 当前支付方式付出去多少钱 */
|
|
115
97
|
amount: string;
|
|
116
98
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -128,7 +110,18 @@ export interface PaymentItem {
|
|
|
128
110
|
/** Wallet Pass 本次使用值 */
|
|
129
111
|
wallet_pass_use_value?: string | number | null;
|
|
130
112
|
/** 拓展参数字段 */
|
|
131
|
-
metadata?:
|
|
113
|
+
metadata?: {
|
|
114
|
+
/** 钱箱 ID */
|
|
115
|
+
shop_wallet_pass_id?: string;
|
|
116
|
+
/** 唯一支付号 */
|
|
117
|
+
unique_payment_number?: string;
|
|
118
|
+
/** rouding规则 */
|
|
119
|
+
rounding_rule?: any;
|
|
120
|
+
/** 实付金额(现金支付时的实际给出金额) */
|
|
121
|
+
actual_paid_amount?: number;
|
|
122
|
+
/** 找零金额(现金支付时的找零金额) */
|
|
123
|
+
change_given_amount?: number;
|
|
124
|
+
};
|
|
132
125
|
/** rouding金额 */
|
|
133
126
|
rounding_amount?: string;
|
|
134
127
|
/** 三方支付手续费 */
|
|
@@ -235,10 +228,6 @@ export interface UpdateOrderParams {
|
|
|
235
228
|
* 支付项输入类型(允许 amount 为数字)
|
|
236
229
|
*/
|
|
237
230
|
export interface PaymentItemInput {
|
|
238
|
-
/** 调用方已有的支付项运行态 UUID;存在时复用为 payment_number 的唯一号段 */
|
|
239
|
-
uuid?: string;
|
|
240
|
-
/** 支付项稳定唯一号 */
|
|
241
|
-
payment_number?: string;
|
|
242
231
|
/** 当前支付方式付出去多少钱 */
|
|
243
232
|
amount: string | number;
|
|
244
233
|
/** 支付类型,跟支付列表上对应的支付方式保持一致 */
|
|
@@ -267,7 +256,18 @@ export interface PaymentItemInput {
|
|
|
267
256
|
/** 订单支付类型 */
|
|
268
257
|
order_payment_type?: 'normal' | 'deposit';
|
|
269
258
|
/** 扩展参数字段 */
|
|
270
|
-
metadata?:
|
|
259
|
+
metadata?: {
|
|
260
|
+
/** 钱箱 ID */
|
|
261
|
+
shop_wallet_pass_id?: string;
|
|
262
|
+
/** 唯一支付号 */
|
|
263
|
+
unique_payment_number?: string;
|
|
264
|
+
/** rounding规则 */
|
|
265
|
+
rounding_rule?: any;
|
|
266
|
+
/** 实付金额(现金支付时的实际给出金额) */
|
|
267
|
+
actual_paid_amount?: number;
|
|
268
|
+
/** 找零金额(现金支付时的找零金额) */
|
|
269
|
+
change_given_amount?: number;
|
|
270
|
+
};
|
|
271
271
|
/** 支付项创建时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
272
272
|
created_at?: string;
|
|
273
273
|
/** 支付项更新时间 (格式: YYYY-MM-DD HH:mm:ss, 可选,不传则自动生成) */
|
|
@@ -302,8 +302,6 @@ export interface PaymentUpdateFields {
|
|
|
302
302
|
voucher_id?: string;
|
|
303
303
|
/** 该支付项是否已经同步给后端服务器(只有网络请求成功后才为true) */
|
|
304
304
|
isSynced?: boolean;
|
|
305
|
-
/** 支付项扩展元数据;更新时与原 metadata 浅合并 */
|
|
306
|
-
metadata?: PaymentItemMetadata;
|
|
307
305
|
/** 同步错误信息(业务错误时记录错误信息,用于区分"未同步"和"同步失败") */
|
|
308
306
|
syncError?: {
|
|
309
307
|
error: string;
|
|
@@ -340,8 +338,6 @@ export interface CashPayment {
|
|
|
340
338
|
processCashPayment: (amount: number, orderUuid: string) => Promise<void>;
|
|
341
339
|
/** 获取现金余额 */
|
|
342
340
|
getCashBalance: () => Promise<number>;
|
|
343
|
-
/** 根据币种面额生成现金快捷金额。 */
|
|
344
|
-
getRecommendedAmount: (money: number, currency: string) => number[];
|
|
345
341
|
}
|
|
346
342
|
/**
|
|
347
343
|
* Eftpos支付接口
|
|
@@ -367,56 +363,6 @@ export interface WalletStoredInitData {
|
|
|
367
363
|
noApplicableVoucher: any[];
|
|
368
364
|
products: any[];
|
|
369
365
|
}
|
|
370
|
-
export type WalletAssetId = string | number;
|
|
371
|
-
export type WalletAssetSelectionSource = 'manual' | 'scan';
|
|
372
|
-
export type WalletAssetsStatus = 'idle' | 'loading' | 'ready' | 'error';
|
|
373
|
-
/**
|
|
374
|
-
* 购物车与结账共享的钱包资产状态。
|
|
375
|
-
*
|
|
376
|
-
* 原始券字段完整保留在 items / selectedItems 中,Payment 只补充统一的
|
|
377
|
-
* 可用性、选择和加载状态,不在此层引入 UI ViewModel。
|
|
378
|
-
*/
|
|
379
|
-
export interface WalletAssetsState {
|
|
380
|
-
status: WalletAssetsStatus;
|
|
381
|
-
items: any[];
|
|
382
|
-
selectedIds: WalletAssetId[];
|
|
383
|
-
selectedItems: any[];
|
|
384
|
-
committedIds: WalletAssetId[];
|
|
385
|
-
selectionSources: Record<string, WalletAssetSelectionSource>;
|
|
386
|
-
totalSelectedAmount: number;
|
|
387
|
-
customerId?: string | number;
|
|
388
|
-
error: string | null;
|
|
389
|
-
revision: number;
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* Shared Wallet Assets 的可序列化运行时快照。
|
|
393
|
-
*
|
|
394
|
-
* state 供购物车 / Checkout 直接恢复展示与选择;searchResults 和
|
|
395
|
-
* calculationContext 用于商品变化后继续重验扫码搜索过的 Wallet。
|
|
396
|
-
*/
|
|
397
|
-
export interface WalletAssetsSnapshot {
|
|
398
|
-
state: WalletAssetsState;
|
|
399
|
-
searchResults: SearchIdentificationCodeItem[];
|
|
400
|
-
walletParams: WalletDeductionRecommendParams | null;
|
|
401
|
-
calculationContext: {
|
|
402
|
-
orderTotalAmount: number;
|
|
403
|
-
products: any[];
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
export interface RefreshWalletAssetsOptions {
|
|
407
|
-
/** 商品/金额变化默认保留并重验选择;客户变化由实现层强制清空。 */
|
|
408
|
-
preserveSelection?: boolean;
|
|
409
|
-
}
|
|
410
|
-
export interface SelectWalletAssetOptions {
|
|
411
|
-
selected: boolean;
|
|
412
|
-
source?: WalletAssetSelectionSource;
|
|
413
|
-
}
|
|
414
|
-
export interface ScanWalletAssetResult {
|
|
415
|
-
type: SearchIdentificationCodeResult['type'];
|
|
416
|
-
asset?: any;
|
|
417
|
-
selected: boolean;
|
|
418
|
-
state: WalletAssetsState;
|
|
419
|
-
}
|
|
420
366
|
export interface WalletPassPayment {
|
|
421
367
|
/** 生成钱包API默认参数 */
|
|
422
368
|
generateWalletParams: (businessData: WalletInitBusinessData) => WalletDeductionRecommendParams;
|
|
@@ -468,22 +414,6 @@ export interface WalletPassPayment {
|
|
|
468
414
|
processWalletPayment: (amount: number, orderUuid: string, voucherId?: string) => Promise<void>;
|
|
469
415
|
/** 获取钱包余额 */
|
|
470
416
|
getWalletBalance: (voucherId: string) => Promise<number>;
|
|
471
|
-
/** 刷新购物车/结账共享的钱包资产,刷新本身不会默认选券。 */
|
|
472
|
-
refreshWalletAssetsFromBusinessAsync: (businessData: WalletInitBusinessData, options?: RefreshWalletAssetsOptions) => Promise<WalletAssetsState>;
|
|
473
|
-
/** 获取共享钱包资产状态快照。 */
|
|
474
|
-
getWalletAssetsState: () => WalletAssetsState;
|
|
475
|
-
/** 导出供 Shared Checkout 跨运行时传递的 Wallet Assets 快照。 */
|
|
476
|
-
exportWalletAssetsSnapshot: () => WalletAssetsSnapshot;
|
|
477
|
-
/** 恢复 Shared Checkout 传回的 Wallet Assets 快照。 */
|
|
478
|
-
importWalletAssetsSnapshot: (snapshot: WalletAssetsSnapshot) => WalletAssetsState;
|
|
479
|
-
/** 设置单张钱包资产的选择状态并重新计算其实际抵扣额。 */
|
|
480
|
-
selectWalletAsset: (assetId: WalletAssetId, options: SelectWalletAssetOptions) => WalletAssetsState;
|
|
481
|
-
/** 精确搜索钱包资产;仅当前券可用时自动选择。 */
|
|
482
|
-
scanWalletAssetAsync: (code: string) => Promise<ScanWalletAssetResult>;
|
|
483
|
-
/** 清空未确认的钱包资产选择。 */
|
|
484
|
-
clearWalletAssetSelection: () => WalletAssetsState;
|
|
485
|
-
/** 同步订单中已经支付、不可撤销的钱包资产。 */
|
|
486
|
-
setCommittedWalletAssets: (committedIds: WalletAssetId[], committedAssets?: any[]) => WalletAssetsState;
|
|
487
417
|
}
|
|
488
418
|
/**
|
|
489
419
|
* 支付模块API接口
|
|
@@ -676,8 +606,7 @@ export declare enum WalletPassHooks {
|
|
|
676
606
|
OnSearchIdentificationCodeCompleted = "wallet:onSearchIdentificationCodeCompleted",
|
|
677
607
|
OnWalletInitializationStarted = "wallet:onWalletInitializationStarted",
|
|
678
608
|
OnWalletInitializationCompleted = "wallet:onWalletInitializationCompleted",
|
|
679
|
-
OnWalletInitializationFailed = "wallet:onWalletInitializationFailed"
|
|
680
|
-
OnWalletAssetsStateChanged = "wallet:onWalletAssetsStateChanged"
|
|
609
|
+
OnWalletInitializationFailed = "wallet:onWalletInitializationFailed"
|
|
681
610
|
}
|
|
682
611
|
/**
|
|
683
612
|
* 支付钩子事件(统一接口)
|
|
@@ -51,9 +51,9 @@ var TaskRunStatus = /* @__PURE__ */ ((TaskRunStatus2) => {
|
|
|
51
51
|
})(TaskRunStatus || {});
|
|
52
52
|
var RoundingRule = /* @__PURE__ */ ((RoundingRule2) => {
|
|
53
53
|
RoundingRule2["Standard"] = "standard_rounding";
|
|
54
|
-
RoundingRule2["StandardDown"] = "
|
|
55
|
-
RoundingRule2["AlwaysUp"] = "
|
|
56
|
-
RoundingRule2["AlwaysDown"] = "
|
|
54
|
+
RoundingRule2["StandardDown"] = "standard_down";
|
|
55
|
+
RoundingRule2["AlwaysUp"] = "always_up";
|
|
56
|
+
RoundingRule2["AlwaysDown"] = "always_down";
|
|
57
57
|
return RoundingRule2;
|
|
58
58
|
})(RoundingRule || {});
|
|
59
59
|
var RoundingInterval = /* @__PURE__ */ ((RoundingInterval2) => {
|
|
@@ -73,7 +73,6 @@ var WalletPassHooks = /* @__PURE__ */ ((WalletPassHooks2) => {
|
|
|
73
73
|
WalletPassHooks2["OnWalletInitializationStarted"] = "wallet:onWalletInitializationStarted";
|
|
74
74
|
WalletPassHooks2["OnWalletInitializationCompleted"] = "wallet:onWalletInitializationCompleted";
|
|
75
75
|
WalletPassHooks2["OnWalletInitializationFailed"] = "wallet:onWalletInitializationFailed";
|
|
76
|
-
WalletPassHooks2["OnWalletAssetsStateChanged"] = "wallet:onWalletAssetsStateChanged";
|
|
77
76
|
return WalletPassHooks2;
|
|
78
77
|
})(WalletPassHooks || {});
|
|
79
78
|
var PaymentHooks = /* @__PURE__ */ ((PaymentHooks2) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, SearchIdentificationCodeResult, WalletInitBusinessData
|
|
1
|
+
import { WalletPassPayment, WalletDeductionRecommendParams, WalletRecommendItem, UserIdentificationCodeParams, UserIdentificationCodeItem, SearchIdentificationCodeParams, SearchIdentificationCodeItem, SearchIdentificationCodeResult, WalletInitBusinessData } from './types';
|
|
2
2
|
import type { PaymentModule } from './index';
|
|
3
3
|
/**
|
|
4
4
|
* 钱包支付实现
|
|
@@ -10,22 +10,12 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
10
10
|
private searchResults;
|
|
11
11
|
private walletParams;
|
|
12
12
|
private walletInitData;
|
|
13
|
-
private walletAssetsState;
|
|
14
|
-
private walletAssetsRequestSequence;
|
|
15
|
-
private walletAssetsCalculationContext;
|
|
16
13
|
constructor(paymentModule: PaymentModule);
|
|
17
14
|
/**
|
|
18
15
|
* 发送事件的辅助方法
|
|
19
16
|
* 支持使用WalletPassHooks或PaymentHooks
|
|
20
17
|
*/
|
|
21
18
|
private emitEvent;
|
|
22
|
-
private publishWalletAssetsState;
|
|
23
|
-
private recalculateWalletAssets;
|
|
24
|
-
/**
|
|
25
|
-
* 使用最新订单参数重验扫码搜索过的支付类 Wallet 资产。
|
|
26
|
-
* 请求失败或暂时无匹配结果时保留旧资产,避免商品变化造成列表闪空。
|
|
27
|
-
*/
|
|
28
|
-
private revalidateSearchedWalletAssets;
|
|
29
19
|
/**
|
|
30
20
|
* 生成钱包API默认参数
|
|
31
21
|
* 根据业务数据生成标准的钱包API参数,并存储在模块中
|
|
@@ -83,20 +73,6 @@ export declare class WalletPassPaymentImpl implements WalletPassPayment {
|
|
|
83
73
|
searchIdentificationCodeAsync(params: SearchIdentificationCodeParams, config?: {
|
|
84
74
|
noCache?: boolean;
|
|
85
75
|
}): Promise<SearchIdentificationCodeResult>;
|
|
86
|
-
/**
|
|
87
|
-
* 刷新购物车与结账共享的钱包资产。
|
|
88
|
-
*
|
|
89
|
-
* 与 legacy initializeWalletDataFromBusinessAsync 不同,这里维护选择状态;
|
|
90
|
-
* 推荐结果只作为可用性/金额计算输入,不会自动成为 selectedIds。
|
|
91
|
-
*/
|
|
92
|
-
refreshWalletAssetsFromBusinessAsync(businessData: WalletInitBusinessData, options?: RefreshWalletAssetsOptions): Promise<WalletAssetsState>;
|
|
93
|
-
getWalletAssetsState(): WalletAssetsState;
|
|
94
|
-
exportWalletAssetsSnapshot(): WalletAssetsSnapshot;
|
|
95
|
-
importWalletAssetsSnapshot(snapshot: WalletAssetsSnapshot): WalletAssetsState;
|
|
96
|
-
selectWalletAsset(assetId: WalletAssetId, options: SelectWalletAssetOptions): WalletAssetsState;
|
|
97
|
-
scanWalletAssetAsync(code: string): Promise<ScanWalletAssetResult>;
|
|
98
|
-
clearWalletAssetSelection(): WalletAssetsState;
|
|
99
|
-
setCommittedWalletAssets(committedIds: WalletAssetId[], committedAssets?: any[]): WalletAssetsState;
|
|
100
76
|
processWalletPayment(amount: number, orderUuid: string, voucherId?: string): Promise<void>;
|
|
101
77
|
getWalletBalance(voucherId: string): Promise<number>;
|
|
102
78
|
/**
|