Class: SolidusGraphqlApi::Mutations::Checkout::CreateOrder

Inherits:
BaseMutation
  • Object
show all
Defined in:
lib/solidus_graphql_api/mutations/checkout/create_order.rb

Instance Method Summary collapse

Instance Method Details

#ready?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/solidus_graphql_api/mutations/checkout/create_order.rb', line 21

def ready?(*)
  current_ability.authorize!(:create, Spree::Order)
end

#resolveObject



12
13
14
15
16
17
18
19
# File 'lib/solidus_graphql_api/mutations/checkout/create_order.rb', line 12

def resolve
  order = Spree::Order.create!(user: current_user, store: current_store)

  {
    order: order,
    errors: user_errors("order", order.errors)
  }
end