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 support for pausing/resuming subscriptions #7548

Conversation

pauloiankoski
Copy link
Contributor

@pauloiankoski pauloiankoski commented Sep 23, 2024

Resolves GIVE-1250

Description

This Pull Request adds supports for gateways to implement their solutions for pausing/resuming subscriptions. Within this PR we are:

  • adding a new "paused" status to subscriptions;
  • setting a color for the "paused" status in the subscriptions list table;
  • adding a new SubscriptionPausable contract to be signed by gateways;
  • adding a capability check as can_pause to gateways (false by default if not implemented);
  • fixing the SubscriptionRepository to update the expiration date into the database;
  • updating the subscription details screen to show the next renewal date for paused subscriptions as it does for active ones.

This PR is a foundational work that is required for the new implementations on Give Recurring.

Affects

Subscriptions

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

use Give\Framework\PaymentGateways\Contracts\Subscription\SubscriptionPaymentMethodEditable;
use Give\Framework\PaymentGateways\Contracts\Subscription\SubscriptionResumable;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this still?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. That's a leftover.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking, everything seems to be in order with the UI and this work. This should be good to go! Would you prefer I make an epic for the UI & this or would you rather work off dev?

@JoshuaHungDinh JoshuaHungDinh self-requested a review September 24, 2024 15:12
Copy link
Contributor

@JoshuaHungDinh JoshuaHungDinh left a comment

Choose a reason for hiding this comment

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

Nice!

@jonwaldstein jonwaldstein changed the base branch from develop to epic/stripe-subscription-management September 24, 2024 20:11
@jonwaldstein
Copy link
Contributor

@pauloiankoski we decided to loosen the restriction on the SubscriptionPausable contract to receive an array of data instead of intervalInMonths - reason being want this to be flexible for other gateways and since this is our first gateway it's hard to predict what they will need.

@jonwaldstein jonwaldstein merged commit 89a15f3 into epic/stripe-subscription-management Sep 24, 2024
20 checks passed
@jonwaldstein jonwaldstein deleted the feature/pause-subscriptions-support branch September 24, 2024 21:39
@pauloiankoski
Copy link
Contributor Author

Cool. That's something I was in doubt. I see other methods receiving a generic $gatewayData array instead.

@jonwaldstein
Copy link
Contributor

@pauloiankoski yeah it's just hard to predict what params would be helpful for all gateways at this point, so i'd rather keep it flexible as changing signatures on contracts is painful 😄

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.

3 participants