@pisell/pisellos 2.2.291 → 2.2.292
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/promotion/index.js +0 -9
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/server/utils/small-ticket.js +1 -49
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/server/utils/small-ticket.js +1 -50
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// 导出评估器
|
|
2
|
-
export { PromotionEvaluator } from "./evaluator";
|
|
3
|
-
|
|
4
|
-
// 导出适配器
|
|
5
|
-
export { PromotionAdapter } from "./adapter";
|
|
6
|
-
export { default } from "./adapter";
|
|
7
|
-
|
|
8
|
-
// 导出策略配置示例常量
|
|
9
|
-
export { X_ITEMS_FOR_Y_PRICE_STRATEGY, BUY_X_GET_Y_FREE_STRATEGY, ITEM_REWARD_STRATEGY } from "./examples";
|
|
@@ -514,7 +514,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
514
514
|
generateIdempotencyToken(): string;
|
|
515
515
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
516
516
|
createOrder(params: CommitOrderParams['query']): {
|
|
517
|
-
type: "
|
|
517
|
+
type: "virtual" | "appointment_booking";
|
|
518
518
|
platform: string;
|
|
519
519
|
sales_channel: string;
|
|
520
520
|
order_sales_channel: string;
|
|
@@ -30,8 +30,6 @@ var LABELS = {
|
|
|
30
30
|
pickUpTime: 'Pick-up time',
|
|
31
31
|
asap: 'ASAP',
|
|
32
32
|
cash: 'Cash',
|
|
33
|
-
cashReceived: 'Cash received',
|
|
34
|
-
changeDue: 'Change due',
|
|
35
33
|
eftpos: 'Eftpos',
|
|
36
34
|
wallet: 'Wallet',
|
|
37
35
|
giftCard: 'Gift card',
|
|
@@ -58,8 +56,6 @@ var LABELS = {
|
|
|
58
56
|
pickUpTime: '取餐时间',
|
|
59
57
|
asap: '尽快',
|
|
60
58
|
cash: '现金支付',
|
|
61
|
-
cashReceived: '收取现金',
|
|
62
|
-
changeDue: '找零',
|
|
63
59
|
eftpos: '刷卡支付',
|
|
64
60
|
wallet: '钱包支付',
|
|
65
61
|
giftCard: '礼品卡',
|
|
@@ -86,8 +82,6 @@ var LABELS = {
|
|
|
86
82
|
pickUpTime: '取餐時間',
|
|
87
83
|
asap: '盡快',
|
|
88
84
|
cash: '現金支付',
|
|
89
|
-
cashReceived: '收取現金',
|
|
90
|
-
changeDue: '找零',
|
|
91
85
|
eftpos: '刷卡支付',
|
|
92
86
|
wallet: '錢包支付',
|
|
93
87
|
giftCard: '禮品卡',
|
|
@@ -101,14 +95,6 @@ var LABELS = {
|
|
|
101
95
|
rounding: '抹零',
|
|
102
96
|
gross: '重量',
|
|
103
97
|
tare: '去皮'
|
|
104
|
-
},
|
|
105
|
-
ja: {
|
|
106
|
-
cashReceived: 'お預かり',
|
|
107
|
-
changeDue: 'お釣り'
|
|
108
|
-
},
|
|
109
|
-
pt: {
|
|
110
|
-
cashReceived: 'Dinheiro recebido',
|
|
111
|
-
changeDue: 'Troco'
|
|
112
98
|
}
|
|
113
99
|
};
|
|
114
100
|
export function buildSmallTicketData(params) {
|
|
@@ -180,7 +166,7 @@ function buildBaseData(params) {
|
|
|
180
166
|
order_number: orderNumber,
|
|
181
167
|
shop_tax_number: stringify(shopInfo.tax_number || order.shop_tax_number),
|
|
182
168
|
shop_phone: stringify(shopInfo.phone || order.shop_phone),
|
|
183
|
-
shop_address: stringify(shopInfo.
|
|
169
|
+
shop_address: stringify(shopInfo.address || buildShopAddress(shopInfo) || order.shop_address),
|
|
184
170
|
original_payment_status: stringify(order.payment_status),
|
|
185
171
|
is_repeat: 0,
|
|
186
172
|
buzzer: stringify(order.buzzer || order.pickup_number || ((_order$metadata = order.metadata) === null || _order$metadata === void 0 ? void 0 : _order$metadata.buzzer)),
|
|
@@ -779,11 +765,6 @@ function buildPaymentData(params) {
|
|
|
779
765
|
item: paymentMethodName(payment, params.locale),
|
|
780
766
|
value: formatMoney((_payment$amount = payment.amount) !== null && _payment$amount !== void 0 ? _payment$amount : payment.origin_amount, params.currencySymbol)
|
|
781
767
|
}];
|
|
782
|
-
items.push.apply(items, _toConsumableArray(buildCashChangePaymentItems({
|
|
783
|
-
payment: payment,
|
|
784
|
-
locale: params.locale,
|
|
785
|
-
currencySymbol: params.currencySymbol
|
|
786
|
-
})));
|
|
787
768
|
var fundRecord = getFundRecord(payment);
|
|
788
769
|
if (fundRecord) {
|
|
789
770
|
items.push.apply(items, _toConsumableArray(buildFundRecordPaymentItems({
|
|
@@ -809,35 +790,6 @@ function buildPaymentData(params) {
|
|
|
809
790
|
return items;
|
|
810
791
|
});
|
|
811
792
|
}
|
|
812
|
-
function buildCashChangePaymentItems(params) {
|
|
813
|
-
var payment = params.payment,
|
|
814
|
-
locale = params.locale,
|
|
815
|
-
currencySymbol = params.currencySymbol;
|
|
816
|
-
if (!shouldDisplayCashChange(payment)) return [];
|
|
817
|
-
return [{
|
|
818
|
-
item: label(locale, 'cashReceived'),
|
|
819
|
-
value: formatMoney(payment.metadata.actual_paid_amount, currencySymbol)
|
|
820
|
-
}, {
|
|
821
|
-
item: label(locale, 'changeDue'),
|
|
822
|
-
value: formatMoney(payment.metadata.change_given_amount, currencySymbol)
|
|
823
|
-
}];
|
|
824
|
-
}
|
|
825
|
-
function shouldDisplayCashChange(payment) {
|
|
826
|
-
var _payment$code, _payment$metadata2, _payment$metadata3;
|
|
827
|
-
if (stringify(payment.status).toLowerCase() !== 'paid') return false;
|
|
828
|
-
var paymentMethod = stringify((_payment$code = payment.code) !== null && _payment$code !== void 0 ? _payment$code : payment.payment_method).toUpperCase();
|
|
829
|
-
if (paymentMethod !== 'CASHMANUAL') return false;
|
|
830
|
-
var actualPaidAmount = (_payment$metadata2 = payment.metadata) === null || _payment$metadata2 === void 0 ? void 0 : _payment$metadata2.actual_paid_amount;
|
|
831
|
-
var changeGivenAmount = (_payment$metadata3 = payment.metadata) === null || _payment$metadata3 === void 0 ? void 0 : _payment$metadata3.change_given_amount;
|
|
832
|
-
if (!isNumericAmount(actualPaidAmount) || !isNumericAmount(changeGivenAmount)) return false;
|
|
833
|
-
return new Decimal(changeGivenAmount).toDecimalPlaces(2).gt(0);
|
|
834
|
-
}
|
|
835
|
-
function isNumericAmount(value) {
|
|
836
|
-
if (typeof value === 'number') return Number.isFinite(value);
|
|
837
|
-
if (typeof value !== 'string') return false;
|
|
838
|
-
var normalized = value.trim();
|
|
839
|
-
return normalized !== '' && /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(normalized);
|
|
840
|
-
}
|
|
841
793
|
function buildFundRecordPaymentItems(params) {
|
|
842
794
|
var payment = params.payment,
|
|
843
795
|
fundRecord = params.fundRecord,
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 1 | 2 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 6 | 4 | 3 | 5;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -514,7 +514,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
514
514
|
generateIdempotencyToken(): string;
|
|
515
515
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
516
516
|
createOrder(params: CommitOrderParams['query']): {
|
|
517
|
-
type: "
|
|
517
|
+
type: "virtual" | "appointment_booking";
|
|
518
518
|
platform: string;
|
|
519
519
|
sales_channel: string;
|
|
520
520
|
order_sales_channel: string;
|
|
@@ -22,8 +22,6 @@ const LABELS = {
|
|
|
22
22
|
pickUpTime: 'Pick-up time',
|
|
23
23
|
asap: 'ASAP',
|
|
24
24
|
cash: 'Cash',
|
|
25
|
-
cashReceived: 'Cash received',
|
|
26
|
-
changeDue: 'Change due',
|
|
27
25
|
eftpos: 'Eftpos',
|
|
28
26
|
wallet: 'Wallet',
|
|
29
27
|
giftCard: 'Gift card',
|
|
@@ -50,8 +48,6 @@ const LABELS = {
|
|
|
50
48
|
pickUpTime: '取餐时间',
|
|
51
49
|
asap: '尽快',
|
|
52
50
|
cash: '现金支付',
|
|
53
|
-
cashReceived: '收取现金',
|
|
54
|
-
changeDue: '找零',
|
|
55
51
|
eftpos: '刷卡支付',
|
|
56
52
|
wallet: '钱包支付',
|
|
57
53
|
giftCard: '礼品卡',
|
|
@@ -78,8 +74,6 @@ const LABELS = {
|
|
|
78
74
|
pickUpTime: '取餐時間',
|
|
79
75
|
asap: '盡快',
|
|
80
76
|
cash: '現金支付',
|
|
81
|
-
cashReceived: '收取現金',
|
|
82
|
-
changeDue: '找零',
|
|
83
77
|
eftpos: '刷卡支付',
|
|
84
78
|
wallet: '錢包支付',
|
|
85
79
|
giftCard: '禮品卡',
|
|
@@ -93,14 +87,6 @@ const LABELS = {
|
|
|
93
87
|
rounding: '抹零',
|
|
94
88
|
gross: '重量',
|
|
95
89
|
tare: '去皮'
|
|
96
|
-
},
|
|
97
|
-
ja: {
|
|
98
|
-
cashReceived: 'お預かり',
|
|
99
|
-
changeDue: 'お釣り'
|
|
100
|
-
},
|
|
101
|
-
pt: {
|
|
102
|
-
cashReceived: 'Dinheiro recebido',
|
|
103
|
-
changeDue: 'Troco'
|
|
104
90
|
}
|
|
105
91
|
};
|
|
106
92
|
function buildSmallTicketData(params) {
|
|
@@ -175,7 +161,7 @@ function buildBaseData(params) {
|
|
|
175
161
|
order_number: orderNumber,
|
|
176
162
|
shop_tax_number: stringify(shopInfo.tax_number || order.shop_tax_number),
|
|
177
163
|
shop_phone: stringify(shopInfo.phone || order.shop_phone),
|
|
178
|
-
shop_address: stringify(shopInfo.
|
|
164
|
+
shop_address: stringify(shopInfo.address || buildShopAddress(shopInfo) || order.shop_address),
|
|
179
165
|
original_payment_status: stringify(order.payment_status),
|
|
180
166
|
is_repeat: 0,
|
|
181
167
|
buzzer: stringify(order.buzzer || order.pickup_number || order.metadata?.buzzer),
|
|
@@ -748,11 +734,6 @@ function buildPaymentData(params) {
|
|
|
748
734
|
item: paymentMethodName(payment, params.locale),
|
|
749
735
|
value: formatMoney(payment.amount ?? payment.origin_amount, params.currencySymbol)
|
|
750
736
|
}];
|
|
751
|
-
items.push(...buildCashChangePaymentItems({
|
|
752
|
-
payment,
|
|
753
|
-
locale: params.locale,
|
|
754
|
-
currencySymbol: params.currencySymbol
|
|
755
|
-
}));
|
|
756
737
|
const fundRecord = getFundRecord(payment);
|
|
757
738
|
if (fundRecord) {
|
|
758
739
|
items.push(...buildFundRecordPaymentItems({
|
|
@@ -777,36 +758,6 @@ function buildPaymentData(params) {
|
|
|
777
758
|
return items;
|
|
778
759
|
});
|
|
779
760
|
}
|
|
780
|
-
function buildCashChangePaymentItems(params) {
|
|
781
|
-
const {
|
|
782
|
-
payment,
|
|
783
|
-
locale,
|
|
784
|
-
currencySymbol
|
|
785
|
-
} = params;
|
|
786
|
-
if (!shouldDisplayCashChange(payment)) return [];
|
|
787
|
-
return [{
|
|
788
|
-
item: label(locale, 'cashReceived'),
|
|
789
|
-
value: formatMoney(payment.metadata.actual_paid_amount, currencySymbol)
|
|
790
|
-
}, {
|
|
791
|
-
item: label(locale, 'changeDue'),
|
|
792
|
-
value: formatMoney(payment.metadata.change_given_amount, currencySymbol)
|
|
793
|
-
}];
|
|
794
|
-
}
|
|
795
|
-
function shouldDisplayCashChange(payment) {
|
|
796
|
-
if (stringify(payment.status).toLowerCase() !== 'paid') return false;
|
|
797
|
-
const paymentMethod = stringify(payment.code ?? payment.payment_method).toUpperCase();
|
|
798
|
-
if (paymentMethod !== 'CASHMANUAL') return false;
|
|
799
|
-
const actualPaidAmount = payment.metadata?.actual_paid_amount;
|
|
800
|
-
const changeGivenAmount = payment.metadata?.change_given_amount;
|
|
801
|
-
if (!isNumericAmount(actualPaidAmount) || !isNumericAmount(changeGivenAmount)) return false;
|
|
802
|
-
return new _decimal.default(changeGivenAmount).toDecimalPlaces(2).gt(0);
|
|
803
|
-
}
|
|
804
|
-
function isNumericAmount(value) {
|
|
805
|
-
if (typeof value === 'number') return Number.isFinite(value);
|
|
806
|
-
if (typeof value !== 'string') return false;
|
|
807
|
-
const normalized = value.trim();
|
|
808
|
-
return normalized !== '' && /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(normalized);
|
|
809
|
-
}
|
|
810
761
|
function buildFundRecordPaymentItems(params) {
|
|
811
762
|
const {
|
|
812
763
|
payment,
|
|
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
326
326
|
date: string;
|
|
327
327
|
status: string;
|
|
328
328
|
week: string;
|
|
329
|
-
weekNum: 0 | 1 | 2 |
|
|
329
|
+
weekNum: 0 | 1 | 2 | 6 | 4 | 3 | 5;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|