Skip to content

Commit

Permalink
Adjust signature of get_order_totals
Browse files Browse the repository at this point in the history
This allows taxes to be added to the shipping charge and passed around.
Before this, tax info would be lost when regenerating order totals.
  • Loading branch information
codeinthehole committed May 28, 2014
1 parent 8bcee10 commit 4dcfcc1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions oscar/apps/checkout/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def build_submission(self, **kwargs):
else:
shipping_charge = shipping_method.calculate(basket)
total = self.get_order_totals(
basket, shipping_method=shipping_method)
basket, shipping_charge=shipping_charge)
submission = {
'user': self.request.user,
'basket': basket,
Expand Down Expand Up @@ -302,10 +302,9 @@ def get_billing_address(self, shipping_address):
user_address.populate_alternative_model(billing_address)
return billing_address

def get_order_totals(self, basket, shipping_method, **kwargs):
def get_order_totals(self, basket, shipping_charge, **kwargs):
"""
Returns the total for the order with and without tax (as a tuple)
"""
shipping_charge = shipping_method.calculate(basket)
return OrderTotalCalculator(self.request).calculate(
basket, shipping_charge, **kwargs)
2 changes: 1 addition & 1 deletion oscar/templates/oscar/basket/partials/basket_totals.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ <h4>{% trans "Tax" %}</h4>
<tr>
<th class="total">{% trans "Shipping" %}</th>
<th class="total align-right">
{{ shipping_method.tax|currency:basket.currency }}
{{ shipping_charge.tax|currency:basket.currency }}
</th>
</tr>
{% endif %}
Expand Down

0 comments on commit 4dcfcc1

Please sign in to comment.