From 11ff2d4a5617572c8ce2015260ed4eff0a38857e Mon Sep 17 00:00:00 2001 From: Jerome Celle Date: Wed, 27 Nov 2019 08:53:55 +0100 Subject: [PATCH] Fix decimal error and add cost in orderline of reservation test --- retirement/tests/tests_viewset_Reservation.py | 3 ++- retirement/views.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/retirement/tests/tests_viewset_Reservation.py b/retirement/tests/tests_viewset_Reservation.py index e6278b65..8f450a8f 100644 --- a/retirement/tests/tests_viewset_Reservation.py +++ b/retirement/tests/tests_viewset_Reservation.py @@ -135,7 +135,8 @@ def setUp(self): order=self.order, quantity=1, content_type=self.retreat_type, - object_id=self.retreat.id + object_id=self.retreat.id, + cost=self.retreat.price ) self.reservation = Reservation.objects.create( user=self.user, diff --git a/retirement/views.py b/retirement/views.py index ed3931e2..506a396c 100644 --- a/retirement/views.py +++ b/retirement/views.py @@ -431,12 +431,12 @@ def destroy(self, request, *args, **kwargs): # Send an email if a refund has been issued if reservation_active and instance.cancelation_action == 'R': self.send_refund_confirmation_email( - amount=round(refund.amount - refund.amount * Decimal(TAX)), + amount=round(refund.amount - refund.amount * TAX, 2), retreat=retreat, order=order, user=user, total_amount=refund.amount, - amount_tax=round(refund.amount * Decimal(TAX), 2), + amount_tax=round(refund.amount * TAX, 2), ) return Response(status=status.HTTP_204_NO_CONTENT)