fix cursor review comments

This commit is contained in:
Tanmay Deep Sharma
2025-11-05 13:16:36 +05:30
parent eb04882e5a
commit 35f42e71f6
5 changed files with 4 additions and 21 deletions
@@ -53,7 +53,7 @@ module Enterprise::Api::V1::Accounts::Concerns::BillingV2
)
if result[:success]
render json: { success: true, redirect_url: result[:redirect_url], checkout_session_id: result[:checkout_session_id] }
render json: { success: true, redirect_url: result[:redirect_url], session_id: result[:session_id] }
else
render json: { error: result[:message] }, status: :unprocessable_entity
end
@@ -50,10 +50,4 @@ class Enterprise::Billing::V2::BaseService
def with_locked_account(&)
account.with_lock(&)
end
def with_stripe_error_handling
yield
rescue Stripe::StripeError => e
{ success: false, message: e.message }
end
end
@@ -32,8 +32,7 @@ class Enterprise::Billing::V2::CreditManagementService < Enterprise::Billing::V2
return [] if customer_id.blank?
response = Stripe::Billing::CreditGrant.list(
{ customer: customer_id, limit: 100 },
stripe_api_options
{ customer: customer_id, limit: 100 }
)
grants = response.data.map do |grant|
@@ -87,8 +86,4 @@ class Enterprise::Billing::V2::CreditManagementService < Enterprise::Billing::V2
def stripe_customer_id
custom_attribute('stripe_customer_id')
end
def stripe_api_options
{ api_key: ENV.fetch('STRIPE_SECRET_KEY', nil), stripe_version: '2025-08-27.preview' }
end
end
@@ -93,11 +93,10 @@ module Enterprise::Billing::V2::PlanCatalog
}
end
def rate_card_component(definition)
def rate_card_component(_definition)
{
type: 'rate_card',
name: 'Overage Rate',
overage_rate: definition[:overage_rate],
rate_unit: CREDIT_UNIT,
meter_id: nil
}
@@ -102,8 +102,7 @@ class Enterprise::Billing::V2::TopupService < Enterprise::Billing::V2::BaseServi
# Following Stripe UBB Integration Guide section 8
def create_stripe_credit_grant(amount_cents, currency, credits)
Stripe::Billing::CreditGrant.create(
credit_grant_params(amount_cents, currency, credits),
stripe_api_options
credit_grant_params(amount_cents, currency, credits)
)
end
@@ -149,8 +148,4 @@ class Enterprise::Billing::V2::TopupService < Enterprise::Billing::V2::BaseServi
def stripe_customer_id
custom_attribute('stripe_customer_id')
end
def stripe_api_options
{ api_key: ENV.fetch('STRIPE_SECRET_KEY', nil), stripe_version: '2025-08-27.preview' }
end
end