@aptos-scp/scp-component-store-selling-features-domain-model 1.41.2 → 1.42.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.
- package/lib/domain/model/extensibilityForm/IExtensibilityForm.d.ts +9 -0
- package/lib/domain/model/extensibilityForm/IExtensibilityForm.js +10 -0
- package/lib/domain/model/extensibilityForm/index.js +1 -0
- package/lib/domain/model/fee/BaseFeeLineDecorator.d.ts +5 -1
- package/lib/domain/model/fee/BaseFeeLineDecorator.js +20 -3
- package/lib/domain/model/fee/FeeLine.d.ts +8 -1
- package/lib/domain/model/fee/FeeLine.js +35 -4
- package/lib/domain/model/fee/FeeLineBaseDiscountDecorator.d.ts +65 -0
- package/lib/domain/model/fee/FeeLineBaseDiscountDecorator.js +155 -0
- package/lib/domain/model/fee/FeeLinePromotionDecorator.d.ts +41 -0
- package/lib/domain/model/fee/FeeLinePromotionDecorator.js +126 -0
- package/lib/domain/model/fee/IFeeLine.d.ts +2 -0
- package/lib/domain/model/fee/index.d.ts +1 -0
- package/lib/domain/model/fee/index.js +1 -0
- package/package.json +5 -5
|
@@ -6,3 +6,12 @@ export interface IExtensibilityForm {
|
|
|
6
6
|
export interface IExtensibilityFormFields {
|
|
7
7
|
[k: string]: any;
|
|
8
8
|
}
|
|
9
|
+
export declare enum ExtensibilityFormTypeOfDataEnum {
|
|
10
|
+
StringData = "StringData",
|
|
11
|
+
IntegerData = "IntegerData",
|
|
12
|
+
BooleanData = "BooleanData",
|
|
13
|
+
DateData = "DateData",
|
|
14
|
+
TimeData = "TimeData",
|
|
15
|
+
DateTimeData = "DateTimeData",
|
|
16
|
+
Unknown = "Unknown"
|
|
17
|
+
}
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var ExtensibilityFormTypeOfDataEnum;
|
|
4
|
+
(function (ExtensibilityFormTypeOfDataEnum) {
|
|
5
|
+
ExtensibilityFormTypeOfDataEnum["StringData"] = "StringData";
|
|
6
|
+
ExtensibilityFormTypeOfDataEnum["IntegerData"] = "IntegerData";
|
|
7
|
+
ExtensibilityFormTypeOfDataEnum["BooleanData"] = "BooleanData";
|
|
8
|
+
ExtensibilityFormTypeOfDataEnum["DateData"] = "DateData";
|
|
9
|
+
ExtensibilityFormTypeOfDataEnum["TimeData"] = "TimeData";
|
|
10
|
+
ExtensibilityFormTypeOfDataEnum["DateTimeData"] = "DateTimeData";
|
|
11
|
+
ExtensibilityFormTypeOfDataEnum["Unknown"] = "Unknown";
|
|
12
|
+
})(ExtensibilityFormTypeOfDataEnum = exports.ExtensibilityFormTypeOfDataEnum || (exports.ExtensibilityFormTypeOfDataEnum = {}));
|
|
3
13
|
//# sourceMappingURL=IExtensibilityForm.js.map
|
|
@@ -3,6 +3,7 @@ function __export(m) {
|
|
|
3
3
|
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
4
4
|
}
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
__export(require("./IExtensibilityForm"));
|
|
6
7
|
__export(require("./ExtensibilityFormDataLine"));
|
|
7
8
|
__export(require("./VoidedExtensibilityFormDataLineDecorator"));
|
|
8
9
|
__export(require("./BaseExtensibilityFormDataLineDecorator"));
|
|
@@ -7,6 +7,8 @@ import { ITransactionLineTaxes } from "../item";
|
|
|
7
7
|
import { TaxOverrideLine } from "../taxOverride/TaxOverrideLine";
|
|
8
8
|
import { IFeeLine, IFeeSubline, IFulfillmentGroupFee } from "./IFeeLine";
|
|
9
9
|
export declare abstract class BaseFeeLineDecorator extends BaseLineDecorator<IFeeLine> implements IFeeLine {
|
|
10
|
+
private _lineSavings;
|
|
11
|
+
static getLineSavingsFromJsonObject(transactionLineJsonObject: any): Money;
|
|
10
12
|
static getSublinesFromJsonObject(transactionLineJsonObject: any): IFeeSubline[];
|
|
11
13
|
setTransactionLineTaxes(transactionLineTaxes: ITransactionLineTaxes, extendedAmount?: Money): IFeeLine;
|
|
12
14
|
setSublines(sublines: IFeeSubline[]): IFeeLine;
|
|
@@ -20,8 +22,10 @@ export declare abstract class BaseFeeLineDecorator extends BaseLineDecorator<IFe
|
|
|
20
22
|
get feeType(): FeeType;
|
|
21
23
|
get feeId(): string;
|
|
22
24
|
get extendedAmount(): Money;
|
|
25
|
+
get extendedAmountAdjustment(): Money;
|
|
23
26
|
get extendedAmountExcludingTax(): Money;
|
|
24
27
|
get extendedAmountIncludingTax(): Money;
|
|
28
|
+
get lineSavings(): Money;
|
|
25
29
|
get couldAffectPricing(): boolean;
|
|
26
30
|
get unitAmount(): Money;
|
|
27
31
|
get description(): string;
|
|
@@ -49,7 +53,7 @@ export declare abstract class BaseFeeLineDecorator extends BaseLineDecorator<IFe
|
|
|
49
53
|
get sublineIndexFromReturnCanonicalTransaction(): number;
|
|
50
54
|
get originalTransactionLineReference(): ITransactionLineReferenceType;
|
|
51
55
|
get taxIndicatorOnReceipt(): string;
|
|
52
|
-
protected constructor(lineDecoratorType: string, decoratedTransactionLine: IFeeLine, annotationDescription: string, annotationSourceType: string, annotationSourceLineNumber?: number, couldDecoratorAffectPricing?: boolean, couldDecoratorAffectTaxation?: boolean);
|
|
56
|
+
protected constructor(lineDecoratorType: string, decoratedTransactionLine: IFeeLine, annotationDescription: string, annotationSourceType: string, annotationSourceLineNumber?: number, couldDecoratorAffectPricing?: boolean, couldDecoratorAffectTaxation?: boolean, lineSavings?: Money);
|
|
53
57
|
get taxGroupId(): string;
|
|
54
58
|
get taxByAuthority(): IAppliedTax[];
|
|
55
59
|
get taxExemptDisplayName(): string;
|
|
@@ -4,6 +4,15 @@ const scp_component_business_core_1 = require("@aptos-scp/scp-component-business
|
|
|
4
4
|
const scp_types_commerce_transaction_1 = require("@aptos-scp/scp-types-commerce-transaction");
|
|
5
5
|
const BaseLineDecorator_1 = require("../../model/BaseLineDecorator");
|
|
6
6
|
class BaseFeeLineDecorator extends BaseLineDecorator_1.BaseLineDecorator {
|
|
7
|
+
constructor(lineDecoratorType, decoratedTransactionLine, annotationDescription, annotationSourceType, annotationSourceLineNumber, couldDecoratorAffectPricing, couldDecoratorAffectTaxation, lineSavings) {
|
|
8
|
+
super(lineDecoratorType, decoratedTransactionLine, annotationDescription, annotationSourceType, annotationSourceLineNumber, couldDecoratorAffectPricing, couldDecoratorAffectTaxation);
|
|
9
|
+
this._lineSavings = lineSavings;
|
|
10
|
+
}
|
|
11
|
+
static getLineSavingsFromJsonObject(transactionLineJsonObject) {
|
|
12
|
+
if (transactionLineJsonObject._lineSavings) {
|
|
13
|
+
return new scp_component_business_core_1.Money(transactionLineJsonObject._lineSavings);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
7
16
|
static getSublinesFromJsonObject(transactionLineJsonObject) {
|
|
8
17
|
var _a;
|
|
9
18
|
return (_a = transactionLineJsonObject._sublines) === null || _a === void 0 ? void 0 : _a.map((subline) => {
|
|
@@ -54,12 +63,22 @@ class BaseFeeLineDecorator extends BaseLineDecorator_1.BaseLineDecorator {
|
|
|
54
63
|
get extendedAmount() {
|
|
55
64
|
return this.decoratedTransactionLine.extendedAmount;
|
|
56
65
|
}
|
|
66
|
+
get extendedAmountAdjustment() {
|
|
67
|
+
var _a;
|
|
68
|
+
return this.decoratedTransactionLine.extendedAmount
|
|
69
|
+
? (_a = this.extendedAmount) === null || _a === void 0 ? void 0 : _a.minus(this.decoratedTransactionLine.extendedAmount) : this.extendedAmount;
|
|
70
|
+
}
|
|
57
71
|
get extendedAmountExcludingTax() {
|
|
58
72
|
return this.decoratedTransactionLine.extendedAmountExcludingTax;
|
|
59
73
|
}
|
|
60
74
|
get extendedAmountIncludingTax() {
|
|
61
75
|
return this.decoratedTransactionLine.extendedAmountIncludingTax;
|
|
62
76
|
}
|
|
77
|
+
get lineSavings() {
|
|
78
|
+
var _a;
|
|
79
|
+
return this._lineSavings
|
|
80
|
+
? (_a = this.decoratedTransactionLine.lineSavings) === null || _a === void 0 ? void 0 : _a.plus(this._lineSavings) : this.decoratedTransactionLine.lineSavings;
|
|
81
|
+
}
|
|
63
82
|
get couldAffectPricing() {
|
|
64
83
|
return this.decoratedTransactionLine.couldAffectPricing;
|
|
65
84
|
}
|
|
@@ -141,9 +160,6 @@ class BaseFeeLineDecorator extends BaseLineDecorator_1.BaseLineDecorator {
|
|
|
141
160
|
get taxIndicatorOnReceipt() {
|
|
142
161
|
return this.decoratedTransactionLine.taxIndicatorOnReceipt;
|
|
143
162
|
}
|
|
144
|
-
constructor(lineDecoratorType, decoratedTransactionLine, annotationDescription, annotationSourceType, annotationSourceLineNumber, couldDecoratorAffectPricing, couldDecoratorAffectTaxation) {
|
|
145
|
-
super(lineDecoratorType, decoratedTransactionLine, annotationDescription, annotationSourceType, annotationSourceLineNumber, couldDecoratorAffectPricing, couldDecoratorAffectTaxation);
|
|
146
|
-
}
|
|
147
163
|
get taxGroupId() {
|
|
148
164
|
return this.decoratedTransactionLine.taxGroupId;
|
|
149
165
|
}
|
|
@@ -194,6 +210,7 @@ class BaseFeeLineDecorator extends BaseLineDecorator_1.BaseLineDecorator {
|
|
|
194
210
|
}
|
|
195
211
|
clone() {
|
|
196
212
|
const newBaseFeeLineDecorator = super.clone();
|
|
213
|
+
newBaseFeeLineDecorator._lineSavings = this._lineSavings;
|
|
197
214
|
return newBaseFeeLineDecorator;
|
|
198
215
|
}
|
|
199
216
|
}
|
|
@@ -60,6 +60,9 @@ export declare class FeeLine extends BaseTransactionLine implements IFeeLine, IC
|
|
|
60
60
|
private _lineNumberFromReturnTransaction?;
|
|
61
61
|
private _originalTaxOverride?;
|
|
62
62
|
private _taxIndicatorOnReceipt?;
|
|
63
|
+
private _accountingCurrency?;
|
|
64
|
+
private _extendedAmountAdjustment?;
|
|
65
|
+
private _lineSavings?;
|
|
63
66
|
static isPickupFulfilmentTransaction?: boolean;
|
|
64
67
|
/**
|
|
65
68
|
* The create method is called by the transaction line factory to create an instance and initialize it from the
|
|
@@ -75,6 +78,9 @@ export declare class FeeLine extends BaseTransactionLine implements IFeeLine, IC
|
|
|
75
78
|
static create(lineNumber: number, lineType: string, uiBusinessEvent: UiBusinessEvent, collectedData: Readonly<Map<string, any>>): FeeLine;
|
|
76
79
|
static createFromJsonObject(transactionLineJsonObj: any): FeeLine;
|
|
77
80
|
get quantity(): Quantity;
|
|
81
|
+
get accountingCurrency(): string;
|
|
82
|
+
get extendedAmountAdjustment(): Money;
|
|
83
|
+
get lineSavings(): Money;
|
|
78
84
|
get unitPrice(): Price;
|
|
79
85
|
/**
|
|
80
86
|
* @deprecated This will no longer be used in the future. Use the direct line instead.
|
|
@@ -146,6 +152,7 @@ export declare class FeeLine extends BaseTransactionLine implements IFeeLine, IC
|
|
|
146
152
|
get sublines(): IFeeSubline[];
|
|
147
153
|
get prepaidAmount(): Money;
|
|
148
154
|
get prepaidTaxAmount(): Money;
|
|
155
|
+
static lineSavingsFromJsonObject(transactionLineJsonObj: any): Money;
|
|
149
156
|
static feeTypeFromJsonObject(transactionLineJsonObj: any): FeeType;
|
|
150
157
|
static feeTypeFromCollectedData(collectedData: Readonly<Map<string, any>>): FeeType;
|
|
151
158
|
static taxGroupIdFromJsonObject(transactionLineJsonObj: any): string;
|
|
@@ -167,7 +174,7 @@ export declare class FeeLine extends BaseTransactionLine implements IFeeLine, IC
|
|
|
167
174
|
setTransactionLineTaxes(transactionLineTaxes: ITransactionLineTaxes, extendedAmount?: Money): IFeeLine;
|
|
168
175
|
updateExtendedAmountExcludingTax(amount: Money): ITransactionLine;
|
|
169
176
|
updateExtendedAmountIncludingTax(amount: Money): ITransactionLine;
|
|
170
|
-
protected constructor(lineNumber: number, lineType: string, feeType: FeeType, extendedAmount?: Money, extendedAmountExcludingTax?: Money, extendedAmountIncludingTax?: Money, feeId?: string, customFeeType?: string, unitAmount?: Money, quantity?: Quantity, description?: string, externalId?: string, longDescription?: string, departmentId?: string, departmentGroupId?: string, orderReferenceId?: string, feesByFulfillmentGroup?: IFulfillmentGroupFee[], fulfillmentGroupIds?: string[], taxGroupId?: string, autoApplied?: boolean, quantityAllowed?: boolean, itemLineReference?: ISameTransactionLineReference, percent?: string, maximumAmount?: Money, returnRule?: string);
|
|
177
|
+
protected constructor(lineNumber: number, lineType: string, feeType: FeeType, extendedAmount?: Money, extendedAmountExcludingTax?: Money, extendedAmountIncludingTax?: Money, accountingCurrency?: string, feeId?: string, customFeeType?: string, unitAmount?: Money, quantity?: Quantity, description?: string, externalId?: string, longDescription?: string, departmentId?: string, departmentGroupId?: string, orderReferenceId?: string, feesByFulfillmentGroup?: IFulfillmentGroupFee[], fulfillmentGroupIds?: string[], taxGroupId?: string, autoApplied?: boolean, quantityAllowed?: boolean, itemLineReference?: ISameTransactionLineReference, percent?: string, maximumAmount?: Money, returnRule?: string, lineSavings?: Money);
|
|
171
178
|
protected clone(): BaseTransactionLine;
|
|
172
179
|
protected newTransactionLine(): BaseTransactionLine;
|
|
173
180
|
protected loadFromJsonObject(transactionLineJsonObj: any): void;
|
|
@@ -11,8 +11,9 @@ exports.TRANSACTION_FEE_REFUND_LINE_TYPE = "TransactionFeeRefund";
|
|
|
11
11
|
exports.ITEM_FEE_LINE_TYPE = "ItemFee";
|
|
12
12
|
exports.ITEM_FEE_REFUND_LINE_TYPE = "ItemFeeRefund";
|
|
13
13
|
class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
14
|
-
constructor(lineNumber, lineType, feeType, extendedAmount, extendedAmountExcludingTax, extendedAmountIncludingTax, feeId, customFeeType, unitAmount, quantity, description, externalId, longDescription, departmentId, departmentGroupId, orderReferenceId, feesByFulfillmentGroup, fulfillmentGroupIds, taxGroupId, autoApplied, quantityAllowed, itemLineReference, percent, maximumAmount, returnRule) {
|
|
14
|
+
constructor(lineNumber, lineType, feeType, extendedAmount, extendedAmountExcludingTax, extendedAmountIncludingTax, accountingCurrency, feeId, customFeeType, unitAmount, quantity, description, externalId, longDescription, departmentId, departmentGroupId, orderReferenceId, feesByFulfillmentGroup, fulfillmentGroupIds, taxGroupId, autoApplied, quantityAllowed, itemLineReference, percent, maximumAmount, returnRule, lineSavings) {
|
|
15
15
|
super(lineNumber, lineType, extendedAmount, extendedAmountExcludingTax, extendedAmountIncludingTax);
|
|
16
|
+
this._accountingCurrency = accountingCurrency;
|
|
16
17
|
this._feeType = feeType;
|
|
17
18
|
this._feeId = feeId;
|
|
18
19
|
this._customFeeType = customFeeType;
|
|
@@ -37,6 +38,7 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
37
38
|
this._sublines = undefined;
|
|
38
39
|
this._prepaidAmount = undefined;
|
|
39
40
|
this._prepaidTaxAmount = undefined;
|
|
41
|
+
this._lineSavings = lineSavings;
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
42
44
|
* The create method is called by the transaction line factory to create an instance and initialize it from the
|
|
@@ -50,29 +52,49 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
50
52
|
* @return {FeeLine}
|
|
51
53
|
*/
|
|
52
54
|
static create(lineNumber, lineType, uiBusinessEvent, collectedData) {
|
|
55
|
+
var _a;
|
|
53
56
|
this.isPickupFulfilmentTransaction = uiBusinessEvent.type === UIBusinessEventTypes_1.ORDER_ITEM_PICKUP_EVENT;
|
|
54
57
|
const extendedAmount = this.getExtendedAmountFromCollectedData(collectedData);
|
|
55
58
|
const extendedAmountExcludingTax = this.getExtendedAmountExcludingTaxFromCollectedData(collectedData);
|
|
56
59
|
const extendedAmountIncludingTax = this.getExtendedAmountIncludingTaxFromCollectedData(collectedData);
|
|
57
60
|
const feeType = this.feeTypeFromCollectedData(collectedData);
|
|
58
|
-
let
|
|
61
|
+
let accountingCurrency = collectedData.get("accountingCurrency");
|
|
62
|
+
accountingCurrency = ((_a = extendedAmount) === null || _a === void 0 ? void 0 : _a.currency) || accountingCurrency;
|
|
63
|
+
let feeLine = new FeeLine(lineNumber, lineType, feeType, extendedAmount, extendedAmountExcludingTax, extendedAmountIncludingTax, accountingCurrency);
|
|
59
64
|
feeLine.loadFromCollectedData(collectedData);
|
|
60
65
|
return feeLine;
|
|
61
66
|
}
|
|
62
67
|
static createFromJsonObject(transactionLineJsonObj) {
|
|
68
|
+
var _a, _b;
|
|
63
69
|
const lineNumber = BaseTransactionLine_1.BaseTransactionLine.lineNumberFromJsonObject(transactionLineJsonObj);
|
|
64
70
|
const lineType = BaseTransactionLine_1.BaseTransactionLine.lineTypeFromJsonObject(transactionLineJsonObj);
|
|
65
71
|
const feeType = FeeLine.feeTypeFromJsonObject(transactionLineJsonObj);
|
|
66
72
|
const extendedAmount = BaseTransactionLine_1.BaseTransactionLine.extendedAmountFromJsonObject(transactionLineJsonObj);
|
|
67
73
|
const extendedAmountExcludingTax = BaseTransactionLine_1.BaseTransactionLine.extendedAmountExcludingTaxFromJsonObject(transactionLineJsonObj);
|
|
68
74
|
const extendedAmountIncludingTax = BaseTransactionLine_1.BaseTransactionLine.extendedAmountIncludingTaxFromJsonObject(transactionLineJsonObj);
|
|
69
|
-
const
|
|
75
|
+
const accountingCurrency = ((_a = extendedAmount) === null || _a === void 0 ? void 0 : _a.currency) || ((_b = FeeLine.lineSavingsFromJsonObject(transactionLineJsonObj)) === null || _b === void 0 ? void 0 : _b.currency);
|
|
76
|
+
const feeLine = new FeeLine(lineNumber, lineType, feeType, extendedAmount, extendedAmountExcludingTax, extendedAmountIncludingTax, accountingCurrency);
|
|
70
77
|
feeLine.loadFromJsonObject(transactionLineJsonObj);
|
|
71
78
|
return feeLine;
|
|
72
79
|
}
|
|
73
80
|
get quantity() {
|
|
74
81
|
return this._quantity;
|
|
75
82
|
}
|
|
83
|
+
get accountingCurrency() {
|
|
84
|
+
return this._accountingCurrency;
|
|
85
|
+
}
|
|
86
|
+
get extendedAmountAdjustment() {
|
|
87
|
+
if (!this._extendedAmountAdjustment && this._accountingCurrency) {
|
|
88
|
+
this._extendedAmountAdjustment = new scp_component_business_core_1.Money(0, this._accountingCurrency);
|
|
89
|
+
}
|
|
90
|
+
return this._extendedAmountAdjustment;
|
|
91
|
+
}
|
|
92
|
+
get lineSavings() {
|
|
93
|
+
if (!this._lineSavings && this._accountingCurrency) {
|
|
94
|
+
this._lineSavings = new scp_component_business_core_1.Money(0, this._accountingCurrency);
|
|
95
|
+
}
|
|
96
|
+
return this._lineSavings;
|
|
97
|
+
}
|
|
76
98
|
get unitPrice() {
|
|
77
99
|
return this._unitPrice;
|
|
78
100
|
}
|
|
@@ -255,6 +277,11 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
255
277
|
get prepaidTaxAmount() {
|
|
256
278
|
return this._prepaidTaxAmount;
|
|
257
279
|
}
|
|
280
|
+
static lineSavingsFromJsonObject(transactionLineJsonObj) {
|
|
281
|
+
return transactionLineJsonObj._lineSavings
|
|
282
|
+
? scp_component_business_core_1.Money.fromJSON(transactionLineJsonObj._lineSavings)
|
|
283
|
+
: undefined;
|
|
284
|
+
}
|
|
258
285
|
static feeTypeFromJsonObject(transactionLineJsonObj) {
|
|
259
286
|
return transactionLineJsonObj._feeType;
|
|
260
287
|
}
|
|
@@ -435,10 +462,11 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
435
462
|
newTransactionFeeLine._lineNumberFromReturnTransaction = this._lineNumberFromReturnTransaction;
|
|
436
463
|
newTransactionFeeLine._originalTaxOverride = this._originalTaxOverride;
|
|
437
464
|
newTransactionFeeLine._taxIndicatorOnReceipt = this._taxIndicatorOnReceipt;
|
|
465
|
+
newTransactionFeeLine._lineSavings = this._lineSavings;
|
|
438
466
|
return newTransactionFeeLine;
|
|
439
467
|
}
|
|
440
468
|
newTransactionLine() {
|
|
441
|
-
return new FeeLine(this.lineNumber, this.lineType, this._feeType, this.extendedAmount, this.extendedAmountExcludingTax, this.extendedAmountIncludingTax, this._feeId, this._customFeeType, this._unitAmount, this._quantity, this._description, this._externalId, this._longDescription, this._departmentId, this._departmentGroupId, this._orderReferenceId, this._feesByFulfillmentGroup, this._fulfillmentGroupIds, this._taxGroupId, this._autoApplied, this._quantityAllowed, this._itemLineReference, this._percent, this._maximumAmount, this._returnRule);
|
|
469
|
+
return new FeeLine(this.lineNumber, this.lineType, this._feeType, this.extendedAmount, this.extendedAmountExcludingTax, this.extendedAmountIncludingTax, this._accountingCurrency, this._feeId, this._customFeeType, this._unitAmount, this._quantity, this._description, this._externalId, this._longDescription, this._departmentId, this._departmentGroupId, this._orderReferenceId, this._feesByFulfillmentGroup, this._fulfillmentGroupIds, this._taxGroupId, this._autoApplied, this._quantityAllowed, this._itemLineReference, this._percent, this._maximumAmount, this._returnRule, this._lineSavings);
|
|
442
470
|
}
|
|
443
471
|
loadFromJsonObject(transactionLineJsonObj) {
|
|
444
472
|
super.loadFromJsonObject(transactionLineJsonObj);
|
|
@@ -507,6 +535,9 @@ class FeeLine extends BaseTransactionLine_1.BaseTransactionLine {
|
|
|
507
535
|
? new scp_component_business_core_1.Money(transactionLineJsonObj._prepaidTaxAmount)
|
|
508
536
|
: undefined;
|
|
509
537
|
this.loadFeesByFulfillmentGroupFromJsonObject(transactionLineJsonObj);
|
|
538
|
+
if (!this._lineSavings && transactionLineJsonObj._lineSavings) {
|
|
539
|
+
this._lineSavings = scp_component_business_core_1.Money.fromJSON(transactionLineJsonObj._lineSavings);
|
|
540
|
+
}
|
|
510
541
|
}
|
|
511
542
|
loadTaxInformation(transactionLineJsonObj) {
|
|
512
543
|
this._taxGroupId = transactionLineJsonObj._taxGroupId;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Money, Price } from "@aptos-scp/scp-component-business-core";
|
|
2
|
+
import { VerboseDiscountType } from "@aptos-scp/scp-component-pricing";
|
|
3
|
+
import { BaseFeeLineDecorator } from "./BaseFeeLineDecorator";
|
|
4
|
+
import { IFeeLine, IFeeSubline } from "./IFeeLine";
|
|
5
|
+
export declare type DiscountType = VerboseDiscountType;
|
|
6
|
+
export declare class FeeLineBaseDiscountDecorator extends BaseFeeLineDecorator {
|
|
7
|
+
/**
|
|
8
|
+
* Line savings amount just for this decorator, not including cumulative line savings from child decorated lines.
|
|
9
|
+
*/
|
|
10
|
+
adjustmentAmount: Money;
|
|
11
|
+
private _ruleId;
|
|
12
|
+
private _percent;
|
|
13
|
+
private _discountAmount;
|
|
14
|
+
private _sublines;
|
|
15
|
+
private _newExtendedAmount;
|
|
16
|
+
private _discountName;
|
|
17
|
+
private _discountDescription;
|
|
18
|
+
private _discountType;
|
|
19
|
+
private _replacementUnitPrice;
|
|
20
|
+
private _replacementAmount;
|
|
21
|
+
private _isEmployeeDiscount;
|
|
22
|
+
private _extendedAmountBeforeAdjustment;
|
|
23
|
+
private _isFastDiscount;
|
|
24
|
+
private _presentation;
|
|
25
|
+
private _aggregationId;
|
|
26
|
+
constructor(decoratorType: string, replacementUnitPrice: Price, newExtendedAmount: Money, feeLine: IFeeLine, lineSavings: Money, adjustmentAmount: Money, annotationDescription: string, annotationSourceType: string, discountAmount?: Money, percent?: string, discountName?: string, discountDescription?: string, discountType?: VerboseDiscountType, sublines?: IFeeSubline[], replacementAmount?: Money, isEmployeeDiscount?: boolean, ruleId?: string, extendedAmountBeforeAdjustment?: Money, isFastDiscount?: boolean, presentation?: IFeeLine, aggregationId?: string);
|
|
27
|
+
get unitPriceBeforeDiscounts(): Price;
|
|
28
|
+
/**
|
|
29
|
+
* Percent adjustment if a percentage was applied
|
|
30
|
+
* @returns {number}
|
|
31
|
+
*/
|
|
32
|
+
get percentAdjustment(): string;
|
|
33
|
+
/**
|
|
34
|
+
* The amount of the modification, applied to the extended amount, if an amount off discount was applied
|
|
35
|
+
* @returns {Money}
|
|
36
|
+
*/
|
|
37
|
+
get discountAmountAdjustment(): Money;
|
|
38
|
+
setSublines(sublines: IFeeSubline[]): IFeeLine;
|
|
39
|
+
get sublines(): IFeeSubline[];
|
|
40
|
+
get discountName(): string;
|
|
41
|
+
get discountDescription(): string;
|
|
42
|
+
get discountType(): DiscountType;
|
|
43
|
+
get discountAmount(): Money;
|
|
44
|
+
get replacementUnitPrice(): Price;
|
|
45
|
+
get replacementAmount(): Money;
|
|
46
|
+
get newExtendedAmount(): Money;
|
|
47
|
+
get percent(): string;
|
|
48
|
+
get unitPrice(): Price;
|
|
49
|
+
get unitPriceExcludingTransactionDiscounts(): Price;
|
|
50
|
+
get extendedAmount(): Money;
|
|
51
|
+
get extendedAmountExcludingTax(): Money;
|
|
52
|
+
get extendedAmountIncludingTax(): Money;
|
|
53
|
+
get ruleId(): string;
|
|
54
|
+
get isEmployeeDiscount(): boolean;
|
|
55
|
+
get isFastDiscount(): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Extended amount of the line before this pricing adjustment.
|
|
58
|
+
*/
|
|
59
|
+
get extendedAmountBeforeAdjustment(): Money;
|
|
60
|
+
get presentation(): IFeeLine;
|
|
61
|
+
get aggregationId(): string;
|
|
62
|
+
updateDecoratedTransactionLine(transactionLine: IFeeLine): IFeeLine;
|
|
63
|
+
protected clone(): FeeLineBaseDiscountDecorator;
|
|
64
|
+
protected newTransactionLine(): FeeLineBaseDiscountDecorator;
|
|
65
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
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 ErrorCodes_1 = require("../../../config/ErrorCodes");
|
|
5
|
+
const BaseFeeLineDecorator_1 = require("./BaseFeeLineDecorator");
|
|
6
|
+
class FeeLineBaseDiscountDecorator extends BaseFeeLineDecorator_1.BaseFeeLineDecorator {
|
|
7
|
+
constructor(decoratorType, replacementUnitPrice, newExtendedAmount, feeLine, lineSavings, adjustmentAmount, annotationDescription, annotationSourceType, discountAmount, percent, discountName, discountDescription, discountType, sublines, replacementAmount, isEmployeeDiscount, ruleId, extendedAmountBeforeAdjustment, isFastDiscount, presentation, aggregationId) {
|
|
8
|
+
super(decoratorType, feeLine, annotationDescription, annotationSourceType, undefined, undefined, undefined, lineSavings);
|
|
9
|
+
if (!replacementUnitPrice) {
|
|
10
|
+
throw new scp_component_store_selling_core_1.PosError(`The replacement unit price is required on FeeLineBaseDiscountDecorator.`, ErrorCodes_1.SSF_DECORATOR_ERROR_CODE);
|
|
11
|
+
}
|
|
12
|
+
if (!newExtendedAmount) {
|
|
13
|
+
throw new scp_component_store_selling_core_1.PosError(`The new extended amount is required on FeeLineBaseDiscountDecorator.`, ErrorCodes_1.SSF_DECORATOR_ERROR_CODE);
|
|
14
|
+
}
|
|
15
|
+
if (!annotationSourceType) {
|
|
16
|
+
throw new scp_component_store_selling_core_1.PosError(`The annotated source type is required on FeeLineBaseDiscountDecorator.`, ErrorCodes_1.SSF_DECORATOR_ERROR_CODE);
|
|
17
|
+
}
|
|
18
|
+
this.adjustmentAmount = adjustmentAmount;
|
|
19
|
+
this._replacementUnitPrice = replacementUnitPrice;
|
|
20
|
+
if (replacementAmount) {
|
|
21
|
+
this._replacementAmount = replacementAmount;
|
|
22
|
+
}
|
|
23
|
+
this._newExtendedAmount = newExtendedAmount;
|
|
24
|
+
this._discountName = discountName;
|
|
25
|
+
this._discountDescription = discountDescription;
|
|
26
|
+
this._discountType = discountType;
|
|
27
|
+
this._discountAmount = discountAmount;
|
|
28
|
+
this._percent = percent;
|
|
29
|
+
this._sublines = sublines;
|
|
30
|
+
this._isEmployeeDiscount = isEmployeeDiscount;
|
|
31
|
+
this._ruleId = ruleId;
|
|
32
|
+
this._extendedAmountBeforeAdjustment = extendedAmountBeforeAdjustment;
|
|
33
|
+
this._isFastDiscount = isFastDiscount;
|
|
34
|
+
this._presentation = presentation;
|
|
35
|
+
this._aggregationId = aggregationId;
|
|
36
|
+
}
|
|
37
|
+
get unitPriceBeforeDiscounts() {
|
|
38
|
+
if (this.decoratedTransactionLine instanceof FeeLineBaseDiscountDecorator) {
|
|
39
|
+
return this.decoratedTransactionLine.unitPriceBeforeDiscounts;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
return this.decoratedTransactionLine.unitPrice;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Percent adjustment if a percentage was applied
|
|
47
|
+
* @returns {number}
|
|
48
|
+
*/
|
|
49
|
+
get percentAdjustment() {
|
|
50
|
+
return this._percent;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The amount of the modification, applied to the extended amount, if an amount off discount was applied
|
|
54
|
+
* @returns {Money}
|
|
55
|
+
*/
|
|
56
|
+
get discountAmountAdjustment() {
|
|
57
|
+
return this._discountAmount;
|
|
58
|
+
}
|
|
59
|
+
setSublines(sublines) {
|
|
60
|
+
const newLine = this.clone();
|
|
61
|
+
newLine._sublines = sublines;
|
|
62
|
+
return newLine;
|
|
63
|
+
}
|
|
64
|
+
get sublines() {
|
|
65
|
+
return this._sublines;
|
|
66
|
+
}
|
|
67
|
+
get discountName() {
|
|
68
|
+
return this._discountName;
|
|
69
|
+
}
|
|
70
|
+
get discountDescription() {
|
|
71
|
+
return this._discountDescription;
|
|
72
|
+
}
|
|
73
|
+
get discountType() {
|
|
74
|
+
return this._discountType;
|
|
75
|
+
}
|
|
76
|
+
get discountAmount() {
|
|
77
|
+
return this._discountAmount;
|
|
78
|
+
}
|
|
79
|
+
get replacementUnitPrice() {
|
|
80
|
+
return this._replacementUnitPrice;
|
|
81
|
+
}
|
|
82
|
+
get replacementAmount() {
|
|
83
|
+
return this._replacementAmount;
|
|
84
|
+
}
|
|
85
|
+
get newExtendedAmount() {
|
|
86
|
+
return this._newExtendedAmount;
|
|
87
|
+
}
|
|
88
|
+
get percent() {
|
|
89
|
+
return this._percent;
|
|
90
|
+
}
|
|
91
|
+
get unitPrice() {
|
|
92
|
+
return this._replacementUnitPrice;
|
|
93
|
+
}
|
|
94
|
+
get unitPriceExcludingTransactionDiscounts() {
|
|
95
|
+
return this.unitPrice;
|
|
96
|
+
}
|
|
97
|
+
get extendedAmount() {
|
|
98
|
+
return this._newExtendedAmount;
|
|
99
|
+
}
|
|
100
|
+
get extendedAmountExcludingTax() {
|
|
101
|
+
return this.decoratedTransactionLine.extendedAmountExcludingTax;
|
|
102
|
+
}
|
|
103
|
+
get extendedAmountIncludingTax() {
|
|
104
|
+
return this.decoratedTransactionLine.extendedAmountIncludingTax;
|
|
105
|
+
}
|
|
106
|
+
get ruleId() {
|
|
107
|
+
return this._ruleId;
|
|
108
|
+
}
|
|
109
|
+
get isEmployeeDiscount() {
|
|
110
|
+
return this._isEmployeeDiscount;
|
|
111
|
+
}
|
|
112
|
+
get isFastDiscount() {
|
|
113
|
+
return this._isFastDiscount;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Extended amount of the line before this pricing adjustment.
|
|
117
|
+
*/
|
|
118
|
+
get extendedAmountBeforeAdjustment() {
|
|
119
|
+
return this._extendedAmountBeforeAdjustment;
|
|
120
|
+
}
|
|
121
|
+
get presentation() {
|
|
122
|
+
return this._presentation;
|
|
123
|
+
}
|
|
124
|
+
get aggregationId() {
|
|
125
|
+
return this._aggregationId;
|
|
126
|
+
}
|
|
127
|
+
updateDecoratedTransactionLine(transactionLine) {
|
|
128
|
+
const feeLine = super.updateDecoratedTransactionLine(transactionLine);
|
|
129
|
+
return feeLine;
|
|
130
|
+
}
|
|
131
|
+
clone() {
|
|
132
|
+
const newFeeLineBaseDiscountDecorator = super.clone();
|
|
133
|
+
newFeeLineBaseDiscountDecorator._replacementUnitPrice = this._replacementUnitPrice;
|
|
134
|
+
newFeeLineBaseDiscountDecorator._replacementAmount = this._replacementAmount;
|
|
135
|
+
newFeeLineBaseDiscountDecorator._newExtendedAmount = this._newExtendedAmount;
|
|
136
|
+
newFeeLineBaseDiscountDecorator._discountName = this._discountName;
|
|
137
|
+
newFeeLineBaseDiscountDecorator._discountDescription = this._discountDescription;
|
|
138
|
+
newFeeLineBaseDiscountDecorator._discountType = this._discountType;
|
|
139
|
+
newFeeLineBaseDiscountDecorator._discountAmount = this._discountAmount;
|
|
140
|
+
newFeeLineBaseDiscountDecorator._percent = this._percent;
|
|
141
|
+
newFeeLineBaseDiscountDecorator._sublines = this._sublines;
|
|
142
|
+
newFeeLineBaseDiscountDecorator._ruleId = this._ruleId;
|
|
143
|
+
newFeeLineBaseDiscountDecorator._isEmployeeDiscount = this._isEmployeeDiscount;
|
|
144
|
+
newFeeLineBaseDiscountDecorator._extendedAmountBeforeAdjustment = this._extendedAmountBeforeAdjustment;
|
|
145
|
+
newFeeLineBaseDiscountDecorator._isFastDiscount = this._isFastDiscount;
|
|
146
|
+
newFeeLineBaseDiscountDecorator._presentation = this._presentation;
|
|
147
|
+
newFeeLineBaseDiscountDecorator._aggregationId = this._aggregationId;
|
|
148
|
+
return newFeeLineBaseDiscountDecorator;
|
|
149
|
+
}
|
|
150
|
+
newTransactionLine() {
|
|
151
|
+
return new FeeLineBaseDiscountDecorator(this.lineDecoratorType, this._replacementUnitPrice, this._newExtendedAmount, this.decoratedTransactionLine, this.lineSavings, this.adjustmentAmount, this.annotationDescription, this.annotationSourceType, this._discountAmount, this._percent, this._discountName, this._discountDescription, this._discountType, this._sublines, this._replacementAmount, this._isEmployeeDiscount, this._ruleId, this._extendedAmountBeforeAdjustment, this._isFastDiscount, this._presentation, this._aggregationId);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
exports.FeeLineBaseDiscountDecorator = FeeLineBaseDiscountDecorator;
|
|
155
|
+
//# sourceMappingURL=FeeLineBaseDiscountDecorator.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Money, Price } from "@aptos-scp/scp-component-business-core";
|
|
2
|
+
import { ITransactionLine, ITransactionLineFactory } from "@aptos-scp/scp-component-store-selling-core";
|
|
3
|
+
import { SourceIndicator } from "@aptos-scp/scp-types-commerce-transaction";
|
|
4
|
+
import { ICampaignInformation } from "@aptos-scp/scp-component-pricing";
|
|
5
|
+
import { IFeeLine, IFeeSubline } from "./IFeeLine";
|
|
6
|
+
import { DiscountType, FeeLineBaseDiscountDecorator } from "./FeeLineBaseDiscountDecorator";
|
|
7
|
+
export declare const DECORATOR_TYPE_FEE_LINE_PROMO: string;
|
|
8
|
+
export declare function isFeeLinePromotionDecorator(transactionLine: ITransactionLine): transactionLine is FeeLinePromotionDecorator;
|
|
9
|
+
export declare class FeeLinePromotionDecorator extends FeeLineBaseDiscountDecorator {
|
|
10
|
+
private _promoName;
|
|
11
|
+
private _promoDescription;
|
|
12
|
+
private _promotionId;
|
|
13
|
+
private _promotionType;
|
|
14
|
+
private _couponCode;
|
|
15
|
+
private _isAutoCoupon;
|
|
16
|
+
private _singleUseCoupon;
|
|
17
|
+
private _campaign?;
|
|
18
|
+
/**
|
|
19
|
+
* @obsolete
|
|
20
|
+
*/
|
|
21
|
+
private _rewardCouponId;
|
|
22
|
+
private _sourceIndicator;
|
|
23
|
+
static createFromJsonObject(transactionLineJsonObj: any, transactionLineFactory: ITransactionLineFactory): FeeLinePromotionDecorator;
|
|
24
|
+
constructor(ruleId: string, promotionType: string, replacementUnitPrice: Price, newExtendedAmount: Money, feeLine: IFeeLine, lineSavings: Money, adjustmentAmount: Money, annotationDescription: string, annotationSourceType: string, promoName?: string, promoDescription?: string, promotionId?: string, discountAmount?: Money, percent?: string, discountName?: string, discountDescription?: string, discountType?: DiscountType, rewardCouponId?: string, sublines?: IFeeSubline[], replacementAmount?: Money, couponCode?: string, isAutoCoupon?: boolean, sourceIndicator?: SourceIndicator, extendedAmountBeforeAdjustment?: Money, singleUseCoupon?: string, presentation?: IFeeLine, aggregationId?: string, isEmployeeDiscount?: boolean, campaign?: ICampaignInformation);
|
|
25
|
+
get sourceIndicator(): SourceIndicator;
|
|
26
|
+
get promoName(): string;
|
|
27
|
+
get promoDescription(): string;
|
|
28
|
+
get promotionId(): string;
|
|
29
|
+
get promotionType(): string;
|
|
30
|
+
/**
|
|
31
|
+
* @obsolete the ID of the coupon that triggered the promo
|
|
32
|
+
* @returns {string}
|
|
33
|
+
*/
|
|
34
|
+
get rewardCouponId(): string;
|
|
35
|
+
get couponCode(): string;
|
|
36
|
+
get isAutoCoupon(): boolean;
|
|
37
|
+
get campaign(): ICampaignInformation;
|
|
38
|
+
get singleUseCoupon(): string;
|
|
39
|
+
protected clone(): FeeLinePromotionDecorator;
|
|
40
|
+
protected newTransactionLine(): FeeLinePromotionDecorator;
|
|
41
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const scp_component_business_core_1 = require("@aptos-scp/scp-component-business-core");
|
|
4
|
+
const BaseFeeLineDecorator_1 = require("./BaseFeeLineDecorator");
|
|
5
|
+
const FeeLineBaseDiscountDecorator_1 = require("./FeeLineBaseDiscountDecorator");
|
|
6
|
+
exports.DECORATOR_TYPE_FEE_LINE_PROMO = "FEE_LINE_PROMO_DECORATOR";
|
|
7
|
+
function isFeeLinePromotionDecorator(transactionLine) {
|
|
8
|
+
return transactionLine.lineDecoratorType === exports.DECORATOR_TYPE_FEE_LINE_PROMO;
|
|
9
|
+
}
|
|
10
|
+
exports.isFeeLinePromotionDecorator = isFeeLinePromotionDecorator;
|
|
11
|
+
class FeeLinePromotionDecorator extends FeeLineBaseDiscountDecorator_1.FeeLineBaseDiscountDecorator {
|
|
12
|
+
constructor(ruleId, promotionType, replacementUnitPrice, newExtendedAmount, feeLine, lineSavings, adjustmentAmount, annotationDescription, annotationSourceType, promoName, promoDescription, promotionId, discountAmount, percent, discountName, discountDescription, discountType, rewardCouponId, sublines, replacementAmount, couponCode, isAutoCoupon, sourceIndicator, extendedAmountBeforeAdjustment, singleUseCoupon, presentation, aggregationId, isEmployeeDiscount, campaign) {
|
|
13
|
+
super(exports.DECORATOR_TYPE_FEE_LINE_PROMO, replacementUnitPrice, newExtendedAmount, feeLine, lineSavings, adjustmentAmount, annotationDescription, annotationSourceType, discountAmount, percent, discountName, discountDescription, discountType, sublines, replacementAmount, isEmployeeDiscount, ruleId, extendedAmountBeforeAdjustment, undefined, presentation, aggregationId);
|
|
14
|
+
this.adjustmentAmount = adjustmentAmount;
|
|
15
|
+
this._promoName = promoName;
|
|
16
|
+
this._promoDescription = promoDescription;
|
|
17
|
+
this._promotionId = promotionId;
|
|
18
|
+
this._promotionType = promotionType;
|
|
19
|
+
this._rewardCouponId = rewardCouponId;
|
|
20
|
+
this._couponCode = couponCode;
|
|
21
|
+
this._isAutoCoupon = isAutoCoupon;
|
|
22
|
+
this._sourceIndicator = sourceIndicator;
|
|
23
|
+
this._singleUseCoupon = singleUseCoupon;
|
|
24
|
+
this._campaign = campaign;
|
|
25
|
+
}
|
|
26
|
+
static createFromJsonObject(transactionLineJsonObj, transactionLineFactory) {
|
|
27
|
+
const decoratedTransactionLineJsonObj = BaseFeeLineDecorator_1.BaseFeeLineDecorator.getDecoratedTransactionLineJsonObjectFromJsonObject(transactionLineJsonObj);
|
|
28
|
+
const decoratedFeeLine = transactionLineFactory.createTransactionLineFromJsonObj(decoratedTransactionLineJsonObj);
|
|
29
|
+
let adjustmentAmount;
|
|
30
|
+
if (transactionLineJsonObj.adjustmentAmount) {
|
|
31
|
+
adjustmentAmount = scp_component_business_core_1.Money.fromIMoney(transactionLineJsonObj.adjustmentAmount);
|
|
32
|
+
}
|
|
33
|
+
const promoName = transactionLineJsonObj._promoName;
|
|
34
|
+
const promoDescription = transactionLineJsonObj._promoDescription;
|
|
35
|
+
const promotionId = transactionLineJsonObj._promotionId;
|
|
36
|
+
const promotionType = transactionLineJsonObj._promotionType;
|
|
37
|
+
const replacementUnitPrice = scp_component_business_core_1.Price.fromJSON(transactionLineJsonObj._replacementUnitPrice);
|
|
38
|
+
let replacementAmount;
|
|
39
|
+
if (transactionLineJsonObj._replacementAmount) {
|
|
40
|
+
replacementAmount = scp_component_business_core_1.Money.fromJSON(transactionLineJsonObj._replacementAmount);
|
|
41
|
+
}
|
|
42
|
+
const newExtendedAmount = new scp_component_business_core_1.Money(transactionLineJsonObj._newExtendedAmount);
|
|
43
|
+
const ruleId = transactionLineJsonObj._ruleId;
|
|
44
|
+
const discountName = transactionLineJsonObj._discountName;
|
|
45
|
+
const discountDescription = transactionLineJsonObj._discountDescription;
|
|
46
|
+
const discountType = transactionLineJsonObj._discountType;
|
|
47
|
+
let discountAmount;
|
|
48
|
+
if (transactionLineJsonObj._discountAmount) {
|
|
49
|
+
discountAmount = scp_component_business_core_1.Money.fromJSON(transactionLineJsonObj._discountAmount);
|
|
50
|
+
}
|
|
51
|
+
const percent = transactionLineJsonObj._percent;
|
|
52
|
+
const rewardCouponId = transactionLineJsonObj._rewardCouponId;
|
|
53
|
+
const lineSavings = BaseFeeLineDecorator_1.BaseFeeLineDecorator.getLineSavingsFromJsonObject(transactionLineJsonObj);
|
|
54
|
+
const annotationDescription = BaseFeeLineDecorator_1.BaseFeeLineDecorator.getAnnotationDescriptionFromJsonObject(transactionLineJsonObj);
|
|
55
|
+
const annotationSourceType = BaseFeeLineDecorator_1.BaseFeeLineDecorator.getAnnotationSourceTypeFromJsonObject(transactionLineJsonObj);
|
|
56
|
+
const sublines = BaseFeeLineDecorator_1.BaseFeeLineDecorator.getSublinesFromJsonObject(transactionLineJsonObj);
|
|
57
|
+
const couponCode = transactionLineJsonObj._couponCode;
|
|
58
|
+
const isAutoCoupon = transactionLineJsonObj._isAutoCoupon;
|
|
59
|
+
const singleUseCoupon = transactionLineJsonObj._singleUseCoupon;
|
|
60
|
+
const sourceIndicator = transactionLineJsonObj._sourceIndicator;
|
|
61
|
+
const extendedAmountBeforeAdjustment = transactionLineJsonObj._extendedAmountBeforeAdjustment
|
|
62
|
+
? scp_component_business_core_1.Money.fromJSON(transactionLineJsonObj._extendedAmountBeforeAdjustment)
|
|
63
|
+
: undefined;
|
|
64
|
+
const presentation = transactionLineJsonObj._presentation
|
|
65
|
+
? FeeLinePromotionDecorator.createFromJsonObject(transactionLineJsonObj._presentation, transactionLineFactory)
|
|
66
|
+
: undefined;
|
|
67
|
+
const aggregationId = transactionLineJsonObj._aggregationId;
|
|
68
|
+
const isEmployeeDiscount = transactionLineJsonObj._isEmployeeDiscount;
|
|
69
|
+
const campaign = transactionLineJsonObj._campaign;
|
|
70
|
+
const feeLinePromotionDecorator = new FeeLinePromotionDecorator(ruleId, promotionType, replacementUnitPrice, newExtendedAmount, decoratedFeeLine, lineSavings, adjustmentAmount, annotationDescription, annotationSourceType, promoName, promoDescription, promotionId, discountAmount, percent, discountName, discountDescription, discountType, rewardCouponId, sublines, replacementAmount, couponCode, isAutoCoupon, sourceIndicator, extendedAmountBeforeAdjustment, singleUseCoupon, presentation, aggregationId, isEmployeeDiscount, campaign);
|
|
71
|
+
return feeLinePromotionDecorator;
|
|
72
|
+
}
|
|
73
|
+
get sourceIndicator() {
|
|
74
|
+
return this._sourceIndicator;
|
|
75
|
+
}
|
|
76
|
+
get promoName() {
|
|
77
|
+
return this._promoName;
|
|
78
|
+
}
|
|
79
|
+
get promoDescription() {
|
|
80
|
+
return this._promoDescription;
|
|
81
|
+
}
|
|
82
|
+
get promotionId() {
|
|
83
|
+
return this._promotionId; // can be undefined
|
|
84
|
+
}
|
|
85
|
+
get promotionType() {
|
|
86
|
+
return this._promotionType;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @obsolete the ID of the coupon that triggered the promo
|
|
90
|
+
* @returns {string}
|
|
91
|
+
*/
|
|
92
|
+
get rewardCouponId() {
|
|
93
|
+
return this._rewardCouponId;
|
|
94
|
+
}
|
|
95
|
+
get couponCode() {
|
|
96
|
+
return this._couponCode;
|
|
97
|
+
}
|
|
98
|
+
get isAutoCoupon() {
|
|
99
|
+
return this._isAutoCoupon;
|
|
100
|
+
}
|
|
101
|
+
get campaign() {
|
|
102
|
+
return this._campaign;
|
|
103
|
+
}
|
|
104
|
+
get singleUseCoupon() {
|
|
105
|
+
return this._singleUseCoupon;
|
|
106
|
+
}
|
|
107
|
+
clone() {
|
|
108
|
+
const newFeeLinePromotionDecorator = super.clone();
|
|
109
|
+
newFeeLinePromotionDecorator._promoName = this._promoName;
|
|
110
|
+
newFeeLinePromotionDecorator._promoDescription = this._promoDescription;
|
|
111
|
+
newFeeLinePromotionDecorator._promotionId = this._promotionId;
|
|
112
|
+
newFeeLinePromotionDecorator._promotionType = this._promotionType;
|
|
113
|
+
newFeeLinePromotionDecorator._rewardCouponId = this._rewardCouponId;
|
|
114
|
+
newFeeLinePromotionDecorator._couponCode = this._couponCode;
|
|
115
|
+
newFeeLinePromotionDecorator._isAutoCoupon = this._isAutoCoupon;
|
|
116
|
+
newFeeLinePromotionDecorator._singleUseCoupon = this._singleUseCoupon;
|
|
117
|
+
newFeeLinePromotionDecorator._sourceIndicator = this._sourceIndicator;
|
|
118
|
+
newFeeLinePromotionDecorator._campaign = this._campaign;
|
|
119
|
+
return newFeeLinePromotionDecorator;
|
|
120
|
+
}
|
|
121
|
+
newTransactionLine() {
|
|
122
|
+
return new FeeLinePromotionDecorator(this.ruleId, this._promotionType, this.replacementUnitPrice, this.newExtendedAmount, this.decoratedTransactionLine, this.lineSavings, this.adjustmentAmount, this.annotationDescription, this.annotationSourceType, this._promoName, this._promoDescription, this._promotionId, this.discountAmount, this.percent, this.discountName, this.discountDescription, this.discountType, this._rewardCouponId, this.sublines, this.replacementAmount, this.couponCode, this.isAutoCoupon, this.sourceIndicator, this.extendedAmountBeforeAdjustment, this.singleUseCoupon, this.presentation, this.aggregationId, this.isEmployeeDiscount, this.campaign);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.FeeLinePromotionDecorator = FeeLinePromotionDecorator;
|
|
126
|
+
//# sourceMappingURL=FeeLinePromotionDecorator.js.map
|
|
@@ -68,6 +68,8 @@ export interface IFeeLine extends ITransactionLine, IVoidableLine {
|
|
|
68
68
|
readonly lineNumberFromReturnTransaction?: number;
|
|
69
69
|
readonly unitAmountBeforeOverride?: Money;
|
|
70
70
|
readonly taxIndicatorOnReceipt?: string;
|
|
71
|
+
readonly lineSavings?: Money;
|
|
72
|
+
readonly extendedAmountAdjustment?: Money;
|
|
71
73
|
setTransactionLineTaxes(transactionLineTaxes: ITransactionLineTaxes, extendedAmount?: Money): IFeeLine;
|
|
72
74
|
setSublines(sublines: IFeeSubline[]): IFeeLine;
|
|
73
75
|
setTaxExemptInformation(taxExemptLine: ItemTaxExemptLine | TransactionTaxExemptLine, preTaxExemptDetails: IAppliedTax[]): IFeeLine;
|
|
@@ -14,4 +14,5 @@ __export(require("./FeeLineTaxExemptDecorator"));
|
|
|
14
14
|
__export(require("./FeeLineTaxOverrideDecorator"));
|
|
15
15
|
__export(require("./FeeLinePricingExtendedAmountDecorator"));
|
|
16
16
|
__export(require("./FeeLineOriginalPricingAdjustmentDecorator"));
|
|
17
|
+
__export(require("./FeeLinePromotionDecorator"));
|
|
17
18
|
//# sourceMappingURL=index.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.
|
|
3
|
+
"version": "1.42.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",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@aptos-scp/scp-component-business-core": "^1.12.7",
|
|
56
56
|
"@aptos-scp/scp-component-logging": "^2.1.16",
|
|
57
|
-
"@aptos-scp/scp-component-pricing": "^7.
|
|
57
|
+
"@aptos-scp/scp-component-pricing": "^7.62.0",
|
|
58
58
|
"@aptos-scp/scp-component-store-items": "^1.19.0",
|
|
59
59
|
"@aptos-scp/scp-component-store-selling-core": "^18.9.3",
|
|
60
60
|
"@aptos-scp/scp-component-taxation": "^5.27.3",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@aptos-scp/scp-types-client-registration": "^1.4.0",
|
|
63
63
|
"@aptos-scp/scp-types-core-config": "^2.2.1",
|
|
64
64
|
"@aptos-scp/scp-types-commerce-devices": "^3.9.0",
|
|
65
|
-
"@aptos-scp/scp-types-commerce-transaction": "^1.
|
|
65
|
+
"@aptos-scp/scp-types-commerce-transaction": "^1.70.0",
|
|
66
66
|
"@aptos-scp/scp-types-customer": "^3.7.0",
|
|
67
67
|
"@aptos-scp/scp-types-einvoice": "^1.17.0",
|
|
68
68
|
"@aptos-scp/scp-types-inventory": "^2.0.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@aptos-scp/scp-component-business-core": "^1.12.7",
|
|
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.
|
|
79
|
+
"@aptos-scp/scp-component-pricing": "^7.62.0",
|
|
80
80
|
"@aptos-scp/scp-component-rn-circuit-breaker": "^1.0.15",
|
|
81
81
|
"@aptos-scp/scp-component-store-items": "^1.19.0",
|
|
82
82
|
"@aptos-scp/scp-component-store-selling-core": "^18.9.3",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"@aptos-scp/scp-component-user": "^1.4.0",
|
|
85
85
|
"@aptos-scp/scp-types-client-registration": "^1.4.0",
|
|
86
86
|
"@aptos-scp/scp-types-commerce-devices": "^3.9.0",
|
|
87
|
-
"@aptos-scp/scp-types-commerce-transaction": "^1.
|
|
87
|
+
"@aptos-scp/scp-types-commerce-transaction": "^1.70.0",
|
|
88
88
|
"@aptos-scp/scp-types-core": "^1.0.5",
|
|
89
89
|
"@aptos-scp/scp-types-core-config": "^2.2.1",
|
|
90
90
|
"@aptos-scp/scp-types-currency-conversion": "^1.2.0",
|