forked from GithubBackups/healthchecks
Don't delete customer data in braintree when closing account.
Need customer data to stay in braintree until the end of each month for tax reports.
This commit is contained in:
parent
b8cf428899
commit
f51a0a257e
@ -31,9 +31,6 @@ class CloseAccountTestCase(BaseTestCase):
|
||||
# Subscription should have been canceled
|
||||
self.assertTrue(mock_braintree.Subscription.cancel.called)
|
||||
|
||||
# Braintree customer should have been deleted
|
||||
self.assertTrue(mock_braintree.Customer.delete.called)
|
||||
|
||||
# Subscription should be gone
|
||||
self.assertFalse(Subscription.objects.exists())
|
||||
|
||||
|
@ -472,10 +472,10 @@ def unsubscribe_reports(request, signed_username):
|
||||
def close(request):
|
||||
user = request.user
|
||||
|
||||
# Subscription needs to be canceled before it is deleted:
|
||||
# Cancel their subscription:
|
||||
sub = Subscription.objects.filter(user=user).first()
|
||||
if sub:
|
||||
sub.cancel(delete_customer=True)
|
||||
sub.cancel()
|
||||
|
||||
user.delete()
|
||||
|
||||
|
@ -136,15 +136,11 @@ class Subscription(models.Model):
|
||||
|
||||
return result
|
||||
|
||||
def cancel(self, delete_customer=False):
|
||||
def cancel(self):
|
||||
if self.subscription_id:
|
||||
braintree.Subscription.cancel(self.subscription_id)
|
||||
self.subscription_id = ""
|
||||
|
||||
if self.customer_id and delete_customer:
|
||||
braintree.Customer.delete(self.customer_id)
|
||||
self.customer_id = ""
|
||||
|
||||
self.plan_id = ""
|
||||
self.plan_name = ""
|
||||
self.save()
|
||||
|
Loading…
x
Reference in New Issue
Block a user