diff options
-rw-r--r-- | billing/app/views/payments/confirm.html.erb | 16 | ||||
-rw-r--r-- | billing/app/views/payments/confirm.html.haml | 26 | ||||
-rw-r--r-- | billing/app/views/payments/new.html.erb | 38 | ||||
-rw-r--r-- | billing/app/views/payments/new.html.haml | 25 |
4 files changed, 51 insertions, 54 deletions
diff --git a/billing/app/views/payments/confirm.html.erb b/billing/app/views/payments/confirm.html.erb deleted file mode 100644 index 5ab851e..0000000 --- a/billing/app/views/payments/confirm.html.erb +++ /dev/null @@ -1,16 +0,0 @@ -<h1>Payment Result</h1> - -<div>Thank you for your payment.</div> - -<h2>Transaction Details</h2> - -<table> - <tr><td>Amount</td><td>$<%= @result.transaction.amount %></td></tr> - <tr><td>Transaction ID:</td><td><%= @result.transaction.id %></td></tr> - <tr><td>First Name:</td><td><%= h @result.transaction.customer_details.first_name %></td></tr> - <tr><td>Last Name:</td><td><%= h @result.transaction.customer_details.last_name %></td></tr> - <tr><td>Email:</td><td><%= h @result.transaction.customer_details.email %></td></tr> - <tr><td>Credit Card:</td><td><%= h @result.transaction.credit_card_details.masked_number %></td></tr> - <tr><td>Card Type:</td><td><%= h @result.transaction.credit_card_details.card_type %></td></tr> -</table> - diff --git a/billing/app/views/payments/confirm.html.haml b/billing/app/views/payments/confirm.html.haml new file mode 100644 index 0000000..21611f5 --- /dev/null +++ b/billing/app/views/payments/confirm.html.haml @@ -0,0 +1,26 @@ +%h1 Payment Result +%div Thank you for your payment. +%h2 Transaction Details +%table + %tr + %td Amount + %td + $#{@result.transaction.amount} + %tr + %td Transaction ID: + %td= @result.transaction.id + %tr + %td First Name: + %td= h @result.transaction.customer_details.first_name + %tr + %td Last Name: + %td= h @result.transaction.customer_details.last_name + %tr + %td Email: + %td= h @result.transaction.customer_details.email + %tr + %td Credit Card: + %td= h @result.transaction.credit_card_details.masked_number + %tr + %td Card Type: + %td= h @result.transaction.credit_card_details.card_type
\ No newline at end of file diff --git a/billing/app/views/payments/new.html.erb b/billing/app/views/payments/new.html.erb deleted file mode 100644 index 092c518..0000000 --- a/billing/app/views/payments/new.html.erb +++ /dev/null @@ -1,38 +0,0 @@ -<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 -%> diff --git a/billing/app/views/payments/new.html.haml b/billing/app/views/payments/new.html.haml new file mode 100644 index 0000000..9b06050 --- /dev/null +++ b/billing/app/views/payments/new.html.haml @@ -0,0 +1,25 @@ +%h1 + Payment: $#{h @amount} +- if @result + %div{:style => "color: red;"} + = h @result.errors.size + error(s) += 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= c.text_field :first_name + %div= c.label :last_name, "Last Name" + %div= c.text_field :last_name + %div= c.label :email, "Email" + %div= c.text_field :email + = field_set_tag "Credit Card" do + = f.fields_for :credit_card do |c| + %div= c.label :number, "Number" + %div= c.text_field :number + %div= c.label :expiration_date, "Expiration Date (MM/YY)" + %div= c.text_field :expiration_date + %div= c.label :cvv, "CVV" + %div= c.text_field :cvv + = hidden_field_tag :tr_data, Braintree::TransparentRedirect.transaction_data(:redirect_url => confirm_payment_url,:transaction => {:type => "sale", :amount => @amount}) + = f.submit "Submit"
\ No newline at end of file |