t523c: Block PayPal gateway at checkout when merchant status is invalid#734
Conversation
Completion Summary
This summary was written by the worker at PR creation time for the deterministic merge pass. |
When payments_receivable or email_confirmed is false for the connected OAuth merchant, remove the PayPal REST gateway from the active gateways list so customers cannot attempt a payment that PayPal would reject. - Add is_merchant_status_valid() to check both flags for the current mode - Add maybe_remove_for_invalid_merchant_status() filter callback hooked to wu_get_active_gateways (mirrors the existing currency check pattern) - Skip the check when no OAuth merchant is connected (manual credentials are unaffected) - Add 11 unit tests covering all flag combinations, live/sandbox modes, and the manual-credentials bypass Closes #729 Part of #725
808f5fa to
e81857b
Compare
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 17 minutes and 56 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 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: |
|
Performance Test Results Performance test results for dda8201 are in 🛎️! URL:
|
Closing SummaryWhat was done:
Testing Evidence: (self-assessed — medium risk, gateway filter only)
Key decisions:
Files changed: aidevops.sh v3.5.556 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 15m on this as a headless worker. |
Summary
Block the PayPal REST gateway from appearing at checkout when the connected OAuth merchant account has an invalid status (
payments_receivable=falseoremail_confirmed=false). Customers would otherwise see a PayPal option that silently fails.Changes
inc/gateways/class-paypal-rest-gateway.phpis_merchant_status_valid()— readspaypal_rest_{mode}_payments_receivableandpaypal_rest_{mode}_email_confirmedsettings; returnstruewhen no OAuth merchant is connected (manual credentials bypass)maybe_remove_for_invalid_merchant_status()— hooked towu_get_active_gateways, mirrors the existingmaybe_remove_for_unsupported_currencypatternhooks()tests/WP_Ultimo/Gateways/PayPal_REST_Gateway_Test.phpTesting
PayPal_REST_Gateway_Test: 103 tests, 169 assertions, 5 skipped (all pass)Runtime Testing
Risk level: Medium (gateway filter, no payment processing path). Verified via unit tests. No live PayPal environment available in CI.
Closes #729
Part of #725
aidevops.sh v3.5.556 plugin for OpenCode v1.3.0 with claude-sonnet-4-6 spent 10m on this as a headless worker.