effective_orders 3.2.3 → 4.0.0beta1

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.
Files changed (87) hide show
  1. checksums.yaml +5 -5
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +11 -99
  4. data/app/assets/stylesheets/effective_orders.scss +1 -0
  5. data/app/assets/stylesheets/effective_orders/_cart.scss +4 -0
  6. data/app/assets/stylesheets/effective_orders/_order.scss +6 -2
  7. data/app/controllers/admin/orders_controller.rb +17 -17
  8. data/app/controllers/effective/carts_controller.rb +4 -2
  9. data/app/controllers/effective/orders_controller.rb +50 -105
  10. data/app/controllers/effective/providers/cheque.rb +1 -1
  11. data/app/controllers/effective/providers/moneris.rb +17 -23
  12. data/app/controllers/effective/providers/stripe.rb +2 -37
  13. data/app/datatables/effective_customers_datatable.rb +1 -5
  14. data/app/datatables/effective_order_items_datatable.rb +10 -10
  15. data/app/datatables/effective_orders_datatable.rb +23 -46
  16. data/app/helpers/effective_carts_helper.rb +5 -25
  17. data/app/helpers/effective_orders_helper.rb +29 -61
  18. data/app/helpers/effective_paypal_helper.rb +10 -8
  19. data/app/helpers/effective_stripe_helper.rb +2 -33
  20. data/app/models/concerns/acts_as_purchasable.rb +26 -37
  21. data/app/models/concerns/acts_as_subscribable.rb +1 -1
  22. data/app/models/effective/cart.rb +4 -5
  23. data/app/models/effective/customer.rb +1 -4
  24. data/app/models/effective/order.rb +132 -163
  25. data/app/models/effective/order_item.rb +2 -21
  26. data/app/models/{effective → validators/effective}/sold_out_validator.rb +0 -0
  27. data/app/views/admin/customers/index.html.haml +1 -4
  28. data/app/views/admin/order_items/index.html.haml +1 -4
  29. data/app/views/admin/orders/_actions.html.haml +18 -9
  30. data/app/views/admin/orders/_form.html.haml +12 -14
  31. data/app/views/admin/orders/_form_note_internal.html.haml +2 -2
  32. data/app/views/admin/orders/_order_actions.html.haml +8 -5
  33. data/app/views/admin/orders/_order_item_fields.html.haml +9 -8
  34. data/app/views/admin/orders/checkout.html.haml +3 -0
  35. data/app/views/admin/orders/edit.html.haml +3 -1
  36. data/app/views/admin/orders/new.html.haml +2 -1
  37. data/app/views/admin/orders/show.html.haml +2 -5
  38. data/app/views/effective/carts/_cart.html.haml +1 -1
  39. data/app/views/effective/carts/_cart_actions.html.haml +3 -4
  40. data/app/views/effective/carts/show.html.haml +4 -4
  41. data/app/views/effective/orders/_checkout_actions.html.haml +3 -0
  42. data/app/views/effective/orders/_checkout_step1.html.haml +20 -27
  43. data/app/views/effective/orders/_checkout_step2.html.haml +26 -30
  44. data/app/views/effective/orders/_order.html.haml +1 -2
  45. data/app/views/effective/orders/_order_actions.html.haml +14 -6
  46. data/app/views/effective/orders/_order_header.html.haml +2 -2
  47. data/app/views/effective/orders/_order_note_fields.html.haml +6 -4
  48. data/app/views/effective/orders/_order_notes.html.haml +15 -0
  49. data/app/views/effective/orders/_order_payment_details.html.haml +1 -1
  50. data/app/views/effective/orders/_order_shipping.html.haml +6 -6
  51. data/app/views/effective/orders/_order_terms_and_conditions_fields.html.haml +5 -6
  52. data/app/views/effective/orders/_order_user_fields.html.haml +5 -11
  53. data/app/views/effective/orders/_orders_table.html.haml +2 -6
  54. data/app/views/effective/orders/index.html.haml +2 -1
  55. data/app/views/effective/orders/mark_as_paid/_form.html.haml +8 -14
  56. data/app/views/effective/orders/moneris/_form.html.haml +43 -4
  57. data/app/views/effective/orders/pretend/_form.html.haml +1 -3
  58. data/app/views/effective/orders/refund/_form.html.haml +8 -12
  59. data/app/views/effective/orders/show.html.haml +2 -2
  60. data/app/views/effective/orders/stripe/_form.html.haml +4 -4
  61. data/app/views/effective/orders_mailer/payment_request_to_buyer.html.haml +1 -1
  62. data/app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml +1 -1
  63. data/config/effective_orders.rb +116 -182
  64. data/config/routes.rb +16 -27
  65. data/db/migrate/01_create_effective_orders.rb.erb +6 -5
  66. data/lib/effective_orders.rb +72 -76
  67. data/lib/effective_orders/engine.rb +8 -80
  68. data/lib/effective_orders/version.rb +1 -1
  69. data/lib/generators/templates/effective_orders_mailer_preview.rb +4 -4
  70. metadata +26 -38
  71. data/Rakefile +0 -21
  72. data/app/assets/config/effective_orders_manifest.js +0 -3
  73. data/app/assets/images/effective_orders/stripe_connect.png +0 -0
  74. data/app/controllers/effective/providers/app_checkout.rb +0 -38
  75. data/app/controllers/effective/providers/ccbill.rb +0 -34
  76. data/app/controllers/effective/providers/stripe_connect.rb +0 -47
  77. data/app/helpers/effective_ccbill_helper.rb +0 -25
  78. data/app/models/effective/providers/ccbill_postback.rb +0 -85
  79. data/app/models/effective/providers/moneris_charge.rb +0 -115
  80. data/app/views/effective/orders/_order_note.html.haml +0 -5
  81. data/app/views/effective/orders/_order_note_to_buyer.html.haml +0 -9
  82. data/app/views/effective/orders/app_checkout/_form.html.haml +0 -2
  83. data/app/views/effective/orders/ccbill/_form.html.haml +0 -24
  84. data/app/views/effective/orders/my_purchases.html.haml +0 -3
  85. data/app/views/effective/orders/my_sales.html.haml +0 -25
  86. data/app/views/effective/orders_mailer/order_receipt_to_seller.html.haml +0 -25
  87. data/lib/effective_orders/app_checkout_service.rb +0 -26
