@aptos-scp/scp-component-store-selling-features-domain-model 1.0.11 → 1.1.0

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 (43) hide show
  1. package/lib/config/DiTypes.d.ts +0 -1
  2. package/lib/config/DiTypes.js +0 -1
  3. package/lib/config/inversify/index.d.ts +0 -1
  4. package/lib/config/inversify/index.js +0 -1
  5. package/lib/domain/UIBusinessEventTypes.d.ts +1 -0
  6. package/lib/domain/UIBusinessEventTypes.js +1 -0
  7. package/lib/domain/index.d.ts +0 -1
  8. package/lib/domain/index.js +0 -1
  9. package/lib/domain/model/Constants.d.ts +6 -0
  10. package/lib/domain/model/Constants.js +6 -0
  11. package/lib/domain/model/IReceipt.d.ts +32 -0
  12. package/lib/domain/{service/IReceiptFormattingService.js → model/IReceipt.js} +1 -1
  13. package/lib/domain/model/StoreItem.js +1 -0
  14. package/lib/domain/model/configuration/IFeesConfig.d.ts +2 -1
  15. package/lib/domain/model/configuration/IFeesConfig.js +1 -0
  16. package/lib/domain/model/fee/IFee.d.ts +13 -0
  17. package/lib/domain/{service/ITransactionAccountingService.js → model/fee/IFee.js} +1 -1
  18. package/lib/domain/model/fee/index.d.ts +1 -0
  19. package/lib/domain/model/index.d.ts +1 -0
  20. package/lib/domain/model/item/ItemLine.js +6 -2
  21. package/lib/domain/model/receipt/BaseReceiptLineDecorator.d.ts +1 -1
  22. package/lib/domain/model/receipt/FiscalReceiptLine.d.ts +1 -1
  23. package/lib/domain/model/receipt/ReceiptLine.d.ts +1 -1
  24. package/lib/domain/model/transaction/order/OrderReferenceLine.d.ts +9 -1
  25. package/lib/domain/model/transaction/order/OrderReferenceLine.js +15 -4
  26. package/lib/domain/service/index.d.ts +0 -2
  27. package/lib/domain/utility/index.d.ts +0 -1
  28. package/lib/domain/utility/index.js +0 -1
  29. package/lib/domain/utility/utils.d.ts +1 -5
  30. package/lib/domain/utility/utils.js +0 -41
  31. package/package.json +27 -16
  32. package/lib/config/inversify/inversify.terminal.config/index.d.ts +0 -1
  33. package/lib/config/inversify/inversify.terminal.config/index.js +0 -7
  34. package/lib/config/inversify/inversify.terminal.config/transaction-services.config.d.ts +0 -11
  35. package/lib/config/inversify/inversify.terminal.config/transaction-services.config.js +0 -30
  36. package/lib/domain/processing/PosBusinessAction.d.ts +0 -9
  37. package/lib/domain/processing/PosBusinessAction.js +0 -55
  38. package/lib/domain/processing/index.d.ts +0 -1
  39. package/lib/domain/processing/index.js +0 -7
  40. package/lib/domain/service/IReceiptFormattingService.d.ts +0 -48
  41. package/lib/domain/service/ITransactionAccountingService.d.ts +0 -6
  42. package/lib/domain/utility/supervisorOverride.d.ts +0 -9
  43. package/lib/domain/utility/supervisorOverride.js +0 -152
@@ -1,5 +1,4 @@
1
1
  export declare const DI_TYPES: {
2
- ITransactionAccountingService: any;
3
2
  ITransactionReferenceFormatter: any;
4
3
  };
5
4
  export default DI_TYPES;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const Symbol = require("es-symbol");
4
4
  exports.DI_TYPES = {
5
- ITransactionAccountingService: Symbol("ITransactionAccountingService"),
6
5
  ITransactionReferenceFormatter: Symbol("ITransactionReferenceFormatter"),
7
6
  };
8
7
  exports.default = exports.DI_TYPES;
@@ -1,3 +1,2 @@
1
1
  export * from "./binding-helpers";
2
2
  export * from "./inversify.app.config";
3
- export * from "./inversify.terminal.config";
@@ -5,5 +5,4 @@ function __export(m) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  __export(require("./binding-helpers"));
7
7
  __export(require("./inversify.app.config"));
8
- __export(require("./inversify.terminal.config"));
9
8
  //# sourceMappingURL=index.js.map
@@ -158,6 +158,7 @@ export declare const ITEM_PICKUP_SIGNATURE_EVENT: string;
158
158
  export declare const TERMINAL_STATE_SYNC_EVENT: string;
159
159
  export declare const TRANSACTION_FEE_CHANGE_QUANTITY_EVENT = "ChangeTransactionFeeQuantity";
160
160
  export declare const TRANSACTION_FEE_EVENT = "TransactionFee";
161
+ export declare const TRANSACTION_FEE_REFUND_EVENT: string;
161
162
  export declare const MAKE_DONATION_EVENT = "MakeDonation";
162
163
  export declare const TRANSACTION_RECEIPTS_EVENT = "TransactionReceipts";
163
164
  export declare const TRANSACTION_TAX_EXEMPT_EVENT = "TransactionTaxExempt";
@@ -161,6 +161,7 @@ exports.ITEM_PICKUP_SIGNATURE_EVENT = "ItemPickupSignature";
161
161
  exports.TERMINAL_STATE_SYNC_EVENT = "TerminalStatusSync";
162
162
  exports.TRANSACTION_FEE_CHANGE_QUANTITY_EVENT = "ChangeTransactionFeeQuantity";
163
163
  exports.TRANSACTION_FEE_EVENT = "TransactionFee";
164
+ exports.TRANSACTION_FEE_REFUND_EVENT = "TransactionRefundFee";
164
165
  exports.MAKE_DONATION_EVENT = "MakeDonation";
165
166
  exports.TRANSACTION_RECEIPTS_EVENT = "TransactionReceipts";
166
167
  exports.TRANSACTION_TAX_EXEMPT_EVENT = "TransactionTaxExempt";
@@ -1,5 +1,4 @@
1
1
  export * from "./UIBusinessEventTypes";
2
2
  export * from "./model/";
3
- export * from "./processing/";
4
3
  export * from "./service/";
5
4
  export * from "./utility/";
@@ -5,6 +5,5 @@ function __export(m) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  __export(require("./UIBusinessEventTypes"));
7
7
  __export(require("./model/"));
8
- __export(require("./processing/"));
9
8
  __export(require("./utility/"));
10
9
  //# sourceMappingURL=index.js.map
