@pisell/pisellos 2.3.233 → 2.3.234

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.
Files changed (30) hide show
  1. package/dist/modules/Order/index.d.ts +9 -8
  2. package/dist/modules/Order/index.js +273 -255
  3. package/dist/modules/Order/utils.d.ts +1 -0
  4. package/dist/modules/Order/utils.js +3 -2
  5. package/dist/shared/payment/loadPaymentMethods.d.ts +2 -1
  6. package/dist/shared/payment/loadPaymentMethods.js +13 -12
  7. package/dist/solution/BaseSales/index.d.ts +3 -0
  8. package/dist/solution/BaseSales/index.js +445 -402
  9. package/dist/solution/BookingTicket/index.d.ts +3 -1
  10. package/dist/solution/BookingTicket/index.js +49 -43
  11. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -1
  12. package/dist/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +69 -13
  13. package/dist/utils/platform.d.ts +2 -0
  14. package/dist/utils/platform.js +4 -0
  15. package/lib/model/strategy/adapter/promotion/index.js +1 -46
  16. package/lib/modules/Order/index.d.ts +9 -8
  17. package/lib/modules/Order/index.js +57 -43
  18. package/lib/modules/Order/utils.d.ts +1 -0
  19. package/lib/modules/Order/utils.js +2 -1
  20. package/lib/shared/payment/loadPaymentMethods.d.ts +2 -1
  21. package/lib/shared/payment/loadPaymentMethods.js +10 -9
  22. package/lib/solution/BaseSales/index.d.ts +3 -0
  23. package/lib/solution/BaseSales/index.js +45 -22
  24. package/lib/solution/BookingTicket/index.d.ts +3 -1
  25. package/lib/solution/BookingTicket/index.js +4 -1
  26. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.d.ts +1 -1
  27. package/lib/solution/BookingTicket/utils/scan/applyProductVoucherCollectionScan.js +44 -5
  28. package/lib/utils/platform.d.ts +2 -0
  29. package/lib/utils/platform.js +5 -0
  30. package/package.json +1 -1
@@ -257,6 +257,7 @@ export declare function buildSubmitPayload(params: {
257
257
  summary?: OrderSummary | null;
258
258
  request_unique_idempotency_token?: string;
259
259
  includePaymentStatus?: boolean;
260
+ enableMultiCurrencySettlement?: boolean;
260
261
  enhance?: SubmitPayloadEnhancer;
261
262
  }): OrderSubmitPayload;
262
263
  export declare function mapPaymentItemToOrderPayment(paymentItem: OrderPaymentSource): OrderPaymentData;
@@ -29,7 +29,7 @@ import Decimal from 'decimal.js';
29
29
  import { withOriginalBundleOptionPrices } from "./utils/weighedProduct";
30
30
  import { hasManualProductDiscountFlag } from "./utils/manualProductDiscount";
31
31
  import { getProductHolderConfig } from "../Holder/utils";
32
- import { isPosTerminalPlatform } from "../../utils/platform";
32
+ import { isPosTerminalPlatform, resolveTerminalVirtualCurrencyChannel } from "../../utils/platform";
33
33
  import { buildProductLineFingerprint, createEmptySummary } from "../../solution/ScanOrder/utils";
34
34
  import { createUuidV4 } from "./utils/orderCollectionIdentity";
35
35
  import { assignBookingUuid } from "./utils/bookingUuid";
@@ -1704,9 +1704,10 @@ export function buildSubmitPayload(params) {
1704
1704
  now: now
1705
1705
  })) !== null && _enhance !== void 0 ? _enhance : payload;
1706
1706
  var submitSummary = (_enhancedPayload$summ = enhancedPayload.summary) !== null && _enhancedPayload$summ !== void 0 ? _enhancedPayload$summ : payload.summary;
1707
+ var retailKioskSettlement = params.enableMultiCurrencySettlement === true && resolveTerminalVirtualCurrencyChannel(enhancedPayload.platform, resolvedBusinessCode) === 'kiosk';
1707
1708
  return _objectSpread(_objectSpread({}, enhancedPayload), {}, {
1708
1709
  summary: submitSummary
1709
- }, isPosTerminalPlatform(enhancedPayload.platform) ? {
1710
+ }, isPosTerminalPlatform(enhancedPayload.platform) || retailKioskSettlement ? {
1710
1711
  product_tax_fee: virtualSettlementMode ? '0.00' : (_submitSummary$tax_fe = submitSummary === null || submitSummary === void 0 ? void 0 : submitSummary.tax_fee) !== null && _submitSummary$tax_fe !== void 0 ? _submitSummary$tax_fe : '0.00'
1711
1712
  } : {});
1712
1713
  }
@@ -1,12 +1,13 @@
1
1
  import type { RequestPlugin } from '../../plugins/request';
2
2
  import type { PaymentMethod } from '../../modules/Payment/types';
3
+ import type { TerminalVirtualCurrencyChannel } from '../../utils/platform';
3
4
  type PaymentMethodsTransport = 'remote' | 'os-server';
4
5
  /** Shared read-only transport; customer hosts route the remote path under /h5. */
5
6
  export declare function loadPaymentMethods(request: RequestPlugin, options: {
6
7
  transport: PaymentMethodsTransport;
7
8
  filterPaymentMethods: boolean;
8
9
  }): Promise<PaymentMethod[]>;