@@ -1,5 +1,7 @@
1
- %h2 Note
2
- - if EffectiveOrders.collect_note_message.present?
3
- %p= EffectiveOrders.collect_note_message.html_safe
1
+ .effective-order-note-fields
2
+ %h2 Note
4
3
 
5
- = form.input :note, required: (EffectiveOrders.collect_note_required == true)
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
@@ -14,5 +14,5 @@
14
14
 
15
15
  %tr
16
16
  %td Purchased at
17
- %td= order.purchased_at.strftime('%Y-%m-%d %H:%M')
17
+ %td= order.purchased_at.strftime('%F %H:%M')
18
18
 
@@ -9,14 +9,14 @@
9
9
  %tbody
10
10
  %tr
11
11
  %td
12
- - unless EffectiveOrders.use_address_full_name
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
- - if order.billing_address.present?
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 :partial => 'effective/addresses/address', :locals => {:address => order.shipping_address}
22
+ = render(partial: 'effective/addresses/address', locals: { address: order.shipping_address })
@@ -1,8 +1,7 @@
1
- %h2 Terms and Conditions
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.input :terms_and_conditions,
6
- required: true,
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
- %h2 User Information
2
- = form.simple_fields_for :user, user do |fa|
3
- - if (EffectiveOrders.collect_user_fields || []).include?(:salutation) && fa.object.respond_to?(:salutation)
4
- - if defined?(fa.object.class::SALUTATIONS)
5
- = fa.input :salutation, :as => :select, :collection => fa.object.class::SALUTATIONS, :include_blank => false, :required => true
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
- - if order.purchased?
15
- Purchased
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?
@@ -7,5 +7,6 @@
7
7
  - if @orders.present?
8
8
  %h2 Purchased Orders
9
9
  = render_orders(@orders)
10
- - else
10
+
11
+ - unless (@pending_orders.present? || @orders.present?)
11
12
  %p You have no purchased orders.
@@ -2,31 +2,25 @@
2
2
  .panel-body
3
3
  %h2 Admin: Offline Payment
4
4
 
