Class: Spree::Api::Chatrace::OrdersController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/chatrace/orders_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#validate_token_client

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/spree/api/chatrace/orders_controller.rb', line 7

def create
  guest_token = SecureRandom.uuid

  SpreeCmCommissioner::ChatraceOrderCreatorJob.perform_later(
    guest_token: guest_token,
    chatrace_user_id: params[:chatrace_user_id],
    chatrace_api_host: params[:chatrace_api_host],
    chatrace_return_flow_id: params[:chatrace_return_flow_id],
    chatrace_access_token: params[:chatrace_access_token],
    order_params: params.permit(
      :order_email,
      :order_phone_number,
      :variant_id,
      *SpreeCmCommissioner::Guest.csv_importable_columns
    )
  )

  render_serialized_payload do
    { queue_guest_token: guest_token }
  end
end