Skip to content
This repository
  • 3 commits
  • 7 files changed
  • 0 comments
  • 1 contributor
1  satchless/contrib/checkout/full/views.py
@@ -116,4 +116,5 @@ def confirmation(request):
116 116 except ConfirmationFormNeeded, e:
117 117 return direct_to_template(request, 'satchless/checkout/confirmation.html',
118 118 {'order': order, 'formdata': e})
  119 + order.set_status('payment-complete')
119 120 return redirect('satchless-order-view', order.pk)
8 satchless/contrib/payment/django_payments_provider/__init__.py
... ... @@ -1,7 +1,7 @@
1 1 from django.conf import settings
2 2 import payments
3 3
4   -from satchless.payment import PaymentProvider
  4 +from satchless.payment import PaymentProvider, ConfirmationFormNeeded
5 5 from . import models
6 6
7 7 class DjangoPaymentsProvider(PaymentProvider):
@@ -20,10 +20,8 @@ def get_variant(self, order, typ, form):
20 20 .create(payment=payment, order=order, price=0)
21 21 return payment_variant
22 22
23   - def get_confirmation_formdata(self, order):
  23 + def confirm(self, order):
24 24 form = order.paymentvariant.get_subtype_instance().payment.get_form()
25   - return {'form': form,
26   - 'action': form.action,
27   - 'method': form.method}
  25 + raise ConfirmationFormNeeded(form, form.action, form.method)
28 26
29 27 provider = DjangoPaymentsProvider()
2  satchless/contrib/payment/django_payments_provider/listeners.py
@@ -9,6 +9,6 @@ def payment_status_changed_listener(sender, instance=None, **kwargs):
9 9 if instance.status == 'confirmed':
10 10 variant.order.set_status('payment-complete')
11 11 elif instance.status == 'rejected':
12   - variant.order.set_status('cancelled')
  12 + variant.order.set_status('payment-failed')
13 13
14 14 signals.status_changed.connect(payment_status_changed_listener)
6 satchless/contrib/payment/mamona_provider/__init__.py
... ... @@ -1,7 +1,6 @@
1   -from django.conf import settings
2 1 from mamona.utils import get_backend_choices
3 2
4   -from satchless.payment import PaymentProvider
  3 +from satchless.payment import PaymentProvider, ConfirmationFormNeeded
5 4 from . import models
6 5
7 6 class MamonaProvider(PaymentProvider):
@@ -18,6 +17,7 @@ def get_variant(self, order, typ, form):
18 17
19 18 def get_confirmation_formdata(self, order):
20 19 payment = order.paymentvariant.get_subtype_instance().payments.get()
21   - return payment.get_processor().get_confirmation_form(payment)
  20 + form = payment.get_processor().get_confirmation_form(payment)
  21 + raise ConfirmationFormNeeded(**form)
22 22
23 23 provider = MamonaProvider()
2  satchless/contrib/payment/mamona_provider/listeners.py
@@ -5,6 +5,8 @@
5 5 def payment_status_changed_listener(sender, instance=None, old_status=None, new_status=None, **kwargs):
6 6 if new_status == 'paid':
7 7 instance.order.order.set_status('payment-complete')
  8 + elif new_status == 'failed':
  9 + instance.order.order.set_status('payment-failed')
8 10
9 11 def return_urls_query_listener(sender, instance=None, urls=None, **kwargs):
10 12 urls['failure'] = urls['paid'] = reverse(
4 satchless/order/handler.py
@@ -63,9 +63,7 @@ def get_payment_variant(order, typ, form):
63 63
64 64 def confirm(order, typ):
65 65 provider, typ_short = get_payment_provider(typ)
66   - result = provider.confirm(order)
67   - order.set_status('payment-complete')
68   - return result
  66 + return provider.confirm(order)
69 67
70 68 def init_queues():
71 69 global _partitioners_queue
1  satchless/order/models.py
@@ -74,6 +74,7 @@ class Order(models.Model):
74 74 ('checkout', _('undergoing checkout')),
75 75 ('payment-pending', _('waiting for payment')),
76 76 ('payment-complete', _('paid')),
  77 + ('payment-failed', _('payment failed')),
77 78 ('delivery', _('shipped')),
78 79 ('cancelled', _('cancelled')),
79 80 )

No commit comments for this range

Something went wrong with that request. Please try again.