effective_orders 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +1004 -0
  4. data/app/assets/images/effective_orders/stripe.png +0 -0
  5. data/app/assets/javascripts/effective_orders.js +6 -0
  6. data/app/assets/javascripts/effective_orders/customers.js.coffee +32 -0
  7. data/app/assets/javascripts/effective_orders/providers/stripe.js.coffee +77 -0
  8. data/app/assets/javascripts/effective_orders/subscriptions.js.coffee +81 -0
  9. data/app/assets/stylesheets/effective_orders.scss +2 -0
  10. data/app/assets/stylesheets/effective_orders/_cart.scss +4 -0
  11. data/app/assets/stylesheets/effective_orders/_order.scss +58 -0
  12. data/app/controllers/admin/customers_controller.rb +24 -0
  13. data/app/controllers/admin/order_items_controller.rb +16 -0
  14. data/app/controllers/admin/orders_controller.rb +223 -0
  15. data/app/controllers/effective/carts_controller.rb +85 -0
  16. data/app/controllers/effective/concerns/purchase.rb +62 -0
  17. data/app/controllers/effective/customers_controller.rb +20 -0
  18. data/app/controllers/effective/orders_controller.rb +162 -0
  19. data/app/controllers/effective/providers/cheque.rb +22 -0
  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 +60 -0
  23. data/app/controllers/effective/providers/paypal.rb +33 -0
  24. data/app/controllers/effective/providers/phone.rb +22 -0
  25. data/app/controllers/effective/providers/pretend.rb +26 -0
  26. data/app/controllers/effective/providers/refund.rb +33 -0
  27. data/app/controllers/effective/providers/stripe.rb +72 -0
  28. data/app/controllers/effective/subscripter_controller.rb +18 -0
  29. data/app/controllers/effective/webhooks_controller.rb +109 -0
  30. data/app/datatables/admin/effective_customers_datatable.rb +22 -0
  31. data/app/datatables/admin/effective_orders_datatable.rb +100 -0
  32. data/app/datatables/effective_orders_datatable.rb +79 -0
  33. data/app/helpers/effective_carts_helper.rb +113 -0
  34. data/app/helpers/effective_orders_helper.rb +143 -0
  35. data/app/helpers/effective_paypal_helper.rb +49 -0
  36. data/app/helpers/effective_stripe_helper.rb +85 -0
  37. data/app/helpers/effective_subscriptions_helper.rb +34 -0
  38. data/app/mailers/effective/orders_mailer.rb +196 -0
  39. data/app/models/concerns/acts_as_purchasable.rb +118 -0
  40. data/app/models/concerns/acts_as_subscribable.rb +90 -0
  41. data/app/models/concerns/acts_as_subscribable_buyer.rb +49 -0
  42. data/app/models/effective/access_denied.rb +17 -0
  43. data/app/models/effective/cart.rb +88 -0
  44. data/app/models/effective/cart_item.rb +40 -0
  45. data/app/models/effective/customer.rb +92 -0
  46. data/app/models/effective/order.rb +541 -0
  47. data/app/models/effective/order_item.rb +63 -0
  48. data/app/models/effective/product.rb +23 -0
  49. data/app/models/effective/sold_out_validator.rb +7 -0
  50. data/app/models/effective/subscripter.rb +185 -0
  51. data/app/models/effective/subscription.rb +95 -0
  52. data/app/models/effective/tax_rate_calculator.rb +48 -0
  53. data/app/views/admin/customers/_actions.html.haml +2 -0
  54. data/app/views/admin/customers/index.html.haml +6 -0
  55. data/app/views/admin/customers/show.html.haml +6 -0
  56. data/app/views/admin/order_items/index.html.haml +3 -0
  57. data/app/views/admin/orders/_datatable_actions.html.haml +18 -0
  58. data/app/views/admin/orders/_form.html.haml +35 -0
  59. data/app/views/admin/orders/_form_note_internal.html.haml +7 -0
  60. data/app/views/admin/orders/_order_actions.html.haml +9 -0
  61. data/app/views/admin/orders/_order_item_fields.html.haml +14 -0
  62. data/app/views/admin/orders/checkout.html.haml +3 -0
  63. data/app/views/admin/orders/edit.html.haml +6 -0
  64. data/app/views/admin/orders/index.html.haml +6 -0
  65. data/app/views/admin/orders/new.html.haml +4 -0
  66. data/app/views/admin/orders/show.html.haml +4 -0
  67. data/app/views/effective/carts/_cart.html.haml +28 -0
  68. data/app/views/effective/carts/_cart_actions.html.haml +3 -0
  69. data/app/views/effective/carts/show.html.haml +17 -0
  70. data/app/views/effective/customers/_customer.html.haml +72 -0
  71. data/app/views/effective/customers/_form.html.haml +21 -0
  72. data/app/views/effective/customers/edit.html.haml +4 -0
  73. data/app/views/effective/customers/update.js.erb +5 -0
  74. data/app/views/effective/orders/_checkout_actions.html.haml +3 -0
  75. data/app/views/effective/orders/_checkout_step1.html.haml +4 -0
  76. data/app/views/effective/orders/_checkout_step2.html.haml +37 -0
  77. data/app/views/effective/orders/_datatable_actions.html.haml +2 -0
  78. data/app/views/effective/orders/_fields.html.haml +31 -0
  79. data/app/views/effective/orders/_fields_note.html.haml +7 -0
  80. data/app/views/effective/orders/_fields_terms.html.haml +8 -0
  81. data/app/views/effective/orders/_order.html.haml +11 -0
  82. data/app/views/effective/orders/_order_actions.html.haml +18 -0
  83. data/app/views/effective/orders/_order_deferred.html.haml +9 -0
  84. data/app/views/effective/orders/_order_footer.html.haml +1 -0
  85. data/app/views/effective/orders/_order_header.html.haml +23 -0
  86. data/app/views/effective/orders/_order_items.html.haml +72 -0
  87. data/app/views/effective/orders/_order_notes.html.haml +17 -0
  88. data/app/views/effective/orders/_order_payment.html.haml +24 -0
  89. data/app/views/effective/orders/_order_shipping.html.haml +30 -0
  90. data/app/views/effective/orders/_orders_table.html.haml +23 -0
  91. data/app/views/effective/orders/cheque/_form.html.haml +4 -0
  92. data/app/views/effective/orders/declined.html.haml +12 -0
  93. data/app/views/effective/orders/deferred.html.haml +13 -0
  94. data/app/views/effective/orders/deferred/_form.html.haml +16 -0
  95. data/app/views/effective/orders/edit.html.haml +3 -0
  96. data/app/views/effective/orders/free/_form.html.haml +5 -0
  97. data/app/views/effective/orders/index.html.haml +3 -0
  98. data/app/views/effective/orders/mark_as_paid/_form.html.haml +23 -0
  99. data/app/views/effective/orders/moneris/_form.html.haml +47 -0
  100. data/app/views/effective/orders/new.html.haml +3 -0
  101. data/app/views/effective/orders/paypal/_form.html.haml +5 -0
  102. data/app/views/effective/orders/phone/_form.html.haml +4 -0
  103. data/app/views/effective/orders/pretend/_form.html.haml +8 -0
  104. data/app/views/effective/orders/purchased.html.haml +11 -0
  105. data/app/views/effective/orders/refund/_form.html.haml +5 -0
  106. data/app/views/effective/orders/show.html.haml +6 -0
  107. data/app/views/effective/orders/stripe/_element.html.haml +8 -0
  108. data/app/views/effective/orders/stripe/_form.html.haml +31 -0
  109. data/app/views/effective/orders_mailer/order_error.html.haml +11 -0
  110. data/app/views/effective/orders_mailer/order_receipt_to_admin.html.haml +2 -0
  111. data/app/views/effective/orders_mailer/order_receipt_to_buyer.html.haml +2 -0
  112. data/app/views/effective/orders_mailer/payment_request_to_buyer.html.haml +13 -0
  113. data/app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml +13 -0
  114. data/app/views/effective/orders_mailer/refund_notification_to_admin.html.haml +15 -0
  115. data/app/views/effective/orders_mailer/subscription_canceled.html.haml +9 -0
  116. data/app/views/effective/orders_mailer/subscription_created.html.haml +13 -0
  117. data/app/views/effective/orders_mailer/subscription_event_to_admin.html.haml +13 -0
  118. data/app/views/effective/orders_mailer/subscription_payment_failed.html.haml +9 -0
  119. data/app/views/effective/orders_mailer/subscription_payment_succeeded.html.haml +9 -0
  120. data/app/views/effective/orders_mailer/subscription_trial_expired.html.haml +5 -0
  121. data/app/views/effective/orders_mailer/subscription_trialing.html.haml +7 -0
  122. data/app/views/effective/orders_mailer/subscription_updated.html.haml +13 -0
  123. data/app/views/effective/subscripter/_form.html.haml +60 -0
  124. data/app/views/effective/subscripter/_plan.html.haml +23 -0
  125. data/app/views/layouts/effective_orders_mailer_layout.html.haml +25 -0
  126. data/config/effective_orders.rb +279 -0
  127. data/config/routes.rb +70 -0
  128. data/db/migrate/01_create_effective_orders.rb.erb +137 -0
  129. data/lib/effective_orders.rb +243 -0
  130. data/lib/effective_orders/engine.rb +60 -0
  131. data/lib/effective_orders/version.rb +3 -0
  132. data/lib/generators/effective_orders/install_generator.rb +63 -0
  133. data/lib/generators/templates/effective_orders_mailer_preview.rb +120 -0
  134. data/lib/tasks/effective_orders_tasks.rake +69 -0
  135. metadata +276 -0
