Refactor: update Stripe subscription model decorator to use subscription model methods directly #7696
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #
Description
This pull request includes changes to the
SubscriptionModelDecorator
class and its related tests to simplify the code and improve maintainability. The most important changes include the removal of unused imports, updating methods to use model methods, and refactoring the test cases.Code simplification and maintainability improvements:
src/PaymentGateways/Gateways/Stripe/StripePaymentElementGateway/Webhooks/Decorators/SubscriptionModelDecorator.php
: Removed unused imports to clean up the code.src/PaymentGateways/Gateways/Stripe/StripePaymentElementGateway/Webhooks/Decorators/SubscriptionModelDecorator.php
: UpdatedshouldEndSubscription
,shouldCreateRenewal
, andhandleRenewal
methods to use model methods for better encapsulation and maintainability.tests/Feature/Gateways/Stripe/StripePaymentElement/Webhooks/Listeners/InvoicePaymentSucceededTest.php
: Refactored thetestShouldCompleteSubscription
method to remove unnecessary caching of donations.tests/Feature/Gateways/Stripe/StripePaymentElement/Webhooks/Listeners/InvoicePaymentSucceededTest.php
: Updated assertions to use thetotalDonations
method for clarity and accuracy.Affects
The logic for handling the Stripe subscription webhook listener
InvoicePaymentSucceeded
Visuals
N/A
Testing Instructions
QA
Pre-review Checklist
@unreleased
tags included in DocBlocks