Commits

NikolayBlohin  committed 256fb5f

Added costs calculation function

  • Participants
  • Parent commits 12075e6

Comments (0)

Files changed (1)

File lfs/order/utils.py

-# lfs imports
+from django.conf import settings
 import lfs.discounts.utils
 import lfs.voucher.utils
 from lfs.cart import utils as cart_utils
         user = None
         customer_email = customer.selected_invoice_address.email
 
+    cart_costs_price = cart_costs["price"]
+    shipping_costs_price = shipping_costs['price']
+    payment_costs_price = payment_costs["price"]
+
+    calculate_costs = getattr(settings, 'LFS_COSTS_CALCULATOR', lambda a, b, c: (a, b, c))
+
+    cart_costs_price, shipping_costs_price, payment_costs_price = calculate_costs(
+        cart_costs_price,
+        shipping_costs_price,
+        payment_costs_price
+    )
+
     # Calculate the totals
-    price = cart_costs["price"] + shipping_costs["price"] + payment_costs["price"]
+    price = cart_costs_price + shipping_costs_price + payment_costs_price
     tax = cart_costs["tax"] + shipping_costs["tax"] + payment_costs["tax"]
 
     # Discounts