def tax_amount(self): """ :return: Tax amount. """ tax_amount = 0.0 if self.__cart.tax_type == 'included': total = self.sub_total() - self.discount_amount() else: total = self.untaxed_amount() tax_amount = calculate(total, self.__taxes, self.__cart.tax_type, self.__cart.currency_rate, self.__cart.price_accuracy) return tax_amount
def total_tax(self): """ :return: Total tax amount. """ total_tax = 0.0 if self.tax_type == 'included': total = self.sub_total() - self.total_discount() else: total = self.total_untaxed_amount() total_tax = calculate(total, self.__taxes, self.tax_type, self.currency_rate, self.price_accuracy) for cart_item in self.get_items(): total_tax += cart_item.tax_amount() return round(total_tax, self.price_accuracy)