summaryrefslogtreecommitdiff
path: root/billing/app/views/payments/new.html.erb
blob: 092c51851797e6b24a67ff1271e5f89ff25e0c32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<h1>Payment: $<%= h @amount %></h1>

<% if @result -%>
  <div style="color: red;"><%= h @result.errors.size %> error(s)</div>
<% end -%>

<%= form_for :transaction,
     :params => @result && @result.params[:transaction],
     :errors => @result && @result.errors.for(:transaction),
     :builder => BraintreeHelper::BraintreeFormBuilder,
     :url => Braintree::TransparentRedirect.url,
     :html => {:autocomplete => "off"} do |f| -%>
  <%= field_set_tag "Customer" do -%>
    <%= f.fields_for :customer do |c| -%>
      <div><%= c.label :first_name, "First Name" %></div>
      <div><%= c.text_field :first_name %></div>
      <div><%= c.label :last_name, "Last Name" %></div>
      <div><%= c.text_field :last_name %></div>
      <div><%= c.label :email, "Email" %></div>
      <div><%= c.text_field :email %></div>
    <% end -%>
  <% end -%>
  <%= field_set_tag "Credit Card" do -%>
    <%= f.fields_for :credit_card do |c| -%>
      <div><%= c.label :number, "Number" %></div>
      <div><%= c.text_field :number %></div>
      <div><%= c.label :expiration_date, "Expiration Date (MM/YY)" %></div>
      <div><%= c.text_field :expiration_date %></div>
      <div><%= c.label :cvv, "CVV" %></div>
      <div><%= c.text_field :cvv %></div>
    <% end -%>
  <% end -%>
  <%= hidden_field_tag :tr_data, Braintree::TransparentRedirect.transaction_data(
    :redirect_url => confirm_payment_url,
    :transaction => {:type => "sale", :amount => @amount}
  ) %>
  <%= f.submit "Submit" %>
<% end -%>