effective_orders 2.2.4 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +124 -84
- data/app/assets/javascripts/effective_orders/customers.js.coffee +39 -0
- data/app/assets/javascripts/effective_orders/providers/{stripe_charges.js.coffee → stripe.js.coffee} +15 -13
- data/app/assets/javascripts/effective_orders/subscriptions.js.coffee +73 -0
- data/app/assets/stylesheets/effective_orders.scss +2 -1
- data/app/assets/stylesheets/effective_orders/_order.scss +16 -8
- data/app/assets/stylesheets/effective_orders/_subscriptions.scss +14 -0
- data/app/controllers/admin/customers_controller.rb +11 -8
- data/app/controllers/admin/order_items_controller.rb +4 -8
- data/app/controllers/admin/orders_controller.rb +133 -87
- data/app/controllers/effective/carts_controller.rb +18 -8
- data/app/controllers/effective/concerns/purchase.rb +39 -0
- data/app/controllers/effective/customers_controller.rb +43 -0
- data/app/controllers/effective/orders_controller.rb +73 -119
- data/app/controllers/effective/providers/app_checkout.rb +3 -1
- data/app/controllers/effective/providers/ccbill.rb +4 -6
- data/app/controllers/effective/providers/cheque.rb +20 -11
- data/app/controllers/effective/providers/free.rb +33 -0
- data/app/controllers/effective/providers/mark_as_paid.rb +33 -0
- data/app/controllers/effective/providers/moneris.rb +9 -17
- data/app/controllers/effective/providers/paypal.rb +4 -6
- data/app/controllers/effective/providers/pretend.rb +4 -4
- data/app/controllers/effective/providers/refund.rb +39 -0
- data/app/controllers/effective/providers/stripe.rb +19 -40
- data/app/controllers/effective/providers/stripe_connect.rb +2 -6
- data/app/controllers/effective/webhooks_controller.rb +44 -95
- data/app/datatables/effective_customers_datatable.rb +21 -29
- data/app/datatables/effective_order_items_datatable.rb +77 -79
- data/app/datatables/effective_orders_datatable.rb +67 -57
- data/app/helpers/effective_carts_helper.rb +17 -14
- data/app/helpers/effective_orders_helper.rb +40 -56
- data/app/helpers/effective_paypal_helper.rb +3 -3
- data/app/helpers/effective_stripe_helper.rb +47 -18
- data/app/helpers/effective_subscriptions_helper.rb +79 -0
- data/app/mailers/effective/orders_mailer.rb +125 -2
- data/app/models/concerns/acts_as_purchasable.rb +23 -33
- data/app/models/concerns/acts_as_subscribable.rb +68 -0
- data/app/models/concerns/acts_as_subscribable_buyer.rb +22 -0
- data/app/models/effective/cart.rb +53 -24
- data/app/models/effective/cart_item.rb +6 -12
- data/app/models/effective/customer.rb +51 -54
- data/app/models/effective/order.rb +160 -147
- data/app/models/effective/order_item.rb +18 -21
- data/app/models/effective/product.rb +7 -7
- data/app/models/effective/providers/ccbill_postback.rb +1 -1
- data/app/models/effective/providers/stripe_charge.rb +8 -19
- data/app/models/effective/subscripter.rb +230 -0
- data/app/models/effective/subscription.rb +27 -76
- data/app/models/effective/tax_rate_calculator.rb +10 -7
- data/app/views/admin/customers/_actions.html.haml +1 -2
- data/app/views/admin/customers/index.html.haml +1 -1
- data/app/views/admin/customers/show.html.haml +6 -0
- data/app/views/admin/orders/_actions.html.haml +9 -7
- data/app/views/admin/orders/_form.html.haml +11 -7
- data/app/views/admin/orders/_order_actions.html.haml +2 -1
- data/app/views/admin/orders/_order_item_fields.html.haml +1 -1
- data/app/views/admin/orders/edit.html.haml +4 -0
- data/app/views/admin/orders/index.html.haml +1 -4
- data/app/views/admin/orders/new.html.haml +1 -1
- data/app/views/admin/orders/show.html.haml +5 -6
- data/app/views/effective/carts/_cart.html.haml +2 -2
- data/app/views/effective/carts/show.html.haml +2 -2
- data/app/views/effective/customers/_customer.html.haml +152 -0
- data/app/views/effective/customers/_fields.html.haml +12 -0
- data/app/views/effective/customers/_form.html.haml +13 -0
- data/app/views/effective/customers/edit.html.haml +3 -0
- data/app/views/effective/orders/_checkout_step1.html.haml +8 -15
- data/app/views/effective/orders/_checkout_step2.html.haml +34 -21
- data/app/views/effective/orders/_order.html.haml +8 -9
- data/app/views/effective/orders/_order_actions.html.haml +7 -8
- data/app/views/effective/orders/_order_header.html.haml +1 -1
- data/app/views/effective/orders/_order_items.html.haml +11 -5
- data/app/views/effective/orders/_order_note.html.haml +4 -7
- data/app/views/effective/orders/_orders_table.html.haml +26 -26
- data/app/views/effective/orders/app_checkout/_form.html.haml +2 -2
- data/app/views/effective/orders/ccbill/_form.html.haml +1 -1
- data/app/views/effective/orders/cheque/_form.html.haml +3 -1
- data/app/views/effective/orders/declined.html.haml +1 -1
- data/app/views/effective/orders/{checkout_step1.html.haml → edit.html.haml} +0 -0
- data/app/views/effective/orders/free/_form.html.haml +4 -0
- data/app/views/effective/orders/index.html.haml +2 -4
- data/app/views/effective/orders/mark_as_paid/_form.html.haml +32 -0
- data/app/views/effective/orders/moneris/_form.html.haml +6 -6
- data/app/views/effective/orders/{checkout_step2.html.haml → new.html.haml} +1 -1
- data/app/views/effective/orders/paypal/_form.html.haml +2 -2
- data/app/views/effective/orders/pretend/_form.html.haml +2 -2
- data/app/views/effective/orders/purchased.html.haml +3 -0
- data/app/views/effective/orders/refund/_form.html.haml +32 -0
- data/app/views/effective/orders/show.html.haml +4 -1
- data/app/views/effective/orders/stripe/_form.html.haml +5 -5
- data/app/views/effective/orders_mailer/subscription_canceled.html.haml +9 -0
- data/app/views/effective/orders_mailer/subscription_payment_failed.html.haml +9 -0
- data/app/views/effective/orders_mailer/subscription_payment_succeeded.html.haml +9 -0
- data/app/views/effective/orders_mailer/subscription_trial_expired.html.haml +5 -0
- data/app/views/effective/orders_mailer/subscription_trial_expiring.html.haml +7 -0
- data/app/views/effective/subscriptions/_fields.html.haml +16 -0
- data/app/views/effective/subscriptions/_plan.html.haml +21 -0
- data/app/views/layouts/effective_orders_mailer_layout.html.haml +6 -8
- data/config/effective_orders.rb +41 -20
- data/config/routes.rb +48 -48
- data/db/migrate/01_create_effective_orders.rb.erb +19 -5
- data/lib/effective_orders.rb +78 -42
- data/lib/effective_orders/engine.rb +36 -82
- data/lib/effective_orders/version.rb +1 -1
- data/lib/generators/effective_orders/install_generator.rb +2 -2
- data/lib/generators/templates/effective_orders_mailer_preview.rb +39 -4
- data/lib/tasks/effective_orders_tasks.rake +42 -0
- data/spec/controllers/carts_controller_spec.rb +1 -1
- data/spec/controllers/moneris_orders_controller_spec.rb +4 -4
- data/spec/controllers/orders_controller_spec.rb +4 -4
- data/spec/controllers/stripe_orders_controller_spec.rb +2 -2
- data/spec/controllers/webhooks_controller_spec.rb +1 -1
- data/spec/dummy/config/initializers/effective_orders.rb +1 -7
- data/spec/dummy/db/schema.rb +1 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +3 -0
- data/spec/models/acts_as_purchasable_spec.rb +0 -56
- data/spec/models/customer_spec.rb +3 -3
- data/spec/models/order_spec.rb +2 -2
- data/spec/spec_helper.rb +1 -1
- data/spec/support/factories.rb +2 -1
- metadata +37 -49
- data/active_admin/effective_carts.rb +0 -14
- data/active_admin/effective_orders.rb +0 -112
- data/app/assets/javascripts/effective_orders/providers/stripe_subscriptions.js.coffee +0 -28
- data/app/controllers/concerns/acts_as_active_admin_controller.rb +0 -69
- data/app/controllers/effective/subscriptions_controller.rb +0 -126
- data/app/models/effective/datatables/customers.rb +0 -40
- data/app/models/effective/datatables/order_items.rb +0 -101
- data/app/models/effective/datatables/orders.rb +0 -91
- data/app/models/inputs/price_field.rb +0 -63
- data/app/models/inputs/price_form_input.rb +0 -7
- data/app/models/inputs/price_formtastic_input.rb +0 -9
- data/app/models/inputs/price_input.rb +0 -19
- data/app/models/inputs/price_simple_form_input.rb +0 -8
- data/app/views/admin/orders/_form_mark_as_paid.html.haml +0 -33
- data/app/views/admin/orders/_order_payment_details.html.haml +0 -5
- data/app/views/admin/orders/mark_as_paid.html.haml +0 -7
- data/app/views/effective/orders/stripe/_subscription_fields.html.haml +0 -7
- data/app/views/effective/subscriptions/index.html.haml +0 -22
- data/app/views/effective/subscriptions/new.html.haml +0 -9
- data/app/views/effective/subscriptions/show.html.haml +0 -49
- data/db/upgrade/02_upgrade_effective_orders_from03x.rb.erb +0 -29
- data/db/upgrade/03_upgrade_effective_orders_from1x.rb.erb +0 -98
- data/db/upgrade/upgrade_price_column_on_table.rb.erb +0 -17
- data/lib/generators/effective_orders/upgrade_from03x_generator.rb +0 -31
- data/lib/generators/effective_orders/upgrade_from1x_generator.rb +0 -27
- 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
|
2
|
-
|
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
|
-
|
6
|
-
|
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
|
-
|
9
|
-
|
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
|
-
|
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...' }
|
@@ -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
|
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
|
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
|
-
|
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,27 +1,27 @@
|
|
1
|
-
|
2
|
-
%
|
3
|
-
%
|
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
|
-
%
|
12
|
-
%
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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.
|
2
|
-
= submit_tag order_checkout_label(:app_checkout), :
|
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
|
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.
|
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...' }
|
File without changes
|
@@ -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], :
|
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
|
8
|
-
= hidden_field_tag(:
|
7
|
+
- if purchased_url.present?
|
8
|
+
= hidden_field_tag(:rvar_purchased_url, purchased_url)
|
9
9
|
|
10
|
-
- if
|
11
|
-
= hidden_field_tag(:
|
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), :
|
47
|
+
= submit_tag order_checkout_label(:moneris), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
|
@@ -1,5 +1,5 @@
|
|
1
|
-
= form_tag(EffectiveOrders.paypal[:paypal_url], :
|
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), :
|
5
|
+
= submit_tag order_checkout_label(:paypal), class: 'btn btn-primary', data: { disable_with: 'Continuing...' }
|
@@ -1,2 +1,2 @@
|
|
1
|
-
= form_tag(effective_orders.
|
2
|
-
= submit_tag order_checkout_label(:pretend), :
|
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...' }
|
@@ -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,7 +1,7 @@
|
|
1
|
-
= javascript_include_tag
|
1
|
+
= javascript_include_tag 'https://checkout.stripe.com/checkout.js'
|
2
2
|
|
3
|
-
#effective-orders-new-charge-form{data:
|
4
|
-
= simple_form_for(@stripe_charge || Effective::Providers::StripeCharge.new(order),
|
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.
|
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,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
|
+
|