@aptos-scp/scp-component-store-selling-features-domain-model 1.45.0-patch.7 → 1.45.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/Constants.d.ts +0 -1
- package/lib/domain/model/Constants.js +0 -1
- package/lib/domain/model/FulfillmentGroup.js +1 -2
- package/lib/domain/model/TenderType.d.ts +0 -7
- package/lib/domain/model/TenderType.js +43 -97
- package/lib/domain/model/discounts/lineTypes.js +6 -10
- package/lib/domain/model/fee/FeeLineExtendedAmountDecorator.d.ts +2 -3
- package/lib/domain/model/fee/FeeLineExtendedAmountDecorator.js +0 -6
- package/lib/domain/model/shipping/ShippingFeeLineChangeDecorator.d.ts +2 -3
- package/lib/domain/model/shipping/ShippingFeeLineChangeDecorator.js +5 -13
- package/package.json +1 -1
|
@@ -1041,5 +1041,4 @@ 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";
|
|
1045
1044
|
//# sourceMappingURL=Constants.js.map
|
|
@@ -93,7 +93,7 @@ class FulfillmentGroup {
|
|
|
93
93
|
return this;
|
|
94
94
|
}
|
|
95
95
|
static getDeliveryAddress(contact) {
|
|
96
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w
|
|
96
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
97
97
|
const primaryAddress = (_a = contact.addresses) === null || _a === void 0 ? void 0 : _a.find((address) => address.primaryIndicator);
|
|
98
98
|
return {
|
|
99
99
|
addressLine1: ((_b = contact) === null || _b === void 0 ? void 0 : _b.address1) || ((_c = primaryAddress) === null || _c === void 0 ? void 0 : _c.address1),
|
|
@@ -106,7 +106,6 @@ class FulfillmentGroup {
|
|
|
106
106
|
countryCode: ((_r = contact) === null || _r === void 0 ? void 0 : _r.countryCode) || ((_s = primaryAddress) === null || _s === void 0 ? void 0 : _s.countryCode),
|
|
107
107
|
firstAdminDivision: ((_t = contact) === null || _t === void 0 ? void 0 : _t.firstAdminDivision) || ((_u = primaryAddress) === null || _u === void 0 ? void 0 : _u.firstAdminDivision),
|
|
108
108
|
firstAdminDivisionCode: ((_v = contact) === null || _v === void 0 ? void 0 : _v.firstAdminDivisionCode) || ((_w = primaryAddress) === null || _w === void 0 ? void 0 : _w.firstAdminDivisionCode),
|
|
109
|
-
firstAdminDivisionType: ((_x = contact) === null || _x === void 0 ? void 0 : _x.firstAdminDivisionType) || ((_y = primaryAddress) === null || _y === void 0 ? void 0 : _y.firstAdminDivisionType),
|
|
110
109
|
};
|
|
111
110
|
}
|
|
112
111
|
static getDeliveryContact(contact) {
|
|
@@ -98,13 +98,6 @@ export declare class TenderType {
|
|
|
98
98
|
static getActiveRefundConfiguredTenderGroups(container: Container, accountingCurrency: string, withTransaction: boolean, activeTenders: TenderType[], originalTransactionsDetails: IOriginalTransactionDetails[], withOfflineTransaction: boolean): ITenderGroup[];
|
|
99
99
|
static tenderIsCreditOrDebit(tenderType: any): boolean;
|
|
100
100
|
static getRefundableAmountByGroup(group: ITenderGroup, displayInfo: any, currency: string, configuration: IConfigurationManager, refundDue?: Money): Money;
|
|
101
|
-
static getFeesTotal(displayInfo: any, accountingCurrency: string): Money;
|
|
102
|
-
static getTenderedAmountsWithoutTransaction(tenderDisplayLines: any[], accountingCurrency: string, configurationManager: IConfigurationManager): Money;
|
|
103
|
-
static getTenderedAmountsWithTransaction(tenderDisplayLines: any[], accountingCurrency: string, configurationManager: IConfigurationManager): Money;
|
|
104
|
-
static getTenderedAmountsWithOfflineTransaction(tenderDisplayLines: any[], accountingCurrency: string, configurationManager: IConfigurationManager): Money;
|
|
105
|
-
static getItemAmountsWithoutTransaction(itemDisplayLines: any[], accountingCurrency: string): Money;
|
|
106
|
-
static getItemAmountsWithTransaction(itemDisplayLines: any[], accountingCurrency: string): Money;
|
|
107
|
-
static getItemAmountsWithOfflineTransaction(itemDisplayLines: any[], accountingCurrency: string): Money;
|
|
108
101
|
static getWithoutTransactionTotal(displayInfo: any, accountingCurrency: string, configurationManager: IConfigurationManager): Money;
|
|
109
102
|
static getWithTransactionTotal(displayInfo: any, accountingCurrency: string, configurationManager: IConfigurationManager): Money;
|
|
110
103
|
static getWithOfflineTransactionTotal(displayInfo: any, accountingCurrency: string, configurationManager: IConfigurationManager): Money;
|
|
@@ -137,129 +137,75 @@ class TenderType {
|
|
|
137
137
|
}
|
|
138
138
|
return getLowestRefundDue(refundDue, undefined, refundableAmount);
|
|
139
139
|
}
|
|
140
|
-
static
|
|
140
|
+
static getWithoutTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
|
|
141
141
|
var _a, _b, _c, _d;
|
|
142
|
-
let
|
|
143
|
-
(_b = (_a = displayInfo) === null || _a === void 0 ? void 0 : _a.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
142
|
+
let withoutTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
143
|
+
(_b = (_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines) === null || _b === void 0 ? void 0 : _b.forEach((itemDisplayLine) => {
|
|
144
|
+
if ((itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemOrder && itemDisplayLine.cancelled) ||
|
|
145
|
+
(itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
|
|
146
|
+
_.isUndefined(itemDisplayLine.lineNumberFromReturnTransaction) &&
|
|
147
|
+
_.isUndefined(itemDisplayLine.sublineIndexFromReturnItem) &&
|
|
148
|
+
_.isUndefined(itemDisplayLine.offlineReturnReferenceNumber))) {
|
|
149
|
+
withoutTransactionTotal = withoutTransactionTotal.plus(itemDisplayLine.extendedAmount.abs());
|
|
150
|
+
withoutTransactionTotal = !_.isEmpty(itemDisplayLine.totalLineTax)
|
|
151
|
+
? withoutTransactionTotal.plus(itemDisplayLine.totalLineTax.abs())
|
|
152
|
+
: withoutTransactionTotal;
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
static getTenderedAmountsWithoutTransaction(tenderDisplayLines, accountingCurrency, configurationManager) {
|
|
158
|
-
var _a;
|
|
159
|
-
let withoutTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
160
|
-
(_a = tenderDisplayLines) === null || _a === void 0 ? void 0 : _a.forEach((tenderDisplayLine) => {
|
|
155
|
+
(_d = (_c = displayInfo) === null || _c === void 0 ? void 0 : _c.tenderDisplayLines) === null || _d === void 0 ? void 0 : _d.forEach((tenderDisplayLine) => {
|
|
161
156
|
var _a, _b;
|
|
162
157
|
const tender = getConfiguredTender(tenderDisplayLine.tenderId, configurationManager);
|
|
163
158
|
if (_.isEmpty(tenderDisplayLine.originalTenderReferences) &&
|
|
164
159
|
((_b = (_a = tender) === null || _a === void 0 ? void 0 : _a.allowRefund) === null || _b === void 0 ? void 0 : _b.indexOf(ITendersConfig_1.AllowRefund.WithoutTransaction)) >= 0) {
|
|
165
|
-
withoutTransactionTotal = withoutTransactionTotal.
|
|
160
|
+
withoutTransactionTotal = withoutTransactionTotal.minus(tenderDisplayLine.tenderAmount.abs());
|
|
166
161
|
}
|
|
167
162
|
});
|
|
168
163
|
return withoutTransactionTotal;
|
|
169
164
|
}
|
|
170
|
-
static
|
|
171
|
-
var _a;
|
|
165
|
+
static getWithTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
|
|
166
|
+
var _a, _b, _c, _d;
|
|
172
167
|
let withTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
173
|
-
(_a =
|
|
168
|
+
(_b = (_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines) === null || _b === void 0 ? void 0 : _b.forEach((itemDisplayLine) => {
|
|
169
|
+
if (itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemCancel ||
|
|
170
|
+
(itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
|
|
171
|
+
!_.isUndefined(itemDisplayLine.lineNumberFromReturnTransaction) &&
|
|
172
|
+
!_.isUndefined(itemDisplayLine.sublineIndexFromReturnItem))) {
|
|
173
|
+
withTransactionTotal = withTransactionTotal.plus(itemDisplayLine.extendedAmount.abs());
|
|
174
|
+
withTransactionTotal = !_.isEmpty(itemDisplayLine.totalLineTax)
|
|
175
|
+
? withTransactionTotal.plus(itemDisplayLine.totalLineTax.abs())
|
|
176
|
+
: withTransactionTotal;
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
(_d = (_c = displayInfo) === null || _c === void 0 ? void 0 : _c.tenderDisplayLines) === null || _d === void 0 ? void 0 : _d.forEach((tenderDisplayLine) => {
|
|
174
180
|
var _a, _b;
|
|
175
181
|
const tender = getConfiguredTender(tenderDisplayLine.tenderId, configurationManager);
|
|
176
182
|
if (((_b = (_a = tender) === null || _a === void 0 ? void 0 : _a.allowRefund) === null || _b === void 0 ? void 0 : _b.indexOf(ITendersConfig_1.AllowRefund.WithTransaction)) >= 0 ||
|
|
177
183
|
!_.isEmpty(tenderDisplayLine.originalTenderReferences)) {
|
|
178
|
-
withTransactionTotal = withTransactionTotal.
|
|
184
|
+
withTransactionTotal = withTransactionTotal.minus(tenderDisplayLine.tenderAmount.abs());
|
|
179
185
|
}
|
|
180
186
|
});
|
|
181
187
|
return withTransactionTotal;
|
|
182
188
|
}
|
|
183
|
-
static
|
|
184
|
-
var _a;
|
|
189
|
+
static getWithOfflineTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
|
|
190
|
+
var _a, _b, _c, _d;
|
|
185
191
|
let withOfflineTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
186
|
-
(_a =
|
|
192
|
+
(_b = (_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines) === null || _b === void 0 ? void 0 : _b.forEach((itemDisplayLine) => {
|
|
187
193
|
var _a, _b;
|
|
188
|
-
const tender = getConfiguredTender(tenderDisplayLine.tenderId, configurationManager);
|
|
189
|
-
if (((_b = (_a = tender) === null || _a === void 0 ? void 0 : _a.allowRefund) === null || _b === void 0 ? void 0 : _b.indexOf(ITendersConfig_1.AllowRefund.WithOfflineTransaction)) >= 0) {
|
|
190
|
-
withOfflineTransactionTotal = withOfflineTransactionTotal.plus(tenderDisplayLine.tenderAmount.abs());
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
return withOfflineTransactionTotal;
|
|
194
|
-
}
|
|
195
|
-
static getItemAmountsWithoutTransaction(itemDisplayLines, accountingCurrency) {
|
|
196
|
-
var _a;
|
|
197
|
-
let withoutTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
198
|
-
(_a = itemDisplayLines) === null || _a === void 0 ? void 0 : _a.forEach((itemDisplayLine) => {
|
|
199
|
-
if ((itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemOrder && itemDisplayLine.cancelled) ||
|
|
200
|
-
(itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
|
|
201
|
-
_.isUndefined(itemDisplayLine.lineNumberFromReturnTransaction) &&
|
|
202
|
-
_.isUndefined(itemDisplayLine.sublineIndexFromReturnItem) &&
|
|
203
|
-
_.isUndefined(itemDisplayLine.offlineReturnReferenceNumber))) {
|
|
204
|
-
withoutTransactionTotal = withoutTransactionTotal.plus(itemDisplayLine.extendedAmountIncludingTax.abs());
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
return withoutTransactionTotal;
|
|
208
|
-
}
|
|
209
|
-
static getItemAmountsWithTransaction(itemDisplayLines, accountingCurrency) {
|
|
210
|
-
var _a;
|
|
211
|
-
let withTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
212
|
-
(_a = itemDisplayLines) === null || _a === void 0 ? void 0 : _a.forEach((itemDisplayLine) => {
|
|
213
|
-
if (itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemCancel ||
|
|
214
|
-
(itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
|
|
215
|
-
!_.isUndefined(itemDisplayLine.lineNumberFromReturnTransaction) &&
|
|
216
|
-
!_.isUndefined(itemDisplayLine.sublineIndexFromReturnItem))) {
|
|
217
|
-
withTransactionTotal = withTransactionTotal.plus(itemDisplayLine.extendedAmountIncludingTax.abs());
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
return withTransactionTotal;
|
|
221
|
-
}
|
|
222
|
-
static getItemAmountsWithOfflineTransaction(itemDisplayLines, accountingCurrency) {
|
|
223
|
-
var _a;
|
|
224
|
-
let withOfflineTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
225
|
-
(_a = itemDisplayLines) === null || _a === void 0 ? void 0 : _a.forEach((itemDisplayLine) => {
|
|
226
|
-
var _a;
|
|
227
194
|
if (itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
|
|
228
195
|
!_.isUndefined(itemDisplayLine.offlineReturnReferenceNumber)) {
|
|
229
|
-
withOfflineTransactionTotal = withOfflineTransactionTotal.plus((_a = itemDisplayLine.
|
|
196
|
+
withOfflineTransactionTotal = withOfflineTransactionTotal.plus((_a = itemDisplayLine.extendedAmount) === null || _a === void 0 ? void 0 : _a.abs());
|
|
197
|
+
withOfflineTransactionTotal = !_.isEmpty(itemDisplayLine.totalLineTax)
|
|
198
|
+
? withOfflineTransactionTotal.plus((_b = itemDisplayLine.totalLineTax) === null || _b === void 0 ? void 0 : _b.abs())
|
|
199
|
+
: undefined;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
(_d = (_c = displayInfo) === null || _c === void 0 ? void 0 : _c.tenderDisplayLines) === null || _d === void 0 ? void 0 : _d.forEach((tenderDisplayLine) => {
|
|
203
|
+
var _a, _b;
|
|
204
|
+
const tender = getConfiguredTender(tenderDisplayLine.tenderId, configurationManager);
|
|
205
|
+
if (((_b = (_a = tender) === null || _a === void 0 ? void 0 : _a.allowRefund) === null || _b === void 0 ? void 0 : _b.indexOf(ITendersConfig_1.AllowRefund.WithOfflineTransaction)) >= 0) {
|
|
206
|
+
withOfflineTransactionTotal = withOfflineTransactionTotal.minus(tenderDisplayLine.tenderAmount.abs());
|
|
230
207
|
}
|
|
231
208
|
});
|
|
232
|
-
return withOfflineTransactionTotal;
|
|
233
|
-
}
|
|
234
|
-
static getWithoutTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
|
|
235
|
-
var _a, _b;
|
|
236
|
-
let withoutTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
237
|
-
const withoutTransactionItemAmount = TenderType.getItemAmountsWithoutTransaction((_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines, accountingCurrency);
|
|
238
|
-
withoutTransactionTotal = withoutTransactionTotal.plus(withoutTransactionItemAmount);
|
|
239
|
-
const withoutTransactionTenderedAmount = TenderType.getTenderedAmountsWithoutTransaction((_b = displayInfo) === null || _b === void 0 ? void 0 : _b.tenderDisplayLines, accountingCurrency, configurationManager);
|
|
240
|
-
withoutTransactionTotal = withoutTransactionTotal.minus(withoutTransactionTenderedAmount);
|
|
241
|
-
// shipping and item fee are not returned on RWOR
|
|
242
|
-
return withoutTransactionTotal;
|
|
243
|
-
}
|
|
244
|
-
static getWithTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
|
|
245
|
-
var _a, _b;
|
|
246
|
-
let withTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
247
|
-
const withTransactionItemAmount = TenderType.getItemAmountsWithTransaction((_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines, accountingCurrency);
|
|
248
|
-
withTransactionTotal = withTransactionTotal.plus(withTransactionItemAmount);
|
|
249
|
-
const withTransactionTenderedAmount = TenderType.getTenderedAmountsWithTransaction((_b = displayInfo) === null || _b === void 0 ? void 0 : _b.tenderDisplayLines, accountingCurrency, configurationManager);
|
|
250
|
-
withTransactionTotal = withTransactionTotal.minus(withTransactionTenderedAmount);
|
|
251
|
-
const feesTotal = TenderType.getFeesTotal(displayInfo, accountingCurrency);
|
|
252
|
-
withTransactionTotal = withTransactionTotal.plus(feesTotal);
|
|
253
|
-
return withTransactionTotal;
|
|
254
|
-
}
|
|
255
|
-
static getWithOfflineTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
|
|
256
|
-
var _a, _b;
|
|
257
|
-
let withOfflineTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
258
|
-
const withOfflineTransactionItemAmount = TenderType.getItemAmountsWithOfflineTransaction((_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines, accountingCurrency);
|
|
259
|
-
withOfflineTransactionTotal = withOfflineTransactionTotal.plus(withOfflineTransactionItemAmount);
|
|
260
|
-
const withOfflineTransactionTenderedAmount = TenderType.getTenderedAmountsWithOfflineTransaction((_b = displayInfo) === null || _b === void 0 ? void 0 : _b.tenderDisplayLines, accountingCurrency, configurationManager);
|
|
261
|
-
withOfflineTransactionTotal = withOfflineTransactionTotal.minus(withOfflineTransactionTenderedAmount);
|
|
262
|
-
// shipping and item fee are not returned on offline returns
|
|
263
209
|
return withOfflineTransactionTotal;
|
|
264
210
|
}
|
|
265
211
|
static getOriginalRefundableTenders(container, accountingCurrency, originalTransactionsDetails, balanceDue, itemTypes, orderTypes, isRefund, productAttributeTypes, displayInfo) {
|
|
@@ -7,22 +7,18 @@ exports.ITEM_MANUAL_DISCOUNT_LINE_TYPE = "ItemManualDiscount";
|
|
|
7
7
|
exports.TRANSACTION_MANUAL_DISCOUNT_LINE_TYPE = "TransactionManualDiscount";
|
|
8
8
|
exports.LOYALTY_DISCOUNT_LINE_TYPE = "LoyaltyDiscount";
|
|
9
9
|
function isManualItemDiscountLine(transactionLine) {
|
|
10
|
-
return (transactionLine
|
|
11
|
-
(transactionLine
|
|
12
|
-
|
|
13
|
-
transactionLine.itemLineReference !== undefined)));
|
|
10
|
+
return (transactionLine instanceof ManualItemDiscountLine_1.ManualItemDiscountLine ||
|
|
11
|
+
(transactionLine.lineType === exports.ITEM_MANUAL_DISCOUNT_LINE_TYPE &&
|
|
12
|
+
transactionLine.itemLineReference !== undefined));
|
|
14
13
|
}
|
|
15
14
|
exports.isManualItemDiscountLine = isManualItemDiscountLine;
|
|
16
15
|
function isManualTransactionDiscountLine(transactionLine) {
|
|
17
|
-
return (transactionLine
|
|
18
|
-
|
|
19
|
-
transactionLine.lineType === exports.TRANSACTION_MANUAL_DISCOUNT_LINE_TYPE));
|
|
16
|
+
return (transactionLine instanceof ManualTransactionDiscountLine_1.ManualTransactionDiscountLine ||
|
|
17
|
+
transactionLine.lineType === exports.TRANSACTION_MANUAL_DISCOUNT_LINE_TYPE);
|
|
20
18
|
}
|
|
21
19
|
exports.isManualTransactionDiscountLine = isManualTransactionDiscountLine;
|
|
22
20
|
function isLoyaltyDiscountLine(transactionLine) {
|
|
23
|
-
return (transactionLine
|
|
24
|
-
(transactionLine instanceof LoyaltyDiscountLine_1.LoyaltyDiscountLine ||
|
|
25
|
-
transactionLine.lineType === exports.LOYALTY_DISCOUNT_LINE_TYPE));
|
|
21
|
+
return (transactionLine instanceof LoyaltyDiscountLine_1.LoyaltyDiscountLine || transactionLine.lineType === exports.LOYALTY_DISCOUNT_LINE_TYPE);
|
|
26
22
|
}
|
|
27
23
|
exports.isLoyaltyDiscountLine = isLoyaltyDiscountLine;
|
|
28
24
|
function isManualDiscountLine(transactionLine) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Money } from "@aptos-scp/scp-component-business-core";
|
|
2
|
-
import {
|
|
2
|
+
import { 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 {
|
|
15
15
|
protected _newExtendedAmount: Money;
|
|
16
16
|
protected _newExtendedAmountExcludingTax: Money;
|
|
17
17
|
protected _newExtendedAmountIncludingTax: Money;
|
|
@@ -29,7 +29,6 @@ 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;
|
|
33
32
|
updateExtendedAmountExcludingTax(amount: Money): ITransactionLine;
|
|
34
33
|
updateExtendedAmountIncludingTax(amount: Money): ITransactionLine;
|
|
35
34
|
setTransactionLineTaxes(transactionLineTaxes: ITransactionLineTaxes, extendedAmount?: Money): FeeLineExtendedAmountDecorator;
|
|
@@ -95,12 +95,6 @@ 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
|
-
}
|
|
104
98
|
updateExtendedAmountExcludingTax(amount) {
|
|
105
99
|
amount = FeeLine_1.adjustSignForFeeLineType(this.lineType, amount);
|
|
106
100
|
const newLine = this.clone();
|
|
@@ -2,11 +2,10 @@ 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";
|
|
6
5
|
import { IFulfillmentGroupFee } from "../fee/IFeeLine";
|
|
7
6
|
export declare const SHIPPING_FEE_CHANGE_ANNOTATION_SOURCE_TYPE: string;
|
|
8
7
|
export declare const DECORATOR_TYPE_SHIPPING_FEE_LINE_CHANGE: string;
|
|
9
|
-
export declare class ShippingFeeLineChangeDecorator extends
|
|
8
|
+
export declare class ShippingFeeLineChangeDecorator extends BaseFeeLineDecorator {
|
|
10
9
|
private _newUnitAmount;
|
|
11
10
|
private _feesByFulfillmentGroup;
|
|
12
11
|
private _newTaxGroupId;
|
|
@@ -14,7 +13,7 @@ export declare class ShippingFeeLineChangeDecorator extends FeeLineExtendedAmoun
|
|
|
14
13
|
private _newDescription;
|
|
15
14
|
private _newLongDescription;
|
|
16
15
|
static createFromJsonObject(transactionLineJsonObj: any, transactionLineFactory: ITransactionLineFactory): ShippingFeeLineChangeDecorator;
|
|
17
|
-
constructor(feeLine?: FeeLine, annotationSourceLineNumber?: number, newUnitAmount?: Money, feesByFulfillmentGroup?: IFulfillmentGroupFee[], newTaxGroupId?: string, newFeeId?: string, newDescription?: string, newLongDescription?: string
|
|
16
|
+
constructor(feeLine?: FeeLine, annotationSourceLineNumber?: number, newUnitAmount?: Money, feesByFulfillmentGroup?: IFulfillmentGroupFee[], newTaxGroupId?: string, newFeeId?: string, newDescription?: string, newLongDescription?: string);
|
|
18
17
|
get unitAmount(): Money;
|
|
19
18
|
get unitAmountBeforeOverride(): Money;
|
|
20
19
|
get feesByFulfillmentGroup(): IFulfillmentGroupFee[];
|
|
@@ -2,12 +2,11 @@
|
|
|
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");
|
|
6
5
|
exports.SHIPPING_FEE_CHANGE_ANNOTATION_SOURCE_TYPE = "ShippingFee";
|
|
7
6
|
exports.DECORATOR_TYPE_SHIPPING_FEE_LINE_CHANGE = "SHIPPING_FEE_LINE_DECORATOR";
|
|
8
|
-
class ShippingFeeLineChangeDecorator extends
|
|
9
|
-
constructor(feeLine, annotationSourceLineNumber, newUnitAmount, feesByFulfillmentGroup, newTaxGroupId, newFeeId, newDescription, newLongDescription
|
|
10
|
-
super(exports.DECORATOR_TYPE_SHIPPING_FEE_LINE_CHANGE, feeLine, undefined, exports.SHIPPING_FEE_CHANGE_ANNOTATION_SOURCE_TYPE, annotationSourceLineNumber
|
|
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);
|
|
11
10
|
this._newUnitAmount = newUnitAmount;
|
|
12
11
|
this._feesByFulfillmentGroup = feesByFulfillmentGroup;
|
|
13
12
|
this._newTaxGroupId = newTaxGroupId;
|
|
@@ -37,12 +36,11 @@ class ShippingFeeLineChangeDecorator extends FeeLineExtendedAmountDecorator_1.Fe
|
|
|
37
36
|
});
|
|
38
37
|
const feesByFulfillmentGroup = transactionLineJsonObj._feesByFulfillmentGroup;
|
|
39
38
|
const annotationSourceLineNumber = BaseFeeLineDecorator_1.BaseFeeLineDecorator.getAnnotationSourceLineNumberFromJsonObject(transactionLineJsonObj);
|
|
40
|
-
const extendedAmountFields = FeeLineExtendedAmountDecorator_1.FeeLineExtendedAmountDecorator.getExtendedAmountFieldsFromJsonObject(transactionLineJsonObj);
|
|
41
39
|
const newTaxGroupId = transactionLineJsonObj._newTaxGroupId;
|
|
42
40
|
const newFeeId = transactionLineJsonObj._newFeeId;
|
|
43
41
|
const newDescription = transactionLineJsonObj._newDescription;
|
|
44
42
|
const newLongDescription = transactionLineJsonObj._newLongDescription;
|
|
45
|
-
const feeLineQuantityChangeDecorator = new ShippingFeeLineChangeDecorator(decoratedFeeLine, annotationSourceLineNumber, newUnitAmount, feesByFulfillmentGroup, newTaxGroupId, newFeeId, newDescription, newLongDescription
|
|
43
|
+
const feeLineQuantityChangeDecorator = new ShippingFeeLineChangeDecorator(decoratedFeeLine, annotationSourceLineNumber, newUnitAmount, feesByFulfillmentGroup, newTaxGroupId, newFeeId, newDescription, newLongDescription);
|
|
46
44
|
return feeLineQuantityChangeDecorator;
|
|
47
45
|
}
|
|
48
46
|
get unitAmount() {
|
|
@@ -76,13 +74,7 @@ class ShippingFeeLineChangeDecorator extends FeeLineExtendedAmountDecorator_1.Fe
|
|
|
76
74
|
return newShippingFeeLineChangeDecorator;
|
|
77
75
|
}
|
|
78
76
|
newTransactionLine() {
|
|
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
|
-
});
|
|
77
|
+
return new ShippingFeeLineChangeDecorator(this.decoratedTransactionLine, this.annotationSourceLineNumber, this._newUnitAmount, this._feesByFulfillmentGroup, this._newTaxGroupId, this._newFeeId, this._newDescription, this._newLongDescription);
|
|
86
78
|
}
|
|
87
79
|
}
|
|
88
80
|
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
|
|
3
|
+
"version": "1.45.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",
|