effective_orders 2.2.4 → 3.0.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.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +124 -84
  4. data/app/assets/javascripts/effective_orders/customers.js.coffee +39 -0
  5. data/app/assets/javascripts/effective_orders/providers/{stripe_charges.js.coffee → stripe.js.coffee} +15 -13
  6. data/app/assets/javascripts/effective_orders/subscriptions.js.coffee +73 -0
  7. data/app/assets/stylesheets/effective_orders.scss +2 -1
  8. data/app/assets/stylesheets/effective_orders/_order.scss +16 -8
  9. data/app/assets/stylesheets/effective_orders/_subscriptions.scss +14 -0
  10. data/app/controllers/admin/customers_controller.rb +11 -8
  11. data/app/controllers/admin/order_items_controller.rb +4 -8
  12. data/app/controllers/admin/orders_controller.rb +133 -87
  13. data/app/controllers/effective/carts_controller.rb +18 -8
  14. data/app/controllers/effective/concerns/purchase.rb +39 -0
  15. data/app/controllers/effective/customers_controller.rb +43 -0
  16. data/app/controllers/effective/orders_controller.rb +73 -119
  17. data/app/controllers/effective/providers/app_checkout.rb +3 -1
  18. data/app/controllers/effective/providers/ccbill.rb +4 -6
  19. data/app/controllers/effective/providers/cheque.rb +20 -11
  20. data/app/controllers/effective/providers/free.rb +33 -0
  21. data/app/controllers/effective/providers/mark_as_paid.rb +33 -0
  22. data/app/controllers/effective/providers/moneris.rb +9 -17
  23. data/app/controllers/effective/providers/paypal.rb +4 -6
  24. data/app/controllers/effective/providers/pretend.rb +4 -4
  25. data/app/controllers/effective/providers/refund.rb +39 -0
  26. data/app/controllers/effective/providers/stripe.rb +19 -40
  27. data/app/controllers/effective/providers/stripe_connect.rb +2 -6
  28. data/app/controllers/effective/webhooks_controller.rb +44 -95
  29. data/app/datatables/effective_customers_datatable.rb +21 -29
  30. data/app/datatables/effective_order_items_datatable.rb +77 -79
  31. data/app/datatables/effective_orders_datatable.rb +67 -57
  32. data/app/helpers/effective_carts_helper.rb +17 -14
  33. data/app/helpers/effective_orders_helper.rb +40 -56
  34. data/app/helpers/effective_paypal_helper.rb +3 -3
  35. data/app/helpers/effective_stripe_helper.rb +47 -18
  36. data/app/helpers/effective_subscriptions_helper.rb +79 -0
  37. data/app/mailers/effective/orders_mailer.rb +125 -2
  38. data/app/models/concerns/acts_as_purchasable.rb +23 -33
  39. data/app/models/concerns/acts_as_subscribable.rb +68 -0
  40. data/app/models/concerns/acts_as_subscribable_buyer.rb +22 -0
  41. data/app/models/effective/cart.rb +53 -24
  42. data/app/models/effective/cart_item.rb +6 -12
  43. data/app/models/effective/customer.rb +51 -54
  44. data/app/models/effective/order.rb +160 -147
  45. data/app/models/effective/order_item.rb +18 -21
  46. data/app/models/effective/product.rb +7 -7
  47. data/app/models/effective/providers/ccbill_postback.rb +1 -1
  48. data/app/models/effective/providers/stripe_charge.rb +8 -19
  49. data/app/models/effective/subscripter.rb +230 -0
  50. data/app/models/effective/subscription.rb +27 -76
  51. data/app/models/effective/tax_rate_calculator.rb +10 -7
  52. data/app/views/admin/customers/_actions.html.haml +1 -2
  53. data/app/views/admin/customers/index.html.haml +1 -1
  54. data/app/views/admin/customers/show.html.haml +6 -0
  55. data/app/views/admin/orders/_actions.html.haml +9 -7
  56. data/app/views/admin/orders/_form.html.haml +11 -7
  57. data/app/views/admin/orders/_order_actions.html.haml +2 -1
  58. data/app/views/admin/orders/_order_item_fields.html.haml +1 -1
  59. data/app/views/admin/orders/edit.html.haml +4 -0
  60. data/app/views/admin/orders/index.html.haml +1 -4
  61. data/app/views/admin/orders/new.html.haml +1 -1
  62. data/app/views/admin/orders/show.html.haml +5 -6
  63. data/app/views/effective/carts/_cart.html.haml +2 -2
  64. data/app/views/effective/carts/show.html.haml +2 -2
  65. data/app/views/effective/customers/_customer.html.haml +152 -0
  66. data/app/views/effective/customers/_fields.html.haml +12 -0
  67. data/app/views/effective/customers/_form.html.haml +13 -0
  68. data/app/views/effective/customers/edit.html.haml +3 -0
  69. data/app/views/effective/orders/_checkout_step1.html.haml +8 -15
  70. data/app/views/effective/orders/_checkout_step2.html.haml +34 -21
  71. data/app/views/effective/orders/_order.html.haml +8 -9
  72. data/app/views/effective/orders/_order_actions.html.haml +7 -8
  73. data/app/views/effective/orders/_order_header.html.haml +1 -1
  74. data/app/views/effective/orders/_order_items.html.haml +11 -5
  75. data/app/views/effective/orders/_order_note.html.haml +4 -7
  76. data/app/views/effective/orders/_orders_table.html.haml +26 -26
  77. data/app/views/effective/orders/app_checkout/_form.html.haml +2 -2
  78. data/app/views/effective/orders/ccbill/_form.html.haml +1 -1
  79. data/app/views/effective/orders/cheque/_form.html.haml +3 -1
  80. data/app/views/effective/orders/declined.html.haml +1 -1
  81. data/app/views/effective/orders/{checkout_step1.html.haml → edit.html.haml} +0 -0
  82. data/app/views/effective/orders/free/_form.html.haml +4 -0
  83. data/app/views/effective/orders/index.html.haml +2 -4
  84. data/app/views/effective/orders/mark_as_paid/_form.html.haml +32 -0
  85. data/app/views/effective/orders/moneris/_form.html.haml +6 -6
  86. data/app/views/effective/orders/{checkout_step2.html.haml → new.html.haml} +1 -1
  87. data/app/views/effective/orders/paypal/_form.html.haml +2 -2
  88. data/app/views/effective/orders/pretend/_form.html.haml +2 -2
  89. data/app/views/effective/orders/purchased.html.haml +3 -0
  90. data/app/views/effective/orders/refund/_form.html.haml +32 -0
  91. data/app/views/effective/orders/show.html.haml +4 -1
  92. data/app/views/effective/orders/stripe/_form.html.haml +5 -5
  93. data/app/views/effective/orders_mailer/subscription_canceled.html.haml +9 -0
  94. data/app/views/effective/orders_mailer/subscription_payment_failed.html.haml +9 -0
  95. data/app/views/effective/orders_mailer/subscription_payment_succeeded.html.haml +9 -0
  96. data/app/views/effective/orders_mailer/subscription_trial_expired.html.haml +5 -0
  97. data/app/views/effective/orders_mailer/subscription_trial_expiring.html.haml +7 -0
  98. data/app/views/effective/subscriptions/_fields.html.haml +16 -0
  99. data/app/views/effective/subscriptions/_plan.html.haml +21 -0
  100. data/app/views/layouts/effective_orders_mailer_layout.html.haml +6 -8
  101. data/config/effective_orders.rb +41 -20
  102. data/config/routes.rb +48 -48
  103. data/db/migrate/01_create_effective_orders.rb.erb +19 -5
  104. data/lib/effective_orders.rb +78 -42
  105. data/lib/effective_orders/engine.rb +36 -82
  106. data/lib/effective_orders/version.rb +1 -1
  107. data/lib/generators/effective_orders/install_generator.rb +2 -2
  108. data/lib/generators/templates/effective_orders_mailer_preview.rb +39 -4
  109. data/lib/tasks/effective_orders_tasks.rake +42 -0
  110. data/spec/controllers/carts_controller_spec.rb +1 -1
  111. data/spec/controllers/moneris_orders_controller_spec.rb +4 -4
  112. data/spec/controllers/orders_controller_spec.rb +4 -4
  113. data/spec/controllers/stripe_orders_controller_spec.rb +2 -2
  114. data/spec/controllers/webhooks_controller_spec.rb +1 -1
  115. data/spec/dummy/config/initializers/effective_orders.rb +1 -7
  116. data/spec/dummy/db/schema.rb +1 -0
  117. data/spec/dummy/db/test.sqlite3 +0 -0
  118. data/spec/dummy/log/test.log +3 -0
  119. data/spec/models/acts_as_purchasable_spec.rb +0 -56
  120. data/spec/models/customer_spec.rb +3 -3
  121. data/spec/models/order_spec.rb +2 -2
  122. data/spec/spec_helper.rb +1 -1
  123. data/spec/support/factories.rb +2 -1
  124. metadata +37 -49
  125. data/active_admin/effective_carts.rb +0 -14
  126. data/active_admin/effective_orders.rb +0 -112
  127. data/app/assets/javascripts/effective_orders/providers/stripe_subscriptions.js.coffee +0 -28
  128. data/app/controllers/concerns/acts_as_active_admin_controller.rb +0 -69
  129. data/app/controllers/effective/subscriptions_controller.rb +0 -126
  130. data/app/models/effective/datatables/customers.rb +0 -40
  131. data/app/models/effective/datatables/order_items.rb +0 -101
  132. data/app/models/effective/datatables/orders.rb +0 -91
  133. data/app/models/inputs/price_field.rb +0 -63
  134. data/app/models/inputs/price_form_input.rb +0 -7
  135. data/app/models/inputs/price_formtastic_input.rb +0 -9
  136. data/app/models/inputs/price_input.rb +0 -19
  137. data/app/models/inputs/price_simple_form_input.rb +0 -8
  138. data/app/views/admin/orders/_form_mark_as_paid.html.haml +0 -33
  139. data/app/views/admin/orders/_order_payment_details.html.haml +0 -5
  140. data/app/views/admin/orders/mark_as_paid.html.haml +0 -7
  141. data/app/views/effective/orders/stripe/_subscription_fields.html.haml +0 -7
  142. data/app/views/effective/subscriptions/index.html.haml +0 -22
  143. data/app/views/effective/subscriptions/new.html.haml +0 -9
  144. data/app/views/effective/subscriptions/show.html.haml +0 -49
  145. data/db/upgrade/02_upgrade_effective_orders_from03x.rb.erb +0 -29
  146. data/db/upgrade/03_upgrade_effective_orders_from1x.rb.erb +0 -98
  147. data/db/upgrade/upgrade_price_column_on_table.rb.erb +0 -17
  148. data/lib/generators/effective_orders/upgrade_from03x_generator.rb +0 -31
  149. data/lib/generators/effective_orders/upgrade_from1x_generator.rb +0 -27
  150. data/lib/generators/effective_orders/upgrade_price_column_generator.rb +0 -30
