Skip to content

Commit

Permalink
fixup! Replace Stripe Plan API with the Prices API
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Nov 12, 2024
1 parent e308d4a commit bd4aef5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
7 changes: 3 additions & 4 deletions app/models/alaveteli_pro/price.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ class AlaveteliPro::Price < SimpleDelegator
tax :unit_amount

def self.list
AlaveteliConfiguration.stripe_prices.inject([]) do |arr, (_key, id)|
arr << retrieve(id)
arr
AlaveteliConfiguration.stripe_prices.map do |(_key, id)|
retrieve(id)
end
end

Expand All @@ -21,7 +20,7 @@ def self.retrieve(id)
end

def to_param
AlaveteliConfiguration.stripe_prices[id]
AlaveteliConfiguration.stripe_prices[id] || id
end

# product
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,6 @@
let(:user) { FactoryBot.create(:pro_user) }

let!(:customer) do
price = stripe_helper.create_price(id: 'test', product: product.id)
customer = Stripe::Customer.create(
email: user.email,
source: stripe_helper.generate_card_token
Expand Down Expand Up @@ -822,8 +821,6 @@
context 'with a signed-in user' do
let(:user) { FactoryBot.create(:pro_user) }

let(:price) { stripe_helper.create_price(id: 'test', product: product.id) }

let(:customer) do
customer = Stripe::Customer.create({
email: user.email,
Expand Down
2 changes: 1 addition & 1 deletion spec/views/alaveteli_pro/plans/index.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

let(:stripe_price) do
stripe_helper.create_price(
id: 'pro', product: product.id, unit_amount: cents_price
id: 'price_123', product: product.id, unit_amount: cents_price
)
end

Expand Down

0 comments on commit bd4aef5

Please sign in to comment.