Skip to content

Commit

Permalink
IMPROVE AssertionError logging in pay_order()
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmax committed May 23, 2017
1 parent 624efbf commit cc8a44f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion FabLabKasse/shopping/backend/offline_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def delete_order_line(self, order_line_id):
# ==============================

def pay_order(self, method):
assert method.amount_paid - method.amount_returned == self.get_current_total()
assert method.amount_paid - method.amount_returned == self.get_current_total(), "Paid amount does not match current total. Payment method returned: {}, expected total: {}, current order: {} ".format(method, repr(self.get_current_total()), repr(self.get_order_lines()))
self._get_current_order_obj().set_finished()
self._store_payment(method)

Expand Down
2 changes: 1 addition & 1 deletion FabLabKasse/shopping/payment_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self, parent, shopping_backend, amount_to_pay, cfg):
self.receipt_order_id = shopping_backend.get_current_order()

def __repr__(self):
return "<{0}(amount_to_pay={1}, amount_paid={2}, amount_returned={3}, successful={4}, ...)>".format(type(self).__name__, self.amount_to_pay, self.amount_paid, self.amount_returned, self.successful)
return "<{0}(amount_to_pay={1}, amount_paid={2}, amount_returned={3}, successful={4}, ...)>".format(type(self).__name__, repr(self.amount_to_pay), repr(self.amount_paid), repr(self.amount_returned), self.successful)

@abstractmethod
def _show_dialog(self):
Expand Down

0 comments on commit cc8a44f

Please sign in to comment.