5
- = simple_form_for order, (EffectiveOrders.simple_form_options || {}).merge(url: effective_orders.mark_as_paid_order_path(order), method: :post) do |f|
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.input :payment_provider,
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.input :payment_card,
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.input :payment,
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.input :send_mark_as_paid_email_to_buyer,
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.input :note_to_buyer, hint: 'This message will be displayed on the receipt.'
23
+ = f.text_area :note_to_buyer, hint: 'This message will be displayed on the receipt.'
29
24
 
30
- .text-right
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
- - moneris = Effective::Providers::MonerisCharge.new(order: order, purchased_url: purchased_url, declined_url: declined_url)
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
- = hidden_field_tag :hpp_preload, ''
5
- = hidden_field_tag :hpp_id, moneris.hpp_id
6
- = hidden_field_tag :ticket, moneris.ticket
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
- = simple_form_for order, (EffectiveOrders.simple_form_options || {}).merge(url: effective_orders.refund_order_path(order), method: :post) do |f|
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.input :payment_card,
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.input :payment,
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.input :send_mark_as_paid_email_to_buyer,
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.input :note_to_buyer, hint: 'This is displayed to the buyer on all order receipts.'
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', data: { disable_with: 'Continuing...' }
27
+ = f.submit order_checkout_label(:refund), class: 'btn btn-primary'
32
28
 
@@ -1,6 +1,6 @@
1
1
  %h1.effective-heading= @page_title
2
2
 
3
- - if (@order.purchased? == false) && (@order.user == current_user)
4
- = render_checkout_step2(@order)
3
+ - if @order.user == current_user
4
+ = render_checkout(@order)
5
5
  - else
6
6
  = render @order
@@ -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
- = simple_form_for(@stripe_charge || Effective::Providers::StripeCharge.new(order: order), url: effective_orders.stripe_charge_orders_path) do |f|
5
- = f.input :stripe_token, as: :hidden, input_html: { value: nil }
6
- = f.input :effective_order_id, as: :hidden
7
- = f.submit order_checkout_label(:stripe), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
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.cheque_enabled
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.cheque_enabled
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)
@@ -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
- # Skip automatically mounting the EffectiveOrders engine
35
- config.skip_mount_engine = false
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.require_billing_address = true
45
- config.require_shipping_address = false
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 = [:salutation, :first_name, :last_name] # Must be valid fields on the User object
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 # just required for the form, not a true Order model validation
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
- # and just display the 'Thank You' after checkout is clicked
89
- config.allow_free_orders = true
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
- # This just changes the validations
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.allow_pretend_purchase_in_development = true
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
- # Allow Pretend Purchase in Production
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.allow_pretend_purchase_in_production = false
112
- config.allow_pretend_purchase_in_production_message = '* payment information is not required to process this order at this time.'
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, # :deliver (rails < 4.2), :deliver_now (rails >= 4.2) or :deliver_later
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
- ### Payment Provider specific options
176
+ ## Payment Provider specific options ##
200
177
  #######################################
201
178
 
202
- # Mark an order as paid without going through a processor
203
- # This is accessed via the admin screens only. Must have can?(:admin, :effective_orders)
204
- config.mark_as_paid_enabled = false
179
+ # Cheque
180
+ config.cheque = false
205
181
 
206
- # Moneris configuration
207
- config.moneris_enabled = false
208
-
209
- if Rails.env.production?
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
- if Rails.env.production?
268
- config.stripe = {
269
- secret_key: '',
270
- publishable_key: '',
271
- currency: 'usd',
272
- site_title: 'My Site',
273
- site_image: '', # A relative URL pointing to a square image of your brand or product. The recommended minimum size is 128x128px.
274
- connect_client_id: ''
275
- }
276
- else
277
- config.stripe = {
278
- secret_key: '',
279
- publishable_key: '',
280
- currency: 'usd',
281
- site_title: 'My Development Site', # Displayed on the Embedded Stripe Form
282
- site_image: '', # A relative URL pointing to a square image of your brand or product. The recommended minimum size is 128x128px.
283
- connect_client_id: ''
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
- # Pay by Cheque configuration
324
- config.cheque_enabled = false
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
- config.cheque = {
327
- confirm: 'Your order will not be considered purchased until we receive your cheque. Proceed with pay by cheque?',
328
- 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.'
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