effective_orders 1.8.1 → 2.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 +150 -60
- data/Rakefile +0 -3
- data/active_admin/effective_orders.rb +14 -9
- data/app/assets/javascripts/effective_orders.js +2 -0
- data/app/assets/javascripts/effective_orders/{stripe_charges.js.coffee → providers/stripe_charges.js.coffee} +1 -1
- data/app/assets/javascripts/effective_orders/{stripe_subscriptions.js.coffee → providers/stripe_subscriptions.js.coffee} +1 -1
- data/app/assets/stylesheets/effective_orders/_order.scss +9 -3
- data/app/controllers/admin/orders_controller.rb +87 -3
- data/app/controllers/concerns/acts_as_active_admin_controller.rb +2 -1
- data/app/controllers/effective/carts_controller.rb +4 -2
- data/app/controllers/effective/orders_controller.rb +101 -60
- data/app/controllers/effective/providers/app_checkout.rb +10 -2
- data/app/controllers/effective/providers/ccbill.rb +34 -0
- data/app/controllers/effective/providers/cheque.rb +30 -0
- data/app/controllers/effective/providers/moneris.rb +7 -7
- data/app/controllers/effective/providers/paypal.rb +7 -5
- data/app/controllers/effective/providers/pretend.rb +22 -0
- data/app/controllers/effective/providers/stripe.rb +26 -24
- data/app/controllers/effective/webhooks_controller.rb +1 -1
- data/app/helpers/effective_carts_helper.rb +59 -29
- data/app/helpers/effective_ccbill_helper.rb +25 -0
- data/app/helpers/effective_orders_helper.rb +50 -41
- data/app/helpers/effective_paypal_helper.rb +11 -11
- data/app/mailers/effective/orders_mailer.rb +95 -20
- data/app/models/concerns/acts_as_purchasable.rb +14 -22
- data/app/models/effective/cart.rb +9 -15
- data/app/models/effective/cart_item.rb +15 -13
- data/app/models/effective/customer.rb +9 -9
- data/app/models/effective/datatables/order_items.rb +14 -8
- data/app/models/effective/datatables/orders.rb +56 -69
- data/app/models/effective/order.rb +250 -139
- data/app/models/effective/order_item.rb +23 -16
- data/app/models/effective/product.rb +23 -0
- data/app/models/effective/providers/ccbill_postback.rb +85 -0
- data/app/models/effective/{stripe_charge.rb → providers/stripe_charge.rb} +1 -1
- data/app/models/effective/subscription.rb +16 -12
- data/app/models/effective/tax_rate_calculator.rb +45 -0
- data/app/views/admin/customers/index.html.haml +2 -5
- data/app/views/admin/order_items/index.html.haml +2 -5
- data/app/views/admin/orders/_actions.html.haml +2 -0
- data/app/views/admin/orders/_form.html.haml +28 -0
- data/app/views/admin/orders/_order_item_fields.html.haml +9 -0
- data/app/views/admin/orders/index.html.haml +9 -5
- data/app/views/admin/orders/new.html.haml +3 -0
- data/app/views/effective/carts/_cart.html.haml +3 -12
- data/app/views/effective/carts/_cart_actions.html.haml +4 -0
- data/app/views/effective/carts/show.html.haml +10 -12
- data/app/views/effective/orders/_checkout_step1.html.haml +46 -0
- data/app/views/effective/orders/_checkout_step2.html.haml +33 -0
- data/app/views/effective/orders/_order.html.haml +2 -0
- data/app/views/effective/orders/_order_actions.html.haml +10 -5
- data/app/views/effective/orders/_order_footer.html.haml +1 -0
- data/app/views/effective/orders/_order_items.html.haml +11 -9
- data/app/views/effective/orders/_order_note.html.haml +8 -0
- data/app/views/effective/orders/_order_note_fields.html.haml +5 -0
- data/app/views/effective/orders/_order_shipping.html.haml +4 -4
- data/app/views/effective/orders/_order_user_fields.html.haml +1 -0
- data/app/views/effective/orders/_orders_table.html.haml +27 -0
- data/app/views/effective/orders/ccbill/_form.html.haml +24 -0
- data/app/views/effective/orders/checkout_step1.html.haml +3 -0
- data/app/views/effective/orders/checkout_step2.html.haml +3 -0
- data/app/views/effective/orders/cheque/_form.html.haml +2 -0
- data/app/views/effective/orders/cheque/pay_by_cheque.html.haml +9 -0
- data/app/views/effective/orders/declined.html.haml +4 -2
- data/app/views/effective/orders/my_purchases.html.haml +1 -1
- data/app/views/effective/orders/my_sales.html.haml +1 -1
- data/app/views/effective/orders/purchased.html.haml +3 -2
- data/app/views/effective/orders/show.html.haml +1 -1
- data/app/views/effective/orders/stripe/_form.html.haml +5 -5
- data/app/views/effective/orders_mailer/order_error.html.haml +11 -0
- data/app/views/effective/orders_mailer/payment_request_to_buyer.html.haml +13 -0
- data/app/views/effective/orders_mailer/pending_order_invoice_to_buyer.html.haml +13 -0
- data/app/views/layouts/effective_orders_mailer_layout.html.haml +7 -7
- data/config/routes.rb +39 -24
- data/db/migrate/01_create_effective_orders.rb.erb +20 -1
- data/db/upgrade/03_upgrade_effective_orders_from1x.rb.erb +95 -0
- data/lib/effective_orders.rb +67 -9
- data/lib/effective_orders/app_checkout_service.rb +1 -2
- data/lib/effective_orders/engine.rb +46 -14
- data/lib/effective_orders/version.rb +1 -1
- data/lib/generators/effective_orders/install_generator.rb +1 -0
- data/lib/generators/effective_orders/upgrade_from03x_generator.rb +1 -0
- data/lib/generators/effective_orders/upgrade_from1x_generator.rb +31 -0
- data/lib/generators/templates/effective_orders.rb +131 -66
- data/lib/generators/templates/effective_orders_mailer_preview.rb +28 -13
- data/spec/controllers/admin/orders_controller_spec.rb +242 -0
- data/spec/controllers/ccbill_orders_controller_spec.rb +103 -0
- data/spec/controllers/moneris_orders_controller_spec.rb +23 -23
- data/spec/controllers/orders_controller_spec.rb +167 -79
- data/spec/controllers/stripe_orders_controller_spec.rb +7 -7
- data/spec/dummy/app/models/product.rb +0 -8
- data/spec/dummy/app/models/product_with_float_price.rb +0 -8
- data/spec/dummy/app/models/user.rb +2 -19
- data/spec/dummy/config/application.rb +2 -1
- data/spec/dummy/config/environments/test.rb +1 -0
- data/spec/dummy/config/initializers/effective_orders.rb +109 -64
- data/spec/dummy/db/schema.rb +15 -2
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +0 -258
- data/spec/models/acts_as_purchasable_spec.rb +8 -6
- data/spec/models/factories_spec.rb +7 -1
- data/spec/models/order_item_spec.rb +1 -1
- data/spec/models/order_spec.rb +165 -46
- data/spec/models/stripe_charge_spec.rb +5 -5
- data/spec/spec_helper.rb +2 -0
- data/spec/support/factories.rb +49 -33
- metadata +47 -64
- data/app/views/effective/orders/_checkout_step_1.html.haml +0 -43
- data/app/views/effective/orders/_checkout_step_2.html.haml +0 -25
- data/app/views/effective/orders/_my_purchases.html.haml +0 -17
- data/app/views/effective/orders/checkout.html.haml +0 -3
- data/app/views/effective/orders/new.html.haml +0 -4
- data/spec/dummy/log/development.log +0 -82
@@ -0,0 +1,33 @@
|
|
1
|
+
= render(order)
|
2
|
+
|
3
|
+
.effective-order.effective-order-purchase-actions
|
4
|
+
- if EffectiveOrders.allow_pretend_purchase_in_development
|
5
|
+
- if Rails.env.production? == false
|
6
|
+
= render partial: '/effective/orders/pretend/form', locals: {order: order, purchased_redirect_url: purchased_redirect_url, declined_redirect_url: declined_redirect_url}
|
7
|
+
|
8
|
+
- if EffectiveOrders.allow_pretend_purchase_in_production
|
9
|
+
- if Rails.env.production?
|
10
|
+
= render partial: '/effective/orders/pretend/form', locals: {order: order, purchased_redirect_url: purchased_redirect_url, declined_redirect_url: declined_redirect_url}
|
11
|
+
|
12
|
+
- if EffectiveOrders.moneris_enabled
|
13
|
+
= render partial: '/effective/orders/moneris/form', locals: {order: order, purchased_redirect_url: purchased_redirect_url, declined_redirect_url: declined_redirect_url}
|
14
|
+
|
15
|
+
- if EffectiveOrders.paypal_enabled
|
16
|
+
= render partial: '/effective/orders/paypal/form', locals: {order: order}
|
17
|
+
|
18
|
+
- if EffectiveOrders.stripe_enabled
|
19
|
+
= render partial: '/effective/orders/stripe/form', locals: {order: order}
|
20
|
+
|
21
|
+
- if EffectiveOrders.ccbill_enabled
|
22
|
+
= render partial: '/effective/orders/ccbill/form', locals: {order: order}
|
23
|
+
|
24
|
+
- if EffectiveOrders.app_checkout_enabled
|
25
|
+
- if (EffectiveOrders.authorized?(controller, :app_checkout, order) rescue false)
|
26
|
+
= render partial: '/effective/orders/app_checkout/form', locals: {order: order}
|
27
|
+
|
28
|
+
- if EffectiveOrders.cheque_enabled
|
29
|
+
= render partial: '/effective/orders/cheque/form', locals: {order: order}
|
30
|
+
|
31
|
+
- if EffectiveOrders.allow_pretend_purchase_in_production
|
32
|
+
%br
|
33
|
+
%p= EffectiveOrders.allow_pretend_purchase_in_production_message
|
@@ -4,7 +4,9 @@
|
|
4
4
|
|
5
5
|
= render partial: 'effective/orders/order_header', locals: {order: order}
|
6
6
|
= render partial: 'effective/orders/order_shipping', locals: {order: order}
|
7
|
+
= render partial: 'effective/orders/order_note', locals: {order: order}
|
7
8
|
= render partial: 'effective/orders/order_items', locals: {order: order}
|
9
|
+
= render partial: 'effective/orders/order_footer', locals: {order: order}
|
8
10
|
|
9
11
|
- if (EffectiveOrders.authorized?(controller, :show, :payment_details) rescue false)
|
10
12
|
= render partial: 'effective/orders/order_payment_details', locals: {order: order}
|
@@ -1,5 +1,10 @@
|
|
1
|
-
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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;'
|
4
|
+
|
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...' }
|
7
|
+
|
8
|
+
- elsif (EffectiveOrders.authorized?(controller, :admin, :effective_orders) rescue false)
|
9
|
+
= link_to 'Mark as Paid', effective_orders.mark_as_paid_admin_order_path(order), class: 'btn btn-default', method: :post, data: { confirm: 'Are you sure you want to mark this order as paid?', disable_with: 'Marking as paid...' }
|
10
|
+
= link_to 'Send Payment Request', effective_orders.send_payment_request_admin_order_path(order), class: 'btn btn-default', method: :post, data: { confirm: 'This action will email buyer a payment request. Send it now?', disable_with: 'Sending...' }
|
@@ -0,0 +1 @@
|
|
1
|
+
- # intentionally left blank
|
@@ -31,7 +31,7 @@
|
|
31
31
|
%td.price= price_to_currency(item.price)
|
32
32
|
|
33
33
|
%tfoot
|
34
|
-
- if order.tax > 0
|
34
|
+
- if order.tax.to_i > 0 || order.tax_rate == nil
|
35
35
|
%tr
|
36
36
|
- if include_quantity_column
|
37
37
|
%th.quantity
|
@@ -39,17 +39,19 @@
|
|
39
39
|
%th.download
|
40
40
|
%th.subtotal Subtotal
|
41
41
|
%td.price.subtotal-price= price_to_currency(order.subtotal)
|
42
|
+
- if order.tax.to_i > 0
|
42
43
|
%tr
|
43
44
|
- if include_quantity_column
|
44
45
|
%th.quantity
|
45
46
|
- if include_download_column
|
46
47
|
%th.download
|
47
|
-
%th.tax Tax
|
48
|
+
%th.tax Tax (#{tax_rate_to_percentage(order.tax_rate)})
|
48
49
|
%td.price.tax-price= price_to_currency(order.tax)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
50
|
+
- if order.tax_rate.present?
|
51
|
+
%tr
|
52
|
+
- if include_quantity_column
|
53
|
+
%th.quantity
|
54
|
+
- if include_download_column
|
55
|
+
%th.download
|
56
|
+
%th.total Total Due
|
57
|
+
%td.price.total-price= price_to_currency(order.total)
|
@@ -3,20 +3,20 @@
|
|
3
3
|
%thead
|
4
4
|
%tr
|
5
5
|
%th= "#{order.purchased? ? 'Sold to' : 'Bill to'}"
|
6
|
-
- if order.shipping_address.present?
|
6
|
+
- if order.shipping_address.present?
|
7
7
|
%th Ship to
|
8
8
|
|
9
9
|
%tbody
|
10
10
|
%tr
|
11
11
|
%td
|
12
|
-
- if order.billing_address.present?
|
13
|
-
= render :partial => 'effective/addresses/address', :locals => {:address => order.billing_address
|
12
|
+
- if order.billing_address.present?
|
13
|
+
= render :partial => 'effective/addresses/address', :locals => {:address => order.billing_address}
|
14
14
|
- else
|
15
15
|
= order.billing_name
|
16
16
|
%br
|
17
17
|
= mail_to(order.user.email)
|
18
18
|
%br
|
19
19
|
|
20
|
-
- if order.shipping_address.present?
|
20
|
+
- if order.shipping_address.present?
|
21
21
|
%td
|
22
22
|
= render :partial => 'effective/addresses/address', :locals => {:address => order.shipping_address}
|
@@ -0,0 +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|
|
10
|
+
%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
|
@@ -0,0 +1,24 @@
|
|
1
|
+
= form_tag('https://bill.ccbill.com/jpost/signup.cgi', :method => :post) do
|
2
|
+
= hidden_field_tag(:clientAccnum, EffectiveOrders.ccbill[:client_accnum])
|
3
|
+
= hidden_field_tag(:clientSubacc, EffectiveOrders.ccbill[:client_subacc])
|
4
|
+
= hidden_field_tag(:formName, EffectiveOrders.ccbill[:form_name])
|
5
|
+
= hidden_field_tag(:formPrice, ccbill_price(order.total))
|
6
|
+
= hidden_field_tag(:formPeriod, EffectiveOrders.ccbill[:form_period])
|
7
|
+
= hidden_field_tag(:currencyCode, EffectiveOrders.ccbill[:currency_code])
|
8
|
+
= hidden_field_tag(:formDigest, ccbill_form_digest(order))
|
9
|
+
|
10
|
+
-# CCBill 'Webhooks' (pre-filled form data)
|
11
|
+
= hidden_field_tag(:customer_fname, ccbill_customer_name(order, :first_name))
|
12
|
+
= hidden_field_tag(:customer_lname, ccbill_customer_name(order, :last_name))
|
13
|
+
= hidden_field_tag(:email, order.user.try(:email))
|
14
|
+
= hidden_field_tag(:address1, order.billing_address.try(:address1))
|
15
|
+
= hidden_field_tag(:city, order.billing_address.try(:city))
|
16
|
+
= hidden_field_tag(:state, order.billing_address.try(:state_code))
|
17
|
+
= hidden_field_tag(:zipcode, order.billing_address.try(:postal_code))
|
18
|
+
= hidden_field_tag(:country, order.billing_address.try(:country_code))
|
19
|
+
|
20
|
+
-# custom fields
|
21
|
+
= hidden_field_tag(:order_id, order.to_param)
|
22
|
+
|
23
|
+
= submit_tag(order_checkout_label(:ccbill), :class => 'btn btn-primary', :data => {'disable_with' => 'Continuing...' })
|
24
|
+
|
@@ -0,0 +1,9 @@
|
|
1
|
+
%h2.effective-orders-page-title= (@page_title || 'Payment Required')
|
2
|
+
|
3
|
+
%p.effective-orders-page-content
|
4
|
+
Thank you!
|
5
|
+
You have indicated that this order will be purchased by cheque.
|
6
|
+
Please send us a cheque at your earliest convenience.
|
7
|
+
We will mark this order purchased upon receiving your payment.
|
8
|
+
|
9
|
+
= render @order
|
@@ -1,5 +1,7 @@
|
|
1
|
-
%h2.effective-orders-page-title Payment Declined
|
1
|
+
%h2.effective-orders-page-title= (@page_title || 'Payment Declined')
|
2
2
|
|
3
|
-
%p
|
3
|
+
%p= flash[:danger]
|
4
|
+
|
5
|
+
%p Your #{link_to_current_cart(label: 'Cart')} items have been saved. Please try again.
|
4
6
|
|
5
7
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
= javascript_include_tag "https://checkout.stripe.com/checkout.js"
|
2
2
|
|
3
|
-
#effective-orders-new-charge-form{:
|
4
|
-
= simple_form_for(@stripe_charge || Effective::StripeCharge.new(order), (EffectiveOrders.simple_form_options || {}).merge(:
|
5
|
-
= f.input :effective_order_id, :
|
6
|
-
= f.input :token, :
|
7
|
-
= f.submit order_checkout_label(:stripe), :
|
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|
|
5
|
+
= f.input :effective_order_id, as: :hidden
|
6
|
+
= f.input :token, as: :hidden
|
7
|
+
= f.submit order_checkout_label(:stripe), class: 'stripe-button', data: {'disable_with' => 'Continuing...' }
|
@@ -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_enabled
|
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
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
%p.effective-orders-receipt-info Pending order created
|
2
|
+
|
3
|
+
%p We have received notice of your intention to purchase the following items.
|
4
|
+
|
5
|
+
%p Please remit payment at your earliest convenience.
|
6
|
+
|
7
|
+
%p #{link_to('Click here', effective_orders.order_url(@order))} to review your order online.
|
8
|
+
|
9
|
+
- if EffectiveOrders.cheque_enabled
|
10
|
+
%p When we receive your cheque in the mail we will mark your order paid.
|
11
|
+
|
12
|
+
= render(@order, no_order_actions: true)
|
13
|
+
|
@@ -16,12 +16,12 @@
|
|
16
16
|
%tr
|
17
17
|
%td
|
18
18
|
%table{style: 'max-width: 650px; margin: 4px auto 30px;'}
|
19
|
-
%thead{style: '
|
20
|
-
%tr
|
21
|
-
%th
|
22
|
-
%tbody{style: '
|
19
|
+
%thead{style: 'width: 100%;'}
|
20
|
+
%tr
|
21
|
+
%th
|
22
|
+
%tbody{style: 'width: 100%'}
|
23
23
|
%tr
|
24
24
|
%td= yield
|
25
|
-
%tfoot{style: '
|
26
|
-
%tr
|
27
|
-
%th
|
25
|
+
%tfoot{style: 'width: 100%;'}
|
26
|
+
%tr
|
27
|
+
%th
|
data/config/routes.rb
CHANGED
@@ -1,61 +1,76 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
|
2
|
+
unless EffectiveOrders.skip_mount_engine
|
3
|
+
mount EffectiveOrders::Engine => '/', as: 'effective_orders'
|
4
|
+
end
|
3
5
|
end
|
4
6
|
|
5
7
|
EffectiveOrders::Engine.routes.draw do
|
6
|
-
scope :
|
8
|
+
scope module: 'effective' do
|
9
|
+
|
10
|
+
match 'orders/(:id)/purchased', to: 'orders#purchased', as: 'order_purchased', via: :get
|
11
|
+
match 'orders/:id/declined', to: 'orders#declined', as: 'order_declined', via: :get
|
12
|
+
match 'orders/:id/resend_buyer_receipt', to: 'orders#resend_buyer_receipt', via: :get, as: 'resend_buyer_receipt'
|
13
|
+
match 'orders/my_purchases', to: 'orders#my_purchases', as: 'my_purchases', via: :get
|
7
14
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
match 'orders/my_purchases', :to => 'orders#my_purchases', :as => 'my_purchases', :via => :get
|
15
|
+
if EffectiveOrders.cheque_enabled
|
16
|
+
match 'orders/:id/pay_by_cheque', to: 'orders#pay_by_cheque', via: :post, as: 'pay_by_cheque'
|
17
|
+
end
|
12
18
|
|
13
19
|
if EffectiveOrders.paypal_enabled
|
14
|
-
match 'orders/paypal_postback', :
|
20
|
+
match 'orders/paypal_postback', to: 'orders#paypal_postback', as: 'paypal_postback', via: :post
|
15
21
|
end
|
16
22
|
|
17
23
|
if EffectiveOrders.moneris_enabled
|
18
|
-
match 'orders/moneris_postback', :
|
24
|
+
match 'orders/moneris_postback', to: 'orders#moneris_postback', as: 'moneris_postback', via: :post
|
19
25
|
end
|
20
26
|
|
21
27
|
if EffectiveOrders.stripe_enabled
|
22
|
-
match 'orders/stripe_charge', :
|
28
|
+
match 'orders/stripe_charge', to: 'orders#stripe_charge', as: 'stripe_charges', via: :post
|
23
29
|
end
|
24
30
|
|
25
31
|
if EffectiveOrders.stripe_subscriptions_enabled
|
26
|
-
resources :subscriptions, :
|
32
|
+
resources :subscriptions, only: [:index, :show, :new, :create, :destroy]
|
27
33
|
end
|
28
34
|
|
29
35
|
if EffectiveOrders.stripe_connect_enabled
|
30
|
-
match 'orders/stripe_connect_redirect_uri', :
|
31
|
-
match 'orders/my_sales', :
|
36
|
+
match 'orders/stripe_connect_redirect_uri', to: 'orders#stripe_connect_redirect_uri', as: 'stripe_connect_redirect_uri', via: :get
|
37
|
+
match 'orders/my_sales', to: 'orders#my_sales', as: 'my_sales', via: :get
|
38
|
+
end
|
39
|
+
|
40
|
+
if EffectiveOrders.ccbill_enabled
|
41
|
+
match 'orders/ccbill_postback', to: 'orders#ccbill_postback', as: 'ccbill_postback', via: :post
|
32
42
|
end
|
33
43
|
|
34
44
|
if EffectiveOrders.app_checkout_enabled
|
35
|
-
match 'orders/:id/app_checkout', :
|
45
|
+
match 'orders/:id/app_checkout', to: 'orders#app_checkout', as: 'app_checkout', via: :post
|
36
46
|
end
|
37
47
|
|
38
48
|
if (Rails.env.development? || Rails.env.test?) || EffectiveOrders.allow_pretend_purchase_in_production
|
39
|
-
match 'orders/:id/pretend_purchase', :
|
49
|
+
match 'orders/:id/pretend_purchase', to: 'orders#pretend_purchase', as: 'pretend_purchase', via: [:get, :post]
|
40
50
|
end
|
41
51
|
|
42
|
-
resources :orders, :
|
52
|
+
resources :orders, except: [:destroy]
|
43
53
|
|
44
|
-
match 'cart', :
|
45
|
-
match 'cart', :
|
54
|
+
match 'cart', to: 'carts#show', as: 'cart', via: :get
|
55
|
+
match 'cart', to: 'carts#destroy', via: :delete
|
46
56
|
|
47
57
|
# If you Tweak this route, please update EffectiveOrdersHelper too
|
48
|
-
match 'cart/:purchasable_type/:purchasable_id', :
|
49
|
-
match 'cart/:id', :
|
58
|
+
match 'cart/:purchasable_type/:purchasable_id', to: 'carts#add_to_cart', via: [:get, :post], as: 'add_to_cart'
|
59
|
+
match 'cart/:id', to: 'carts#remove_from_cart', via: [:delete], as: 'remove_from_cart'
|
50
60
|
|
51
|
-
match 'webhooks/stripe', :
|
61
|
+
match 'webhooks/stripe', to: 'webhooks#stripe', via: [:post, :put]
|
52
62
|
end
|
53
63
|
|
54
|
-
if
|
64
|
+
if !EffectiveOrders.use_active_admin? || Rails.env.test?
|
55
65
|
namespace :admin do
|
56
|
-
resources :customers, :
|
57
|
-
resources :orders, :
|
58
|
-
|
66
|
+
resources :customers, only: [:index]
|
67
|
+
resources :orders, only: [:index, :show, :new, :create] do
|
68
|
+
member do
|
69
|
+
post :send_payment_request
|
70
|
+
post :mark_as_paid
|
71
|
+
end
|
72
|
+
end
|
73
|
+
resources :order_items, only: [:index]
|
59
74
|
end
|
60
75
|
end
|
61
76
|
end
|