@pisell/pisellos 2.3.192 → 2.3.194
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 +9 -0
- package/dist/modules/OpenData/types.d.ts +3 -0
- package/dist/modules/Order/index.d.ts +1 -1
- package/dist/modules/Order/utils.d.ts +3 -1
- package/dist/modules/Order/utils.js +5 -2
- package/dist/modules/Rules/index.js +30 -19
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +76 -61
- package/dist/solution/BaseSales/index.d.ts +3 -0
- package/dist/solution/BaseSales/index.js +45 -36
- package/dist/solution/BookingByStep/index.d.ts +1 -1
- package/dist/solution/UnifiedBookingSales/index.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/index.js +35 -25
- package/dist/utils/pos-receipt-auto-print.d.ts +4 -0
- package/dist/utils/pos-receipt-auto-print.js +14 -0
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/modules/OpenData/types.d.ts +3 -0
- package/lib/modules/Order/index.d.ts +1 -1
- package/lib/modules/Order/utils.d.ts +3 -1
- package/lib/modules/Order/utils.js +5 -2
- package/lib/modules/Rules/index.js +19 -9
- package/lib/server/index.d.ts +2 -0
- package/lib/server/index.js +17 -6
- package/lib/solution/BaseSales/index.d.ts +3 -0
- package/lib/solution/BaseSales/index.js +11 -1
- package/lib/solution/BookingByStep/index.d.ts +1 -1
- package/lib/solution/UnifiedBookingSales/index.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/index.js +7 -0
- package/lib/utils/pos-receipt-auto-print.d.ts +4 -0
- package/lib/utils/pos-receipt-auto-print.js +13 -0
- package/package.json +1 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ScheduleItem } from '../Schedule/types';
|
|
2
|
+
import type { PosReceiptAutoPrintPaymentStatus } from '../../utils/pos-receipt-auto-print';
|
|
3
|
+
export type { PosReceiptAutoPrintPaymentStatus } from '../../utils/pos-receipt-auto-print';
|
|
2
4
|
export interface MultiLangObject {
|
|
3
5
|
en?: string;
|
|
4
6
|
ja?: string;
|
|
@@ -126,6 +128,7 @@ export interface OpenDataConfig {
|
|
|
126
128
|
}>;
|
|
127
129
|
'documents.invoice_template'?: string | number;
|
|
128
130
|
'documents.invoice_edit'?: RawInvoiceEditConfig;
|
|
131
|
+
'documents.pos_receipt_auto_print_payment_statuses'?: PosReceiptAutoPrintPaymentStatus[];
|
|
129
132
|
/** @deprecated 仅保留旧调用方的类型兼容,Invoice 读取逻辑不再消费该字段。 */
|
|
130
133
|
'documents.invoice'?: RawInvoiceLayoutConfig;
|
|
131
134
|
/** @deprecated Invoice 读取逻辑只消费扁平的 documents.invoice_* 字段。 */
|
|
@@ -637,7 +637,7 @@ export declare class OrderModule extends BaseModule implements Module, OrderModu
|
|
|
637
637
|
generateIdempotencyToken(): string;
|
|
638
638
|
syncPaymentsToOrder<T = any>(params: SyncPaymentsToOrderParams): Promise<SyncPaymentsToOrderResult<T>>;
|
|
639
639
|
createOrder(params: CommitOrderParams['query']): {
|
|
640
|
-
type: "
|
|
640
|
+
type: "appointment_booking" | "virtual";
|
|
641
641
|
platform: string;
|
|
642
642
|
sales_channel: string;
|
|
643
643
|
order_sales_channel: string;
|
|
@@ -128,7 +128,9 @@ export declare function getBundleSellingMagnitude(bundle: Record<string, any> |
|
|
|
128
128
|
*
|
|
129
129
|
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
130
130
|
* - `getProduct.price` / `getProduct.original_price` 回传 **source-level 主价**
|
|
131
|
-
* (`metadata.source_product_price
|
|
131
|
+
* (`metadata.source_product_price`);买赠行的 `price` 为 0,`original_price` 仍保留 source。
|
|
132
|
+
* 赠品基础价已被赠送优惠抵扣,只有收费 option / bundle 继续按卡券规则计算。
|
|
133
|
+
* Rules 内部 `getProductTotalPrice` /
|
|
132
134
|
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
133
135
|
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
134
136
|
* total(source + option + bundle)对齐。
|
|
@@ -651,7 +651,9 @@ function getBundleSellingMagnitude(bundle) {
|
|
|
651
651
|
*
|
|
652
652
|
* Rules 钩子契约(hook_adapt 方案,Rules 内部保持不变):
|
|
653
653
|
* - `getProduct.price` / `getProduct.original_price` 回传 **source-level 主价**
|
|
654
|
-
* (`metadata.source_product_price
|
|
654
|
+
* (`metadata.source_product_price`);买赠行的 `price` 为 0,`original_price` 仍保留 source。
|
|
655
|
+
* 赠品基础价已被赠送优惠抵扣,只有收费 option / bundle 继续按卡券规则计算。
|
|
656
|
+
* Rules 内部 `getProductTotalPrice` /
|
|
655
657
|
* `getProductOriginTotalPrice` 会自行叠加 option + bundle,喂 source 可避免 option 双加。
|
|
656
658
|
* - `getProduct.total` = `selling_price × num`(行 composite × num),与 Rules 内部产出的
|
|
657
659
|
* total(source + option + bundle)对齐。
|
|
@@ -934,7 +936,8 @@ function createDefaultOrderRulesHooks(getBookings, getHolderRelations) {
|
|
|
934
936
|
_id: product.metadata?.unique_identification_number ? `${product.product_id}_${product.product_variant_id}_${product.metadata.unique_identification_number}` : `${product.product_id}_${product.product_variant_id}_${(0, _utils2.buildProductLineFingerprint)(getProductSkuOptions(product), product.product_bundle)}`,
|
|
935
937
|
// Rules 内部 getProductTotalPrice / getProductOriginTotalPrice 会各自再叠加 bundle + option,
|
|
936
938
|
// 所以这里必须喂 source-level(不含 option、不含 bundle、不含折扣)单价,避免双加 option。
|
|
937
|
-
|
|
939
|
+
// 赠品基础价不再参与卡券;source 元数据保留原价,供后续与赠送优惠相抵。
|
|
940
|
+
price: metadataAny._giftInfo ? '0.00' : sourcePrice,
|
|
938
941
|
// total / origin_total 使用 composite × num,跟 Rules 内部产出的 total 对齐(含 option + bundle)。
|
|
939
942
|
total: new _decimal.default(product.selling_price || 0).times(product.num || 1).toNumber(),
|
|
940
943
|
origin_total: new _decimal.default(product.original_price || product.selling_price || 0).times(product.num || 1).toNumber(),
|
|
@@ -940,6 +940,22 @@ class RulesModule extends _BaseModule.BaseModule {
|
|
|
940
940
|
|
|
941
941
|
// 记录已应用优惠券的商品信息
|
|
942
942
|
const appliedDiscountProducts = new Map();
|
|
943
|
+
const hasPayableOptions = product => {
|
|
944
|
+
return (product.options || []).reduce((total, option) => {
|
|
945
|
+
const unitPrice = Number(option._original_price ?? option._original_add_price ?? option.price ?? option.add_price ?? 0);
|
|
946
|
+
const quantity = Number(option.num ?? option.quantity ?? 1);
|
|
947
|
+
if (!Number.isFinite(unitPrice) || !Number.isFinite(quantity) || quantity <= 0) {
|
|
948
|
+
return total;
|
|
949
|
+
}
|
|
950
|
+
return total.plus(new _decimal.default(unitPrice).mul(quantity));
|
|
951
|
+
}, new _decimal.default(0)).greaterThan(0);
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
// 只排除赠品主项的零可抵扣金额;收费 option 和独立 bundle 保持原有规则。
|
|
955
|
+
const isGiftWithoutDeductibleAmount = (flatItem, discount) => {
|
|
956
|
+
if (flatItem.type !== 'main' || !flatItem.originProduct?.metadata?._giftInfo || Number(flatItem.price || 0) > 0) return false;
|
|
957
|
+
return !discount.config?.deductOptionPrice || !hasPayableOptions(flatItem.product);
|
|
958
|
+
};
|
|
943
959
|
|
|
944
960
|
// 可用性和实际应用共用金额判断;零基础价商品可按策略抵扣收费 option。
|
|
945
961
|
const isDiscountCardPriceAvailable = (flatItem, discount) => {
|
|
@@ -950,14 +966,7 @@ class RulesModule extends _BaseModule.BaseModule {
|
|
|
950
966
|
if (flatItem.type !== 'main' || Number(flatItem.price) !== 0 || !['discount_card', 'product_discount_card'].includes(discount.tag || discount.type || '') || !discount.config?.deductOptionPrice || (0, _utils.isOrderLevelFixedAmountDiscount)(discount)) {
|
|
951
967
|
return false;
|
|
952
968
|
}
|
|
953
|
-
return (product
|
|
954
|
-
const unitPrice = Number(option._original_price ?? option._original_add_price ?? option.price ?? option.add_price ?? 0);
|
|
955
|
-
const quantity = Number(option.num ?? option.quantity ?? 1);
|
|
956
|
-
if (!Number.isFinite(unitPrice) || !Number.isFinite(quantity) || quantity <= 0) {
|
|
957
|
-
return total;
|
|
958
|
-
}
|
|
959
|
-
return total.plus(new _decimal.default(unitPrice).mul(quantity));
|
|
960
|
-
}, new _decimal.default(0)).greaterThan(0);
|
|
969
|
+
return hasPayableOptions(product);
|
|
961
970
|
};
|
|
962
971
|
|
|
963
972
|
// 首先遍历所有商品和所有优惠券,确定每个优惠券的适用范围,包括isSelected为false的优惠券
|
|
@@ -1012,7 +1021,7 @@ class RulesModule extends _BaseModule.BaseModule {
|
|
|
1012
1021
|
}
|
|
1013
1022
|
|
|
1014
1023
|
// 判断优惠券是否适用于该商品
|
|
1015
|
-
if (isAvailableProduct && !isItemRewardProductDiscount && isLimitedProduct && timeLimit && isBundleAvailable && discount.config?.isAvailable && ((0, _entitlementPass.isFullCoveragePass)(discount) || isDiscountCardPriceAvailable(flatItem, discount)) && (!(0, _entitlementPass.isEntitlementPass)(discount) || (0, _entitlementPass.getRemainingEntitlementUses)(discount, 0, 1) > 0)) {
|
|
1024
|
+
if (isAvailableProduct && !isItemRewardProductDiscount && !isGiftWithoutDeductibleAmount(flatItem, discount) && isLimitedProduct && timeLimit && isBundleAvailable && discount.config?.isAvailable && ((0, _entitlementPass.isFullCoveragePass)(discount) || isDiscountCardPriceAvailable(flatItem, discount)) && (!(0, _entitlementPass.isEntitlementPass)(discount) || (0, _entitlementPass.getRemainingEntitlementUses)(discount, 0, 1) > 0)) {
|
|
1016
1025
|
// 记录此优惠券适用的商品
|
|
1017
1026
|
discountApplicability.get(discount.id)?.push(product.id);
|
|
1018
1027
|
if (flatItem.type === 'main' && (0, _promotionSelection.isPromotionDiscountCard)(discount)) {
|
|
@@ -1161,6 +1170,7 @@ class RulesModule extends _BaseModule.BaseModule {
|
|
|
1161
1170
|
|
|
1162
1171
|
// 找到适用于此商品的所有优惠券,仅考虑isSelected不为false的优惠券
|
|
1163
1172
|
const applicableDiscounts = sortedDiscountList.filter(discount => {
|
|
1173
|
+
if (isGiftWithoutDeductibleAmount(flatItem, discount)) return false;
|
|
1164
1174
|
if (this.discountScope && !this.discountScope(originProduct, discount)) return false;
|
|
1165
1175
|
if (this.isItemRewardProductDiscount(product)) return false;
|
|
1166
1176
|
if (isCardBlockedByPromotion(flatItem, discount)) return false;
|
package/lib/server/index.d.ts
CHANGED
|
@@ -563,6 +563,8 @@ declare class Server {
|
|
|
563
563
|
* Android 结账自动小票由当前设备设置控制;其它平台保持原有行为。
|
|
564
564
|
*/
|
|
565
565
|
private shouldAutoPrintCheckoutReceipt;
|
|
566
|
+
/** Only receipt auto-printing uses this policy; vouchers retain their paid-order gate. */
|
|
567
|
+
private shouldAutoPrintReceiptForPaymentStatus;
|
|
566
568
|
private shouldBuildSmallTicketData;
|
|
567
569
|
private shouldPrintSyncedOrder;
|
|
568
570
|
private hasPaymentStatus;
|
package/lib/server/index.js
CHANGED
|
@@ -33,6 +33,7 @@ var _paymentUtils = require("../modules/Order/payment-utils");
|
|
|
33
33
|
var _salesNotes = require("../modules/Order/salesNotes");
|
|
34
34
|
var _orderCollectionIdentity = require("../modules/Order/utils/orderCollectionIdentity");
|
|
35
35
|
var _osPrivatePayload = require("../utils/os-private-payload");
|
|
36
|
+
var _posReceiptAutoPrint = require("../utils/pos-receipt-auto-print");
|
|
36
37
|
var _OpenData = require("../modules/OpenData");
|
|
37
38
|
var _modules = require("./modules");
|
|
38
39
|
Object.keys(_modules).forEach(function (key) {
|
|
@@ -4459,6 +4460,7 @@ class Server {
|
|
|
4459
4460
|
const data = extractedTemplateSettings.data;
|
|
4460
4461
|
const invoiceLayoutConfig = extractedInvoice.invoiceLayoutConfig;
|
|
4461
4462
|
const invoiceTemplateSettings = this.normalizePrintInvoiceTemplateSettings(extractedTemplateSettings.invoiceTemplateSettings);
|
|
4463
|
+
const receiptAutoPrintPaymentStatuses = (0, _posReceiptAutoPrint.normalizePosReceiptAutoPrintPaymentStatuses)(data?.[_posReceiptAutoPrint.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD]);
|
|
4462
4464
|
this.logInfo(`${title}: 开始处理`, {
|
|
4463
4465
|
backendPath,
|
|
4464
4466
|
order_id: data?.order_id,
|
|
@@ -4471,7 +4473,8 @@ class Server {
|
|
|
4471
4473
|
data,
|
|
4472
4474
|
title,
|
|
4473
4475
|
invoiceLayoutConfig,
|
|
4474
|
-
invoiceTemplateSettings
|
|
4476
|
+
invoiceTemplateSettings,
|
|
4477
|
+
receiptAutoPrintPaymentStatuses
|
|
4475
4478
|
});
|
|
4476
4479
|
}
|
|
4477
4480
|
const normalizedData = await this.normalizeCheckoutSubmitData(data, title);
|
|
@@ -4486,13 +4489,13 @@ class Server {
|
|
|
4486
4489
|
});
|
|
4487
4490
|
if (pendingResult?.status === true) {
|
|
4488
4491
|
const pendingOrder = pendingResult.data;
|
|
4489
|
-
if (pendingOrder && this.shouldBuildSmallTicketData(checkoutData, invoiceTemplateSettings) && this.
|
|
4492
|
+
if (pendingOrder && this.shouldBuildSmallTicketData(checkoutData, invoiceTemplateSettings) && this.shouldAutoPrintReceiptForPaymentStatus(pendingOrder, receiptAutoPrintPaymentStatuses) && this.shouldAutoPrintCheckoutReceipt()) {
|
|
4490
4493
|
try {
|
|
4491
4494
|
await this.dispatchLocalReceiptPrint({
|
|
4492
4495
|
checkoutData,
|
|
4493
4496
|
order: pendingOrder,
|
|
4494
4497
|
response: pendingResult,
|
|
4495
|
-
requireFullyPaid:
|
|
4498
|
+
requireFullyPaid: receiptAutoPrintPaymentStatuses === undefined,
|
|
4496
4499
|
invoiceLayoutConfig,
|
|
4497
4500
|
invoiceTemplateSettings
|
|
4498
4501
|
});
|
|
@@ -4530,7 +4533,8 @@ class Server {
|
|
|
4530
4533
|
data,
|
|
4531
4534
|
title,
|
|
4532
4535
|
invoiceLayoutConfig,
|
|
4533
|
-
invoiceTemplateSettings
|
|
4536
|
+
invoiceTemplateSettings,
|
|
4537
|
+
receiptAutoPrintPaymentStatuses
|
|
4534
4538
|
} = params;
|
|
4535
4539
|
if (!this.app?.request?.post) {
|
|
4536
4540
|
this.logError(`${title}: sync checkout app.request 不可用`);
|
|
@@ -4561,13 +4565,13 @@ class Server {
|
|
|
4561
4565
|
}
|
|
4562
4566
|
const response = this.withSyncedOrderIdInCheckoutResponse(syncResult.normalizedResponse, syncResult.syncedOrder);
|
|
4563
4567
|
const syncedOrder = syncResult.syncedOrder;
|
|
4564
|
-
if (syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData, invoiceTemplateSettings) && this.
|
|
4568
|
+
if (syncedOrder && this.shouldBuildSmallTicketData(syncResult.checkoutData, invoiceTemplateSettings) && this.shouldAutoPrintReceiptForPaymentStatus(syncedOrder, receiptAutoPrintPaymentStatuses) && (receiptAutoPrintPaymentStatuses === undefined || this.shouldAutoPrintCheckoutReceipt())) {
|
|
4565
4569
|
try {
|
|
4566
4570
|
await this.dispatchLocalReceiptPrint({
|
|
4567
4571
|
checkoutData: syncResult.checkoutData,
|
|
4568
4572
|
order: syncedOrder,
|
|
4569
4573
|
response: syncResult.normalizedResponse,
|
|
4570
|
-
requireFullyPaid:
|
|
4574
|
+
requireFullyPaid: receiptAutoPrintPaymentStatuses === undefined,
|
|
4571
4575
|
invoiceLayoutConfig,
|
|
4572
4576
|
invoiceTemplateSettings
|
|
4573
4577
|
});
|
|
@@ -4787,6 +4791,13 @@ class Server {
|
|
|
4787
4791
|
if (this.core.context?.getPlatform?.() !== 'android') return true;
|
|
4788
4792
|
return this.app?.storage?.getStorage?.(AUTO_PRINT_STORAGE_KEY) !== 'false';
|
|
4789
4793
|
}
|
|
4794
|
+
|
|
4795
|
+
/** Only receipt auto-printing uses this policy; vouchers retain their paid-order gate. */
|
|
4796
|
+
shouldAutoPrintReceiptForPaymentStatus(order, statuses) {
|
|
4797
|
+
if (statuses === undefined) return this.isSalesOrderFullyPaid(order);
|
|
4798
|
+
const paymentStatus = String(order?.payment_status || '').toLowerCase();
|
|
4799
|
+
return statuses.some(status => status === 'paid' ? this.isSalesOrderFullyPaid(order) : paymentStatus === status);
|
|
4800
|
+
}
|
|
4790
4801
|
shouldBuildSmallTicketData(order, invoiceTemplateSettings) {
|
|
4791
4802
|
if (!order || typeof order !== 'object') return false;
|
|
4792
4803
|
const flag = order.small_ticket_data_flag ?? order.smallTicketDataFlag;
|
|
@@ -13,6 +13,7 @@ import type { Discount, VirtualCurrencyAsset } from '../../modules/Discount/type
|
|
|
13
13
|
import { RequestPlugin, WindowPlugin } from '../../plugins';
|
|
14
14
|
export * from './types';
|
|
15
15
|
import { ProductList } from '../../modules/ProductList';
|
|
16
|
+
import { type PosReceiptAutoPrintPaymentStatus } from '../../utils/pos-receipt-auto-print';
|
|
16
17
|
import { PaymentModule } from '../../modules/Payment';
|
|
17
18
|
import type { PaymentMethod, RoundingResult, WalletAssetId, WalletAssetsBehaviorOptions, WalletAssetsSnapshot, WalletAssetsState, WalletAssetSelectionSource, ScanWalletAssetResult } from '../../modules/Payment/types';
|
|
18
19
|
import type { SalesSummaryModule } from '../../modules/SalesSummary';
|
|
@@ -199,6 +200,8 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
|
|
|
199
200
|
private getFulfillmentRefMode;
|
|
200
201
|
private getCachedInvoiceLayoutConfig;
|
|
201
202
|
private getCachedInvoiceTemplateSettings;
|
|
203
|
+
/** Only solutions with a current POS business configuration opt into this receipt policy. */
|
|
204
|
+
protected getPosReceiptAutoPrintPaymentStatuses(): PosReceiptAutoPrintPaymentStatus[] | undefined;
|
|
202
205
|
private buildSubmitPayloadEnhancerWithOpenDataConfig;
|
|
203
206
|
/**
|
|
204
207
|
* 工厂入口:根据子模块名实例化对应模块。
|
|
@@ -40,6 +40,7 @@ var _orderCollectionIdentity = require("../../modules/Order/utils/orderCollectio
|
|
|
40
40
|
var _dayjs = _interopRequireDefault(require("dayjs"));
|
|
41
41
|
var _clientDataVariants = require("../../modules/ProductList/clientDataVariants");
|
|
42
42
|
var _platform = require("../../utils/platform");
|
|
43
|
+
var _posReceiptAutoPrint = require("../../utils/pos-receipt-auto-print");
|
|
43
44
|
var _Quotation = require("../../modules/Quotation");
|
|
44
45
|
var _transformBaseProductToOrderProduct = require("./utils/transformBaseProductToOrderProduct");
|
|
45
46
|
var _quotationPrice = require("./utils/quotationPrice");
|
|
@@ -1448,11 +1449,17 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1448
1449
|
return undefined;
|
|
1449
1450
|
}
|
|
1450
1451
|
}
|
|
1452
|
+
|
|
1453
|
+
/** Only solutions with a current POS business configuration opt into this receipt policy. */
|
|
1454
|
+
getPosReceiptAutoPrintPaymentStatuses() {
|
|
1455
|
+
return undefined;
|
|
1456
|
+
}
|
|
1451
1457
|
buildSubmitPayloadEnhancerWithOpenDataConfig(enhancePayload) {
|
|
1452
1458
|
const fulfillmentRefMode = this.getFulfillmentRefMode();
|
|
1453
1459
|
const invoiceLayoutConfig = this.getCachedInvoiceLayoutConfig();
|
|
1454
1460
|
const invoiceTemplateSettings = this.getCachedInvoiceTemplateSettings();
|
|
1455
|
-
|
|
1461
|
+
const receiptPaymentStatuses = this.getPosReceiptAutoPrintPaymentStatuses();
|
|
1462
|
+
if (!fulfillmentRefMode && !invoiceLayoutConfig && !invoiceTemplateSettings && receiptPaymentStatuses === undefined) {
|
|
1456
1463
|
return enhancePayload;
|
|
1457
1464
|
}
|
|
1458
1465
|
return (payload, ctx) => {
|
|
@@ -1467,6 +1474,9 @@ class BaseSalesImpl extends _BaseModule.BaseModule {
|
|
|
1467
1474
|
} : {}),
|
|
1468
1475
|
...(invoiceTemplateSettings ? {
|
|
1469
1476
|
[OS_INVOICE_TEMPLATE_SETTINGS_FIELD]: (0, _lodashEs.cloneDeep)(invoiceTemplateSettings)
|
|
1477
|
+
} : {}),
|
|
1478
|
+
...(receiptPaymentStatuses !== undefined ? {
|
|
1479
|
+
[_posReceiptAutoPrint.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD]: [...receiptPaymentStatuses]
|
|
1470
1480
|
} : {})
|
|
1471
1481
|
};
|
|
1472
1482
|
};
|
|
@@ -328,7 +328,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
|
|
|
328
328
|
date: string;
|
|
329
329
|
status: string;
|
|
330
330
|
week: string;
|
|
331
|
-
weekNum: 0 |
|
|
331
|
+
weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
|
|
332
332
|
}[]>;
|
|
333
333
|
submitTimeSlot(timeSlots: TimeSliceItem): void;
|
|
334
334
|
private getScheduleDataByIds;
|
|
@@ -10,6 +10,7 @@ import type { AvailabilityContextRef, ContextualAvailabilityQuery, ContextualAva
|
|
|
10
10
|
import type { BusinessAvailability } from '../../modules/BusinessAvailability';
|
|
11
11
|
import { BookingTicket } from '../BookingTicket';
|
|
12
12
|
import type { BaseSalesSubmitSalesOrderParams } from '../BaseSales/types';
|
|
13
|
+
import { type PosReceiptAutoPrintPaymentStatus } from '../../utils/pos-receipt-auto-print';
|
|
13
14
|
import type { AllergyRequirement } from '../../model/strategy/adapter/itemRule';
|
|
14
15
|
export * from './types';
|
|
15
16
|
export * from './salesSettings';
|
|
@@ -224,6 +225,7 @@ export declare class UnifiedBookingSalesImpl extends BookingTicket {
|
|
|
224
225
|
clearOpenDataCache(): void;
|
|
225
226
|
getInvoiceLayoutConfig(): Promise<InvoiceLayoutConfig>;
|
|
226
227
|
getInvoiceTemplateSettings(): Promise<InvoiceTemplateSettings>;
|
|
228
|
+
protected getPosReceiptAutoPrintPaymentStatuses(): PosReceiptAutoPrintPaymentStatus[] | undefined;
|
|
227
229
|
protected isInvoiceOpenDataCacheCurrent(): boolean;
|
|
228
230
|
/**
|
|
229
231
|
* Load a resource policy without depending on the legacy appointmentBooking solution.
|
|
@@ -71,6 +71,7 @@ var _venueCatalogSession = require("./venueCatalogSession");
|
|
|
71
71
|
var _BookingTicket = require("../BookingTicket");
|
|
72
72
|
var _localClock = require("../../modules/ResourcePlanner/localClock");
|
|
73
73
|
var _platform = require("../../utils/platform");
|
|
74
|
+
var _posReceiptAutoPrint = require("../../utils/pos-receipt-auto-print");
|
|
74
75
|
var _itemRule = require("../../model/strategy/adapter/itemRule");
|
|
75
76
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
76
77
|
const OPEN_DATA_SECTION_CODES = ['sale', 'reservation', 'fulfillment', 'menu', 'workflow', 'documents', 'basic', 'checkout', 'availability', 'interface'];
|
|
@@ -2431,6 +2432,12 @@ class UnifiedBookingSalesImpl extends _BookingTicket.BookingTicket {
|
|
|
2431
2432
|
}
|
|
2432
2433
|
return this.store.openData.getInvoiceTemplateSettings();
|
|
2433
2434
|
}
|
|
2435
|
+
getPosReceiptAutoPrintPaymentStatuses() {
|
|
2436
|
+
const platform = (0, _platform.normalizeRuntimePlatform)(this.otherParams?.platform);
|
|
2437
|
+
if (platform !== 'pos' && platform !== 'webpos') return undefined;
|
|
2438
|
+
if (!this.isInvoiceOpenDataCacheCurrent() || this.runtimeOpenDataModule !== this.store.openData || this.runtimeOpenDataCore !== this.core) return undefined;
|
|
2439
|
+
return (0, _posReceiptAutoPrint.normalizePosReceiptAutoPrintPaymentStatuses)(this.runtimeOpenDataSnapshot?.['documents.pos_receipt_auto_print_payment_statuses']);
|
|
2440
|
+
}
|
|
2434
2441
|
isInvoiceOpenDataCacheCurrent() {
|
|
2435
2442
|
const businessCode = String(this.otherParams?.businessCode || '').trim();
|
|
2436
2443
|
const channel = String(this.otherParams?.channel || '').trim();
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = "_os_pos_receipt_auto_print_payment_statuses";
|
|
2
|
+
export type PosReceiptAutoPrintPaymentStatus = 'paid' | 'partially_paid' | 'payment_processing';
|
|
3
|
+
/** Missing/invalid configuration preserves legacy behavior; an empty array disables auto receipts. */
|
|
4
|
+
export declare function normalizePosReceiptAutoPrintPaymentStatuses(value: unknown): PosReceiptAutoPrintPaymentStatus[] | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = void 0;
|
|
7
|
+
exports.normalizePosReceiptAutoPrintPaymentStatuses = normalizePosReceiptAutoPrintPaymentStatuses;
|
|
8
|
+
const OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = exports.OS_POS_RECEIPT_AUTO_PRINT_PAYMENT_STATUSES_FIELD = '_os_pos_receipt_auto_print_payment_statuses';
|
|
9
|
+
/** Missing/invalid configuration preserves legacy behavior; an empty array disables auto receipts. */
|
|
10
|
+
function normalizePosReceiptAutoPrintPaymentStatuses(value) {
|
|
11
|
+
if (!Array.isArray(value)) return undefined;
|
|
12
|
+
return [...new Set(value.filter(status => status === 'paid' || status === 'partially_paid' || status === 'payment_processing'))];
|
|
13
|
+
}
|