diff --git a/lib/tasks/subscriptions.rake b/lib/tasks/subscriptions.rake index 41bfe7201c..6d083df99a 100644 --- a/lib/tasks/subscriptions.rake +++ b/lib/tasks/subscriptions.rake @@ -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" @@ -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]