Fix issue in Stripe event handling#495
Conversation
WalkthroughThe Stripe event controller now uses boolean return values from event handlers to control processing flow. Previously void-returning handlers have been refactored to return booleans, allowing the event dispatcher to short-circuit and skip standard processing when an event is handled. All major handler methods consistently signal success or failure through explicit returns. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip CodeRabbit can generate a title for your PR based on the changes.Add |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
includes/gateways/stripe/controllers/classStrpEventsController.php (2)
197-197: Drop unused$subscriptionparameter fromprocess_invoice_payment_failed().Line 225 does not use
$subscription, and this private API can be simplified to reduce noise.Refactor diff
- return $this->process_invoice_payment_failed( $subscription, $parent_payment ); + return $this->process_invoice_payment_failed( $parent_payment ); - private function process_invoice_payment_failed( $subscription, $parent_payment ) { + private function process_invoice_payment_failed( $parent_payment ) {Also applies to: 225-225
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@includes/gateways/stripe/controllers/classStrpEventsController.php` at line 197, The private method process_invoice_payment_failed currently accepts an unused $subscription parameter; remove $subscription from its signature and all call sites (e.g., change $this->process_invoice_payment_failed( $subscription, $parent_payment ) to $this->process_invoice_payment_failed( $parent_payment )), update the method definition to accept only $parent_payment, and adjust the method body and any docblock/type hints accordingly to reflect the single parameter.
294-299: Tighten return-doc semantics forprocess_payment_intent().The method returns
truenot only when a payment is found, but also when the intent is intentionally ignored (e.g., manual confirmation). The@returntext should reflect that broader meaning.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@includes/gateways/stripe/controllers/classStrpEventsController.php` around lines 294 - 299, Update the docblock for process_payment_intent() to reflect its broader return semantics: it returns true both when a payment is found on this site and when the intent is intentionally ignored (e.g., missing invoice id or 'manual' confirmation_method). Edit the `@return` description in the comment above process_payment_intent() to state that true indicates either a found/handled payment or an intentionally ignored intent, and false indicates the payment was not found/handled.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@includes/gateways/stripe/controllers/classStrpEventsController.php`:
- Line 197: The private method process_invoice_payment_failed currently accepts
an unused $subscription parameter; remove $subscription from its signature and
all call sites (e.g., change $this->process_invoice_payment_failed(
$subscription, $parent_payment ) to $this->process_invoice_payment_failed(
$parent_payment )), update the method definition to accept only $parent_payment,
and adjust the method body and any docblock/type hints accordingly to reflect
the single parameter.
- Around line 294-299: Update the docblock for process_payment_intent() to
reflect its broader return semantics: it returns true both when a payment is
found on this site and when the intent is intentionally ignored (e.g., missing
invoice id or 'manual' confirmation_method). Edit the `@return` description in the
comment above process_payment_intent() to state that true indicates either a
found/handled payment or an intentionally ignored intent, and false indicates
the payment was not found/handled.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 03ff2d7a-6f12-4d19-b579-a56ce7dd7dc6
📒 Files selected for processing (1)
includes/gateways/stripe/controllers/classStrpEventsController.php
Check if the event needs to be handled before processing the event.