Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 0a029bb

Browse files
fix: Cleanup
1 parent 24f0a7a commit 0a029bb

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

services/billing.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,7 @@ def delete_subscription(self, owner: Owner):
171171
)
172172
differenceFromNow = datetime.now() - current_subscription_datetime
173173

174-
subscription_plan_interval = (
175-
subscription.plan.interval if subscription.plan is not None else None
176-
)
174+
subscription_plan_interval = (getattr(getattr(subscription, "plan", None), "interval", None))
177175
within_refund_grace_period = (
178176
subscription_plan_interval == "month" and differenceFromNow.days < 1
179177
) or (subscription_plan_interval == "year" and differenceFromNow.days < 3)
@@ -215,7 +213,7 @@ def delete_subscription(self, owner: Owner):
215213
metadata={"autorefunds_remaining": str(autorefunds_remaining - 1)},
216214
)
217215
log.info(
218-
f"Autorefunded owner id #{owner.ownerid} for stripe id {owner.stripe_customer_id}. They have {str(autorefunds_remaining - 1)} remaining."
216+
f"Autorefunded owner id #{owner.ownerid} for stripe id #{owner.stripe_customer_id}. They have {str(autorefunds_remaining - 1)} remaining."
219217
)
220218
else:
221219
# outside of the grace period, we schedule a cancellation at the end of the period with no refund

0 commit comments

Comments
 (0)