effective_orders 4.5.0
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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +1004 -0
- data/app/assets/images/effective_orders/stripe.png +0 -0
- data/app/assets/javascripts/effective_orders.js +6 -0
- data/app/assets/javascripts/effective_orders/customers.js.coffee +32 -0
- data/app/assets/javascripts/effective_orders/providers/stripe.js.coffee +77 -0
- data/app/assets/javascripts/effective_orders/subscriptions.js.coffee +81 -0
- data/app/assets/stylesheets/effective_orders.scss +2 -0
- data/app/assets/stylesheets/effective_orders/_cart.scss +4 -0
- data/app/assets/stylesheets/effective_orders/_order.scss +58 -0
- data/app/controllers/admin/customers_controller.rb +24 -0
- data/app/controllers/admin/order_items_controller.rb +16 -0
- data/app/controllers/admin/orders_controller.rb +223 -0
- data/app/controllers/effective/carts_controller.rb +85 -0
- data/app/controllers/effective/concerns/purchase.rb +62 -0
- data/app/controllers/effective/customers_controller.rb +20 -0
- data/app/controllers/effective/orders_controller.rb +162 -0
- data/app/controllers/effective/providers/cheque.rb +22 -0
- data/app/controllers/effective/providers/free.rb +33 -0
- data/app/controllers/effective/providers/mark_as_paid.rb +33 -0
- data/app/controllers/effective/providers/moneris.rb +60 -0
- data/app/controllers/effective/providers/paypal.rb +33 -0
- data/app/controllers/effective/providers/phone.rb +22 -0
- data/app/controllers/effective/providers/pretend.rb +26 -0
- data/app/controllers/effective/providers/refund.rb +33 -0
- data/app/controllers/effective/providers/stripe.rb +72 -0
- data/app/controllers/effective/subscripter_controller.rb +18 -0
- data/app/controllers/effective/webhooks_controller.rb +109 -0
- data/app/datatables/admin/effective_customers_datatable.rb +22 -0
- data/app/datatables/admin/effective_orders_datatable.rb +100 -0
- data/app/datatables/effective_orders_datatable.rb +79 -0
- data/app/helpers/effective_carts_helper.rb +113 -0
- data/app/helpers/effective_orders_helper.rb +143 -0
- data/app/helpers/effective_paypal_helper.rb +49 -0
- data/app/helpers/effective_stripe_helper.rb +85 -0
- data/app/helpers/effective_subscriptions_helper.rb +34 -0
- data/app/mailers/effective/orders_mailer.rb +196 -0
- data/app/models/concerns/acts_as_purchasable.rb +118 -0
- data/app/models/concerns/acts_as_subscribable.rb +90 -0
- data/app/models/concerns/acts_as_subscribable_buyer.rb +49 -0
- data/app/models/effective/access_denied.rb +17 -0
- data/app/models/effective/cart.rb +88 -0
- data/app/models/effective/cart_item.rb +40 -0
- data/app/models/effective/customer.rb +92 -0
- data/app/models/effective/order.rb +541 -0
- data/app/models/effective/order_item.rb +63 -0
- data/app/models/effective/product.rb +23 -0
- data/app/models/effective/sold_out_validator.rb +7 -0
- data/app/models/effective/subscripter.rb +185 -0
- data/app/models/effective/subscription.rb +95 -0
- data/app/models/effective/tax_rate_calculator.rb +48 -0
- data/app/views/admin/customers/_actions.html.haml +2 -0
- data/app/views/admin/customers/index.html.haml +6 -0
- data/app/views/admin/customers/show.html.haml +6 -0
- data/app/views/admin/order_items/index.html.haml +3 -0
- data/app/views/admin/orders/_datatable_actions.html.haml +18 -0
- data/app/views/admin/orders/_form.html.haml +35 -0
- data/app/views/admin/orders/_form_note_internal.html.haml +7 -0
- data/app/views/admin/orders/_order_actions.html.haml +9 -0
- data/app/views/admin/orders/_order_item_fields.html.haml +14 -0
- data/app/views/admin/orders/checkout.html.haml +3 -0
- data/app/views/admin/orders/edit.html.haml +6 -0
- data/app/views/admin/orders/index.html.haml +6 -0
- data/app/views/admin/orders/new.html.haml +4 -0
- data/app/views/admin/orders/show.html.haml +4 -0
- data/app/views/effective/carts/_cart.html.haml +28 -0
- data/app/views/effective/carts/_cart_actions.html.haml +3 -0
- data/app/views/effective/carts/show.html.haml +17 -0
- data/app/views/effective/customers/_customer.html.haml +72 -0
- data/app/views/effective/customers/_form.html.haml +21 -0
- data/app/views/effective/customers/edit.html.haml +4 -0
- data/app/views/effective/customers/update.js.erb +5 -0
- data/app/views/effective/orders/_checkout_actions.html.haml +3 -0
- data/app/views/effective/orders/_checkout_step1.html.haml +4 -0
- data/app/views/effective/orders/_checkout_step2.html.haml +37 -0
- data/app/views/effective/orders/_datatable_actions.html.haml +2 -0
- data/app/views/effective/orders/_fields.html.haml +31 -0
- data/app/views/effective/orders/_fields_note.html.haml +7 -0
- data/app/views/effective/orders/_fields_terms.html.haml +8 -0
- data/app/views/effective/orders/_order.html.haml +11 -0
- data/app/views/effective/orders/_order_actions.html.haml +18 -0
- data/app/views/effective/orders/_order_deferred.html.haml +9 -0
- data/app/views/effective/orders/_order_footer.html.haml +1 -0
- data/app/views/effective/orders/_order_header.html.haml +23 -0
- data/app/views/effective/orders/_order_items.html.haml +72 -0
- data/app/views/effective/orders/_order_notes.html.haml +17 -0
- data/app/views/effective/orders/_order_payment.html.haml +24 -0
- data/app/views/effective/orders/_order_shipping.html.haml +30 -0
- data/app/views/effective/orders/_orders_table.html.haml +23 -0
- data/app/views/effective/orders/cheque/_form.html.haml +4 -0
- data/app/views/effective/orders/declined.html.haml +12 -0
- data/app/views/effective/orders/deferred.html.haml +13 -0
- data/app/views/effective/orders/deferred/_form.html.haml +16 -0
- data/app/views/effective/orders/edit.html.haml +3 -0
- data/app/views/effective/orders/free/_form.html.haml +5 -0
- data/app/views/effective/orders/index.html.haml +3 -0
- data/app/views/effective/orders/mark_as_paid/_form.html.haml +23 -0
- data/app/views/effective/orders/moneris/_form.html.haml +47 -0
- data/app/views/effective/orders/new.html.haml +3 -0
- data/app/views/effective/orders/paypal/_form.html.haml +5 -0
- data/app/views/effective/orders/phone/_form.html.haml +4 -0
- data/app/views/effective/orders/pretend/_form.html.haml +8 -0
- data/app/views/effective/orders/purchased.html.haml +11 -0
- data/app/views/effective/orders/refund/_form.html.haml +5 -0
- data/app/views/effective/orders/show.html.haml +6 -0
- data/app/views/effective/orders/stripe/_element.html.haml +8 -0
- data/app/views/effective/orders/stripe/_form.html.haml +31 -0
- data/app/views/effective/orders_mailer/order_error.html.haml +11 -0
- data/app/views/effective/orders_mailer/order_receipt_to_admin.html.haml +2 -0
- data/app/views/effective/orders_mailer/order_receipt_to_buyer.html.haml +2 -0
- data/app/views/effective/orders_mailer/payment_request_to_buyer.html.haml +13 -0
- data/app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml +13 -0
- data/app/views/effective/orders_mailer/refund_notification_to_admin.html.haml +15 -0
- data/app/views/effective/orders_mailer/subscription_canceled.html.haml +9 -0
- data/app/views/effective/orders_mailer/subscription_created.html.haml +13 -0
- data/app/views/effective/orders_mailer/subscription_event_to_admin.html.haml +13 -0
- data/app/views/effective/orders_mailer/subscription_payment_failed.html.haml +9 -0
- data/app/views/effective/orders_mailer/subscription_payment_succeeded.html.haml +9 -0
- data/app/views/effective/orders_mailer/subscription_trial_expired.html.haml +5 -0
- data/app/views/effective/orders_mailer/subscription_trialing.html.haml +7 -0
- data/app/views/effective/orders_mailer/subscription_updated.html.haml +13 -0
- data/app/views/effective/subscripter/_form.html.haml +60 -0
- data/app/views/effective/subscripter/_plan.html.haml +23 -0
- data/app/views/layouts/effective_orders_mailer_layout.html.haml +25 -0
- data/config/effective_orders.rb +279 -0
- data/config/routes.rb +70 -0
- data/db/migrate/01_create_effective_orders.rb.erb +137 -0
- data/lib/effective_orders.rb +243 -0
- data/lib/effective_orders/engine.rb +60 -0
- data/lib/effective_orders/version.rb +3 -0
- data/lib/generators/effective_orders/install_generator.rb +63 -0
- data/lib/generators/templates/effective_orders_mailer_preview.rb +120 -0
- data/lib/tasks/effective_orders_tasks.rake +69 -0
- metadata +276 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
%p.effective-orders-receipt-info Pending order created
|
|
2
|
+
|
|
3
|
+
%p We have received notice of your intention to purchase the following items.
|
|
4
|
+
|
|
5
|
+
%p Please remit payment at your earliest convenience.
|
|
6
|
+
|
|
7
|
+
%p #{link_to('Click here', effective_orders.order_url(@order))} to review your order online.
|
|
8
|
+
|
|
9
|
+
- if EffectiveOrders.cheque?
|
|
10
|
+
%p When we receive your cheque in the mail we will mark your order paid.
|
|
11
|
+
|
|
12
|
+
= render(@order, no_order_actions: true)
|
|
13
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
%p.effective-orders-receipt-info A new refund has been created!
|
|
2
|
+
|
|
3
|
+
%p Please sign in to your payment processor and issue the following refund:
|
|
4
|
+
|
|
5
|
+
%p
|
|
6
|
+
Refund
|
|
7
|
+
= price_to_currency(@order.total)
|
|
8
|
+
to
|
|
9
|
+
= @order.billing_name
|
|
10
|
+
= @order.email
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
%p Thanks and have a great day!
|
|
14
|
+
|
|
15
|
+
= render(@order, no_order_actions: true)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
%p.effective-orders-receipt-info Subscription canceled
|
|
2
|
+
|
|
3
|
+
%p We will no longer charge your credit card.
|
|
4
|
+
|
|
5
|
+
%p Thank you for trying our app.
|
|
6
|
+
|
|
7
|
+
%p If you would like to continue, please click the following link to update your card settings:
|
|
8
|
+
|
|
9
|
+
%p= link_to(effective_orders.customer_settings_url, effective_orders.customer_settings_url)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
%p.effective-orders-receipt-info Subscription created
|
|
2
|
+
|
|
3
|
+
%p Thank you for subscribing!
|
|
4
|
+
|
|
5
|
+
%p You are currently subscribed to the following:
|
|
6
|
+
|
|
7
|
+
%ul
|
|
8
|
+
- @subscriptions.each do |subscription|
|
|
9
|
+
%li #{subscription.subscribable.to_s} - #{subscription}
|
|
10
|
+
|
|
11
|
+
%p Please click the following link to view past invoices or update your card settings:
|
|
12
|
+
|
|
13
|
+
%p= link_to(effective_orders.customer_settings_url, effective_orders.customer_settings_url)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
%p Hi admin,
|
|
2
|
+
|
|
3
|
+
%p A <strong>#{@event}</strong> event has occurred.
|
|
4
|
+
|
|
5
|
+
%p Customer: #{@customer}, #{@customer.email}, #{@customer.stripe_customer_id}
|
|
6
|
+
|
|
7
|
+
- if @subscriptions.present?
|
|
8
|
+
%p Current subscriptions:
|
|
9
|
+
%ul
|
|
10
|
+
- @subscriptions.each do |subscription|
|
|
11
|
+
%li #{subscription.subscribable.to_s} - #{subscription}
|
|
12
|
+
- else
|
|
13
|
+
%p This customer has no current subscriptions.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
%p.effective-orders-receipt-info Payment failed
|
|
2
|
+
|
|
3
|
+
%p We were unable to charge your credit card #{@customer.active_card}.
|
|
4
|
+
|
|
5
|
+
%p We will attempt to charge your credit card again in a few days for 3 total attempts.
|
|
6
|
+
|
|
7
|
+
%p Please click the following link to update your card settings:
|
|
8
|
+
|
|
9
|
+
%p= link_to(effective_orders.customer_settings_url, effective_orders.customer_settings_url)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
%p.effective-orders-receipt-info Payment succeeded
|
|
2
|
+
|
|
3
|
+
%p Thank you for your payment.
|
|
4
|
+
|
|
5
|
+
%p We have charged your credit card #{@customer.active_card}.
|
|
6
|
+
|
|
7
|
+
%p Please click the following link to view past invoices or update your card settings:
|
|
8
|
+
|
|
9
|
+
%p= link_to(effective_orders.customer_settings_url, effective_orders.customer_settings_url)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
%p.effective-orders-receipt-info Subscription updated
|
|
2
|
+
|
|
3
|
+
%p Your subscription has changed
|
|
4
|
+
|
|
5
|
+
%p You are currently subscribed to the following:
|
|
6
|
+
|
|
7
|
+
%ul
|
|
8
|
+
- @subscriptions.each do |subscription|
|
|
9
|
+
%li #{subscription.subscribable.to_s} - #{subscription}
|
|
10
|
+
|
|
11
|
+
%p Please click the following link to view past invoices or update your card settings:
|
|
12
|
+
|
|
13
|
+
%p= link_to(effective_orders.customer_settings_url, effective_orders.customer_settings_url)
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
= javascript_include_tag 'https://checkout.stripe.com/checkout.js'
|
|
2
|
+
|
|
3
|
+
- stripe = subscripter_stripe_data(subscripter)
|
|
4
|
+
- plans = subscripter_stripe_plans(subscripter)
|
|
5
|
+
|
|
6
|
+
- subscripter.quantity ||= subscripter.subscribable.subscribable_quantity_used
|
|
7
|
+
- subscripter.stripe_plan_id ||= Hash(plans.first)[:id]
|
|
8
|
+
|
|
9
|
+
- if subscripter.stripe_plan_id.present? && plans.present? && plans.none? { |plan| plan[:id] == subscripter.stripe_plan_id }
|
|
10
|
+
- closest_plan = plans.find { |plan| plan[:interval] == subscripter.plan[:interval] }
|
|
11
|
+
- subscripter.stripe_plan_id = closest_plan[:id] if closest_plan.present?
|
|
12
|
+
|
|
13
|
+
= effective_form_with(model: subscripter, url: effective_orders.subscripter_path, remote: true, data: { stripe: stripe, plans: plans }) do |f|
|
|
14
|
+
= f.hidden_field :subscribable_global_id
|
|
15
|
+
= f.hidden_field :stripe_token, value: nil
|
|
16
|
+
= f.hidden_field :stripe_plan_id
|
|
17
|
+
= f.error :stripe_token
|
|
18
|
+
|
|
19
|
+
- if f.object.subscribable.subscribed?
|
|
20
|
+
- quantity_used = f.object.subscribable.subscribable_quantity_used.to_i
|
|
21
|
+
- quantity_purchased = f.object.subscribable.subscription.quantity
|
|
22
|
+
|
|
23
|
+
.text-center
|
|
24
|
+
%p
|
|
25
|
+
You currently have <strong>#{pluralize(quantity_used, 'member')}</strong> in your team
|
|
26
|
+
and have space for <strong>#{pluralize(quantity_purchased, 'member')}</strong>.
|
|
27
|
+
|
|
28
|
+
- if quantity_purchased > quantity_used
|
|
29
|
+
%p You can add #{pluralize(quantity_purchased - quantity_used, 'more member')} without updating your plan.
|
|
30
|
+
- else
|
|
31
|
+
%p To add more members you will need to update your plan.
|
|
32
|
+
|
|
33
|
+
%p To pay for less than #{pluralize(quantity_used, 'member')}, remove some team members first.
|
|
34
|
+
|
|
35
|
+
- else
|
|
36
|
+
.text-center
|
|
37
|
+
%p
|
|
38
|
+
You are not currently subscribed to any plan.
|
|
39
|
+
%br
|
|
40
|
+
For full access, upgrade to a paid plan below.
|
|
41
|
+
%br
|
|
42
|
+
To upgrade with fewer people, remove some team members first.
|
|
43
|
+
|
|
44
|
+
.card.mb-4
|
|
45
|
+
.card-body.card-subscripter
|
|
46
|
+
%h5.card-title.subscripter-title Billing Cycle
|
|
47
|
+
|
|
48
|
+
= f.radios :stripe_plan_id, plans.map { |plan| [plan[:name], plan[:id]] }, label: false, buttons: true
|
|
49
|
+
|
|
50
|
+
%hr.mt-4.mb-4
|
|
51
|
+
|
|
52
|
+
- plans.each do |plan|
|
|
53
|
+
= f.show_if(:stripe_plan_id, plan[:id]) do
|
|
54
|
+
= render 'effective/subscripter/plan', plan: plan, f: f
|
|
55
|
+
|
|
56
|
+
= f.submit(border: false, center: true) do
|
|
57
|
+
- if f.object.token_required?
|
|
58
|
+
= f.save('Continue to Billing', class: 'effective-orders-stripe-token-required')
|
|
59
|
+
- else
|
|
60
|
+
= f.save('Upgrade Now')
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.effective-orders-stripe-plan{data: plan}
|
|
2
|
+
.d-flex.justify-content-around.align-top
|
|
3
|
+
= f.integer_field :quantity, autocomplete: 'off', required: true, label: 'Total People', maxlength: 3,
|
|
4
|
+
class: 'effective-orders-subscripter-plan-quantity form-control-lg'
|
|
5
|
+
|
|
6
|
+
.subscripter-math-symbol= 'x'
|
|
7
|
+
|
|
8
|
+
= f.static_field :price_per_person, label: 'Price Per Person' do
|
|
9
|
+
= price_to_currency(plan[:amount])
|
|
10
|
+
|
|
11
|
+
- if plan[:savings]
|
|
12
|
+
.subscripter-savings.text-danger
|
|
13
|
+
Save #{price_to_currency(plan[:savings])}/person
|
|
14
|
+
|
|
15
|
+
.subscripter-math-symbol= '='
|
|
16
|
+
|
|
17
|
+
= f.static_field :total_amount, label: 'Total Amount' do
|
|
18
|
+
= price_to_currency(plan[:amount] * f.object.quantity.to_i)
|
|
19
|
+
|
|
20
|
+
- if plan[:savings]
|
|
21
|
+
.subscripter-total-savings.text-danger
|
|
22
|
+
Save
|
|
23
|
+
%span #{price_to_currency(f.object.quantity.to_i * plan[:savings])}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
!!!
|
|
2
|
+
%html{style: 'background: #fff;'}
|
|
3
|
+
%head
|
|
4
|
+
%meta{:content => 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type'}
|
|
5
|
+
|
|
6
|
+
:css
|
|
7
|
+
.effective-order table.table { min-width: 650px; vertical-align: top; border: 0; }
|
|
8
|
+
.effective-order table.table td { border: 0; vertical-align: top; }
|
|
9
|
+
.effective-order { text-align: left; }
|
|
10
|
+
.effective-order .price { text-align: right; }
|
|
11
|
+
.effective-order tfoot th { text-align: right; }
|
|
12
|
+
.effective-order tfoot tr:first-child td { padding-top: 24px; }
|
|
13
|
+
.effective-order tfoot tr:first-child th { padding-top: 24px; }
|
|
14
|
+
.effective-order-shipping { padding-top: 12px; padding-bottom: 12px; }
|
|
15
|
+
.effective-order-header h1 { margin: 0; }
|
|
16
|
+
@media print { .effective-page-break { page-break-inside: avoid; page-break-after: always; min-height: 1px; } }
|
|
17
|
+
|
|
18
|
+
%body{style: 'background: #fff;'}
|
|
19
|
+
%table{style: 'width: 100%;'}
|
|
20
|
+
%tr
|
|
21
|
+
%td
|
|
22
|
+
%table{style: 'max-width: 650px; margin: 4px auto 30px;'}
|
|
23
|
+
%tbody{style: 'width: 100%;'}
|
|
24
|
+
%tr
|
|
25
|
+
%td= yield
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# EffectiveOrders Rails Engine
|
|
2
|
+
|
|
3
|
+
EffectiveOrders.setup do |config|
|
|
4
|
+
# Configure Database Tables
|
|
5
|
+
config.orders_table_name = :orders
|
|
6
|
+
config.order_items_table_name = :order_items
|
|
7
|
+
config.carts_table_name = :carts
|
|
8
|
+
config.cart_items_table_name = :cart_items
|
|
9
|
+
config.customers_table_name = :customers
|
|
10
|
+
config.subscriptions_table_name = :subscriptions
|
|
11
|
+
config.products_table_name = :products
|
|
12
|
+
|
|
13
|
+
# Authorization Method
|
|
14
|
+
#
|
|
15
|
+
# This method is called by all controller actions with the appropriate action and resource
|
|
16
|
+
# If the method returns false, an Effective::AccessDenied Error will be raised (see README.md for complete info)
|
|
17
|
+
#
|
|
18
|
+
# Use via Proc (and with CanCan):
|
|
19
|
+
# config.authorization_method = Proc.new { |controller, action, resource| can?(action, resource) }
|
|
20
|
+
#
|
|
21
|
+
# Use via custom method:
|
|
22
|
+
# config.authorization_method = :my_authorization_method
|
|
23
|
+
#
|
|
24
|
+
# And then in your application_controller.rb:
|
|
25
|
+
#
|
|
26
|
+
# def my_authorization_method(action, resource)
|
|
27
|
+
# current_user.is?(:admin)
|
|
28
|
+
# end
|
|
29
|
+
#
|
|
30
|
+
# Or disable the check completely:
|
|
31
|
+
# config.authorization_method = false
|
|
32
|
+
config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) } # CanCanCan
|
|
33
|
+
|
|
34
|
+
# Layout Settings
|
|
35
|
+
# Configure the Layout per controller, or all at once
|
|
36
|
+
|
|
37
|
+
# config.layout = 'application' # All EffectiveOrders controllers will use this layout
|
|
38
|
+
config.layout = {
|
|
39
|
+
carts: 'application',
|
|
40
|
+
orders: 'application',
|
|
41
|
+
subscriptions: 'application',
|
|
42
|
+
admin_customers: 'admin',
|
|
43
|
+
admin_orders: 'admin'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
# Filter the @orders on admin/orders#index screen
|
|
47
|
+
# config.orders_collection_scope = Proc.new { |scope| scope.where(...) }
|
|
48
|
+
|
|
49
|
+
# Require these addresses when creating a new Order. Works with effective_addresses gem
|
|
50
|
+
config.billing_address = true
|
|
51
|
+
config.shipping_address = false
|
|
52
|
+
config.use_address_full_name = true
|
|
53
|
+
|
|
54
|
+
# Use effective_obfuscation gem to change order.id into a seemingly random 10-digit number
|
|
55
|
+
config.obfuscate_order_ids = false
|
|
56
|
+
|
|
57
|
+
# If set, the orders#new screen will render effective/orders/_order_note_fields to capture any Note info
|
|
58
|
+
config.collect_note = false
|
|
59
|
+
config.collect_note_required = false
|
|
60
|
+
config.collect_note_message = ''
|
|
61
|
+
|
|
62
|
+
# If true, the orders#new screen will render effective/orders/_terms_and_conditions_fields to require a Terms of Service boolean
|
|
63
|
+
# config.terms_and_conditions_label can be a String or a Proc
|
|
64
|
+
# config.terms_and_conditions_label = Proc.new { |order| "Yes, I agree to the #{link_to 'terms and conditions', terms_and_conditions_path}." }
|
|
65
|
+
config.terms_and_conditions = false
|
|
66
|
+
config.terms_and_conditions_label = 'I agree to the terms and conditions.'
|
|
67
|
+
|
|
68
|
+
# Tax Calculation Method
|
|
69
|
+
# The Effective::TaxRateCalculator considers the order.billing_address and assigns a tax based on country & state code
|
|
70
|
+
# Right now, only Canadian provinces are supported. Sorry.
|
|
71
|
+
# To always charge 12.5% tax: Proc.new { |order| 12.5 }
|
|
72
|
+
# To always charge 0% tax: Proc.new { |order| 0 }
|
|
73
|
+
# If the Proc returns nil, the tax rate will be calculated once again whenever the order is validated
|
|
74
|
+
# An order must have a tax rate (even if the value is 0) to be purchased
|
|
75
|
+
config.order_tax_rate_method = Proc.new { |order| Effective::TaxRateCalculator.new(order: order).tax_rate }
|
|
76
|
+
|
|
77
|
+
# Minimum Charge
|
|
78
|
+
# Prevent orders less than this value from being purchased
|
|
79
|
+
# Stripe doesn't allow orders less than $0.50
|
|
80
|
+
# Set to nil for no minimum charge
|
|
81
|
+
# Default value is 50 cents, or $0.50
|
|
82
|
+
config.minimum_charge = 50
|
|
83
|
+
|
|
84
|
+
# Free Orders
|
|
85
|
+
# Allow orders with a total of 0.00 to be purchased (regardless of the minimum charge setting)
|
|
86
|
+
config.free_enabled = true
|
|
87
|
+
|
|
88
|
+
# Mark as Paid
|
|
89
|
+
# Mark an order as paid without going through a processor
|
|
90
|
+
# This is accessed via the admin screens only. Must have can?(:admin, :effective_orders)
|
|
91
|
+
config.mark_as_paid_enabled = false
|
|
92
|
+
|
|
93
|
+
# Pretend Purchase
|
|
94
|
+
# Display a 'Purchase order' button on the Checkout screen allowing the user
|
|
95
|
+
# to purchase an Order without going through the payment processor.
|
|
96
|
+
# WARNING: Setting this option to true will allow users to purchase! an Order without entering a credit card
|
|
97
|
+
# WARNING: When true, users can purchase! anything without paying money
|
|
98
|
+
config.pretend_enabled = !Rails.env.production?
|
|
99
|
+
config.pretend_message = '* payment information is not required to process this order at this time.'
|
|
100
|
+
|
|
101
|
+
# Mailer Settings
|
|
102
|
+
# effective_orders sends out receipts to buyers and admins as well as trial and subscription related emails.
|
|
103
|
+
# For all the emails, the same :subject_prefix will be prefixed. Leave as nil / empty string if you don't want any prefix
|
|
104
|
+
#
|
|
105
|
+
# All the subject_* keys below can one of:
|
|
106
|
+
# - nil / empty string to use the built in defaults
|
|
107
|
+
# - A string with the full subject line for this email
|
|
108
|
+
# - A Proc to create the subject line based on the email
|
|
109
|
+
# The subject_prefix will then be applied ontop of these.
|
|
110
|
+
#
|
|
111
|
+
# send_order_receipt_to_buyer: Proc.new { |order| "Order #{order.to_param} has been purchased"}
|
|
112
|
+
# subject_for_subscription_payment_succeeded: Proc.new { |order| "Order #{order.to_param} has been purchased"}
|
|
113
|
+
|
|
114
|
+
# subject_for_subscription_trialing: Proc.new { |subscribable| "Pending Order #{order.to_param}"}
|
|
115
|
+
|
|
116
|
+
config.mailer = {
|
|
117
|
+
send_order_receipt_to_admin: true,
|
|
118
|
+
send_order_receipt_to_buyer: true,
|
|
119
|
+
send_payment_request_to_buyer: true,
|
|
120
|
+
send_pending_order_invoice_to_buyer: true,
|
|
121
|
+
send_order_receipts_when_mark_as_paid: false,
|
|
122
|
+
|
|
123
|
+
send_subscription_event_to_admin: true,
|
|
124
|
+
send_subscription_created: true,
|
|
125
|
+
send_subscription_updated: true,
|
|
126
|
+
send_subscription_canceled: true,
|
|
127
|
+
send_subscription_payment_succeeded: true,
|
|
128
|
+
send_subscription_payment_failed: true,
|
|
129
|
+
|
|
130
|
+
send_subscription_trialing: true, # Only if you schedule the rake task to run
|
|
131
|
+
send_subscription_trial_expired: true, # Only if you schedule the rake task to run
|
|
132
|
+
|
|
133
|
+
subject_prefix: '[example]',
|
|
134
|
+
|
|
135
|
+
# Procs yield an Effective::Order object
|
|
136
|
+
subject_for_order_receipt_to_admin: '',
|
|
137
|
+
subject_for_order_receipt_to_buyer: '',
|
|
138
|
+
subject_for_payment_request_to_buyer: '',
|
|
139
|
+
subject_for_pending_order_invoice_to_buyer: '',
|
|
140
|
+
subject_for_refund_notification_to_admin: '',
|
|
141
|
+
|
|
142
|
+
# Procs yield an Effective::Customer object
|
|
143
|
+
subject_for_subscription_created: '',
|
|
144
|
+
subject_for_subscription_updated: '',
|
|
145
|
+
subject_for_subscription_canceled: '',
|
|
146
|
+
subject_for_subscription_payment_succeeded: '',
|
|
147
|
+
subject_for_subscription_payment_failed: '',
|
|
148
|
+
|
|
149
|
+
# Procs yield the acts_as_subscribable object
|
|
150
|
+
subject_for_subscription_trialing: '',
|
|
151
|
+
subject_for_subscription_trial_expired: '',
|
|
152
|
+
|
|
153
|
+
layout: 'effective_orders_mailer_layout',
|
|
154
|
+
|
|
155
|
+
default_from: 'info@example.com',
|
|
156
|
+
admin_email: 'admin@example.com', # Refund notifications will also be sent here
|
|
157
|
+
|
|
158
|
+
deliver_method: nil # When nil, will use deliver_later if active_job is configured, otherwise deliver_now
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
#######################################
|
|
162
|
+
## Payment Provider specific options ##
|
|
163
|
+
#######################################
|
|
164
|
+
|
|
165
|
+
# Cheque
|
|
166
|
+
# This is an deferred payment
|
|
167
|
+
config.cheque = false
|
|
168
|
+
|
|
169
|
+
# config.cheque = {
|
|
170
|
+
# confirm: 'Proceed with pay by cheque?',
|
|
171
|
+
# success: 'Thank you! You have indicated that this order will be purchased by cheque. Please send us a cheque and a copy of this invoice at your earliest convenience.'
|
|
172
|
+
# }
|
|
173
|
+
|
|
174
|
+
# Moneris
|
|
175
|
+
config.moneris = false
|
|
176
|
+
|
|
177
|
+
# if Rails.env.production?
|
|
178
|
+
# config.moneris = {
|
|
179
|
+
# ps_store_id: '',
|
|
180
|
+
# hpp_key: '',
|
|
181
|
+
# hpp_url: 'https://www3.moneris.com/HPPDP/index.php',
|
|
182
|
+
# verify_url: 'https://www3.moneris.com/HPPDP/verifyTxn.php'
|
|
183
|
+
# }
|
|
184
|
+
# else
|
|
185
|
+
# config.moneris = {
|
|
186
|
+
# ps_store_id: '',
|
|
187
|
+
# hpp_key: '',
|
|
188
|
+
# hpp_url: 'https://esqa.moneris.com/HPPDP/index.php',
|
|
189
|
+
# verify_url: 'https://esqa.moneris.com/HPPDP/verifyTxn.php'
|
|
190
|
+
# }
|
|
191
|
+
# end
|
|
192
|
+
|
|
193
|
+
# Paypal
|
|
194
|
+
config.paypal = false
|
|
195
|
+
|
|
196
|
+
# if Rails.env.production?
|
|
197
|
+
# config.paypal = {
|
|
198
|
+
# seller_email: '',
|
|
199
|
+
# secret: '',
|
|
200
|
+
# cert_id: '',
|
|
201
|
+
# paypal_url: 'https://www.paypal.com/cgi-bin/webscr',
|
|
202
|
+
# currency: 'CAD',
|
|
203
|
+
# paypal_cert: "#{Rails.root}/config/paypalcerts/production/paypal_cert.pem",
|
|
204
|
+
# app_cert: "#{Rails.root}/config/paypalcerts/production/app_cert.pem",
|
|
205
|
+
# app_key: "#{Rails.root}/config/paypalcerts/production/app_key.pem"
|
|
206
|
+
# }
|
|
207
|
+
# else
|
|
208
|
+
# config.paypal = {
|
|
209
|
+
# seller_email: '',
|
|
210
|
+
# secret: '',
|
|
211
|
+
# cert_id: '',
|
|
212
|
+
# paypal_url: 'https://www.sandbox.paypal.com/cgi-bin/webscr',
|
|
213
|
+
# currency: 'CAD',
|
|
214
|
+
# paypal_cert: "#{Rails.root}/config/paypalcerts/#{Rails.env}/paypal_cert.pem",
|
|
215
|
+
# app_cert: "#{Rails.root}/config/paypalcerts/#{Rails.env}/app_cert.pem",
|
|
216
|
+
# app_key: "#{Rails.root}/config/paypalcerts/#{Rails.env}/app_key.pem"
|
|
217
|
+
# }
|
|
218
|
+
# end
|
|
219
|
+
|
|
220
|
+
# Phone
|
|
221
|
+
# This is an deferred payment
|
|
222
|
+
config.phone = false
|
|
223
|
+
|
|
224
|
+
# config.phone = {
|
|
225
|
+
# confirm: 'Proceed with pay by phone?',
|
|
226
|
+
# success: 'Thank you! You have indicated that this order will be purchased by phone. Please give us a call at your earliest convenience.'
|
|
227
|
+
# }
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
# Refunds
|
|
231
|
+
# This does not issue a refund with the payment processor at all.
|
|
232
|
+
# Instead, we mark the order as purchased, create a refund object to track it, and
|
|
233
|
+
# send an email to mailer[:admin_email] with instructions to issue a refund
|
|
234
|
+
config.refund = false
|
|
235
|
+
|
|
236
|
+
# config.refund = {
|
|
237
|
+
# success: 'Thank you! Your refund will be processed in the next few business days.'
|
|
238
|
+
# }
|
|
239
|
+
|
|
240
|
+
# Stripe
|
|
241
|
+
config.stripe = false
|
|
242
|
+
|
|
243
|
+
# if Rails.env.production?
|
|
244
|
+
# config.stripe = {
|
|
245
|
+
# secret_key: 'sk_xxx',
|
|
246
|
+
# publishable_key: 'pk_xxx',
|
|
247
|
+
# currency: 'usd',
|
|
248
|
+
# site_title: 'My Site',
|
|
249
|
+
# site_image: 'logo.png' # A relative or absolute URL pointing to a square image of your brand or product. The recommended minimum size is 128x128px.
|
|
250
|
+
# }
|
|
251
|
+
# else
|
|
252
|
+
# config.stripe = {
|
|
253
|
+
# secret_key: 'sk_test_xxx',
|
|
254
|
+
# publishable_key: 'pk_test_xxx',
|
|
255
|
+
# currency: 'usd',
|
|
256
|
+
# site_title: 'My Site',
|
|
257
|
+
# site_image: 'logo.png' # A relative or absolute URL pointing to a square image of your brand or product. The recommended minimum size is 128x128px.
|
|
258
|
+
# }
|
|
259
|
+
# end
|
|
260
|
+
|
|
261
|
+
# Subscriptions (https://stripe.com/docs/subscriptions)
|
|
262
|
+
config.subscriptions = false
|
|
263
|
+
|
|
264
|
+
# config.subscriptions = {
|
|
265
|
+
# webhook_secret: 'whsec_xxx',
|
|
266
|
+
# ignore_livemode: false # Use this to run test mode in production. careful.
|
|
267
|
+
# }
|
|
268
|
+
|
|
269
|
+
# Trial
|
|
270
|
+
config.trial = false
|
|
271
|
+
|
|
272
|
+
# config.trial = {
|
|
273
|
+
# name: 'Free Trial',
|
|
274
|
+
# description: '45-Day Free Trial',
|
|
275
|
+
# length: 45.days,
|
|
276
|
+
# remind_at: [1.day, 3.days, 7.days, 40.days, 44.days], # Send email notification to trialing owners on day 1, 3, 7 40 and 44. false to disable
|
|
277
|
+
# }
|
|
278
|
+
|
|
279
|
+
end
|