mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
add SplitCheckoutController and conditional route
This commit is contained in:
committed by
Jean-Baptiste Bellet
parent
49f026629c
commit
af79969d96
9
app/constraints/split_checkout_constraint.rb
Normal file
9
app/constraints/split_checkout_constraint.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class SplitCheckoutConstraint
|
||||
def matches?(request)
|
||||
Flipper.enabled? :split_checkout, current_user(request)
|
||||
end
|
||||
|
||||
def current_user(request)
|
||||
@spree_current_user ||= request.env['warden'].user
|
||||
end
|
||||
end
|
||||
3
app/controllers/split_checkout_controller.rb
Normal file
3
app/controllers/split_checkout_controller.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class SplitCheckoutController < CheckoutController
|
||||
|
||||
end
|
||||
@@ -69,10 +69,17 @@ Openfoodnetwork::Application.routes.draw do
|
||||
resources :webhooks, only: [:create]
|
||||
end
|
||||
|
||||
get '/checkout', to: 'checkout#edit' , as: :checkout
|
||||
put '/checkout', to: 'checkout#update' , as: :update_checkout
|
||||
get '/checkout/:state', to: 'checkout#edit', as: :checkout_state
|
||||
get '/checkout/paypal_payment/:order_id', to: 'checkout#paypal_payment', as: :paypal_payment
|
||||
constraints(SplitCheckoutConstraint.new) do
|
||||
get '/checkout', to: 'split_checkout#edit', as: :checkout
|
||||
put '/checkout', to: 'split_checkout#update', as: :update_checkout
|
||||
get '/checkout/:state', to: 'split_checkout#edit', as: :checkout_state
|
||||
get '/checkout/paypal_payment/:order_id', to: 'split_checkout#paypal_payment', as: :paypal_payment
|
||||
end
|
||||
|
||||
get '/checkout', to: 'checkout#edit'
|
||||
put '/checkout', to: 'checkout#update'
|
||||
get '/checkout/:state', to: 'checkout#edit'
|
||||
get '/checkout/paypal_payment/:order_id', to: 'checkout#paypal_payment'
|
||||
|
||||
get 'embedded_shopfront/shopfront_session', to: 'application#shopfront_session'
|
||||
post 'embedded_shopfront/enable', to: 'application#enable_embedded_styles'
|
||||
|
||||
Reference in New Issue
Block a user