@@ -1,12 +1,11 @@
1
1
  .effective-order
2
2
  - unless defined?(no_order_actions)
3
- = render partial: 'effective/orders/order_actions', locals: {order: order}
4
-
5
- = render partial: 'effective/orders/order_header', locals: {order: order}
6
- = render partial: 'effective/orders/order_shipping', locals: {order: order}
7
- = render partial: 'effective/orders/order_note', locals: {order: order}
8
- = render partial: 'effective/orders/order_note_to_buyer', locals: {order: order}
9
- = render partial: 'effective/orders/order_items', locals: {order: order}
10
- = render partial: 'effective/orders/order_payment_details', locals: {order: order}
11
- = render partial: 'effective/orders/order_footer', locals: {order: order}
3
+ = render partial: 'effective/orders/order_actions', locals: { order: order }
12
4
 
5
+ = render partial: 'effective/orders/order_header', locals: { order: order }
6
+ = render partial: 'effective/orders/order_shipping', locals: { order: order }
7
+ = render partial: 'effective/orders/order_note', locals: { order: order }
8
+ = render partial: 'effective/orders/order_note_to_buyer', locals: { order: order }
9
+ = render partial: 'effective/orders/order_items', locals: { order: order }
10
+ = render partial: 'effective/orders/order_payment_details', locals: { order: order }
11
+ = render partial: 'effective/orders/order_footer', locals: { order: order }
@@ -1,11 +1,10 @@
1
- .effective-order-actions.pull-right
2
- %p
3
- = link_to 'Print', '#', class: 'btn btn-default print-button', data: { role: 'print-button' }, onClick: 'window.print(); false;'
1
+ .effective-order-actions
2
+ = link_to 'Print', '#', class: 'btn btn-default print-button', data: { role: 'print-button' }, onClick: 'window.print(); false;'
4
3
 
