Repository navigation
fix(payments): G2A-CRIT-001 follow-up — cancel preflight on PATCH and Woo paths - #15
Merged
Merged
Conversation
G2A-CRIT-001 follow-up: gate PATCH /memberships/{id} status=cancelled
and WooCommerce refund/cancel through cancel_remote_first() before local
status flips, matching the dedicated cancel endpoint and wp-admin cancel.
PATCH accepts optional force=true; Woo always proceeds locally after the
Stripe attempt because the refund has already happened.
The clean-install/upgrade workflow still expected memberistic-2.1.1.zip after the 2.2.0 release, so the version assertion failed on main and on this PR. Update build/assert/install pins to 2.2.0; upgrade smoke still starts from public v2.1.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Closes the remaining G2A-CRIT-001 cancel gaps identified against public Memberistic v2.2.0: the dedicated
POST .../cancelendpoint and wp-admin cancel already calledStripe_Service::cancel_remote_first(), but two paths still flipped local status first (or skipped Stripe entirely).Changes
Memberships_Controller::update_item(PATCH/memberships/{id})When
statuschanges tocancelled, callcancel_remote_first()beforechange_status(). On Stripe failure return502 memberistic_stripe_cancel_failedunlessforce=true(same behaviour/message as the dedicated cancel endpoint). Registers optionalforceboolean arg.WooCommerce_Bridge::sync_refunded_orderBefore
dispatch_order(..., 'refunded'), resolve_memberistic_membership_idand callcancel_remote_first(). Local cancel via the payment-integrity gate always proceeds afterward (Woo refund already happened). Needed because the gate firesmemberistic_membership_status_changedwith the inbound-event flag set, which skips the post-hoc Stripe listener.CHANGELOG —
Unreleased/ Fixed entry. No version bump or tag.Tests
find . -name '*.php' ... | xargs php -l— exit 0 (PHP 8.4)php tests/licensing.php— 8 checks passedtests/licensing.php+ CI PHP lint)Risks / notes
cancel_remote_first.forcewill refuse cancel if Stripe fails — callers that previously used PATCH to cancel must handle 502 or use/cancel/force=true.