Class: Workarea::Storefront::OrdersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/workarea/storefront/orders_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_layout, #current_user_info, #health_check, #layout_content

Methods included from OrderLookup

#lookup_order, #lookup_order=

Methods included from CurrentCheckout

#clear_current_order, #completed_order, #completed_order=, #current_checkout, #current_order, #current_order=, #current_shipping, #current_shippings, #logout

Instance Method Details

#indexObject



3
4
5
# File 'app/controllers/workarea/storefront/orders_controller.rb', line 3

def index
  redirect_to users_orders_path if logged_in?
end

#lookupObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/workarea/storefront/orders_controller.rb', line 7

def lookup
  @payment = Payment.lookup(params[:order_id], params[:postal_code])

  if @payment
    self.lookup_order = Order.find(@payment.id)
    redirect_to order_path(lookup_order)
  else
    self.lookup_order = nil
    flash[:error] = t('workarea.storefront.flash_messages.no_matching_order')
    redirect_to check_orders_path
  end
end

#showObject



20
21
22
23
24
25
26
27
# File 'app/controllers/workarea/storefront/orders_controller.rb', line 20

def show
  if lookup_order.try(:id).to_s.downcase != params[:id].to_s.downcase
    flash[:error] = t('workarea.storefront.flash_messages.no_matching_order')
    redirect_to check_orders_path
  end

  @order = Storefront::OrderViewModel.wrap(lookup_order, view_model_options)
end