spree_api 6.0.4 → 6.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +3 -5
- data/app/controllers/concerns/spree/api/v3/storefront_gating.rb +4 -2
- data/app/controllers/spree/api/v3/admin/categories_controller.rb +1 -1
- data/app/controllers/spree/api/v3/admin/store_controller.rb +9 -1
- data/app/controllers/spree/api/v3/seller/option_types_controller.rb +41 -0
- data/app/controllers/spree/api/v3/seller/products_controller.rb +35 -0
- data/app/controllers/spree/api/v3/store/carts/store_credits_controller.rb +7 -3
- data/app/controllers/spree/api/v3/store/carts_controller.rb +1 -1
- data/app/controllers/spree/api/v3/store/categories_controller.rb +1 -1
- data/app/controllers/spree/api/v3/store/companies/addresses_controller.rb +1 -1
- data/app/controllers/spree/api/v3/store/store_controller.rb +3 -2
- data/app/request_schemas/spree/api/v3/seller/variant_request_schema.rb +4 -0
- data/app/request_schemas/spree/api/v3/store/address_request_schema.rb +2 -2
- data/app/serializers/spree/api/v3/address_serializer.rb +3 -3
- data/app/serializers/spree/api/v3/admin/address_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/market_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/refund_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/stock_location_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/store_serializer.rb +0 -7
- data/app/serializers/spree/api/v3/base_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/cart_serializer.rb +4 -3
- data/app/serializers/spree/api/v3/country_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/currency_serializer.rb +3 -2
- data/app/serializers/spree/api/v3/locale_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/market_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/price_history_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/price_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/refund_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/seller/address_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/seller/option_type_serializer.rb +18 -0
- data/app/serializers/spree/api/v3/seller/product_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/seller/product_type_serializer.rb +8 -7
- data/app/serializers/spree/api/v3/seller/stock_location_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/stock_location_serializer.rb +3 -3
- data/app/serializers/spree/api/v3/store_serializer.rb +17 -5
- data/app/services/spree/api/v3/request_schema.rb +1 -1
- data/config/routes.rb +6 -1
- data/lib/spree/api/dependencies.rb +5 -5
- data/lib/spree/api/oauth.rb +8 -19
- data/lib/spree/api/openapi/path_sorter.rb +91 -74
- data/lib/spree/api/typelizer_generation.rb +1 -1
- data/openapi/admin.yaml +34718 -34643
- data/openapi/store.yaml +6646 -6604
- metadata +8 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f34f6665b12790e158bff2ef546d9d5b055e1c8e86c2e2331868dbcecda9285f
|
|
4
|
+
data.tar.gz: 64ca7895cf3891dbaf1c0ec665408a42eec99aa197b7788c13f7ce45be151611
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 95a763713fde3a71aa0f01e23761d6dd63a6662f50ca58a21e4c63a5492cb1938c206783d837ad5292fcd008bf4267beba2df7345a1c177d36a97781bb80f936
|
|
7
|
+
data.tar.gz: dea78274d81838b3bce43dbb0db6cf67b393819b1e9ac4ed790d184b95c3f7870c3c83e8f701dac85c9a5ca3ecab46a892b70a8e5869c24a589c77f355d1a07b
|
data/Rakefile
CHANGED
|
@@ -28,10 +28,8 @@ namespace :rswag do
|
|
|
28
28
|
t.rspec_opts = ['--format Rswag::Specs::SwaggerFormatter', '--order defined']
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
# sidebar sections by first-tag-appearance in `paths:`, so reorder paths here
|
|
34
|
-
# so the sidebar follows the `tags:` array.
|
|
31
|
+
# Mintlify orders sidebar groups by first tag appearance in `paths:`, so sort
|
|
32
|
+
# the groups alphabetically (Authentication first).
|
|
35
33
|
Rake::Task['rswag:specs:swaggerize'].enhance do
|
|
36
34
|
$LOAD_PATH.unshift(File.expand_path('lib', __dir__))
|
|
37
35
|
require 'spree/api/openapi/path_sorter'
|
|
@@ -42,7 +40,7 @@ namespace :rswag do
|
|
|
42
40
|
next unless File.exist?(path)
|
|
43
41
|
|
|
44
42
|
if Spree::Api::OpenAPI::PathSorter.sort_file!(path)
|
|
45
|
-
puts "
|
|
43
|
+
puts "Sorted paths and tags → #{path}"
|
|
46
44
|
end
|
|
47
45
|
end
|
|
48
46
|
end
|
|
@@ -43,10 +43,12 @@ module Spree
|
|
|
43
43
|
# Renders a 401 with the shared +authentication_required+ error code.
|
|
44
44
|
# @param message [String] translated error message
|
|
45
45
|
# @param legacy_default [String, nil] deprecated: the two-argument form
|
|
46
|
-
# (key under +spree.+, fallback text) is removed in Spree 6.
|
|
46
|
+
# (key under +spree.+, fallback text) is removed in Spree 6.3
|
|
47
47
|
def render_authentication_required(message, legacy_default = nil)
|
|
48
48
|
unless legacy_default.nil?
|
|
49
|
-
Spree::Deprecation.warn(
|
|
49
|
+
Spree::Deprecation.warn(
|
|
50
|
+
'render_authentication_required(key, default) is deprecated and will be removed in Spree 6.3. Pass the translated message instead.'
|
|
51
|
+
)
|
|
50
52
|
message = I18n.t("spree.#{message}", default: legacy_default)
|
|
51
53
|
end
|
|
52
54
|
|
|
@@ -92,7 +92,7 @@ module Spree
|
|
|
92
92
|
|
|
93
93
|
# Categories exclude automatic (rule-based) rows, which still live in
|
|
94
94
|
# spree_categories until the Phase 4 migration moves them to Collections.
|
|
95
|
-
# No-op after migration; the .manual scope is removed in 6.
|
|
95
|
+
# No-op after migration; the .manual scope is removed in 6.3.
|
|
96
96
|
def scope
|
|
97
97
|
super.manual
|
|
98
98
|
end
|
|
@@ -13,6 +13,14 @@ module Spree
|
|
|
13
13
|
body.attribute :meta_description, :string,
|
|
14
14
|
nullable: true,
|
|
15
15
|
description: "The storefront's default meta description, in the store's default language."
|
|
16
|
+
body.attribute :meta_keywords, :string, nullable: true,
|
|
17
|
+
description: "The storefront's default meta keywords, comma-separated, in the default language."
|
|
18
|
+
body.attribute :facebook, :string, nullable: true, example: 'https://facebook.com/mystore',
|
|
19
|
+
description: 'The Facebook page: a handle or a full URL.'
|
|
20
|
+
body.attribute :twitter, :string, nullable: true, example: 'mystore',
|
|
21
|
+
description: 'The X (Twitter) account: a handle or a full URL.'
|
|
22
|
+
body.attribute :instagram, :string, nullable: true, example: 'mystore',
|
|
23
|
+
description: 'The Instagram account: a handle or a full URL.'
|
|
16
24
|
body.attribute :admin_locale, :locale, nullable: true, example: 'en',
|
|
17
25
|
description: 'The language the dashboard opens in for every staff member; null lets each use their own.'
|
|
18
26
|
body.attribute :timezone, :time_zone, example: 'Europe/Berlin'
|
|
@@ -143,7 +151,7 @@ module Spree
|
|
|
143
151
|
# all, so every signed-in staff member can read it regardless of
|
|
144
152
|
# their permissions. Secret keys still need `read_settings`: a
|
|
145
153
|
# scope-limited integration has no business reading operational
|
|
146
|
-
# settings (
|
|
154
|
+
# settings (notification emails, routing) it wasn't granted.
|
|
147
155
|
# Writing always requires `write_settings`.
|
|
148
156
|
skip_scope_check! only: :show, jwt_only: true
|
|
149
157
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Seller
|
|
5
|
+
# The marketplace's option types (Size, Colour) and their values, for
|
|
6
|
+
# the variants builder on a seller's product form.
|
|
7
|
+
#
|
|
8
|
+
# Read only: a seller builds their variants from the options the
|
|
9
|
+
# operator defines, and never adds a type or a value to that shared
|
|
10
|
+
# vocabulary (docs/plans/6.0-multi-vendor-marketplace.md).
|
|
11
|
+
#
|
|
12
|
+
# Gated on `read_products`, as delivery profiles are, rather than a key
|
|
13
|
+
# of its own: option types and values are resources of the `products`
|
|
14
|
+
# scope on both branches (the operator's endpoint uses it too), and
|
|
15
|
+
# this list exists only for the product form, so a key that may read
|
|
16
|
+
# products may read the vocabulary that form fills in.
|
|
17
|
+
#
|
|
18
|
+
# Option types belong to the store rather than to a seller, so this is
|
|
19
|
+
# not rooted in `current_seller` — the store comes from the seller,
|
|
20
|
+
# which is what keeps it scoped.
|
|
21
|
+
class OptionTypesController < Seller::ResourceController
|
|
22
|
+
scoped_resource :products
|
|
23
|
+
|
|
24
|
+
protected
|
|
25
|
+
|
|
26
|
+
def model_class
|
|
27
|
+
Spree::OptionType
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def serializer_class
|
|
31
|
+
Spree.api.seller_option_type_serializer
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def scope
|
|
35
|
+
model_class.for_store(current_store).preload_associations_lazily.i18n
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -102,6 +102,7 @@ module Spree
|
|
|
102
102
|
|
|
103
103
|
before_action :set_status_resource, only: [:submit, :draft, :archive]
|
|
104
104
|
before_action :require_ids!, only: [:bulk_submit, :bulk_status_update, :bulk_destroy]
|
|
105
|
+
before_action :refuse_unknown_variant_options, only: [:create, :update]
|
|
105
106
|
|
|
106
107
|
# PATCH /api/v3/seller/products/:id/submit
|
|
107
108
|
#
|
|
@@ -303,6 +304,40 @@ module Spree
|
|
|
303
304
|
|
|
304
305
|
private
|
|
305
306
|
|
|
307
|
+
# A seller builds variants from the marketplace's option types and
|
|
308
|
+
# values and never adds to them, but `Variant#options=` creates
|
|
309
|
+
# whatever a payload names. Each option is matched here the way that
|
|
310
|
+
# writer matches it, against this store's vocabulary, so an unknown
|
|
311
|
+
# name is a 422 before anything is written.
|
|
312
|
+
def refuse_unknown_variant_options
|
|
313
|
+
# `create` authorizes inside the action, after this filter: a
|
|
314
|
+
# caller who may not create a product is told that, not which of
|
|
315
|
+
# the marketplace's options their payload missed.
|
|
316
|
+
authorize_resource!(build_resource, :create) if action_name == 'create'
|
|
317
|
+
|
|
318
|
+
requested = Array(params[:variants]).grep(ActionController::Parameters).
|
|
319
|
+
flat_map { |variant| Array(variant[:options]).grep(ActionController::Parameters) }.
|
|
320
|
+
select { |option| option[:name].present? && option[:value].present? }.
|
|
321
|
+
map { |option| [option[:name], option[:value]] }
|
|
322
|
+
unknown = Spree::OptionType.unknown_options(current_store, requested)
|
|
323
|
+
return if unknown.empty?
|
|
324
|
+
|
|
325
|
+
errors = ActiveModel::Errors.new(Spree::Product.new)
|
|
326
|
+
unknown.each do |option|
|
|
327
|
+
if option[:option_type].nil?
|
|
328
|
+
errors.add(:variants, :unknown_option_type,
|
|
329
|
+
message: I18n.t('spree.errors.messages.unknown_option_type', name: option[:name]))
|
|
330
|
+
else
|
|
331
|
+
errors.add(:variants, :unknown_option_value,
|
|
332
|
+
message: I18n.t('spree.errors.messages.unknown_option_value',
|
|
333
|
+
value: option[:value],
|
|
334
|
+
option_type: option[:option_type].label.presence || option[:option_type].name))
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
render_validation_error(errors)
|
|
339
|
+
end
|
|
340
|
+
|
|
306
341
|
# 422s when the caller omits `ids` entirely, matching the operator's
|
|
307
342
|
# bulk endpoints. An explicit empty array is a no-op, which is what a
|
|
308
343
|
# UI whose selection was cleared between render and submit sends.
|
|
@@ -13,8 +13,9 @@ module Spree
|
|
|
13
13
|
|
|
14
14
|
request_params 'ApplyStoreCreditParams', action: :create do |body|
|
|
15
15
|
body.attribute :amount, :decimal,
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
example: '10.00',
|
|
17
|
+
description: 'Defaults to as much as the cart can use. ' \
|
|
18
|
+
'A JSON number is still read until 6.5, with a deprecation warning.'
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
# POST /api/v3/store/carts/:cart_id/store_credits
|
|
@@ -63,7 +64,10 @@ module Spree
|
|
|
63
64
|
def stringify_numeric_amount
|
|
64
65
|
return unless params[:amount].is_a?(Numeric)
|
|
65
66
|
|
|
66
|
-
Spree::Deprecation.warn(
|
|
67
|
+
Spree::Deprecation.warn(
|
|
68
|
+
'Sending the store credit amount as a JSON number is deprecated and will be refused in Spree 6.5. ' \
|
|
69
|
+
'Send a decimal string such as "25.00".'
|
|
70
|
+
)
|
|
67
71
|
params[:amount] = params[:amount].to_s
|
|
68
72
|
end
|
|
69
73
|
end
|
|
@@ -16,7 +16,7 @@ module Spree
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
# Exclude automatic (rule-based) rows still living in spree_categories
|
|
19
|
-
# until the Phase 4 migration moves them to Collections (removed in 6.
|
|
19
|
+
# until the Phase 4 migration moves them to Collections (removed in 6.3).
|
|
20
20
|
def scope
|
|
21
21
|
super.manual
|
|
22
22
|
end
|
|
@@ -12,7 +12,7 @@ module Spree
|
|
|
12
12
|
request_params :company_address do |body|
|
|
13
13
|
body.include_attributes Spree::Api::V3::AddressRequestSchema
|
|
14
14
|
body.require_attributes :first_name, :last_name, :address1, :city, :country_code, on: :create
|
|
15
|
-
body.attribute :zipcode, :string, deprecated: 'Use `postal_code`. Removed in 6.
|
|
15
|
+
body.attribute :zipcode, :string, deprecated: 'Use `postal_code`. Removed in 6.5.'
|
|
16
16
|
body.attribute :default_billing, :boolean,
|
|
17
17
|
permit: false,
|
|
18
18
|
description: "True makes this the node's default billing address, false gives that up, and leaving it out changes nothing."
|
|
@@ -3,9 +3,10 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Store
|
|
5
5
|
# Exposes the store the request resolved to, so a storefront can render
|
|
6
|
-
# its name and default SEO metadata in the requested locale.
|
|
6
|
+
# its name, branding and default SEO metadata in the requested locale.
|
|
7
7
|
class StoreController < Store::BaseController
|
|
8
|
-
# A gated storefront still needs
|
|
8
|
+
# A gated storefront still needs its name, logo and page metadata on
|
|
9
|
+
# its sign-in wall. Every field here is public by nature.
|
|
9
10
|
allow_guest_storefront_access!
|
|
10
11
|
|
|
11
12
|
# GET /api/v3/store/store
|
|
@@ -12,6 +12,10 @@ module Spree
|
|
|
12
12
|
description: 'Per-currency prices. Upserted by currency.'
|
|
13
13
|
attribute :stock_levels, :array, of: Spree::Api::V3::StockLevelRequestSchema,
|
|
14
14
|
description: "Stock per location, at this seller's own locations only: a location belonging to anyone else is ignored."
|
|
15
|
+
definition.describe_attribute :options,
|
|
16
|
+
'One pair per option type the variant takes part in (size, color), naming an option type and ' \
|
|
17
|
+
'value the marketplace already defines (see `GET /option_types`). A seller cannot add to that ' \
|
|
18
|
+
'vocabulary, so an unknown name is refused with a 422.'
|
|
15
19
|
end
|
|
16
20
|
end
|
|
17
21
|
end
|
|
@@ -22,8 +22,8 @@ module Spree
|
|
|
22
22
|
attribute :state_name, :string, description: 'The state name, for countries without predefined states.'
|
|
23
23
|
attribute :quick_checkout, :boolean,
|
|
24
24
|
description: 'Relaxes validation (name, phone, postal code, street), for express checkouts that share a partial address.'
|
|
25
|
-
attribute :country_iso, :string, deprecated: 'Use `country_code`. Removed in 6.
|
|
26
|
-
attribute :state_abbr, :string, deprecated: 'Use `state_code`. Removed in 6.
|
|
25
|
+
attribute :country_iso, :string, deprecated: 'Use `country_code`. Removed in 6.5.'
|
|
26
|
+
attribute :state_abbr, :string, deprecated: 'Use `state_code`. Removed in 6.5.'
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -6,10 +6,10 @@ module Spree
|
|
|
6
6
|
address1: [:string, nullable: true], address2: [:string, nullable: true],
|
|
7
7
|
city: [:string, nullable: true], postal_code: [:string, nullable: true], phone: [:string, nullable: true],
|
|
8
8
|
company: [:string, nullable: true], state_code: [:string, nullable: true],
|
|
9
|
-
state_abbr: [:string, nullable: true, deprecated: 'Use `state_code`. Removed in 6.
|
|
9
|
+
state_abbr: [:string, nullable: true, deprecated: 'Use `state_code`. Removed in 6.5.'],
|
|
10
10
|
state_name: [:string, nullable: true],
|
|
11
11
|
state_text: [:string, nullable: true], country_code: [:string, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
|
|
12
|
-
country_iso: [:string, deprecated: 'Use `country_code`. Removed in 6.
|
|
12
|
+
country_iso: [:string, deprecated: 'Use `country_code`. Removed in 6.5.'],
|
|
13
13
|
country_name: :string,
|
|
14
14
|
quick_checkout: :boolean, is_default_billing: :boolean, is_default_shipping: :boolean,
|
|
15
15
|
label: [:string, nullable: true], owner: { nullable: true }
|
|
@@ -23,7 +23,7 @@ module Spree
|
|
|
23
23
|
:state_code, :quick_checkout, :is_default_billing, :is_default_shipping
|
|
24
24
|
|
|
25
25
|
# @deprecated Storefronts shipped against these names; use +state_code+
|
|
26
|
-
# and +country_code+. Removed in 6.
|
|
26
|
+
# and +country_code+. Removed in 6.5.
|
|
27
27
|
attribute :state_abbr, &:state_code
|
|
28
28
|
attribute :country_iso, &:country_code
|
|
29
29
|
|
|
@@ -3,7 +3,7 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Admin
|
|
5
5
|
class AddressSerializer < V3::AddressSerializer
|
|
6
|
-
# The Store API keeps these deprecated names until 6.
|
|
6
|
+
# The Store API keeps these deprecated names until 6.5.
|
|
7
7
|
%i[state_abbr country_iso].each { |key| _attributes.delete(key) }
|
|
8
8
|
|
|
9
9
|
typelize customer_id: [:string, nullable: true],
|
|
@@ -3,7 +3,7 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Admin
|
|
5
5
|
class MarketSerializer < V3::MarketSerializer
|
|
6
|
-
# The Store API keeps this deprecated name until 6.
|
|
6
|
+
# The Store API keeps this deprecated name until 6.5.
|
|
7
7
|
_attributes.delete(:country_isos)
|
|
8
8
|
|
|
9
9
|
typelize tax_provider: [:string, nullable: true, comment: 'Tax provider; null uses the store default. Built-in: internal. Provider gems register more.']
|
|
@@ -3,7 +3,7 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Admin
|
|
5
5
|
class RefundSerializer < V3::RefundSerializer
|
|
6
|
-
# The Store API keeps this deprecated name until 6.
|
|
6
|
+
# The Store API keeps this deprecated name until 6.5.
|
|
7
7
|
_attributes.delete(:reimbursement_id)
|
|
8
8
|
|
|
9
9
|
typelize payment_id: [:string, nullable: true],
|
|
@@ -3,7 +3,7 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Admin
|
|
5
5
|
class StockLocationSerializer < V3::StockLocationSerializer
|
|
6
|
-
# The Store API keeps these deprecated names until 6.
|
|
6
|
+
# The Store API keeps these deprecated names until 6.5.
|
|
7
7
|
%i[country_iso state_abbr].each { |key| _attributes.delete(key) }
|
|
8
8
|
|
|
9
9
|
include Concerns::ExternalReferencesAttribute
|
|
@@ -9,10 +9,8 @@ module Spree
|
|
|
9
9
|
supported_currencies: [:string, multi: true, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
10
10
|
supported_locales: [:string, multi: true, enum: Spree::Locales::ALL, enum_type_name: 'LocaleCode'],
|
|
11
11
|
available_locales: [:string, multi: true, enum: Spree::Locales::ALL, enum_type_name: 'LocaleCode'],
|
|
12
|
-
logo_url: [:string, nullable: true],
|
|
13
12
|
mailer_logo_url: [:string, nullable: true],
|
|
14
13
|
mail_from_address: [:string, nullable: true],
|
|
15
|
-
customer_support_email: [:string, nullable: true],
|
|
16
14
|
new_order_notifications_email: [:string, nullable: true],
|
|
17
15
|
order_routing_strategy: [:string, comment: 'Order routing strategy. Built-in: rules. Extensions may register more.'],
|
|
18
16
|
payout_provider: [:string, nullable: true, comment: 'Payout provider; null uses the installation default. Built-in: system. Provider gems register more (e.g. stripe).'],
|
|
@@ -25,7 +23,6 @@ module Spree
|
|
|
25
23
|
:default_locale,
|
|
26
24
|
:default_country_code,
|
|
27
25
|
:mail_from_address,
|
|
28
|
-
:customer_support_email,
|
|
29
26
|
:new_order_notifications_email,
|
|
30
27
|
created_at: :iso8601, updated_at: :iso8601
|
|
31
28
|
|
|
@@ -78,10 +75,6 @@ module Spree
|
|
|
78
75
|
Spree::Locales::ALL
|
|
79
76
|
end
|
|
80
77
|
|
|
81
|
-
attribute :logo_url do |store|
|
|
82
|
-
image_url_for(store.logo)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
78
|
attribute :mailer_logo_url do |store|
|
|
86
79
|
image_url_for(store.mailer_logo)
|
|
87
80
|
end
|
|
@@ -82,7 +82,7 @@ module Spree
|
|
|
82
82
|
amount = name.to_s.delete_prefix('display_')
|
|
83
83
|
[:string, nullable: nullable,
|
|
84
84
|
comment: "`#{amount}` formatted with its currency symbol in the request's language.",
|
|
85
|
-
deprecated: "Format `#{amount}` with its currency instead. Removed in 6.
|
|
85
|
+
deprecated: "Format `#{amount}` with its currency instead. Removed in 6.5."]
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
# Declares rates and percentages, written as decimal strings without
|
|
@@ -4,7 +4,8 @@ module Spree
|
|
|
4
4
|
# Store API Cart Serializer
|
|
5
5
|
# Pre-purchase cart data with checkout progression info
|
|
6
6
|
class CartSerializer < BaseSerializer
|
|
7
|
-
typelize number: [:string, deprecated: 'Use `id`; a cart has no order number. Removed in 6.
|
|
7
|
+
typelize number: [:string, deprecated: 'Use `id`; a cart has no order number. Removed in 6.5.'],
|
|
8
|
+
current_step: :string, completed_steps: 'string[]', token: :string,
|
|
8
9
|
email: [:string, nullable: true], customer_note: [:string, nullable: true],
|
|
9
10
|
market_id: [:string, nullable: true], channel_id: [:string, nullable: true], currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
10
11
|
locale: [:string, nullable: true, enum: Spree::Locales::ALL, enum_type_name: 'LocaleCode'], total_quantity: :number, coupon_code: [:string, nullable: true],
|
|
@@ -52,7 +53,7 @@ module Spree
|
|
|
52
53
|
end
|
|
53
54
|
|
|
54
55
|
# @deprecated `number` mirrors `id` (carts have no order-style
|
|
55
|
-
# number) — kept
|
|
56
|
+
# number) — kept until 6.5 for 5.x clients.
|
|
56
57
|
attributes :number, :token, :email, :customer_note, :po_number,
|
|
57
58
|
:currency, :locale, :total_quantity, :warnings, :coupon_code
|
|
58
59
|
|
|
@@ -75,7 +76,7 @@ module Spree
|
|
|
75
76
|
# with its numbers stripped tells them nothing they can act on.
|
|
76
77
|
attribute :requirements do |order|
|
|
77
78
|
# 5.6 storefronts matched the delivery requirement by its field, so
|
|
78
|
-
# it keeps the old name until 6.
|
|
79
|
+
# it keeps the old name until 6.5; `code` already carries the new one.
|
|
79
80
|
requirements = Spree::Checkout::Requirements.new(order).call.map do |requirement|
|
|
80
81
|
requirement[:field] == 'delivery_method' ? requirement.merge(field: 'shipping_method') : requirement
|
|
81
82
|
end
|
|
@@ -6,7 +6,7 @@ module Spree
|
|
|
6
6
|
include Typelizer::DSL
|
|
7
7
|
|
|
8
8
|
typelize iso: [:string, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'], iso3: :string,
|
|
9
|
-
name: [:string, deprecated: 'Name the country from `iso` with `Intl.DisplayNames` (type `region`). Removed in 6.
|
|
9
|
+
name: [:string, deprecated: 'Name the country from `iso` with `Intl.DisplayNames` (type `region`). Removed in 6.5.'],
|
|
10
10
|
states_required: :boolean, zipcode_required: :boolean,
|
|
11
11
|
market: [:Market, nullable: true]
|
|
12
12
|
|
|
@@ -5,8 +5,9 @@ module Spree
|
|
|
5
5
|
include Alba::Resource
|
|
6
6
|
include Typelizer::DSL
|
|
7
7
|
|
|
8
|
-
typelize iso_code: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
9
|
-
|
|
8
|
+
typelize iso_code: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
9
|
+
name: [:string, deprecated: 'Name the currency from `iso_code` with `Intl.DisplayNames` (type `currency`). Removed in 6.5.'],
|
|
10
|
+
symbol: [:string, deprecated: 'Format amounts with `formatMoney` or `Intl.NumberFormat`, which place the symbol. Removed in 6.5.'],
|
|
10
11
|
decimal_places: :number
|
|
11
12
|
|
|
12
13
|
attributes :iso_code, :name, :symbol
|
|
@@ -8,7 +8,7 @@ module Spree
|
|
|
8
8
|
include Typelizer::DSL
|
|
9
9
|
|
|
10
10
|
typelize code: [:string, enum: Spree::Locales::ALL, enum_type_name: 'LocaleCode'],
|
|
11
|
-
name: [:string, deprecated: 'Name the locale from `code` with `Intl.DisplayNames`. Removed in 6.
|
|
11
|
+
name: [:string, deprecated: 'Name the locale from `code` with `Intl.DisplayNames`. Removed in 6.5.'],
|
|
12
12
|
default: :boolean, rtl: :boolean
|
|
13
13
|
|
|
14
14
|
attributes :code, :name
|
|
@@ -6,14 +6,14 @@ module Spree
|
|
|
6
6
|
default_locale: [:string, enum: Spree::Locales::ALL, enum_type_name: 'LocaleCode'],
|
|
7
7
|
supported_locales: [:string, multi: true, enum: Spree::Locales::ALL, enum_type_name: 'LocaleCode'],
|
|
8
8
|
country_codes: [:string, multi: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
|
|
9
|
-
country_isos: [:string, multi: true, deprecated: 'Use `country_codes`. Removed in 6.
|
|
9
|
+
country_isos: [:string, multi: true, deprecated: 'Use `country_codes`. Removed in 6.5.'],
|
|
10
10
|
tax_inclusive: :boolean,
|
|
11
11
|
default: :boolean
|
|
12
12
|
|
|
13
13
|
attributes :name, :currency, :default_locale, :tax_inclusive, :default, :country_codes
|
|
14
14
|
|
|
15
15
|
# @deprecated Storefronts shipped against this name; use +country_codes+.
|
|
16
|
-
# Removed in 6.
|
|
16
|
+
# Removed in 6.5.
|
|
17
17
|
attribute :country_isos, &:country_codes
|
|
18
18
|
|
|
19
19
|
attribute :supported_locales do |market|
|
|
@@ -7,7 +7,7 @@ module Spree
|
|
|
7
7
|
typelize display_amount: display_money_type(:display_amount, nullable: false),
|
|
8
8
|
currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
9
9
|
recorded_at: :string,
|
|
10
|
-
amount_in_cents: [:number, nullable: true, deprecated: 'Use `amount`. Removed in 6.
|
|
10
|
+
amount_in_cents: [:number, nullable: true, deprecated: 'Use `amount`. Removed in 6.5.']
|
|
11
11
|
|
|
12
12
|
attributes :currency
|
|
13
13
|
|
|
@@ -9,8 +9,8 @@ module Spree
|
|
|
9
9
|
display_compare_at_amount: display_money_type(:display_compare_at_amount),
|
|
10
10
|
currency: [:string, nullable: true, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
11
11
|
price_list_id: [:string, nullable: true],
|
|
12
|
-
amount_in_cents: [:number, nullable: true, deprecated: 'Use `amount`. Removed in 6.
|
|
13
|
-
compare_at_amount_in_cents: [:number, nullable: true, deprecated: 'Use `compare_at_amount`. Removed in 6.
|
|
12
|
+
amount_in_cents: [:number, nullable: true, deprecated: 'Use `amount`. Removed in 6.5.'],
|
|
13
|
+
compare_at_amount_in_cents: [:number, nullable: true, deprecated: 'Use `compare_at_amount`. Removed in 6.5.']
|
|
14
14
|
|
|
15
15
|
attributes :currency
|
|
16
16
|
|
|
@@ -7,7 +7,7 @@ module Spree
|
|
|
7
7
|
typelize transaction_id: [:string, nullable: true],
|
|
8
8
|
payment_id: [:string, nullable: true], refund_reason_id: [:string, nullable: true],
|
|
9
9
|
originator_id: [:string, nullable: true], originator_type: [:string, nullable: true],
|
|
10
|
-
reimbursement_id: [:string, nullable: true, deprecated: 'Always null: reimbursements are gone. Use `originator_id`. Removed in 6.
|
|
10
|
+
reimbursement_id: [:string, nullable: true, deprecated: 'Always null: reimbursements are gone. Use `originator_id`. Removed in 6.5.']
|
|
11
11
|
|
|
12
12
|
attributes :transaction_id
|
|
13
13
|
|
|
@@ -24,7 +24,7 @@ module Spree
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# @deprecated Reimbursements were folded into returns, which a refund
|
|
27
|
-
# names as its +originator+. Removed in 6.
|
|
27
|
+
# names as its +originator+. Removed in 6.5.
|
|
28
28
|
attribute(:reimbursement_id) { nil }
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -3,7 +3,7 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Seller
|
|
5
5
|
class AddressSerializer < V3::AddressSerializer
|
|
6
|
-
# The Store API keeps these deprecated names until 6.
|
|
6
|
+
# The Store API keeps these deprecated names until 6.5. A seller
|
|
7
7
|
# keeps no address book of the buyer's, so has no owner to read.
|
|
8
8
|
%i[state_abbr country_iso owner].each { |key| _attributes.delete(key) }
|
|
9
9
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
module Seller
|
|
5
|
+
# An option type as a seller builds variants from it: its name and,
|
|
6
|
+
# when expanded, the values a variant may take.
|
|
7
|
+
#
|
|
8
|
+
# The store shape plus its values, and nothing the operator keeps to
|
|
9
|
+
# maintain the vocabulary — no `metadata`, `filterable` or timestamps.
|
|
10
|
+
class OptionTypeSerializer < V3::OptionTypeSerializer
|
|
11
|
+
many :option_values,
|
|
12
|
+
resource: proc { Spree.api.option_value_serializer },
|
|
13
|
+
if: proc { expand?('option_values') }
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -46,7 +46,7 @@ module Spree
|
|
|
46
46
|
if: proc { expand?('media') }
|
|
47
47
|
|
|
48
48
|
many :option_types,
|
|
49
|
-
resource: proc { Spree.api.
|
|
49
|
+
resource: proc { Spree.api.seller_option_type_serializer },
|
|
50
50
|
if: proc { expand?('option_types') }
|
|
51
51
|
|
|
52
52
|
# Why the marketplace sent this back, so the panel can show it
|
|
@@ -5,19 +5,20 @@ module Spree
|
|
|
5
5
|
# A product type as a seller sees it: something to list against, and
|
|
6
6
|
# what picking it will bring.
|
|
7
7
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
# the form unable to name them, and the warning it exists to show
|
|
13
|
-
# would silently never appear.
|
|
8
|
+
# `option_type_ids` is what the variants builder offers as rows on a
|
|
9
|
+
# new product, resolved against `GET /seller/option_types`. The labels
|
|
10
|
+
# are sent as well, already named, so the form can warn which options
|
|
11
|
+
# the type adds without waiting on that list.
|
|
14
12
|
#
|
|
15
13
|
# No `category_ids` (filing is the operator's, so a seller would be
|
|
16
14
|
# shown a consequence they never see) and no `products_count` or
|
|
17
15
|
# custom field schema, which describe how the operator maintains the
|
|
18
16
|
# type rather than what listing against it does.
|
|
19
17
|
class ProductTypeSerializer < V3::ProductTypeSerializer
|
|
20
|
-
typelize
|
|
18
|
+
typelize option_type_ids: [:string, multi: true],
|
|
19
|
+
option_type_labels: [:string, multi: true]
|
|
20
|
+
|
|
21
|
+
attribute :option_type_ids, &:option_type_prefixed_ids
|
|
21
22
|
|
|
22
23
|
attribute :option_type_labels do |product_type|
|
|
23
24
|
product_type.option_types.map { |option_type| option_type.label.presence || option_type.name }.compact
|
|
@@ -3,7 +3,7 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Seller
|
|
5
5
|
class StockLocationSerializer < V3::StockLocationSerializer
|
|
6
|
-
# The Store API keeps these deprecated names until 6.
|
|
6
|
+
# The Store API keeps these deprecated names until 6.5.
|
|
7
7
|
%i[country_iso state_abbr].each { |key| _attributes.delete(key) }
|
|
8
8
|
|
|
9
9
|
typelize address2: [:string, nullable: true], state_name: [:string, nullable: true],
|
|
@@ -6,15 +6,15 @@ module Spree
|
|
|
6
6
|
zipcode: [:string, nullable: true], country_code: [:string, nullable: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
|
|
7
7
|
country_name: [:string, nullable: true], state_code: [:string, nullable: true],
|
|
8
8
|
state_text: [:string, nullable: true],
|
|
9
|
-
country_iso: [:string, nullable: true, deprecated: 'Use `country_code`. Removed in 6.
|
|
10
|
-
state_abbr: [:string, nullable: true, deprecated: 'Use `state_code`. Removed in 6.
|
|
9
|
+
country_iso: [:string, nullable: true, deprecated: 'Use `country_code`. Removed in 6.5.'],
|
|
10
|
+
state_abbr: [:string, nullable: true, deprecated: 'Use `state_code`. Removed in 6.5.'],
|
|
11
11
|
pickup_ready_in_minutes: [:number, nullable: true],
|
|
12
12
|
pickup_instructions: [:string, nullable: true]
|
|
13
13
|
|
|
14
14
|
attributes :name, :address1, :city, :zipcode, :country_code, :country_name, :state_code, :state_text
|
|
15
15
|
|
|
16
16
|
# @deprecated Storefronts shipped against these names; use +country_code+
|
|
17
|
-
# and +state_code+. Removed in 6.
|
|
17
|
+
# and +state_code+. Removed in 6.5.
|
|
18
18
|
attribute :country_iso, &:country_code
|
|
19
19
|
attribute :state_abbr, &:state_code
|
|
20
20
|
|