5
- - if order.purchased?
6
- = link_to 'Resend Receipt', effective_orders.resend_buyer_receipt_path(order), class: 'btn btn-default', data: { confirm: 'This action will email the buyer a copy of the original email receipt. Send receipt now?', disable_with: 'Resending...' }
4
+ - if order.purchased?
5
+ = link_to 'Resend Receipt', effective_orders.send_buyer_receipt_order_path(order), class: 'btn btn-default', data: { confirm: 'This action will email the buyer a copy of the original email receipt. Send receipt now?', disable_with: 'Resending...' }
7
6
 
8
- - elsif (EffectiveOrders.authorized?(controller, :admin, :effective_orders) rescue false)
9
- = link_to 'Admin: Mark as Paid', effective_orders.mark_as_paid_admin_order_path(order), class: 'btn btn-default'
7
+ - elsif EffectiveOrders.authorized?(controller, :admin, :effective_orders)
8
+ - if order.pending?
10
9
  = link_to 'Admin: Send Payment Request', effective_orders.send_payment_request_admin_order_path(order), class: 'btn btn-default', data: { method: :post, confirm: 'This action will email buyer a payment request. Send it now?', disable_with: 'Sending...' }
11
- = link_to 'Admin: Delete', effective_orders.admin_order_path(order), class: 'btn btn-default', data: { method: :delete, confirm: 'Are you sure you want to delete? This cannot be undone.', disable_with: 'Deleting...' }
10
+ = link_to 'Admin: Delete', effective_orders.admin_order_path(order), class: 'btn btn-default', data: { method: :delete, confirm: 'Are you sure you want to delete? This cannot be undone.', disable_with: 'Deleting...' }
@@ -1,5 +1,5 @@
1
1
  .effective-order-header
