Class: Kms::Public::CheckoutController

Inherits:
ActionController::Base
  • Object
show all
Includes:
CurrentCart
Defined in:
app/controllers/kms/public/checkout_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
# File 'app/controllers/kms/public/checkout_controller.rb', line 7

def create
  cart_finalizer = Kms::CartFinalizer.new(current_cart, customer_params)
  if order = cart_finalizer.finalize
    session[:cart_id] = nil
    render json: order, root: false
  else
    render json: {errors: order || {}}.to_json, status: :unprocessable_entity
  end
end