9
- export declare function requirePosVirtualCurrencyPaymentMethod(methods: readonly PaymentMethod[], shopId?: string): PaymentMethod;
10
+ export declare function requireTerminalVirtualCurrencyPaymentMethod(methods: readonly PaymentMethod[], channel: TerminalVirtualCurrencyChannel, shopId?: string): PaymentMethod;
10
11
  /** Enrich a copy: never overwrite historical names or change payment amounts. */
11
12
  export declare function withPaymentMethodNames(order: Record<string, any>, methods: PaymentMethod[]): Record<string, any>;
12
13
  export {};
@@ -58,24 +58,25 @@ function _loadPaymentMethods() {
58
58
  }));
59
59
  return _loadPaymentMethods.apply(this, arguments);
60
60
  }
61
- var PosVirtualCurrencyPaymentUnavailableError = /*#__PURE__*/function (_Error) {
62
- _inherits(PosVirtualCurrencyPaymentUnavailableError, _Error);
63
- var _super = _createSuper(PosVirtualCurrencyPaymentUnavailableError);
64
- function PosVirtualCurrencyPaymentUnavailableError() {
61
+ var TerminalVirtualCurrencyPaymentUnavailableError = /*#__PURE__*/function (_Error) {
62
+ _inherits(TerminalVirtualCurrencyPaymentUnavailableError, _Error);
63
+ var _super = _createSuper(TerminalVirtualCurrencyPaymentUnavailableError);
64
+ function TerminalVirtualCurrencyPaymentUnavailableError(channel) {
65
65
  var _this;
66
- _classCallCheck(this, PosVirtualCurrencyPaymentUnavailableError);
67
- _this = _super.call(this, 'Virtual currency payment is not enabled on this POS.');
68
- _defineProperty(_assertThisInitialized(_this), "code", 'POS_VIRTUAL_CURRENCY_PAYMENT_UNAVAILABLE');
69
- _this.name = 'PosVirtualCurrencyPaymentUnavailableError';
66
+ _classCallCheck(this, TerminalVirtualCurrencyPaymentUnavailableError);
67
+ _this = _super.call(this, channel === 'kiosk' ? 'Virtual currency payment is not enabled on this Kiosk.' : 'Virtual currency payment is not enabled on this POS.');
68
+ _defineProperty(_assertThisInitialized(_this), "code", void 0);
69
+ _this.code = channel === 'kiosk' ? 'KIOSK_VIRTUAL_CURRENCY_PAYMENT_UNAVAILABLE' : 'POS_VIRTUAL_CURRENCY_PAYMENT_UNAVAILABLE';
70
+ _this.name = channel === 'kiosk' ? 'KioskVirtualCurrencyPaymentUnavailableError' : 'PosVirtualCurrencyPaymentUnavailableError';
70
71
  return _this;
71
72
  }
72
- return _createClass(PosVirtualCurrencyPaymentUnavailableError);
73
+ return _createClass(TerminalVirtualCurrencyPaymentUnavailableError);
73
74
  }( /*#__PURE__*/_wrapNativeSuper(Error));
74
- export function requirePosVirtualCurrencyPaymentMethod(methods, shopId) {
75
+ export function requireTerminalVirtualCurrencyPaymentMethod(methods, channel, shopId) {
75
76
  var method = methods.find(function (candidate) {
76
- return (candidate === null || candidate === void 0 ? void 0 : candidate.code) === 'VIRTUALCURRENCY' && (!shopId || candidate.shop_id == null || String(candidate.shop_id) === shopId) && candidate.status === 1 && candidate.disable === 0 && Array.isArray(candidate.channel_application) && candidate.channel_application.includes('pos');
77
+ return (candidate === null || candidate === void 0 ? void 0 : candidate.code) === 'VIRTUALCURRENCY' && (channel === 'pos' || Boolean(shopId)) && (!shopId || candidate.shop_id == null || String(candidate.shop_id) === shopId) && candidate.status === 1 && candidate.disable === 0 && Array.isArray(candidate.channel_application) && candidate.channel_application.includes(channel);
77
78
  });
78
- if (!method) throw new PosVirtualCurrencyPaymentUnavailableError();
79
+ if (!method) throw new TerminalVirtualCurrencyPaymentUnavailableError(channel);
79
80
  return method;
80
81
  }
81
82
 
@@ -246,6 +246,7 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
246
246
  private getPaymentNumberDevicePrefixSync;
247
247
  private getPaymentNumberDevicePrefixAsync;
248
248
  private isMultiCurrencySettlementEnabled;
249
+ private getTerminalVirtualCurrencyChannel;
249
250
  private isActiveVirtualSettlementOrder;
250
251
  private isHistoricalVirtualSettlementOrder;
251
252
  private syncAppDataToTempOrder;
@@ -503,7 +504,9 @@ export declare class BaseSalesImpl extends BaseModule implements Module {
503
504
  getPaymentMethodsAsync(): Promise<PaymentMethod[]>;
504
505
  /** 同步读取初始化时缓存的支付方式列表。 */
505
506
  getPaymentMethods(): PaymentMethod[];
507
+ private checkTerminalVirtualCurrencyPaymentMethod;
506
508
  hasPosVirtualCurrencyPaymentMethod(): Promise<boolean>;
509
+ hasTerminalVirtualCurrencyPaymentMethod(): Promise<boolean>;
507
510
  private findCashPaymentMethod;
508
511
  private getPendingWalletPaymentAmount;
509
512
  /** 读取现金 action 所需的支付方式、待付金额和快捷金额。 */