2
- %h3 Acme Industries Inc.
2
+ %h2 Acme Industries Inc.
3
3
  .row
4
4
  .col-sm-6
5
5
  - email_address = EffectiveOrders.mailer[:admin_email] || 'info@acmeindustries.com'
@@ -25,13 +25,11 @@
25
25
  = '-'
26
26
  %td.item
27
27
  = item.title.html_safe
28
- - if order.new_record? && item.purchasable.kind_of?(Effective::Subscription)
29
- = render :partial => 'effective/orders/stripe/subscription_fields', :locals => {:form => form, :subscription => item.purchasable }
30
28
 
31
29
  %td.price= price_to_currency(item.subtotal)
32
30
 
33
31
  %tfoot
34
- - if order.tax.to_i > 0 || order.tax_rate == nil
32
+ - if order.tax.to_i != 0 || order.tax_rate == nil
35
33
  %tr
36
34
  - if include_quantity_column
37
35
  %th.quantity
@@ -39,7 +37,7 @@
39
37
  %th.download
40
38
  %th.subtotal Subtotal
41
39
  %td.price.subtotal-price= price_to_currency(order.subtotal)
42
- - if order.tax.to_i > 0
40
+ - if order.tax.to_i != 0
43
41
  %tr
44
42
  - if include_quantity_column
45
43
  %th.quantity
@@ -53,5 +51,13 @@
53
51
  %th.quantity
54
52
  - if include_download_column
55
53
  %th.download
56
- %th.total Total Due
54
+
55
+ %th.total
56
+ - if order.pending?
57
+ Amount Due
58
+ - elsif order.purchased?
59
+ Amount Paid
60
+ - else
61
+ Total
62
+
57
63
  %td.price.total-price= price_to_currency(order.total)
@@ -1,8 +1,5 @@
1
1
  - if order.note.present?
2
- %table.table
3
- %thead
4
- %tr
5
- %th Note
6
- %tbody
7
- %tr
8
- %td= order.note
2
+ %p
3
+ %strong Note
4
+ %br
5
+ = order.note
@@ -1,27 +1,27 @@
1
- %table.table
2
- %thead
3
- %tr
4
- %th Order
5
- %th Date
6
- %th Description
7
- %th
8
- %tbody
9
- - orders.each do |order|
1
+ - if orders.present?
2
+ %table.table
3
+ %thead
10
4
  %tr
