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.27 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.26 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.45 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.25 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.23 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.44 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.22 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.43 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.21 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.42 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.20 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.41 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.19 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.40 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.18 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.39 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.17 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.38 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.5.16 app/controllers/workarea/storefront/checkout/shipping_controller.rb
workarea-storefront-3.4.37 app/controllers/workarea/storefront/checkout/shipping_controller.rb