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