11
- %td ##{order.to_param}
12
- %td
13
- - if order.purchased?
14
- Purchased
15
- = order.purchased_at.strftime("%Y-%m-%d %H:%M")
16
- - else
17
- Created
18
- = order.created_at.strftime("%Y-%m-%d %H:%M")
19
- %td= order_summary(order)
20
- %td
21
- - if order.pending?
22
- = link_to_checkout(order: order)
23
- - else
24
- = link_to 'View', effective_orders.order_path(order)
25
-
26
- - unless orders.present?
27
- %p You have no orders
5
+ %th Order
6
+ %th Date
7
+ %th Description
8
+ %th
9
+ %tbody
10
+ - orders.each do |order|
11
+ %tr
12
+ %td ##{order.to_param}
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")
20
+ %td= order_summary(order)
21
+ %td
22
+ - if order.pending?
23
+ = link_to_checkout(order: order)
24
+ - else
25
+ = link_to 'View', effective_orders.order_path(order)
26
+ - else
27
+ %p No previous orders.
@@ -1,2 +1,2 @@
1
- = form_tag(effective_orders.app_checkout_path(order), method: :post) do
2
- = submit_tag order_checkout_label(:app_checkout), :class => 'btn btn-primary', :data => {'disable_with' => 'Continuing...' }
1
+ = form_tag(effective_orders.app_checkout_order_path(order), method: :post) do
2
+ = submit_tag order_checkout_label(:app_checkout), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
@@ -20,5 +20,5 @@
20
20
  -# custom fields
21
21
  = hidden_field_tag(:order_id, order.to_param)
22
22
 
23
- = submit_tag(order_checkout_label(:ccbill), :class => 'btn btn-primary', :data => {'disable_with' => 'Continuing...' })
23
+ = submit_tag order_checkout_label(:ccbill), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
24
24
 
@@ -1,2 +1,4 @@
1
- = form_tag(effective_orders.pay_by_cheque_path(order), method: :post) do
1
+ = form_tag(effective_orders.pay_by_cheque_order_path(order), method: :post) do
2
+ = hidden_field_tag(:purchased_url, purchased_url)
3
+ = hidden_field_tag(:declined_url, declined_url)
2
4
  = submit_tag order_checkout_label(:cheque), class: 'btn btn-primary', data: { confirm: EffectiveOrders.cheque[:confirm].presence, disable_with: 'Continuing...' }
@@ -2,6 +2,6 @@
2
2
 
3
3
  %p= flash[:danger]
4
4
 
5
- %p Your #{link_to_current_cart(label: 'Cart')} items have been saved. Please try again.
5
+ %p Your #{link_to_current_cart(label: 'Cart')} items have been saved. Please try again.
6
6
 
7
7
 
@@ -0,0 +1,4 @@
1
+ = form_tag(effective_orders.free_order_path(order), method: :post) do
2
+ = hidden_field_tag(:purchased_url, purchased_url)
3
+ = hidden_field_tag(:declined_url, declined_url)
4
+ = submit_tag order_checkout_label(:free), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
@@ -1,13 +1,11 @@
1
1
  %h1.effective-heading= @page_title
2
2
 
3
- %h2 Pending Orders
4
3
  - if @pending_orders.present?
4
+ %h2 Pending Orders
5
5
  = render_orders(@pending_orders)
6
- - else
7
- %p You have no pending orders.
8
6
 
9
- %h2 Purchased Orders
10
7
  - if @orders.present?
8
+ %h2 Purchased Orders
11
9
  = render_orders(@orders)
12
10
  - else
13
11
  %p You have no purchased orders.
@@ -0,0 +1,32 @@
1
+ .panel.panel-default
2
+ .panel-body
3
+ %h2 Admin: Offline Payment
4
+
5
+ = simple_form_for order, (EffectiveOrders.simple_form_options || {}).merge(url: effective_orders.mark_as_paid_order_path(order), method: :post) do |f|
6
+ = hidden_field_tag(:purchased_url, purchased_url)
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
+
13
+ = f.input :payment_card,
14
+ label: 'Payment card type, cheque or transaction number',
15
+ placeholder: 'visa',
16
+ hint: 'Full credit card numbers should not be entered here, or anywhere.'
17
+
18
+ = f.input :payment,
19
+ as: :text,
20
+ label: 'Additional details',
21
+ input_html: { value: f.object.payment.kind_of?(Hash) ? f.object.payment[:details] : f.object.payment.presence }
22
+
23
+ = f.input :send_mark_as_paid_email_to_buyer,
24
+ as: :boolean,
25
+ label: 'Yes, send a receipt email to the buyer.',
26
+ 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
+
28
+ = f.input :note_to_buyer, hint: 'This message will be displayed on the receipt.'
29
+
30
+ .text-right
31
+ = f.submit order_checkout_label(:mark_as_paid), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
32
+
@@ -1,14 +1,14 @@
1
- = form_tag(EffectiveOrders.moneris[:hpp_url], :method => 'post') do
1
+ = form_tag(EffectiveOrders.moneris[:hpp_url], method: :post) do
2
2
  = hidden_field_tag(:ps_store_id, EffectiveOrders.moneris[:ps_store_id])
