Private
Public Access
1
0

adding braintree

This commit is contained in:
2025-12-20 13:21:51 +01:00
parent d14e11b6c4
commit da9aef5c65
2 changed files with 16 additions and 0 deletions

View File

@@ -619,3 +619,19 @@ def get_transactions(start_date, end_date): # pragma: no cover
def mocktest(rower): # pragma: no cover def mocktest(rower): # pragma: no cover
return '5' return '5'
def cancel_braintree_subscriptions(gateway):
"""
Cancel all Braintree subscriptions for Rowers, ensuring they run to the end of the current billing period.
"""
rowers = Rower.objects.exclude(subscription_id__isnull=True)
for rower in rowers:
subscription_id = rower.subscription_id
try:
result = gateway.subscription.cancel(subscription_id)
if result.is_success:
print(f"✅ Subscription {subscription_id} for Rower {rower.id} will not renew.")
else:
print(f"❌ Failed to cancel subscription {subscription_id}: {result.message}")
except Exception as e:
print(f"🚨 Error processing subscription {subscription_id}: {e}")

Binary file not shown.