update gemfile stripe version to alpha
This commit is contained in:
@@ -159,7 +159,7 @@ gem 'working_hours'
|
||||
gem 'pg_search'
|
||||
|
||||
# Subscriptions, Billing
|
||||
gem 'stripe', '17.2.0.pre.beta.1'
|
||||
gem 'stripe', '17.2.0.pre.alpha.2'
|
||||
|
||||
## - helper gems --##
|
||||
## to populate db with sample data
|
||||
|
||||
+2
-2
@@ -902,7 +902,7 @@ GEM
|
||||
squasher (0.7.2)
|
||||
stackprof (0.2.25)
|
||||
statsd-ruby (1.5.0)
|
||||
stripe (17.2.0.pre.beta.1)
|
||||
stripe (17.2.0.pre.alpha.2)
|
||||
telephone_number (1.4.20)
|
||||
test-prof (1.2.1)
|
||||
thor (1.4.0)
|
||||
@@ -1110,7 +1110,7 @@ DEPENDENCIES
|
||||
spring-watcher-listen
|
||||
squasher
|
||||
stackprof
|
||||
stripe (= 17.2.0.pre.beta.1)
|
||||
stripe (= 17.2.0.pre.alpha.2)
|
||||
telephone_number
|
||||
test-prof
|
||||
tidewave
|
||||
|
||||
@@ -7,8 +7,12 @@ if resource.custom_attributes.present?
|
||||
json.subscription_status resource.custom_attributes['subscription_status']
|
||||
json.subscription_ends_on resource.custom_attributes['subscription_ends_on']
|
||||
json.stripe_subscription_id resource.custom_attributes['stripe_subscription_id'] if resource.custom_attributes['stripe_subscription_id'].present?
|
||||
json.pending_stripe_pricing_plan_id resource.custom_attributes['pending_stripe_pricing_plan_id'] if resource.custom_attributes['pending_stripe_pricing_plan_id'].present?
|
||||
json.pending_subscription_quantity resource.custom_attributes['pending_subscription_quantity'] if resource.custom_attributes['pending_subscription_quantity'].present?
|
||||
if resource.custom_attributes['pending_stripe_pricing_plan_id'].present?
|
||||
json.pending_stripe_pricing_plan_id resource.custom_attributes['pending_stripe_pricing_plan_id']
|
||||
end
|
||||
if resource.custom_attributes['pending_subscription_quantity'].present?
|
||||
json.pending_subscription_quantity resource.custom_attributes['pending_subscription_quantity']
|
||||
end
|
||||
json.stripe_pricing_plan_id resource.custom_attributes['stripe_pricing_plan_id'] if resource.custom_attributes['stripe_pricing_plan_id'].present?
|
||||
json.next_billing_date resource.custom_attributes['next_billing_date'] if resource.custom_attributes['next_billing_date'].present?
|
||||
json.industry resource.custom_attributes['industry'] if resource.custom_attributes['industry'].present?
|
||||
|
||||
@@ -67,7 +67,7 @@ module Enterprise::Api::V1::Accounts::Concerns::BillingV2
|
||||
service = Enterprise::Billing::V2::ChangePlanService.new(account: @account)
|
||||
result = service.change_plan(
|
||||
new_pricing_plan_id: params[:pricing_plan_id],
|
||||
quantity: params[:quantity].to_i
|
||||
quantity: params[:quantity]&.to_i
|
||||
)
|
||||
|
||||
if result[:success]
|
||||
|
||||
@@ -19,12 +19,8 @@ class Enterprise::Billing::CreateStripeCustomerService
|
||||
|
||||
def prepare_customer_id
|
||||
customer_id = account.custom_attributes['stripe_customer_id']
|
||||
test_clock = Stripe::TestHelpers::TestClock.create({
|
||||
frozen_time: Time.now.to_i,
|
||||
name: 'Test Clock for Account'
|
||||
})
|
||||
if customer_id.blank?
|
||||
customer = Stripe::Customer.create({ name: account.name, email: billing_email, test_clock: test_clock.id })
|
||||
customer = Stripe::Customer.create({ name: account.name, email: billing_email })
|
||||
customer_id = customer.id
|
||||
end
|
||||
customer_id
|
||||
|
||||
@@ -20,7 +20,7 @@ class Enterprise::Billing::V2::ChangePlanService < Enterprise::Billing::V2::Base
|
||||
|
||||
def validate_parameters(new_pricing_plan_id, quantity)
|
||||
return { success: false, message: 'Must specify either new_pricing_plan_id or quantity' } if new_pricing_plan_id.nil? && quantity.nil?
|
||||
return { success: false, message: 'Invalid quantity' } if quantity && !quantity.positive?
|
||||
return { success: false, message: 'Invalid quantity' } if !quantity.nil? && !quantity.positive?
|
||||
|
||||
# Validate customer has a default payment method using common service
|
||||
payment_service = Enterprise::Billing::V2::InvoicePaymentService.new(account: account)
|
||||
|
||||
@@ -12,7 +12,7 @@ class Enterprise::Billing::V2::CheckoutSessionService < Enterprise::Billing::V2:
|
||||
|
||||
validate_params
|
||||
store_pending_subscription_quantity
|
||||
session = create_checkout_session
|
||||
session = create_checkout_session(checkout_session_params)
|
||||
{ success: true, redirect_url: session.url }
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user