adding braintree
This commit is contained in:
@@ -619,3 +619,19 @@ def get_transactions(start_date, end_date): # pragma: no cover
|
||||
|
||||
def mocktest(rower): # pragma: no cover
|
||||
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}")
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user