solidus_api 2.9.6 → 2.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -2
  3. data/app/controllers/spree/api/addresses_controller.rb +2 -2
  4. data/app/controllers/spree/api/base_controller.rb +21 -13
  5. data/app/controllers/spree/api/checkouts_controller.rb +1 -11
  6. data/app/controllers/spree/api/countries_controller.rb +2 -2
  7. data/app/controllers/spree/api/credit_cards_controller.rb +3 -3
  8. data/app/controllers/spree/api/customer_returns_controller.rb +67 -0
  9. data/app/controllers/spree/api/images_controller.rb +5 -5
  10. data/app/controllers/spree/api/inventory_units_controller.rb +2 -2
  11. data/app/controllers/spree/api/option_types_controller.rb +4 -4
  12. data/app/controllers/spree/api/option_values_controller.rb +3 -3
  13. data/app/controllers/spree/api/orders_controller.rb +11 -6
  14. data/app/controllers/spree/api/payments_controller.rb +2 -2
  15. data/app/controllers/spree/api/product_properties_controller.rb +9 -14
  16. data/app/controllers/spree/api/promotions_controller.rb +3 -12
  17. data/app/controllers/spree/api/properties_controller.rb +4 -4
  18. data/app/controllers/spree/api/resource_controller.rb +3 -3
  19. data/app/controllers/spree/api/return_authorizations_controller.rb +4 -4
  20. data/app/controllers/spree/api/shipments_controller.rb +2 -2
  21. data/app/controllers/spree/api/states_controller.rb +3 -3
  22. data/app/controllers/spree/api/stock_items_controller.rb +3 -3
  23. data/app/controllers/spree/api/stock_locations_controller.rb +4 -4
  24. data/app/controllers/spree/api/stock_movements_controller.rb +3 -3
  25. data/app/controllers/spree/api/stores_controller.rb +4 -4
  26. data/app/controllers/spree/api/taxonomies_controller.rb +5 -3
  27. data/app/controllers/spree/api/taxons_controller.rb +5 -5
  28. data/app/controllers/spree/api/users_controller.rb +13 -0
  29. data/app/controllers/spree/api/variants_controller.rb +4 -4
  30. data/app/controllers/spree/api/zones_controller.rb +3 -3
  31. data/app/helpers/spree/api/api_helpers.rb +20 -7
  32. data/app/views/spree/api/customer_returns/index.json.jbuilder +6 -0
  33. data/app/views/spree/api/customer_returns/new.json.jbuilder +4 -0
  34. data/app/views/spree/api/customer_returns/show.json.jbuilder +3 -0
  35. data/app/views/spree/api/errors/could_not_transition.json.jbuilder +4 -0
  36. data/app/views/spree/api/images/_image.json.jbuilder +2 -2
  37. data/app/views/spree/api/orders/_order.json.jbuilder +1 -1
  38. data/app/views/spree/api/orders/could_not_transition.json.jbuilder +5 -0
  39. data/app/views/spree/api/shared/_pagination.json.jbuilder +1 -1
  40. data/config/locales/en.yml +2 -0
  41. data/config/routes.rb +6 -3
  42. data/lib/spree/api.rb +0 -7
  43. data/lib/spree/api/config.rb +9 -0
  44. data/lib/spree/api/engine.rb +4 -4
  45. data/lib/spree/api/responders.rb +3 -2
  46. data/lib/spree/api/responders/{rabl_template.rb → jbuilder_template.rb} +3 -1
  47. data/lib/spree/api/testing_support/helpers.rb +1 -1
  48. data/{app/models → lib}/spree/api_configuration.rb +0 -0
  49. data/openapi/.stoplight.yml +7 -0
  50. data/openapi/authentication.md +33 -0
  51. data/openapi/checkout-flow.md +63 -0
  52. data/openapi/errors.md +3 -0
  53. data/openapi/lint.yml +1 -0
  54. data/openapi/main.hub.yml +65 -0
  55. data/openapi/pagination.md +7 -0
  56. data/openapi/solidus-api.oas.yml +6753 -0
  57. data/openapi/theme.css +0 -0
  58. data/solidus_api.gemspec +19 -19
  59. metadata +27 -115
  60. data/script/rails +0 -10
  61. data/spec/controllers/spree/api/base_controller_spec.rb +0 -118
  62. data/spec/controllers/spree/api/resource_controller_spec.rb +0 -190
  63. data/spec/features/checkout_spec.rb +0 -192
  64. data/spec/fixtures/thinking-cat.jpg +0 -0
  65. data/spec/models/spree/legacy_user_spec.rb +0 -103
  66. data/spec/requests/api/address_books_spec.rb +0 -240
  67. data/spec/requests/rabl_cache_spec.rb +0 -34
  68. data/spec/requests/ransackable_attributes_spec.rb +0 -79
  69. data/spec/requests/spree/api/addresses_controller_spec.rb +0 -57
  70. data/spec/requests/spree/api/checkouts_controller_spec.rb +0 -484
  71. data/spec/requests/spree/api/classifications_controller_spec.rb +0 -50
  72. data/spec/requests/spree/api/config_controller_spec.rb +0 -26
  73. data/spec/requests/spree/api/countries_controller_spec.rb +0 -48
  74. data/spec/requests/spree/api/coupon_codes_controller_spec.rb +0 -105
  75. data/spec/requests/spree/api/credit_cards_controller_spec.rb +0 -105
  76. data/spec/requests/spree/api/images_controller_spec.rb +0 -99
  77. data/spec/requests/spree/api/inventory_units_controller_spec.rb +0 -55
  78. data/spec/requests/spree/api/line_items_controller_spec.rb +0 -213
  79. data/spec/requests/spree/api/option_types_controller_spec.rb +0 -116
  80. data/spec/requests/spree/api/option_values_controller_spec.rb +0 -138
  81. data/spec/requests/spree/api/orders_controller_spec.rb +0 -954
  82. data/spec/requests/spree/api/payments_controller_spec.rb +0 -259
  83. data/spec/requests/spree/api/product_properties_controller_spec.rb +0 -114
  84. data/spec/requests/spree/api/products_controller_spec.rb +0 -422
  85. data/spec/requests/spree/api/promotion_application_spec.rb +0 -50
  86. data/spec/requests/spree/api/promotions_controller_spec.rb +0 -67
  87. data/spec/requests/spree/api/properties_controller_spec.rb +0 -102
  88. data/spec/requests/spree/api/return_authorizations_controller_spec.rb +0 -180
  89. data/spec/requests/spree/api/shipments_controller_spec.rb +0 -532
  90. data/spec/requests/spree/api/states_controller_spec.rb +0 -69
  91. data/spec/requests/spree/api/stock_items_controller_spec.rb +0 -311
  92. data/spec/requests/spree/api/stock_locations_controller_spec.rb +0 -170
  93. data/spec/requests/spree/api/stock_movements_controller_spec.rb +0 -81
  94. data/spec/requests/spree/api/store_credit_events_controller_spec.rb +0 -59
  95. data/spec/requests/spree/api/stores_controller_spec.rb +0 -134
  96. data/spec/requests/spree/api/taxonomies_controller_spec.rb +0 -114
  97. data/spec/requests/spree/api/taxons_controller_spec.rb +0 -217
  98. data/spec/requests/spree/api/unauthenticated_products_controller_spec.rb +0 -27
  99. data/spec/requests/spree/api/users_controller_spec.rb +0 -151
  100. data/spec/requests/spree/api/variants_controller_spec.rb +0 -340
  101. data/spec/requests/spree/api/zones_controller_spec.rb +0 -89
  102. data/spec/shared_examples/protect_product_actions.rb +0 -18
  103. data/spec/spec_helper.rb +0 -73
  104. data/spec/support/be_paginated_matcher.rb +0 -9
  105. data/spec/support/controller_hacks.rb +0 -43
  106. data/spec/support/database_cleaner.rb +0 -16
  107. data/spec/support/have_attributes_matcher.rb +0 -11
  108. data/spec/test_views/spree/api/widgets/_widget.json.jbuilder +0 -3
  109. data/spec/test_views/spree/api/widgets/index.json.jbuilder +0 -9
  110. data/spec/test_views/spree/api/widgets/new.json.jbuilder +0 -3
  111. data/spec/test_views/spree/api/widgets/show.json.jbuilder +0 -3
