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 'stripe', :git => 'https://github.com/stripe/stripe-ruby'
gem "letter_opener", :group => :development
gem 'sass-rails', "~> 3.2.6"

View file

@ -35,14 +35,6 @@ GIT
specs:
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
remote: http://rubygems.org/
specs:
@ -335,7 +327,6 @@ DEPENDENCIES
rvm-capistrano (~> 1.5.6)
sanitize (~> 2.0.3)
sass-rails (~> 3.2.6)
stripe!
swf_converter (~> 0.0.3)
uglifier (>= 1.0.3)
whenever (~> 0.7.3)

View file

@ -6,51 +6,52 @@
toward #{@current_campaign.purpose}.
Thanks so much!
= form_tag donations_path, method: 'POST', id: 'donation-form',
'data-checkout-image' => image_path('default_preview.png'),
'data-checkout-publishable-key' => Rails.configuration.stripe[:publishable_key],
'data-campaign-theme' => @current_campaign.theme_id do
= hidden_field_tag 'donation[stripe_token]'
= hidden_field_tag 'donation[stripe_token_type]'
= hidden_field_tag 'donation[donor_email]'
= hidden_field_tag 'donation[amount]'
%header
%p#donation-form-title
Thanks for supporting Dress to Impress!
%p
From modeling to servers, Dress to Impress is a community effort.
This year, we need to raise
#{cents_to_currency(@current_campaign.goal, precision: 0)}
to cover our #{@current_campaign.name} hosting costs.
%p
As a thank-you gift, for every $5 you give, we'll feature one of your
outfits here and on the homepage. Show off your latest designs!
%p
All donations are securely powered by
#{link_to 'Stripe', 'https://stripe.com/'}, and go directly toward our
hosting costs. Thank you for your help!
#donation-fields
#amount-header Amount
#amount-choices
%li
%input#amount-5{type: 'radio', name: 'amount', value: '5.00'}
%label{for: 'amount-5'} $5
%li
%input#amount-10{type: 'radio', name: 'amount', value: '10.00'}
%label{for: 'amount-10'} $10
%li
%input#amount-30{type: 'radio', name: 'amount', value: '20.00', checked: true}
%label{for: 'amount-30'} $20
%li
%input#amount-50{type: 'radio', name: 'amount', value: '50.00'}
%label{for: 'amount-50'} $50
%li
%input#amount-custom{type: 'radio', name: 'amount', value: 'custom'}
%label{for: 'amount-custom'} Other
%label#amount-custom-fields{for: 'amount-custom-value'}
%input#amount-custom-value{type: 'text'}
#donation-controls
%button{type: 'submit'} Donate now!
-# 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-publishable-key' => Rails.configuration.stripe[:publishable_key],
'data-campaign-theme' => @current_campaign.theme_id do
= hidden_field_tag 'donation[stripe_token]'
= hidden_field_tag 'donation[stripe_token_type]'
= hidden_field_tag 'donation[donor_email]'
= hidden_field_tag 'donation[amount]'
%header
%p#donation-form-title
Thanks for supporting Dress to Impress!
%p
From modeling to servers, Dress to Impress is a community effort.
This year, we need to raise
#{cents_to_currency(@current_campaign.goal, precision: 0)}
to cover our #{@current_campaign.name} hosting costs.
%p
As a thank-you gift, for every $5 you give, we'll feature one of your
outfits here and on the homepage. Show off your latest designs!
%p
All donations are securely powered by
#{link_to 'Stripe', 'https://stripe.com/'}, and go directly toward our
hosting costs. Thank you for your help!
#donation-fields
#amount-header Amount
#amount-choices
%li
%input#amount-5{type: 'radio', name: 'amount', value: '5.00'}
%label{for: 'amount-5'} $5
%li
%input#amount-10{type: 'radio', name: 'amount', value: '10.00'}
%label{for: 'amount-10'} $10
%li
%input#amount-30{type: 'radio', name: 'amount', value: '20.00', checked: true}
%label{for: 'amount-30'} $20
%li
%input#amount-50{type: 'radio', name: 'amount', value: '50.00'}
%label{for: 'amount-50'} $50
%li
%input#amount-custom{type: 'radio', name: 'amount', value: 'custom'}
%label{for: 'amount-custom'} Other
%label#amount-custom-fields{for: 'amount-custom-value'}
%input#amount-custom-value{type: 'text'}
#donation-controls
%button{type: 'submit'} Donate now!
- if @donations.present?
#outfits-header

View file

@ -1,6 +1,27 @@
# TODO: Upgrade Stripe to be usable again, or remove references altogether
Rails.configuration.stripe = {
:publishable_key => ENV.fetch('STRIPE_PUBLISHABLE_KEY'),
:secret_key => ENV.fetch('STRIPE_SECRET_KEY')
:publishable_key => "REMOVED:STRIPE_PUBLISHABLE_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