3
3
  = hidden_field_tag(:hpp_key, EffectiveOrders.moneris[:hpp_key])
4
4
  = hidden_field_tag(:lang, 'en-ca')
5
5
  = hidden_field_tag(:rvar_authenticity_token, form_authenticity_token)
6
6
 
7
- - if purchased_redirect_url.present?
8
- = hidden_field_tag(:rvar_purchased_redirect_url, purchased_redirect_url)
7
+ - if purchased_url.present?
8
+ = hidden_field_tag(:rvar_purchased_url, purchased_url)
9
9
 
10
- - if declined_redirect_url.present?
11
- = hidden_field_tag(:rvar_declined_redirect_url, declined_redirect_url)
10
+ - if declined_url.present?
11
+ = hidden_field_tag(:rvar_declined_url, declined_url)
12
12
 
13
13
  = hidden_field_tag(:email, order.user.try(:email))
14
14
  = hidden_field_tag(:cust_id, order.user.to_param)
@@ -44,4 +44,4 @@
44
44
  = hidden_field_tag(:ship_postal_code, address.postal_code)
45
45
  = hidden_field_tag(:ship_country, address.country)
46
46
 
47
- = submit_tag order_checkout_label(:moneris), :class => 'btn btn-primary', :data => {'disable_with' => 'Continuing...' }
47
+ = submit_tag order_checkout_label(:moneris), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
@@ -1,3 +1,3 @@
1
1
  %h1.effective-heading= @page_title
2
2
 
3
- = render_checkout_step2(@order)
3
+ = render_checkout_step1(@order)
@@ -1,5 +1,5 @@
1
- = form_tag(EffectiveOrders.paypal[:paypal_url], :method => 'post') do
1
+ = form_tag(EffectiveOrders.paypal[:paypal_url], method: :post) do
2
2
  = hidden_field_tag :cmd, '_s-xclick'
3
3
  = hidden_field_tag :encrypted, paypal_encrypted_payload(order)
4
4
 
5
- = submit_tag order_checkout_label(:paypal), :class => 'btn btn-primary', :data => {'disable_with' => 'Continuing...' }
5
+ = submit_tag order_checkout_label(:paypal), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
@@ -1,2 +1,2 @@
1
- = form_tag(effective_orders.pretend_purchase_path(order, :purchased_redirect_url => purchased_redirect_url, :declined_redirect_url => declined_redirect_url), method: :post) do
2
- = submit_tag order_checkout_label(:pretend), :class => 'btn btn-primary', :data => {'disable_with' => 'Continuing...' }
1
+ = form_tag(effective_orders.pretend_order_path(order, purchased_url: purchased_url, declined_url: declined_url), method: :post) do
2
+ = submit_tag order_checkout_label(:pretend), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
@@ -1,5 +1,8 @@
1
1
  %h1.effective-heading= @page_title
2
2
 
3
+ %p.effective-orders-page-content
4
+ = link_to 'Home', root_path, class: 'btn btn-primary'
5
+
3
6
  %p.effective-orders-page-content
4
7
  You have successfully purchased the following:
5
8
 
@@ -0,0 +1,32 @@
1
+ .panel.panel-default
2
+ .panel-body
3
+ %h2 Admin: Complete Refund
4
+
5
+ = simple_form_for order, (EffectiveOrders.simple_form_options || {}).merge(url: effective_orders.refund_order_path(order), method: :post) do |f|
6
+ = hidden_field_tag(:purchased_url, purchased_url)
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
+
13
+ = f.input :payment_card,
14
+ label: 'Payment card type, cheque or transaction number',
15
+ placeholder: 'visa',
16
+ hint: 'Full credit card numbers should not be entered here, or anywhere.'
17
+
18
+ = f.input :payment,
19
+ as: :text,
20
+ label: 'Additional details',
21
+ input_html: { value: f.object.payment.kind_of?(Hash) ? f.object.payment[:details] : f.object.payment.presence }
22
+
23
+ = f.input :send_mark_as_paid_email_to_buyer,
24
+ as: :boolean,
25
+ label: 'Yes, send an refund receipt email to the buyer.',
26
+ 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
+
28
+ = f.input :note_to_buyer, hint: 'This is displayed to the buyer on all order receipts.'
29
+
30
+ .text-right
31
+ = f.submit order_checkout_label(:refund), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
32
+
@@ -1,3 +1,6 @@
1
1
  %h1.effective-heading= @page_title
