saasaparilla 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/Gemfile +36 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +39 -0
- data/app/controllers/saasaparilla/admin/plans_controller.rb +87 -0
- data/app/controllers/saasaparilla/admin/subscriptions_controller.rb +34 -0
- data/app/controllers/saasaparilla/admin/transactions_controller.rb +14 -0
- data/app/controllers/saasaparilla/application_controller.rb +4 -0
- data/app/controllers/saasaparilla/billing_history_controller.rb +9 -0
- data/app/controllers/saasaparilla/contact_info_controller.rb +31 -0
- data/app/controllers/saasaparilla/credit_card_controller.rb +41 -0
- data/app/controllers/saasaparilla/invoices_controller.rb +19 -0
- data/app/controllers/saasaparilla/payments_controller.rb +71 -0
- data/app/controllers/saasaparilla/plans_controller.rb +34 -0
- data/app/controllers/saasaparilla/subscription_controller.rb +71 -0
- data/app/helpers/application_helper.rb +3 -0
- data/app/helpers/plans_helper.rb +2 -0
- data/app/helpers/saasaparilla/billing_history_helper.rb +4 -0
- data/app/mailers/saasaparilla/notifier.rb +38 -0
- data/app/models/billing_activity.rb +12 -0
- data/app/models/contact_info.rb +107 -0
- data/app/models/credit_card.rb +109 -0
- data/app/models/invoice.rb +31 -0
- data/app/models/invoice_line_item.rb +3 -0
- data/app/models/payment.rb +39 -0
- data/app/models/plan.rb +36 -0
- data/app/models/subscription.rb +363 -0
- data/app/models/transaction.rb +32 -0
- data/app/views/layouts/saasaparilla.html.haml +9 -0
- data/app/views/saasaparilla/admin/plans/_form.html.haml +45 -0
- data/app/views/saasaparilla/admin/plans/edit.html.erb +4 -0
- data/app/views/saasaparilla/admin/plans/index.html.erb +31 -0
- data/app/views/saasaparilla/admin/plans/new.html.haml +4 -0
- data/app/views/saasaparilla/admin/plans/show.html.haml +20 -0
- data/app/views/saasaparilla/admin/subscriptions/_subscription.html.haml +7 -0
- data/app/views/saasaparilla/admin/subscriptions/index.html.haml +14 -0
- data/app/views/saasaparilla/admin/subscriptions/show.html.haml +52 -0
- data/app/views/saasaparilla/admin/transactions/_transaction.html.haml +6 -0
- data/app/views/saasaparilla/admin/transactions/index.html.haml +16 -0
- data/app/views/saasaparilla/billing_history/_billing_activity.html.haml +10 -0
- data/app/views/saasaparilla/billing_history/show.html.haml +11 -0
- data/app/views/saasaparilla/contact_info/edit.html.haml +8 -0
- data/app/views/saasaparilla/credit_card/edit.html.haml +18 -0
- data/app/views/saasaparilla/invoices/show.html.haml +17 -0
- data/app/views/saasaparilla/notifier/billing_failed.html.haml +5 -0
- data/app/views/saasaparilla/notifier/billing_successful.html.haml +5 -0
- data/app/views/saasaparilla/notifier/invoice_created.html.haml +24 -0
- data/app/views/saasaparilla/notifier/pending_cancellation_notice.html.haml +6 -0
- data/app/views/saasaparilla/notifier/subscription_canceled.html.haml +4 -0
- data/app/views/saasaparilla/notifier/subscription_created.html.haml +5 -0
- data/app/views/saasaparilla/payments/edit.html.haml +10 -0
- data/app/views/saasaparilla/payments/new.html.haml +10 -0
- data/app/views/saasaparilla/payments/show.html.haml +8 -0
- data/app/views/saasaparilla/plans/edit.html.haml +34 -0
- data/app/views/saasaparilla/subscription/_contact_info_form.html.haml +19 -0
- data/app/views/saasaparilla/subscription/_credit_card_form.html.haml +10 -0
- data/app/views/saasaparilla/subscription/new.html.haml +24 -0
- data/app/views/saasaparilla/subscription/show.html.haml +73 -0
- data/autotest/discover.rb +2 -0
- data/config/routes.rb +27 -0
- data/lib/country_select/MIT-LICENSE +20 -0
- data/lib/country_select/README +15 -0
- data/lib/country_select/init.rb +1 -0
- data/lib/country_select/install.rb +2 -0
- data/lib/country_select/lib/country_select.rb +88 -0
- data/lib/country_select/uninstall.rb +1 -0
- data/lib/extensions/action_controller/base.rb +7 -0
- data/lib/extensions/active_record/nested_attributes.rb +36 -0
- data/lib/extensions/active_record/statuses.rb +16 -0
- data/lib/extensions/billable.rb +12 -0
- data/lib/generators/saasaparilla/install/install_generator.rb +29 -0
- data/lib/generators/saasaparilla/install/templates/create_saasaparilla_tables.rb +106 -0
- data/lib/generators/saasaparilla/install/templates/saasaparilla.yml +32 -0
- data/lib/initializers/auth_dot_net.rb +25 -0
- data/lib/initializers/simple_form.rb +77 -0
- data/lib/initializers/time_format.rb +3 -0
- data/lib/saasaparilla.rb +16 -0
- data/lib/saasaparilla/authentication.rb +18 -0
- data/lib/saasaparilla/authorization.rb +26 -0
- data/lib/saasaparilla/engine.rb +30 -0
- data/lib/saasaparilla/version.rb +3 -0
- data/saasaparilla.gemspec +48 -0
- data/spec/.livereload +21 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +11 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/model/user.rb +4 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +46 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +30 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/simple_form.rb +77 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/locales/simple_form.en.yml +24 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/config/saasaparilla.yml +32 -0
- data/spec/dummy/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/index.html +0 -0
- data/spec/dummy/public/javascripts/application.js +2 -0
- data/spec/dummy/public/javascripts/jquery.js +8374 -0
- data/spec/dummy/public/javascripts/jquery.min.js +16 -0
- data/spec/dummy/public/javascripts/rails.js +159 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/MIT-LICENSE +20 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/README +32 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/Rakefile +23 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/init.rb +1 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/install.rb +1 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/lib/authorize_net_cim_gateway_test.rb +492 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/lib/authorize_net_gateway_test.rb +133 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/lib/paypal_express_gateway_test.rb +138 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/tasks/activemerchant_testing_tasks.rake +4 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/test/activemerchant_testing_test.rb +8 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/test/test_helper.rb +3 -0
- data/spec/dummy/vendor/plugins/active_merchant_testing/uninstall.rb +1 -0
- data/spec/factories/factories.rb +75 -0
- data/spec/integration/navigation_spec.rb +9 -0
- data/spec/mailers/notifier_spec.rb +167 -0
- data/spec/models/billing_activity_spec.rb +27 -0
- data/spec/models/contact_info_spec.rb +32 -0
- data/spec/models/credit_card_spec.rb +57 -0
- data/spec/models/invoice_line_item_spec.rb +7 -0
- data/spec/models/invoice_spec.rb +25 -0
- data/spec/models/payment_spec.rb +29 -0
- data/spec/models/plan_spec.rb +16 -0
- data/spec/models/subscription_spec.rb +414 -0
- data/spec/requests/admin_plans_spec.rb +32 -0
- data/spec/requests/admin_subscriptions_spec.rb +31 -0
- data/spec/requests/billing_history_spec.rb +26 -0
- data/spec/requests/contact_info_controller_spec.rb +42 -0
- data/spec/requests/credit_cards_spec.rb +79 -0
- data/spec/requests/invoices_spec.rb +23 -0
- data/spec/requests/payments_spec.rb +89 -0
- data/spec/requests/subscription_plans_spec.rb +34 -0
- data/spec/requests/subscriptions_spec.rb +80 -0
- data/spec/spec_helper.rb +68 -0
- data/spec/spec_helpers/spec_helpers.rb +8 -0
- metadata +611 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<div class="saasaparilla">
|
|
2
|
+
|
|
3
|
+
<h1>Plans</h1>
|
|
4
|
+
|
|
5
|
+
<table>
|
|
6
|
+
<tr>
|
|
7
|
+
<th>Name</th>
|
|
8
|
+
<th>Billing period</th>
|
|
9
|
+
<th>Subscription</th>
|
|
10
|
+
<th>Extras</th>
|
|
11
|
+
<th></th>
|
|
12
|
+
<th></th>
|
|
13
|
+
<th></th>
|
|
14
|
+
</tr>
|
|
15
|
+
|
|
16
|
+
<% @plans.each do |plan| %>
|
|
17
|
+
<tr>
|
|
18
|
+
<td><%= plan.name %></td>
|
|
19
|
+
<td><%= plan.billing_period %></td>
|
|
20
|
+
<td><%= plan.subscription_id %></td>
|
|
21
|
+
<td><%#= plan.extras %></td>
|
|
22
|
+
<td><%= link_to 'Show', admin_plan_path(plan) %></td>
|
|
23
|
+
<td><%= link_to 'Edit', edit_admin_plan_path(plan) %></td>
|
|
24
|
+
<td><%= link_to 'Destroy', admin_plan_path(plan), :confirm => 'Are you sure?', :method => :delete %></td>
|
|
25
|
+
</tr>
|
|
26
|
+
<% end %>
|
|
27
|
+
</table>
|
|
28
|
+
|
|
29
|
+
<p><%= link_to 'New Plan', new_admin_plan_path %></p>
|
|
30
|
+
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.saasaparilla
|
|
2
|
+
%h2 Plan
|
|
3
|
+
%p
|
|
4
|
+
%b Name:
|
|
5
|
+
= @plan.name
|
|
6
|
+
%p
|
|
7
|
+
%b Billing period:
|
|
8
|
+
= @plan.billing_period
|
|
9
|
+
%p
|
|
10
|
+
%b Attributes:
|
|
11
|
+
%br
|
|
12
|
+
- @plan.dynamic_attributes.each do |da|
|
|
13
|
+
= da[0].gsub("field_", "")
|
|
14
|
+
= ": "
|
|
15
|
+
= da[1]
|
|
16
|
+
%br
|
|
17
|
+
%p
|
|
18
|
+
= link_to 'Edit', edit_admin_plan_path(@plan)
|
|
19
|
+
= " | "
|
|
20
|
+
= link_to 'Back', admin_plans_path
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.saasaparilla
|
|
2
|
+
%h1 Subscription Detail
|
|
3
|
+
|
|
4
|
+
.info
|
|
5
|
+
%h2 Subscriber Contact Info
|
|
6
|
+
%p
|
|
7
|
+
= "#{@subscription.first_name} #{@subscription.last_name}"
|
|
8
|
+
%br
|
|
9
|
+
= @subscription.contact_info.email
|
|
10
|
+
%br
|
|
11
|
+
- if @subscription.contact_info.require_billing_address?
|
|
12
|
+
= @subscription.address
|
|
13
|
+
%br
|
|
14
|
+
= "#{@subscription.city}, #{@subscription.state} #{@subscription.zip}"
|
|
15
|
+
%br
|
|
16
|
+
- if @subscription.contact_info.require_phone_number?
|
|
17
|
+
= "#{@subscription.phone_number}"
|
|
18
|
+
|
|
19
|
+
.info
|
|
20
|
+
%h2 Subscription Details
|
|
21
|
+
%p
|
|
22
|
+
="Status: "
|
|
23
|
+
= @subscription.status
|
|
24
|
+
%br
|
|
25
|
+
- if @subscription.no_charge
|
|
26
|
+
Complimentary (no_charge):
|
|
27
|
+
= @subscription.no_charge
|
|
28
|
+
%br
|
|
29
|
+
= "Balance: "
|
|
30
|
+
= number_to_currency(@subscription.balance)
|
|
31
|
+
%br
|
|
32
|
+
= "Last Invoiced: "
|
|
33
|
+
= @subscription.invoiced_on.to_s(:month_day_year) unless @subscription.invoiced_on.nil?
|
|
34
|
+
%br
|
|
35
|
+
= "Last Transaction Date: "
|
|
36
|
+
= @subscription.last_transaction_date
|
|
37
|
+
%br
|
|
38
|
+
= "Last Transaction Amount: "
|
|
39
|
+
= number_to_currency(@subscription.last_transaction_amount)
|
|
40
|
+
%br
|
|
41
|
+
%br
|
|
42
|
+
= link_to "See all transactions", admin_subscription_transactions_path(@subscription)
|
|
43
|
+
|
|
44
|
+
.info
|
|
45
|
+
%h2 Actions
|
|
46
|
+
%p
|
|
47
|
+
= link_to "Cancel Subscription", cancel_admin_subscription_path(@subscription), :confirm => "Are you sure you want to cancel this subscription?" unless @subscription.status == "canceled"
|
|
48
|
+
%br
|
|
49
|
+
- if @subscription.no_charge
|
|
50
|
+
= link_to "Revoke complimentary subscription", toggle_no_charge_admin_subscription_path(@subscription), :confirm => "Are you sure you want to comp this subscription?"
|
|
51
|
+
- else
|
|
52
|
+
= link_to "Make subscription complimentary", toggle_no_charge_admin_subscription_path(@subscription), :confirm => "Are you sure you want to comp this subscription?"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.saasaparilla
|
|
2
|
+
%h1
|
|
3
|
+
= "Transactions for #{@subscription.email}"
|
|
4
|
+
|
|
5
|
+
%table
|
|
6
|
+
%tr
|
|
7
|
+
%th Date
|
|
8
|
+
%th Amount
|
|
9
|
+
%th Success
|
|
10
|
+
%th Action
|
|
11
|
+
%th Message
|
|
12
|
+
|
|
13
|
+
= render :partial => "transaction", :collection => @transactions
|
|
14
|
+
|
|
15
|
+
= will_paginate @transactions
|
|
16
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
%tr
|
|
2
|
+
%td
|
|
3
|
+
= billing_activity.created_at.to_s(:month_day_year)
|
|
4
|
+
%td
|
|
5
|
+
= raw(billing_activity.message)
|
|
6
|
+
%td
|
|
7
|
+
- if billing_activity.invoice.nil?
|
|
8
|
+
= number_to_currency(billing_activity.amount)
|
|
9
|
+
- else
|
|
10
|
+
= "(#{number_to_currency(billing_activity.invoice.amount)})"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.saasaparilla
|
|
2
|
+
%h1 Update Billing Payment Info
|
|
3
|
+
|
|
4
|
+
.info
|
|
5
|
+
%h2 Current card
|
|
6
|
+
%p
|
|
7
|
+
= @current_card.card_number
|
|
8
|
+
%br
|
|
9
|
+
= "Exp: #{@current_card.expiration_date}"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
.info
|
|
13
|
+
%h2 Update card
|
|
14
|
+
= simple_form_for [@subscription, @credit_card], :secure => true do |f|
|
|
15
|
+
= render :partial => 'saasaparilla/subscription/credit_card_form', :locals => {:f => f}
|
|
16
|
+
= f.submit "Update Card"
|
|
17
|
+
= link_to "Cancel", :back
|
|
18
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.saasaparilla
|
|
2
|
+
%h1 Invoice
|
|
3
|
+
|
|
4
|
+
%p
|
|
5
|
+
Date
|
|
6
|
+
= @invoice.created_at.to_s(:month_day_year)
|
|
7
|
+
|
|
8
|
+
%table
|
|
9
|
+
%tr
|
|
10
|
+
%th Price
|
|
11
|
+
%th Billing From
|
|
12
|
+
%th Billing To
|
|
13
|
+
- for line_item in @invoice.invoice_line_items
|
|
14
|
+
%tr
|
|
15
|
+
%td= line_item.price
|
|
16
|
+
%td= line_item.from.to_date.to_s(:month_day_year)
|
|
17
|
+
%td= line_item.to.to_date.to_s(:month_day_year)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
%h2 Account Billing Failed
|
|
2
|
+
|
|
3
|
+
%p
|
|
4
|
+
= "Our attempt to charge your credit card #{number_to_currency(@amount)} for your #{@subscription.plan.billing_period} subscription to the #{@subscription.plan.name} plan has failed. Please visit #{@url} to fix this problem."
|
|
5
|
+
If you need any assistance, please contact the administrator.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
%h2 Your account was successfully billed
|
|
2
|
+
|
|
3
|
+
%p
|
|
4
|
+
= "Your credit card has been charged #{number_to_currency(@amount)} for your #{@subscription.plan.billing_period} subscription to the #{@subscription.plan.name} plan. Thank you."
|
|
5
|
+
If you need any assistance, please contact the administrator.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
%h2 Invoice
|
|
2
|
+
|
|
3
|
+
%p
|
|
4
|
+
= "You will be billed in 5 days for the following:"
|
|
5
|
+
|
|
6
|
+
%table
|
|
7
|
+
- @invoice.invoice_line_items.each do |item|
|
|
8
|
+
%tr
|
|
9
|
+
%td
|
|
10
|
+
= @subscription.plan.name
|
|
11
|
+
%td
|
|
12
|
+
= "#{item.from.to_s}-#{item.to.to_s}"
|
|
13
|
+
%td
|
|
14
|
+
= "$" + item.price.to_s
|
|
15
|
+
%tr
|
|
16
|
+
%td
|
|
17
|
+
Total:
|
|
18
|
+
%td
|
|
19
|
+
|
|
20
|
+
%td
|
|
21
|
+
= "$" + @invoice.amount.to_s
|
|
22
|
+
|
|
23
|
+
%p
|
|
24
|
+
No action is required at this time. If you need any assistance, please contact the administrator.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
%h2 Your account will be canceled soon
|
|
2
|
+
|
|
3
|
+
%p
|
|
4
|
+
= "Our attempt to charge your credit card #{number_to_currency(@amount)} for your #{@subscription.plan.billing_period} subscription to the #{@subscription.plan.name} plan has failed multiple times. Please visit #{@url} to fix this problem."
|
|
5
|
+
If this problem is not fixed soon, your account will be canceled and deleted.
|
|
6
|
+
If you need any assistance, please contact the administrator.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.saasaparilla
|
|
2
|
+
%h1 Change you plan
|
|
3
|
+
|
|
4
|
+
- if Saasaparilla::CONFIG["include_free_account"]
|
|
5
|
+
.plan
|
|
6
|
+
%h4
|
|
7
|
+
Free Plan
|
|
8
|
+
= button_to "Downgrade", {:action => :update, :subscription => {:plan_id => nil}}, {:method => :put, :confirm => 'Are you sure you want downgrade to the free plan?'}
|
|
9
|
+
%p
|
|
10
|
+
If you downgrade to the free plan, you may reactivate your paid subscription at a later date.
|
|
11
|
+
%br
|
|
12
|
+
|
|
13
|
+
- @plans.each do |plan|
|
|
14
|
+
.plan
|
|
15
|
+
%h4
|
|
16
|
+
= "#{plan.name}: #{number_to_currency(plan.price)}"
|
|
17
|
+
- if @subscription.plan_id == plan.id
|
|
18
|
+
%br
|
|
19
|
+
You are currently subscribed to this plan
|
|
20
|
+
%br
|
|
21
|
+
%br
|
|
22
|
+
- else
|
|
23
|
+
- if plan.price > @subscription.plan.price
|
|
24
|
+
= button_to "Upgrade", {:action => :update, :subscription => {:plan_id => plan.id}}, {:method => :put, :confirm => 'Are you sure you want to upgrade your plan?'}
|
|
25
|
+
%p
|
|
26
|
+
If you choose to upgrade, you will be put on the new plan immediately. You will be charged the new rate minus a pro-rated credit for your current cycle.
|
|
27
|
+
%br
|
|
28
|
+
- else
|
|
29
|
+
= button_to "Downgrade", {:action => :update, :subscription => {:plan_id => plan.id}}, {:method => :put, :confirm => 'Are you sure you want to downgrade your plan?'}
|
|
30
|
+
%p
|
|
31
|
+
The downgrade will occur at the end of your current billing cycle. You will remain on your current plan until then.
|
|
32
|
+
%br
|
|
33
|
+
|
|
34
|
+
= link_to 'Back', subscription_path
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
= f.input :first_name
|
|
2
|
+
= f.input :last_name
|
|
3
|
+
= f.input :email
|
|
4
|
+
- if @subscription.contact_info.require_billing_address?
|
|
5
|
+
= f.input :address
|
|
6
|
+
= f.input :city
|
|
7
|
+
= f.input :state
|
|
8
|
+
= f.input :zip
|
|
9
|
+
= f.input :country
|
|
10
|
+
- if @subscription.contact_info.require_phone_number?
|
|
11
|
+
.input.string.required
|
|
12
|
+
= f.label :phone, :required => true
|
|
13
|
+
= "("
|
|
14
|
+
= f.text_field :phone_area_code, :required => true, :size => 3, :maxlength => 3, :class => "phone_3"
|
|
15
|
+
= ")"
|
|
16
|
+
= f.text_field :phone_prefix, :required => true, :size => 3, :maxlength => 3, :class => "phone_3"
|
|
17
|
+
= " - "
|
|
18
|
+
= f.text_field :phone_suffix, :required => true, :size => 4, :maxlength => 4, :class => "phone_4"
|
|
19
|
+
= f.error :phone_number, :id => 'phone_error'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
= f.input :card_type, :collection => CreditCard::CARD_TYPES, :include_blank => false
|
|
2
|
+
- if f.object.new_record?
|
|
3
|
+
= f.input :card_number
|
|
4
|
+
- else
|
|
5
|
+
= f.input :card_number, :input_html => {:value => ""}
|
|
6
|
+
= f.input :expiry_month, :collection => CreditCard::MONTHS
|
|
7
|
+
= f.input :expiry_year, :collection => CreditCard::YEARS, :error_html => { :id => "subscription_credit_card_attributes_expiry_date_error"}
|
|
8
|
+
= f.input :card_verification
|
|
9
|
+
|
|
10
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.saasaparilla
|
|
2
|
+
%h1 Create Subscription
|
|
3
|
+
|
|
4
|
+
= simple_form_for @subscription, :url => subscription_path(:secure => true) do |f|
|
|
5
|
+
|
|
6
|
+
.info
|
|
7
|
+
%h2 Plan
|
|
8
|
+
= f.association :plan, :as => 'radio', :label => false
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
= f.simple_fields_for :contact_info, @subscription.contact_info do |cif|
|
|
12
|
+
.info
|
|
13
|
+
%h2 Billing Contact Info
|
|
14
|
+
= render :partial => 'contact_info_form', :locals => {:f => cif}
|
|
15
|
+
|
|
16
|
+
= f.simple_fields_for :credit_card, @subscription.credit_card do |cf|
|
|
17
|
+
.info
|
|
18
|
+
%h2 Billing Payment Info
|
|
19
|
+
= render :partial => 'credit_card_form', :locals => {:f => cf}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
= f.submit "Create Subscription"
|
|
23
|
+
|
|
24
|
+
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
.saasaparilla
|
|
2
|
+
%h1 Subscription
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
- if @subscription.status == "canceled"
|
|
6
|
+
.info
|
|
7
|
+
%p
|
|
8
|
+
You do not have an active paid subscription.
|
|
9
|
+
= link_to "Reactivate your previous plan", reactivate_subscription_path, :confirm => "Are you sure you want to reactive your previous plan? Your credit card will be billed immediately."
|
|
10
|
+
|
|
11
|
+
- else
|
|
12
|
+
.info
|
|
13
|
+
%h2 Plan
|
|
14
|
+
|
|
15
|
+
%p
|
|
16
|
+
= "You are currently subscribed to the #{@subscription.plan.name} plan."
|
|
17
|
+
%p
|
|
18
|
+
= link_to "Change plan", edit_subscription_plan_path
|
|
19
|
+
|
|
20
|
+
.info
|
|
21
|
+
%h2 Billing Contact Info
|
|
22
|
+
|
|
23
|
+
%p
|
|
24
|
+
= "#{@subscription.contact_info.first_name} #{@subscription.contact_info.last_name}"
|
|
25
|
+
%br
|
|
26
|
+
= @subscription.contact_info.email
|
|
27
|
+
%br
|
|
28
|
+
- if @subscription.contact_info.require_billing_address?
|
|
29
|
+
= @subscription.contact_info.address
|
|
30
|
+
%br
|
|
31
|
+
= "#{@subscription.contact_info.city}, #{@subscription.contact_info.state} #{@subscription.contact_info.zip}"
|
|
32
|
+
%br
|
|
33
|
+
= @subscription.contact_info.country
|
|
34
|
+
%br
|
|
35
|
+
- if @subscription.contact_info.require_phone_number?
|
|
36
|
+
= "#{@subscription.contact_info.phone_number}"
|
|
37
|
+
%p
|
|
38
|
+
= link_to "Update", edit_subscription_contact_info_path(@subscription.contact_info)
|
|
39
|
+
|
|
40
|
+
.info
|
|
41
|
+
%h2 Billing Payment Info
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
%p
|
|
45
|
+
Card Number
|
|
46
|
+
%br
|
|
47
|
+
= @subscription.credit_card.card_number
|
|
48
|
+
%p
|
|
49
|
+
Expiration
|
|
50
|
+
%br
|
|
51
|
+
=@subscription.credit_card.expiration_date
|
|
52
|
+
%p
|
|
53
|
+
= link_to "Update", edit_subscription_credit_card_path(@subscription.credit_card)
|
|
54
|
+
|
|
55
|
+
.info
|
|
56
|
+
%h2 Billing History
|
|
57
|
+
%p
|
|
58
|
+
= "Balance: #{number_to_currency(@subscription.balance)}"
|
|
59
|
+
= link_to "Make a payment", new_subscription_payment_path if @subscription.balance > 0
|
|
60
|
+
%br
|
|
61
|
+
= "Your next billing date is #{@subscription.billing_date.to_s(:month_day_year)}"
|
|
62
|
+
%br
|
|
63
|
+
Your subscription was created on
|
|
64
|
+
= @subscription.created_at.to_s(:month_day_year)
|
|
65
|
+
|
|
66
|
+
%table.history-table
|
|
67
|
+
= render :partial => 'saasaparilla/billing_history/billing_activity', :collection => @subscription.billing_activities.recent.limit(5)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
.info
|
|
71
|
+
%h2 Actions
|
|
72
|
+
%p
|
|
73
|
+
= link_to "Cancel Subscription", @subscription, :method => "delete", :confirm => "Are you sure you want to cancel your subscription?"
|