Skip to content

Conversation

lucasdotvin
Copy link
Owner

This pull request refines subscription handling by improving the logic for expiration and overdue status, and adds corresponding test cases to ensure correctness. The key changes include adjustments to how expiration dates are determined, handling of overdue status, and new tests to validate these behaviors.

Subscription expiration logic improvements:

  • Updated subscribeTo method in HasSubscriptions.php to set expiration to null explicitly if the plan lacks periodicity, and adjusted grace days calculation to account for the absence of expiration.

Overdue status handling:

  • Modified getIsOverdueAttribute in Subscription.php to return false if the subscription has no expiration date, ensuring overdue logic is only applied when relevant.

New test cases:

  • Added testItUsesReceivedExpirationEvenIfThePlanHasNoPeriodicity in HasSubscriptionsTest.php to verify that an explicitly provided expiration date is respected even when the plan lacks periodicity.
  • Added testModelDoesNotRegisterOverdueIfThereIsNoExpiration in SubscriptionTest.php to confirm that overdue status is not marked if the subscription has no expiration date.

@lucasdotvin lucasdotvin self-assigned this Jul 22, 2025
@lucasdotvin lucasdotvin added bug Something isn't working enhancement New feature or request labels Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant