@aptos-scp/scp-component-store-selling-features-domain-model 2.10.0 → 2.10.2

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.
@@ -254,7 +254,7 @@ export declare class MerchandiseTransaction extends RetailTransaction implements
254
254
  get transactionTaxExemptAmount(): Money;
255
255
  get transactionTaxAdjustmentAmount(): Money;
256
256
  get fiscalError(): IFiscalError;
257
- get fiscalizationComplete(): boolean;
257
+ get hasFiscalizationCompleted(): boolean;
258
258
  get tradeType(): MerchandiseTransactionTradeType;
259
259
  get taxLotteryNumber(): string;
260
260
  get taxLotteryCustomerCode(): string;
@@ -300,7 +300,7 @@ export declare class MerchandiseTransaction extends RetailTransaction implements
300
300
  assignFiscalTypeCode(fiscalTypeCode: string): ITransaction;
301
301
  assignFiscalTransactionSequenceNumber(fiscalTransactionSequenceNumber: number, fiscalTransactionSequenceNumberGenerator: string): ITransaction;
302
302
  setFiscalError(fiscalError: IFiscalError): ITransaction;
303
- setFiscalizationComplete(fiscalizationComplete: boolean): ITransaction;
303
+ setHasFiscalizationCompleted(hasFiscalizationCompleted: boolean): ITransaction;
304
304
  assignOrderReferenceSequenceNumber(orderReferenceSequenceNumber: number, orderReferenceSequenceNumberGenerator: string): ITransaction;
305
305
  assignInvoiceFiscalTransactionNumber(invoiceTransactionNumber: number, invoiceFiscalTransactionNumber: string): ITransaction;
306
306
  assignTaxlotteryNumber(taxLotteryNumber: string): ITransaction;
@@ -497,7 +497,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
497
497
  get fiscalError() {
498
498
  return this._fiscalError;
499
499
  }
500
- get fiscalizationComplete() {
500
+ get hasFiscalizationCompleted() {
501
501
  return this._hasFiscalizationCompleted;
502
502
  }
503
503
  get tradeType() {
@@ -720,9 +720,9 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
720
720
  newTransaction._fiscalError = fiscalError;
721
721
  return newTransaction;
722
722
  }
723
- setFiscalizationComplete(fiscalizationComplete) {
723
+ setHasFiscalizationCompleted(hasFiscalizationCompleted) {
724
724
  const newTransaction = this.clone();
725
- newTransaction._hasFiscalizationCompleted = fiscalizationComplete;
725
+ newTransaction._hasFiscalizationCompleted = hasFiscalizationCompleted;
726
726
  return newTransaction;
727
727
  }
728
728
  assignOrderReferenceSequenceNumber(orderReferenceSequenceNumber, orderReferenceSequenceNumberGenerator) {
@@ -901,7 +901,7 @@ class MerchandiseTransaction extends RetailTransaction_1.RetailTransaction {
901
901
  ["transaction.taxExemptAmount", this._transactionTaxExemptAmount],
902
902
  ["transaction.transactionTaxAdjustmentAmount", this._transactionTaxAdjustmentAmount],
903
903
  ["transaction.fiscalError", this._fiscalError],
904
- ["transaction.fiscalizationComplete", this._hasFiscalizationCompleted],
904
+ ["transaction.hasFiscalizationCompleted", this._hasFiscalizationCompleted],
905
905
  ["transaction.tradeType", this._tradeType],
906
906
  ["transaction.signatureCollected", this.signatureCollected],
907
907
  ["transaction.itemPickupSignatureCollected", this.itemPickupSignatureCollected],
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function isVoidableLine(transactionLine) {
4
- return (transactionLine.voided !== undefined &&
5
- transactionLine.preventsTransactionVoid !== undefined);
4
+ /**
5
+ * Using "in" to check for the existence of these properties is faster than comparing
6
+ * to undefined since it is not evaluating the getter method and avoids the extra
7
+ * calculations on deeply nested decorators.
8
+ */
9
+ return "voided" in transactionLine && "preventsTransactionVoid" in transactionLine;
6
10
  }
7
11
  exports.isVoidableLine = isVoidableLine;
8
12
  function lineCanBeVoided(transactionLine) {
@@ -112,10 +112,18 @@ class ItemLinePromotionDecorator extends ItemLineBaseDiscountDecorator_1.ItemLin
112
112
  : this.decoratedTransactionLine.itemSelectedUnitPrice;
113
113
  }
114
114
  get extendedAmountExcludingTransactionDiscounts() {
115
- const resultAmount = this.decoratedTransactionLine.extendedAmountExcludingTransactionDiscounts
115
+ /**
116
+ * Creating this constant so that the extendedAmountExcludingTransactionDiscounts
117
+ * getter on the decorated line is only accessed once.
118
+ * Accessing the property multiple times causes the calculations on decorated
119
+ * decorators to be performed multiple times that can be a performance issue on
120
+ * deeply nested decorators.
121
+ */
122
+ const decoratedExtendedAmountExcludingTransactionDiscounts = this.decoratedTransactionLine.extendedAmountExcludingTransactionDiscounts;
123
+ const resultAmount = decoratedExtendedAmountExcludingTransactionDiscounts
116
124
  .abs()
117
125
  .minus(this.adjustmentAmount.abs());
118
- return this.decoratedTransactionLine.extendedAmountExcludingTransactionDiscounts.isNegative()
126
+ return decoratedExtendedAmountExcludingTransactionDiscounts.isNegative()
119
127
  ? resultAmount.times(-1) // return to negative value for returns.
120
128
  : resultAmount;
121
129
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aptos-scp/scp-component-store-selling-features-domain-model",
3
- "version": "2.10.0",
3
+ "version": "2.10.2",
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",