Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Platform API - Orders endpoints

Damian Legawieca5046c483e24
diff --git a/api/app/controllers/concerns/spree/api/v2/coupon_codes_helper.rb b/api/app/controllers/concerns/spree/api/v2/coupon_codes_helper.rb
new file mode 100644
index 0000000000..1bf9e1ed29
--- /dev/null
+++ b/api/app/controllers/concerns/spree/api/v2/coupon_codes_helper.rb
@@ -0,0 +1,29 @@
+module Spree
+ module Api
+ module V2
+ module CouponCodesHelper
+ def select_coupon_codes
+ params[:coupon_code].present? ? [params[:coupon_code]] : check_coupon_codes
+ end
+
+ def check_coupon_codes
+ spree_current_order.promotions.coupons.map(&:code)
+ end
+
+ def select_error(coupon_codes)
+ result = coupon_handler.new(spree_current_order).remove(coupon_codes.first)
+ result.error
+ end
+
+ def select_errors(coupon_codes)
+ results = []
+ coupon_codes.each do |coupon_code|
+ results << coupon_handler.new(spree_current_order).remove(coupon_code)
+ end
+
+ results.select(&:error)
+ end
+ end
+ end
+ end
+end
diff --git a/api/app/controllers/spree/api/v2/platform/orders_controller.rb b/api/app/controllers/spree/api/v2/platform/orders_controller.rb
new file mode 100644
index 0000000000..b850b17f53
--- /dev/null
+++ b/api/app/controllers/spree/api/v2/platform/orders_controller.rb
@@ -0,0 +1,175 @@
+module Spree
+ module Api
+ module V2
+ module Platform
+ class OrdersController < ResourceController
+ WRITE_ACTIONS.push(:add_store_credit, :remove_store_credit, :apply_coupon_code, :remove_coupon_code, :next, :advance, :complete, :empty)
+
+ include CouponCodesHelper
+
+ def update
+ result = update_service.call(
+ order: resource,
+ params: params,
+ permitted_attributes: spree_permitted_attributes,
+ request_env: request.headers.env
+ )
+
+ render_order(result)
+ end
+
+ def next
+ result = next_service.call(order: resource)
+
+ render_order(result)
+ end
+
+ def advance
+ result = advance_service.call(order: resource)
+
+ render_order(result)
+ end
+
+ def complete
+ result = complete_service.call(order: resource)
+
+ render_order(result)
+ end
+
+ def empty
+ result = empty_order_service.call(order: resource)
+
+ render_order(result)
+ end
+
+ def destroy
+ result = destroy_order_service.call(order: resource)
+
+ if result.success?
+ head 204
+ else
+ render_error_payload(result.error)
+ end
+ end
+
+ def apply_coupon_code
+ resource.coupon_code = params[:coupon_code]
+ result = coupon_handler.new(resource).apply
+
+ render_order(result)
+ end
+
+ def remove_coupon_code
+ coupon_codes = select_coupon_codes
+
+ return render_error_payload(Spree.t('v2.cart.no_coupon_code', scope: 'api')) if coupon_codes.empty?
+
+ result_errors = coupon_codes.count > 1 ? select_errors(coupon_codes) : select_error(coupon_codes)
+
+ if result_errors.blank?
+ render_serialized_payload { resource }
+ else
+ render_error_payload(result_errors)
+ end
+ end
+
+ def add_store_credit
+ result = add_store_credit_service.call(
+ order: resource,
+ amount: params[:amount].try(:to_f)
+ )
+
+ render_order(result)
+ end
+
+ def remove_store_credit
+ result = remove_store_credit_service.call(order: resource)
+ render_order(result)
+ end
+
+ private
+
+ def model_class
+ Spree::Order
+ end
+
+ def resource
+ @resource ||= scope.find_by(number: params[:id]) || scope.find(params[:id])
+ end
+
+ def allowed_sort_attributes
+ super.push(:available_on, :total, :payment_total, :item_total, :shipment_total,
+ :adjustment_total, :promo_total, :included_tax_total, :additional_tax_total,
+ :item_count, :tax_total, :completed_at)
+ end
+
+ def authorize_spree_user
+ return if spree_current_user.nil?
+
+ if action_name == 'create'
+ spree_authorize! :create, model_class
+ elsif %w[next cancel complete empty advance add_store_credit remove_store_credit].include?(action_name)
+ spree_authorize! :update, resource
+ else
+ spree_authorize! action_name, resource
+ end
+ end
+
+ def render_order(result)
+ if result.success?
+ render_serialized_payload { serialize_resource(resource) }
+ else
+ render_error_payload(result.error)
+ end
+ end
+
+ def update_service
+ Spree::Api::Dependencies.platform_order_update_service.constantize
+ end
+
+ def next_service
+ Spree::Api::Dependencies.platform_order_next_service.constantize
+ end
+
+ def advance_service
+ Spree::Api::Dependencies.platform_order_advance_service.constantize
+ end
+
+ def add_store_credit_service
+ Spree::Api::Dependencies.platform_order_add_store_credit_service.constantize
+ end
+
+ def remove_store_credit_service
+ Spree::Api::Dependencies.platform_order_remove_store_credit_service.constantize
+ end
+
+ def complete_service
+ Spree::Api::Dependencies.platform_order_complete_service.constantize
+ end
+
+ def empty_order_service
+ Spree::Api::Dependencies.platform_order_empty_service.constantize
+ end
+
+ def destroy_order_service
+ Spree::Api::Dependencies.platform_order_destroy_service.constantize
+ end
+
+ def coupon_handler
+ Spree::Api::Dependencies.platform_coupon_handler.constantize
+ end
+
+ def spree_permitted_attributes
+ Spree::Order.json_api_permitted_attributes + [
+ bill_address_attributes: Spree::Address.json_api_permitted_attributes,
+ ship_address_attributes: Spree::Address.json_api_permitted_attributes,
+ line_items_attributes: Spree::LineItem.json_api_permitted_attributes,
+ payments_attributes: Spree::Payment.json_api_permitted_attributes,
+ shipments_attributes: Spree::Shipment.json_api_permitted_attributes
+ ]
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/api/app/controllers/spree/api/v2/platform/resource_controller.rb b/api/app/controllers/spree/api/v2/platform/resource_controller.rb
index 17798fcc96..20d7ffc09a 100644
--- a/api/app/controllers/spree/api/v2/platform/resource_controller.rb
+++ b/api/app/controllers/spree/api/v2/platform/resource_controller.rb
@@ -7,11 +7,11 @@ module Spree
WRITE_ACTIONS = %i[create update destroy]
# doorkeeper scopes usage: https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes
- before_action -> { doorkeeper_authorize! :read, :admin }, only: READ_ACTIONS
- before_action -> { doorkeeper_authorize! :write, :admin }, only: WRITE_ACTIONS
+ before_action -> { doorkeeper_authorize! :read, :admin }, if: -> { READ_ACTIONS.include?(action_name.to_sym) }
+ before_action -> { doorkeeper_authorize! :write, :admin }, if: -> { WRITE_ACTIONS.include?(action_name.to_sym) }
# optional authorization if using a user token instead of app token
- before_action :authorize_spree_user, only: WRITE_ACTIONS
+ before_action :authorize_spree_user, if: -> { WRITE_ACTIONS.include?(action_name.to_sym) }
# index and show acrtions are defined in Spree::Api::V2::ResourceController
diff --git a/api/app/controllers/spree/api/v2/resource_controller.rb b/api/app/controllers/spree/api/v2/resource_controller.rb
index c9661e7360..bf512187e8 100644
--- a/api/app/controllers/spree/api/v2/resource_controller.rb
+++ b/api/app/controllers/spree/api/v2/resource_controller.rb
@@ -28,7 +28,7 @@ module Spree
end
def default_sort_atributes
- [:id, :name, :number, :position, :updated_at, :created_at]
+ [:id, :name, :slug, :number, :position, :updated_at, :created_at, :deleted_at]
end
def scope(skip_cancancan: false)
diff --git a/api/app/controllers/spree/api/v2/storefront/cart_controller.rb b/api/app/controllers/spree/api/v2/storefront/cart_controller.rb
index f795da3f9f..b237bd6ef6 100644
--- a/api/app/controllers/spree/api/v2/storefront/cart_controller.rb
+++ b/api/app/controllers/spree/api/v2/storefront/cart_controller.rb
@@ -3,7 +3,9 @@ module Spree
module V2
module Storefront
class CartController < ::Spree::Api::V2::BaseController
- include Spree::Api::V2::Storefront::OrderConcern
+ include OrderConcern
+ include CouponCodesHelper
+
before_action :ensure_order, except: %i[create associate]
before_action :load_variant, only: :add_item
before_action :require_spree_current_user, only: :associate
@@ -226,28 +228,6 @@ module Spree
params: serializer_params
).serializable_hash
end
-
- def select_coupon_codes
- params[:coupon_code].present? ? [params[:coupon_code]] : check_coupon_codes
- end
-
- def check_coupon_codes
- spree_current_order.promotions.coupons.map(&:code)
- end
-
- def select_error(coupon_codes)
- result = coupon_handler.new(spree_current_order).remove(coupon_codes.first)
- result.error
- end
-
- def select_errors(coupon_codes)
- results = []
- coupon_codes.each do |coupon_code|
- results << coupon_handler.new(spree_current_order).remove(coupon_code)
- end
-
- results.select(&:error)
- end
end
end
end
diff --git a/api/app/models/spree/api_dependencies.rb b/api/app/models/spree/api_dependencies.rb
index 799ed57cee..0d0bf3adb6 100644
--- a/api/app/models/spree/api_dependencies.rb
+++ b/api/app/models/spree/api_dependencies.rb
@@ -22,7 +22,10 @@ module Spree
:storefront_cart_empty_service, :storefront_cart_destroy_service, :storefront_credit_cards_destroy_service, :platform_products_sorter,
:storefront_cart_change_currency_service,
- :platform_admin_user_serializer
+ :platform_admin_user_serializer, :platform_coupon_handler, :platform_order_update_service,
+ :platform_order_add_store_credit_service, :platform_order_remove_store_credit_service,
+ :platform_order_complete_service, :platform_order_empty_service, :platform_order_destroy_service,
+ :platform_order_next_service, :platform_order_advance_service
].freeze
attr_accessor *INJECTION_POINTS
@@ -112,7 +115,21 @@ module Spree
end
def set_platform_defaults
+ # serializers
@platform_admin_user_serializer = 'Spree::Api::V2::Platform::UserSerializer'
+
+ # coupon code handler
+ @platform_coupon_handler = Spree::Dependencies.coupon_handler
+
+ # order services
+ @platform_order_update_service = Spree::Dependencies.checkout_update_service
+ @platform_order_empty_service = Spree::Dependencies.cart_empty_service
+ @platform_order_destroy_service = Spree::Dependencies.cart_destroy_service
+ @platform_order_next_service = Spree::Dependencies.checkout_next_service
+ @platform_order_advance_service = Spree::Dependencies.checkout_advance_service
+ @platform_order_complete_service = Spree::Dependencies.checkout_complete_service
+ @platform_order_add_store_credit_service = Spree::Dependencies.checkout_add_store_credit_service
+ @platform_order_remove_store_credit_service = Spree::Dependencies.checkout_remove_store_credit_service
end
end
end
diff --git a/api/app/serializers/spree/api/v2/platform/order_serializer.rb b/api/app/serializers/spree/api/v2/platform/order_serializer.rb
index bebe3adf68..5fa38ae4ad 100644
--- a/api/app/serializers/spree/api/v2/platform/order_serializer.rb
+++ b/api/app/serializers/spree/api/v2/platform/order_serializer.rb
@@ -19,7 +19,9 @@ module Spree
has_many :state_changes
has_many :return_authorizations
+ has_many :reimbursements
has_many :adjustments
+ has_many :all_adjustments, serializer: :adjustments, type: :adjustment
has_many :order_promotions
end
diff --git a/api/config/routes.rb b/api/config/routes.rb
index e0232d818e..ccc8d22fa7 100644
--- a/api/config/routes.rb
+++ b/api/config/routes.rb
@@ -219,8 +219,11 @@ Spree::Core::Engine.add_routes do
put :approve
put :cancel
put :empty
- put :apply_coupon_code
- put :remove_coupon_code
+ patch :apply_coupon_code
+ # delete 'remove_coupon_code/:coupon_code'
+ put :complete
+ post :add_store_credit
+ post :remove_store_credit
end
end
resources :line_items
diff --git a/api/docs/v2/platform/index.yaml b/api/docs/v2/platform/index.yaml
index 09c53447e5..e3cf91bc3c 100644
--- a/api/docs/v2/platform/index.yaml
+++ b/api/docs/v2/platform/index.yaml
@@ -63,8 +63,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-09-27T22:41:57.860Z'
- updated_at: '2021-09-27T22:41:57.860Z'
+ created_at: '2021-10-03T17:50:23.680Z'
+ updated_at: '2021-10-03T17:50:23.680Z'
deleted_at:
label:
relationships:
@@ -91,8 +91,8 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-09-27T22:41:57.862Z'
- updated_at: '2021-09-27T22:41:57.862Z'
+ created_at: '2021-10-03T17:50:23.686Z'
+ updated_at: '2021-10-03T17:50:23.686Z'
deleted_at:
label:
relationships:
@@ -149,7 +149,7 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '5'
type: address
attributes:
firstname: John
@@ -162,18 +162,18 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-09-27T22:41:57.976Z'
- updated_at: '2021-09-27T22:41:57.976Z'
+ created_at: '2021-10-03T17:50:23.939Z'
+ updated_at: '2021-10-03T17:50:23.939Z'
deleted_at:
label:
relationships:
country:
data:
- id: '2'
+ id: '4'
type: country
state:
data:
- id: '1'
+ id: '5'
type: state
user:
data:
@@ -240,7 +240,7 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '6'
type: address
attributes:
firstname: John
@@ -253,18 +253,18 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-09-27T22:41:57.997Z'
- updated_at: '2021-09-27T22:41:57.997Z'
+ created_at: '2021-10-03T17:50:23.990Z'
+ updated_at: '2021-10-03T17:50:23.990Z'
deleted_at:
label:
relationships:
country:
data:
- id: '1'
+ id: '6'
type: country
state:
data:
- id: '1'
+ id: '6'
type: state
user:
data:
@@ -314,7 +314,7 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '8'
type: address
attributes:
firstname: Jack
@@ -327,18 +327,18 @@ paths:
state_name:
alternative_phone: 555-555-0199
company: Company
- created_at: '2021-09-27T22:41:58.028Z'
- updated_at: '2021-09-27T22:41:58.033Z'
+ created_at: '2021-10-03T17:50:24.066Z'
+ updated_at: '2021-10-03T17:50:24.078Z'
deleted_at:
label:
relationships:
country:
data:
- id: '1'
+ id: '9'
type: country
state:
data:
- id: '1'
+ id: '8'
type: state
user:
data:
@@ -455,8 +455,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-09-27T22:41:58.287Z'
- updated_at: '2021-09-27T22:41:58.287Z'
+ created_at: '2021-10-03T17:50:24.644Z'
+ updated_at: '2021-10-03T17:50:24.644Z'
relationships:
product:
data:
@@ -470,8 +470,8 @@ paths:
type: classification
attributes:
position: 1
- created_at: '2021-09-27T22:41:58.356Z'
- updated_at: '2021-09-27T22:41:58.356Z'
+ created_at: '2021-10-03T17:50:24.821Z'
+ updated_at: '2021-10-03T17:50:24.821Z'
relationships:
product:
data:
@@ -524,20 +524,20 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '5'
type: classification
attributes:
position: 1
- created_at: '2021-09-27T22:41:58.641Z'
- updated_at: '2021-09-27T22:41:58.641Z'
+ created_at: '2021-10-03T17:50:25.468Z'
+ updated_at: '2021-10-03T17:50:25.468Z'
relationships:
product:
data:
- id: '1'
+ id: '5'
type: product
taxon:
data:
- id: '2'
+ id: '10'
type: taxon
'422':
description: invalid request
@@ -588,20 +588,20 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '6'
type: classification
attributes:
position: 1
- created_at: '2021-09-27T22:41:58.746Z'
- updated_at: '2021-09-27T22:41:58.746Z'
+ created_at: '2021-10-03T17:50:25.718Z'
+ updated_at: '2021-10-03T17:50:25.718Z'
relationships:
product:
data:
- id: '1'
+ id: '6'
type: product
taxon:
data:
- id: '2'
+ id: '12'
type: taxon
'404':
description: Record not found
@@ -649,20 +649,20 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '8'
type: classification
attributes:
position: 1
- created_at: '2021-09-27T22:41:58.964Z'
- updated_at: '2021-09-27T22:41:58.964Z'
+ created_at: '2021-10-03T17:50:26.171Z'
+ updated_at: '2021-10-03T17:50:26.171Z'
relationships:
product:
data:
- id: '1'
+ id: '8'
type: product
taxon:
data:
- id: '2'
+ id: '16'
type: taxon
'422':
description: invalid request
@@ -760,20 +760,20 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '13'
type: classification
attributes:
position: 2
- created_at: '2021-09-27T22:41:59.461Z'
- updated_at: '2021-09-27T22:41:59.472Z'
+ created_at: '2021-10-03T17:50:27.326Z'
+ updated_at: '2021-10-03T17:50:27.354Z'
relationships:
product:
data:
- id: '1'
+ id: '13'
type: product
taxon:
data:
- id: '2'
+ id: '26'
type: taxon
'422':
description: invalid request
@@ -850,34 +850,35 @@ paths:
- id: '1'
type: cms_page
attributes:
- title: Quae illum sed aut aliquam nulla enim.
+ title: Nam excepturi amet numquam temporibus voluptatem rerum.
meta_title:
content:
meta_description:
visible: true
- slug: quae-illum-sed-aut-aliquam-nulla-enim
+ slug: nam-excepturi-amet-numquam-temporibus-voluptatem-rerum
type: Spree::Cms::Pages::StandardPage
locale: en
deleted_at:
- created_at: '2021-09-27T22:41:59.683Z'
- updated_at: '2021-09-27T22:41:59.683Z'
+ created_at: '2021-10-03T17:50:27.838Z'
+ updated_at: '2021-10-03T17:50:27.838Z'
relationships:
cms_sections:
data: []
- id: '2'
type: cms_page
attributes:
- title: Unde a reprehenderit ad similique recusandae quos laboriosam.
+ title: Tenetur similique totam mollitia doloremque placeat
+ dolorum unde accusantium.
meta_title:
content:
meta_description:
visible: true
- slug: unde-a-reprehenderit-ad-similique-recusandae-quos-laboriosam
+ slug: tenetur-similique-totam-mollitia-doloremque-placeat-dolorum-unde-accusantium
type: Spree::Cms::Pages::StandardPage
locale: en
deleted_at:
- created_at: '2021-09-27T22:41:59.686Z'
- updated_at: '2021-09-27T22:41:59.686Z'
+ created_at: '2021-10-03T17:50:27.843Z'
+ updated_at: '2021-10-03T17:50:27.843Z'
relationships:
cms_sections:
data: []
@@ -924,21 +925,20 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '5'
type: cms_page
attributes:
- title: Exercitationem fugit architecto aspernatur consectetur
- voluptatem perferendis.
+ title: Cupiditate ducimus voluptatem labore magni neque explicabo.
meta_title:
content:
meta_description:
visible: true
- slug: exercitationem-fugit-architecto-aspernatur-consectetur-voluptatem-perferendis
- type:
+ slug: cupiditate-ducimus-voluptatem-labore-magni-neque-explicabo
+ type: Spree::Cms::Pages::StandardPage
locale: en
deleted_at:
- created_at: '2021-09-27T22:41:59.728Z'
- updated_at: '2021-09-27T22:41:59.728Z'
+ created_at: '2021-10-03T17:50:27.951Z'
+ updated_at: '2021-10-03T17:50:27.951Z'
relationships:
cms_sections:
data: []
@@ -991,21 +991,20 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '6'
type: cms_page
attributes:
- title: Magni earum enim deleniti architecto inventore illo
- perferendis.
+ title: Ex harum quia inventore hic nobis maxime.
meta_title:
content:
meta_description:
visible: true
- slug: magni-earum-enim-deleniti-architecto-inventore-illo-perferendis
+ slug: ex-harum-quia-inventore-hic-nobis-maxime
type: Spree::Cms::Pages::StandardPage
locale: en
deleted_at:
- created_at: '2021-09-27T22:41:59.753Z'
- updated_at: '2021-09-27T22:41:59.753Z'
+ created_at: '2021-10-03T17:50:27.999Z'
+ updated_at: '2021-10-03T17:50:27.999Z'
relationships:
cms_sections:
data: []
@@ -1055,7 +1054,7 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '8'
type: cms_page
attributes:
title: My Super Page
@@ -1063,12 +1062,12 @@ paths:
content:
meta_description:
visible: true
- slug: ipsam-magnam-laboriosam-id-architecto
+ slug: repellendus-dolorem-autem-nisi-nihil-voluptate-deserunt-laudantium
type: Spree::Cms::Pages::StandardPage
locale: en
deleted_at:
- created_at: '2021-09-27T22:41:59.795Z'
- updated_at: '2021-09-27T22:41:59.801Z'
+ created_at: '2021-10-03T17:50:28.090Z'
+ updated_at: '2021-10-03T17:50:28.104Z'
relationships:
cms_sections:
data: []
@@ -1182,7 +1181,7 @@ paths:
- id: '1'
type: cms_section
attributes:
- name: Neque excepturi minima consequuntur vero eligendi.
+ name: Assumenda illo non rem et ducimus molestiae.
content: {}
settings:
gutters: No Gutters
@@ -1191,19 +1190,20 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 1
linked_resource_type: Spree::Taxon
- created_at: '2021-09-27T22:41:59.900Z'
- updated_at: '2021-09-27T22:41:59.900Z'
+ created_at: '2021-10-03T17:50:28.323Z'
+ updated_at: '2021-10-03T17:50:28.323Z'
relationships:
cms_page:
data:
- id: '1'
+ id: '13'
type: cms_page
linked_resource:
data:
- id: '2'
type: cms_section
attributes:
- name: Qui voluptate nesciunt animi nemo similique numquam.
+ name: Ducimus molestias illo asperiores explicabo aliquid
+ tempora repellendus.
content:
link_type_one: Spree::Taxon
link_type_two: Spree::Taxon
@@ -1215,20 +1215,19 @@ paths:
type: Spree::Cms::Sections::ImageGallery
position: 2
linked_resource_type:
- created_at: '2021-09-27T22:41:59.902Z'
- updated_at: '2021-09-27T22:41:59.902Z'
+ created_at: '2021-10-03T17:50:28.327Z'
+ updated_at: '2021-10-03T17:50:28.327Z'
relationships:
cms_page:
data:
- id: '1'
+ id: '13'
type: cms_page
linked_resource:
data:
- id: '3'
type: cms_section
attributes:
- name: Quibusdam voluptas consequuntur fugiat iste doloribus
- quidem ab facilis.
+ name: Autem cum nisi deleniti iste facilis reprehenderit voluptatum.
content: {}
settings:
gutters: No Gutters
@@ -1237,19 +1236,19 @@ paths:
type: Spree::Cms::Sections::FeaturedArticle
position: 3
linked_resource_type: Spree::Taxon
- created_at: '2021-09-27T22:41:59.909Z'
- updated_at: '2021-09-27T22:41:59.909Z'
+ created_at: '2021-10-03T17:50:28.339Z'
+ updated_at: '2021-10-03T17:50:28.339Z'
relationships:
cms_page:
data:
- id: '1'
+ id: '13'
type: cms_page
linked_resource:
data:
- id: '4'
type: cms_section
attributes:
- name: Rerum occaecati blanditiis quia hic laborum natus.
+ name: Aliquid hic est nulla repellat.
content: {}
settings:
gutters: No Gutters
@@ -1258,21 +1257,21 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 4
linked_resource_type: Spree::Product
- created_at: '2021-09-27T22:41:59.915Z'
- updated_at: '2021-09-27T22:41:59.915Z'
+ created_at: '2021-10-03T17:50:28.350Z'
+ updated_at: '2021-10-03T17:50:28.350Z'
relationships:
cms_page:
data:
- id: '1'
+ id: '13'
type: cms_page
linked_resource:
data:
- id: '1'
+ id: '16'
type: product
- id: '5'
type: cms_section
attributes:
- name: Cumque expedita repellendus occaecati ex magni.
+ name: Enim quidem mollitia assumenda sunt tempore ipsum temporibus.
content: {}
settings:
gutters: No Gutters
@@ -1281,16 +1280,16 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 5
linked_resource_type: Spree::Product
- created_at: '2021-09-27T22:41:59.920Z'
- updated_at: '2021-09-27T22:41:59.920Z'
+ created_at: '2021-10-03T17:50:28.361Z'
+ updated_at: '2021-10-03T17:50:28.361Z'
relationships:
cms_page:
data:
- id: '1'
+ id: '13'
type: cms_page
linked_resource:
data:
- id: '1'
+ id: '16'
type: product
meta:
count: 5
@@ -1335,27 +1334,29 @@ paths:
Example:
value:
data:
- id: '4'
+ id: '14'
type: cms_section
attributes:
- name: Illo ipsam officia magni molestiae doloribus culpa at
- eligendi.
- content:
+ name: Deserunt non voluptatem quod quae optio odit.
+ content: {}
settings:
- fit:
+ gutters: No Gutters
+ fit: Screen
destination:
- type:
+ type: Spree::Cms::Sections::HeroImage
position: 4
- linked_resource_type:
- created_at: '2021-09-27T22:42:00.021Z'
- updated_at: '2021-09-27T22:42:00.021Z'
+ linked_resource_type: Spree::Product
+ created_at: '2021-10-03T17:50:28.610Z'
+ updated_at: '2021-10-03T17:50:28.610Z'
relationships:
cms_page:
data:
- id: '1'
+ id: '15'
type: cms_page
linked_resource:
data:
+ id: '18'
+ type: product
'422':
description: invalid request
content:
@@ -1405,10 +1406,11 @@ paths:
Example:
value:
data:
- id: '4'
+ id: '21'
type: cms_section
attributes:
- name: Labore commodi minima eos officiis ea.
+ name: Ut iure at exercitationem quam officia molestias tenetur
+ aperiam.
content: {}
settings:
gutters: No Gutters
@@ -1417,16 +1419,16 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 4
linked_resource_type: Spree::Product
- created_at: '2021-09-27T22:42:00.096Z'
- updated_at: '2021-09-27T22:42:00.096Z'
+ created_at: '2021-10-03T17:50:28.778Z'
+ updated_at: '2021-10-03T17:50:28.778Z'
relationships:
cms_page:
data:
- id: '1'
+ id: '17'
type: cms_page
linked_resource:
data:
- id: '1'
+ id: '20'
type: product
'404':
description: Record not found
@@ -1474,7 +1476,7 @@ paths:
Example:
value:
data:
- id: '4'
+ id: '32'
type: cms_section
attributes:
name: Super Hero
@@ -1486,16 +1488,16 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 4
linked_resource_type: Spree::Product
- created_at: '2021-09-27T22:42:00.215Z'
- updated_at: '2021-09-27T22:42:00.222Z'
+ created_at: '2021-10-03T17:50:29.200Z'
+ updated_at: '2021-10-03T17:50:29.216Z'
relationships:
cms_page:
data:
- id: '1'
+ id: '20'
type: cms_page
linked_resource:
data:
- id: '1'
+ id: '23'
type: product
'422':
description: invalid request
@@ -1586,10 +1588,10 @@ paths:
Example:
value:
data:
- id: '4'
+ id: '58'
type: cms_section
attributes:
- name: Eos iste adipisci laudantium beatae amet eius.
+ name: Fuga perspiciatis aliquam reiciendis velit.
content: {}
settings:
gutters: No Gutters
@@ -1598,16 +1600,16 @@ paths:
type: Spree::Cms::Sections::HeroImage
position: 3
linked_resource_type: Spree::Product
- created_at: '2021-09-27T22:42:00.499Z'
- updated_at: '2021-09-27T22:42:00.506Z'
+ created_at: '2021-10-03T17:50:29.877Z'
+ updated_at: '2021-10-03T17:50:29.893Z'
relationships:
cms_page:
data:
- id: '1'
+ id: '27'
type: cms_page
linked_resource:
data:
- id: '1'
+ id: '30'
type: product
'404':
description: Record not found
@@ -1648,7 +1650,7 @@ paths:
Example:
value:
data:
- - id: '1'
+ - id: '65'
type: country
attributes:
iso_name: UNITED STATES
@@ -1657,13 +1659,13 @@ paths:
name: United States of America
numcode: 840
states_required: true
- updated_at: '2021-09-27T22:42:00.594Z'
+ updated_at: '2021-10-03T17:50:30.107Z'
zipcode_required: true
- created_at: '2021-09-27T22:42:00.594Z'
+ created_at: '2021-10-03T17:50:30.107Z'
relationships:
states:
data: []
- - id: '2'
+ - id: '66'
type: country
attributes:
iso_name: ISO_NAME_2
@@ -1672,13 +1674,13 @@ paths:
name: NAME_2
numcode: 840
states_required: false
- updated_at: '2021-09-27T22:42:00.598Z'
+ updated_at: '2021-10-03T17:50:30.116Z'
zipcode_required: true
- created_at: '2021-09-27T22:42:00.598Z'
+ created_at: '2021-10-03T17:50:30.116Z'
relationships:
states:
data: []
- - id: '3'
+ - id: '67'
type: country
attributes:
iso_name: ISO_NAME_3
@@ -1687,9 +1689,9 @@ paths:
name: NAME_3
numcode: 840
states_required: false
- updated_at: '2021-09-27T22:42:00.598Z'
+ updated_at: '2021-10-03T17:50:30.119Z'
zipcode_required: true
- created_at: '2021-09-27T22:42:00.598Z'
+ created_at: '2021-10-03T17:50:30.119Z'
relationships:
states:
data: []
@@ -1735,7 +1737,7 @@ paths:
Example:
value:
data:
- id: '2'
+ id: '72'
type: country
attributes:
iso_name: ISO_NAME_6
@@ -1744,9 +1746,9 @@ paths:
name: NAME_6
numcode: 840
states_required: false
- updated_at: '2021-09-27T22:42:00.626Z'
+ updated_at: '2021-10-03T17:50:30.184Z'
zipcode_required: true
- created_at: '2021-09-27T22:42:00.626Z'
+ created_at: '2021-10-03T17:50:30.184Z'
relationships:
states:
data: []
@@ -1808,54 +1810,6 @@ paths:
Example:
value:
data:
- - id: '1'
- type: menu_item
- attributes:
- name: Perspiciatis cupiditate quae quas incidunt nostrum alias
- vitae.
- subtitle:
- destination:
- new_window: false
- item_type: Container
- linked_resource_type: URL
- code:
- lft: 1
- rgt: 16
- depth: 0
- created_at: '2021-09-27T22:42:00.664Z'
- updated_at: '2021-09-27T22:42:00.969Z'
- link:
- is_container: true
- is_root: true
- is_child: false
- is_leaf: false
- relationships:
- icon:
- data:
- menu:
- data:
- id: '1'
- type: menu
- parent:
- data:
- linked_resource:
- data:
- children:
- data:
- - id: '2'
- type: menu_item
- - id: '3'
- type: menu_item
- - id: '4'
- type: menu_item
- - id: '5'
- type: menu_item
- - id: '6'
- type: menu_item
- - id: '7'
- type: menu_item
- - id: '8'
- type: menu_item
- id: '2'
type: menu_item
attributes:
@@ -1869,8 +1823,8 @@ paths:
lft: 2
rgt: 3
depth: 1
- created_at: '2021-09-27T22:42:00.704Z'
- updated_at: '2021-09-27T22:42:00.707Z'
+ created_at: '2021-10-03T17:50:30.380Z'
+ updated_at: '2021-10-03T17:50:30.388Z'
link:
is_container: false
is_root: false
@@ -1879,7 +1833,7 @@ paths:
relationships:
icon:
data:
- id: '1'
+ id: '16'
type: icon
menu:
data:
@@ -1906,8 +1860,8 @@ paths:
lft: 4
rgt: 5
depth: 1
- created_at: '2021-09-27T22:42:00.745Z'
- updated_at: '2021-09-27T22:42:00.748Z'
+ created_at: '2021-10-03T17:50:30.485Z'
+ updated_at: '2021-10-03T17:50:30.493Z'
link:
is_container: false
is_root: false
@@ -1916,7 +1870,7 @@ paths:
relationships:
icon:
data:
- id: '2'
+ id: '17'
type: icon
menu:
data:
@@ -1943,8 +1897,8 @@ paths:
lft: 6
rgt: 7
depth: 1
- created_at: '2021-09-27T22:42:00.786Z'
- updated_at: '2021-09-27T22:42:00.789Z'
+ created_at: '2021-10-03T17:50:30.589Z'
+ updated_at: '2021-10-03T17:50:30.595Z'
link:
is_container: false
is_root: false
@@ -1953,7 +1907,7 @@ paths:
relationships:
icon:
data:
- id: '3'
+ id: '18'
type: icon
menu:
data:
@@ -1980,8 +1934,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-09-27T22:42:00.835Z'
- updated_at: '2021-09-27T22:42:00.838Z'
+ created_at: '2021-10-03T17:50:30.689Z'
+ updated_at: '2021-10-03T17:50:30.696Z'
link:
is_container: false
is_root: false
@@ -1990,7 +1944,7 @@ paths:
relationships:
icon:
data:
- id: '4'
+ id: '19'
type: icon
menu:
data:
@@ -2017,8 +1971,8 @@ paths:
lft: 10
rgt: 11
depth: 1
- created_at: '2021-09-27T22:42:00.877Z'
- updated_at: '2021-09-27T22:42:00.880Z'
+ created_at: '2021-10-03T17:50:30.790Z'
+ updated_at: '2021-10-03T17:50:30.797Z'
link:
is_container: false
is_root: false
@@ -2027,7 +1981,7 @@ paths:
relationships:
icon:
data:
- id: '5'
+ id: '20'
type: icon
menu:
data:
@@ -2054,8 +2008,8 @@ paths:
lft: 12
rgt: 13
depth: 1
- created_at: '2021-09-27T22:42:00.919Z'
- updated_at: '2021-09-27T22:42:00.922Z'
+ created_at: '2021-10-03T17:50:30.890Z'
+ updated_at: '2021-10-03T17:50:30.898Z'
link:
is_container: false
is_root: false
@@ -2064,7 +2018,7 @@ paths:
relationships:
icon:
data:
- id: '6'
+ id: '21'
type: icon
menu:
data:
@@ -2091,8 +2045,8 @@ paths:
lft: 14
rgt: 15
depth: 1
- created_at: '2021-09-27T22:42:00.961Z'
- updated_at: '2021-09-27T22:42:00.964Z'
+ created_at: '2021-10-03T17:50:30.992Z'
+ updated_at: '2021-10-03T17:50:31.000Z'
link:
is_container: false
is_root: false
@@ -2101,7 +2055,7 @@ paths:
relationships:
icon:
data:
- id: '7'
+ id: '22'
type: icon
menu:
data:
@@ -2115,6 +2069,53 @@ paths:
data:
children:
data: []
+ - id: '1'
+ type: menu_item
+ attributes:
+ name: Accusamus sequi praesentium a dicta.
+ subtitle:
+ destination:
+ new_window: false
+ item_type: Container
+ linked_resource_type: URL
+ code:
+ lft: 1
+ rgt: 16
+ depth: 0
+ created_at: '2021-10-03T17:50:30.286Z'
+ updated_at: '2021-10-03T17:50:31.018Z'
+ link:
+ is_container: true
+ is_root: true
+ is_child: false
+ is_leaf: false
+ relationships:
+ icon:
+ data:
+ menu:
+ data:
+ id: '1'
+ type: menu
+ parent:
+ data:
+ linked_resource:
+ data:
+ children:
+ data:
+ - id: '2'
+ type: menu_item
+ - id: '3'
+ type: menu_item
+ - id: '4'
+ type: menu_item
+ - id: '5'
+ type: menu_item
+ - id: '6'
+ type: menu_item
+ - id: '7'
+ type: menu_item
+ - id: '8'
+ type: menu_item
meta:
count: 8
total_count: 8
@@ -2158,7 +2159,7 @@ paths:
Example:
value:
data:
- id: '5'
+ id: '21'
type: menu_item
attributes:
name: Link no. 18 To Somewhere
@@ -2171,8 +2172,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-09-27T22:42:01.441Z'
- updated_at: '2021-09-27T22:42:01.443Z'
+ created_at: '2021-10-03T17:50:32.409Z'
+ updated_at: '2021-10-03T17:50:32.421Z'
link:
is_container: false
is_root: false
@@ -2183,11 +2184,11 @@ paths:
data:
menu:
data:
- id: '1'
+ id: '3'
type: menu
parent:
data:
- id: '1'
+ id: '17'
type: menu_item
linked_resource:
data:
@@ -2245,7 +2246,7 @@ paths:
Example:
value:
data:
- id: '5'
+ id: '30'
type: menu_item
attributes:
name: Link no. 25 To Somewhere
@@ -2258,8 +2259,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-09-27T22:42:01.802Z'
- updated_at: '2021-09-27T22:42:01.805Z'
+ created_at: '2021-10-03T17:50:33.314Z'
+ updated_at: '2021-10-03T17:50:33.321Z'
link:
is_container: false
is_root: false
@@ -2268,15 +2269,15 @@ paths:
relationships:
icon:
data:
- id: '4'
+ id: '39'
type: icon
menu:
data:
- id: '1'
+ id: '5'
type: menu
parent:
data:
- id: '1'
+ id: '26'
type: menu_item
linked_resource:
data:
@@ -2328,7 +2329,7 @@ paths:
Example:
value:
data:
- id: '5'
+ id: '44'
type: menu_item
attributes:
name: Menu Item One
@@ -2341,8 +2342,8 @@ paths:
lft: 8
rgt: 9
depth: 1
- created_at: '2021-09-27T22:42:02.322Z'
- updated_at: '2021-09-27T22:42:02.341Z'
+ created_at: '2021-10-03T17:50:34.631Z'
+ updated_at: '2021-10-03T17:50:34.672Z'
link:
is_container: false
is_root: false
@@ -2351,15 +2352,15 @@ paths:
relationships:
icon:
data:
- id: '4'
+ id: '50'
type: icon
menu:
data:
- id: '1'
+ id: '8'
type: menu
parent:
data:
- id: '1'
+ id: '40'
type: menu_item
linked_resource:
data:
@@ -2454,7 +2455,7 @@ paths:
Example:
value:
data:
- id: '5'
+ id: '77'
type: menu_item
attributes:
name: Link no. 62 To Somewhere
@@ -2467,8 +2468,8 @@ paths:
lft: 5
rgt: 6
depth: 2
- created_at: '2021-09-27T22:42:03.595Z'
- updated_at: '2021-09-27T22:42:03.610Z'
+ created_at: '2021-10-03T17:50:37.856Z'
+ updated_at: '2021-10-03T17:50:37.904Z'
link:
is_container: false
is_root: false
@@ -2477,15 +2478,15 @@ paths:
relationships:
icon:
data:
- id: '4'
+ id: '76'
type: icon
menu:
data:
- id: '1'
+ id: '15'
type: menu
parent:
data:
- id: '3'
+ id: '75'
type: menu_item
linked_resource:
data:
@@ -2554,39 +2555,39 @@ paths:
Example:
value:
data:
- - id: '1'
+ - id: '18'
type: menu
attributes:
name: Main Menu
location: header
locale: en
- created_at: '2021-09-27T22:42:03.961Z'
- updated_at: '2021-09-27T22:42:04.051Z'
+ created_at: '2021-10-03T17:50:38.792Z'
+ updated_at: '2021-10-03T17:50:39.090Z'
relationships:
menu_items:
data:
- - id: '1'
+ - id: '89'
type: menu_item
- - id: '3'
+ - id: '87'
type: menu_item
- - id: '4'
+ - id: '90'
type: menu_item
- - id: '2'
+ - id: '19'
type: menu
attributes:
name: Footer Menu
location: footer
locale: en
- created_at: '2021-09-27T22:42:03.966Z'
- updated_at: '2021-09-27T22:42:04.135Z'
+ created_at: '2021-10-03T17:50:38.808Z'
+ updated_at: '2021-10-03T17:50:39.289Z'
relationships:
menu_items:
data:
- - id: '2'
+ - id: '91'
type: menu_item
- - id: '5'
+ - id: '88'
type: menu_item
- - id: '6'
+ - id: '92'
type: menu_item
meta:
count: 2
@@ -2631,18 +2632,18 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '22'
type: menu
attributes:
name: Main Menu
location: header
locale: en
- created_at: '2021-09-27T22:42:04.360Z'
- updated_at: '2021-09-27T22:42:04.364Z'
+ created_at: '2021-10-03T17:50:39.796Z'
+ updated_at: '2021-10-03T17:50:39.805Z'
relationships:
menu_items:
data:
- - id: '1'
+ - id: '99'
type: menu_item
'422':
description: invalid request
@@ -2696,18 +2697,18 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '23'
type: menu
attributes:
name: Main Menu
location: header
locale: en
- created_at: '2021-09-27T22:42:04.389Z'
- updated_at: '2021-09-27T22:42:04.392Z'
+ created_at: '2021-10-03T17:50:39.854Z'
+ updated_at: '2021-10-03T17:50:39.863Z'
relationships:
menu_items:
data:
- - id: '1'
+ - id: '100'
type: menu_item
'404':
description: Record not found
@@ -2755,18 +2756,18 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '25'
type: menu
attributes:
name: Main Menu
location: header
locale: en
- created_at: '2021-09-27T22:42:04.503Z'
- updated_at: '2021-09-27T22:42:04.506Z'
+ created_at: '2021-10-03T17:50:39.953Z'
+ updated_at: '2021-10-03T17:50:39.963Z'
relationships:
menu_items:
data:
- - id: '1'
+ - id: '102'
type: menu_item
'422':
description: invalid request
@@ -2886,8 +2887,8 @@ paths:
name: foo-size-1
presentation: Size
position: 1
- created_at: '2021-09-27T22:42:04.605Z'
- updated_at: '2021-09-27T22:42:04.605Z'
+ created_at: '2021-10-03T17:50:40.204Z'
+ updated_at: '2021-10-03T17:50:40.204Z'
filterable: true
relationships:
option_values:
@@ -2898,8 +2899,8 @@ paths:
name: foo-size-2
presentation: Size
position: 2
- created_at: '2021-09-27T22:42:04.606Z'
- updated_at: '2021-09-27T22:42:04.606Z'
+ created_at: '2021-10-03T17:50:40.214Z'
+ updated_at: '2021-10-03T17:50:40.214Z'
filterable: true
relationships:
option_values:
@@ -2947,14 +2948,14 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '5'
type: option_type
attributes:
name: foo-size-5
presentation: Size
position: 1
- created_at: '2021-09-27T22:42:04.638Z'
- updated_at: '2021-09-27T22:42:04.638Z'
+ created_at: '2021-10-03T17:50:40.418Z'
+ updated_at: '2021-10-03T17:50:40.418Z'
filterable: true
relationships:
option_values:
@@ -3008,14 +3009,14 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '6'
type: option_type
attributes:
name: foo-size-6
presentation: Size
position: 1
- created_at: '2021-09-27T22:42:04.658Z'
- updated_at: '2021-09-27T22:42:04.658Z'
+ created_at: '2021-10-03T17:50:40.468Z'
+ updated_at: '2021-10-03T17:50:40.468Z'
filterable: true
relationships:
option_values:
@@ -3066,14 +3067,14 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '8'
type: option_type
attributes:
name: Size-X
presentation: Size
position: 1
- created_at: '2021-09-27T22:42:04.708Z'
- updated_at: '2021-09-27T22:42:04.714Z'
+ created_at: '2021-10-03T17:50:40.556Z'
+ updated_at: '2021-10-03T17:50:40.570Z'
filterable: true
relationships:
option_values:
@@ -3191,12 +3192,12 @@ paths:
position: 1
name: Size-1
presentation: S
- created_at: '2021-09-27T22:42:04.850Z'
- updated_at: '2021-09-27T22:42:04.850Z'
+ created_at: '2021-10-03T17:50:40.838Z'
+ updated_at: '2021-10-03T17:50:40.838Z'
relationships:
option_type:
data:
- id: '1'
+ id: '13'
type: option_type
- id: '2'
type: option_value
@@ -3204,12 +3205,12 @@ paths:
position: 1
name: Size-2
presentation: S
- created_at: '2021-09-27T22:42:04.854Z'
- updated_at: '2021-09-27T22:42:04.854Z'
+ created_at: '2021-10-03T17:50:40.850Z'
+ updated_at: '2021-10-03T17:50:40.850Z'
relationships:
option_type:
data:
- id: '2'
+ id: '14'
type: option_type
meta:
count: 2
@@ -3254,14 +3255,14 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '5'
type: option_value
attributes:
position: 1
name: Size-5
presentation: S
- created_at: '2021-09-27T22:42:04.895Z'
- updated_at: '2021-09-27T22:42:04.895Z'
+ created_at: '2021-10-03T17:50:40.935Z'
+ updated_at: '2021-10-03T17:50:40.935Z'
relationships:
option_type:
data:
@@ -3314,18 +3315,18 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '6'
type: option_value
attributes:
position: 1
name: Size-6
presentation: S
- created_at: '2021-09-27T22:42:04.922Z'
- updated_at: '2021-09-27T22:42:04.922Z'
+ created_at: '2021-10-03T17:50:40.985Z'
+ updated_at: '2021-10-03T17:50:40.985Z'
relationships:
option_type:
data:
- id: '1'
+ id: '17'
type: option_type
'404':
description: Record not found
@@ -3373,18 +3374,18 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '8'
type: option_value
attributes:
position: 1
name: M
presentation: S
- created_at: '2021-09-27T22:42:04.968Z'
- updated_at: '2021-09-27T22:42:04.974Z'
+ created_at: '2021-10-03T17:50:41.075Z'
+ updated_at: '2021-10-03T17:50:41.088Z'
relationships:
option_type:
data:
- id: '1'
+ id: '19'
type: option_type
'422':
description: invalid request
@@ -3451,15 +3452,15 @@ paths:
Example:
value:
error: The access token is invalid
- "/api/v2/platform/taxons":
+ "/api/v2/platform/orders":
get:
- summary: Returns a list of Taxons
+ summary: Returns a list of Orders
tags:
- - Taxons
+ - Orders
security:
- bearer_auth: []
- description: Returns a list of Taxons
- operationId: taxons-list
+ description: Returns a list of Orders
+ operationId: orders-list
parameters:
- name: page
in: query
@@ -3475,13 +3476,13 @@ paths:
in: query
description: 'Select which associated resources you would like to fetch, see:
<a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
- example: taxonomy,parent,children
+ example: line_items.variants.product
schema:
type: string
- name: filter
in: query
description: ''
- example: taxonomy_id_eq=1&name_cont=Shirts
+ example: state_eq=complete
schema:
type: string
responses:
@@ -3494,76 +3495,1262 @@ paths:
value:
data:
- id: '1'
- type: taxon
+ type: order
attributes:
- position: 0
- name: taxonomy_16
- permalink: taxonomy-16
- lft: 1
- rgt: 6
- description:
- created_at: '2021-09-27T22:42:05.071Z'
- updated_at: '2021-09-27T22:42:05.161Z'
- meta_title:
- meta_description:
- meta_keywords:
- depth: 0
- pretty_name: taxonomy_16
- seo_title: taxonomy_16
- is_root: true
- is_child: false
- is_leaf: false
+ number: R522792765
+ item_total: '0.0'
+ total: '0.0'
+ state: cart
+ adjustment_total: '0.0'
+ completed_at:
+ payment_total: '0.0'
+ shipment_state:
+ payment_state:
+ special_instructions:
+ created_at: '2021-10-03T17:50:41.309Z'
+ updated_at: '2021-10-03T17:50:41.309Z'
+ currency: USD
+ last_ip_address:
+ shipment_total: '0.0'
+ additional_tax_total: '0.0'
+ promo_total: '0.0'
+ channel: spree
+ included_tax_total: '0.0'
+ item_count: 0
+ approved_at:
+ confirmation_delivered: false
+ canceled_at:
+ state_lock_version: 0
+ taxable_adjustment_total: '0.0'
+ non_taxable_adjustment_total: '0.0'
+ store_owner_notification_delivered:
+ display_pre_tax_total: "$0.00"
+ display_ship_total: "$0.00"
+ display_shipment_total: "$0.00"
+ display_total: "$0.00"
+ display_outstanding_balance: "$0.00"
+ display_item_total: "$0.00"
+ display_tax_total: "$0.00"
+ display_cart_promo_total: "$0.00"
+ display_pre_tax_item_amount: "$0.00"
+ display_adjustment_total: "$0.00"
+ display_additional_tax_total: "$0.00"
+ display_included_tax_total: "$0.00"
+ display_promo_total: "$0.00"
+ display_total_applicable_store_credit: "$0.00"
+ display_total_applied_store_credit: "$0.00"
+ display_order_total_after_store_credit: "$0.00"
+ display_total_available_store_credit: "$0.00"
+ display_store_credit_remaining_after_capture: "$0.00"
relationships:
- parent:
+ user:
data:
- taxonomy:
+ id: '2'
+ type: user
+ created_by:
data:
- id: '1'
- type: taxonomy
- children:
+ approver:
data:
- - id: '2'
- type: taxon
- - id: '3'
- type: taxon
- image:
+ canceler:
+ data:
+ bill_address:
+ data:
+ id: '13'
+ type: address
+ ship_address:
data:
+ line_items:
+ data: []
+ payments:
+ data: []
+ shipments:
+ data: []
+ state_changes:
+ data: []
+ return_authorizations:
+ data: []
+ reimbursements:
+ data: []
+ adjustments:
+ data: []
+ all_adjustments:
+ data: []
+ order_promotions:
+ data: []
- id: '2'
- type: taxon
+ type: order
attributes:
- position: 0
- name: taxon_16
- permalink: taxonomy-16/taxon-16
- lft: 2
- rgt: 3
- description:
- created_at: '2021-09-27T22:42:05.113Z'
- updated_at: '2021-09-27T22:42:05.114Z'
- meta_title:
- meta_description:
- meta_keywords:
- depth: 1
- pretty_name: taxonomy_16 -> taxon_16
- seo_title: taxon_16
- is_root: false
- is_child: true
- is_leaf: true
+ number: R476114052
+ item_total: '0.0'
+ total: '0.0'
+ state: cart
+ adjustment_total: '0.0'
+ completed_at:
+ payment_total: '0.0'
+ shipment_state:
+ payment_state:
+ special_instructions:
+ created_at: '2021-10-03T17:50:41.325Z'
+ updated_at: '2021-10-03T17:50:41.325Z'
+ currency: USD
+ last_ip_address:
+ shipment_total: '0.0'
+ additional_tax_total: '0.0'
+ promo_total: '0.0'
+ channel: spree
+ included_tax_total: '0.0'
+ item_count: 0
+ approved_at:
+ confirmation_delivered: false
+ canceled_at:
+ state_lock_version: 0
+ taxable_adjustment_total: '0.0'
+ non_taxable_adjustment_total: '0.0'
+ store_owner_notification_delivered:
+ display_pre_tax_total: "$0.00"
+ display_ship_total: "$0.00"
+ display_shipment_total: "$0.00"
+ display_total: "$0.00"
+ display_outstanding_balance: "$0.00"
+ display_item_total: "$0.00"
+ display_tax_total: "$0.00"
+ display_cart_promo_total: "$0.00"
+ display_pre_tax_item_amount: "$0.00"
+ display_adjustment_total: "$0.00"
+ display_additional_tax_total: "$0.00"
+ display_included_tax_total: "$0.00"
+ display_promo_total: "$0.00"
+ display_total_applicable_store_credit: "$0.00"
+ display_total_applied_store_credit: "$0.00"
+ display_order_total_after_store_credit: "$0.00"
+ display_total_available_store_credit: "$0.00"
+ display_store_credit_remaining_after_capture: "$0.00"
relationships:
- parent:
+ user:
data:
- id: '1'
- type: taxon
- taxonomy:
+ id: '3'
+ type: user
+ created_by:
data:
- id: '1'
- type: taxonomy
- children:
+ approver:
+ data:
+ canceler:
+ data:
+ bill_address:
+ data:
+ id: '14'
+ type: address
+ ship_address:
+ data:
+ line_items:
+ data: []
+ payments:
+ data: []
+ shipments:
+ data: []
+ state_changes:
+ data: []
+ return_authorizations:
+ data: []
+ reimbursements:
+ data: []
+ adjustments:
+ data: []
+ all_adjustments:
+ data: []
+ order_promotions:
+ data: []
+ meta:
+ count: 2
+ total_count: 2
+ total_pages: 1
+ links:
+ self: http://www.example.com/api/v2/platform/orders?page=1&per_page=&include=&filter=
+ next: http://www.example.com/api/v2/platform/orders?include=&page=1&per_page=
+ prev: http://www.example.com/api/v2/platform/orders?include=&page=1&per_page=
+ last: http://www.example.com/api/v2/platform/orders?include=&page=1&per_page=
+ first: http://www.example.com/api/v2/platform/orders?include=&page=1&per_page=
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ post:
+ summary: Creates an Order
+ tags:
+ - Orders
+ security:
+ - bearer_auth: []
+ description: Creates an Order
+ operationId: create-order
+ parameters:
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: line_items.variants.product
+ schema:
+ type: string
+ responses:
+ '201':
+ description: record created
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '5'
+ type: order
+ attributes:
+ number: R347100103
+ item_total: '0.0'
+ total: '0.0'
+ state: cart
+ adjustment_total: '0.0'
+ completed_at:
+ payment_total: '0.0'
+ shipment_state:
+ payment_state:
+ special_instructions:
+ created_at: '2021-10-03T17:50:41.719Z'
+ updated_at: '2021-10-03T17:50:41.719Z'
+ currency: USD
+ last_ip_address:
+ shipment_total: '0.0'
+ additional_tax_total: '0.0'
+ promo_total: '0.0'
+ channel: spree
+ included_tax_total: '0.0'
+ item_count: 0
+ approved_at:
+ confirmation_delivered: false
+ canceled_at:
+ state_lock_version: 0
+ taxable_adjustment_total: '0.0'
+ non_taxable_adjustment_total: '0.0'
+ store_owner_notification_delivered:
+ display_pre_tax_total: "$0.00"
+ display_ship_total: "$0.00"
+ display_shipment_total: "$0.00"
+ display_total: "$0.00"
+ display_outstanding_balance: "$0.00"
+ display_item_total: "$0.00"
+ display_tax_total: "$0.00"
+ display_cart_promo_total: "$0.00"
+ display_pre_tax_item_amount: "$0.00"
+ display_adjustment_total: "$0.00"
+ display_additional_tax_total: "$0.00"
+ display_included_tax_total: "$0.00"
+ display_promo_total: "$0.00"
+ display_total_applicable_store_credit: "$0.00"
+ display_total_applied_store_credit: "$0.00"
+ display_order_total_after_store_credit: "$0.00"
+ display_total_available_store_credit: "$0.00"
+ display_store_credit_remaining_after_capture: "$0.00"
+ relationships:
+ user:
+ data:
+ created_by:
+ data:
+ approver:
+ data:
+ canceler:
+ data:
+ bill_address:
+ data:
+ ship_address:
+ data:
+ line_items:
+ data: []
+ payments:
+ data: []
+ shipments:
+ data: []
+ state_changes:
+ data: []
+ return_authorizations:
+ data: []
+ reimbursements:
+ data: []
+ adjustments:
+ data: []
+ all_adjustments:
+ data: []
+ order_promotions:
+ data: []
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/order_params"
+ "/api/v2/platform/orders/{id}":
+ get:
+ summary: Returns an Order
+ tags:
+ - Orders
+ security:
+ - bearer_auth: []
+ description: Returns an Order
+ operationId: show-order
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: line_items.variants.product
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Record found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '6'
+ type: order
+ attributes:
+ number: R676333728
+ item_total: '10.0'
+ total: '110.0'
+ state: delivery
+ adjustment_total: '0.0'
+ completed_at:
+ payment_total: '0.0'
+ shipment_state:
+ payment_state:
+ special_instructions:
+ created_at: '2021-10-03T17:50:41.781Z'
+ updated_at: '2021-10-03T17:50:41.990Z'
+ currency: USD
+ last_ip_address:
+ shipment_total: '100.0'
+ additional_tax_total: '0.0'
+ promo_total: '0.0'
+ channel: spree
+ included_tax_total: '0.0'
+ item_count: 1
+ approved_at:
+ confirmation_delivered: false
+ canceled_at:
+ state_lock_version: 0
+ taxable_adjustment_total: '0.0'
+ non_taxable_adjustment_total: '0.0'
+ store_owner_notification_delivered:
+ display_pre_tax_total: "$10.00"
+ display_ship_total: "$100.00"
+ display_shipment_total: "$100.00"
+ display_total: "$110.00"
+ display_outstanding_balance: "$110.00"
+ display_item_total: "$10.00"
+ display_tax_total: "$0.00"
+ display_cart_promo_total: "$0.00"
+ display_pre_tax_item_amount: "$10.00"
+ display_adjustment_total: "$0.00"
+ display_additional_tax_total: "$0.00"
+ display_included_tax_total: "$0.00"
+ display_promo_total: "$0.00"
+ display_total_applicable_store_credit: "$0.00"
+ display_total_applied_store_credit: "$0.00"
+ display_order_total_after_store_credit: "$110.00"
+ display_total_available_store_credit: "$0.00"
+ display_store_credit_remaining_after_capture: "$0.00"
+ relationships:
+ user:
+ data:
+ id: '6'
+ type: user
+ created_by:
+ data:
+ approver:
+ data:
+ canceler:
+ data:
+ bill_address:
+ data:
+ id: '17'
+ type: address
+ ship_address:
+ data:
+ id: '18'
+ type: address
+ line_items:
+ data:
+ - id: '1'
+ type: line_item
+ payments:
+ data: []
+ shipments:
+ data:
+ - id: '1'
+ type: shipment
+ state_changes:
+ data: []
+ return_authorizations:
+ data: []
+ reimbursements:
+ data: []
+ adjustments:
+ data: []
+ all_adjustments:
+ data: []
+ order_promotions:
+ data: []
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ put:
+ summary: Updates an Order
+ tags:
+ - Orders
+ security:
+ - bearer_auth: []
+ description: Updates an Order
+ operationId: update-order
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: line_items.variants.product
+ schema:
+ type: string
+ responses:
+ '200':
+ description: record updated
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '8'
+ type: order
+ attributes:
+ number: R759459506
+ item_total: '10.0'
+ total: '110.0'
+ state: delivery
+ adjustment_total: '0.0'
+ completed_at:
+ payment_total: '0.0'
+ shipment_state:
+ payment_state:
+ special_instructions:
+ created_at: '2021-10-03T17:50:42.208Z'
+ updated_at: '2021-10-03T17:50:42.330Z'
+ currency: USD
+ last_ip_address:
+ shipment_total: '100.0'
+ additional_tax_total: '0.0'
+ promo_total: '0.0'
+ channel: spree
+ included_tax_total: '0.0'
+ item_count: 1
+ approved_at:
+ confirmation_delivered: false
+ canceled_at:
+ state_lock_version: 0
+ taxable_adjustment_total: '0.0'
+ non_taxable_adjustment_total: '0.0'
+ store_owner_notification_delivered:
+ display_pre_tax_total: "$10.00"
+ display_ship_total: "$100.00"
+ display_shipment_total: "$100.00"
+ display_total: "$110.00"
+ display_outstanding_balance: "$110.00"
+ display_item_total: "$10.00"
+ display_tax_total: "$0.00"
+ display_cart_promo_total: "$0.00"
+ display_pre_tax_item_amount: "$10.00"
+ display_adjustment_total: "$0.00"
+ display_additional_tax_total: "$0.00"
+ display_included_tax_total: "$0.00"
+ display_promo_total: "$0.00"
+ display_total_applicable_store_credit: "$0.00"
+ display_total_applied_store_credit: "$0.00"
+ display_order_total_after_store_credit: "$110.00"
+ display_total_available_store_credit: "$0.00"
+ display_store_credit_remaining_after_capture: "$0.00"
+ relationships:
+ user:
+ data:
+ id: '8'
+ type: user
+ created_by:
+ data:
+ approver:
+ data:
+ canceler:
+ data:
+ bill_address:
+ data:
+ id: '21'
+ type: address
+ ship_address:
+ data:
+ id: '22'
+ type: address
+ line_items:
+ data:
+ - id: '3'
+ type: line_item
+ payments:
+ data: []
+ shipments:
+ data:
+ - id: '3'
+ type: shipment
+ state_changes:
+ data: []
+ return_authorizations:
+ data: []
+ reimbursements:
+ data: []
+ adjustments:
+ data: []
+ all_adjustments:
+ data: []
+ order_promotions:
+ data: []
+ '422':
+ description: invalid request
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: Email is invalid
+ errors:
+ email:
+ - is invalid
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/order_params"
+ delete:
+ summary: Deletes an Order
+ tags:
+ - Orders
+ security:
+ - bearer_auth: []
+ description: Deletes an Order
+ operationId: delete-order
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: Record deleted
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ "/api/v2/platform/orders/{id}/advance":
+ put:
+ summary: Advances an Order
+ tags:
+ - Orders
+ security:
+ - bearer_auth: []
+ description: Advances an Order
+ operationId: advance-order
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: line_items.variants.product
+ schema:
+ type: string
+ responses:
+ '200':
+ description: record updated
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '13'
+ type: order
+ attributes:
+ number: R474584117
+ item_total: '10.0'
+ total: '110.0'
+ state: payment
+ adjustment_total: '0.0'
+ completed_at:
+ payment_total: '0.0'
+ shipment_state:
+ payment_state:
+ special_instructions:
+ created_at: '2021-10-03T17:50:43.116Z'
+ updated_at: '2021-10-03T17:50:43.340Z'
+ currency: USD
+ last_ip_address:
+ shipment_total: '100.0'
+ additional_tax_total: '0.0'
+ promo_total: '0.0'
+ channel: spree
+ included_tax_total: '0.0'
+ item_count: 1
+ approved_at:
+ confirmation_delivered: false
+ canceled_at:
+ state_lock_version: 0
+ taxable_adjustment_total: '0.0'
+ non_taxable_adjustment_total: '0.0'
+ store_owner_notification_delivered:
+ display_pre_tax_total: "$110.00"
+ display_ship_total: "$100.00"
+ display_shipment_total: "$100.00"
+ display_total: "$110.00"
+ display_outstanding_balance: "$110.00"
+ display_item_total: "$10.00"
+ display_tax_total: "$0.00"
+ display_cart_promo_total: "$0.00"
+ display_pre_tax_item_amount: "$10.00"
+ display_adjustment_total: "$0.00"
+ display_additional_tax_total: "$0.00"
+ display_included_tax_total: "$0.00"
+ display_promo_total: "$0.00"
+ display_total_applicable_store_credit: "$0.00"
+ display_total_applied_store_credit: "$0.00"
+ display_order_total_after_store_credit: "$110.00"
+ display_total_available_store_credit: "$0.00"
+ display_store_credit_remaining_after_capture: "$0.00"
+ relationships:
+ user:
+ data:
+ id: '13'
+ type: user
+ created_by:
+ data:
+ approver:
+ data:
+ canceler:
+ data:
+ bill_address:
+ data:
+ id: '31'
+ type: address
+ ship_address:
+ data:
+ id: '32'
+ type: address
+ line_items:
+ data:
+ - id: '8'
+ type: line_item
+ payments:
+ data: []
+ shipments:
+ data:
+ - id: '8'
+ type: shipment
+ state_changes:
+ data:
+ - id: '2'
+ type: state_change
+ return_authorizations:
+ data: []
+ reimbursements:
+ data: []
+ adjustments:
+ data: []
+ all_adjustments:
+ data: []
+ order_promotions:
+ data: []
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ "/api/v2/platform/orders/{id}/next":
+ put:
+ summary: Next an Order
+ tags:
+ - Orders
+ security:
+ - bearer_auth: []
+ description: Moves an Order to the next state
+ operationId: next-order
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: line_items.variants.product
+ schema:
+ type: string
+ responses:
+ '200':
+ description: record updated
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '15'
+ type: order
+ attributes:
+ number: R926665217
+ item_total: '10.0'
+ total: '110.0'
+ state: payment
+ adjustment_total: '0.0'
+ completed_at:
+ payment_total: '0.0'
+ shipment_state:
+ payment_state:
+ special_instructions:
+ created_at: '2021-10-03T17:50:43.572Z'
+ updated_at: '2021-10-03T17:50:43.731Z'
+ currency: USD
+ last_ip_address:
+ shipment_total: '100.0'
+ additional_tax_total: '0.0'
+ promo_total: '0.0'
+ channel: spree
+ included_tax_total: '0.0'
+ item_count: 1
+ approved_at:
+ confirmation_delivered: false
+ canceled_at:
+ state_lock_version: 0
+ taxable_adjustment_total: '0.0'
+ non_taxable_adjustment_total: '0.0'
+ store_owner_notification_delivered:
+ display_pre_tax_total: "$110.00"
+ display_ship_total: "$100.00"
+ display_shipment_total: "$100.00"
+ display_total: "$110.00"
+ display_outstanding_balance: "$110.00"
+ display_item_total: "$10.00"
+ display_tax_total: "$0.00"
+ display_cart_promo_total: "$0.00"
+ display_pre_tax_item_amount: "$10.00"
+ display_adjustment_total: "$0.00"
+ display_additional_tax_total: "$0.00"
+ display_included_tax_total: "$0.00"
+ display_promo_total: "$0.00"
+ display_total_applicable_store_credit: "$0.00"
+ display_total_applied_store_credit: "$0.00"
+ display_order_total_after_store_credit: "$110.00"
+ display_total_available_store_credit: "$0.00"
+ display_store_credit_remaining_after_capture: "$0.00"
+ relationships:
+ user:
+ data:
+ id: '15'
+ type: user
+ created_by:
+ data:
+ approver:
+ data:
+ canceler:
+ data:
+ bill_address:
+ data:
+ id: '35'
+ type: address
+ ship_address:
+ data:
+ id: '36'
+ type: address
+ line_items:
+ data:
+ - id: '10'
+ type: line_item
+ payments:
+ data: []
+ shipments:
+ data:
+ - id: '10'
+ type: shipment
+ state_changes:
+ data:
+ - id: '3'
+ type: state_change
+ return_authorizations:
+ data: []
+ reimbursements:
+ data: []
+ adjustments:
+ data: []
+ all_adjustments:
+ data: []
+ order_promotions:
+ data: []
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ "/api/v2/platform/orders/{id}/complete":
+ put:
+ summary: Completes an Order
+ tags:
+ - Orders
+ security:
+ - bearer_auth: []
+ description: Marks an Order as completed
+ operationId: complete-order
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: line_items.variants.product
+ schema:
+ type: string
+ responses:
+ '200':
+ description: record updated
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '17'
+ type: order
+ attributes:
+ number: R951935954
+ item_total: '10.0'
+ total: '110.0'
+ state: complete
+ adjustment_total: '0.0'
+ completed_at: '2021-10-03T17:50:44.239Z'
+ payment_total: '0.0'
+ shipment_state: pending
+ payment_state: balance_due
+ special_instructions:
+ created_at: '2021-10-03T17:50:43.930Z'
+ updated_at: '2021-10-03T17:50:44.239Z'
+ currency: USD
+ last_ip_address:
+ shipment_total: '100.0'
+ additional_tax_total: '0.0'
+ promo_total: '0.0'
+ channel: spree
+ included_tax_total: '0.0'
+ item_count: 1
+ approved_at:
+ confirmation_delivered: false
+ canceled_at:
+ state_lock_version: 0
+ taxable_adjustment_total: '0.0'
+ non_taxable_adjustment_total: '0.0'
+ store_owner_notification_delivered:
+ display_pre_tax_total: "$110.00"
+ display_ship_total: "$100.00"
+ display_shipment_total: "$100.00"
+ display_total: "$110.00"
+ display_outstanding_balance: "$110.00"
+ display_item_total: "$10.00"
+ display_tax_total: "$0.00"
+ display_cart_promo_total: "$0.00"
+ display_pre_tax_item_amount: "$10.00"
+ display_adjustment_total: "$0.00"
+ display_additional_tax_total: "$0.00"
+ display_included_tax_total: "$0.00"
+ display_promo_total: "$0.00"
+ display_total_applicable_store_credit: "$0.00"
+ display_total_applied_store_credit: "$0.00"
+ display_order_total_after_store_credit: "$110.00"
+ display_total_available_store_credit: "$0.00"
+ display_store_credit_remaining_after_capture: "$0.00"
+ relationships:
+ user:
+ data:
+ id: '17'
+ type: user
+ created_by:
+ data:
+ approver:
+ data:
+ canceler:
+ data:
+ bill_address:
+ data:
+ id: '39'
+ type: address
+ ship_address:
+ data:
+ id: '40'
+ type: address
+ line_items:
+ data:
+ - id: '12'
+ type: line_item
+ payments:
+ data:
+ - id: '1'
+ type: payment
+ shipments:
+ data:
+ - id: '12'
+ type: shipment
+ state_changes:
+ data:
+ - id: '4'
+ type: state_change
+ - id: '5'
+ type: state_change
+ - id: '8'
+ type: state_change
+ - id: '9'
+ type: state_change
+ - id: '10'
+ type: state_change
+ return_authorizations:
+ data: []
+ reimbursements:
+ data: []
+ adjustments:
+ data: []
+ all_adjustments:
+ data: []
+ order_promotions:
+ data: []
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ "/api/v2/platform/orders/{id}/empty":
+ put:
+ summary: Empties an Order
+ tags:
+ - Orders
+ security:
+ - bearer_auth: []
+ description: Removes all line items, promotions, shipment and payments from
+ an Order
+ operationId: empty-order
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: line_items.variants.product
+ schema:
+ type: string
+ responses:
+ '200':
+ description: record updated
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ id: '20'
+ type: order
+ attributes:
+ number: R526952607
+ item_total: '0.0'
+ total: '0.0'
+ state: cart
+ adjustment_total: '0.0'
+ completed_at:
+ payment_total: '0.0'
+ shipment_state:
+ payment_state:
+ special_instructions:
+ created_at: '2021-10-03T17:50:44.652Z'
+ updated_at: '2021-10-03T17:50:44.781Z'
+ currency: USD
+ last_ip_address:
+ shipment_total: '0.0'
+ additional_tax_total: '0.0'
+ promo_total: '0.0'
+ channel: spree
+ included_tax_total: '0.0'
+ item_count: 0
+ approved_at:
+ confirmation_delivered: false
+ canceled_at:
+ state_lock_version: 0
+ taxable_adjustment_total: '0.0'
+ non_taxable_adjustment_total: '0.0'
+ store_owner_notification_delivered:
+ display_pre_tax_total: "$0.00"
+ display_ship_total: "$0.00"
+ display_shipment_total: "$0.00"
+ display_total: "$0.00"
+ display_outstanding_balance: "$0.00"
+ display_item_total: "$0.00"
+ display_tax_total: "$0.00"
+ display_cart_promo_total: "$0.00"
+ display_pre_tax_item_amount: "$0.00"
+ display_adjustment_total: "$0.00"
+ display_additional_tax_total: "$0.00"
+ display_included_tax_total: "$0.00"
+ display_promo_total: "$0.00"
+ display_total_applicable_store_credit: "$0.00"
+ display_total_applied_store_credit: "$0.00"
+ display_order_total_after_store_credit: "$0.00"
+ display_total_available_store_credit: "$0.00"
+ display_store_credit_remaining_after_capture: "$0.00"
+ relationships:
+ user:
+ data:
+ id: '20'
+ type: user
+ created_by:
+ data:
+ approver:
+ data:
+ canceler:
+ data:
+ bill_address:
+ data:
+ id: '45'
+ type: address
+ ship_address:
+ data:
+ id: '46'
+ type: address
+ line_items:
+ data: []
+ payments:
+ data: []
+ shipments:
+ data: []
+ state_changes:
+ data: []
+ return_authorizations:
+ data: []
+ reimbursements:
+ data: []
+ adjustments:
+ data: []
+ all_adjustments:
+ data: []
+ order_promotions:
+ data: []
+ '404':
+ description: Record not found
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The resource you were looking for could not be found.
+ '401':
+ description: Authentication Failed
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ error: The access token is invalid
+ "/api/v2/platform/taxons":
+ get:
+ summary: Returns a list of Taxons
+ tags:
+ - Taxons
+ security:
+ - bearer_auth: []
+ description: Returns a list of Taxons
+ operationId: taxons-list
+ parameters:
+ - name: page
+ in: query
+ example: 1
+ schema:
+ type: integer
+ - name: per_page
+ in: query
+ example: 50
+ schema:
+ type: integer
+ - name: include
+ in: query
+ description: 'Select which associated resources you would like to fetch, see:
+ <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>'
+ example: taxonomy,parent,children
+ schema:
+ type: string
+ - name: filter
+ in: query
+ description: ''
+ example: taxonomy_id_eq=1&name_cont=Shirts
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Records returned
+ content:
+ application/vnd.api+json:
+ examples:
+ Example:
+ value:
+ data:
+ - id: '32'
+ type: taxon
+ attributes:
+ position: 0
+ name: taxon_16
+ permalink: taxonomy-16/taxon-16
+ lft: 2
+ rgt: 3
+ description:
+ created_at: '2021-10-03T17:50:45.082Z'
+ updated_at: '2021-10-03T17:50:45.088Z'
+ meta_title:
+ meta_description:
+ meta_keywords:
+ depth: 1
+ pretty_name: taxonomy_16 -> taxon_16
+ seo_title: taxon_16
+ is_root: false
+ is_child: true
+ is_leaf: true
+ relationships:
+ parent:
+ data:
+ id: '31'
+ type: taxon
+ taxonomy:
+ data:
+ id: '16'
+ type: taxonomy
+ children:
data: []
image:
data:
- id: '1'
+ id: '92'
type: taxon_image
- - id: '3'
+ - id: '33'
type: taxon
attributes:
position: 0
@@ -3572,8 +4759,8 @@ paths:
lft: 4
rgt: 5
description:
- created_at: '2021-09-27T22:42:05.154Z'
- updated_at: '2021-09-27T22:42:05.156Z'
+ created_at: '2021-10-03T17:50:45.181Z'
+ updated_at: '2021-10-03T17:50:45.187Z'
meta_title:
meta_description:
meta_keywords:
@@ -3586,18 +4773,53 @@ paths:
relationships:
parent:
data:
- id: '1'
+ id: '31'
type: taxon
taxonomy:
data:
- id: '1'
+ id: '16'
type: taxonomy
children:
data: []
image:
data:
- id: '2'
+ id: '93'
type: taxon_image
+ - id: '31'
+ type: taxon
+ attributes:
+ position: 0
+ name: taxonomy_16
+ permalink: taxonomy-16
+ lft: 1
+ rgt: 6
+ description:
+ created_at: '2021-10-03T17:50:44.987Z'
+ updated_at: '2021-10-03T17:50:45.201Z'
+ meta_title:
+ meta_description:
+ meta_keywords:
+ depth: 0
+ pretty_name: taxonomy_16
+ seo_title: taxonomy_16
+ is_root: true
+ is_child: false
+ is_leaf: false
+ relationships:
+ parent:
+ data:
+ taxonomy:
+ data:
+ id: '16'
+ type: taxonomy
+ children:
+ data:
+ - id: '32'
+ type: taxon
+ - id: '33'
+ type: taxon
+ image:
+ data:
meta:
count: 3
total_count: 3
@@ -3641,7 +4863,7 @@ paths:
Example:
value:
data:
- id: '2'
+ id: '38'
type: taxon
attributes:
position: 0
@@ -3650,8 +4872,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-09-27T22:42:05.317Z'
- updated_at: '2021-09-27T22:42:05.320Z'
+ created_at: '2021-10-03T17:50:45.554Z'
+ updated_at: '2021-10-03T17:50:45.560Z'
meta_title:
meta_description:
meta_keywords:
@@ -3664,11 +4886,11 @@ paths:
relationships:
parent:
data:
- id: '1'
+ id: '37'
type: taxon
taxonomy:
data:
- id: '1'
+ id: '18'
type: taxonomy
children:
data: []
@@ -3723,7 +4945,7 @@ paths:
Example:
value:
data:
- id: '2'
+ id: '40'
type: taxon
attributes:
position: 0
@@ -3732,8 +4954,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-09-27T22:42:05.388Z'
- updated_at: '2021-09-27T22:42:05.390Z'
+ created_at: '2021-10-03T17:50:45.710Z'
+ updated_at: '2021-10-03T17:50:45.715Z'
meta_title:
meta_description:
meta_keywords:
@@ -3746,11 +4968,11 @@ paths:
relationships:
parent:
data:
- id: '1'
+ id: '39'
type: taxon
taxonomy:
data:
- id: '1'
+ id: '19'
type: taxonomy
children:
data: []
@@ -3758,7 +4980,7 @@ paths:
data: []
image:
data:
- id: '1'
+ id: '96'
type: taxon_image
'404':
description: Record not found
@@ -3806,7 +5028,7 @@ paths:
Example:
value:
data:
- id: '2'
+ id: '44'
type: taxon
attributes:
position: 0
@@ -3815,8 +5037,8 @@ paths:
lft: 2
rgt: 3
description:
- created_at: '2021-09-27T22:42:05.559Z'
- updated_at: '2021-09-27T22:42:05.575Z'
+ created_at: '2021-10-03T17:50:46.043Z'
+ updated_at: '2021-10-03T17:50:46.084Z'
meta_title:
meta_description:
meta_keywords:
@@ -3829,17 +5051,17 @@ paths:
relationships:
parent:
data:
- id: '1'
+ id: '43'
type: taxon
taxonomy:
data:
- id: '1'
+ id: '21'
type: taxonomy
children:
data: []
image:
data:
- id: '1'
+ id: '98'
type: taxon_image
'422':
description: invalid request
@@ -3948,12 +5170,12 @@ paths:
Example:
value:
data:
- - id: '1'
+ - id: '22'
type: user
attributes:
- created_at: '2021-09-27T22:42:05.876Z'
- updated_at: '2021-09-27T22:42:05.876Z'
+ created_at: '2021-10-03T17:50:46.787Z'
+ updated_at: '2021-10-03T17:50:46.787Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -3962,12 +5184,12 @@ paths:
data:
ship_address:
data:
- - id: '2'
+ - id: '23'
type: user
attributes:
- created_at: '2021-09-27T22:42:05.880Z'
- updated_at: '2021-09-27T22:42:05.880Z'
+ created_at: '2021-10-03T17:50:46.796Z'
+ updated_at: '2021-10-03T17:50:46.796Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -3976,12 +5198,12 @@ paths:
data:
ship_address:
data:
- - id: '3'
+ - id: '24'
type: user
attributes:
- created_at: '2021-09-27T22:42:05.881Z'
- updated_at: '2021-09-27T22:42:05.881Z'
+ created_at: '2021-10-03T17:50:46.798Z'
+ updated_at: '2021-10-03T17:50:46.798Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -4033,12 +5255,12 @@ paths:
Example:
value:
data:
- id: '2'
+ id: '29'
type: user
attributes:
- created_at: '2021-09-27T22:42:05.931Z'
- updated_at: '2021-09-27T22:42:05.931Z'
+ created_at: '2021-10-03T17:50:46.888Z'
+ updated_at: '2021-10-03T17:50:46.888Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -4094,12 +5316,12 @@ paths:
Example:
value:
data:
- id: '2'
+ id: '32'
type: user
attributes:
- created_at: '2021-09-27T22:42:05.959Z'
- updated_at: '2021-09-27T22:42:05.959Z'
+ created_at: '2021-10-03T17:50:46.959Z'
+ updated_at: '2021-10-03T17:50:46.959Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -4154,12 +5376,12 @@ paths:
Example:
value:
data:
- id: '2'
+ id: '37'
type: user
attributes:
- created_at: '2021-09-27T22:42:06.001Z'
- updated_at: '2021-09-27T22:42:06.005Z'
+ created_at: '2021-10-03T17:50:47.056Z'
+ updated_at: '2021-10-03T17:50:47.068Z'
average_order_value: []
lifetime_value: []
store_credits: []
@@ -4273,61 +5495,61 @@ paths:
type: wished_item
attributes:
quantity: 1
- created_at: '2021-09-27T22:42:06.193Z'
- updated_at: '2021-09-27T22:42:06.193Z'
- price: '19.99'
- total: '19.99'
+ created_at: '2021-10-03T17:50:47.441Z'
+ updated_at: '2021-10-03T17:50:47.441Z'
display_price: "$19.99"
display_total: "$19.99"
+ price: '19.99'
+ total: '19.99'
relationships:
variant:
data:
- id: '4'
+ id: '52'
type: variant
- id: '2'
type: wished_item
attributes:
quantity: 1
- created_at: '2021-09-27T22:42:06.219Z'
- updated_at: '2021-09-27T22:42:06.219Z'
- price: '19.99'
- total: '19.99'
+ created_at: '2021-10-03T17:50:47.508Z'
+ updated_at: '2021-10-03T17:50:47.508Z'
display_price: "$19.99"
display_total: "$19.99"
+ price: '19.99'
+ total: '19.99'
relationships:
variant:
data:
- id: '6'
+ id: '54'
type: variant
- id: '3'
type: wished_item
attributes:
quantity: 1
- created_at: '2021-09-27T22:42:06.248Z'
- updated_at: '2021-09-27T22:42:06.248Z'
- price: '19.99'
- total: '19.99'
+ created_at: '2021-10-03T17:50:47.580Z'
+ updated_at: '2021-10-03T17:50:47.580Z'
display_price: "$19.99"
display_total: "$19.99"
+ price: '19.99'
+ total: '19.99'
relationships:
variant:
data:
- id: '8'
+ id: '56'
type: variant
- id: '4'
type: wished_item
attributes:
quantity: 1
- created_at: '2021-09-27T22:42:06.283Z'
- updated_at: '2021-09-27T22:42:06.283Z'
- price: '19.99'
- total: '19.99'
+ created_at: '2021-10-03T17:50:47.642Z'
+ updated_at: '2021-10-03T17:50:47.642Z'
display_price: "$19.99"
display_total: "$19.99"
+ price: '19.99'
+ total: '19.99'
relationships:
variant:
data:
- id: '10'
+ id: '58'
type: variant
meta:
count: 4
@@ -4372,20 +5594,20 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '9'
type: wished_item
attributes:
quantity: 1
- created_at: '2021-09-27T22:42:06.544Z'
- updated_at: '2021-09-27T22:42:06.544Z'
- price: '19.99'
- total: '19.99'
+ created_at: '2021-10-03T17:50:48.138Z'
+ updated_at: '2021-10-03T17:50:48.138Z'
display_price: "$19.99"
display_total: "$19.99"
+ price: '19.99'
+ total: '19.99'
relationships:
variant:
data:
- id: '2'
+ id: '70'
type: variant
'422':
description: invalid request
@@ -4439,20 +5661,20 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '10'
type: wished_item
attributes:
quantity: 1
- created_at: '2021-09-27T22:42:06.680Z'
- updated_at: '2021-09-27T22:42:06.680Z'
- price: '19.99'
- total: '19.99'
+ created_at: '2021-10-03T17:50:48.421Z'
+ updated_at: '2021-10-03T17:50:48.421Z'
display_price: "$19.99"
display_total: "$19.99"
+ price: '19.99'
+ total: '19.99'
relationships:
variant:
data:
- id: '4'
+ id: '76'
type: variant
'404':
description: Record not found
@@ -4500,20 +5722,20 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '12'
type: wished_item
attributes:
quantity: 3
- created_at: '2021-09-27T22:42:06.886Z'
- updated_at: '2021-09-27T22:42:06.890Z'
- price: '19.99'
- total: '59.97'
+ created_at: '2021-10-03T17:50:48.855Z'
+ updated_at: '2021-10-03T17:50:48.867Z'
display_price: "$19.99"
display_total: "$59.97"
+ price: '19.99'
+ total: '59.97'
relationships:
variant:
data:
- id: '4'
+ id: '86'
type: variant
'422':
description: invalid request
@@ -4622,39 +5844,39 @@ paths:
Example:
value:
data:
- - id: '1'
+ - id: '22'
type: wishlist
attributes:
name: Black Friday
is_private: true
is_default: false
- created_at: '2021-09-27T22:42:07.394Z'
- updated_at: '2021-09-27T22:42:07.394Z'
- token: Nr8hjLVZCvWRa8WAAytPNK9E
+ created_at: '2021-10-03T17:50:49.740Z'
+ updated_at: '2021-10-03T17:50:49.740Z'
+ token: v8PYdmgUUu66MgfumM2Kd6Ao
variant_included: false
relationships:
wished_items:
data:
- - id: '1'
+ - id: '17'
type: wished_item
- - id: '2'
+ - id: '18'
type: wished_item
- - id: '2'
+ - id: '23'
type: wishlist
attributes:
name: Birthday
is_private: true
is_default: false
- created_at: '2021-09-27T22:42:07.396Z'
- updated_at: '2021-09-27T22:42:07.396Z'
- token: YzviFd1H6FqmzmYYoKzgkek6
+ created_at: '2021-10-03T17:50:49.743Z'
+ updated_at: '2021-10-03T17:50:49.743Z'
+ token: UGDS3w2waMXfR2XwbfjHABHh
variant_included: false
relationships:
wished_items:
data:
- - id: '3'
+ - id: '19'
type: wished_item
- - id: '4'
+ - id: '20'
type: wished_item
meta:
count: 2
@@ -4699,15 +5921,15 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '26'
type: wishlist
attributes:
name: Wishlist_26
is_private: true
is_default: false
- created_at: '2021-09-27T22:42:07.677Z'
- updated_at: '2021-09-27T22:42:07.677Z'
- token: YtspLEk3GWr7gioBmsBCw7tf
+ created_at: '2021-10-03T17:50:50.328Z'
+ updated_at: '2021-10-03T17:50:50.328Z'
+ token: VyXGh11iuWXAVcerz4udHkwA
variant_included: false
relationships:
wished_items:
@@ -4761,15 +5983,15 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '27'
type: wishlist
attributes:
name: My Wishlist
is_private: true
is_default: false
- created_at: '2021-09-27T22:42:07.700Z'
- updated_at: '2021-09-27T22:42:07.700Z'
- token: AJNdSqCxTup2bzES8DNnwzsJ
+ created_at: '2021-10-03T17:50:50.377Z'
+ updated_at: '2021-10-03T17:50:50.377Z'
+ token: LQ2BbYEKrQ2hQ37nifC7JRZY
variant_included: false
relationships:
wished_items:
@@ -4820,15 +6042,15 @@ paths:
Example:
value:
data:
- id: '1'
+ id: '29'
type: wishlist
attributes:
name: My Super Wishlist
is_private: true
is_default: false
- created_at: '2021-09-27T22:42:07.735Z'
- updated_at: '2021-09-27T22:42:07.740Z'
- token: DqLANX4PY9o2RCQiEnFnG8Nb
+ created_at: '2021-10-03T17:50:50.466Z'
+ updated_at: '2021-10-03T17:50:50.479Z'
+ token: 14X8kLxwUmgNaZsNSvqo6KfV
variant_included: false
relationships:
wished_items:
@@ -4913,6 +6135,7 @@ tags:
- name: Menus
- name: Option Types
- name: Option Values
+- name: Orders
- name: Taxons
- name: Users
- name: Wishlists
@@ -4983,6 +6206,89 @@ components:
required:
- name
- presentation
+ order_params:
+ type: object
+ properties:
+ number:
+ type: string
+ item_total:
+ type: number
+ total:
+ type: number
+ state:
+ type: string
+ adjustment_total:
+ type: number
+ user_id:
+ type: string
+ completed_at:
+ type: string
+ format: date_time
+ bill_address_id:
+ type: string
+ ship_address_id:
+ type: string
+ payment_total:
+ type: number
+ shipment_state:
+ type: string
+ payment_state:
+ type: string
+ email:
+ type: string
+ format: email
+ special_instructions:
+ type: string
+ created_at:
+ type: string
+ format: date_time
+ updated_at:
+ type: string
+ format: date_time
+ currency:
+ type: string
+ last_ip_address:
+ type: string
+ created_by_id:
+ type: string
+ shipment_total:
+ type: number
+ additional_tax_total:
+ type: number
+ promo_total:
+ type: number
+ channel:
+ type: string
+ included_tax_total:
+ type: number
+ item_count:
+ type: integer
+ approver_id:
+ type: string
+ approved_at:
+ type: string
+ format: date_time
+ confirmation_delivered:
+ type: boolean
+ considered_risky:
+ type: boolean
+ token:
+ type: string
+ canceled_at:
+ type: string
+ format: date_time
+ canceler_id:
+ type: string
+ store_id:
+ type: string
+ state_lock_version:
+ type: integer
+ taxable_adjustment_total:
+ type: number
+ non_taxable_adjustment_total:
+ type: number
+ store_owner_notification_delivered:
+ type: boolean
product_params:
type: object
properties:
diff --git a/api/spec/integration/api/v2/platform/orders_spec.rb b/api/spec/integration/api/v2/platform/orders_spec.rb
new file mode 100644
index 0000000000..061d47052f
--- /dev/null
+++ b/api/spec/integration/api/v2/platform/orders_spec.rb
@@ -0,0 +1,129 @@
+require 'swagger_helper'
+
+describe 'Orders API', swagger: true do
+ include_context 'Platform API v2'
+
+ resource_name = 'Order'
+ resource_path = 'orders'
+ include_example = 'line_items.variants.product'
+ filter_example = 'state_eq=complete'
+
+ let(:persisted_order) { create(:order_with_line_items, state: :delivery) }
+ let(:id) { persisted_order.number }
+ let(:records_list) { create_list(:order, 2) }
+ let(:valid_create_param_value) { build(:order).attributes }
+ let(:valid_update_param_value) do
+ {
+ total: 10.00,
+ }
+ end
+ let(:invalid_param_value) do
+ {
+ email: 'not_valid_email',
+ user_id: nil
+ }
+ end
+
+ path "/api/v2/platform/#{resource_path}" do
+ include_examples 'GET records list', resource_name, include_example, filter_example
+
+ param_name = resource_name.parameterize(separator: '_').to_sym
+ post "Creates #{resource_name.articleize}" do
+ tags resource_name.pluralize
+ consumes 'application/json'
+ security [ bearer_auth: [] ]
+ description "Creates #{resource_name.articleize}"
+ operationId "create-#{resource_name.parameterize.to_sym}"
+ parameter name: param_name, in: :body, schema: { '$ref' => "#/components/schemas/#{param_name}_params" }
+ json_api_include_parameter(include_example)
+
+ let(param_name) { valid_create_param_value }
+
+ it_behaves_like 'record created'
+ # it_behaves_like 'invalid request', param_name
+ end
+ end
+
+ path "/api/v2/platform/#{resource_path}/{id}" do
+ include_examples 'GET record', resource_name, include_example
+ include_examples 'PUT update record', resource_name, include_example
+ include_examples 'DELETE record', resource_name
+ end
+
+ path "/api/v2/platform/#{resource_path}/{id}/advance" do
+ put "Advances #{resource_name.articleize}" do
+ tags resource_name.pluralize
+ security [ bearer_auth: [] ]
+ description "Advances #{resource_name.articleize}"
+ operationId "advance-#{resource_name.parameterize.to_sym}"
+ consumes 'application/json'
+ parameter name: :id, in: :path, type: :string
+ json_api_include_parameter(include_example)
+
+ response '200', 'record updated' do
+ run_test!
+ end
+ it_behaves_like 'record not found'
+ it_behaves_like 'authentication failed'
+ end
+ end
+
+ path "/api/v2/platform/#{resource_path}/{id}/next" do
+ put "Next #{resource_name.articleize}" do
+ tags resource_name.pluralize
+ security [ bearer_auth: [] ]
+ description "Moves #{resource_name.articleize} to the next state"
+ operationId "next-#{resource_name.parameterize.to_sym}"
+ consumes 'application/json'
+ parameter name: :id, in: :path, type: :string
+ json_api_include_parameter(include_example)
+
+ response '200', 'record updated' do
+ run_test!
+ end
+ it_behaves_like 'record not found'
+ it_behaves_like 'authentication failed'
+ end
+ end
+
+ path "/api/v2/platform/#{resource_path}/{id}/complete" do
+ before do
+ create(:payment, amount: persisted_order.total, order: persisted_order)
+ end
+
+ put "Completes #{resource_name.articleize}" do
+ tags resource_name.pluralize
+ security [ bearer_auth: [] ]
+ description "Marks #{resource_name.articleize} as completed"
+ operationId "complete-#{resource_name.parameterize.to_sym}"
+ consumes 'application/json'
+ parameter name: :id, in: :path, type: :string
+ json_api_include_parameter(include_example)
+
+ response '200', 'record updated' do
+ run_test!
+ end
+ it_behaves_like 'record not found'
+ it_behaves_like 'authentication failed'
+ end
+ end
+
+ path "/api/v2/platform/#{resource_path}/{id}/empty" do
+ put "Empties #{resource_name.articleize}" do
+ tags resource_name.pluralize
+ security [ bearer_auth: [] ]
+ description "Removes all line items, promotions, shipment and payments from #{resource_name.articleize}"
+ operationId "empty-#{resource_name.parameterize.to_sym}"
+ consumes 'application/json'
+ parameter name: :id, in: :path, type: :string
+ json_api_include_parameter(include_example)
+
+ response '200', 'record updated' do
+ run_test!
+ end
+ it_behaves_like 'record not found'
+ it_behaves_like 'authentication failed'
+ end
+ end
+end
diff --git a/api/spec/swagger_helper.rb b/api/spec/swagger_helper.rb
index 9e0bd3d11a..19cd60e478 100644
--- a/api/spec/swagger_helper.rb
+++ b/api/spec/swagger_helper.rb
@@ -49,6 +49,7 @@ RSpec.configure do |config|
{ name: 'Menus' },
{ name: 'Option Types' },
{ name: 'Option Values' },
+ { name: 'Orders' },
{ name: 'Taxons' },
{ name: 'Users' },
{ name: 'Wishlists' },
@@ -105,6 +106,48 @@ RSpec.configure do |config|
},
required: %w[name presentation]
},
+ order_params: {
+ type: :object,
+ properties: {
+ number: { type: :string },
+ item_total: { type: :number },
+ total: { type: :number },
+ state: { type: :string },
+ adjustment_total: { type: :number },
+ user_id: { type: :string },
+ completed_at: { type: :string, format: :date_time },
+ bill_address_id: { type: :string },
+ ship_address_id: { type: :string },
+ payment_total: { type: :number },
+ shipment_state: { type: :string },
+ payment_state: { type: :string },
+ email: { type: :string, format: :email },
+ special_instructions: { type: :string },
+ created_at: { type: :string, format: :date_time },
+ updated_at: { type: :string, format: :date_time },
+ currency: { type: :string },
+ last_ip_address: { type: :string },
+ created_by_id: { type: :string },
+ shipment_total: { type: :number },
+ additional_tax_total: { type: :number },
+ promo_total: { type: :number },
+ channel: { type: :string },
+ included_tax_total: { type: :number },
+ item_count: { type: :integer },
+ approver_id: { type: :string },
+ approved_at: { type: :string, format: :date_time },
+ confirmation_delivered: { type: :boolean },
+ considered_risky: { type: :boolean },
+ token: { type: :string },
+ canceled_at: { type: :string, format: :date_time },
+ canceler_id: { type: :string },
+ store_id: { type: :string },
+ state_lock_version: { type: :integer },
+ taxable_adjustment_total: { type: :number },
+ non_taxable_adjustment_total: { type: :number },
+ store_owner_notification_delivered: { type: :boolean }
+ }
+ },
product_params: {
type: :object,
properties: {
diff --git a/core/app/models/spree/order.rb b/core/app/models/spree/order.rb
index eb363198f3..59dd733a81 100644
--- a/core/app/models/spree/order.rb
+++ b/core/app/models/spree/order.rb
@@ -62,8 +62,8 @@ module Spree
remove_transition from: :delivery, to: :confirm, unless: ->(order) { order.confirmation_required? }
end
- self.whitelisted_ransackable_associations = %w[shipments user promotions bill_address ship_address line_items store]
- self.whitelisted_ransackable_attributes = %w[completed_at email number state payment_state shipment_state total considered_risky channel]
+ self.whitelisted_ransackable_associations = %w[shipments user created_by approver canceler promotions bill_address ship_address line_items store]
+ self.whitelisted_ransackable_attributes = %w[completed_at email number state payment_state shipment_state total item_total considered_risky channel]
attr_reader :coupon_code
attr_accessor :temporary_address, :temporary_credit_card