@aptos-scp/scp-component-store-selling-features-domain-model 1.10.2 → 1.10.3

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.
@@ -496,8 +496,12 @@ export declare enum CollectedDataKey {
496
496
  FeeDepartmentGroup = "feeDepartmentGroup",
497
497
  FeeDescription = "feeDescription",
498
498
  FeeExternalId = "feeExternalId",
499
+ FeeExtendedAmount = "feeExtendedAmount",
500
+ FeeExtendedAmountExcludingTax = "FeeExtendedAmountExcludingTax",
501
+ FeeExtendedAmountIncludingTax = "FeeExtendedAmountIncludingTax",
499
502
  FeeId = "feeId",
500
503
  FeeLongDescription = "feeLongDescription",
504
+ FeeSublines = "FeeSublines",
501
505
  FeeQuantity = "feeQuantity",
502
506
  PrevFeeQuantity = "prevFeeQuantity",
503
507
  FeeLineReference = "feeLineReference",
@@ -680,6 +684,7 @@ export declare enum CollectedDataKey {
680
684
  TaxExemptType = "taxExemptType",
681
685
  TaxGroupId = "taxGroupId",
682
686
  TaxOverrideType = "taxOverrideType",
687
+ TaxByAuthority = "taxByAuthority",
683
688
  TenderAdjustmentType = "TenderAdjustmentType",
684
689
  TenderAmount = "TenderAmount",
685
690
  TenderAmountOriginal = "TenderAmountOriginal",
@@ -896,7 +901,8 @@ export declare enum CollectedDataKey {
896
901
  MembershipTypeName = "membershipTypeName",
897
902
  MembershipTypeDescription = "membershipTypeDescription",
898
903
  IsPermanentMembershipDiscount = "isPermanentMembershipDiscount",
899
- TerminalForceClosed = "TerminalForceClosed"
904
+ TerminalForceClosed = "TerminalForceClosed",
905
+ TotalLineTax = "totalLineTax"
900
906
  }
901
907
  export declare enum ItemLookupType {
902
908
  ProductInquiryDetail = "ProductInquiryDetail",
@@ -505,8 +505,12 @@ var CollectedDataKey;
505
505
  CollectedDataKey["FeeDepartmentGroup"] = "feeDepartmentGroup";
506
506
  CollectedDataKey["FeeDescription"] = "feeDescription";
507
507
  CollectedDataKey["FeeExternalId"] = "feeExternalId";
508
+ CollectedDataKey["FeeExtendedAmount"] = "feeExtendedAmount";
509
+ CollectedDataKey["FeeExtendedAmountExcludingTax"] = "FeeExtendedAmountExcludingTax";
510
+ CollectedDataKey["FeeExtendedAmountIncludingTax"] = "FeeExtendedAmountIncludingTax";
508
511
  CollectedDataKey["FeeId"] = "feeId";
509
512
  CollectedDataKey["FeeLongDescription"] = "feeLongDescription";
513
+ CollectedDataKey["FeeSublines"] = "FeeSublines";
510
514
  CollectedDataKey["FeeQuantity"] = "feeQuantity";
511
515
  CollectedDataKey["PrevFeeQuantity"] = "prevFeeQuantity";
512
516
  CollectedDataKey["FeeLineReference"] = "feeLineReference";
@@ -689,6 +693,7 @@ var CollectedDataKey;
689
693
  CollectedDataKey["TaxExemptType"] = "taxExemptType";
690
694
  CollectedDataKey["TaxGroupId"] = "taxGroupId";
691
695
  CollectedDataKey["TaxOverrideType"] = "taxOverrideType";
696
+ CollectedDataKey["TaxByAuthority"] = "taxByAuthority";
692
697
  CollectedDataKey["TenderAdjustmentType"] = "TenderAdjustmentType";
693
698
  CollectedDataKey["TenderAmount"] = "TenderAmount";
694
699
  CollectedDataKey["TenderAmountOriginal"] = "TenderAmountOriginal";
@@ -906,6 +911,7 @@ var CollectedDataKey;
906
911
  CollectedDataKey["MembershipTypeDescription"] = "membershipTypeDescription";
907
912
  CollectedDataKey["IsPermanentMembershipDiscount"] = "isPermanentMembershipDiscount";
908
913
  CollectedDataKey["TerminalForceClosed"] = "TerminalForceClosed";
914
+ CollectedDataKey["TotalLineTax"] = "totalLineTax";
909
915
  })(CollectedDataKey = exports.CollectedDataKey || (exports.CollectedDataKey = {}));
910
916
  var ItemLookupType;
911
917
  (function (ItemLookupType) {
@@ -57,6 +57,7 @@ export declare class FeeLine extends BaseTransactionLine implements IFeeLine, IC
57
57
  private _sublineIndexFromReturnCanonicalTransaction?;
58
58
  private _lineNumberFromReturnTransaction?;
59
59
  private _originalTaxOverride?;
60
+ static isPickupFulfilmentTransaction?: boolean;
60
61
  /**
61
62
  * The create method is called by the transaction line factory to create an instance and initialize it from the
62
63
  * data collected during the qualification process.
@@ -142,6 +143,9 @@ export declare class FeeLine extends BaseTransactionLine implements IFeeLine, IC
142
143
  static feeTypeFromJsonObject(transactionLineJsonObj: any): FeeType;
143
144
  static feeTypeFromCollectedData(collectedData: Readonly<Map<string, any>>): FeeType;
144
145
  static taxGroupIdFromJsonObject(transactionLineJsonObj: any): string;
146
+ static getExtendedAmountFromCollectedData(collectedData: Readonly<Map<string, any>>): Money;
147
+ static getExtendedAmountExcludingTaxFromCollectedData(collectedData: Readonly<Map<string, any>>): Money;
148
+ static getExtendedAmountIncludingTaxFromCollectedData(collectedData: Readonly<Map<string, any>>): Money;
145
149
  copyLineWithNewLineNumber(newLineNumber: number): FeeLine;
146
150
  /**
147
151
  * This method should be implemented only in decorator and not in the Fee line.
@@ -5,6 +5,7 @@ const scp_types_commerce_transaction_1 = require("@aptos-scp/scp-types-commerce-
5
5
  const BaseTransactionLine_1 = require("../BaseTransactionLine");
6
6
  const Constants_1 = require("../Constants");
7
7
  const ItemLine_1 = require("../item/ItemLine");
8
+ const UIBusinessEventTypes_1 = require("../../UIBusinessEventTypes");
8
9
  exports.TRANSACTION_FEE_LINE_TYPE = "TransactionFee";
9
10
  exports.TRANSACTION_FEE_REFUND_LINE_TYPE = "TransactionFeeRefund";
10
11
  exports.ITEM_FEE_LINE_TYPE = "ItemFee";
@@ -47,8 +48,12 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
47
48
  * @return {FeeLine}
48
49
  */
49
50
  static create(lineNumber, lineType, uiBusinessEvent, collectedData) {
51
+ this.isPickupFulfilmentTransaction = uiBusinessEvent.type === UIBusinessEventTypes_1.ORDER_ITEM_PICKUP_EVENT;
52
+ const extendedAmount = this.getExtendedAmountFromCollectedData(collectedData);
53
+ const extendedAmountExcludingTax = this.getExtendedAmountExcludingTaxFromCollectedData(collectedData);
54
+ const extendedAmountIncludingTax = this.getExtendedAmountIncludingTaxFromCollectedData(collectedData);
50
55
  const feeType = this.feeTypeFromCollectedData(collectedData);
51
- let feeLine = new FeeLine(lineNumber, lineType, feeType);
56
+ let feeLine = new FeeLine(lineNumber, lineType, feeType, extendedAmount, extendedAmountExcludingTax, extendedAmountIncludingTax);
52
57
  feeLine.loadFromCollectedData(collectedData);
53
58
  return feeLine;
54
59
  }
@@ -88,10 +93,16 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
88
93
  return this._feeId;
89
94
  }
90
95
  get couldAffectPricing() {
96
+ if (FeeLine.isPickupFulfilmentTransaction) {
97
+ return false;
98
+ }
91
99
  return true;
92
100
  }
93
101
  get couldAffectTaxation() {
94
- if (this._sublineFromOriginalItemFee !== undefined) {
102
+ if (FeeLine.isPickupFulfilmentTransaction) {
103
+ return false;
104
+ }
105
+ else if (this._sublineFromOriginalItemFee !== undefined) {
95
106
  return true;
96
107
  }
97
108
  return this.couldAffectPricing;
@@ -248,6 +259,26 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
248
259
  static taxGroupIdFromJsonObject(transactionLineJsonObj) {
249
260
  return transactionLineJsonObj._taxGroupId;
250
261
  }
262
+ static getExtendedAmountFromCollectedData(collectedData) {
263
+ if (collectedData.has(Constants_1.CollectedDataKey.FeeExtendedAmount) && FeeLine.isPickupFulfilmentTransaction) {
264
+ return collectedData.get(Constants_1.CollectedDataKey.FeeExtendedAmount);
265
+ }
266
+ undefined;
267
+ }
268
+ static getExtendedAmountExcludingTaxFromCollectedData(collectedData) {
269
+ if (collectedData.has(Constants_1.CollectedDataKey.FeeExtendedAmountExcludingTax) &&
270
+ FeeLine.isPickupFulfilmentTransaction) {
271
+ return collectedData.get(Constants_1.CollectedDataKey.FeeExtendedAmountExcludingTax);
272
+ }
273
+ undefined;
274
+ }
275
+ static getExtendedAmountIncludingTaxFromCollectedData(collectedData) {
276
+ if (collectedData.has(Constants_1.CollectedDataKey.FeeExtendedAmountIncludingTax) &&
277
+ FeeLine.isPickupFulfilmentTransaction) {
278
+ return collectedData.get(Constants_1.CollectedDataKey.FeeExtendedAmountIncludingTax);
279
+ }
280
+ undefined;
281
+ }
251
282
  copyLineWithNewLineNumber(newLineNumber) {
252
283
  const clonedItem = this.clone();
253
284
  return clonedItem.updateLineNumber(newLineNumber);
@@ -257,6 +288,11 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
257
288
  * @param sublines fee's sublines
258
289
  */
259
290
  setSublines(sublines) {
291
+ if (FeeLine.isPickupFulfilmentTransaction) {
292
+ const newLine = this.clone();
293
+ newLine._sublines = sublines;
294
+ return newLine;
295
+ }
260
296
  throw new Error("Method not implemented.");
261
297
  }
262
298
  setItemLineReference(itemLineReference) {
@@ -554,6 +590,17 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
554
590
  if (collectedData.has(Constants_1.CollectedDataKey.LineNumberFromReturnTransaction)) {
555
591
  this._lineNumberFromReturnTransaction = collectedData.get(Constants_1.CollectedDataKey.LineNumberFromReturnTransaction);
556
592
  }
593
+ if (FeeLine.isPickupFulfilmentTransaction) {
594
+ if (!this._totalLineTax && collectedData.has(Constants_1.CollectedDataKey.TotalLineTax)) {
595
+ this._totalLineTax = collectedData.get(Constants_1.CollectedDataKey.TotalLineTax);
596
+ }
597
+ if (!this._quantity && collectedData.has(Constants_1.CollectedDataKey.FeeQuantity)) {
598
+ this._quantity = collectedData.get(Constants_1.CollectedDataKey.FeeQuantity);
599
+ }
600
+ if (!this.taxByAuthority && collectedData.has(Constants_1.CollectedDataKey.TaxByAuthority)) {
601
+ this._taxByAuthority = collectedData.get(Constants_1.CollectedDataKey.TaxByAuthority);
602
+ }
603
+ }
557
604
  if (collectedData.has(Constants_1.CollectedDataKey.OriginalTaxOverride)) {
558
605
  const originalTaxOverride = collectedData.get(Constants_1.CollectedDataKey.OriginalTaxOverride);
559
606
  if (originalTaxOverride) {
@@ -565,8 +612,11 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
565
612
  if (collectedData.has(Constants_1.CollectedDataKey.SublineIndexFromReturnItem)) {
566
613
  this._sublineIndexFromReturnCanonicalTransaction = collectedData.get(Constants_1.CollectedDataKey.SublineIndexFromReturnItem);
567
614
  }
568
- // initial value for sublines, will be replaced when taxes are calculated
569
- if (this._itemLineReference && this._quantity) {
615
+ if (collectedData.has(Constants_1.CollectedDataKey.FeeSublines) && FeeLine.isPickupFulfilmentTransaction) {
616
+ this._sublines = collectedData.get(Constants_1.CollectedDataKey.FeeSublines);
617
+ }
618
+ else if (this._itemLineReference && this._quantity) {
619
+ // initial value for sublines, will be replaced when taxes are calculated
570
620
  this._sublines = [
571
621
  {
572
622
  quantity: this._quantity.amount,
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.10.2",
3
+ "version": "1.10.3",
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",