Sha256: 5aec5cb1b18a4f51e0986e58b88389680ae77c34c6ca422f09db204153c4294d

Contents?: true

Size: 1.28 KB

Versions: 62

Compression:

Stored size: 1.28 KB

Contents

module Workarea
  module Storefront
    module Checkout
      class ShippingController < CheckoutsController
        # GET /checkout/shipping
        def shipping
          @step ||= Storefront::Checkout::ShippingViewModel.new(
            shipping_step,
            view_model_options
          )
        end

        # PATCH /checkout/payment
        def update_shipping
          shipping_step.update(params)

          if request.xhr?
            updated_shipping_step_summary
          elsif shipping_step.complete?
            completed_shipping_step
          else
            incomplete_shipping_step
          end
        end

        private

        def shipping_step
          @shipping_step ||= Workarea::Checkout::Steps::Shipping.new(current_checkout)
        end

        def updated_shipping_step_summary
          Pricing.perform(current_order, current_shippings)

          shipping
          render :summary
        end

        def completed_shipping_step
          flash[:success] = t('workarea.storefront.flash_messages.shipping_options_saved')
          redirect_to checkout_payment_path
        end

        def incomplete_shipping_step
          Pricing.perform(current_order, current_shippings)

          shipping
          render :shipping
        end
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.5.15 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.36 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.14 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.35 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.13 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.34 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.12 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.33 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.11 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.10 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.32 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.9 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.31 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.8 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.30 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.7 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.29 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.6 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.28 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.5 app/controllers/workarea/storefront/checkout/shipping_controller.rb