@aptos-scp/scp-component-store-selling-features-domain-model 1.45.0-patch.2 → 1.45.0-patch.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.
|
@@ -98,6 +98,13 @@ 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;
|
|
101
108
|
static getWithoutTransactionTotal(displayInfo: any, accountingCurrency: string, configurationManager: IConfigurationManager): Money;
|
|
102
109
|
static getWithTransactionTotal(displayInfo: any, accountingCurrency: string, configurationManager: IConfigurationManager): Money;
|
|
103
110
|
static getWithOfflineTransactionTotal(displayInfo: any, accountingCurrency: string, configurationManager: IConfigurationManager): Money;
|
|
@@ -137,75 +137,129 @@ class TenderType {
|
|
|
137
137
|
}
|
|
138
138
|
return getLowestRefundDue(refundDue, undefined, refundableAmount);
|
|
139
139
|
}
|
|
140
|
-
static
|
|
140
|
+
static getFeesTotal(displayInfo, accountingCurrency) {
|
|
141
141
|
var _a, _b, _c, _d;
|
|
142
|
-
let
|
|
143
|
-
(_b = (_a = displayInfo) === null || _a === void 0 ? void 0 : _a.
|
|
144
|
-
if (
|
|
145
|
-
|
|
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;
|
|
142
|
+
let total = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
143
|
+
(_b = (_a = displayInfo) === null || _a === void 0 ? void 0 : _a.shippingFeeDisplayLines) === null || _b === void 0 ? void 0 : _b.forEach((shippingFeeDisplayLine) => {
|
|
144
|
+
if (shippingFeeDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.TransactionFeeRefund) {
|
|
145
|
+
total = total.plus(shippingFeeDisplayLine.extendedAmountIncludingTax.abs());
|
|
153
146
|
}
|
|
154
147
|
});
|
|
155
|
-
(_d = (_c = displayInfo) === null || _c === void 0 ? void 0 : _c.
|
|
148
|
+
(_d = (_c = displayInfo) === null || _c === void 0 ? void 0 : _c.itemFeeDisplayLines) === null || _d === void 0 ? void 0 : _d.forEach((itemFeeDisplayLine) => {
|
|
149
|
+
if (itemFeeDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemFeeRefund) {
|
|
150
|
+
total = total.plus(itemFeeDisplayLine.extendedAmount.abs());
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
return total;
|
|
154
|
+
}
|
|
155
|
+
static getTenderedAmountsWithoutTransaction(tenderDisplayLines, accountingCurrency, configurationManager) {
|
|
156
|
+
var _a;
|
|
157
|
+
let withoutTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
158
|
+
(_a = tenderDisplayLines) === null || _a === void 0 ? void 0 : _a.forEach((tenderDisplayLine) => {
|
|
156
159
|
var _a, _b;
|
|
157
160
|
const tender = getConfiguredTender(tenderDisplayLine.tenderId, configurationManager);
|
|
158
161
|
if (_.isEmpty(tenderDisplayLine.originalTenderReferences) &&
|
|
159
162
|
((_b = (_a = tender) === null || _a === void 0 ? void 0 : _a.allowRefund) === null || _b === void 0 ? void 0 : _b.indexOf(ITendersConfig_1.AllowRefund.WithoutTransaction)) >= 0) {
|
|
160
|
-
withoutTransactionTotal = withoutTransactionTotal.
|
|
163
|
+
withoutTransactionTotal = withoutTransactionTotal.plus(tenderDisplayLine.tenderAmount.abs());
|
|
161
164
|
}
|
|
162
165
|
});
|
|
163
166
|
return withoutTransactionTotal;
|
|
164
167
|
}
|
|
165
|
-
static
|
|
166
|
-
var _a
|
|
168
|
+
static getTenderedAmountsWithTransaction(tenderDisplayLines, accountingCurrency, configurationManager) {
|
|
169
|
+
var _a;
|
|
167
170
|
let withTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
168
|
-
(
|
|
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) => {
|
|
171
|
+
(_a = tenderDisplayLines) === null || _a === void 0 ? void 0 : _a.forEach((tenderDisplayLine) => {
|
|
180
172
|
var _a, _b;
|
|
181
173
|
const tender = getConfiguredTender(tenderDisplayLine.tenderId, configurationManager);
|
|
182
174
|
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 ||
|
|
183
175
|
!_.isEmpty(tenderDisplayLine.originalTenderReferences)) {
|
|
184
|
-
withTransactionTotal = withTransactionTotal.
|
|
176
|
+
withTransactionTotal = withTransactionTotal.plus(tenderDisplayLine.tenderAmount.abs());
|
|
185
177
|
}
|
|
186
178
|
});
|
|
187
179
|
return withTransactionTotal;
|
|
188
180
|
}
|
|
189
|
-
static
|
|
190
|
-
var _a
|
|
181
|
+
static getTenderedAmountsWithOfflineTransaction(tenderDisplayLines, accountingCurrency, configurationManager) {
|
|
182
|
+
var _a;
|
|
191
183
|
let withOfflineTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
192
|
-
(
|
|
193
|
-
var _a, _b;
|
|
194
|
-
if (itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
|
|
195
|
-
!_.isUndefined(itemDisplayLine.offlineReturnReferenceNumber)) {
|
|
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) => {
|
|
184
|
+
(_a = tenderDisplayLines) === null || _a === void 0 ? void 0 : _a.forEach((tenderDisplayLine) => {
|
|
203
185
|
var _a, _b;
|
|
204
186
|
const tender = getConfiguredTender(tenderDisplayLine.tenderId, configurationManager);
|
|
205
187
|
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.
|
|
188
|
+
withOfflineTransactionTotal = withOfflineTransactionTotal.plus(tenderDisplayLine.tenderAmount.abs());
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
return withOfflineTransactionTotal;
|
|
192
|
+
}
|
|
193
|
+
static getItemAmountsWithoutTransaction(itemDisplayLines, accountingCurrency) {
|
|
194
|
+
var _a;
|
|
195
|
+
let withoutTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
196
|
+
(_a = itemDisplayLines) === null || _a === void 0 ? void 0 : _a.forEach((itemDisplayLine) => {
|
|
197
|
+
if ((itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemOrder && itemDisplayLine.cancelled) ||
|
|
198
|
+
(itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
|
|
199
|
+
_.isUndefined(itemDisplayLine.lineNumberFromReturnTransaction) &&
|
|
200
|
+
_.isUndefined(itemDisplayLine.sublineIndexFromReturnItem) &&
|
|
201
|
+
_.isUndefined(itemDisplayLine.offlineReturnReferenceNumber))) {
|
|
202
|
+
withoutTransactionTotal = withoutTransactionTotal.plus(itemDisplayLine.extendedAmountIncludingTax.abs());
|
|
207
203
|
}
|
|
208
204
|
});
|
|
205
|
+
return withoutTransactionTotal;
|
|
206
|
+
}
|
|
207
|
+
static getItemAmountsWithTransaction(itemDisplayLines, accountingCurrency) {
|
|
208
|
+
var _a;
|
|
209
|
+
let withTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
210
|
+
(_a = itemDisplayLines) === null || _a === void 0 ? void 0 : _a.forEach((itemDisplayLine) => {
|
|
211
|
+
if (itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemCancel ||
|
|
212
|
+
(itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
|
|
213
|
+
!_.isUndefined(itemDisplayLine.lineNumberFromReturnTransaction) &&
|
|
214
|
+
!_.isUndefined(itemDisplayLine.sublineIndexFromReturnItem))) {
|
|
215
|
+
withTransactionTotal = withTransactionTotal.plus(itemDisplayLine.extendedAmountIncludingTax.abs());
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
return withTransactionTotal;
|
|
219
|
+
}
|
|
220
|
+
static getItemAmountsWithOfflineTransaction(itemDisplayLines, accountingCurrency) {
|
|
221
|
+
var _a;
|
|
222
|
+
let withOfflineTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
223
|
+
(_a = itemDisplayLines) === null || _a === void 0 ? void 0 : _a.forEach((itemDisplayLine) => {
|
|
224
|
+
var _a;
|
|
225
|
+
if (itemDisplayLine.lineType === scp_types_commerce_transaction_1.LineType.ItemReturn &&
|
|
226
|
+
!_.isUndefined(itemDisplayLine.offlineReturnReferenceNumber)) {
|
|
227
|
+
withOfflineTransactionTotal = withOfflineTransactionTotal.plus((_a = itemDisplayLine.extendedAmountIncludingTax) === null || _a === void 0 ? void 0 : _a.abs());
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
return withOfflineTransactionTotal;
|
|
231
|
+
}
|
|
232
|
+
static getWithoutTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
|
|
233
|
+
var _a, _b;
|
|
234
|
+
let withoutTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
235
|
+
const withoutTransactionItemAmount = TenderType.getItemAmountsWithoutTransaction((_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines, accountingCurrency);
|
|
236
|
+
withoutTransactionTotal = withoutTransactionTotal.plus(withoutTransactionItemAmount);
|
|
237
|
+
const withoutTransactionTenderedAmount = TenderType.getTenderedAmountsWithoutTransaction((_b = displayInfo) === null || _b === void 0 ? void 0 : _b.tenderDisplayLines, accountingCurrency, configurationManager);
|
|
238
|
+
withoutTransactionTotal = withoutTransactionTotal.minus(withoutTransactionTenderedAmount);
|
|
239
|
+
const feesTotal = TenderType.getFeesTotal(displayInfo, accountingCurrency);
|
|
240
|
+
withoutTransactionTotal = withoutTransactionTotal.plus(feesTotal);
|
|
241
|
+
return withoutTransactionTotal;
|
|
242
|
+
}
|
|
243
|
+
static getWithTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
|
|
244
|
+
var _a, _b;
|
|
245
|
+
let withTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
246
|
+
const withTransactionItemAmount = TenderType.getItemAmountsWithTransaction((_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines, accountingCurrency);
|
|
247
|
+
withTransactionTotal = withTransactionTotal.plus(withTransactionItemAmount);
|
|
248
|
+
const withTransactionTenderedAmount = TenderType.getTenderedAmountsWithTransaction((_b = displayInfo) === null || _b === void 0 ? void 0 : _b.tenderDisplayLines, accountingCurrency, configurationManager);
|
|
249
|
+
withTransactionTotal = withTransactionTotal.minus(withTransactionTenderedAmount);
|
|
250
|
+
const feesTotal = TenderType.getFeesTotal(displayInfo, accountingCurrency);
|
|
251
|
+
withTransactionTotal = withTransactionTotal.plus(feesTotal);
|
|
252
|
+
return withTransactionTotal;
|
|
253
|
+
}
|
|
254
|
+
static getWithOfflineTransactionTotal(displayInfo, accountingCurrency, configurationManager) {
|
|
255
|
+
var _a, _b;
|
|
256
|
+
let withOfflineTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
257
|
+
const withOfflineTransactionItemAmount = TenderType.getItemAmountsWithOfflineTransaction((_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines, accountingCurrency);
|
|
258
|
+
withOfflineTransactionTotal = withOfflineTransactionTotal.plus(withOfflineTransactionItemAmount);
|
|
259
|
+
const withOfflineTransactionTenderedAmount = TenderType.getTenderedAmountsWithOfflineTransaction((_b = displayInfo) === null || _b === void 0 ? void 0 : _b.tenderDisplayLines, accountingCurrency, configurationManager);
|
|
260
|
+
withOfflineTransactionTotal = withOfflineTransactionTotal.minus(withOfflineTransactionTenderedAmount);
|
|
261
|
+
const feesTotal = TenderType.getFeesTotal(displayInfo, accountingCurrency);
|
|
262
|
+
withOfflineTransactionTotal = withOfflineTransactionTotal.plus(feesTotal);
|
|
209
263
|
return withOfflineTransactionTotal;
|
|
210
264
|
}
|
|
211
265
|
static getOriginalRefundableTenders(container, accountingCurrency, originalTransactionsDetails, balanceDue, itemTypes, orderTypes, isRefund, productAttributeTypes, displayInfo) {
|
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.
|
|
3
|
+
"version": "1.45.0-patch.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",
|