Sha256: dcebfc2b8a70ca1bad386fb92f520afd2270df19759bc1a2eeb3bff0270e4097

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

module Spree
  module Api
    module V2
      module Storefront
        class OrderStatusController < ::Spree::Api::V2::BaseController
          include Spree::Api::V2::Storefront::OrderConcern

          def show
            render_serialized_payload { serialize_resource(resource) }
          end

          private

          def resource
            resource = resource_finder.new(number: params[:number], token: order_token).execute.take
            raise ActiveRecord::RecordNotFound if resource.nil?

            resource
          end

          def serialize_resource(resource)
            resource_serializer.new(
              resource,
              include: resource_includes,
              sparse_fields: sparse_fields
            ).serializable_hash
          end

          def resource_finder
            Spree::Api::Dependencies.storefront_completed_order_finder.constantize
          end

          def resource_serializer
            Spree::Api::Dependencies.storefront_cart_serializer.constantize
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
spree_api-3.7.9 app/controllers/spree/api/v2/storefront/order_status_controller.rb
spree_api-3.7.8 app/controllers/spree/api/v2/storefront/order_status_controller.rb
spree_api-3.7.7 app/controllers/spree/api/v2/storefront/order_status_controller.rb
spree_api-3.7.6 app/controllers/spree/api/v2/storefront/order_status_controller.rb
spree_api-3.7.5 app/controllers/spree/api/v2/storefront/order_status_controller.rb
spree_api-3.7.4 app/controllers/spree/api/v2/storefront/order_status_controller.rb
spree_api-3.7.3 app/controllers/spree/api/v2/storefront/order_status_controller.rb
spree_api-3.7.2 app/controllers/spree/api/v2/storefront/order_status_controller.rb
spree_api-3.7.1 app/controllers/spree/api/v2/storefront/order_status_controller.rb
spree_api-3.7.0 app/controllers/spree/api/v2/storefront/order_status_controller.rb