2
2
 
3
- = render @order
3
+ - if (@order.purchased? == false) && (@order.user == current_user)
4
+ = render_checkout_step2(@order)
5
+ - else
6
+ = render @order
@@ -1,7 +1,7 @@
1
- = javascript_include_tag "https://checkout.stripe.com/checkout.js"
1
+ = javascript_include_tag 'https://checkout.stripe.com/checkout.js'
2
2
 
3
- #effective-orders-new-charge-form{data: {'stripe-publishable-key' => EffectiveOrders.stripe[:publishable_key], 'site-title' => EffectiveOrders.stripe[:site_title], 'site-image' => EffectiveOrders.stripe[:site_image], 'user-email' => current_user.try(:email), 'amount' => order.total, 'description' => "#{order.num_items} items (#{price_to_currency(order.total)})"}}
4
- = simple_form_for(@stripe_charge || Effective::Providers::StripeCharge.new(order), (EffectiveOrders.simple_form_options || {}).merge(url: effective_orders.stripe_charges_path)) do |f|
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 }
5
6
  = f.input :effective_order_id, as: :hidden
6
- = f.input :token, as: :hidden
7
- = f.submit order_checkout_label(:stripe), class: 'btn btn-primary stripe-button', data: {'disable_with' => 'Continuing...' }
7
+ = f.submit order_checkout_label(:stripe), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
@@ -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,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,5 @@
1
+ %p.effective-orders-receipt-info Trial expired
2
+
3
+ %p Your trial for #{@subscribable} has expired. To continue, please choose a paid plan.
4
+
5
+ %p= link_to(root_url, root_url)
@@ -0,0 +1,7 @@
1
+ %p.effective-orders-receipt-info Trial expiring
2
+
3
+ %p Your trial for #{@subscribable} expires on #{@subscribable.trial_expires_at.strftime('%F')}.
4
+
5
+ %p Please upgrade to a paid plan before your trial expires.
6
+
7
+ %p= link_to(root_url, root_url)
@@ -0,0 +1,16 @@
1
+ = javascript_include_tag 'https://checkout.stripe.com/checkout.js'
2
+
3
+ = form.simple_fields_for :subscripter, form.object.subscripter do |fs|
4
+ = fs.input :stripe_token, as: :hidden, input_html: { value: nil }
5
+
6
+ - fs.object.stripe_plan_id ||= (fs.object.current_plan || {})[:id]
7
+
8
+ = fs.input :stripe_plan_id, as: :radio_buttons, collection: stripe_plans_collection(fs, include_trial: include_trial, selected_class: selected_class),
9
+ label: label,
10
+ required: required,
11
+ wrapper_html: { class: "effective-orders-stripe-plans #{wrapper_class}", data: { selected_class: selected_class, stripe: stripe } },
12
+ item_wrapper_class: "effective-orders-stripe-plan #{item_wrapper_class}",
13
+ item_wrapper_tag: 'div'
14
+
15
+ - if fs.object.customer.persisted?
16
+ = effective_customer_fields(fs)
@@ -0,0 +1,21 @@
1
+ .panel.panel-default{class: (selected_class if selected)}
2
+ .panel-heading.text-center
3
+ %h3= plan[:name]
4
+ %p= plan[:description]
5
+ .panel-body
6
+ %p Includes features
7
+
8
+ - if plan[:amount] == 0
9
+ %p Free plan
10
+
11
+ %hr
12
+ .visible-when-unselected.text-center
13
+ = link_to 'Select', '#', class: 'btn btn-default btn-select-plan'
14
+
15
+ .visible-when-selected.text-center
16
+ - if subscribed
17
+ %p
18
+ %strong Your current plan
19
+ - else
20
+ %p This is #{['an amazing', 'a great', 'an excellent', 'an exceptional', 'a marvelous', 'a wonderful'].sample} plan
21
+