@pisell/pisellos 0.10.29 → 0.10.31
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/modules/Order/index.d.ts +1 -1
- package/dist/server/utils/small-ticket.js +63 -3
- 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 +61 -2
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -535,7 +535,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
535
535
|
generateIdempotencyToken(): string;
|
|
536
536
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
537
537
|
createOrder(params: CommitOrderParams['query']): {
|
|
538
|
-
type: "
|
|
538
|
+
type: "appointment_booking" | "virtual";
|
|
539
539
|
platform: string;
|
|
540
540
|
sales_channel: string;
|
|
541
541
|
order_sales_channel: string;
|
|
@@ -35,6 +35,7 @@ var LABELS = {
|
|
|
35
35
|
eftpos: 'Eftpos',
|
|
36
36
|
wallet: 'Wallet',
|
|
37
37
|
giftCard: 'Gift card',
|
|
38
|
+
pointCard: 'Point card',
|
|
38
39
|
balance: 'Balance',
|
|
39
40
|
remainingAmount: 'Remaining amount',
|
|
40
41
|
redeemPoints: 'Redeem points',
|
|
@@ -67,6 +68,7 @@ var LABELS = {
|
|
|
67
68
|
eftpos: '刷卡支付',
|
|
68
69
|
wallet: '钱包支付',
|
|
69
70
|
giftCard: '礼品卡',
|
|
71
|
+
pointCard: '积分卡',
|
|
70
72
|
balance: '余额',
|
|
71
73
|
remainingAmount: '剩余金额',
|
|
72
74
|
redeemPoints: '本次使用积分',
|
|
@@ -99,6 +101,7 @@ var LABELS = {
|
|
|
99
101
|
eftpos: '刷卡支付',
|
|
100
102
|
wallet: '錢包支付',
|
|
101
103
|
giftCard: '禮品卡',
|
|
104
|
+
pointCard: '積分卡',
|
|
102
105
|
balance: '餘額',
|
|
103
106
|
remainingAmount: '剩餘金額',
|
|
104
107
|
redeemPoints: '本次使用積分',
|
|
@@ -129,6 +132,7 @@ var LABELS = {
|
|
|
129
132
|
eftpos: 'カード',
|
|
130
133
|
wallet: 'ウォレット',
|
|
131
134
|
giftCard: 'ギフトカード',
|
|
135
|
+
pointCard: 'ポイントカード',
|
|
132
136
|
balance: '残高',
|
|
133
137
|
remainingAmount: '残高',
|
|
134
138
|
redeemPoints: '利用ポイント',
|
|
@@ -160,6 +164,7 @@ var LABELS = {
|
|
|
160
164
|
eftpos: 'Cartão',
|
|
161
165
|
wallet: 'Carteira',
|
|
162
166
|
giftCard: 'Cartão-presente',
|
|
167
|
+
pointCard: 'Cartão de pontos',
|
|
163
168
|
balance: 'Saldo',
|
|
164
169
|
remainingAmount: 'Saldo restante',
|
|
165
170
|
redeemPoints: 'Pontos utilizados',
|
|
@@ -1120,9 +1125,10 @@ function resolveRefundPayment(refund, payments) {
|
|
|
1120
1125
|
return matchedPayment || refund;
|
|
1121
1126
|
}
|
|
1122
1127
|
function buildWallets(params) {
|
|
1123
|
-
var
|
|
1128
|
+
var displayedWalletPayments = normalizeArray(params.order.payments).filter(function (payment) {
|
|
1124
1129
|
return isPrintablePayment(payment) && !!getFundRecord(payment);
|
|
1125
|
-
})
|
|
1130
|
+
});
|
|
1131
|
+
var paymentWallets = displayedWalletPayments.map(function (payment) {
|
|
1126
1132
|
return buildPaymentItems({
|
|
1127
1133
|
payment: payment,
|
|
1128
1134
|
locale: params.locale,
|
|
@@ -1130,7 +1136,61 @@ function buildWallets(params) {
|
|
|
1130
1136
|
includeFundRecordBalance: true
|
|
1131
1137
|
});
|
|
1132
1138
|
});
|
|
1133
|
-
|
|
1139
|
+
var displayedWalletPassIds = collectDisplayedWalletPassIds(displayedWalletPayments);
|
|
1140
|
+
return [].concat(_toConsumableArray(paymentWallets), _toConsumableArray(buildVoucherAssets(params)), _toConsumableArray(buildPointCardSnapshotAssets({
|
|
1141
|
+
order: params.order,
|
|
1142
|
+
locale: params.locale,
|
|
1143
|
+
displayedWalletPassIds: displayedWalletPassIds
|
|
1144
|
+
})));
|
|
1145
|
+
}
|
|
1146
|
+
function collectDisplayedWalletPassIds(payments) {
|
|
1147
|
+
var ids = new Set();
|
|
1148
|
+
payments.forEach(function (payment) {
|
|
1149
|
+
var fundRecord = getFundRecord(payment);
|
|
1150
|
+
[payment.voucher_id, fundRecord === null || fundRecord === void 0 ? void 0 : fundRecord.voucher_id].forEach(function (value) {
|
|
1151
|
+
var id = normalizeWalletPassId(value);
|
|
1152
|
+
if (id) ids.add(id);
|
|
1153
|
+
});
|
|
1154
|
+
});
|
|
1155
|
+
return ids;
|
|
1156
|
+
}
|
|
1157
|
+
function buildPointCardSnapshotAssets(params) {
|
|
1158
|
+
var _params$order$order_m;
|
|
1159
|
+
var snapshots = (_params$order$order_m = params.order.order_meta_list) === null || _params$order$order_m === void 0 ? void 0 : _params$order$order_m.point_cards_snapshot;
|
|
1160
|
+
if (!Array.isArray(snapshots)) return [];
|
|
1161
|
+
var seenSnapshotIds = new Set();
|
|
1162
|
+
return snapshots.flatMap(function (snapshot) {
|
|
1163
|
+
if (!snapshot || _typeof(snapshot) !== 'object' || Array.isArray(snapshot)) return [];
|
|
1164
|
+
var pointCard = snapshot;
|
|
1165
|
+
if (stringify(pointCard.tag).trim().toLowerCase() !== 'point_card') return [];
|
|
1166
|
+
var id = normalizeWalletPassId(pointCard.id);
|
|
1167
|
+
if (!id || seenSnapshotIds.has(id)) return [];
|
|
1168
|
+
seenSnapshotIds.add(id);
|
|
1169
|
+
if (params.displayedWalletPassIds.has(id)) return [];
|
|
1170
|
+
var rows = [{
|
|
1171
|
+
item: stringify(pointCard.product_name).trim() || label(params.locale, 'pointCard'),
|
|
1172
|
+
value: ''
|
|
1173
|
+
}];
|
|
1174
|
+
var remainingPoints = getPointCardSnapshotRemainingPoints(pointCard);
|
|
1175
|
+
if (remainingPoints) {
|
|
1176
|
+
rows.push({
|
|
1177
|
+
item: label(params.locale, 'remainingPoints'),
|
|
1178
|
+
value: trimDecimal(remainingPoints)
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
return [rows];
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
function normalizeWalletPassId(value) {
|
|
1185
|
+
if (typeof value === 'number') return Number.isFinite(value) ? String(value) : null;
|
|
1186
|
+
if (typeof value !== 'string') return null;
|
|
1187
|
+
return value.trim() || null;
|
|
1188
|
+
}
|
|
1189
|
+
function getPointCardSnapshotRemainingPoints(snapshot) {
|
|
1190
|
+
if (!isNumericAmount(snapshot.par_value) || !isNumericAmount(snapshot.used_par_value)) {
|
|
1191
|
+
return null;
|
|
1192
|
+
}
|
|
1193
|
+
return Decimal.max(new Decimal(snapshot.par_value).minus(new Decimal(snapshot.used_par_value)), 0);
|
|
1134
1194
|
}
|
|
1135
1195
|
function buildVoucherAssets(params) {
|
|
1136
1196
|
var seenVoucherKeys = new Set();
|
|
@@ -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 |
|
|
329
|
+
weekNum: 0 | 5 | 3 | 1 | 2 | 4 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|
|
@@ -535,7 +535,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
535
535
|
generateIdempotencyToken(): string;
|
|
536
536
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
537
537
|
createOrder(params: CommitOrderParams['query']): {
|
|
538
|
-
type: "
|
|
538
|
+
type: "appointment_booking" | "virtual";
|
|
539
539
|
platform: string;
|
|
540
540
|
sales_channel: string;
|
|
541
541
|
order_sales_channel: string;
|
|
@@ -27,6 +27,7 @@ const LABELS = {
|
|
|
27
27
|
eftpos: 'Eftpos',
|
|
28
28
|
wallet: 'Wallet',
|
|
29
29
|
giftCard: 'Gift card',
|
|
30
|
+
pointCard: 'Point card',
|
|
30
31
|
balance: 'Balance',
|
|
31
32
|
remainingAmount: 'Remaining amount',
|
|
32
33
|
redeemPoints: 'Redeem points',
|
|
@@ -59,6 +60,7 @@ const LABELS = {
|
|
|
59
60
|
eftpos: '刷卡支付',
|
|
60
61
|
wallet: '钱包支付',
|
|
61
62
|
giftCard: '礼品卡',
|
|
63
|
+
pointCard: '积分卡',
|
|
62
64
|
balance: '余额',
|
|
63
65
|
remainingAmount: '剩余金额',
|
|
64
66
|
redeemPoints: '本次使用积分',
|
|
@@ -91,6 +93,7 @@ const LABELS = {
|
|
|
91
93
|
eftpos: '刷卡支付',
|
|
92
94
|
wallet: '錢包支付',
|
|
93
95
|
giftCard: '禮品卡',
|
|
96
|
+
pointCard: '積分卡',
|
|
94
97
|
balance: '餘額',
|
|
95
98
|
remainingAmount: '剩餘金額',
|
|
96
99
|
redeemPoints: '本次使用積分',
|
|
@@ -121,6 +124,7 @@ const LABELS = {
|
|
|
121
124
|
eftpos: 'カード',
|
|
122
125
|
wallet: 'ウォレット',
|
|
123
126
|
giftCard: 'ギフトカード',
|
|
127
|
+
pointCard: 'ポイントカード',
|
|
124
128
|
balance: '残高',
|
|
125
129
|
remainingAmount: '残高',
|
|
126
130
|
redeemPoints: '利用ポイント',
|
|
@@ -152,6 +156,7 @@ const LABELS = {
|
|
|
152
156
|
eftpos: 'Cartão',
|
|
153
157
|
wallet: 'Carteira',
|
|
154
158
|
giftCard: 'Cartão-presente',
|
|
159
|
+
pointCard: 'Cartão de pontos',
|
|
155
160
|
balance: 'Saldo',
|
|
156
161
|
remainingAmount: 'Saldo restante',
|
|
157
162
|
redeemPoints: 'Pontos utilizados',
|
|
@@ -1083,13 +1088,67 @@ function resolveRefundPayment(refund, payments) {
|
|
|
1083
1088
|
return matchedPayment || refund;
|
|
1084
1089
|
}
|
|
1085
1090
|
function buildWallets(params) {
|
|
1086
|
-
const
|
|
1091
|
+
const displayedWalletPayments = normalizeArray(params.order.payments).filter(payment => isPrintablePayment(payment) && !!getFundRecord(payment));
|
|
1092
|
+
const paymentWallets = displayedWalletPayments.map(payment => buildPaymentItems({
|
|
1087
1093
|
payment,
|
|
1088
1094
|
locale: params.locale,
|
|
1089
1095
|
currencySymbol: params.currencySymbol,
|
|
1090
1096
|
includeFundRecordBalance: true
|
|
1091
1097
|
}));
|
|
1092
|
-
|
|
1098
|
+
const displayedWalletPassIds = collectDisplayedWalletPassIds(displayedWalletPayments);
|
|
1099
|
+
return [...paymentWallets, ...buildVoucherAssets(params), ...buildPointCardSnapshotAssets({
|
|
1100
|
+
order: params.order,
|
|
1101
|
+
locale: params.locale,
|
|
1102
|
+
displayedWalletPassIds
|
|
1103
|
+
})];
|
|
1104
|
+
}
|
|
1105
|
+
function collectDisplayedWalletPassIds(payments) {
|
|
1106
|
+
const ids = new Set();
|
|
1107
|
+
payments.forEach(payment => {
|
|
1108
|
+
const fundRecord = getFundRecord(payment);
|
|
1109
|
+
[payment.voucher_id, fundRecord?.voucher_id].forEach(value => {
|
|
1110
|
+
const id = normalizeWalletPassId(value);
|
|
1111
|
+
if (id) ids.add(id);
|
|
1112
|
+
});
|
|
1113
|
+
});
|
|
1114
|
+
return ids;
|
|
1115
|
+
}
|
|
1116
|
+
function buildPointCardSnapshotAssets(params) {
|
|
1117
|
+
const snapshots = params.order.order_meta_list?.point_cards_snapshot;
|
|
1118
|
+
if (!Array.isArray(snapshots)) return [];
|
|
1119
|
+
const seenSnapshotIds = new Set();
|
|
1120
|
+
return snapshots.flatMap(snapshot => {
|
|
1121
|
+
if (!snapshot || typeof snapshot !== 'object' || Array.isArray(snapshot)) return [];
|
|
1122
|
+
const pointCard = snapshot;
|
|
1123
|
+
if (stringify(pointCard.tag).trim().toLowerCase() !== 'point_card') return [];
|
|
1124
|
+
const id = normalizeWalletPassId(pointCard.id);
|
|
1125
|
+
if (!id || seenSnapshotIds.has(id)) return [];
|
|
1126
|
+
seenSnapshotIds.add(id);
|
|
1127
|
+
if (params.displayedWalletPassIds.has(id)) return [];
|
|
1128
|
+
const rows = [{
|
|
1129
|
+
item: stringify(pointCard.product_name).trim() || label(params.locale, 'pointCard'),
|
|
1130
|
+
value: ''
|
|
1131
|
+
}];
|
|
1132
|
+
const remainingPoints = getPointCardSnapshotRemainingPoints(pointCard);
|
|
1133
|
+
if (remainingPoints) {
|
|
1134
|
+
rows.push({
|
|
1135
|
+
item: label(params.locale, 'remainingPoints'),
|
|
1136
|
+
value: trimDecimal(remainingPoints)
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
return [rows];
|
|
1140
|
+
});
|
|
1141
|
+
}
|
|
1142
|
+
function normalizeWalletPassId(value) {
|
|
1143
|
+
if (typeof value === 'number') return Number.isFinite(value) ? String(value) : null;
|
|
1144
|
+
if (typeof value !== 'string') return null;
|
|
1145
|
+
return value.trim() || null;
|
|
1146
|
+
}
|
|
1147
|
+
function getPointCardSnapshotRemainingPoints(snapshot) {
|
|
1148
|
+
if (!isNumericAmount(snapshot.par_value) || !isNumericAmount(snapshot.used_par_value)) {
|
|
1149
|
+
return null;
|
|
1150
|
+
}
|
|
1151
|
+
return _decimal.default.max(new _decimal.default(snapshot.par_value).minus(new _decimal.default(snapshot.used_par_value)), 0);
|
|
1093
1152
|
}
|
|
1094
1153
|
function buildVoucherAssets(params) {
|
|
1095
1154
|
const seenVoucherKeys = new Set();
|
|
@@ -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 |
|
|
329
|
+
weekNum: 0 | 5 | 3 | 1 | 2 | 4 | 6;
|
|
330
330
|
}[]>;
|
|
331
331
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
332
332
|
private getScheduleDataByIds;
|