@@ -43,7 +43,7 @@ module Spree
43
43
 
44
44
  def update
45
45
  @variant = scope.accessible_by(current_ability, :update).find(params[:id])
46
- if @variant.update_attributes(variant_params)
46
+ if @variant.update(variant_params)
47
47
  respond_with(@variant, status: 200, default_template: :show)
48
48
  else
49
49
  invalid_resource!(@product)
@@ -53,7 +53,7 @@ module Spree
53
53
  private
54
54
 
55
55
  def product
56
- @product ||= Spree::Product.accessible_by(current_ability, :read).friendly.find(params[:product_id]) if params[:product_id]
56
+ @product ||= Spree::Product.accessible_by(current_ability, :show).friendly.find(params[:product_id]) if params[:product_id]
57
57
  end
58
58
 
59
59
  def scope
@@ -64,12 +64,12 @@ module Spree
64
64
  end
65
65
 
66
66
  if current_ability.can?(:manage, Variant) && params[:show_deleted]
67
- variants = variants.with_deleted
67
+ variants = variants.with_discarded
68
68
  end
69
69
 
70
70
  in_stock_only = ActiveRecord::Type::Boolean.new.cast(params[:in_stock_only])
71
71
  suppliable_only = ActiveRecord::Type::Boolean.new.cast(params[:suppliable_only])
