Fix #751 -- calculate payment fees in OrderChangeManager (#752)

* check for payment method instead of order total

* incorporate payment fee diff in totaldiff at oder change

* use fee from model and the correct order total

* add error handling

* do not change paid orders

* OrderChangedManager can only be committed once

* remove prints of stripe secrets

* add tests

* an OrderChangeManager must not be committed multiple times
* A pending free order stays pending after being changed

* comments on paid_to_free logic
This commit is contained in:
Felix Rindt
2018-01-22 12:53:46 +01:00
committed by Raphael Michel
parent 817038563f
commit 78b31149b5
3 changed files with 56 additions and 6 deletions

View File

@@ -204,7 +204,6 @@ class ReturnView(StripeOrderView, View):
prov = self.pprov
prov._init_api()
src = stripe.Source.retrieve(request.GET.get('source'))
print(src.client_secret, request.GET.get('client_secret'))
if src.client_secret != request.GET.get('client_secret'):
messages.error(self.request, _('Sorry, there was an error in the payment process. Please check the link '
'in your emails to continue.'))
@@ -232,7 +231,6 @@ class ReturnView(StripeOrderView, View):
return self._redirect_to_order()
def _redirect_to_order(self):
print(self.request.session.get('payment_stripe_order_secret'), self.order.secret)
if self.request.session.get('payment_stripe_order_secret') != self.order.secret:
messages.error(self.request, _('Sorry, there was an error in the payment process. Please check the link '
'in your emails to continue.'))