@infrab4a/connect-angular 4.4.1-beta.0 → 4.4.1-beta.2
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.
|
@@ -1188,10 +1188,11 @@ class CouponService {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
calcLineItenDiscount(type, lineItems, couponDiscount, subTotal) {
|
|
1190
1190
|
let lineItemsDiscount = [];
|
|
1191
|
-
if (type
|
|
1191
|
+
if (type === CouponTypes.ABSOLUTE) {
|
|
1192
1192
|
lineItemsDiscount = lineItems.map((item) => {
|
|
1193
|
-
const totalItemPercentage =
|
|
1194
|
-
const discountItem = item.pricePaid -
|
|
1193
|
+
const totalItemPercentage = item.pricePaid / subTotal;
|
|
1194
|
+
const discountItem = item.pricePaid - couponDiscount * totalItemPercentage;
|
|
1195
|
+
console.log(item.name, subTotal, 'absolute', couponDiscount, totalItemPercentage, discountItem);
|
|
1195
1196
|
return {
|
|
1196
1197
|
...item,
|
|
1197
1198
|
discount: discountItem,
|
|
@@ -1202,6 +1203,7 @@ class CouponService {
|
|
|
1202
1203
|
else {
|
|
1203
1204
|
lineItemsDiscount = lineItems.map((item) => {
|
|
1204
1205
|
const discountItem = item.pricePaid * (couponDiscount / 100);
|
|
1206
|
+
console.log(item.name, 'percentage', couponDiscount, discountItem);
|
|
1205
1207
|
return {
|
|
1206
1208
|
...item,
|
|
1207
1209
|
discount: discountItem,
|