72
- variants = variants.accessible_by(current_ability, :read)
72
+ variants = variants.accessible_by(current_ability)
73
73
  if in_stock_only || cannot?(:view_out_of_stock, Spree::Variant)
74
74
  variants = variants.in_stock
75
75
  elsif suppliable_only
@@ -21,7 +21,7 @@ module Spree
21
21
 
22
22
  def index
23
23
  @zones = Spree::Zone.
24
- accessible_by(current_ability, :read).
24
+ accessible_by(current_ability).
25
25
  order('name ASC').
26
26
  ransack(params[:q]).
27
27
  result
@@ -37,7 +37,7 @@ module Spree
37
37
 
38
38
  def update
39
39
  authorize! :update, zone
40
- if zone.update_attributes(zone_params)
40
+ if zone.update(zone_params)
41
41
  respond_with(zone, status: 200, default_template: :show)
42
42
  else
43
43
  invalid_resource!(zone)
@@ -55,7 +55,7 @@ module Spree
55
55
  end
56
56
 
57
57
  def zone
58
- @zone ||= Spree::Zone.accessible_by(current_ability, :read).find(params[:id])
58
+ @zone ||= Spree::Zone.accessible_by(current_ability, :show).find(params[:id])
59
59
  end
60
60
  end
61
61
  end
@@ -22,6 +22,7 @@ module Spree
22
22
  :state_attributes,
23
23
  :adjustment_attributes,
24
24
  :inventory_unit_attributes,
25
+ :customer_return_attributes,
25
26
  :return_authorization_attributes,
26
27
  :creditcard_attributes,
27
28
  :payment_source_attributes,
@@ -40,7 +41,7 @@ module Spree
40
41
 
41
42
  def required_fields_for(model)
42
43
  required_fields = model._validators.select do |_field, validations|
43
- validations.any? { |v| v.is_a?(ActiveModel::Validations::PresenceValidator) }
44
+ validations.any? { |validation| validation.is_a?(ActiveModel::Validations::PresenceValidator) }
44
45
  end.map(&:first) # get fields that are invalid
