Skip to content
Browse files

Added 3 more recurring payment signals.

  • Loading branch information...
1 parent 2fe1afe commit e43f73431092afb725e1dbb30d2beaab3c6725d3 David Cramer committed Aug 24, 2009
Showing with 20 additions and 5 deletions.
  1. +4 −1 README.md
  2. +9 −3 pro/helpers.py
  3. +7 −1 standard/ipn/signals.py
View
5 README.md
@@ -91,9 +91,12 @@ Using PayPal Payments Standard IPN:
- `subscription_modify` - Sent when a subscription is modified.
- `subscription_signup` - Sent when a subscription is created.
- Two more for recurring payments:
+ Several more exist for recurring payments:
- `recurring_create` - Sent when a recurring payment is created.
- `recurring_payment` - Sent when a payment is received from a recurring payment.
+ - `recurring_cancel` - Sent when a recurring payment is cancelled.
+ - `recurring_suspend` - Sent when a recurring payment is suspended.
+ - `recurring_reactivate` - Sent when a recurring payment is reactivated.
Connect to these signals and update your data accordingly. [Django Signals Documentation](http://docs.djangoproject.com/en/dev/topics/signals/).
View
12 pro/helpers.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# XXX: should these methods handle signals, rather than views?
import datetime
import pprint
@@ -13,6 +12,7 @@
from django.utils.datastructures import MergeDict
from django.utils.http import urlencode
+from paypal.pro.signals import *
from paypal.pro.models import PayPalNVP, L
@@ -148,8 +148,14 @@ def manangeRecurringPaymentsProfileStatus(self, params):
nvp_obj = self._fetch(params, required, defaults)
- # XXX: should we create signals for this since it doesn't happen via IPN?
-
+ if not nvp_obj.flag:
+ if params['action'] == 'Cancel':
+ recurring_cancel.send(sender=nvp_obj)
+ elif params['action'] == 'Suspend':
+ recurring_suspend.send(sender=nvp_obj)
+ elif params['action'] == 'Reactivate':
+ recurring_reactivate.send(sender=nvp_obj)
+
return nvp_obj
def refundTransaction(self, params):
View
8 standard/ipn/signals.py
@@ -28,4 +28,10 @@
recurring_create = Signal()
# recurring_payment
-recurring_payment = Signal()
+recurring_payment = Signal()
+
+recurring_cancel = Signal()
+
+recurring_suspend = Signal()
+
+recurring_reactivate = Signal()

0 comments on commit e43f734

Please sign in to comment.
Something went wrong with that request. Please try again.