@@ -249,6 +249,7 @@ export declare enum UiInputKey {
249
249
  SALESPERSON_ID = "input_salespersonId",
250
250
  SELECTED_ORDER_ITEMS = "input_selectedOrderItems",
251
251
  CANCELLED_ORDER_ITEM_LINE_NUMBER = "input_cancelledOrderItemLineNumber",
252
+ FEE_DETAILS = "input_feeDetails",
252
253
  SUBSCRIPTIONS = "input_subscriptions",
253
254
  VAT_NUMBER = "input_vatNumber",
254
255
  CUSTOMER_TYPE = "input_customerType",
@@ -300,12 +301,17 @@ export declare enum UiInputKey {
300
301
  TRANSACTION_REFERENCE_NUMBER_FIELD = "input_referenceNumberField",
301
302
  CASH_DRAWER_KEY = "input_cashDrawerKey",
302
303
  CASH_DRAWER_RESET = "input_cashDrawerReset",
304
+ FIRST_NAME = "input_firstName",
305
+ LAST_NAME = "input_lastName",
306
+ POSTAL_CODE = "input_postalCode",
303
307
  ALTERNATE_KEY = "input_alternateKey",
308
+ ALTERNATE_KEY_2 = "input_alternateKey2",
304
309
  ALTERNATE_KEY_ADD = "input_alternateKeyAdd",
305
310
  ALTERNATE_KEY_SWAP = "input_alternateKeySwap",
306
311
  ALTERNATE_KEY_REMOVE = "input_alternateKeyRemove",
307
312
  EMAIL_OR_PHONE = "input_emailOrPhone",
308
313
  EMAIL_ADDRESS = "emailAddress",
314
+ ADDRESS_LINE_1 = "addressLine1",
309
315
  TILL_KEY = "input_tillKey",
310
316
  TILL_ACTUAL_AMOUNT = "input_tillActualAmount",
311
317
  TILL_TRANSFER_AMOUNT = "input_tillTransferAmount",
@@ -252,6 +252,7 @@ var UiInputKey;
252
252
  UiInputKey["SALESPERSON_ID"] = "input_salespersonId";
253
253
  UiInputKey["SELECTED_ORDER_ITEMS"] = "input_selectedOrderItems";
254
254
  UiInputKey["CANCELLED_ORDER_ITEM_LINE_NUMBER"] = "input_cancelledOrderItemLineNumber";
255
+ UiInputKey["FEE_DETAILS"] = "input_feeDetails";
255
256
  UiInputKey["SUBSCRIPTIONS"] = "input_subscriptions";
256
257
  UiInputKey["VAT_NUMBER"] = "input_vatNumber";
257
258
  UiInputKey["CUSTOMER_TYPE"] = "input_customerType";
@@ -303,12 +304,17 @@ var UiInputKey;
303
304
  UiInputKey["TRANSACTION_REFERENCE_NUMBER_FIELD"] = "input_referenceNumberField";
304
305
  UiInputKey["CASH_DRAWER_KEY"] = "input_cashDrawerKey";
305
306
  UiInputKey["CASH_DRAWER_RESET"] = "input_cashDrawerReset";
307
+ UiInputKey["FIRST_NAME"] = "input_firstName";
308
+ UiInputKey["LAST_NAME"] = "input_lastName";
309
+ UiInputKey["POSTAL_CODE"] = "input_postalCode";
306
310
  UiInputKey["ALTERNATE_KEY"] = "input_alternateKey";
311
+ UiInputKey["ALTERNATE_KEY_2"] = "input_alternateKey2";
307
312
  UiInputKey["ALTERNATE_KEY_ADD"] = "input_alternateKeyAdd";
308
313
  UiInputKey["ALTERNATE_KEY_SWAP"] = "input_alternateKeySwap";
309
314
  UiInputKey["ALTERNATE_KEY_REMOVE"] = "input_alternateKeyRemove";
310
315
  UiInputKey["EMAIL_OR_PHONE"] = "input_emailOrPhone";
311
316
  UiInputKey["EMAIL_ADDRESS"] = "emailAddress";
317
+ UiInputKey["ADDRESS_LINE_1"] = "addressLine1";
312
318
  UiInputKey["TILL_KEY"] = "input_tillKey";
313
319
  UiInputKey["TILL_ACTUAL_AMOUNT"] = "input_tillActualAmount";
314
320
  UiInputKey["TILL_TRANSFER_AMOUNT"] = "input_tillTransferAmount";
@@ -0,0 +1,32 @@
1
+ import { Receipt as CoreReceipt } from "@aptos-scp/scp-component-store-selling-core";
2
+ import { ReceiptCategory } from "../../";
3
+ export interface AdditionalReprintInfo {
4
+ originalTransactionEndDateTime?: Date;
5
+ originalTransactionDeviceId: string;
6
+ originalTransactionNumber: number;
7
+ currentReceiptCategory: ReceiptCategory;
8
+ duplicateCopy: boolean;
9
+ taxInvoiceNumber?: string;
10
+ taxInvoicePrintDate?: Date;
11
+ invoiceTransactionNumber?: number;
12
+ invoiceFiscalTransactionNumber?: string;
13
+ }
14
+ export interface ReceiptTypeCount {
15
+ print: ReceiptCount;
16
+ email: ReceiptCount;
17
+ }
18
+ export interface ReceiptCount {
19
+ sale?: number;
20
+ invoice?: number;
21
+ vatReceipt?: number;
22
+ fullPageInvoice?: number;
23
+ japanRSS?: number;
24
+ postVoid?: number;
25
+ }
26
+ export interface Receipt extends CoreReceipt {
27
+ isTemplate?: boolean;
28
+ htmlDocument?: string;
29
+ }
30
+ export interface ReceiptTemplate extends Receipt {
31
+ receiptCategory: ReceiptCategory;
32
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IReceiptFormattingService.js.map
3
+ //# sourceMappingURL=IReceipt.js.map
@@ -246,6 +246,7 @@ class StoreItem {
246
246
  storeItem.itemGroupId = StoreItem.getStringFromJsonObject(storeItemJsonObj.itemGroupId);
247
247
  storeItem.itemType = scp_types_commerce_transaction_1.ItemType[StoreItem.getStringFromJsonObject(storeItemJsonObj.itemType)];
248
248
  storeItem.imageUrl = StoreItem.getStringFromJsonObject(storeItemJsonObj.imageUrl);
249
+ storeItem.name = StoreItem.getStringFromJsonObject(storeItemJsonObj.name);
249
250
  storeItem.shortDescription = StoreItem.getStringFromJsonObject(storeItemJsonObj.shortDescription);
250
251
  storeItem.additionalDescription = StoreItem.getStringFromJsonObject(storeItemJsonObj.additionalDescription);
251
252
  storeItem.longDescription = StoreItem.getStringFromJsonObject(storeItemJsonObj.longDescription);
@@ -43,7 +43,8 @@ export declare enum DisplayRules {
43
43
  }
44
44
  export declare enum ReturnRule {
45
45
  WithItem = "WithItem",
46
- NonReturnable = "NonReturnable"
46
+ NonReturnable = "NonReturnable",
47
+ OnOrderCancel = "OnOrderCancel"
47
48
  }
48
49
  export declare enum Taxability {
49
50
  FollowItemTax = "FollowItemTax"
@@ -19,6 +19,7 @@ var ReturnRule;
19
19
  (function (ReturnRule) {
20
20
  ReturnRule["WithItem"] = "WithItem";
21
21
  ReturnRule["NonReturnable"] = "NonReturnable";
22
+ ReturnRule["OnOrderCancel"] = "OnOrderCancel";
22
23
  })(ReturnRule = exports.ReturnRule || (exports.ReturnRule = {}));
23
24
  var Taxability;
24
25
  (function (Taxability) {
@@ -0,0 +1,13 @@
1
+ import { Money } from "@aptos-scp/scp-component-business-core";
2
+ import { FeeType } from "@aptos-scp/scp-types-commerce-transaction/lib/TransactionLine";
3
+ export interface IFee {
4
+ unitAmount: Money;
5
+ extendedNetAmount: Money;
6
+ feeType: FeeType;
7
+ feeId?: string;
8
+ alternativeFeeId?: string;
9
+ description?: string;
10
+ shortDescription?: string;
11
+ longDescription?: string;
12
+ customFeeType?: FeeType;
13
+ }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=ITransactionAccountingService.js.map
3
+ //# sourceMappingURL=IFee.js.map
@@ -1,5 +1,6 @@
1
1
  export * from "./FeeLine";
2
2
  export * from "./IFeeLine";
3
+ export * from "./IFee";
3
4
  export * from "./VoidedFeeLineDecorator";
4
5
  export * from "./FeeLineChangeQuantityDecorator";
5
6
  export * from "./BaseFeeLineDecorator";
@@ -105,3 +105,4 @@ export * from "./taxRecord/";
105
105
  export * from "./taxLottery/";
106
106
  export * from "./lottery/";
107
107
  export * from "./ITransactionMetadataPersistanceObject";
108
+ export * from "./IReceipt";
@@ -10,6 +10,7 @@ const Employee_1 = require("../Employee");
10
10
  const StoreItem_1 = require("../StoreItem");
11
11
  const TenderType_1 = require("../TenderType");
12
12
  const FeeLine_1 = require("../../model/fee/FeeLine");
13
+ const UIBusinessEventTypes_1 = require("../../UIBusinessEventTypes");
13
14
  exports.ITEM_SALE_LINE_TYPE = "ItemSale";
14
15
  exports.ITEM_RETURN_LINE_TYPE = "ItemReturn";
15
16
  exports.ITEM_ORDER_LINE_TYPE = "ItemOrder";
@@ -206,8 +207,11 @@ class ItemLine extends BaseTransactionLine_1.BaseTransactionLine {
206
207
  itemLine._originalPriceOverride = originalPriceOverride;
207
208
  }
208
209
  }
209
- if (lineType === exports.ITEM_SALE_LINE_TYPE && collectedData.get(Constants_1.CollectedDataKey.OriginalDiscountReason)) {
210
- itemLine._originalDiscountReason = collectedData.get(Constants_1.CollectedDataKey.OriginalDiscountReason);
210
+ if (lineType === exports.ITEM_SALE_LINE_TYPE && uiBusinessEvent.type === UIBusinessEventTypes_1.ORDER_ITEM_PICKUP_EVENT) {
211
+ const originalDiscountReason = collectedData.get(Constants_1.CollectedDataKey.OriginalDiscountReason);
212
+ if (originalDiscountReason) {
213
+ itemLine._originalDiscountReason = originalDiscountReason;
214
+ }
211
215
  }
212
216
  const originalRedemptionLoyaltyTransactionKeys = collectedData.get(Constants_1.CollectedDataKey.OriginalRedemptionLoyaltyTransactionKeys);
213
217
  if (((_f = originalRedemptionLoyaltyTransactionKeys) === null || _f === void 0 ? void 0 : _f.length) > 0) {
@@ -1,11 +1,11 @@
1
1
  import { IMoney } from "@aptos-scp/scp-component-business-core";
2
2
  import { ITransactionLineReferenceType } from "@aptos-scp/scp-types-commerce-transaction";
3
3
  import { BaseLineDecorator } from "../../model/BaseLineDecorator";
4
- import { Receipt } from "../../service";
5
4
  import { ReceiptStatus, ReceiptType } from "../Constants";
6
5
  import { ReceiptCategory } from "../ReceiptSession";
7
6
  import { IReceiptLine } from "./IReceiptLine";
8
7
  import { ReceiptLine } from "./ReceiptLine";
8
+ import { Receipt } from "../IReceipt";
9
9
  /**
10
10
  * This class acts as the base class for all ReceiptLine decorators. It implements all methods on ReceiptLine, and
11
11
  * passes them through to the decorated ReceiptLine, which might be the original ReceiptLine, or another decorator.
@@ -1,6 +1,6 @@
1
1
  import { ITransactionLine, UiBusinessEvent } from "@aptos-scp/scp-component-store-selling-core";
2
2
  import { ITransactionLineReferenceType } from "@aptos-scp/scp-types-commerce-transaction";
3
- import { Receipt } from "../../service";
3
+ import { Receipt } from "../IReceipt";
4
4
  import { BaseTransactionLine } from "../BaseTransactionLine";
5
5
  import { ReceiptStatus, ReceiptType } from "../Constants";
6
6
  import { ReceiptCategory } from "../ReceiptSession";
@@ -1,7 +1,7 @@
1
1
  import { Money } from "@aptos-scp/scp-component-business-core";
2
2
  import { ITransactionLine, UiBusinessEvent } from "@aptos-scp/scp-component-store-selling-core";
3
3
  import { BarcodeFormats, ITransactionLineReferenceType, FooterScanCode } from "@aptos-scp/scp-types-commerce-transaction";
4
- import { Receipt } from "../../service";
4
+ import { Receipt } from "../IReceipt";
5
5
  import { BaseTransactionLine } from "../BaseTransactionLine";
6
6
  import { ReceiptStatus, ReceiptType } from "../Constants";
7
7
  import { ReceiptCategory } from "../ReceiptSession";
@@ -1,9 +1,11 @@
1
1
  import { ITransactionLine, UiBusinessEvent } from "@aptos-scp/scp-component-store-selling-core";
2
2
  import { IOrderReferenceInfo } from "@aptos-scp/scp-types-commerce-transaction";
3
+ import { CustomerOrder } from "@aptos-scp/scp-types-orders";
3
4
  import { BaseTransactionLine } from "../../BaseTransactionLine";
4
5
  export declare const ORDER_REFERENCE_LINE_TYPE: string;
5
6
  export declare class OrderReferenceLine extends BaseTransactionLine {
6
7
  private _orderReference;
8
+ private _order;
7
9
  /**
8
10
  * The create method is called by the transaction line factory to create an instance and initialize it from the
9
11
  * data collected during the qualification process.
@@ -19,7 +21,13 @@ export declare class OrderReferenceLine extends BaseTransactionLine {
19
21
  static createFromJsonObject(transactionLineJsonObj: any): OrderReferenceLine;
20
22
  get couldAffectPricing(): boolean;
21
23
  get orderReference(): IOrderReferenceInfo;
22
- protected constructor(lineNumber: number, lineType: string, orderReference: IOrderReferenceInfo);
24
+ /**
25
+ * This is the order from OMS.
26
+ * It is provided here for reference within the app.
27
+ * It MUST NOT be included in the internal/postable transaction.
28
+ */
29
+ get order(): CustomerOrder;
30
+ protected constructor(lineNumber: number, lineType: string, orderReference: IOrderReferenceInfo, omsOrder: CustomerOrder);
23
31
  protected newTransactionLine(): BaseTransactionLine;
24
32
  }
25
33
  export declare function isOrderReferenceLine(transactionLine: ITransactionLine): transactionLine is OrderReferenceLine;
@@ -5,9 +5,10 @@ const Constants_1 = require("../../Constants");
5
5
  exports.ORDER_REFERENCE_LINE_TYPE = "OrderReference";
6
6
  class OrderReferenceLine extends BaseTransactionLine_1.BaseTransactionLine {
7
7
  // Since the constructor is only called from the create methods it is made protected to prevent use by others.
8
- constructor(lineNumber, lineType, orderReference) {
8
+ constructor(lineNumber, lineType, orderReference, omsOrder) {
9
9
  super(lineNumber, lineType);
10
10
  this._orderReference = orderReference;
11
+ this._order = omsOrder;
11
12
  }
12
13
  /**
13
14
  * The create method is called by the transaction line factory to create an instance and initialize it from the
@@ -22,14 +23,16 @@ class OrderReferenceLine extends BaseTransactionLine_1.BaseTransactionLine {
22
23
  */
23
24
  static create(lineNumber, lineType, uiBusinessEvent, collectedData) {
24
25
  const orderReference = collectedData.get(Constants_1.CollectedDataKey.OrderReference);
25
- const orderReferenceLine = new OrderReferenceLine(lineNumber, lineType, orderReference);
26
+ const order = collectedData.get(Constants_1.CollectedDataKey.Order);
27
+ const orderReferenceLine = new OrderReferenceLine(lineNumber, lineType, orderReference, order);
26
28
  return orderReferenceLine;
27
29
  }
28
30
  static createFromJsonObject(transactionLineJsonObj) {
29
31
  const lineNumber = BaseTransactionLine_1.BaseTransactionLine.lineNumberFromJsonObject(transactionLineJsonObj);
30
32
  const lineType = BaseTransactionLine_1.BaseTransactionLine.lineTypeFromJsonObject(transactionLineJsonObj);
31
33
  const orderReference = transactionLineJsonObj._orderReference;
32
- const orderReferenceLine = new OrderReferenceLine(lineNumber, lineType, orderReference);
34
+ const order = transactionLineJsonObj._order;
35
+ const orderReferenceLine = new OrderReferenceLine(lineNumber, lineType, orderReference, order);
33
36
  return orderReferenceLine;
34
37
  }
35
38
  get couldAffectPricing() {
@@ -38,8 +41,16 @@ class OrderReferenceLine extends BaseTransactionLine_1.BaseTransactionLine {
38
41
  get orderReference() {
39
42
  return this._orderReference;
40
43
  }
44
+ /**
45
+ * This is the order from OMS.
46
+ * It is provided here for reference within the app.
47
+ * It MUST NOT be included in the internal/postable transaction.
48
+ */
49
+ get order() {
50
+ return this._order;
51
+ }
41
52
  newTransactionLine() {
42
- return new OrderReferenceLine(this.lineNumber, this.lineType, this._orderReference);
53
+ return new OrderReferenceLine(this.lineNumber, this.lineType, this._orderReference, this._order);
43
54
  }
44
55
  }
45
56
  exports.OrderReferenceLine = OrderReferenceLine;
@@ -1,3 +1 @@
1
- export * from "./IReceiptFormattingService";
2
- export * from "./ITransactionAccountingService";
3
1
  export * from "./ITransactionReferenceFormatter";
@@ -1,3 +1,2 @@
1
1
  export * from "./utils";
2
2
  export * from "./orderUtils";
3
- export * from "./supervisorOverride";
@@ -5,5 +5,4 @@ function __export(m) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  __export(require("./utils"));
7
7
  __export(require("./orderUtils"));
8
- __export(require("./supervisorOverride"));
9
8
  //# sourceMappingURL=index.js.map
@@ -1,12 +1,8 @@
1
- import { IConfigurationManager, ITransaction, PosError } from "@aptos-scp/scp-component-store-selling-core";
1
+ import { ITransaction, PosError } from "@aptos-scp/scp-component-store-selling-core";
2
2
  import { IServiceResult, MerchandiseTransactionTradeType } from "@aptos-scp/scp-types-commerce-transaction";
3
- import { CountryAddressFormat } from "../model";
4
- export declare function getAddressFormatorDefault(configurationManager: IConfigurationManager, countryCode: string, i18nLocation: string): CountryAddressFormat;
5
3
  export declare function getLocaleCodeForTranslationSet<T>(translationSet: {
6
4
  [key: string]: T;
7
5
  }, locale: string): string;
8
6
  export declare const getTradeType: (transaction: ITransaction) => MerchandiseTransactionTradeType;
9
7
  export declare const isTimeOutError: (error: PosError) => boolean;
10
8
  export declare const getServiceResult: (isSuccess: boolean, error?: Error, statusCode?: number) => IServiceResult;
11
- export declare function mapStartTillEventTypeToLineType(): Map<string, string>;
12
- export declare function mapEventTypeToTransferType(): Map<string, string>;
@@ -4,22 +4,6 @@ const i18n = require("i18n-js");
4
4
  const scp_component_store_selling_core_1 = require("@aptos-scp/scp-component-store-selling-core");
5
5
  const scp_types_commerce_transaction_1 = require("@aptos-scp/scp-types-commerce-transaction");
6
6
  const model_1 = require("../model");
7
- const UIBusinessEventTypes_1 = require("../UIBusinessEventTypes");
8
- function getAddressFormatorDefault(configurationManager, countryCode, i18nLocation) {
9
- const addressFormats = configurationManager.getI18nAddressFormats();
10
- const defaultCountryCode = countryCode || i18nLocation;
11
- let formatConfig;
12
- const formatKeys = Object.keys(addressFormats);
13
- formatKeys.forEach((key) => {
14
- const addressFormat = addressFormats[key];
15
- if (key === defaultCountryCode || addressFormat.countryCode === defaultCountryCode) {
16
- formatConfig = Object.assign({}, addressFormat, { country: key });
17
- return;
18
- }
19
- });
20
- return formatConfig;
21
- }
22
- exports.getAddressFormatorDefault = getAddressFormatorDefault;
23
7
  function getLocaleCodeForTranslationSet(translationSet, locale) {
24
8
  if (!locale) {
25
9
  return;
@@ -101,29 +85,4 @@ exports.getServiceResult = (isSuccess, error, statusCode) => {
101
85
  };
102
86
  }
103
87
  };
104
- function mapStartTillEventTypeToLineType() {
105
- return new Map([
106
- [UIBusinessEventTypes_1.START_TILL_AUDIT_EVENT, model_1.START_TILL_AUDIT_LINE_TYPE],
107
- [UIBusinessEventTypes_1.START_TILL_COUNT_EVENT, model_1.START_TILL_COUNT_LINE_TYPE],
108
- [UIBusinessEventTypes_1.START_TILL_IN_EVENT, model_1.START_TILL_IN_LINE_TYPE],
109
- [UIBusinessEventTypes_1.START_TILL_OUT_EVENT, model_1.START_TILL_OUT_LINE_TYPE],
110
- [UIBusinessEventTypes_1.START_TILL_TO_BANK_EVENT, model_1.START_TILL_TO_BANK_LINE_TYPE],
111
- [UIBusinessEventTypes_1.START_TILL_RECONCILIATION_EVENT, model_1.START_TILL_RECONCILIATION_LINE_TYPE],
112
- [UIBusinessEventTypes_1.START_SAFE_TO_TILL_EVENT, model_1.START_SAFE_TO_TILL_LINE_TYPE],
113
- [UIBusinessEventTypes_1.START_TILL_TO_SAFE_EVENT, model_1.START_TILL_TO_SAFE_LINE_TYPE],
114
- [UIBusinessEventTypes_1.START_OPEN_CASH_DRAWER_EVENT, model_1.START_OPEN_CASH_DRAWER_LINE_TYPE],
115
- [UIBusinessEventTypes_1.START_OPEN_TENDER_EXCHANGE_CASH_DRAWER_EVENT, model_1.START_OPEN_CASH_DRAWER_LINE_TYPE],
116
- ]);
117
- }
118
- exports.mapStartTillEventTypeToLineType = mapStartTillEventTypeToLineType;
119
- function mapEventTypeToTransferType() {
120
- return new Map([
121
- [UIBusinessEventTypes_1.TILL_IN_EVENT, model_1.SAFE_TO_TILL_TRANSFER_LINE_TYPE],
122
- [UIBusinessEventTypes_1.TILL_OUT_EVENT, model_1.TILL_TO_SAFE_TRANSFER_LINE_TYPE],
123
- [UIBusinessEventTypes_1.TILL_TO_BANK_EVENT, model_1.TILL_TO_BANK_TRANSFER_LINE_TYPE],
124
- [UIBusinessEventTypes_1.SAFE_TO_TILL_EVENT, model_1.SAFE_TO_TILL_TRANSFER_LINE_TYPE],
125
- [UIBusinessEventTypes_1.TILL_TO_SAFE_EVENT, model_1.TILL_TO_SAFE_TRANSFER_LINE_TYPE],
126
- ]);
127
- }
128
- exports.mapEventTypeToTransferType = mapEventTypeToTransferType;
129
88
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-scp/scp-component-store-selling-features-domain-model",
3
- "version": "1.0.11",
3
+ "version": "1.1.0",
4
4
  "description": "This component library provides the common components to handle the coordination of processing the business events from the UI.",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -39,17 +39,6 @@
39
39
  "prettier:format": "prettier --write ."
40
40
  },
41
41
  "dependencies": {
42
- "@aptos-scp/scp-component-pricing": "^7.53.1",
43
- "@aptos-scp/scp-component-store-items": "^1.19.0",
44
- "@aptos-scp/scp-component-taxation": "^5.25.0",
45
- "@aptos-scp/scp-component-user": "^1.4.0",
46
- "@aptos-scp/scp-types-client-registration": "^1.4.0",
47
- "@aptos-scp/scp-types-customer": "^3.7.0",
48
- "@aptos-scp/scp-types-einvoice": "^1.17.0",
49
- "@aptos-scp/scp-types-inventory": "^2.0.0",
50
- "@aptos-scp/scp-types-loyalty-memberships": "^2.3.0",
51
- "@aptos-scp/scp-types-orders": "^4.11.0",
52
- "@aptos-scp/scp-types-ss-transaction-history": "^1.6.0",
53
42
  "big.js": "^6.1.1",
54
43
  "crc-32": "^1.2.0",
55
44
  "fast-json-patch": "^3.0.0-1",
@@ -65,10 +54,21 @@
65
54
  "peerDependencies": {
66
55
  "@aptos-scp/scp-component-business-core": "^1.12.2",
67
56
  "@aptos-scp/scp-component-logging": "^2.1.16",
57
+ "@aptos-scp/scp-component-pricing": "^7.54.1",
58
+ "@aptos-scp/scp-component-store-items": "^1.19.0",
68
59
  "@aptos-scp/scp-component-store-selling-core": "^18.8.2",
60
+ "@aptos-scp/scp-component-taxation": "^5.25.0",
61
+ "@aptos-scp/scp-component-user": "^1.4.0",
62
+ "@aptos-scp/scp-types-client-registration": "^1.4.0",
69
63
  "@aptos-scp/scp-types-core-config": "^2.2.1",
70
- "@aptos-scp/scp-types-commerce-devices": "^3.1.0",
71
- "@aptos-scp/scp-types-commerce-transaction": "^1.59.0",
64
+ "@aptos-scp/scp-types-commerce-devices": "^3.2.0",
65
+ "@aptos-scp/scp-types-commerce-transaction": "^1.60.0",
66
+ "@aptos-scp/scp-types-customer": "^3.7.0",
67
+ "@aptos-scp/scp-types-einvoice": "^1.17.0",
68
+ "@aptos-scp/scp-types-inventory": "^2.0.0",
69
+ "@aptos-scp/scp-types-loyalty-memberships": "^2.3.0",
70
+ "@aptos-scp/scp-types-orders": "^4.11.0",
71
+ "@aptos-scp/scp-types-ss-transaction-history": "^1.6.0",
72
72
  "inversify": "^5.0.1"
73
73
  },
74
74
  "devDependencies": {
@@ -76,15 +76,26 @@
76
76
  "@aptos-scp/scp-component-business-core": "^1.12.2",
77
77
  "@aptos-scp/scp-component-commit-configs": "^4.1.3",
78
78
  "@aptos-scp/scp-component-logging": "^2.1.16",
79
+ "@aptos-scp/scp-component-pricing": "^7.54.1",
79
80
  "@aptos-scp/scp-component-rn-circuit-breaker": "^1.0.15",
81
+ "@aptos-scp/scp-component-store-items": "^1.19.0",
80
82
  "@aptos-scp/scp-component-store-selling-core": "^18.8.2",
81
- "@aptos-scp/scp-types-commerce-devices": "^3.1.0",
82
- "@aptos-scp/scp-types-commerce-transaction": "^1.59.0",
83
+ "@aptos-scp/scp-component-taxation": "^5.25.0",
84
+ "@aptos-scp/scp-component-user": "^1.4.0",
85
+ "@aptos-scp/scp-types-client-registration": "^1.4.0",
86
+ "@aptos-scp/scp-types-commerce-devices": "^3.2.0",
87
+ "@aptos-scp/scp-types-commerce-transaction": "^1.60.0",
83
88
  "@aptos-scp/scp-types-core": "^1.0.5",
84
89
  "@aptos-scp/scp-types-core-config": "^2.2.1",
85
90
  "@aptos-scp/scp-types-currency-conversion": "^1.2.0",
91
+ "@aptos-scp/scp-types-customer": "^3.7.0",
92
+ "@aptos-scp/scp-types-einvoice": "^1.17.0",
86
93
  "@aptos-scp/scp-types-fiscal-transaction": "^1.4.3",
94
+ "@aptos-scp/scp-types-inventory": "^2.0.0",
95
+ "@aptos-scp/scp-types-loyalty-memberships": "^2.3.0",
96
+ "@aptos-scp/scp-types-orders": "^4.11.0",
87
97
  "@aptos-scp/scp-types-pricing": "^4.23.0",
98
+ "@aptos-scp/scp-types-ss-transaction-history": "^1.6.0",
88
99
  "@aptos-scp/scp-types-store-items": "^1.23.0",
89
100
  "@aptos-scp/scp-types-terminal-settings": "^1.3.0",
90
101
  "@aptos-scp/scp-types-transaction": "^1.4.3",
@@ -1 +0,0 @@
1
- export * from "./transaction-services.config";
@@ -1,7 +0,0 @@
1
- "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- __export(require("./transaction-services.config"));
7
- //# sourceMappingURL=index.js.map
@@ -1,11 +0,0 @@
1
- import { Container, ContainerModule } from "inversify";
2
- import { BindToCallback } from "../binding-helpers";
3
- import { ITransactionAccountingService } from "../../../domain";
4
- /**
5
- * Only call this from the composition root when the DI container bindings are being constructed
6
- */
7
- export declare function loadTransactionServicesDomain(container: Container, external: ITransactionServicesDomainExternalBindings): Promise<void>;
8
- export interface ITransactionServicesDomainExternalBindings {
9
- ITransactionAccountingService: BindToCallback<ITransactionAccountingService>;
10
- }
11
- export declare function createTransactionServicesDomainContainerModule(external: ITransactionServicesDomainExternalBindings): ContainerModule;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const inversify_1 = require("inversify");
13
- const binding_helpers_1 = require("../binding-helpers");
14
- const DiTypes_1 = require("../../DiTypes");
15
- /**
16
- * Only call this from the composition root when the DI container bindings are being constructed
17
- */
18
- function loadTransactionServicesDomain(container, external) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- container.load(createTransactionServicesDomainContainerModule(external));
21
- });
22
- }
23
- exports.loadTransactionServicesDomain = loadTransactionServicesDomain;
24
- function createTransactionServicesDomainContainerModule(external) {
25
- return new inversify_1.ContainerModule((bind) => {
26
- binding_helpers_1.bindExternal(bind, DiTypes_1.DI_TYPES.ITransactionAccountingService, external.ITransactionAccountingService);
27
- });
28
- }
29
- exports.createTransactionServicesDomainContainerModule = createTransactionServicesDomainContainerModule;
30
- //# sourceMappingURL=transaction-services.config.js.map
@@ -1,9 +0,0 @@
1
- import { Container } from "inversify";
2
- import { IActionContext, IDomainNotificationService, ITransaction, ITransactionLineFactory, ITransactionNumberProvider, PosBusinessAction as CorePosBusinessAction } from "@aptos-scp/scp-component-store-selling-core";
3
- import { ITransactionAccountingService } from "../service";
4
- export declare class PosBusinessAction extends CorePosBusinessAction {
5
- private _transactionAccountingService;
6
- constructor(transactionNumberProvider: ITransactionNumberProvider, transactionAccountingService: ITransactionAccountingService, transactionLineFactory: ITransactionLineFactory, domainNotificationService: IDomainNotificationService, diContainer: Container);
7
- protected updateTransactionAccounting(context: IActionContext): Promise<ITransaction>;
8
- protected transactionShouldClose(transaction: ITransaction): boolean;
9
- }
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
- var __param = (this && this.__param) || function (paramIndex, decorator) {
12
- return function (target, key) { decorator(target, key, paramIndex); }
13
- };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
- Object.defineProperty(exports, "__esModule", { value: true });
24
- const inversify_1 = require("inversify");
25
- const scp_component_store_selling_core_1 = require("@aptos-scp/scp-component-store-selling-core");
26
- const DiTypes_1 = require("../../config/DiTypes");
27
- const model_1 = require("../model");
28
- let PosBusinessAction = class PosBusinessAction extends scp_component_store_selling_core_1.PosBusinessAction {
29
- constructor(transactionNumberProvider, transactionAccountingService, transactionLineFactory, domainNotificationService, diContainer) {
30
- super(transactionNumberProvider, transactionLineFactory, domainNotificationService, diContainer);
31
- this._transactionAccountingService = transactionAccountingService;
32
- }
33
- updateTransactionAccounting(context) {
34
- var _a;
35
- return __awaiter(this, void 0, void 0, function* () {
36
- const transactionFlowStateObject = context.getState(model_1.TRANSACTION_FLOW_STATE);
37
- const transactionFlowState = (_a = transactionFlowStateObject) === null || _a === void 0 ? void 0 : _a.state;
38
- return this._transactionAccountingService.updateTransaction(context.transaction, transactionFlowState);
39
- });
40
- }
41
- transactionShouldClose(transaction) {
42
- return this._transactionAccountingService.transactionShouldClose(transaction);
43
- }
44
- };
45
- PosBusinessAction = __decorate([
46
- inversify_1.injectable(),
47
- __param(0, inversify_1.inject(scp_component_store_selling_core_1.DI_TYPES.ITransactionNumberProvider)),
48
- __param(1, inversify_1.inject(DiTypes_1.DI_TYPES.ITransactionAccountingService)),
49
- __param(2, inversify_1.inject(scp_component_store_selling_core_1.DI_TYPES.ITransactionFactory)),
50
- __param(3, inversify_1.inject(scp_component_store_selling_core_1.DI_TYPES.IDomainNotificationService)),
51
- __param(4, inversify_1.inject(scp_component_store_selling_core_1.DI_TYPES.DependencyInjectionContainer)),
52
- __metadata("design:paramtypes", [Object, Object, Object, Object, inversify_1.Container])
53
- ], PosBusinessAction);
54
- exports.PosBusinessAction = PosBusinessAction;
55
- //# sourceMappingURL=PosBusinessAction.js.map
@@ -1 +0,0 @@
1
- export * from "./PosBusinessAction";
@@ -1,7 +0,0 @@
1
- "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- __export(require("./PosBusinessAction"));
7
- //# sourceMappingURL=index.js.map
@@ -1,48 +0,0 @@
1
- import { DeviceIdentity, IReceiptFormattingService as ICoreReceiptFormattingService, ITransaction, Receipt as CoreReceipt } from "@aptos-scp/scp-component-store-selling-core";
2
- import { IPrinterInfo, IReceiptRequiredData, ItemLine, ReceiptCategory } from "../../";
3
- export interface IReceiptFormattingService extends ICoreReceiptFormattingService {
4
- formatBalanceInquiryReceipt(transaction: ITransaction, locale: string, printer?: IPrinterInfo): Promise<Receipt>;
5
- formatReceiptByCategory(transaction: ITransaction, locale: string, receiptCategory: ReceiptCategory, lineNumbers?: number[], printer?: IPrinterInfo, receiptRequiredData?: IReceiptRequiredData[]): Promise<Receipt>;
6
- formatReprintReceipt(lines: string[], deviceIdentity: DeviceIdentity, locale?: string, originalReceiptCategory?: ReceiptCategory, printer?: IPrinterInfo): Promise<Receipt>;
7
- formatGiftReceipt(transaction: ITransaction, giftitems: Array<ItemLine>, locale: string, printer?: IPrinterInfo): Promise<Receipt>;
8
- formatCouponReceipt(transaction: ITransaction, locale: string, receiptRequiredData: IReceiptRequiredData[], printer?: IPrinterInfo): Promise<Receipt>;
9
- formatPostVoidReceipts(transaction: ITransaction, locale?: string, printer?: IPrinterInfo): Promise<Receipt[]>;
10
- formatReceiptTemplate(transaction: ITransaction, locale?: string, printer?: IPrinterInfo, selectedReceiptCategory?: string): Promise<ReceiptTemplate[]>;
11
- formatReceiptTemplateValue(transaction: ITransaction, lines: string[], locale?: string, additionalInfo?: AdditionalReprintInfo, printer?: IPrinterInfo, reprintCount?: number): Promise<Receipt>;
12
- formatTillReceipt(transaction: ITransaction, locale: string, printer?: IPrinterInfo): Promise<Receipt>;
13
- formatNoSaleReceipt(transaction: ITransaction, locale: string, printer?: IPrinterInfo): Promise<Receipt>;
14
- formatPaidOperationReceipt(transaction: ITransaction, locale: string, printer?: IPrinterInfo): Promise<Receipt>;
15
- removeReceiptTemplateValue(receiptLines: string[]): string[];
16
- formatPostVoidReceiptTemplate(transaction: ITransaction, locale?: string, printer?: IPrinterInfo): Promise<ReceiptTemplate[]>;
17
- formatSendSaleReceipt(transaction: ITransaction, sendsaleitems: Array<ItemLine>, locale: string, printer?: IPrinterInfo): Promise<Receipt>;
18
- }
19
- export interface AdditionalReprintInfo {
20
- originalTransactionEndDateTime?: Date;
21
- originalTransactionDeviceId: string;
22
- originalTransactionNumber: number;
23
- currentReceiptCategory: ReceiptCategory;
24
- duplicateCopy: boolean;
25
- taxInvoiceNumber?: string;
26
- taxInvoicePrintDate?: Date;
27
- invoiceTransactionNumber?: number;
28
- invoiceFiscalTransactionNumber?: string;
29
- }
30
- export interface ReceiptTypeCount {
31
- print: ReceiptCount;
32
- email: ReceiptCount;
33
- }
34
- export interface ReceiptCount {
35
- sale?: number;
36
- invoice?: number;
37
- vatReceipt?: number;
38
- fullPageInvoice?: number;
39
- japanRSS?: number;
40
- postVoid?: number;
41
- }
42
- export interface Receipt extends CoreReceipt {
43
- isTemplate?: boolean;
44
- htmlDocument?: string;
45
- }
46
- export interface ReceiptTemplate extends Receipt {
47
- receiptCategory: ReceiptCategory;
48
- }
@@ -1,6 +0,0 @@
1
- import { ITransaction } from "@aptos-scp/scp-component-store-selling-core";
2
- import { TransactionFlowSessionState } from "../model";
3
- export interface ITransactionAccountingService {
4
- updateTransaction(transaction: ITransaction, transactionFlowState?: TransactionFlowSessionState): Promise<ITransaction>;
5
- transactionShouldClose(transaction: ITransaction): boolean;
6
- }
@@ -1,9 +0,0 @@
1
- import { Container } from "inversify";
2
- import { ITransaction, IUser, QualificationResult } from "@aptos-scp/scp-component-store-selling-core";
3
- import { IAccessPolicyConfig, ISupervisorCredentials } from "../model";
4
- export declare function eventToConfigKeyMap(): Map<string, string>;
5
- export declare function getEventConfigs(diContainer: Container, eventType: string): IAccessPolicyConfig;
6
- export declare function isUserValid(user: IUser): boolean;
7
- export declare function checkUserSecurityLevel(user: IUser, requiredSecurityLevel: number): boolean;
8
- export declare function skipSecurityCheck(transaction: ITransaction, eventType: string, supervisor: ISupervisorCredentials, qualificationResult: QualificationResult): boolean;
9
- export declare function convertDateTimeToDateOnly(date: Date): Date;
@@ -1,152 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const scp_component_store_selling_core_1 = require("@aptos-scp/scp-component-store-selling-core");
4
- const model_1 = require("../model");
5
- const UIBusinessEventTypes_1 = require("../UIBusinessEventTypes");
6
- function eventToConfigKeyMap() {
7
- return new Map([
8
- [UIBusinessEventTypes_1.VOID_ITEM_LINE_EVENT, "itemVoid"],
9
- [UIBusinessEventTypes_1.VOID_TRANSACTION_EVENT, "transactionVoid"],
10
- [UIBusinessEventTypes_1.MANUAL_ITEM_DISCOUNT_EVENT, "itemDiscounts"],
11
- [UIBusinessEventTypes_1.MANUAL_TRANSACTION_DISCOUNT_EVENT, "transactionDiscounts"],
12
- [UIBusinessEventTypes_1.FAST_DISCOUNT_EVENT, "fastDiscount"],
13
- [UIBusinessEventTypes_1.APPLY_DISCOUNT_EVENT, "applyDiscount"],
14
- [UIBusinessEventTypes_1.PRICE_CHANGE_EVENT, "priceOverride"],
15
- [UIBusinessEventTypes_1.APPLY_EMPLOYEE_DISCOUNT_EVENT, "associateDiscounts"],
16
- [UIBusinessEventTypes_1.APPLY_EMPLOYEE_TRANSACTION_DISCOUNT_EVENT, "associateDiscounts"],
17
- [UIBusinessEventTypes_1.ADD_EMPLOYEE_CUSTOMER_EVENT, "addEmployeeCustomer"],
18
- [UIBusinessEventTypes_1.MODIFY_EMPLOYEE_MANUAL_DISCOUNT_EVENT, "associateDiscounts"],
19
- [UIBusinessEventTypes_1.MODIFY_ITEM_MANUAL_DISCOUNT_EVENT, "itemDiscounts"],
20
- [UIBusinessEventTypes_1.MODIFY_TRANSACTION_MANUAL_DISCOUNT_EVENT, "transactionDiscounts"],
21
- [UIBusinessEventTypes_1.POST_VOID_TRANSACTION_EVENT, "postVoid"],
22
- [UIBusinessEventTypes_1.POST_VOID_RESTORED_TRANSACTION_EVENT, "postVoid"],
23
- [UIBusinessEventTypes_1.CLOSE_TERMINAL_EVENT, "openCloseTerminal"],
24
- [UIBusinessEventTypes_1.OPEN_TERMINAL_EVENT, "openCloseTerminal"],
25
- [UIBusinessEventTypes_1.RETURN_TOTAL_EVENT, "returnItemsWithoutReceipt"],
26
- [UIBusinessEventTypes_1.EXIT_RETURN_MODE_EVENT, "returnItemsWithoutReceipt"],
27
- [UIBusinessEventTypes_1.QUANTITY_CHANGE_EVENT, "changeQuantity"],
28
- [UIBusinessEventTypes_1.APPLY_SINGLE_USE_COUPON_EVENT, "expiredValidatedCoupons"],
29
- [UIBusinessEventTypes_1.LOG_ON_EVENT, "login"],
30
- [UIBusinessEventTypes_1.ENTER_ATTENDANT_MODE_EVENT, "login"],
31
- [UIBusinessEventTypes_1.TRANSACTION_TAX_EXEMPT_EVENT, "transactionTaxExempt"],
32
- [UIBusinessEventTypes_1.ITEM_TAX_EXEMPT_EVENT, "itemTaxExempt"],
33
- [UIBusinessEventTypes_1.START_TILL_OUT_EVENT, "tillOut"],
34
- [UIBusinessEventTypes_1.START_TILL_IN_EVENT, "tillIn"],
35
- [UIBusinessEventTypes_1.START_NO_SALE_EVENT, "noSale"],
36
- [UIBusinessEventTypes_1.START_PAID_OUT_EVENT, "paidOut"],
37
- [UIBusinessEventTypes_1.START_PAID_IN_EVENT, "paidIn"],
38
- [UIBusinessEventTypes_1.START_TILL_AUDIT_EVENT, "tillAudit"],
39
- [UIBusinessEventTypes_1.START_TILL_COUNT_EVENT, "tillCount"],
40
- [UIBusinessEventTypes_1.START_TILL_TO_BANK_EVENT, "tillToBank"],
41
- [UIBusinessEventTypes_1.START_SAFE_TO_TILL_EVENT, "safeToTill"],
42
- [UIBusinessEventTypes_1.START_TILL_TO_SAFE_EVENT, "tillToSafe"],
43
- [UIBusinessEventTypes_1.APPLY_RETURN_WITH_TRANSACTION_EVENT, "returnWithTransaction"],
44
- [UIBusinessEventTypes_1.START_TILL_RECONCILIATION_EVENT, "tillReconciliation"],
45
- [UIBusinessEventTypes_1.TRANSACTION_TAX_OVERRIDE_EVENT, "transactionTaxOverride"],
46
- [UIBusinessEventTypes_1.ITEM_TAX_OVERRIDE_EVENT, "itemTaxOverride"],
47
- [UIBusinessEventTypes_1.TENDER_EXCHANGE_EVENT, "tenderExchange"],
48
- [UIBusinessEventTypes_1.START_EXCHANGE_RATE_ENTRY_EVENT, "exchangeRateEntry"],
49
- [UIBusinessEventTypes_1.UPLOAD_DEVICE_LOGS_EVENT, "uploadPaymentLogs"],
50
- [UIBusinessEventTypes_1.BYPASS_REFUNDED_TAX_FREE_WARNING_EVENT, "bypassRefundedTaxFreeWarning"],
51
- [UIBusinessEventTypes_1.REPRINT_LAST_TRANSACTION_RECEIPTS_EVENT, "reprintReceipt"],
52
- [UIBusinessEventTypes_1.REPRINT_TRANSACTION_RECEIPTS_EVENT, "reprintReceipt"],
53
- [UIBusinessEventTypes_1.REPLACE_FISCAL_DEVICE_EVENT, "swapFiscalDevice"],
54
- [UIBusinessEventTypes_1.REPLACE_FISCAL_DEVICE_HOST_EVENT, "swapFiscalDeviceHost"],
55
- [UIBusinessEventTypes_1.SETUP_FISCAL_DEVICE_EVENT, "setUpFiscalDevice"],
56
- ]);
57
- }
58
- exports.eventToConfigKeyMap = eventToConfigKeyMap;
59
- function getEventConfigs(diContainer, eventType) {
60
- const configKey = eventToConfigKeyMap().get(eventType);
61
- return diContainer
62
- .get(scp_component_store_selling_core_1.DI_TYPES.IConfigurationManager)
63
- .getFunctionalBehaviorValues().securityPolicies.accessPolicies[configKey];
64
- }
65
- exports.getEventConfigs = getEventConfigs;
66
- function isUserValid(user) {
67
- if (!user) {
68
- return false;
69
- }
70
- let mergedUser = mergeGlobalUserAndLocationUser(user);
71
- return !!(mergedUser && isMergedUserValid(mergedUser));
72
- }
73
- exports.isUserValid = isUserValid;
74
- function checkUserSecurityLevel(user, requiredSecurityLevel) {
75
- if (!user) {
76
- return false;
77
- }
78
- let mergedUser = mergeGlobalUserAndLocationUser(user);
79
- return !!(mergedUser &&
80
- isMergedUserValid(mergedUser) &&
81
- mergedUser.securityRole &&
82
- parseInt(mergedUser.securityRole.securityLevel, 10) >= requiredSecurityLevel);
83
- }
84
- exports.checkUserSecurityLevel = checkUserSecurityLevel;
85
- function skipSecurityCheck(transaction, eventType, supervisor, qualificationResult) {
86
- /**
87
- * Security check can be skip when the transaction is resuming for either a transaction resume or transaction
88
- * post void
89
- * Don't skip security requirements when a supervisor is provided for POST_VOID_RESTORED_TRANSACTION_EVENT
90
- */
91
- const transactionResumeOrPostVoid = transaction &&
92
- transaction.isResuming() &&
93
- !(supervisor && eventType === UIBusinessEventTypes_1.POST_VOID_RESTORED_TRANSACTION_EVENT);
94
- /**
95
- * The security check was disabled by a previous qualifier
96
- */
97
- const directlyDisabled = qualificationResult.collectedData.get(model_1.CollectedDataKey.DisableSupervisorOverride);
98
- return transactionResumeOrPostVoid || directlyDisabled;
99
- }
100
- exports.skipSecurityCheck = skipSecurityCheck;
101
- function convertDateTimeToDateOnly(date) {
102
- return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
103
- }
104
- exports.convertDateTimeToDateOnly = convertDateTimeToDateOnly;
105
- function mergeGlobalUserAndLocationUser(user) {
106
- var _a, _b, _c, _d;
107
- return {
108
- id: user.id,
109
- username: user.username,
110
- displayName: user.displayName,
111
- firstName: user.firstName,
112
- lastName: user.lastName,
113
- middleName: user.middleName,
114
- preferredLanguage: user.preferredLanguage,
115
- securityRole: ((_a = user.retailLocationRole) === null || _a === void 0 ? void 0 : _a.securityRole) ? user.retailLocationRole.securityRole
116
- : user.securityRole,
117
- accountStatus: ((_b = user.retailLocationRole) === null || _b === void 0 ? void 0 : _b.assignmentStatus) ? convertAssignmentStatusToAccountStatus(user.retailLocationRole.assignmentStatus)
118
- : user.accountStatus,
119
- effectiveDate: ((_c = user.retailLocationRole) === null || _c === void 0 ? void 0 : _c.effectiveDate) ? user.retailLocationRole.effectiveDate
120
- : user.effectiveDate,
121
- expirationDate: ((_d = user.retailLocationRole) === null || _d === void 0 ? void 0 : _d.expirationDate) ? user.retailLocationRole.expirationDate
122
- : user.expirationDate,
123
- };
124
- }
125
- function convertAssignmentStatusToAccountStatus(assignmentStatus) {
126
- switch (assignmentStatus) {
127
- case "Active":
128
- case "Inactive":
129
- case "Deleted":
130
- case "Locked":
131
- return assignmentStatus;
132
- default:
133
- return undefined;
134
- }
135
- }
136
- function isMergedUserValid(user) {
137
- const accountStatus = user.accountStatus;
138
- if (!accountStatus || accountStatus !== "Active") {
139
- return false;
140
- }
141
- const nowAsUTC = convertDateTimeToDateOnly(new Date());
142
- const expirationDate = user.expirationDate && convertDateTimeToDateOnly(new Date(user.expirationDate));
143
- if (expirationDate && expirationDate < nowAsUTC) {
144
- return false;
145
- }
146
- const effectiveDate = user.effectiveDate && convertDateTimeToDateOnly(new Date(user.effectiveDate));
147
- if (effectiveDate && effectiveDate > nowAsUTC) {
148
- return false;
149
- }
150
- return true;
151
- }
152
- //# sourceMappingURL=supervisorOverride.js.map