From eba12567e9f438113cbba1aa7f426397c82f3ea3 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Mon, 10 Nov 2025 19:15:20 +0530 Subject: [PATCH] cursor review commit fixes --- .../api/v1/accounts/concerns/billing_v2.rb | 2 +- .../enterprise/webhooks/stripe_controller.rb | 2 +- .../billing/handle_stripe_event_service.rb | 12 ------------ 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/enterprise/app/controllers/enterprise/api/v1/accounts/concerns/billing_v2.rb b/enterprise/app/controllers/enterprise/api/v1/accounts/concerns/billing_v2.rb index dc52958bd..c20c5f54c 100644 --- a/enterprise/app/controllers/enterprise/api/v1/accounts/concerns/billing_v2.rb +++ b/enterprise/app/controllers/enterprise/api/v1/accounts/concerns/billing_v2.rb @@ -34,7 +34,7 @@ module Enterprise::Api::V1::Accounts::Concerns::BillingV2 ) if result[:success] - render json: { success: true, redirect_url: result[:redirect_url], session_id: result[:session_id] } + render json: { success: true, redirect_url: result[:redirect_url] } else render json: { error: result[:message] }, status: :unprocessable_entity end diff --git a/enterprise/app/controllers/enterprise/webhooks/stripe_controller.rb b/enterprise/app/controllers/enterprise/webhooks/stripe_controller.rb index 7c248659d..0cc523889 100644 --- a/enterprise/app/controllers/enterprise/webhooks/stripe_controller.rb +++ b/enterprise/app/controllers/enterprise/webhooks/stripe_controller.rb @@ -44,6 +44,6 @@ class Enterprise::Webhooks::StripeController < ActionController::API def v2_billing_event?(event_type) Rails.logger.debug { "V2 billing event: #{event_type}" } - event_type.start_with?('v2.') + event_type.start_with?('v2.') if event_type.present? end end diff --git a/enterprise/app/services/enterprise/billing/handle_stripe_event_service.rb b/enterprise/app/services/enterprise/billing/handle_stripe_event_service.rb index 5343e9ef0..a1baa7b0f 100644 --- a/enterprise/app/services/enterprise/billing/handle_stripe_event_service.rb +++ b/enterprise/app/services/enterprise/billing/handle_stripe_event_service.rb @@ -105,22 +105,10 @@ class Enterprise::Billing::HandleStripeEventService return credits.to_i if credits.present? && credits.to_i.positive? end - # Fallback: extract from amount object - amount_data = extract_attribute(grant, :amount) - return 0 unless amount_data - 0 end def extract_attribute(object, attribute) object.respond_to?(attribute) ? object.public_send(attribute) : object[attribute.to_s] end - - def extract_amount_value(amount_data, unit_type) - unit = extract_attribute(amount_data, unit_type) - return 0 unless unit - - value = extract_attribute(unit, :value) - value.to_i - end end