fix(stripe): handle Basil invoice subscription references - #1838
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 2 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Stripe gateway now pins API requests and webhook endpoints to ChangesStripe gateway updates
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Stripe requests and newly created webhook endpoints now use the Basil API version, while invoice webhooks support both legacy and Basil subscription references. Existing endpoint settings are preserved, and no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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: |
🔨 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: |
Summary
Handle the Stripe Basil invoice subscription reference and explicitly pin outgoing Stripe requests and newly created webhook endpoints to
2025-08-27.basil.Basil places the invoice subscription reference under
parent.subscription_details.subscription; looking only at the legacy top-level field can leave an existing membership payment pending after settlement. The pin makes the integration's chosen version independent of future Stripe SDK defaults. It matches the default in the currently bundled SDK; this is not an intentional API upgrade.Changes and review scope
inc/gateways/class-base-stripe-gateway.php: resolve legacy or nested invoice subscription references, normalize expanded objects to their ID, and retrieve subscriptions only for nonempty string IDs.STRIPE_API_VERSIONconstant (2025-08-27.basil), used as the client'sstripe_versionand the webhookapi_versionin both OAuth and direct-key creation paths.tests/WP_Ultimo/Gateways/Stripe_Webhook_Process_Test.php: existing five-case invoice-reference regression, covering legacy/Basil IDs and expanded objects plus absent reference.tests/WP_Ultimo/Gateways/Stripe_API_Version_Test.php: direct/OAuth client configuration for both Stripe gateways, both new-endpoint creation paths, and preservation of existing enabled/disabled endpoints.Verification
For added pin commit
a20cb1ce:vendor/bin/phpunit --no-coverage --filter Stripe_API_Version_Testpassed: 10 tests / 14 assertions. No real Stripe requests are made by these tests.git diff --checkpassed.Stripe_Webhook_Process_Test.php:66(wu_create_customer()returnedWP_Error, assigned to a typed Customer property). Those reruns did not establish invoice-test success. The initial PR's isolated fixture run was reported as 5 tests / 25 assertions; it is separate evidence, not a claim that the latest combined local run passed.Reproduction commands with the WordPress multisite test environment configured:
No live charge, remote endpoint migration, release, or production deployment is part of this PR. Public webhook delivery and complete payment-provider sandbox flows remain separate integration checks. Existing installations may continue delivering older event shapes, so retain backward-compatible parsing.
aidevops.sh v3.32.317 plugin for OpenCode v1.18.30 with gpt-6-astra spent 7h 53m and 603,926 tokens on this with the user in an interactive session.
Summary by CodeRabbit
Bug Fixes
Improvements