From a0187488107feb7af04f30cda0151510e4ffa919 Mon Sep 17 00:00:00 2001 From: Henri Hulski Date: Fri, 25 Mar 2022 16:47:23 +0100 Subject: [PATCH] fix: remove obsolete strip of % from tax_rate and fix type conversion --- cartridge/shop/checkout.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cartridge/shop/checkout.py b/cartridge/shop/checkout.py index 738acf93..49e74932 100644 --- a/cartridge/shop/checkout.py +++ b/cartridge/shop/checkout.py @@ -52,15 +52,15 @@ def default_tax_handler(request, order_form): """ settings.clear_cache() if settings.SHOP_DEFAULT_TAX_RATE: - tax_rate = settings.SHOP_DEFAULT_TAX_RATE.strip("%") + tax_rate = (settings.SHOP_DEFAULT_TAX_RATE) if settings.SHOP_TAX_INCLUDED: tax = request.cart.total_price() - ( - request.cart.total_price() / decimal.Decimal(1 + float(tax_rate) / 100) + request.cart.total_price() / decimal.Decimal(1 + tax_rate / 100) ) - tax_type = _("Incl.") + " " + tax_rate + "% " + _("VAT") + tax_type = _("Incl.") + " " + str(tax_rate) + "% " + _("VAT") else: - tax = request.cart.total_price() * decimal.Decimal(float(tax_rate) / 100) - tax_type = _("VAT") + " (" + tax_rate + "%)" + tax = request.cart.total_price() * decimal.Decimal(tax_rate / 100) + tax_type = _("VAT") + " (" + str(tax_rate) + "%)" set_tax(request, tax_type, f"{tax:.2f}")