Sha256: 2658ea0754b361e4f82be07591828524dbfc13ff33c9c0cb2cc47963f76d1365
Contents?: true
Size: 1.5 KB
Versions: 2
Compression:
Stored size: 1.5 KB
Contents
module ShoppingCart class CheckoutsController < ApplicationController include ShoppingCart::CurrentSession include Wicked::Wizard include Rectify::ControllerHelpers before_action :authenticate_user!, only: :update steps :login, :address, :delivery, :payment, :confirm 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 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 end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
loker-shopping-cart-0.1.2 | app/controllers/shopping_cart/checkouts_controller.rb |
loker-shopping-cart-0.1.1 | app/controllers/shopping_cart/checkouts_controller.rb |