Esempio n. 1
0
 def update_line(self, data_line, **kwargs):
     line = BasketLine.from_dict(self, data_line)
     new_quantity = kwargs.pop("quantity", None)
     if new_quantity is not None:
         line.set_quantity(new_quantity)
     line.update(**kwargs)
     line.cache_info(PricingContext(shop=self.shop, customer=self.customer))
     self._add_or_replace_line(line)
     return line
Esempio n. 2
0
 def refresh_lines(self):
     """
     Refresh lines recalculating prices
     """
     pricing_context = PricingContext(shop=self.shop, customer=self.customer)
     for line_data in self._data_lines:
         line = BasketLine.from_dict(self, line_data)
         line.cache_info(pricing_context)
         self._add_or_replace_line(line)
Esempio n. 3
0
 def _get_pricing_context(self, request, shop):
     return PricingContext(shop=shop, customer=self.context["customer"])
Esempio n. 4
0
 def resolve_price_info(self, info, **kwargs):
     customer = get_person_contact(info.context.user)
     price_context = PricingContext(shop=self.shop, customer=customer)
     price_info = self.product.get_price_info(price_context)
     return convert_taxness(info.context, self.product, price_info, True)