summaryrefslogtreecommitdiff
path: root/engines/billing
diff options
context:
space:
mode:
Diffstat (limited to 'engines/billing')
-rw-r--r--engines/billing/app/controllers/payments_controller.rb12
-rw-r--r--engines/billing/app/views/payments/new.html.erb30
2 files changed, 20 insertions, 22 deletions
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 @@
-<form id="checkout" method="post" action="/checkout">
- <div id="payment-form"></div>
- <h2 class="mbs">New Donation</h2>
- <p>Please enter your donation details (this is a donation, and will not be applied towards your account):</p>
-</form>
+<h2 class="mbs">New Donation</h2>
+<p>Please enter your donation details (this is a donation and will not be applied towards your account):</p>
+<br>
+<%= form_tag confirm_payment_path, id: "checkout-form" do %>
+ <div id="payment-form"></div>
+ <div id='coinbase-container-id'></div>
+ <input type="text" name="amount" placeholder="Enter amount">
+ <input type="submit" class="btn btn-primary" value="Donate">
+<% end %>
-<%= braintree_form_for :transaction, :html => {:autocomplete => "off"} do |f|%>
- <%= f.label :amount, t(:amount)%>
- <%= f.text_field :amount%>
- <div>
<script src="https://js.braintreegateway.com/v2/braintree.js"></script>
<script>
// We generated a client token for you so you can test out this code
// immediately. In a production-ready integration, you will need to
// generate a client token on your server (see section below).
-var clientTo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VyZS9sb29rdXAifSwicGF5cGFsRW5hYmxlZCI6dHJ1ZSwicGF5cGFsIjp7ImRpc3BsYXlOYW1lIjoiQWNtZSBXaWRnZXRzLCBMdGQuIChTYW5kYm94KSIsImNsaWVudElkIjpudWxsLCJwcml2YWN5VXJsIjoiaHR0cDovL2V4YW1wbGUuY29tL3BwIiwidXNlckFncmVlbWVudFVybCI6Imh0dHA6Ly9leGFtcGxlLmNvbS90b3MiLCJiYXNlVXJsIjoiaHR0cHM6Ly9hc3NldHMuYnJhaW50cmVlZ2F0ZXdheS5jb20iLCJhc3NldHNVcmwiOiJodHRwczovL2NoZWNrb3V0LnBheXBhbC5jb20iLCJkaXJlY3RCYXNlVXJsIjpudWxsLCJhbGxvd0h0dHAiOnRydWUsImVudmlyb25tZW50Tm9OZXR3b3JrIjp0cnVlLCJlbnZpcm9ubWVudCI6Im9mZmxpbmUiLCJ1bnZldHRlZE1lcmNoYW50IjpmYWxzZSwiYnJhaW50cmVlQ2xpZW50SWQiOiJtYXN0ZXJjbGllbnQzIiwiYmlsbGluZ0FncmVlbWVudHNFbmFibGVkIjpmYWxzZSwibWVyY2hhbnRBY2NvdW50SWQiOiJhY21ld2lkZ2V0c2x0ZHNhbmRib3giLCJjdXJyZW5jeUlzb0NvZGUiOiJVU0QifSwiY29pbmJhc2VFbmFibGVkIjpmYWxzZSwibWVyY2hhbnRJZCI6IjM0OHBrOWNnZjNiZ3l3MmIiLCJ2ZW5tbyI6Im9mZiJ9";
-
+var clientToken = "<%= @client_token %>";
braintree.setup(clientToken, "dropin", {
- container: "payment-form"
-});
+ container: "payment-form",
+ form: "checkout-form",
+ coinbase: { container: "payment-form" }
+}
+ );
</script>
- <%= f.submit "Submit Donation", :class => 'btn btn-primary'%>
-<%end%>