chore: Handle stripe events without plan data (#8668)

`plan` isn't a guaranteed object in stripe `customer.subscription.updated` events.  It can be null for cases like `send_invoice` for `past_due` event as seen in the payload shown in sentry error.

fixes: https://linear.app/chatwoot/issue/CW-2925/nomethoderror-undefined-method-[]-for-nilnilclass-nomethoderror
This commit is contained in:
Sojan Jose
2024-01-09 14:48:07 -08:00
committed by GitHub
parent 64138ef220
commit 5845881b08

View File

@@ -14,7 +14,8 @@ class Enterprise::Billing::HandleStripeEventService
private
def process_subscription_updated
plan = find_plan(subscription['plan']['product'])
plan = find_plan(subscription['plan']['product']) if subscription['plan'].present?
# skipping self hosted plan events
return if plan.blank? || account.blank?