Class: ShoppingCart::CheckoutsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- ShoppingCart::CheckoutsController
- Includes:
- Rectify::ControllerHelpers, CurrentSession, Wicked::Wizard
- Defined in:
- app/controllers/shopping_cart/checkouts_controller.rb
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/shopping_cart/checkouts_controller.rb', line 11 def show CheckoutStepper.call(steps: steps, step: step, edit: params[:edit], order: current_order, user: current_user) do on(:empty_cart) { redirect_to cart_path, alert: I18n.t('notice.empty_cart') } on(:invalid) { render_wizard } on(:ok) do |step| jump_to(step) render_wizard end end end |
#update ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/shopping_cart/checkouts_controller.rb', line 22 def update CheckoutUpdater.call(step: step, params: params, order: current_order, user: current_user) do on(:only_billing_address) do |billing| expose(billing: billing) render_wizard billing end on(:both_addresses) do |billing, shipping| expose(billing: billing, shipping: shipping) render_wizard shipping end on(:invalid_addresses) do |billing, shipping| expose(billing: billing, shipping: shipping) render :address end on(:delivery_ok) { |order| render_wizard order } on(:payment_ok) do |credit_card| expose(credit_card: credit_card) render_wizard credit_card end on(:confirm_ok) do |placed_order| expose(placed_order: placed_order) render :complete end end end |