Class: Checkout::ThankYouController

Inherits:
CheckoutController
  • Object
show all
Defined in:
app/controllers/gemgento/checkout/thank_you_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/gemgento/checkout/thank_you_controller.rb', line 11

def show
  @order = @quote.order

  # load the new order from the quote or fetch from Magento if it's not present.
  if @order.nil? && !session[:order_increment_id].nil?
    begin
      @order = Gemgento::OrderAdapter.find(session[:order_increment_id]).import
    rescue Exception
      if (retries ||= 0) <= 1
        retries += 1
        retry
      end
    end
  end

  session.delete :order_increment_id

  # create a new quote
  session.delete :quote
  @current_quote = Gemgento::Quote.current(current_store, nil, current_user)

  respond_with @order
end