@infrab4a/connect-angular 4.9.1-beta-0 → 4.9.1-beta.1
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.
|
@@ -1322,11 +1322,13 @@ class CartService {
|
|
|
1322
1322
|
this.buy2WinRepository = buy2WinRepository;
|
|
1323
1323
|
this.cartSubject = new Subject();
|
|
1324
1324
|
this.updateLineItemInCart = (lineItem, quantity, checkout) => (isNil(checkout) ? this.checkoutService.getCheckout() : of(checkout)).pipe(concatMap((checkoutLoaded) => {
|
|
1325
|
+
console.log('updateLineItemInCart', lineItem);
|
|
1325
1326
|
const items = [];
|
|
1326
1327
|
const index = checkoutLoaded.lineItems?.map((checkoutItem) => checkoutItem.id).indexOf(lineItem.id);
|
|
1327
1328
|
if (index > -1) {
|
|
1328
1329
|
checkoutLoaded.lineItems[index].quantity += quantity;
|
|
1329
1330
|
checkoutLoaded.lineItems[index].pricePaid = lineItem.pricePaid;
|
|
1331
|
+
console.log('if index', checkoutLoaded.lineItems[index]);
|
|
1330
1332
|
}
|
|
1331
1333
|
else
|
|
1332
1334
|
checkoutLoaded.lineItems = items.concat(checkoutLoaded.lineItems ? checkoutLoaded.lineItems.concat([lineItem]) : [lineItem]);
|
|
@@ -1347,13 +1349,14 @@ class CartService {
|
|
|
1347
1349
|
if (this.checkMaxStock(product.stock.quantity, item.quantity || 0, quantity || 0))
|
|
1348
1350
|
throw new Error('Desculpe! Temos apenas ' + product.stock?.quantity + ' em estoque.');
|
|
1349
1351
|
const image = item.image || item.images?.shift();
|
|
1350
|
-
const { id, name, EAN, slug,
|
|
1352
|
+
const { id, name, EAN, slug, weight, sku, type } = item;
|
|
1351
1353
|
const isGift = item.isGift || null;
|
|
1352
1354
|
const pricePaid = this.getProductPrice({
|
|
1353
1355
|
product: LineItem.toInstance(product),
|
|
1354
1356
|
shop: checkout.shop || this.defaultShop,
|
|
1355
1357
|
isSubscriber: checkout.user?.isSubscriber,
|
|
1356
1358
|
});
|
|
1359
|
+
console.log('pricePaid', pricePaid);
|
|
1357
1360
|
RoundProductPricesHelper.roundProductPrices(item);
|
|
1358
1361
|
RoundProductPricesHelper.roundProductPrices(product);
|
|
1359
1362
|
return {
|