diff options
Diffstat (limited to 'billing/app/views/payments/new.html.erb')
-rw-r--r-- | billing/app/views/payments/new.html.erb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/billing/app/views/payments/new.html.erb b/billing/app/views/payments/new.html.erb new file mode 100644 index 0000000..092c518 --- /dev/null +++ b/billing/app/views/payments/new.html.erb @@ -0,0 +1,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 -%> |