Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
Add status for failed payments
Browse files Browse the repository at this point in the history
  • Loading branch information
emesik committed Apr 28, 2011
1 parent d57b520 commit 27e5ccb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Expand Up @@ -9,6 +9,6 @@ def payment_status_changed_listener(sender, instance=None, **kwargs):
if instance.status == 'confirmed':
variant.order.set_status('payment-complete')
elif instance.status == 'rejected':
variant.order.set_status('cancelled')
variant.order.set_status('payment-failed')

signals.status_changed.connect(payment_status_changed_listener)
2 changes: 2 additions & 0 deletions satchless/contrib/payment/mamona_provider/listeners.py
Expand Up @@ -5,6 +5,8 @@
def payment_status_changed_listener(sender, instance=None, old_status=None, new_status=None, **kwargs):
if new_status == 'paid':
instance.order.order.set_status('payment-complete')
elif new_status == 'failed':
instance.order.order.set_status('payment-failed')

def return_urls_query_listener(sender, instance=None, urls=None, **kwargs):
urls['failure'] = urls['paid'] = reverse(
Expand Down
1 change: 1 addition & 0 deletions satchless/order/models.py
Expand Up @@ -74,6 +74,7 @@ class Order(models.Model):
('checkout', _('undergoing checkout')),
('payment-pending', _('waiting for payment')),
('payment-complete', _('paid')),
('payment-failed', _('payment failed')),
('delivery', _('shipped')),
('cancelled', _('cancelled')),
)
Expand Down

0 comments on commit 27e5ccb

Please sign in to comment.