1
0
Fork 0
forked from OpenNeo/impress

Remove references to the Stripe gem

Rather than figure out how to upgrade the Stripe gem to be compatible with future Rails, I'd rather just delete the references, since it's currently unused.

I'm not so bold as to go in and fully trash all our donation code; I just want to ensure we're not sending people down broken codepaths, and that if they reach them, the error messages are clear enough.
This commit is contained in:
Matchu 2023-07-21 18:54:15 -07:00
parent 9cb71da77c
commit 7f8f7e624d
4 changed files with 70 additions and 59 deletions

View file

@ -69,8 +69,6 @@ gem 'rack-attack', '~> 2.2.0'
gem 'react-rails', '~> 0.8.0.0' gem 'react-rails', '~> 0.8.0.0'
gem 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem "letter_opener", :group => :development gem "letter_opener", :group => :development
gem 'sass-rails', "~> 3.2.6" gem 'sass-rails', "~> 3.2.6"

View file

@ -35,14 +35,6 @@ GIT
specs: specs:
RocketAMF (1.0.0) RocketAMF (1.0.0)
GIT
remote: https://github.com/stripe/stripe-ruby
revision: 8c6dc1a838db0d39d9083431f6a4a8287f25d814
specs:
stripe (1.23.0)
json (~> 1.8.1)
rest-client (~> 1.4)
GEM GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
@ -335,7 +327,6 @@ DEPENDENCIES
rvm-capistrano (~> 1.5.6) rvm-capistrano (~> 1.5.6)
sanitize (~> 2.0.3) sanitize (~> 2.0.3)
sass-rails (~> 3.2.6) sass-rails (~> 3.2.6)
stripe!
swf_converter (~> 0.0.3) swf_converter (~> 0.0.3)
uglifier (>= 1.0.3) uglifier (>= 1.0.3)
whenever (~> 0.7.3) whenever (~> 0.7.3)

View file

@ -6,7 +6,8 @@
toward #{@current_campaign.purpose}. toward #{@current_campaign.purpose}.
Thanks so much! Thanks so much!
= form_tag donations_path, method: 'POST', id: 'donation-form', -# TODO: Reinstall Stripe before showing the checkout form
= form_tag donations_path, method: 'POST', id: 'donation-form',
'data-checkout-image' => image_path('default_preview.png'), 'data-checkout-image' => image_path('default_preview.png'),
'data-checkout-publishable-key' => Rails.configuration.stripe[:publishable_key], 'data-checkout-publishable-key' => Rails.configuration.stripe[:publishable_key],
'data-campaign-theme' => @current_campaign.theme_id do 'data-campaign-theme' => @current_campaign.theme_id do

View file

@ -1,6 +1,27 @@
# TODO: Upgrade Stripe to be usable again, or remove references altogether
Rails.configuration.stripe = { Rails.configuration.stripe = {
:publishable_key => ENV.fetch('STRIPE_PUBLISHABLE_KEY'), :publishable_key => "REMOVED:STRIPE_PUBLISHABLE_KEY",
:secret_key => ENV.fetch('STRIPE_SECRET_KEY') :secret_key => "REMOVED:STRIPE_SECRET_KEY"
} }
Stripe.api_key = Rails.configuration.stripe[:secret_key] # Stripe.api_key = Rails.configuration.stripe[:secret_key]
# Some stub methods for our Stripe calls, to give clearer error messages (but
# those code paths shouldn't be accessible by normal users rn anyway).
module Stripe
class Customer
def self.create(*args)
raise NotImplementedError, "TODO: Reinstall Stripe"
end
end
class Card
def self.create(*args)
raise NotImplementedError, "TODO: Reinstall Stripe"
end
end
class CardError < Exception
end
end