@@ -0,0 +1,72 @@
1
+ - include_quantity_column = order.order_items.any? { |order_item| order_item.quantity > 1 }
2
+ - include_download_column = order.purchased? && order.order_items.any? { |order_item| order_item.purchased_download_url.present? }
3
+
4
+ .effective-order-items
5
+ %table.table
6
+ %thead
7
+ %tr
8
+ - if include_quantity_column
9
+ %th.quantity Qty
10
+
11
+ - if include_download_column
12
+ %th.download Download
13
+
14
+ %th.item= order.order_items.length > 1 ? 'Items' : 'Item'
15
+ %th.price Price
16
+
17
+ %tbody
18
+ - order.order_items.each do |item|
19
+ %tr
20
+ - if include_quantity_column
21
+ %td.quantity= item.quantity
22
+
23
+ - if include_download_column
24
+ %td.download
25
+ - if item.purchased_download_url.present?
26
+ = link_to 'download', item.purchased_download_url
27
+ - else
28
+ = '-'
29
+
30
+ %td.item= item.name.html_safe
31
+ %td.price= price_to_currency(item.subtotal)
32
+
33
+ %tfoot
34
+ - if order.tax.to_i != 0 || order.tax_rate == nil
35
+ %tr
36
+ - if include_quantity_column
37
+ %th.quantity
38
+
39
+ - if include_download_column
40
+ %th.download
41
+
42
+ %th.subtotal Subtotal
43
+ %td.price.subtotal-price= price_to_currency(order.subtotal)
44
+
45
+ - if order.tax.to_i != 0
46
+ %tr
47
+ - if include_quantity_column
48
+ %th.quantity
49
+
50
+ - if include_download_column
51
+ %th.download
52
+
53
+ %th.tax Tax (#{tax_rate_to_percentage(order.tax_rate)})
54
+ %td.price.tax-price= price_to_currency(order.tax)
55
+
56
+ - if order.tax_rate.present?
57
+ %tr
58
+ - if include_quantity_column
59
+ %th.quantity
60
+
61
+ - if include_download_column
62
+ %th.download
63
+
64
+ %th.total
65
+ - if order.pending?
66
+ Amount Due
67
+ - elsif order.purchased?
68
+ Amount Paid
69
+ - else
70
+ Total
71
+
72
+ %td.price.total-price= price_to_currency(order.total)
@@ -0,0 +1,17 @@
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
+
9
+ - if order.note_to_buyer.present?
10
+ %th Receipt note
11
+ %tbody
12
+ %tr
13
+ - if order.note.present?
14
+ %td= order.note
15
+
16
+ - if order.note_to_buyer.present?
17
+ %td= order.note_to_buyer
@@ -0,0 +1,24 @@
1
+ - if order.purchased?
2
+ .effective-order-payment-details
3
+ %table.table
4
+ %thead
5
+ %tr
6
+ %th Payment
7
+ %th
8
+ %tbody
9
+ %tr
10
+ %td Provider
11
+ %td= order.payment_provider
12
+
13
+ - if order.payment_card.present?
14
+ %tr
15
+ %td Card
16
+ %td
17
+ = payment_card_label(order.payment_card)
18
+ - if order.payment.kind_of?(Hash)
19
+ = order.payment[:active_card] || order.payment['f4l4']
20
+
21
+ %tr
22
+ %td Purchased at
23
+ %td= order.purchased_at&.strftime('%F %H:%M')
24
+
@@ -0,0 +1,30 @@
1
+ .effective-order-shipping
2
+ %table.table
3
+ %thead
4
+ %tr
5
+ %th= "#{order.purchased? ? 'Sold to' : 'Bill to'}"
6
+ - if order.shipping_address.present?
7
+ %th Ship to
8
+
9
+ %tbody
10
+ %tr
11
+ %td
12
+ - if order.billing_address.blank? || !EffectiveOrders.use_address_full_name
13
+ = order.billing_name
14
+ %br
15
+
16
+ - if order.billing_address.present?
17
+ = render partial: 'effective/addresses/address', locals: { address: order.billing_address }
18
+ %br
19
+
20
+ = mail_to(order.email)
21
+
22
+ - if order.cc.present?
23
+ %br
24
+ Cc:
25
+ - order.cc.split(',').each do |email|
26
+ = mail_to(email)
27
+
28
+ - if order.shipping_address.present?
29
+ %td
30
+ = render partial: 'effective/addresses/address', locals: { address: order.shipping_address }
@@ -0,0 +1,23 @@
1
+ - if orders.present?
2
+ %table.table
3
+ %thead
4
+ %tr
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
+ = (order.purchased? ? 'Purchased' : 'Created')
15
+ = (order.purchased_at || order.created_at).strftime("%F %H:%M")
16
+ %td= order_summary(order)
17
+ %td
18
+ - if order.pending?
19
+ = link_to_checkout(order: order)
20
+ - else
21
+ = link_to 'View', effective_orders.order_path(order)
22
+ - else
23
+ %p No previous orders.
@@ -0,0 +1,4 @@
1
+ = effective_form_with(scope: :cheque, url: effective_orders.cheque_order_path(order), method: :post) do |f|
2
+ = f.hidden_field :deferred_url, value: deferred_url
3
+
4
+ = f.submit order_checkout_label(:cheque), center: true, border: false, 'data-confirm': EffectiveOrders.cheque[:confirm]
@@ -0,0 +1,12 @@
1
+ %h1.effective-heading= @page_title
2
+
3
+ %p.effective-orders-page-content
4
+ = link_to 'Home', root_path
5
+
6
+ %p.effective-orders-page-content
7
+ - if current_cart.present?
8
+ Your #{link_to_current_cart(label: 'Cart')} items have been saved. Please try again.
9
+ - else
10
+ Please try again.
11
+
12
+ = link_to 'Continue', root_path, class: 'btn btn-primary'
@@ -0,0 +1,13 @@
1
+ %h1.effective-heading= @page_title
2
+
3
+ %p.effective-orders-page-content
4
+ = link_to 'Home', root_path
5
+
6
+ %p.effective-orders-page-content
7
+ You have indicated that this order will be paid by #{@order.payment_provider}.
8
+ Your order will not be considered purchased until we receive your payment.
9
+ Please contact us at your earliest convenience.
10
+
11
+ = render @order
12
+
13
+ = link_to 'Continue', root_path, class: 'btn btn-primary'
@@ -0,0 +1,16 @@
1
+ .card
2
+ .card-body
3
+ %h2 Checkout Offline
4
+
5
+ %p
6
+ = succeed('.') do
7
+ Please indicate that you would like to pay by
8
+ = EffectiveOrders.deferred_providers.to_sentence(last_word_connector: ', or', two_words_connector: ' or ')
9
+
10
+ %p Your order will not be considered purchased until we receive your payment.
11
+
12
+ - provider_locals = { order: order, deferred_url: deferred_url, declined_url: declined_url }
13
+
14
+ .d-flex.justify-content-around
15
+ - EffectiveOrders.deferred_providers.each do |provider|
16
+ = render partial: "/effective/orders/#{provider}/form", locals: provider_locals
@@ -0,0 +1,3 @@
1
+ %h1.effective-heading= @page_title
2
+
3
+ = render_checkout_step1(@order)
@@ -0,0 +1,5 @@
1
+ = effective_form_with(scope: :free, url: effective_orders.free_order_path(order), method: :post) do |f|
2
+ = f.hidden_field :purchased_url, value: purchased_url
3
+ = f.hidden_field :declined_url, value: declined_url
4
+
5
+ = f.submit order_checkout_label(:free), center: true, border: false
@@ -0,0 +1,3 @@
1
+ %h1.effective-heading= @page_title
2
+
3
+ = render_datatable(@datatable)
@@ -0,0 +1,23 @@
1
+ .card
2
+ .card-body
3
+ %h2 Admin: Mark as Paid
4
+
5
+ = effective_form_with(model: order, url: effective_orders.mark_as_paid_order_path(order), method: :post) do |f|
6
+ = f.select :payment_provider, EffectiveOrders.payment_providers, required: true
7
+
8
+ = f.text_field :payment_card,
9
+ label: 'Payment card type, cheque or transaction number',
10
+ hint: 'Do not enter credit card numbers here, or anywhere.'
11
+
12
+ = f.text_area :payment,
13
+ label: 'Additional payment details',
14
+ input_html: { value: f.object.payment.kind_of?(Hash) ? f.object.payment[:details] : f.object.payment.presence }
15
+
16
+ = f.check_box :send_mark_as_paid_email_to_buyer,
17
+ label: 'Yes, send a receipt email to the buyer.',
18
+ 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?) }
19
+
20
+ = f.text_area :note_to_buyer, hint: 'This message will be displayed on the receipt.'
21
+
22
+ = f.submit order_checkout_label(:mark_as_paid), center: true
23
+
@@ -0,0 +1,47 @@
1
+ = effective_form_with(scope: :moneris, url: EffectiveOrders.moneris[:hpp_url], method: :post) do |f|
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)
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.name)
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)
46
+
47
+ = f.submit order_checkout_label(:moneris), border: false
@@ -0,0 +1,3 @@
1
+ %h1.effective-heading= @page_title
2
+
3
+ = render_checkout_step1(@order)
@@ -0,0 +1,5 @@
1
+ = effective_form_with(scope: :paypal, url: EffectiveOrders.paypal[:paypal_url], method: :post) do |f|
2
+ = hidden_field_tag(:cmd, '_s-xclick')
3
+ = hidden_field_tag(:encrypted, paypal_encrypted_payload(order))
4
+
5
+ = f.submit order_checkout_label(:paypal), border: false
@@ -0,0 +1,4 @@
1
+ = effective_form_with(scope: :phone, url: effective_orders.phone_order_path(order), method: :post) do |f|
2
+ = f.hidden_field :deferred_url, value: deferred_url
3
+
4
+ = f.submit order_checkout_label(:phone), center: true, border: false, 'data-confirm': EffectiveOrders.phone[:confirm]
@@ -0,0 +1,8 @@
1
+ = effective_form_with(scope: :pretend, url: effective_orders.pretend_order_path(order), method: :post) do |f|
2
+ = f.hidden_field :purchased_url, value: purchased_url
3
+ = f.hidden_field :declined_url, value: declined_url
4
+
5
+ - if EffectiveOrders.pretend_message.present?
6
+ %p.text-right= EffectiveOrders.pretend_message
7
+
8
+ = f.submit order_checkout_label(:pretend), border: false
@@ -0,0 +1,11 @@
1
+ %h1.effective-heading= @page_title
2
+
3
+ %p.effective-orders-page-content
4
+ = link_to 'Home', root_path
5
+
6
+ %p.effective-orders-page-content
7
+ You have successfully purchased the following:
8
+
9
+ = render @order
10
+
11
+ = link_to 'Continue', root_path, class: 'btn btn-primary'
@@ -0,0 +1,5 @@
1
+ = effective_form_with(scope: :refund, url: effective_orders.refund_order_path(order), method: :post) do |f|
2
+ = f.hidden_field :purchased_url, value: purchased_url
3
+ = f.hidden_field :declined_url, value: declined_url
4
+
5
+ = f.submit order_checkout_label(:refund), center: true, border: false
@@ -0,0 +1,6 @@
1
+ %h1.effective-heading= @page_title
2
+
3
+ - if @order.user == current_user
4
+ = render_checkout(@order)
5
+ - else
6
+ = render @order
@@ -0,0 +1,8 @@
1
+ .row
2
+ .col
3
+ %label Card
4
+ .col.text-right.mx-2
5
+ %label Details
6
+
7
+ #stripe-card-element
8
+ #stripe-card-errors
@@ -0,0 +1,31 @@
1
+ = javascript_include_tag 'https://js.stripe.com/v3/'
2
+
3
+ - stripe = stripe_payment_intent(order)
4
+
5
+ .card
6
+ .card-body
7
+ %h2 Checkout
8
+ %p
9
+ %em This checkout is powered by stripe.
10
+
11
+ .my-4.text-center
12
+ = link_to(image_tag('effective_orders/stripe.png'), 'https://www.stripe.com', target: '_blank')
13
+
14
+ = effective_form_with(scope: :stripe, url: effective_orders.stripe_order_path(order), data: { 'stripe-form': stripe.to_json }) do |f|
15
+ = f.hidden_field :purchased_url, value: purchased_url
16
+ = f.hidden_field :declined_url, value: declined_url
17
+
18
+ -# This is set by the stripe.js javascript
19
+ = f.hidden_field :payment_intent_id
20
+
21
+ - if stripe[:token_required]
22
+ %p Please enter your credit card information.
23
+ = render('effective/orders/stripe/element')
24
+ - else
25
+ %p Your existing card <strong>#{stripe[:active_card]}</strong> will be charged.
26
+
27
+ = collapse('Use this card instead...', class: 'update-stripe-payment-method') do
28
+ = render('effective/orders/stripe/element')
29
+
30
+ .mt-4
31
+ = f.submit order_checkout_label(:stripe), center: true, border: false
@@ -0,0 +1,11 @@
1
+ %p.effective-orders-receipt-info
2
+ - if @order.present?
3
+ An error occurred with the following order:
4
+ - else
5
+ An order error occurred:
6
+
7
+ - if @error.present?
8
+ %p Error: #{@error}
9
+
10
+ - if @order.present?
11
+ = render(@order, no_order_actions: true)
@@ -0,0 +1,2 @@
1
+ %p.effective-orders-receipt-info An order has been successfully purchased:
2
+ = render(@order, no_order_actions: true)
@@ -0,0 +1,2 @@
1
+ %p.effective-orders-receipt-info Your order has been successfully purchased:
2
+ = render(@order, no_order_actions: true)
@@ -0,0 +1,13 @@
1
+ %p.effective-orders-receipt-info Request for Payment
2
+
3
+ %p
4
+ An order has been created on your behalf for the following items.
5
+ Please remit payment at your earliest convenience.
6
+
7
+ %p #{link_to('Click here', effective_orders.order_url(@order))} to review your order and pay online with a credit card.
8
+
9
+ - if EffectiveOrders.cheque?
10
+ %p We also accept cheques via the mail, and we will manually mark your order paid upon receiving it.
11
+
12
+ = render(@order, no_order_actions: true)
13
+