Permalink
Browse files

Handling Paypal account cancellations better.

  • Loading branch information...
1 parent 43161f7 commit 8b95849a336dc41533fd86f5433bd70858c22739 @samuelclay committed Feb 19, 2014
Showing with 7 additions and 3 deletions.
  1. +7 −3 apps/profile/models.py
@@ -28,6 +28,7 @@
from vendor.paypal.standard.ipn.signals import subscription_signup, payment_was_successful
from vendor.paypal.standard.ipn.models import PayPalIPN
from vendor.paypalapi.interface import PayPalInterface
+from vendor.paypalapi.exceptions import PayPalAPIResponseError
from zebra.signals import zebra_webhook_customer_subscription_created
from zebra.signals import zebra_webhook_charge_succeeded
@@ -314,9 +315,12 @@ def cancel_premium_paypal(self):
paypal = PayPalInterface(**paypal_opts)
transaction = transactions[0]
profileid = transaction.subscr_id
- paypal.manage_recurring_payments_profile_status(profileid=profileid, action='Cancel')
-
- logging.user(self.user, "~FRCanceling Paypal subscription")
+ try:
+ paypal.manage_recurring_payments_profile_status(profileid=profileid, action='Cancel')
+ except PayPalAPIResponseError:
+ logging.user(self.user, "~FRUser ~SBalready~SN canceled Paypal subscription")
+ else:
+ logging.user(self.user, "~FRCanceling Paypal subscription")
return True

0 comments on commit 8b95849

Please sign in to comment.