summaryrefslogtreecommitdiff
path: root/billing/app/views/payments
diff options
context:
space:
mode:
Diffstat (limited to 'billing/app/views/payments')
-rw-r--r--billing/app/views/payments/_customer_data.html.haml15
-rw-r--r--billing/app/views/payments/_non_customer_fields.html.haml16
-rw-r--r--billing/app/views/payments/_transaction_details.html.haml15
-rw-r--r--billing/app/views/payments/confirm.html.haml29
-rw-r--r--billing/app/views/payments/index.html.haml2
-rw-r--r--billing/app/views/payments/new.html.haml18
6 files changed, 95 insertions, 0 deletions
diff --git a/billing/app/views/payments/_customer_data.html.haml b/billing/app/views/payments/_customer_data.html.haml
new file mode 100644
index 0000000..87b8209
--- /dev/null
+++ b/billing/app/views/payments/_customer_data.html.haml
@@ -0,0 +1,15 @@
+%legend= t(:customer_information)
+%dl
+ %dt First Name
+ %dd= @customer.first_name
+ %dt Last Name
+ %dd= @customer.last_name
+ %dt Phone
+ %dd= @customer.phone
+%legend= t(:credit_card_information)
+%dl
+ %dt Number
+ %dd= @default_cc.masked_number
+ %dt Expiration Date
+ %dd= @default_cc.expiration_date
+ = link_to t(:edit_saved_data), edit_customer_path(@customer), :class => :btn
diff --git a/billing/app/views/payments/_non_customer_fields.html.haml b/billing/app/views/payments/_non_customer_fields.html.haml
new file mode 100644
index 0000000..99b420d
--- /dev/null
+++ b/billing/app/views/payments/_non_customer_fields.html.haml
@@ -0,0 +1,16 @@
+= 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 \ No newline at end of file
diff --git a/billing/app/views/payments/_transaction_details.html.haml b/billing/app/views/payments/_transaction_details.html.haml
new file mode 100644
index 0000000..030639e
--- /dev/null
+++ b/billing/app/views/payments/_transaction_details.html.haml
@@ -0,0 +1,15 @@
+%p
+ = transaction.id
+ Type:
+ = transaction.type
+ Amount:
+ = number_to_currency(transaction.amount)
+ Status:
+ = transaction.status
+ Date
+ = transaction.created_at.strftime("%Y-%m-%d")
+ - if sub_start = transaction.subscription_details.billing_period_start_date
+ From subscription which started
+ = sub_start
+ - else
+ Not paid as part of subscription \ No newline at end of file
diff --git a/billing/app/views/payments/confirm.html.haml b/billing/app/views/payments/confirm.html.haml
new file mode 100644
index 0000000..9479eb9
--- /dev/null
+++ b/billing/app/views/payments/confirm.html.haml
@@ -0,0 +1,29 @@
+%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
+- if current_user
+ - customer = Customer.find_by_user_id(current_user.id)
+ = link_to 'View Customer Info', show_customer_path(customer.braintree_customer_id), :class=> :btn \ No newline at end of file
diff --git a/billing/app/views/payments/index.html.haml b/billing/app/views/payments/index.html.haml
new file mode 100644
index 0000000..a3ad067
--- /dev/null
+++ b/billing/app/views/payments/index.html.haml
@@ -0,0 +1,2 @@
+- @transactions.each do |t|
+ = render :partial => "transaction_details", :locals => {:transaction => t} \ No newline at end of file
diff --git a/billing/app/views/payments/new.html.haml b/billing/app/views/payments/new.html.haml
new file mode 100644
index 0000000..4523e13
--- /dev/null
+++ b/billing/app/views/payments/new.html.haml
@@ -0,0 +1,18 @@
+%h1
+ = t(:payment)
+- if @result and @result.errors.size > 0
+ %div{:style => "color: red;"}
+ = h @result.errors.size
+ error(s)
+- if @result and @result.transaction and @result.transaction.status == 'processor_declined'
+ %div{:style => "color: red;"}
+ = t(:processor_declined)
+= braintree_form_for :transaction, :html => {:autocomplete => "off"} do |f|
+ = f.label :amount, t(:amount)
+ = f.text_field :amount
+ - if !@customer
+ = render :partial => 'non_customer_fields', :locals => {:f => f}
+ - else
+ = render :partial => 'customer_data'
+ = hidden_field_tag :tr_data, @tr_data
+ = f.submit "Submit Payment", :class => 'btn btn-primary'