cursor review commit fixes

This commit is contained in:
Tanmay Deep Sharma
2025-11-10 19:15:20 +05:30
parent d230bb68d0
commit eba12567e9
3 changed files with 2 additions and 14 deletions
@@ -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
@@ -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
@@ -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