@infrab4a/connect-angular 4.12.1-beta.6 → 4.12.2-beta.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/esm2020/services/cart.service.mjs +2 -2
- package/esm2020/services/coupon.service.mjs +5 -13
- package/fesm2015/infrab4a-connect-angular.mjs +7 -16
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +5 -13
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1093,12 +1093,8 @@ class CouponService {
|
|
|
1093
1093
|
if (!hasProductCategories)
|
|
1094
1094
|
throw 'Seu carrinho não possui produtos elegíveis para desconto.';
|
|
1095
1095
|
const hasMinSubTotal = await this.hasMinSubTotal(coupon, checkout);
|
|
1096
|
-
if (!hasMinSubTotal)
|
|
1097
|
-
if (coupon.productsCategories?.length) {
|
|
1098
|
-
throw `Valor mínimo de ${Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue)} não atingido na(s) categoria(s)/marca(s) elegiveis para o desconto.`;
|
|
1099
|
-
}
|
|
1096
|
+
if (!hasMinSubTotal)
|
|
1100
1097
|
throw `Valor mínimo de ${Intl.NumberFormat('pt-BR', { style: 'currency', currency: 'BRL' }).format(coupon.minSubTotalValue)} não atingido`;
|
|
1101
|
-
}
|
|
1102
1098
|
return coupon;
|
|
1103
1099
|
}
|
|
1104
1100
|
calcDiscountSubscription(coupon, checkout) {
|
|
@@ -1183,13 +1179,9 @@ class CouponService {
|
|
|
1183
1179
|
async getCouponCategoriesId(productsCategories) {
|
|
1184
1180
|
const couponCategories = [];
|
|
1185
1181
|
for (let index = 0; index < productsCategories.length; index++) {
|
|
1186
|
-
const category = await this.categoryRepository
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
id: productsCategories[index],
|
|
1190
|
-
},
|
|
1191
|
-
})
|
|
1192
|
-
.then((res) => res.data.at(0));
|
|
1182
|
+
const category = await this.categoryRepository.get({
|
|
1183
|
+
id: productsCategories[index],
|
|
1184
|
+
});
|
|
1193
1185
|
if (category) {
|
|
1194
1186
|
const children = await this.categoryRepository.getChildren(parseInt(productsCategories[index]));
|
|
1195
1187
|
couponCategories.push(category.id, ...children.map((c) => c.id.toString()));
|
|
@@ -1423,7 +1415,7 @@ class CartService {
|
|
|
1423
1415
|
quantity: (item.quantity || 0) + (quantity || 0),
|
|
1424
1416
|
pricePaid,
|
|
1425
1417
|
discount: 0,
|
|
1426
|
-
categories: product.categories
|
|
1418
|
+
categories: product.categories ?? [],
|
|
1427
1419
|
isGift: isGift ?? null,
|
|
1428
1420
|
costPrice: product.costPrice ?? 0,
|
|
1429
1421
|
type,
|