@aptos-scp/scp-component-store-selling-features-domain-model 1.53.2 → 1.53.3-patch.1

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.
@@ -614,6 +614,7 @@ export declare enum CollectedDataKey {
614
614
  ExtendedAmountFromExternalItem = "extendedAmountFromExternalItem",
615
615
  ExtendedAmountIncludingTaxFromExternalItem = "extendedAmountIncludingTaxFromExternalItem",
616
616
  ExtendedAmountExcludingTaxFromExternalItem = "extendedAmountExcludingTaxFromExternalItem",
617
+ OriginalAdjustments = "originalAdjustments",
617
618
  OriginalTenderLineReferences = "originalTenderLineReferences",
618
619
  OriginalTenderReferences = "originalTenderReferences",
619
620
  OriginalTransactionReference = "originalTransactionReference",
@@ -623,6 +623,7 @@ var CollectedDataKey;
623
623
  CollectedDataKey["ExtendedAmountFromExternalItem"] = "extendedAmountFromExternalItem";
624
624
  CollectedDataKey["ExtendedAmountIncludingTaxFromExternalItem"] = "extendedAmountIncludingTaxFromExternalItem";
625
625
  CollectedDataKey["ExtendedAmountExcludingTaxFromExternalItem"] = "extendedAmountExcludingTaxFromExternalItem";
626
+ CollectedDataKey["OriginalAdjustments"] = "originalAdjustments";
626
627
  CollectedDataKey["OriginalTenderLineReferences"] = "originalTenderLineReferences";
627
628
  CollectedDataKey["OriginalTenderReferences"] = "originalTenderReferences";
628
629
  CollectedDataKey["OriginalTransactionReference"] = "originalTransactionReference";
@@ -64,7 +64,12 @@ class BaseFeeLineDecorator extends BaseLineDecorator_1.BaseLineDecorator {
64
64
  return this.decoratedTransactionLine.extendedAmount;
65
65
  }
66
66
  get extendedAmountAdjustment() {
67
- return this.extendedAmount.minus(this.decoratedTransactionLine.extendedAmount);
67
+ if (this.decoratedTransactionLine.extendedAmount) {
68
+ return this.extendedAmount.minus(this.decoratedTransactionLine.extendedAmount);
69
+ }
70
+ else {
71
+ return this._lineSavings.times(-1);
72
+ }
68
73
  }
69
74
  get extendedAmountExcludingTax() {
70
75
  return this.decoratedTransactionLine.extendedAmountExcludingTax;
@@ -1,6 +1,6 @@
1
1
  import { IPricingMetadataPersistanceObject, ISerializedLinePricingAdjustment, ISerializedSubline, ISerializedSublinePricingAdjustment, ISublinePricingAdjustment, RewardIssue } from "@aptos-scp/scp-component-pricing";
2
2
  import { ISerializedNonFinancialReward } from "@aptos-scp/scp-component-pricing/lib/interfaces/ILineNonFinancialReward";
3
- import { ICompetitivePriceInformation, ILoyaltyInformation, ISupervisorOverrideInformation, SourceIndicator } from "@aptos-scp/scp-types-commerce-transaction";
3
+ import { ICompetitivePriceInformation, ILoyaltyInformation, ISupervisorOverrideInformation, PricingAdjustmentScope, SourceIndicator } from "@aptos-scp/scp-types-commerce-transaction";
4
4
  import { PotentialPromotion } from "@aptos-scp/scp-types-pricing";
5
5
  export interface ISerializedPriceCalculationResultsWithSource {
6
6
  readonly lineAdjustments: ISerializedLinePricingAdjustmentWithSource[];
@@ -34,6 +34,7 @@ export interface ISerializedSublinePricingAdjustmentWithSource extends ISerializ
34
34
  isEmployeeDiscount?: boolean;
35
35
  }
36
36
  export interface ISublinePricingAdjustmentWithSource extends ISublinePricingAdjustment {
37
+ adjustmentScope?: PricingAdjustmentScope;
37
38
  sourceIndicator?: SourceIndicator;
38
39
  reasonCode?: string;
39
40
  reasonListType?: string;
@@ -109,6 +109,7 @@ export declare class ItemLine extends BaseTransactionLine implements IItemLine,
109
109
  private _originalRedemptionLoyaltyTransactionKeys?;
110
110
  private _originalSaleLoyaltyTransactionKeys?;
111
111
  private _originalDiscountReason?;
112
+ private _originalAdjustments?;
112
113
  private _taxIndicatorOnReceipt?;
113
114
  /**
114
115
  * The create method is called by the transaction line factory to create an instance and initialize it from the
@@ -54,6 +54,7 @@ class ItemLine extends BaseTransactionLine_1.BaseTransactionLine {
54
54
  const lineNumberFromOrder = collectedData.get(Constants_1.CollectedDataKey.LineNumberFromOrder);
55
55
  const lineSavings = collectedData.get(Constants_1.CollectedDataKey.LineSavings);
56
56
  const sendSaleLine = collectedData.get(Constants_1.CollectedDataKey.SendSaleItem);
57
+ const originalAdjustments = collectedData.get(Constants_1.CollectedDataKey.OriginalAdjustments);
57
58
  accountingCurrency = (storeItem.price && storeItem.price.amount.currency) || accountingCurrency;
58
59
  let itemLine = new ItemLine(lineNumber, lineType, (storeItem.price && storeItem.price.amount.currency) || accountingCurrency, lineSavings);
59
60
  if (additionalItemInfo) {
@@ -233,6 +234,11 @@ class ItemLine extends BaseTransactionLine_1.BaseTransactionLine {
233
234
  itemLine._preTaxOverrideDetails = originalTaxOverride.preTaxOverrideDetails;
234
235
  }
235
236
  }
237
+ if (((lineType === exports.ITEM_SALE_LINE_TYPE && uiBusinessEvent.type === UIBusinessEventTypes_1.ORDER_ITEM_PICKUP_EVENT) ||
238
+ (lineType === exports.ITEM_CANCEL_LINE_TYPE && uiBusinessEvent.type === UIBusinessEventTypes_1.ORDER_ITEM_CANCELLATION_EVENT)) &&
239
+ originalAdjustments) {
240
+ itemLine._originalAdjustments = originalAdjustments;
241
+ }
236
242
  const originalRedemptionLoyaltyTransactionKeys = collectedData.get(Constants_1.CollectedDataKey.OriginalRedemptionLoyaltyTransactionKeys);
237
243
  if (((_f = originalRedemptionLoyaltyTransactionKeys) === null || _f === void 0 ? void 0 : _f.length) > 0) {
238
244
  itemLine._originalRedemptionLoyaltyTransactionKeys = originalRedemptionLoyaltyTransactionKeys;
@@ -611,7 +617,7 @@ class ItemLine extends BaseTransactionLine_1.BaseTransactionLine {
611
617
  return this._originalTaxOverride;
612
618
  }
613
619
  get originalAdjustments() {
614
- return undefined;
620
+ return this._originalAdjustments;
615
621
  }
616
622
  get eligibleForSubscription() {
617
623
  return this._eligibleForSubscription;
@@ -936,6 +942,7 @@ class ItemLine extends BaseTransactionLine_1.BaseTransactionLine {
936
942
  newItemLine._extendedRegularAmount = this._extendedRegularAmount;
937
943
  newItemLine._originalRedemptionLoyaltyTransactionKeys = this._originalRedemptionLoyaltyTransactionKeys;
938
944
  newItemLine._originalSaleLoyaltyTransactionKeys = this._originalSaleLoyaltyTransactionKeys;
945
+ newItemLine._originalAdjustments = this._originalAdjustments;
939
946
  return newItemLine;
940
947
  }
941
948
  // eslint-disable-next-line complexity
@@ -1078,6 +1085,7 @@ class ItemLine extends BaseTransactionLine_1.BaseTransactionLine {
1078
1085
  transactionLineJsonObj._originalRedemptionLoyaltyTransactionKeys;
1079
1086
  this._originalSaleLoyaltyTransactionKeys = transactionLineJsonObj._originalSaleLoyaltyTransactionKeys;
1080
1087
  this._originalDiscountReason = transactionLineJsonObj.originalDiscountReason;
1088
+ this._originalAdjustments = transactionLineJsonObj._originalAdjustments;
1081
1089
  }
1082
1090
  newTransactionLine() {
1083
1091
  return new ItemLine(this.lineNumber, this.lineType, this._accountingCurrency);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const scp_component_business_core_1 = require("@aptos-scp/scp-component-business-core");
4
4
  const StoreItem_1 = require("../StoreItem");
5
5
  const BaseItemLineDecorator_1 = require("./BaseItemLineDecorator");
6
+ const ItemLine_1 = require("./ItemLine");
6
7
  const ItemLineBaseDiscountDecorator_1 = require("./ItemLineBaseDiscountDecorator");
7
8
  exports.DECORATOR_TYPE_ITEM_LINE_MANUAL_ITEM_DISCOUNT = "ITEM_LINE_MANUAL_ITEM_DISCOUNT_DECORATOR";
8
9
  exports.DECORATOR_TYPE_ITEM_LINE_EMPLOYEE_ITEM_DISCOUNT = "ITEM_LINE_EMPLOYEE_ITEM_DISCOUNT_DECORATOR";
@@ -167,7 +168,9 @@ class ItemLineManualDiscountDecorator extends ItemLineBaseDiscountDecorator_1.It
167
168
  : this.unitPrice;
168
169
  }
169
170
  get extendedAmountExcludingTransactionDiscounts() {
170
- return this.lineDecoratorType === exports.DECORATOR_TYPE_ITEM_LINE_MANUAL_TRANSACTION_DISCOUNT
171
+ return this.lineDecoratorType === exports.DECORATOR_TYPE_ITEM_LINE_MANUAL_TRANSACTION_DISCOUNT &&
172
+ !ItemLine_1.isFulfillmentLine(this.decoratedTransactionLine) &&
173
+ !ItemLine_1.isCancelLine(this.decoratedTransactionLine)
171
174
  ? this.decoratedTransactionLine.extendedAmountExcludingTransactionDiscounts
172
175
  : this.decoratedTransactionLine.extendedAmountExcludingTransactionDiscounts.minus(this.adjustmentAmount);
173
176
  }
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.53.2",
3
+ "version": "1.53.3-patch.1",
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",