@aptos-scp/scp-component-store-selling-features-domain-model 2.1.0 → 2.2.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.
|
@@ -161,6 +161,7 @@ export declare class StoreItem implements ISourceIndication, IStoreItemDescripto
|
|
|
161
161
|
private static temporaryPriceExpirationDateTime;
|
|
162
162
|
private static calculateFullPrice;
|
|
163
163
|
private static calculateFullPriceAtLevel;
|
|
164
|
+
private static calculateTreatmentRules;
|
|
164
165
|
private static createItemLookupKeysFromJsonObject;
|
|
165
166
|
private static getStringFromJsonObject;
|
|
166
167
|
private static getPriceFromStoreItemPrice;
|
|
@@ -428,11 +428,9 @@ class StoreItem {
|
|
|
428
428
|
if (item.externalIds) {
|
|
429
429
|
storeItem.externalIds = item.externalIds;
|
|
430
430
|
}
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
if (item.treatmentRules) {
|
|
435
|
-
storeItem.treatmentRules = Object.assign(Object.assign({}, TREATMENT_RULE_DEFAULTS), item.treatmentRules);
|
|
431
|
+
const treatmentRules = StoreItem.calculateTreatmentRules(item, storeGroupItem, retailStoreItem);
|
|
432
|
+
if (treatmentRules) {
|
|
433
|
+
storeItem.treatmentRules = treatmentRules;
|
|
436
434
|
}
|
|
437
435
|
if (!storeItem.price || !storeItem.price.amount) {
|
|
438
436
|
const units = storeItem.price ? storeItem.price.units : undefined;
|
|
@@ -635,6 +633,21 @@ class StoreItem {
|
|
|
635
633
|
}
|
|
636
634
|
return undefined;
|
|
637
635
|
}
|
|
636
|
+
static calculateTreatmentRules(item, storeGroupItem, retailStoreItem) {
|
|
637
|
+
var _a, _b;
|
|
638
|
+
const TREATMENT_RULE_DEFAULTS = {
|
|
639
|
+
eligibleForSendSale: true,
|
|
640
|
+
};
|
|
641
|
+
if ((_a = retailStoreItem) === null || _a === void 0 ? void 0 : _a.treatmentRules) {
|
|
642
|
+
return Object.assign(Object.assign({}, TREATMENT_RULE_DEFAULTS), retailStoreItem.treatmentRules);
|
|
643
|
+
}
|
|
644
|
+
else if ((_b = storeGroupItem) === null || _b === void 0 ? void 0 : _b.treatmentRules) {
|
|
645
|
+
return Object.assign(Object.assign({}, TREATMENT_RULE_DEFAULTS), storeGroupItem.treatmentRules);
|
|
646
|
+
}
|
|
647
|
+
else if (item.treatmentRules) {
|
|
648
|
+
return Object.assign(Object.assign({}, TREATMENT_RULE_DEFAULTS), item.treatmentRules);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
638
651
|
static createItemLookupKeysFromJsonObject(itemLookupKeysFromJson) {
|
|
639
652
|
const itemLookupKeys = [];
|
|
640
653
|
if (itemLookupKeysFromJson) {
|
|
@@ -256,9 +256,11 @@ class TenderType {
|
|
|
256
256
|
var _a, _b;
|
|
257
257
|
let withOfflineTransactionTotal = new scp_component_business_core_1.Money(0, accountingCurrency);
|
|
258
258
|
const withOfflineTransactionItemAmount = TenderType.getItemAmountsWithOfflineTransaction((_a = displayInfo) === null || _a === void 0 ? void 0 : _a.itemDisplayLines, accountingCurrency);
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
259
|
+
if (withOfflineTransactionItemAmount.isPositive()) {
|
|
260
|
+
withOfflineTransactionTotal = withOfflineTransactionTotal.plus(withOfflineTransactionItemAmount);
|
|
261
|
+
const withOfflineTransactionTenderedAmount = TenderType.getTenderedAmountsWithOfflineTransaction((_b = displayInfo) === null || _b === void 0 ? void 0 : _b.tenderDisplayLines, accountingCurrency, configurationManager);
|
|
262
|
+
withOfflineTransactionTotal = withOfflineTransactionTotal.minus(withOfflineTransactionTenderedAmount);
|
|
263
|
+
}
|
|
262
264
|
// shipping and item fee are not returned on offline returns
|
|
263
265
|
return withOfflineTransactionTotal;
|
|
264
266
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-scp/scp-component-store-selling-features-domain-model",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.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",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@aptos-scp/scp-component-logging": "^2.1.16",
|
|
79
79
|
"@aptos-scp/scp-component-pricing": "^7.62.0",
|
|
80
80
|
"@aptos-scp/scp-component-rn-circuit-breaker": "^1.0.15",
|
|
81
|
-
"@aptos-scp/scp-component-store-items": "^1.
|
|
81
|
+
"@aptos-scp/scp-component-store-items": "^1.21.0",
|
|
82
82
|
"@aptos-scp/scp-component-store-selling-core": "^18.9.3",
|
|
83
83
|
"@aptos-scp/scp-component-taxation": "^5.28.0",
|
|
84
84
|
"@aptos-scp/scp-component-user": "^1.4.0",
|