From 027086fc7be10607d27a56fa18f905b696f917d4 Mon Sep 17 00:00:00 2001 From: claucece Date: Tue, 15 Sep 2015 17:49:35 -0500 Subject: add donate button, bitcoin, payment_method --- .../billing/app/controllers/payments_controller.rb | 12 ++++----- engines/billing/app/views/payments/new.html.erb | 30 +++++++++++----------- 2 files changed, 20 insertions(+), 22 deletions(-) (limited to 'engines') diff --git a/engines/billing/app/controllers/payments_controller.rb b/engines/billing/app/controllers/payments_controller.rb index b7a8e24..ece967b 100644 --- a/engines/billing/app/controllers/payments_controller.rb +++ b/engines/billing/app/controllers/payments_controller.rb @@ -6,13 +6,11 @@ class PaymentsController < BillingBaseController end def confirm - @result = Braintree::TransparentRedirect.confirm(request.query_string) - if @result.success? - render :action => "confirm" - else - fetch_transparent_redirect - render :action => "new" - end + result = Braintree::Transaction.sale( + amount: params[:amount], + payment_method_nonce: params[:payment_method_nonce] + ) + redirect_to action: :new, flash: { success: "done" } end def index diff --git a/engines/billing/app/views/payments/new.html.erb b/engines/billing/app/views/payments/new.html.erb index 7eab364..86a1d64 100644 --- a/engines/billing/app/views/payments/new.html.erb +++ b/engines/billing/app/views/payments/new.html.erb @@ -1,25 +1,25 @@ -
-
-

New Donation

-

Please enter your donation details (this is a donation, and will not be applied towards your account):

-
+

New Donation

+

Please enter your donation details (this is a donation and will not be applied towards your account):

+
+<%= form_tag confirm_payment_path, id: "checkout-form" do %> +
+
+ + +<% end %> -<%= braintree_form_for :transaction, :html => {:autocomplete => "off"} do |f|%> - <%= f.label :amount, t(:amount)%> - <%= f.text_field :amount%> -
- <%= f.submit "Submit Donation", :class => 'btn btn-primary'%> -<%end%> -- cgit v1.2.3