effective_orders 3.2.3 → 4.0.0beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/MIT-LICENSE +1 -1
- data/README.md +11 -99
- data/app/assets/stylesheets/effective_orders.scss +1 -0
- data/app/assets/stylesheets/effective_orders/_cart.scss +4 -0
- data/app/assets/stylesheets/effective_orders/_order.scss +6 -2
- data/app/controllers/admin/orders_controller.rb +17 -17
- data/app/controllers/effective/carts_controller.rb +4 -2
- data/app/controllers/effective/orders_controller.rb +50 -105
- data/app/controllers/effective/providers/cheque.rb +1 -1
- data/app/controllers/effective/providers/moneris.rb +17 -23
- data/app/controllers/effective/providers/stripe.rb +2 -37
- data/app/datatables/effective_customers_datatable.rb +1 -5
- data/app/datatables/effective_order_items_datatable.rb +10 -10
- data/app/datatables/effective_orders_datatable.rb +23 -46
- data/app/helpers/effective_carts_helper.rb +5 -25
- data/app/helpers/effective_orders_helper.rb +29 -61
- data/app/helpers/effective_paypal_helper.rb +10 -8
- data/app/helpers/effective_stripe_helper.rb +2 -33
- data/app/models/concerns/acts_as_purchasable.rb +26 -37
- data/app/models/concerns/acts_as_subscribable.rb +1 -1
- data/app/models/effective/cart.rb +4 -5
- data/app/models/effective/customer.rb +1 -4
- data/app/models/effective/order.rb +132 -163
- data/app/models/effective/order_item.rb +2 -21
- data/app/models/{effective → validators/effective}/sold_out_validator.rb +0 -0
- data/app/views/admin/customers/index.html.haml +1 -4
- data/app/views/admin/order_items/index.html.haml +1 -4
- data/app/views/admin/orders/_actions.html.haml +18 -9
- data/app/views/admin/orders/_form.html.haml +12 -14
- data/app/views/admin/orders/_form_note_internal.html.haml +2 -2
- data/app/views/admin/orders/_order_actions.html.haml +8 -5
- data/app/views/admin/orders/_order_item_fields.html.haml +9 -8
- data/app/views/admin/orders/checkout.html.haml +3 -0
- data/app/views/admin/orders/edit.html.haml +3 -1
- data/app/views/admin/orders/new.html.haml +2 -1
- data/app/views/admin/orders/show.html.haml +2 -5
- data/app/views/effective/carts/_cart.html.haml +1 -1
- data/app/views/effective/carts/_cart_actions.html.haml +3 -4
- data/app/views/effective/carts/show.html.haml +4 -4
- data/app/views/effective/orders/_checkout_actions.html.haml +3 -0
- data/app/views/effective/orders/_checkout_step1.html.haml +20 -27
- data/app/views/effective/orders/_checkout_step2.html.haml +26 -30
- data/app/views/effective/orders/_order.html.haml +1 -2
- data/app/views/effective/orders/_order_actions.html.haml +14 -6
- data/app/views/effective/orders/_order_header.html.haml +2 -2
- data/app/views/effective/orders/_order_note_fields.html.haml +6 -4
- data/app/views/effective/orders/_order_notes.html.haml +15 -0
- data/app/views/effective/orders/_order_payment_details.html.haml +1 -1
- data/app/views/effective/orders/_order_shipping.html.haml +6 -6
- data/app/views/effective/orders/_order_terms_and_conditions_fields.html.haml +5 -6
- data/app/views/effective/orders/_order_user_fields.html.haml +5 -11
- data/app/views/effective/orders/_orders_table.html.haml +2 -6
- data/app/views/effective/orders/index.html.haml +2 -1
- data/app/views/effective/orders/mark_as_paid/_form.html.haml +8 -14
- data/app/views/effective/orders/moneris/_form.html.haml +43 -4
- data/app/views/effective/orders/pretend/_form.html.haml +1 -3
- data/app/views/effective/orders/refund/_form.html.haml +8 -12
- data/app/views/effective/orders/show.html.haml +2 -2
- data/app/views/effective/orders/stripe/_form.html.haml +4 -4
- data/app/views/effective/orders_mailer/payment_request_to_buyer.html.haml +1 -1
- data/app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml +1 -1
- data/config/effective_orders.rb +116 -182
- data/config/routes.rb +16 -27
- data/db/migrate/01_create_effective_orders.rb.erb +6 -5
- data/lib/effective_orders.rb +72 -76
- data/lib/effective_orders/engine.rb +8 -80
- data/lib/effective_orders/version.rb +1 -1
- data/lib/generators/templates/effective_orders_mailer_preview.rb +4 -4
- metadata +26 -38
- data/Rakefile +0 -21
- data/app/assets/config/effective_orders_manifest.js +0 -3
- data/app/assets/images/effective_orders/stripe_connect.png +0 -0
- data/app/controllers/effective/providers/app_checkout.rb +0 -38
- data/app/controllers/effective/providers/ccbill.rb +0 -34
- data/app/controllers/effective/providers/stripe_connect.rb +0 -47
- data/app/helpers/effective_ccbill_helper.rb +0 -25
- data/app/models/effective/providers/ccbill_postback.rb +0 -85
- data/app/models/effective/providers/moneris_charge.rb +0 -115
- data/app/views/effective/orders/_order_note.html.haml +0 -5
- data/app/views/effective/orders/_order_note_to_buyer.html.haml +0 -9
- data/app/views/effective/orders/app_checkout/_form.html.haml +0 -2
- data/app/views/effective/orders/ccbill/_form.html.haml +0 -24
- data/app/views/effective/orders/my_purchases.html.haml +0 -3
- data/app/views/effective/orders/my_sales.html.haml +0 -25
- data/app/views/effective/orders_mailer/order_receipt_to_seller.html.haml +0 -25
- data/lib/effective_orders/app_checkout_service.rb +0 -26
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
%p= EffectiveOrders.collect_note_message.html_safe
|
1
|
+
.effective-order-note-fields
|
2
|
+
%h2 Note
|
4
3
|
|
5
|
-
|
4
|
+
- if EffectiveOrders.collect_note_message.present?
|
5
|
+
%p= EffectiveOrders.collect_note_message.html_safe
|
6
|
+
|
7
|
+
= form.text_area :note, required: (EffectiveOrders.collect_note_required == true)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
- if order.note.present? || order.note_to_buyer.present?
|
2
|
+
.effective-order-notes
|
3
|
+
%table.table
|
4
|
+
%thead
|
5
|
+
%tr
|
6
|
+
- if order.note.present?
|
7
|
+
%th Note
|
8
|
+
- if order.note_to_buyer.present?
|
9
|
+
%th Receipt note
|
10
|
+
%tbody
|
11
|
+
%tr
|
12
|
+
- if order.note.present?
|
13
|
+
%td= order.note
|
14
|
+
- if order.note_to_buyer.present?
|
15
|
+
%td= order.note_to_buyer
|
@@ -9,14 +9,14 @@
|
|
9
9
|
%tbody
|
10
10
|
%tr
|
11
11
|
%td
|
12
|
-
-
|
12
|
+
- if order.billing_address.present?
|
13
|
+
= render(partial: 'effective/addresses/address', locals: { address: order.billing_address })
|
14
|
+
- else
|
13
15
|
= order.billing_name
|
14
16
|
%br
|
15
|
-
|
16
|
-
|
17
|
-
= render :partial => 'effective/addresses/address',
|
18
|
-
locals: {address: order.billing_address, email: order.user.email }
|
17
|
+
= mail_to(order.user.email)
|
18
|
+
%br
|
19
19
|
|
20
20
|
- if order.shipping_address.present?
|
21
21
|
%td
|
22
|
-
= render
|
22
|
+
= render(partial: 'effective/addresses/address', locals: { address: order.shipping_address })
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
1
|
+
.effective-order-terms-and-conditions
|
2
|
+
%h2 Terms and Conditions
|
2
3
|
|
3
|
-
- terms = EffectiveOrders.terms_and_conditions_label
|
4
|
+
- terms = EffectiveOrders.terms_and_conditions_label
|
4
5
|
|
5
|
-
= form.
|
6
|
-
|
7
|
-
as: :boolean,
|
8
|
-
label: ((terms.respond_to?(:call) ? instance_exec(form.object, &terms) : terms).presence || 'I accept the terms and conditions.').html_safe
|
6
|
+
= form.check_box :terms_and_conditions, required: true,
|
7
|
+
label: ((terms.respond_to?(:call) ? instance_exec(form.object, &terms) : terms).presence || 'I accept the terms and conditions.').html_safe
|
@@ -1,11 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
-
|
5
|
-
=
|
6
|
-
- else
|
7
|
-
= fa.input :salutation, :required => true, :placeholder => 'Salutation'
|
8
|
-
|
9
|
-
- (EffectiveOrders.collect_user_fields || []).reject { |x| x == :salutation }.each do |field|
|
10
|
-
- if fa.object.respond_to?(field)
|
11
|
-
= fa.input field, :required => true, :placeholder => field.to_s.humanize
|
1
|
+
.effective-order-user-fields
|
2
|
+
%h2 User Information
|
3
|
+
= form.fields_for :user, user do |fu|
|
4
|
+
- Array(EffectiveOrders.collect_user_fields).select { |field| fu.object.respond_to?(field) }.each do |field|
|
5
|
+
= fu.text_field field, required: true
|
@@ -11,12 +11,8 @@
|
|
11
11
|
%tr
|
12
12
|
%td ##{order.to_param}
|
13
13
|
%td
|
14
|
-
|
15
|
-
|
16
|
-
= order.purchased_at.strftime("%Y-%m-%d %H:%M")
|
17
|
-
- else
|
18
|
-
Created
|
19
|
-
= order.created_at.strftime("%Y-%m-%d %H:%M")
|
14
|
+
= (order.purchased? ? 'Purchased' : 'Created')
|
15
|
+
= (order.purchased_at || order.created_at).strftime("%F %H:%M")
|
20
16
|
%td= order_summary(order)
|
21
17
|
%td
|
22
18
|
- if order.pending?
|
@@ -2,31 +2,25 @@
|
|
2
2
|
.panel-body
|
3
3
|
%h2 Admin: Offline Payment
|
4
4
|
|
5
|
-
=
|
5
|
+
= effective_form_with(model: order, url: effective_orders.mark_as_paid_order_path(order), method: :post) do |f|
|
6
6
|
= hidden_field_tag(:purchased_url, purchased_url)
|
7
7
|
= hidden_field_tag(:declined_url, declined_url)
|
8
|
-
= f.
|
9
|
-
as: :effective_select,
|
10
|
-
collection: (EffectiveOrders.payment_providers + EffectiveOrders.other_payment_providers).sort,
|
11
|
-
required: true
|
8
|
+
= f.select :payment_provider, EffectiveOrders.payment_providers, required: true
|
12
9
|
|
13
|
-
= f.
|
10
|
+
= f.text_field :payment_card,
|
14
11
|
label: 'Payment card type, cheque or transaction number',
|
15
|
-
placeholder: 'visa',
|
12
|
+
placeholder: 'visa card',
|
16
13
|
hint: 'Full credit card numbers should not be entered here, or anywhere.'
|
17
14
|
|
18
|
-
= f.
|
19
|
-
as: :text,
|
15
|
+
= f.text_area :payment,
|
20
16
|
label: 'Additional details',
|
21
17
|
input_html: { value: f.object.payment.kind_of?(Hash) ? f.object.payment[:details] : f.object.payment.presence }
|
22
18
|
|
23
|
-
= f.
|
24
|
-
as: :boolean,
|
19
|
+
= f.check_box :send_mark_as_paid_email_to_buyer,
|
25
20
|
label: 'Yes, send a receipt email to the buyer.',
|
26
21
|
input_html: { checked: (f.object.send_mark_as_paid_email_to_buyer.nil? ? EffectiveOrders.mailer[:send_order_receipts_when_mark_as_paid] : f.object.send_mark_as_paid_email_to_buyer?) }
|
27
22
|
|
28
|
-
= f.
|
23
|
+
= f.text_area :note_to_buyer, hint: 'This message will be displayed on the receipt.'
|
29
24
|
|
30
|
-
|
31
|
-
= f.submit order_checkout_label(:mark_as_paid), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
|
25
|
+
= effective_save(f, 'Admin: Mark as Paid')
|
32
26
|
|
@@ -1,8 +1,47 @@
|
|
1
1
|
= form_tag(EffectiveOrders.moneris[:hpp_url], method: :post) do
|
2
|
-
|
2
|
+
= hidden_field_tag(:ps_store_id, EffectiveOrders.moneris[:ps_store_id])
|
3
|
+
= hidden_field_tag(:hpp_key, EffectiveOrders.moneris[:hpp_key])
|
4
|
+
= hidden_field_tag(:lang, 'en-ca')
|
5
|
+
= hidden_field_tag(:rvar_authenticity_token, form_authenticity_token)
|
3
6
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
+
- if purchased_url.present?
|
8
|
+
= hidden_field_tag(:rvar_purchased_url, purchased_url)
|
9
|
+
|
10
|
+
- if declined_url.present?
|
11
|
+
= hidden_field_tag(:rvar_declined_url, declined_url)
|
12
|
+
|
13
|
+
= hidden_field_tag(:email, order.user.try(:email))
|
14
|
+
= hidden_field_tag(:cust_id, order.user.to_param)
|
15
|
+
|
16
|
+
= hidden_field_tag(:order_id, [order.to_param, order.billing_name.to_s.parameterize.presence, Time.zone.now.to_i].compact.join('-'))
|
17
|
+
= hidden_field_tag(:gst, '%.2f' % (order.tax / 100.0))
|
18
|
+
= hidden_field_tag(:charge_total, '%.2f' % (order.total / 100.0))
|
19
|
+
|
20
|
+
- order.order_items.each_with_index do |item, x|
|
21
|
+
= hidden_field_tag("id#{x}", x)
|
22
|
+
= hidden_field_tag("description#{x}", item.title)
|
23
|
+
= hidden_field_tag("quantity#{x}", item.quantity)
|
24
|
+
= hidden_field_tag("price#{x}", '%.2f' % (item.price / 100.0))
|
25
|
+
= hidden_field_tag("subtotal#{x}", '%.2f' % (item.subtotal / 100.0))
|
26
|
+
|
27
|
+
- if order.billing_address.present?
|
28
|
+
- address = order.billing_address
|
29
|
+
= hidden_field_tag(:bill_first_name, address.first_name || order.try(:user).try(:first_name))
|
30
|
+
= hidden_field_tag(:bill_last_name, address.last_name || order.try(:user).try(:last_name))
|
31
|
+
= hidden_field_tag(:bill_address_one, address.address1)
|
32
|
+
= hidden_field_tag(:bill_city, address.city)
|
33
|
+
= hidden_field_tag(:bill_state_or_province, address.state)
|
34
|
+
= hidden_field_tag(:bill_postal_code, address.postal_code)
|
35
|
+
= hidden_field_tag(:bill_country, address.country)
|
36
|
+
|
37
|
+
- if order.shipping_address.present?
|
38
|
+
- address = order.shipping_address
|
39
|
+
= hidden_field_tag(:ship_first_name, address.first_name || order.try(:user).try(:first_name))
|
40
|
+
= hidden_field_tag(:ship_last_name, address.last_name || order.try(:user).try(:last_name))
|
41
|
+
= hidden_field_tag(:ship_address_one, address.address1)
|
42
|
+
= hidden_field_tag(:ship_city, address.city)
|
43
|
+
= hidden_field_tag(:ship_state_or_province, address.state)
|
44
|
+
= hidden_field_tag(:ship_postal_code, address.postal_code)
|
45
|
+
= hidden_field_tag(:ship_country, address.country)
|
7
46
|
|
8
47
|
= submit_tag order_checkout_label(:moneris), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
|
@@ -1,4 +1,2 @@
|
|
1
|
-
= form_tag(effective_orders.pretend_order_path(order), method: :post) do
|
2
|
-
= hidden_field_tag(:purchased_url, purchased_url)
|
3
|
-
= hidden_field_tag(:declined_url, declined_url)
|
1
|
+
= form_tag(effective_orders.pretend_order_path(order, purchased_url: purchased_url, declined_url: declined_url), method: :post) do
|
4
2
|
= submit_tag order_checkout_label(:pretend), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
|
@@ -2,31 +2,27 @@
|
|
2
2
|
.panel-body
|
3
3
|
%h2 Admin: Complete Refund
|
4
4
|
|
5
|
-
=
|
5
|
+
= effective_form_with(model: order, url: effective_orders.refund_order_path(order), method: :post) do |f|
|
6
6
|
= hidden_field_tag(:purchased_url, purchased_url)
|
7
7
|
= hidden_field_tag(:declined_url, declined_url)
|
8
|
-
= f.input :payment_provider,
|
9
|
-
as: :effective_select,
|
10
|
-
collection: (EffectiveOrders.payment_providers + EffectiveOrders.other_payment_providers).sort,
|
11
|
-
required: true
|
12
8
|
|
13
|
-
= f.
|
9
|
+
= f.select :payment_provider, EffectiveOrders.payment_providers, required: true
|
10
|
+
|
11
|
+
= f.text_field :payment_card,
|
14
12
|
label: 'Payment card type, cheque or transaction number',
|
15
13
|
placeholder: 'visa',
|
16
14
|
hint: 'Full credit card numbers should not be entered here, or anywhere.'
|
17
15
|
|
18
|
-
= f.
|
19
|
-
as: :text,
|
16
|
+
= f.text_area :payment,
|
20
17
|
label: 'Additional details',
|
21
18
|
input_html: { value: f.object.payment.kind_of?(Hash) ? f.object.payment[:details] : f.object.payment.presence }
|
22
19
|
|
23
|
-
= f.
|
24
|
-
as: :boolean,
|
20
|
+
= f.check_box :send_mark_as_paid_email_to_buyer,
|
25
21
|
label: 'Yes, send an refund receipt email to the buyer.',
|
26
22
|
input_html: { checked: (f.object.send_mark_as_paid_email_to_buyer.nil? ? EffectiveOrders.mailer[:send_order_receipts_when_mark_as_paid] : f.object.send_mark_as_paid_email_to_buyer?) }
|
27
23
|
|
28
|
-
= f.
|
24
|
+
= f.text_area :note_to_buyer, hint: 'This is displayed to the buyer on all order receipts.'
|
29
25
|
|
30
26
|
.text-right
|
31
|
-
= f.submit order_checkout_label(:refund), class: 'btn btn-primary'
|
27
|
+
= f.submit order_checkout_label(:refund), class: 'btn btn-primary'
|
32
28
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
= javascript_include_tag 'https://checkout.stripe.com/checkout.js'
|
2
2
|
|
3
3
|
#effective-orders-new-charge-form{data: stripe_charge_data(order) }
|
4
|
-
=
|
5
|
-
= f.
|
6
|
-
= f.
|
7
|
-
= f.submit order_checkout_label(:stripe), class: 'btn btn-primary'
|
4
|
+
= effective_form_with(model: @stripe_charge || Effective::Providers::StripeCharge.new(order: order), url: effective_orders.stripe_charge_orders_path) do |f|
|
5
|
+
= f.hidden_field :stripe_token
|
6
|
+
= f.hidden_field :effective_order_id
|
7
|
+
= f.submit order_checkout_label(:stripe), class: 'btn btn-primary'
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
%p #{link_to('Click here', effective_orders.order_url(@order))} to review your order and pay online with a credit card.
|
8
8
|
|
9
|
-
- if EffectiveOrders.
|
9
|
+
- if EffectiveOrders.cheque?
|
10
10
|
%p We also accept cheques via the mail, and we will manually mark your order paid upon receiving it.
|
11
11
|
|
12
12
|
= render(@order, no_order_actions: true)
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
%p #{link_to('Click here', effective_orders.order_url(@order))} to review your order online.
|
8
8
|
|
9
|
-
- if EffectiveOrders.
|
9
|
+
- if EffectiveOrders.cheque?
|
10
10
|
%p When we receive your cheque in the mail we will mark your order paid.
|
11
11
|
|
12
12
|
= render(@order, no_order_actions: true)
|
data/config/effective_orders.rb
CHANGED
@@ -31,34 +31,40 @@ EffectiveOrders.setup do |config|
|
|
31
31
|
# config.authorization_method = false
|
32
32
|
config.authorization_method = Proc.new { |controller, action, resource| authorize!(action, resource) } # CanCanCan
|
33
33
|
|
34
|
-
#
|
35
|
-
|
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
|
+
}
|
36
45
|
|
37
46
|
# Filter the @orders on admin/orders#index screen
|
38
47
|
# config.orders_collection_scope = Proc.new { |scope| scope.where(...) }
|
39
48
|
|
40
|
-
# Use effective_obfuscation gem to change order.id into a seemingly random 10-digit number
|
41
|
-
config.obfuscate_order_ids = false
|
42
|
-
|
43
49
|
# Require these addresses when creating a new Order. Works with effective_addresses gem
|
44
|
-
config.
|
45
|
-
config.
|
46
|
-
|
47
|
-
# Use billing/shipping address full name in checkout process. Address full name will be validated.
|
48
|
-
# Works with effective_addresses gem
|
50
|
+
config.billing_address = true
|
51
|
+
config.shipping_address = false
|
49
52
|
config.use_address_full_name = true
|
50
53
|
|
54
|
+
# Use effective_obfuscation gem to change order.id into a seemingly random 10-digit number
|
55
|
+
config.obfuscate_order_ids = false
|
56
|
+
|
51
57
|
# If set, the orders#new screen will render effective/orders/_order_user_fields to capture this User Info
|
52
58
|
# The partial can be overridden to customize the form, but the following fields are also fed into strong_paramters
|
53
59
|
config.collect_user_fields = []
|
54
|
-
#config.collect_user_fields = [:
|
60
|
+
#config.collect_user_fields = [:first_name, :last_name] # Must be valid fields on the User object
|
55
61
|
|
56
62
|
# Don't validate_associated :user when saving an Order
|
57
63
|
config.skip_user_validation = false
|
58
64
|
|
59
65
|
# If set, the orders#new screen will render effective/orders/_order_note_fields to capture any Note info
|
60
66
|
config.collect_note = false
|
61
|
-
config.collect_note_required = false
|
67
|
+
config.collect_note_required = false
|
62
68
|
config.collect_note_message = ''
|
63
69
|
|
64
70
|
# If true, the orders#new screen will render effective/orders/_terms_and_conditions_fields to require a Terms of Service boolean
|
@@ -85,20 +91,24 @@ EffectiveOrders.setup do |config|
|
|
85
91
|
|
86
92
|
# Free Orders
|
87
93
|
# Allow orders with a total of 0.00 to be purchased (regardless of the minimum charge setting)
|
88
|
-
|
89
|
-
|
94
|
+
config.free_enabled = true
|
95
|
+
|
96
|
+
# Mark as Paid
|
97
|
+
# Mark an order as paid without going through a processor
|
98
|
+
# This is accessed via the admin screens only. Must have can?(:admin, :effective_orders)
|
99
|
+
config.mark_as_paid_enabled = false
|
90
100
|
|
91
101
|
# Refunds
|
92
102
|
# Allow admins to create orders with a negative total
|
93
|
-
# Refunds don't perform any kind of refund action with the payment processor.
|
94
|
-
|
95
|
-
config.allow_refunds = false
|
103
|
+
# Refunds don't perform any kind of refund action with the payment processor. This just changes the validations.
|
104
|
+
config.refunds_enabled = false
|
96
105
|
|
106
|
+
# Pretend Purchase in Development
|
97
107
|
# Display a 'Purchase order' button on the Checkout screen allowing the user
|
98
|
-
# to purchase an Order without going through the payment processor
|
99
|
-
config.
|
108
|
+
# to purchase an Order without going through the payment processor. Works in !Rails.env.production?
|
109
|
+
config.pretend_purchase_in_development_enabled = true
|
100
110
|
|
101
|
-
#
|
111
|
+
# Pretend Purchase in Production
|
102
112
|
# WARNING: Setting this option to true will allow users to purchase! an Order without entering a credit card
|
103
113
|
# WARNING: When true, users can purchase! anything without paying money
|
104
114
|
#
|
@@ -108,38 +118,8 @@ EffectiveOrders.setup do |config|
|
|
108
118
|
# When true, there will be a 'Process Order' button on the Checkout screen.
|
109
119
|
# Clicking this button will mark an Order purchased and redirect the user to the
|
110
120
|
# Thank You page just as if they had successfully Checked Out through a payment processor
|
111
|
-
config.
|
112
|
-
config.
|
113
|
-
|
114
|
-
# Show/hide the 'Order History' button on the 'Cart Page'
|
115
|
-
config.show_order_history_button = true
|
116
|
-
|
117
|
-
# Layout Settings
|
118
|
-
# Configure the Layout per controller, or all at once
|
119
|
-
|
120
|
-
# config.layout = 'application' # All EffectiveOrders controllers will use this layout
|
121
|
-
config.layout = {
|
122
|
-
carts: 'application',
|
123
|
-
orders: 'application',
|
124
|
-
subscriptions: 'application',
|
125
|
-
admin_customers: 'application',
|
126
|
-
admin_orders: 'application'
|
127
|
-
}
|
128
|
-
|
129
|
-
# SimpleForm Options
|
130
|
-
# This Hash of options will be passed into any client facing simple_form_for() calls
|
131
|
-
config.simple_form_options = {}
|
132
|
-
config.admin_simple_form_options = {} # For the /admin/orders/new form
|
133
|
-
|
134
|
-
# config.simple_form_options = {
|
135
|
-
# :html => {:class => ['form-horizontal']},
|
136
|
-
# :wrapper => :horizontal_form,
|
137
|
-
# :wrapper_mappings => {
|
138
|
-
# :boolean => :horizontal_boolean,
|
139
|
-
# :check_boxes => :horizontal_radio_and_checkboxes,
|
140
|
-
# :radio_buttons => :horizontal_radio_and_checkboxes
|
141
|
-
# }
|
142
|
-
# }
|
121
|
+
config.pretend_purchase_in_production_enabled = false
|
122
|
+
config.pretend_purchase_in_production_message = '* payment information is not required to process this order at this time.'
|
143
123
|
|
144
124
|
# Mailer Settings
|
145
125
|
# effective_orders will send out receipts to the buyer, seller and admins.
|
@@ -161,7 +141,6 @@ EffectiveOrders.setup do |config|
|
|
161
141
|
config.mailer = {
|
162
142
|
send_order_receipt_to_admin: true,
|
163
143
|
send_order_receipt_to_buyer: true,
|
164
|
-
send_order_receipt_to_seller: true, # Only applies to StripeConnect
|
165
144
|
send_payment_request_to_buyer: true,
|
166
145
|
send_pending_order_invoice_to_buyer: true,
|
167
146
|
send_order_receipts_when_mark_as_paid: false,
|
@@ -176,9 +155,8 @@ EffectiveOrders.setup do |config|
|
|
176
155
|
|
177
156
|
subject_for_order_receipt_to_admin: '',
|
178
157
|
subject_for_order_receipt_to_buyer: '',
|
179
|
-
subject_for_order_receipt_to_seller: '',
|
180
|
-
subject_for_pending_order_invoice_to_buyer: '',
|
181
158
|
subject_for_payment_request_to_buyer: '',
|
159
|
+
subject_for_pending_order_invoice_to_buyer: '',
|
182
160
|
|
183
161
|
subject_for_subscription_payment_succeeded: '',
|
184
162
|
subject_for_subscription_payment_failed: '',
|
@@ -191,141 +169,97 @@ EffectiveOrders.setup do |config|
|
|
191
169
|
default_from: 'info@example.com',
|
192
170
|
admin_email: 'admin@example.com',
|
193
171
|
|
194
|
-
deliver_method: nil
|
195
|
-
delayed_job_deliver: false # Use the oldschool pre-ActiveJob delayed_job way of sending email
|
172
|
+
deliver_method: nil # When nil, will use deliver_later if active_job is configured, otherwise deliver_now
|
196
173
|
}
|
197
174
|
|
198
175
|
#######################################
|
199
|
-
|
176
|
+
## Payment Provider specific options ##
|
200
177
|
#######################################
|
201
178
|
|
202
|
-
#
|
203
|
-
|
204
|
-
config.mark_as_paid_enabled = false
|
179
|
+
# Cheque
|
180
|
+
config.cheque = false
|
205
181
|
|
206
|
-
#
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
config.moneris = {
|
211
|
-
ps_store_id: '',
|
212
|
-
hpp_key: '',
|
213
|
-
hpp_url: 'https://www3.moneris.com/HPPDP/index.php',
|
214
|
-
verify_url: 'https://www3.moneris.com/HPPDP/verifyTxn.php'
|
215
|
-
}
|
216
|
-
else
|
217
|
-
config.moneris = {
|
218
|
-
ps_store_id: '',
|
219
|
-
hpp_key: '',
|
220
|
-
hpp_url: 'https://esqa.moneris.com/HPPDP/index.php',
|
221
|
-
verify_url: 'https://esqa.moneris.com/HPPDP/verifyTxn.php'
|
222
|
-
}
|
223
|
-
end
|
224
|
-
|
225
|
-
# Paypal configuration
|
226
|
-
config.paypal_enabled = false
|
227
|
-
|
228
|
-
if Rails.env.production?
|
229
|
-
config.paypal = {
|
230
|
-
seller_email: '',
|
231
|
-
secret: '',
|
232
|
-
cert_id: '',
|
233
|
-
paypal_url: 'https://www.paypal.com/cgi-bin/webscr',
|
234
|
-
currency: 'CAD',
|
235
|
-
paypal_cert: "#{Rails.root}/config/paypalcerts/production/paypal_cert.pem",
|
236
|
-
app_cert: "#{Rails.root}/config/paypalcerts/production/app_cert.pem",
|
237
|
-
app_key: "#{Rails.root}/config/paypalcerts/production/app_key.pem"
|
238
|
-
}
|
239
|
-
else
|
240
|
-
config.paypal = {
|
241
|
-
seller_email: '',
|
242
|
-
secret: '',
|
243
|
-
cert_id: '',
|
244
|
-
paypal_url: 'https://www.sandbox.paypal.com/cgi-bin/webscr',
|
245
|
-
currency: 'CAD',
|
246
|
-
paypal_cert: "#{Rails.root}/config/paypalcerts/#{Rails.env}/paypal_cert.pem",
|
247
|
-
app_cert: "#{Rails.root}/config/paypalcerts/#{Rails.env}/app_cert.pem",
|
248
|
-
app_key: "#{Rails.root}/config/paypalcerts/#{Rails.env}/app_key.pem"
|
249
|
-
}
|
250
|
-
end
|
251
|
-
|
252
|
-
# Stripe configuration
|
253
|
-
config.stripe_enabled = false
|
254
|
-
config.subscriptions_enabled = false # https://stripe.com/docs/subscriptions
|
255
|
-
|
256
|
-
config.stripe_connect_enabled = false # https://stripe.com/docs/connect
|
257
|
-
config.stripe_connect_application_fee_method = Proc.new { |order_item| order_item.total * 0.10 } # 10 percent
|
258
|
-
|
259
|
-
config.subscription = {
|
260
|
-
trial_name: 'Free Trial',
|
261
|
-
trial_description: '45-Day Free Trial',
|
262
|
-
trial_period: 45.days,
|
263
|
-
trial_remind_at: [1.day, 3.days, 7.days], # Send email notification to trialing users 1, 3 and 7 days before expiring. false to disable.
|
264
|
-
webhook_secret: 'whsec_1234567890'
|
265
|
-
}
|
182
|
+
# config.cheque = {
|
183
|
+
# confirm: 'Your order will not be considered purchased until we receive your cheque. Proceed with pay by cheque?',
|
184
|
+
# success_message: '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. We will mark this order purchased upon receiving payment.'
|
185
|
+
# }
|
266
186
|
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
end
|
286
|
-
|
287
|
-
# CCBill configuration
|
288
|
-
config.ccbill_enabled = false
|
289
|
-
|
290
|
-
# CCBill Dynamic Pricing documentation describes these variables:
|
291
|
-
# https://www.ccbill.com/cs/wiki/tiki-index.php?page=Dynamic+Pricing+User+Guide
|
292
|
-
if Rails.env.production?
|
293
|
-
config.ccbill = {
|
294
|
-
client_accnum: '',
|
295
|
-
client_subacc: '0000', # initial sub account
|
296
|
-
# Get this from CCBill Admin dashboard after setting up a form
|
297
|
-
form_name: '211cc', # default credit card form
|
298
|
-
# https://www.ccbill.com/cs/wiki/tiki-index.php?page=Webhooks+User+Guide#Appendix_A:_Currency_Codes
|
299
|
-
currency_code: '840', # USD
|
300
|
-
# You'll need to get this salt after having CCBill tech support set up dynamic pricing
|
301
|
-
# https://www.ccbill.com/cs/wiki/tiki-index.php?page=Dynamic+Pricing+User+Guide#Generating_the_MD5_Hash
|
302
|
-
dynamic_pricing_salt: ''
|
303
|
-
}
|
304
|
-
else
|
305
|
-
config.ccbill = {
|
306
|
-
client_accnum: '',
|
307
|
-
client_subacc: '0000',
|
308
|
-
form_name: '211cc',
|
309
|
-
currency_code: '840',
|
310
|
-
dynamic_pricing_salt: ''
|
311
|
-
}
|
312
|
-
end
|
313
|
-
|
314
|
-
# App checkout configuration
|
315
|
-
config.app_checkout_enabled = false
|
316
|
-
|
317
|
-
config.app_checkout = {
|
318
|
-
checkout_label: '', # Checkout button to finalize the order
|
319
|
-
service: nil, # an EffectiveOrders::AppCheckout type object
|
320
|
-
declined_flash: "Payment was unsuccessful. Please try again."
|
321
|
-
}
|
187
|
+
# Moneris
|
188
|
+
config.moneris = false
|
189
|
+
|
190
|
+
# if Rails.env.production?
|
191
|
+
# config.moneris = {
|
192
|
+
# ps_store_id: '',
|
193
|
+
# hpp_key: '',
|
194
|
+
# hpp_url: 'https://www3.moneris.com/HPPDP/index.php',
|
195
|
+
# verify_url: 'https://www3.moneris.com/HPPDP/verifyTxn.php'
|
196
|
+
# }
|
197
|
+
# else
|
198
|
+
# config.moneris = {
|
199
|
+
# ps_store_id: '',
|
200
|
+
# hpp_key: '',
|
201
|
+
# hpp_url: 'https://esqa.moneris.com/HPPDP/index.php',
|
202
|
+
# verify_url: 'https://esqa.moneris.com/HPPDP/verifyTxn.php'
|
203
|
+
# }
|
204
|
+
# end
|
322
205
|
|
323
|
-
#
|
324
|
-
config.
|
206
|
+
# Paypal
|
207
|
+
config.paypal = false
|
208
|
+
|
209
|
+
# if Rails.env.production?
|
210
|
+
# config.paypal = {
|
211
|
+
# seller_email: '',
|
212
|
+
# secret: '',
|
213
|
+
# cert_id: '',
|
214
|
+
# paypal_url: 'https://www.paypal.com/cgi-bin/webscr',
|
215
|
+
# currency: 'CAD',
|
216
|
+
# paypal_cert: "#{Rails.root}/config/paypalcerts/production/paypal_cert.pem",
|
217
|
+
# app_cert: "#{Rails.root}/config/paypalcerts/production/app_cert.pem",
|
218
|
+
# app_key: "#{Rails.root}/config/paypalcerts/production/app_key.pem"
|
219
|
+
# }
|
220
|
+
# else
|
221
|
+
# config.paypal = {
|
222
|
+
# seller_email: '',
|
223
|
+
# secret: '',
|
224
|
+
# cert_id: '',
|
225
|
+
# paypal_url: 'https://www.sandbox.paypal.com/cgi-bin/webscr',
|
226
|
+
# currency: 'CAD',
|
227
|
+
# paypal_cert: "#{Rails.root}/config/paypalcerts/#{Rails.env}/paypal_cert.pem",
|
228
|
+
# app_cert: "#{Rails.root}/config/paypalcerts/#{Rails.env}/app_cert.pem",
|
229
|
+
# app_key: "#{Rails.root}/config/paypalcerts/#{Rails.env}/app_key.pem"
|
230
|
+
# }
|
231
|
+
# end
|
325
232
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
233
|
+
# Stripe
|
234
|
+
config.stripe = false
|
235
|
+
|
236
|
+
# if Rails.env.production?
|
237
|
+
# config.stripe = {
|
238
|
+
# secret_key: '',
|
239
|
+
# publishable_key: '',
|
240
|
+
# currency: 'usd',
|
241
|
+
# site_title: 'My Site',
|
242
|
+
# site_image: '' # A relative URL pointing to a square image of your brand or product. The recommended minimum size is 128x128px.
|
243
|
+
# }
|
244
|
+
# else
|
245
|
+
# config.stripe = {
|
246
|
+
# secret_key: '',
|
247
|
+
# publishable_key: '',
|
248
|
+
# currency: 'usd',
|
249
|
+
# site_title: 'My Development Site', # Displayed on the Embedded Stripe Form
|
250
|
+
# site_image: '' # A relative URL pointing to a square image of your brand or product. The recommended minimum size is 128x128px.
|
251
|
+
# }
|
252
|
+
# end
|
253
|
+
|
254
|
+
# Subscriptions (https://stripe.com/docs/subscriptions)
|
255
|
+
config.subscriptions = false
|
256
|
+
|
257
|
+
# config.subscriptions = {
|
258
|
+
# trial_name: 'Free Trial',
|
259
|
+
# trial_description: '45-Day Free Trial',
|
260
|
+
# trial_period: 45.days,
|
261
|
+
# trial_remind_at: [1.day, 3.days, 7.days], # Send email notification to trialing users 1, 3 and 7 days before expiring. false to disable.
|
262
|
+
# webhook_secret: 'whsec_1234567890'
|
263
|
+
# }
|
330
264
|
|
331
265
|
end
|