45
46
  # Permalinks presence is validated, but are really automatically generated
46
47
  # Therefore we shouldn't tell API clients that they MUST send one through
@@ -117,16 +118,27 @@ module Spree
117
118
  :id, :state, :variant_id, :shipment_id
118
119
  ]
119
120
 
121
+ @@customer_return_attributes = [
122
+ :id, :number, :stock_location_id, :created_at, :updated_at
123
+ ]
124
+
120
125
  @@return_authorization_attributes = [
121
126
  :id, :number, :state, :order_id, :memo, :created_at, :updated_at
122
127
  ]
123
128
 
124
- @@address_attributes = [
125
- :id, :firstname, :lastname, :full_name, :address1, :address2, :city,
126
- :zipcode, :phone, :company, :alternative_phone, :country_id, :country_iso,
127
- :state_id, :state_name, :state_text
129
+ @@address_base_attributes = [
130
+ :id, :name, :address1, :address2, :city, :zipcode, :phone, :company,
131
+ :alternative_phone, :country_id, :country_iso, :state_id, :state_name,
132
+ :state_text
128
133
  ]
129
134
 
135
+ @@address_attributes = if Spree::Config.use_combined_first_and_last_name_in_address
136
+ @@address_base_attributes
137
+ else
138
+ @@address_base_attributes +
139
+ Spree::Address::LEGACY_NAME_ATTRS.map(&:to_sym)
140
+ end
141
+
130
142
  @@country_attributes = [:id, :iso_name, :iso, :iso3, :name, :numcode]
131
143
 
132
144
  @@state_attributes = [:id, :name, :abbr, :country_id]
@@ -168,7 +180,8 @@ module Spree
168
180
 
169
181
  @@store_attributes = [
170
182
  :id, :name, :url, :meta_description, :meta_keywords, :seo_title,
171
- :mail_from_address, :default_currency, :code, :default, :available_locales
183
+ :mail_from_address, :default_currency, :code, :default, :available_locales,
184
+ :bcc_email
172
185
  ]
173
186
 
174
187
  @@store_credit_history_attributes = [
@@ -177,7 +190,7 @@ module Spree
177
190
  ]
178
191
 
179
192
  def variant_attributes
180
- if @current_user_roles && @current_user_roles.include?("admin")
193
+ if @current_user_roles&.include?("admin")
181
194
  @@variant_attributes + [:cost_price]
182
195
  else
183
196
  @@variant_attributes
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ json.customer_returns(@customer_returns) do |customer_return|
4
+ json.(customer_return, *customer_return_attributes)
5
+ end
6
+ json.partial! 'spree/api/shared/pagination', pagination: @customer_returns
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ json.attributes([*customer_return_attributes])
4
+ json.required_attributes(required_fields_for(Spree::CustomerReturn))
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ json.(@customer_return, *customer_return_attributes)
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ json.error(I18n.t(:could_not_transition, scope: "spree.api", resource: resource.class.name.demodulize.underscore))
4
+ json.errors(resource.errors.to_hash)
@@ -2,6 +2,6 @@
2
2
 
3
3
  json.(image, *image_attributes)
4
4
  json.(image, :viewable_type, :viewable_id)
5
- Spree::Image.attachment_definitions[:attachment][:styles].each do |k, _v|
6
- json.set! "#{k}_url", image.attachment.url(k)
5
+ Spree::Image.attachment_definitions[:attachment][:styles].each do |key, _value|
6
+ json.set! "#{key}_url", image.attachment.url(key)
7
7
  end
@@ -3,7 +3,7 @@
3
3
  json.cache! [I18n.locale, order] do
4
4
  json.(order, *order_attributes)
5
5
  json.display_item_total(order.display_item_total.to_s)
6
- json.total_quantity(order.line_items.sum(:quantity))
6
+ json.total_quantity(order.line_items.to_a.sum(&:quantity))
7
7
  json.display_total(order.display_total.to_s)
8
8
  json.display_ship_total(order.display_ship_total)
9
9
  json.display_tax_total(order.display_tax_total)
@@ -1,4 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ Spree::Deprecation.warn(
4
+ 'spree/api/orders/could_not_transition is deprecated.' \
5
+ ' Please use spree/api/errors/could_not_transition'
6
+ )
7
+
3
8
  json.error(I18n.t(:could_not_transition, scope: "spree.api.order"))
4
9
  json.errors(@order.errors.to_hash)
@@ -4,4 +4,4 @@ json.count pagination.count
4
4
  json.total_count pagination.total_count
5
5
  json.current_page pagination.current_page
6
6
  json.pages pagination.total_pages
7
- json.per_page pagination.current_per_page
7
+ json.per_page pagination.limit_value
@@ -8,6 +8,8 @@ en:
8
8
  invalid_resource: Invalid resource. Please fix errors and try again.
9
9
  invalid_taxonomy_id: Invalid taxonomy id.
10
10
  must_specify_api_key: You must specify an API key.
11
+ could_not_transition: The %{resource} could not be transitioned. Please fix the
12
+ errors and try again.
11
13
  order:
12
14
  could_not_transition: The order could not be transitioned. Please fix the
13
15
  errors and try again.
@@ -3,9 +3,11 @@
3
3
  Spree::Core::Engine.routes.draw do
4
4
  namespace :admin do
5
5
  resources :users do
6
+ resource :api_key, controller: 'users/api_key', only: [:create, :destroy]
7
+
6
8
  member do
7
- put :generate_api_key
8
- put :clear_api_key
9
+ put :generate_api_key # Deprecated
10
+ put :clear_api_key # Deprecated
9
11
  end
10
12
  end
11
13
  end
@@ -38,6 +40,8 @@ Spree::Core::Engine.routes.draw do
38
40
  put :cancel
39
41
  end
40
42
  end
43
+
44
+ resources :customer_returns, except: :destroy
41
45
  end
42
46
 
43
47
  resources :checkouts, only: [:update], concerns: :order_routes do
@@ -57,7 +61,6 @@ Spree::Core::Engine.routes.draw do
57
61
  end
58
62
  resources :option_values
59
63
 
60
- resources :option_values, only: :index
61
64
  get '/orders/mine', to: 'orders#mine', as: 'my_orders'
62
65
  get "/orders/current", to: "orders#current", as: "current_order"
63
66
 
@@ -2,11 +2,4 @@
2
2
 
3
3
  require 'spree/core'
4
4
 
5
- require 'responders'
6
-
7
- module Spree
8
- module Api
9
- end
10
- end
11
-
12
5
  require 'spree/api/engine'
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spree/api_configuration'
4
+
5
+ module Spree
6
+ module Api
7
+ Config = Spree::ApiConfiguration.new
8
+ end
9
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rails/engine'
3
+ require 'spree/api/config'
4
4
 
5
5
  module Spree
6
6
  module Api
@@ -8,9 +8,9 @@ module Spree
8
8
  isolate_namespace Spree
9
9
  engine_name 'spree_api'
10
10
 
11
- initializer "spree.api.environment", before: :load_config_initializers do |_app|
12
- Spree::Api::Config = Spree::ApiConfiguration.new
13
- end
11
+ # Leave initializer empty for backwards-compatability. Other apps
12
+ # might still rely on this event.
13
+ initializer "spree.api.environment", before: :load_config_initializers do; end
14
14
  end
15
15
  end
16
16
  end
@@ -1,12 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'spree/api/responders/rabl_template'
3
+ require 'responders'
4
+ require 'spree/api/responders/jbuilder_template'
4
5
 
5
6
  module Spree
6
7
  module Api
7
8
  module Responders
8
9
  class AppResponder < ActionController::Responder
9
- include RablTemplate
10
+ include JbuilderTemplate
10
11
  end
11
12
  end
12
13
  end
@@ -3,7 +3,7 @@
3
3
  module Spree
4
4
  module Api
5
5
  module Responders
6
- module RablTemplate
6
+ module JbuilderTemplate
7
7
  def to_format
8
8
  if template
9
9
  render template, status: options[:status] || 200
@@ -16,6 +16,8 @@ module Spree
16
16
  options[:default_template]
17
17
  end
18
18
  end
19
+
20
+ RablTemplate = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('RablTemplate', 'JbuilderTemplate')
19
21
  end
20
22
  end
21
23
  end
@@ -38,7 +38,7 @@ module Spree
38
38
  end
39
39
 
40
40
  def upload_image(filename)
41
- fixture_file_upload(image(filename).path, 'image/jpg')
41
+ Rack::Test::UploadedFile.new(File.open(image(filename).path), 'image/jpg')
42
42
  end
43
43
  end
44
44
  end
@@ -0,0 +1,7 @@
1
+ stoplight: '1.0'
2
+ environments:
3
+ default:
4
+ host: 'http://todos.stoplight.io'
5
+ todosApiKey: 123
6
+ staging: {}
7
+ production: {}
@@ -0,0 +1,33 @@
1
+ # Authentication
2
+
3
+ The Solidus API provides two means of authentication: one is through your Solidus user's API key, while the other is through an order's guest token.
4
+
5
+ ### API key
6
+
7
+ You can use your API key to access all resources in the API. The API key must be passed in the `Authorization` header in the following form:
8
+
9
+ ```
10
+ Authorization: Bearer API_KEY
11
+ ```
12
+
13
+ As an admin, you can find your API token in the admin section under Users > Your e-email > API Access (at `admin/users/<user_id>/edit`)
14
+
15
+ Example:
16
+
17
+ ```
18
+ curl --header "Authorization: Bearer 1a6a9936ad150a2ee345c65331da7a3ccc2de" http://www.my-solidus-site.com/api/stores
19
+ ```
20
+
21
+ By default, API keys are only generated for admins, but you can easily customize Solidus to generate them for all users, which is useful for instance if you want users to be able to sign in and manage their profile via the API.
22
+
23
+ ### Order token
24
+
25
+ For allowing guests to manage their cart and place their order, you can use the order's guest token. This token is contained in the `guest_token` property of the order, and it allows you to perform certain checkout-related operations on the order such as managing line items, completing the checkout flow etc.
26
+
27
+ The order token must be passed in the `X-Spree-Order-Token` header in the following form:
28
+
29
+ ```
30
+ X-Spree-Order-Token: ORDER_TOKEN
31
+ ```
32
+
33
+ If you are already providing an API key, you don't need to also provide the order token (although you may do so).
@@ -0,0 +1,63 @@
1
+ # Checkout flow
2
+
3
+ Given the amount of endpoints at your disposal, it can be difficult to understand how to string the right API calls together to perform a full checkout flow. This document explains how to perform a full checkout flow.
4
+
5
+ ## 1. Create an order
6
+
7
+ The first step is to create an order via `POST /orders`. You should save the number of the order that is created as well as the guest token, in case you are not authenticating with an API key.
8
+
9
+ ## 2. Fill the cart
10
+
11
+ Once you have an order, you can begin filling your cart. Here are some endpoints you can use for that:
12
+
13
+ - `POST /checkouts/:order_number/line_items`
14
+ - `PATCH /checkouts/:order_number/line_items/:id`
15
+ - `DELETE /checkouts/:order_number/line_items/:id`
16
+ - `PUT /orders/:order_number/empty`
17
+
18
+ ## 3. (Optional) Apply a coupon code
19
+
20
+ You can also apply a coupon code on the order via `POST /orders/:order_number/coupon_codes`.
21
+
22
+ ## 4. Start the checkout flow
23
+
24
+ When you are ready to start the checkout flow, you can call `PUT /checkouts/:order_number/next` to transition the order from the `cart` to the `address` state.
25
+
26
+ ## 5. Enter billing and shipping addresses
27
+
28
+ To enter the billing and shipping addresses, use the `PATCH /checkouts/:order_number` endpoint.
29
+
30
+ The `checkouts#update` endpoint always advance the order to the next state. If the above request is successful, the order should now be in the `delivery` state.
31
+
32
+ ## 6. Select a shipping method
33
+
34
+ You can retrieve the available shipping methods, along with their rates, via `GET /orders/:order_number` or `GET /orders/current`. This allows you to let your user choose the shipping method they prefer.
35
+
36
+ When you want to select a shipping method, call `PUT /checkouts/:order_number`:
37
+
38
+ ```
39
+ {
40
+ "order": {
41
+ "shipments_attributes": {
42
+ "0": {
43
+ "selected_shipping_rate_id": :shipping_rate_id,
44
+ "id": :shipment_id
45
+ }
46
+ }
47
+ }
48
+ }
49
+ ```
50
+
51
+ If the above request is successful, the order should now be in the `payment` state.
52
+
53
+ ## 7. Enter payment details
54
+
55
+ To create a payment, call `POST /orders/:order_number/payments`.
56
+
57
+ Now call `PUT /checkouts/:order_number/next` to transition the order from the `payment` to the `confirm` state.
58
+
59
+ ## 8. Complete the order
60
+
61
+ At this point, you should show the user a summary of their cart and ask them to confirm they want to place the order.
62
+
63
+ When they confirm, call `PUT /checkouts/:order_number/complete` to complete the checkout flow and place the order!
@@ -0,0 +1,3 @@
1
+ # Errors
2
+
3
+ Error responses for each endpoint are documented. When interacting with an endpoint, make sure to handle all possible errors appropriately.
@@ -0,0 +1 @@
1
+ rules: {}
@@ -0,0 +1,65 @@
1
+ title: Solidus API
2
+ logo: 'https://next.stoplight.io/images/mark-light-bg.png'
3
+ header:
4
+ nav:
5
+ left: []
6
+ right: []
7
+ pages:
8
+ /:
9
+ title: Welcome
10
+ data:
11
+ blocks:
12
+ - type: text
13
+ data: >-
14
+ # Solidus API
15
+
16
+
17
+ Welcome! This is the documentation for the
18
+ [Solidus](https://solidus.io) REST API.
19
+
20
+
21
+ This documentation refers to a stock installation of Solidus.
22
+ However, every store may customize their API in any number of ways,
23
+ so make sure to ensure the store you are working with conforms to
24
+ this documentation or refer to the store's own documentation for
25
+ interacting with the API.
26
+
27
+
28
+ Endpoints are grouped by the logical resource they interact with.
29
+ Note that some of the endpoints are duplicated, since the same
30
+ resource may be accessed at the root level or as the child of
31
+ another resource (e.g. you may access all variants or the variants
32
+ that belong to a specific product).
33
+ - type: text
34
+ data: ''
35
+ children:
36
+ - title: Authentication
37
+ route:
38
+ path: /authentication
39
+ data:
40
+ $ref: ./authentication.md
41
+ - title: Pagination
42
+ route:
43
+ path: /pagination
44
+ data:
45
+ $ref: ./pagination.md
46
+ - title: Errors
47
+ route:
48
+ path: /errors
49
+ data:
50
+ $ref: ./errors.md
51
+ - title: Checkout Flow
52
+ route:
53
+ path: /checkout-flow
54
+ data:
55
+ $ref: ./checkout-flow.md
56
+ config:
57
+ sidebar:
58
+ token: ''
59
+ - title: API Reference
60
+ config:
61
+ includeDownloadLink: true
62
+ route:
63
+ path: /api-reference
64
+ data:
65
+ $ref: ./solidus-api.oas.yml