Skip to content

Commit

Permalink
fixup! Add task to migration subscription to new prices
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Nov 18, 2024
1 parent bd4aef5 commit dc79b89
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/tasks/subscriptions.rake
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace :subscriptions do
end

def load_prices
old_price = AlaveteliPro::Price.retrieve(ENV['OLD_PRICE']) if ENV['OLD_PRICE']
new_price = AlaveteliPro::Price.retrieve(ENV['NEW_PRICE']) if ENV['NEW_PRICE']
old_price = Stripe::Price.retrieve(ENV['OLD_PRICE']) if ENV['OLD_PRICE']
new_price = Stripe::Price.retrieve(ENV['NEW_PRICE']) if ENV['NEW_PRICE']

if !old_price
puts "ERROR: Can't find OLD_PRICE"
Expand All @@ -35,6 +35,9 @@ namespace :subscriptions do
elsif old_price.recurring != new_price.recurring
puts "ERROR: Price interval and interval_count need to match"
exit 1
elsif !AlaveteliPro::Price.list.map(&:id).include?(new_price.id)
puts "ERROR: New price is not defined in general.yml"
exit 1
end

[old_price, new_price]
Expand Down

0 comments on commit dc79b89

Please sign in to comment.