Skip to content

Commit

Permalink
Handling Paypal account cancellations better.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelclay committed Feb 19, 2014
1 parent 43161f7 commit 8b95849
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apps/profile/models.py
Expand Up @@ -28,6 +28,7 @@
from vendor.paypal.standard.ipn.signals import subscription_signup, payment_was_successful from vendor.paypal.standard.ipn.signals import subscription_signup, payment_was_successful
from vendor.paypal.standard.ipn.models import PayPalIPN from vendor.paypal.standard.ipn.models import PayPalIPN
from vendor.paypalapi.interface import PayPalInterface 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_customer_subscription_created
from zebra.signals import zebra_webhook_charge_succeeded from zebra.signals import zebra_webhook_charge_succeeded


Expand Down Expand Up @@ -314,9 +315,12 @@ def cancel_premium_paypal(self):
paypal = PayPalInterface(**paypal_opts) paypal = PayPalInterface(**paypal_opts)
transaction = transactions[0] transaction = transactions[0]
profileid = transaction.subscr_id profileid = transaction.subscr_id
paypal.manage_recurring_payments_profile_status(profileid=profileid, action='Cancel') try:

paypal.manage_recurring_payments_profile_status(profileid=profileid, action='Cancel')
logging.user(self.user, "~FRCanceling Paypal subscription") except PayPalAPIResponseError:
logging.user(self.user, "~FRUser ~SBalready~SN canceled Paypal subscription")
else:
logging.user(self.user, "~FRCanceling Paypal subscription")


return True return True


Expand Down

0 comments on commit 8b95849

Please sign in to comment.