@infrab4a/connect-angular 4.4.2-beta.1 → 4.4.2-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.
|
@@ -1189,10 +1189,11 @@ class CouponService {
|
|
|
1189
1189
|
calcLineItenDiscount(type, lineItems, couponDiscount, subTotal) {
|
|
1190
1190
|
let lineItemsDiscount = [];
|
|
1191
1191
|
if (type === CouponTypes.ABSOLUTE) {
|
|
1192
|
+
const couponDiscountMax = couponDiscount > subTotal ? subTotal : couponDiscount;
|
|
1192
1193
|
lineItemsDiscount = lineItems.map((item) => {
|
|
1193
1194
|
const totalItemPercentage = item.pricePaid / subTotal;
|
|
1194
|
-
const discountItem =
|
|
1195
|
-
console.log(item.name, item.pricePaid, subTotal, 'absolute',
|
|
1195
|
+
const discountItem = couponDiscountMax * totalItemPercentage;
|
|
1196
|
+
console.log(item.name, item.pricePaid, subTotal, 'absolute', couponDiscountMax, totalItemPercentage, discountItem);
|
|
1196
1197
|
return {
|
|
1197
1198
|
...item,
|
|
1198
1199
|
discount: Number(discountItem.toFixed(2)),
|