Repository navigation
fix: recover outstanding invoices on active memberships - #1976
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing: 4
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Performance Test Results Performance test results for 1a9362f are in 🛎️! |
Recovered invoice line items were re-run through add_line_item(), which re-applied the coupon at its current base-currency value: a EUR 19.64 invoice (EUR 31.24 less a EUR 11.60 fixed coupon) became USD 18.24. Payable invoices now keep their stored line items, discounts and taxes. The order summary no longer offers Remove links for products or coupons on a retry (invoice) order, since an issued invoice cannot be edited.
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Tested end to end against a local copy of production data with the real case behind this PR: membership #26, invoice #354, EUR 19.64, which is EUR 31.24 less a fixed coupon converted to EUR 11.60. Two follow-up commits were added:
Verification:
aidevops.sh v3.39.36 plugin for OpenCode |
Summary
retry, not fall through into a new signup or conflicting-payment cancellation.Payment::is_payable()and the native payment URL API. Completed/cancelled payment handling and ownership checks remain unchanged.Files and reference pattern
inc/checkout/class-cart.php: retain the existing ownership-checkedbuild_from_payment()recovery path regardless of membership activation.tests/WP_Ultimo/Checkout/Cart_Payment_Recovery_Test.php: cover active/pending/trialing recovery, failed invoices, unchanged identities/status, EUR totals and recurring-payment eligibility. Explicitly clean custom-table fixtures.tests/WP_Ultimo/Gateways/Stripe_Gateway_Process_Checkout_Test.php: exercise the real recovered cart with mocked Stripe services; assert settlement links a subscription, enables auto-renewal and sets a future expiration on the original membership.Verification
vendor/bin/phpstan analyse inc/checkout/class-cart.php --memory-limit=1G --no-progresspasses.vendor/bin/phpunit --no-coverage --filter 'Stripe_Gateway_Process_Checkout_Test|Cart_Payment_Recovery_Test|Cart_Coverage_Test::test_build_from_payment|Cart_Test::.*trial': 20 tests, 115 assertions passed. Stripe services are mocked; the recovery test asserts subscription linkage, auto-renewal and a future expiration on the same membership.Deployment coordination
Pair with the Multinetwork hosting-account change exposing owner-scoped native invoice checkout links:
https://github.com/Ultimate-Multisite/ultimate-multisite-multinetwork/pull/56
Deploy the core recovery fix before exposing those links; otherwise an active membership's invoice can still take the wrong cart path. No release or production deployment is authorized by this PR.
aidevops.sh v3.39.27 plugin for OpenCode