@aptos-scp/scp-component-store-selling-features-domain-model 1.45.0-patch.4 → 1.45.0-patch.6

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.
@@ -1034,3 +1034,4 @@ export declare enum AssignCustomerForReturnAction {
1034
1034
  Skip = "Skip"
1035
1035
  }
1036
1036
  export declare const DELIVERY_CONTACT_UPDATED_EVENT: string;
1037
+ export declare const DELIVERY_SHIPPING_FEE_UPDATED_EVENT: string;
@@ -1041,4 +1041,5 @@ var AssignCustomerForReturnAction;
1041
1041
  AssignCustomerForReturnAction["Skip"] = "Skip";
1042
1042
  })(AssignCustomerForReturnAction = exports.AssignCustomerForReturnAction || (exports.AssignCustomerForReturnAction = {}));
1043
1043
  exports.DELIVERY_CONTACT_UPDATED_EVENT = "Delivery.ContactUpdated";
1044
+ exports.DELIVERY_SHIPPING_FEE_UPDATED_EVENT = "Delivery.ShippingFeeUpdated";
1044
1045
  //# sourceMappingURL=Constants.js.map
@@ -141,13 +141,15 @@ class TenderType {
141
141
  var _a, _b, _c, _d;
142
142
  let total = new scp_component_business_core_1.Money(0, accountingCurrency);
143
143
  (_b = (_a = displayInfo) === null || _a === void 0 ? void 0 : _a.shippingFeeDisplayLines) === null || _b === void 0 ? void 0 : _b.forEach((shippingFeeDisplayLine) => {
144
+ var _a;
144
145
  if (shippingFeeDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.TransactionFeeRefund) {
145
- total = total.plus(shippingFeeDisplayLine.extendedAmountIncludingTax.abs());
146
+ total = total.plus((_a = shippingFeeDisplayLine.extendedAmountIncludingTax) === null || _a === void 0 ? void 0 : _a.abs());
146
147
  }
147
148
  });
148
149
  (_d = (_c = displayInfo) === null || _c === void 0 ? void 0 : _c.itemFeeDisplayLines) === null || _d === void 0 ? void 0 : _d.forEach((itemFeeDisplayLine) => {
150
+ var _a;
149
151
  if (itemFeeDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemFeeRefund) {
150
- total = total.plus(itemFeeDisplayLine.extendedAmount.abs());
152
+ total = total.plus((_a = itemFeeDisplayLine.extendedAmountIncludingTax) === null || _a === void 0 ? void 0 : _a.abs());
151
153
  }
152
154
  });
153
155
  return total;
@@ -236,8 +238,7 @@ class TenderType {
236
238
  withoutTransactionTotal = withoutTransactionTotal.plus(withoutTransactionItemAmount);
237
239
  const withoutTransactionTenderedAmount = TenderType.getTenderedAmountsWithoutTransaction((_b = displayInfo) === null || _b === void 0 ? void 0 : _b.tenderDisplayLines, accountingCurrency, configurationManager);
238
240
  withoutTransactionTotal = withoutTransactionTotal.minus(withoutTransactionTenderedAmount);
239
- const feesTotal = TenderType.getFeesTotal(displayInfo, accountingCurrency);
240
- withoutTransactionTotal = withoutTransactionTotal.plus(feesTotal);
241
+ // shipping and item fee are not returned on RWOR
241
242
  return withoutTransactionTotal;
242
243
  }
243
244
  static getWithTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
@@ -258,8 +259,7 @@ class TenderType {
258
259
  withOfflineTransactionTotal = withOfflineTransactionTotal.plus(withOfflineTransactionItemAmount);
259
260
  const withOfflineTransactionTenderedAmount = TenderType.getTenderedAmountsWithOfflineTransaction((_b = displayInfo) === null || _b === void 0 ? void 0 : _b.tenderDisplayLines, accountingCurrency, configurationManager);
260
261
  withOfflineTransactionTotal = withOfflineTransactionTotal.minus(withOfflineTransactionTenderedAmount);
261
- const feesTotal = TenderType.getFeesTotal(displayInfo, accountingCurrency);
262
- withOfflineTransactionTotal = withOfflineTransactionTotal.plus(feesTotal);
262
+ // shipping and item fee are not returned on offline returns
263
263
  return withOfflineTransactionTotal;
264
264
  }
265
265
  static getOriginalRefundableTenders(container, accountingCurrency, originalTransactionsDetails, balanceDue, itemTypes, orderTypes, isRefund, productAttributeTypes, displayInfo) {
@@ -1,5 +1,5 @@
1
1
  import { Money } from "@aptos-scp/scp-component-business-core";
2
- import { ITransactionLine } from "@aptos-scp/scp-component-store-selling-core";
2
+ import { IExtendedAmountMaintainer, ITransactionLine } from "@aptos-scp/scp-component-store-selling-core";
3
3
  import { IAppliedTax } from "@aptos-scp/scp-component-taxation";
4
4
  import { ITransactionLineTaxes } from "../item/IItemLine";
5
5
  import { BaseFeeLineDecorator } from "./BaseFeeLineDecorator";
@@ -11,7 +11,7 @@ export interface IExtendedAmountFields {
11
11
  taxByAuthority?: IAppliedTax[];
12
12
  totalLineTax?: Money;
13
13
  }
14
- export declare abstract class FeeLineExtendedAmountDecorator extends BaseFeeLineDecorator {
14
+ export declare abstract class FeeLineExtendedAmountDecorator extends BaseFeeLineDecorator implements IExtendedAmountMaintainer {
15
15
  protected _newExtendedAmount: Money;
16
16
  protected _newExtendedAmountExcludingTax: Money;
17
17
  protected _newExtendedAmountIncludingTax: Money;
@@ -29,6 +29,7 @@ export declare abstract class FeeLineExtendedAmountDecorator extends BaseFeeLine
29
29
  get taxByAuthority(): IAppliedTax[];
30
30
  get totalLineTax(): Money;
31
31
  get extendedAmountExcludingTransactionDiscounts(): Money;
32
+ updateExtendedAmount(amount: Money): ITransactionLine;
32
33
  updateExtendedAmountExcludingTax(amount: Money): ITransactionLine;
33
34
  updateExtendedAmountIncludingTax(amount: Money): ITransactionLine;
34
35
  setTransactionLineTaxes(transactionLineTaxes: ITransactionLineTaxes, extendedAmount?: Money): FeeLineExtendedAmountDecorator;
@@ -95,6 +95,12 @@ class FeeLineExtendedAmountDecorator extends BaseFeeLineDecorator_1.BaseFeeLineD
95
95
  get extendedAmountExcludingTransactionDiscounts() {
96
96
  return this.extendedAmount;
97
97
  }
98
+ updateExtendedAmount(amount) {
99
+ amount = FeeLine_1.adjustSignForFeeLineType(this.lineType, amount);
100
+ const newLine = this.clone();
101
+ newLine._newExtendedAmount = amount;
102
+ return newLine;
103
+ }
98
104
  updateExtendedAmountExcludingTax(amount) {
99
105
  amount = FeeLine_1.adjustSignForFeeLineType(this.lineType, amount);
100
106
  const newLine = this.clone();
@@ -2,10 +2,11 @@ import { Money } from "@aptos-scp/scp-component-business-core";
2
2
  import { ITransactionLineFactory } from "@aptos-scp/scp-component-store-selling-core";
3
3
  import { FeeLine } from "../fee/FeeLine";
4
4
  import { BaseFeeLineDecorator } from "../fee/BaseFeeLineDecorator";
5
+ import { FeeLineExtendedAmountDecorator, IExtendedAmountFields } from "../fee/FeeLineExtendedAmountDecorator";
5
6
  import { IFulfillmentGroupFee } from "../fee/IFeeLine";
6
7
  export declare const SHIPPING_FEE_CHANGE_ANNOTATION_SOURCE_TYPE: string;
7
8
  export declare const DECORATOR_TYPE_SHIPPING_FEE_LINE_CHANGE: string;
8
- export declare class ShippingFeeLineChangeDecorator extends BaseFeeLineDecorator {
9
+ export declare class ShippingFeeLineChangeDecorator extends FeeLineExtendedAmountDecorator {
9
10
  private _newUnitAmount;
10
11
  private _feesByFulfillmentGroup;
11
12
  private _newTaxGroupId;
@@ -13,7 +14,7 @@ export declare class ShippingFeeLineChangeDecorator extends BaseFeeLineDecorator
13
14
  private _newDescription;
14
15
  private _newLongDescription;
15
16
  static createFromJsonObject(transactionLineJsonObj: any, transactionLineFactory: ITransactionLineFactory): ShippingFeeLineChangeDecorator;
16
- constructor(feeLine?: FeeLine, annotationSourceLineNumber?: number, newUnitAmount?: Money, feesByFulfillmentGroup?: IFulfillmentGroupFee[], newTaxGroupId?: string, newFeeId?: string, newDescription?: string, newLongDescription?: string);
17
+ constructor(feeLine?: FeeLine, annotationSourceLineNumber?: number, newUnitAmount?: Money, feesByFulfillmentGroup?: IFulfillmentGroupFee[], newTaxGroupId?: string, newFeeId?: string, newDescription?: string, newLongDescription?: string, extendedAmountFields?: IExtendedAmountFields);
17
18
  get unitAmount(): Money;
18
19
  get unitAmountBeforeOverride(): Money;
19
20
  get feesByFulfillmentGroup(): IFulfillmentGroupFee[];
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const scp_component_business_core_1 = require("@aptos-scp/scp-component-business-core");
4
4
  const BaseFeeLineDecorator_1 = require("../fee/BaseFeeLineDecorator");
5
+ const FeeLineExtendedAmountDecorator_1 = require("../fee/FeeLineExtendedAmountDecorator");
5
6
  exports.SHIPPING_FEE_CHANGE_ANNOTATION_SOURCE_TYPE = "ShippingFee";
6
7
  exports.DECORATOR_TYPE_SHIPPING_FEE_LINE_CHANGE = "SHIPPING_FEE_LINE_DECORATOR";
7
- class ShippingFeeLineChangeDecorator extends BaseFeeLineDecorator_1.BaseFeeLineDecorator {
8
- constructor(feeLine, annotationSourceLineNumber, newUnitAmount, feesByFulfillmentGroup, newTaxGroupId, newFeeId, newDescription, newLongDescription) {
9
- super(exports.DECORATOR_TYPE_SHIPPING_FEE_LINE_CHANGE, feeLine, undefined, exports.SHIPPING_FEE_CHANGE_ANNOTATION_SOURCE_TYPE, annotationSourceLineNumber);
8
+ class ShippingFeeLineChangeDecorator extends FeeLineExtendedAmountDecorator_1.FeeLineExtendedAmountDecorator {
9
+ constructor(feeLine, annotationSourceLineNumber, newUnitAmount, feesByFulfillmentGroup, newTaxGroupId, newFeeId, newDescription, newLongDescription, extendedAmountFields) {
10
+ super(exports.DECORATOR_TYPE_SHIPPING_FEE_LINE_CHANGE, feeLine, undefined, exports.SHIPPING_FEE_CHANGE_ANNOTATION_SOURCE_TYPE, annotationSourceLineNumber, extendedAmountFields);
10
11
  this._newUnitAmount = newUnitAmount;
11
12
  this._feesByFulfillmentGroup = feesByFulfillmentGroup;
12
13
  this._newTaxGroupId = newTaxGroupId;
@@ -36,11 +37,12 @@ class ShippingFeeLineChangeDecorator extends BaseFeeLineDecorator_1.BaseFeeLineD
36
37
  });
37
38
  const feesByFulfillmentGroup = transactionLineJsonObj._feesByFulfillmentGroup;
38
39
  const annotationSourceLineNumber = BaseFeeLineDecorator_1.BaseFeeLineDecorator.getAnnotationSourceLineNumberFromJsonObject(transactionLineJsonObj);
40
+ const extendedAmountFields = FeeLineExtendedAmountDecorator_1.FeeLineExtendedAmountDecorator.getExtendedAmountFieldsFromJsonObject(transactionLineJsonObj);
39
41
  const newTaxGroupId = transactionLineJsonObj._newTaxGroupId;
40
42
  const newFeeId = transactionLineJsonObj._newFeeId;
41
43
  const newDescription = transactionLineJsonObj._newDescription;
42
44
  const newLongDescription = transactionLineJsonObj._newLongDescription;
43
- const feeLineQuantityChangeDecorator = new ShippingFeeLineChangeDecorator(decoratedFeeLine, annotationSourceLineNumber, newUnitAmount, feesByFulfillmentGroup, newTaxGroupId, newFeeId, newDescription, newLongDescription);
45
+ const feeLineQuantityChangeDecorator = new ShippingFeeLineChangeDecorator(decoratedFeeLine, annotationSourceLineNumber, newUnitAmount, feesByFulfillmentGroup, newTaxGroupId, newFeeId, newDescription, newLongDescription, extendedAmountFields);
44
46
  return feeLineQuantityChangeDecorator;
45
47
  }
46
48
  get unitAmount() {
@@ -74,7 +76,13 @@ class ShippingFeeLineChangeDecorator extends BaseFeeLineDecorator_1.BaseFeeLineD
74
76
  return newShippingFeeLineChangeDecorator;
75
77
  }
76
78
  newTransactionLine() {
77
- return new ShippingFeeLineChangeDecorator(this.decoratedTransactionLine, this.annotationSourceLineNumber, this._newUnitAmount, this._feesByFulfillmentGroup, this._newTaxGroupId, this._newFeeId, this._newDescription, this._newLongDescription);
79
+ return new ShippingFeeLineChangeDecorator(this.decoratedTransactionLine, this.annotationSourceLineNumber, this._newUnitAmount, this._feesByFulfillmentGroup, this._newTaxGroupId, this._newFeeId, this._newDescription, this._newLongDescription, {
80
+ extendedAmount: this.extendedAmount,
81
+ extendedAmountExcludingTax: this.extendedAmountExcludingTax,
82
+ extendedAmountIncludingTax: this.extendedAmountIncludingTax,
83
+ taxByAuthority: this.taxByAuthority,
84
+ totalLineTax: this.totalLineTax,
85
+ });
78
86
  }
79
87
  }
80
88
  exports.ShippingFeeLineChangeDecorator = ShippingFeeLineChangeDecorator;
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.45.0-patch.4",
3
+ "version": "1.45.0-patch.6",
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",