diff --git a/Gemfile b/Gemfile index bcf73f31..b3a79a0a 100644 --- a/Gemfile +++ b/Gemfile @@ -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" diff --git a/Gemfile.lock b/Gemfile.lock index d87251a2..71531065 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) diff --git a/app/views/campaigns/show.html.haml b/app/views/campaigns/show.html.haml index e09ae7d0..c01d11ce 100644 --- a/app/views/campaigns/show.html.haml +++ b/app/views/campaigns/show.html.haml @@ -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 diff --git a/config/initializers/stripe.rb b/config/initializers/stripe.rb index af67a81b..845fa64f 100644 --- a/config/initializers/stripe.rb +++ b/config/initializers/stripe.rb @@ -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