Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: add renewal methods to subscription model #7681

Merged
merged 4 commits into from
Jan 17, 2025

Conversation

jonwaldstein
Copy link
Contributor

@jonwaldstein jonwaldstein commented Jan 17, 2025

Description

This adds some quality of life methods to subscription model including:

  • createRenewal
  • shouldCreateRenewal
  • shouldEndSubscription

The goal is to unify the way we are dealing with renewals across our gateways.

I noticed throughout different gateways, we are duplicating a lot of the same logic for handling the renewals and are not consistent with the properties being used in the creation of the donation model. For example, sometimes we use the donor's first name vs the initial donation's billing first name, the billing address is not often accounted for, various properties are missing, etc.. With a unified api we can be consistent with the renewal values and which properties are being carried over from the subscription, initial donation, donor, invoice, etc.

This was largely inspired by a SubscriptionModelDecorator I created for Stripe webhooks which is being used in production.

There is also the webhook event handlers that @glaubersilva made that could make use of these methods directly.

Affects

This only introduces new logic to the subscription model and repositories, however will affect gateways in the future as they adopt these methods.

Visuals

N/A

Testing Instructions

  • Programmatically test the methods

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

@jonwaldstein jonwaldstein marked this pull request as ready for review January 17, 2025 15:54
@jonwaldstein jonwaldstein changed the title Feature: add quality of life methods to subscription model Feature: add renewal methods to subscription model Jan 17, 2025
Copy link
Contributor

@JasonTheAdams JasonTheAdams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is such a great addition, @jonwaldstein! Great call! 🎉

@jonwaldstein jonwaldstein merged commit 4e4ea75 into develop Jan 17, 2025
20 checks passed
@jonwaldstein jonwaldstein deleted the feature/subscription-renewal-methods branch January 17, 2025 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants