Skip to content

Instantly share code, notes, and snippets.

@Yenwod
Last active December 25, 2019 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yenwod/a3fa484c4b91429e86f412e535c2487b to your computer and use it in GitHub Desktop.
Save Yenwod/a3fa484c4b91429e86f412e535c2487b to your computer and use it in GitHub Desktop.
require 'platform-api'
namespace :heroku do
desc "set test webhook for Stripe based upon review-app url"
task update_stripe_test_webhook: :environment do
new_webhook_url = ""
heroku = PlatformAPI.connect_oauth('the-token-you-generated-via-README-instructions')
heroku.app.list.each do |app|
if app["name"].include?('vaxcalc-app-pattern-')
new_webhook_url = app["web_url"]
end
end
webhook_endpoints = Stripe::WebhookEndpoint.list
if webhook_endpoints.first.livemode == false
webhook_endpoints.first.url = new_webhook_url + 'stripe-webhook-path-defined-in-routes.rb'
webhook_endpoints.first.save
else
raise "rake task heroku:update_stripe_test_webhook should only work with TEST webhooks!"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment