spree_api 6.0.0.rc4 → 6.0.0.rc6
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/app/controllers/concerns/spree/api/v3/admin/auth_cookies.rb +23 -0
- data/app/controllers/concerns/spree/api/v3/admin/refund_authorization.rb +26 -0
- data/app/controllers/concerns/spree/api/v3/admin_authentication.rb +1 -0
- data/app/controllers/concerns/spree/api/v3/allowed_redirect_url.rb +27 -0
- data/app/controllers/concerns/spree/api/v3/api_key_authentication.rb +14 -2
- data/app/controllers/concerns/spree/api/v3/cart_resolvable.rb +23 -4
- data/app/controllers/concerns/spree/api/v3/digital_assets_resource.rb +68 -0
- data/app/controllers/concerns/spree/api/v3/error_handler.rb +3 -0
- data/app/controllers/concerns/spree/api/v3/jwt_authentication.rb +27 -1
- data/app/controllers/concerns/spree/api/v3/orders/fulfillment_actions.rb +6 -1
- data/app/controllers/concerns/spree/api/v3/scoped_authorization.rb +6 -2
- data/app/controllers/spree/api/v3/admin/allowed_origins_controller.rb +4 -1
- data/app/controllers/spree/api/v3/admin/auth_controller.rb +32 -5
- data/app/controllers/spree/api/v3/admin/commission_lines_controller.rb +2 -2
- data/app/controllers/spree/api/v3/admin/companies/addresses_controller.rb +7 -1
- data/app/controllers/spree/api/v3/admin/custom_fields_controller.rb +27 -8
- data/app/controllers/spree/api/v3/admin/customer_groups_controller.rb +4 -0
- data/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb +4 -0
- data/app/controllers/spree/api/v3/admin/customers/store_credits_controller.rb +1 -1
- data/app/controllers/spree/api/v3/admin/customers_controller.rb +14 -14
- data/app/controllers/spree/api/v3/admin/delivery_profiles/origin_groups_controller.rb +1 -1
- data/app/controllers/spree/api/v3/admin/delivery_profiles_controller.rb +1 -1
- data/app/controllers/spree/api/v3/admin/gift_cards_controller.rb +1 -8
- data/app/controllers/spree/api/v3/admin/invitation_acceptances_controller.rb +2 -0
- data/app/controllers/spree/api/v3/admin/me_controller.rb +2 -0
- data/app/controllers/spree/api/v3/admin/option_types_controller.rb +13 -0
- data/app/controllers/spree/api/v3/admin/orders/claims_controller.rb +2 -0
- data/app/controllers/spree/api/v3/admin/orders/exchanges_controller.rb +9 -0
- data/app/controllers/spree/api/v3/admin/orders/fulfillments_controller.rb +1 -1
- data/app/controllers/spree/api/v3/admin/orders/payments_controller.rb +7 -4
- data/app/controllers/spree/api/v3/admin/orders/returns_controller.rb +2 -0
- data/app/controllers/spree/api/v3/admin/orders_controller.rb +21 -7
- data/app/controllers/spree/api/v3/admin/package_types_controller.rb +2 -3
- data/app/controllers/spree/api/v3/admin/password_resets_controller.rb +7 -1
- data/app/controllers/spree/api/v3/admin/price_lists_controller.rb +18 -0
- data/app/controllers/spree/api/v3/admin/product_types_controller.rb +12 -1
- data/app/controllers/spree/api/v3/admin/products/digital_assets_controller.rb +5 -109
- data/app/controllers/spree/api/v3/admin/products/variants_controller.rb +7 -5
- data/app/controllers/spree/api/v3/admin/products_controller.rb +33 -6
- data/app/controllers/spree/api/v3/admin/sellers/payouts_controller.rb +4 -3
- data/app/controllers/spree/api/v3/admin/stock_transfers_controller.rb +3 -2
- data/app/controllers/spree/api/v3/admin/store_controller.rb +8 -1
- data/app/controllers/spree/api/v3/admin/tags_controller.rb +11 -9
- data/app/controllers/spree/api/v3/admin/variants_controller.rb +96 -1
- data/app/controllers/spree/api/v3/admin/webhook_endpoints_controller.rb +5 -2
- data/app/controllers/spree/api/v3/oauth/authorizations_controller.rb +17 -6
- data/app/controllers/spree/api/v3/resource_controller.rb +50 -7
- data/app/controllers/spree/api/v3/seller/auth_controller.rb +10 -0
- data/app/controllers/spree/api/v3/seller/invitation_acceptances_controller.rb +2 -0
- data/app/controllers/spree/api/v3/seller/me_controller.rb +4 -0
- data/app/controllers/spree/api/v3/seller/orders_controller.rb +11 -3
- data/app/controllers/spree/api/v3/seller/package_types_controller.rb +2 -2
- data/app/controllers/spree/api/v3/seller/password_resets_controller.rb +5 -1
- data/app/controllers/spree/api/v3/seller/products/digital_assets_controller.rb +67 -0
- data/app/controllers/spree/api/v3/seller/products_controller.rb +11 -63
- data/app/controllers/spree/api/v3/seller/resource_controller.rb +2 -6
- data/app/controllers/spree/api/v3/seller/team_controller.rb +1 -1
- data/app/controllers/spree/api/v3/store/carts/addresses_controller.rb +53 -0
- data/app/controllers/spree/api/v3/store/carts/store_credits_controller.rb +9 -1
- data/app/controllers/spree/api/v3/store/carts_controller.rb +17 -3
- data/app/controllers/spree/api/v3/store/companies/addresses_controller.rb +4 -0
- data/app/controllers/spree/api/v3/store/customer/addresses_controller.rb +4 -0
- data/app/controllers/spree/api/v3/store/customer/data_requests_controller.rb +19 -1
- data/app/controllers/spree/api/v3/store/customer/password_resets_controller.rb +3 -14
- data/app/controllers/spree/api/v3/store/customers_controller.rb +13 -1
- data/app/controllers/spree/api/v3/store/data_request_confirmations_controller.rb +23 -0
- data/app/controllers/spree/api/v3/store/data_requests_controller.rb +56 -0
- data/app/controllers/spree/api/v3/store/delivery_methods_controller.rb +6 -1
- data/app/controllers/spree/api/v3/store/newsletter_subscribers_controller.rb +2 -11
- data/app/controllers/spree/api/v3/store/products/filters_controller.rb +19 -4
- data/app/request_schemas/spree/api/v3/admin/variant_request_schema.rb +21 -0
- data/app/request_schemas/spree/api/v3/digital_asset_request_schema.rb +25 -0
- data/app/request_schemas/spree/api/v3/seller/price_request_schema.rb +20 -0
- data/app/request_schemas/spree/api/v3/seller/variant_request_schema.rb +19 -0
- data/app/request_schemas/spree/api/v3/variant_request_schema.rb +8 -13
- data/app/serializers/concerns/spree/api/v3/digital_asset_details.rb +70 -0
- data/app/serializers/spree/api/v3/address_owner_serializer.rb +27 -0
- data/app/serializers/spree/api/v3/address_serializer.rb +5 -1
- data/app/serializers/spree/api/v3/admin/address_owner_serializer.rb +10 -0
- data/app/serializers/spree/api/v3/admin/address_serializer.rb +1 -10
- data/app/serializers/spree/api/v3/admin/api_key_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/catalog_assignment_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/catalog_price_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/collection_rule_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/collection_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/commission_line_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/admin/commission_rate_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/consent_record_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/delivery_origin_group_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/admin/delivery_profile_serializer.rb +3 -5
- data/app/serializers/spree/api/v3/admin/digital_asset_serializer.rb +3 -47
- data/app/serializers/spree/api/v3/admin/email_template_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/newsletter_subscriber_serializer.rb +1 -0
- data/app/serializers/spree/api/v3/admin/order_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/package_type_serializer.rb +3 -3
- data/app/serializers/spree/api/v3/admin/permission_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/price_history_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/price_list_serializer.rb +9 -4
- data/app/serializers/spree/api/v3/admin/price_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/purchase_order_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/seller_payout_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/admin/seller_requirement_status_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/seller_serializer.rb +3 -5
- data/app/serializers/spree/api/v3/admin/seller_transfer_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/shipping_label_serializer.rb +3 -3
- data/app/serializers/spree/api/v3/admin/stock_location_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/stock_receipt_item_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/admin/stock_receipt_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/stock_transfer_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/store_credit_serializer.rb +3 -5
- data/app/serializers/spree/api/v3/admin/store_serializer.rb +1 -0
- data/app/serializers/spree/api/v3/admin/tax_identifier_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/admin/tax_line_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/admin/variant_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/base_serializer.rb +33 -6
- data/app/serializers/spree/api/v3/claim_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/collection_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/company_invitation_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/company_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/data_request_confirmation_requested_event_serializer.rb +28 -0
- data/app/serializers/spree/api/v3/data_request_event_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/data_request_serializer.rb +8 -4
- data/app/serializers/spree/api/v3/delivery_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/delivery_zone_member_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/discount_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/file_upload_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/fulfillment_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/media_event_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/media_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/newsletter_subscriber_serializer.rb +5 -1
- data/app/serializers/spree/api/v3/option_type_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/order_group_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/order_serializer.rb +4 -2
- data/app/serializers/spree/api/v3/payment_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/product_filter_availability_option_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/product_filter_option_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/seller/address_serializer.rb +3 -2
- data/app/serializers/spree/api/v3/seller/digital_asset_serializer.rb +16 -0
- data/app/serializers/spree/api/v3/seller/order_serializer.rb +3 -3
- data/app/serializers/spree/api/v3/seller/package_type_serializer.rb +3 -3
- data/app/serializers/spree/api/v3/seller/payout_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/seller/profile_serializer.rb +2 -2
- data/app/serializers/spree/api/v3/seller/requirement_status_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/seller/store_serializer.rb +18 -0
- data/app/serializers/spree/api/v3/seller/tax_identifier_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/seller/variant_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/shipping_label_event_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/stock_movement_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/stock_receipt_event_serializer.rb +1 -1
- data/app/serializers/spree/api/v3/variant_serializer.rb +2 -2
- data/app/services/spree/api/v3/filter_table.rb +22 -3
- data/app/services/spree/api/v3/filters_aggregator.rb +63 -18
- data/app/services/spree/api/v3/request_schema.rb +64 -17
- data/config/locales/en.yml +2 -0
- data/config/routes.rb +22 -11
- data/lib/spree/api/agent_write_schemas.rb +15 -3
- data/lib/spree/api/dependencies.rb +4 -4
- data/lib/spree/api/engine.rb +6 -0
- data/lib/spree/api/enum_types.rb +118 -0
- data/lib/spree/api/middleware/no_index.rb +33 -0
- data/lib/spree/api/openapi/filter_documentation.rb +8 -1
- data/lib/spree/api/openapi/schema_helper.rb +2 -1
- data/lib/spree/api/testing_support/v3/base.rb +18 -0
- data/lib/spree/api/typelizer_generation.rb +5 -0
- data/lib/typelizer/open_enums.rb +40 -16
- metadata +25 -6
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
# What a panel shows about a downloadable file: its size, the limits
|
|
5
|
+
# that apply to it, and a short-lived link to check what was uploaded.
|
|
6
|
+
# Shared by the operator's and a seller's serializer, so both panels
|
|
7
|
+
# read the same fields.
|
|
8
|
+
module DigitalAssetDetails
|
|
9
|
+
extend ActiveSupport::Concern
|
|
10
|
+
|
|
11
|
+
# The store whose download settings apply: the request's, or the
|
|
12
|
+
# asset's own outside a request.
|
|
13
|
+
#
|
|
14
|
+
# @param digital_asset [Spree::DigitalAsset]
|
|
15
|
+
# @param params [Hash, nil] the serializer params
|
|
16
|
+
# @return [Spree::Store]
|
|
17
|
+
def self.store_for(digital_asset, params)
|
|
18
|
+
params&.dig(:store) || Spree::Current.store || digital_asset.store
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
included do
|
|
22
|
+
typelize byte_size: [:number, nullable: true],
|
|
23
|
+
authorized_clicks: [:number, nullable: true],
|
|
24
|
+
authorized_days: [:number, nullable: true],
|
|
25
|
+
effective_authorized_clicks: :number,
|
|
26
|
+
effective_authorized_days: :number,
|
|
27
|
+
provider_type: [:string, nullable: true, comment: 'Digital asset provider; null is an uploaded file. Built-in: file. Extensions may register more.'],
|
|
28
|
+
provider_name: [:string, comment: 'Digital asset provider name. Built-in: File. Extensions may register more.'],
|
|
29
|
+
download_url: [:string, nullable: true]
|
|
30
|
+
|
|
31
|
+
attributes :authorized_clicks, :authorized_days, :byte_size
|
|
32
|
+
attributes created_at: :iso8601, updated_at: :iso8601
|
|
33
|
+
|
|
34
|
+
api_type_attributes :provider_type
|
|
35
|
+
|
|
36
|
+
# Human-readable source for the listing. Blank provider_type is the
|
|
37
|
+
# uploaded-file default, so this reads "File" there.
|
|
38
|
+
attribute :provider_name do |digital_asset|
|
|
39
|
+
digital_asset.provider_class.provider_name
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Lets a merchant check what they actually uploaded. Short-lived and
|
|
43
|
+
# panel-only: this is the file itself, not a customer's download
|
|
44
|
+
# grant, so it carries no counter and spends nobody's allowance.
|
|
45
|
+
# Nil for a provider-backed asset (no file to preview) and outside a
|
|
46
|
+
# request (the Disk service needs a host only a controller supplies).
|
|
47
|
+
attribute :download_url do |digital_asset, params|
|
|
48
|
+
next nil unless digital_asset.downloadable?
|
|
49
|
+
|
|
50
|
+
store = DigitalAssetDetails.store_for(digital_asset, params)
|
|
51
|
+
begin
|
|
52
|
+
digital_asset.download_url(expires_in: store.preferred_digital_asset_link_expire_time.seconds)
|
|
53
|
+
rescue ArgumentError
|
|
54
|
+
nil
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# The limits actually applied, after the store-settings fallback.
|
|
59
|
+
attribute :effective_authorized_clicks do |digital_asset, params|
|
|
60
|
+
digital_asset.effective_authorized_clicks(DigitalAssetDetails.store_for(digital_asset, params))
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
attribute :effective_authorized_days do |digital_asset, params|
|
|
64
|
+
digital_asset.effective_authorized_days(DigitalAssetDetails.store_for(digital_asset, params))
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Api
|
|
3
|
+
module V3
|
|
4
|
+
# Which address book an entry came out of. A checkout offering the
|
|
5
|
+
# buyer's own addresses beside their company's sites has to label the
|
|
6
|
+
# two, and the owner is the only thing that tells a warehouse from
|
|
7
|
+
# somebody's flat.
|
|
8
|
+
class AddressOwnerSerializer < BaseSerializer
|
|
9
|
+
typelize type: [:string, enum: %w[customer company seller], enum_type_name: 'AddressOwnerType'],
|
|
10
|
+
name: [:string, nullable: true]
|
|
11
|
+
|
|
12
|
+
attribute :type do |owner|
|
|
13
|
+
Spree::Base.polymorphic_api_type(owner.class.to_s)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# What to call the book. A company node answers with its own name, so
|
|
17
|
+
# a division's own sites and the headquarters sites it inherits are
|
|
18
|
+
# told apart rather than filed under one heading. A customer's book is
|
|
19
|
+
# the caller's own and needs no name — "your addresses" is the client's
|
|
20
|
+
# word for it, in the shopper's language.
|
|
21
|
+
attribute :name do |owner|
|
|
22
|
+
owner.name if owner.is_a?(Spree::Company)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -12,7 +12,7 @@ module Spree
|
|
|
12
12
|
country_iso: [:string, deprecated: 'Use `country_code`. Removed in 6.1.'],
|
|
13
13
|
country_name: :string,
|
|
14
14
|
quick_checkout: :boolean, is_default_billing: :boolean, is_default_shipping: :boolean,
|
|
15
|
-
label: [:string, nullable: true]
|
|
15
|
+
label: [:string, nullable: true], owner: { nullable: true }
|
|
16
16
|
|
|
17
17
|
# What the address is filed under in whichever book owns it — a
|
|
18
18
|
# customer's ("Home") or a company node's ("Northern Warehouse").
|
|
@@ -31,6 +31,10 @@ module Spree
|
|
|
31
31
|
attribute :state_name do |address|
|
|
32
32
|
address.state_name.presence || address.state&.name
|
|
33
33
|
end
|
|
34
|
+
|
|
35
|
+
# The address book the entry belongs to. Null for an address in no
|
|
36
|
+
# book: one a guest typed in, or the copy a placed order keeps.
|
|
37
|
+
one :owner, resource: proc { Spree.api.address_owner_serializer }
|
|
34
38
|
end
|
|
35
39
|
end
|
|
36
40
|
end
|
|
@@ -7,8 +7,6 @@ module Spree
|
|
|
7
7
|
%i[state_abbr country_iso].each { |key| _attributes.delete(key) }
|
|
8
8
|
|
|
9
9
|
typelize customer_id: [:string, nullable: true],
|
|
10
|
-
owner_id: [:string, nullable: true],
|
|
11
|
-
owner_type: [:string, nullable: true],
|
|
12
10
|
latitude: [:number, nullable: true],
|
|
13
11
|
longitude: [:number, nullable: true],
|
|
14
12
|
metadata: 'Record<string, unknown>'
|
|
@@ -29,14 +27,7 @@ module Spree
|
|
|
29
27
|
|
|
30
28
|
prefixed_id_attributes customer_id: :customer_owner
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
# seller's billing address. `customer_id` above stays as the
|
|
34
|
-
# customer-only shorthand the customers surface reads.
|
|
35
|
-
prefixed_id_attributes :owner
|
|
36
|
-
|
|
37
|
-
attribute :owner_type do |address|
|
|
38
|
-
Spree::Base.polymorphic_api_type(address.owner_type)
|
|
39
|
-
end
|
|
30
|
+
one :owner, resource: proc { Spree.api.admin_address_owner_serializer }
|
|
40
31
|
end
|
|
41
32
|
end
|
|
42
33
|
end
|
|
@@ -12,7 +12,7 @@ module Spree
|
|
|
12
12
|
# via {#plaintext_token} below — it is `nil` everywhere else.
|
|
13
13
|
class ApiKeySerializer < V3::BaseSerializer
|
|
14
14
|
typelize name: :string,
|
|
15
|
-
key_type: [:string, enum: Spree::ApiKey::KEY_TYPES],
|
|
15
|
+
key_type: [:string, enum: Spree::ApiKey::KEY_TYPES, enum_type_name: 'ApiKeyType'],
|
|
16
16
|
token_prefix: [:string, nullable: true],
|
|
17
17
|
plaintext_token: [:string, nullable: true],
|
|
18
18
|
scopes: [:string, multi: true],
|
|
@@ -3,7 +3,7 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Admin
|
|
5
5
|
class CatalogAssignmentSerializer < V3::BaseSerializer
|
|
6
|
-
typelize catalog_id: :string, assignable_type: :string, assignable_id: :string,
|
|
6
|
+
typelize catalog_id: :string, assignable_type: [:string, enum: Spree::CatalogAssignment::ASSIGNABLE_TYPES.map { |type| Spree::Base.polymorphic_api_type(type) }, enum_type_name: 'CatalogAssignableType'], assignable_id: :string,
|
|
7
7
|
assignable_name: [:string, nullable: true]
|
|
8
8
|
|
|
9
9
|
attributes created_at: :iso8601
|
|
@@ -17,7 +17,7 @@ module Spree
|
|
|
17
17
|
_attributes.delete(:id)
|
|
18
18
|
|
|
19
19
|
typelize id: 'string | null', label: 'string | null', sku: 'string | null',
|
|
20
|
-
currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'], source: [:string, enum: Spree::CatalogPrice::SOURCES], break_count: :number
|
|
20
|
+
currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'], source: [:string, enum: Spree::CatalogPrice::SOURCES, enum_type_name: 'CatalogPriceSource'], break_count: :number
|
|
21
21
|
|
|
22
22
|
# The variant this prices, so a row can name what it is showing —
|
|
23
23
|
# a product's variants can be priced differently, and one figure
|
|
@@ -8,7 +8,7 @@ module Spree
|
|
|
8
8
|
# wire shorthand (e.g. "tag"), matching every other typed-rule
|
|
9
9
|
# serializer and what the writer accepts.
|
|
10
10
|
class CollectionRuleSerializer < BaseSerializer
|
|
11
|
-
typelize type: [:string, comment: 'Rule type. Built-in: tag, available_on, sale. Extensions may register more.'], value: [:string, nullable: true], match_policy: [:string, enum: Spree::CollectionRule::MATCH_POLICIES]
|
|
11
|
+
typelize type: [:string, comment: 'Rule type. Built-in: tag, available_on, sale. Extensions may register more.'], value: [:string, nullable: true], match_policy: [:string, enum: Spree::CollectionRule::MATCH_POLICIES, enum_type_name: 'CollectionRuleMatchPolicy']
|
|
12
12
|
|
|
13
13
|
attributes :value, :match_policy
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@ module Spree
|
|
|
8
8
|
class CollectionSerializer < V3::CollectionSerializer
|
|
9
9
|
include Spree::Api::V3::Admin::Translatable
|
|
10
10
|
|
|
11
|
-
typelize automatic: :boolean, rules_match_policy: [:string, enum: Spree::Collection::RULES_MATCH_POLICIES],
|
|
11
|
+
typelize automatic: :boolean, rules_match_policy: [:string, enum: Spree::Collection::RULES_MATCH_POLICIES, enum_type_name: 'MatchPolicy'],
|
|
12
12
|
metadata: 'Record<string, unknown>'
|
|
13
13
|
|
|
14
14
|
attributes :automatic, :rules_match_policy, :metadata,
|
|
@@ -19,8 +19,8 @@ module Spree
|
|
|
19
19
|
line_item_id: 'string | null',
|
|
20
20
|
fulfillment_id: 'string | null',
|
|
21
21
|
commission_rate_id: 'string | null',
|
|
22
|
-
kind: [:string, enum: Spree::CommissionRate::KINDS],
|
|
23
|
-
taxability_reason:
|
|
22
|
+
kind: [:string, enum: Spree::CommissionRate::KINDS, enum_type_name: 'CommissionKind'],
|
|
23
|
+
taxability_reason: [:string, nullable: true, enum: Spree::TaxLine::BUILT_IN_TAXABILITY_REASONS, enum_type_name: 'TaxabilityReason'],
|
|
24
24
|
country_code: [:string, nullable: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'],
|
|
25
25
|
state_code: 'string | null',
|
|
26
26
|
currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode']
|
|
@@ -15,7 +15,7 @@ module Spree
|
|
|
15
15
|
enabled: :boolean,
|
|
16
16
|
position: :number,
|
|
17
17
|
global: :boolean,
|
|
18
|
-
kind: [:string, enum: Spree::CommissionRate::KINDS],
|
|
18
|
+
kind: [:string, enum: Spree::CommissionRate::KINDS, enum_type_name: 'CommissionKind'],
|
|
19
19
|
amounts: 'Record<string, string>',
|
|
20
20
|
bounds: 'Record<string, { min_amount: string | null; max_amount: string | null }>',
|
|
21
21
|
tax_inclusive: :boolean,
|
|
@@ -5,7 +5,7 @@ module Spree
|
|
|
5
5
|
# Admin API Consent Record Serializer
|
|
6
6
|
# The evidence trail behind a customer's consent state.
|
|
7
7
|
class ConsentRecordSerializer < BaseSerializer
|
|
8
|
-
typelize purpose: :string, source: [:string, enum: Spree::ConsentRecord::SOURCES], accepted: :boolean,
|
|
8
|
+
typelize purpose: :string, source: [:string, enum: Spree::ConsentRecord::SOURCES, enum_type_name: 'ConsentSource'], accepted: :boolean,
|
|
9
9
|
email: [:string, nullable: true],
|
|
10
10
|
ip_address: [:string, nullable: true],
|
|
11
11
|
recorded_at: [:string, nullable: true],
|
|
@@ -19,11 +19,11 @@ module Spree
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
attribute :delivery_zones_count do |record|
|
|
22
|
-
record.delivery_zones.
|
|
22
|
+
record.delivery_zones.size
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
attribute :delivery_methods_count do |record|
|
|
26
|
-
record.delivery_methods.
|
|
26
|
+
record.delivery_methods.size
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
@@ -47,16 +47,14 @@ module Spree
|
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
attribute :products_count
|
|
51
|
-
record.products.count
|
|
52
|
-
end
|
|
50
|
+
attribute :products_count, &:products_count
|
|
53
51
|
|
|
54
52
|
attribute :delivery_methods_count do |record|
|
|
55
|
-
record.delivery_methods.
|
|
53
|
+
record.delivery_methods.size
|
|
56
54
|
end
|
|
57
55
|
|
|
58
56
|
attribute :delivery_zones_count do |record|
|
|
59
|
-
record.delivery_zones.
|
|
57
|
+
record.delivery_zones.size
|
|
60
58
|
end
|
|
61
59
|
end
|
|
62
60
|
end
|
|
@@ -5,55 +5,11 @@ module Spree
|
|
|
5
5
|
module V3
|
|
6
6
|
module Admin
|
|
7
7
|
class DigitalAssetSerializer < V3::DigitalAssetSerializer
|
|
8
|
-
|
|
9
|
-
authorized_clicks: [:number, nullable: true],
|
|
10
|
-
authorized_days: [:number, nullable: true],
|
|
11
|
-
effective_authorized_clicks: :number,
|
|
12
|
-
effective_authorized_days: :number,
|
|
13
|
-
provider_type: [:string, nullable: true, comment: 'Digital asset provider; null is an uploaded file. Built-in: file. Extensions may register more.'],
|
|
14
|
-
provider_name: [:string, comment: 'Digital asset provider name. Built-in: File. Extensions may register more.'],
|
|
15
|
-
provider_settings: 'Record<string, unknown>',
|
|
16
|
-
download_url: [:string, nullable: true]
|
|
8
|
+
include Spree::Api::V3::DigitalAssetDetails
|
|
17
9
|
|
|
18
|
-
|
|
19
|
-
attributes created_at: :iso8601, updated_at: :iso8601
|
|
10
|
+
typelize provider_settings: 'Record<string, unknown>'
|
|
20
11
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
# Human-readable source for the admin listing. Blank provider_type is
|
|
24
|
-
# the uploaded-file default, so this reads "File" there.
|
|
25
|
-
attribute :provider_name do |digital_asset|
|
|
26
|
-
digital_asset.provider_class.provider_name
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Lets a merchant check what they actually uploaded. Short-lived and
|
|
30
|
-
# admin-only: this is the file itself, not a customer's download
|
|
31
|
-
# grant, so it carries no counter and spends nobody's allowance.
|
|
32
|
-
# Nil for a provider-backed asset (no file to preview) and outside a
|
|
33
|
-
# request (the Disk service needs a host only a controller supplies).
|
|
34
|
-
attribute :download_url do |digital_asset, params|
|
|
35
|
-
next nil unless digital_asset.downloadable?
|
|
36
|
-
|
|
37
|
-
store = params&.dig(:store) || Spree::Current.store || digital_asset.store
|
|
38
|
-
begin
|
|
39
|
-
digital_asset.download_url(expires_in: store.preferred_digital_asset_link_expire_time.seconds)
|
|
40
|
-
rescue ArgumentError
|
|
41
|
-
nil
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# The limits actually applied, after the store-settings fallback. The
|
|
46
|
-
# request's store answers it — an admin request always carries one;
|
|
47
|
-
# the asset's own store covers serialization outside a request.
|
|
48
|
-
attribute :effective_authorized_clicks do |digital_asset, params|
|
|
49
|
-
store = params&.dig(:store) || Spree::Current.store || digital_asset.store
|
|
50
|
-
digital_asset.effective_authorized_clicks(store)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
attribute :effective_authorized_days do |digital_asset, params|
|
|
54
|
-
store = params&.dig(:store) || Spree::Current.store || digital_asset.store
|
|
55
|
-
digital_asset.effective_authorized_days(store)
|
|
56
|
-
end
|
|
12
|
+
attributes :provider_settings
|
|
57
13
|
end
|
|
58
14
|
end
|
|
59
15
|
end
|
|
@@ -7,7 +7,7 @@ module Spree
|
|
|
7
7
|
# default, and the draft in progress.
|
|
8
8
|
class EmailTemplateSerializer < V3::BaseSerializer
|
|
9
9
|
typelize key: :string,
|
|
10
|
-
kind: [:string, enum: Spree::Emails::EditableTemplates::KINDS.map(&:to_s)],
|
|
10
|
+
kind: [:string, enum: Spree::Emails::EditableTemplates::KINDS.map(&:to_s), enum_type_name: 'EmailTemplateKind'],
|
|
11
11
|
language: :string,
|
|
12
12
|
customized: :boolean,
|
|
13
13
|
customized_languages: [:string, multi: true],
|
|
@@ -8,6 +8,7 @@ module Spree
|
|
|
8
8
|
# Back-office surface, nested under the admin customer serializer. Extends the
|
|
9
9
|
# customer-facing serializer so public fields stay in sync.
|
|
10
10
|
class NewsletterSubscriberSerializer < V3::NewsletterSubscriberSerializer
|
|
11
|
+
prefixed_id_attributes :customer
|
|
11
12
|
end
|
|
12
13
|
end
|
|
13
14
|
end
|
|
@@ -31,7 +31,7 @@ module Spree
|
|
|
31
31
|
total: [:string, nullable: false],
|
|
32
32
|
amount_due: [:string, nullable: false]
|
|
33
33
|
|
|
34
|
-
typelize status: [:string, enum: Spree::Order::STATUSES],
|
|
34
|
+
typelize status: [:string, enum: Spree::Order::STATUSES, enum_type_name: 'OrderStatus'],
|
|
35
35
|
last_ip_address: [:string, nullable: true],
|
|
36
36
|
considered_risky: :boolean, confirmation_delivered: :boolean,
|
|
37
37
|
store_owner_notification_delivered: [:boolean, nullable: true],
|
|
@@ -7,14 +7,14 @@ module Spree
|
|
|
7
7
|
# only — a shopper never picks their packaging.
|
|
8
8
|
class PackageTypeSerializer < V3::BaseSerializer
|
|
9
9
|
typelize name: :string,
|
|
10
|
-
kind: [:string, enum: Spree::PackageType::KINDS],
|
|
10
|
+
kind: [:string, enum: Spree::PackageType::KINDS, enum_type_name: 'PackageTypeKind'],
|
|
11
11
|
length: [:string, nullable: true],
|
|
12
12
|
width: [:string, nullable: true],
|
|
13
13
|
height: [:string, nullable: true],
|
|
14
|
-
dimensions_unit: [:string, enum: Spree::Variant::DIMENSION_UNITS],
|
|
14
|
+
dimensions_unit: [:string, enum: Spree::Variant::DIMENSION_UNITS, enum_type_name: 'DimensionUnit'],
|
|
15
15
|
weight: [:string, nullable: true],
|
|
16
16
|
max_weight: [:string, nullable: true],
|
|
17
|
-
weight_unit: [:string, enum: Spree::Variant::WEIGHT_UNITS],
|
|
17
|
+
weight_unit: [:string, enum: Spree::Variant::WEIGHT_UNITS, enum_type_name: 'WeightUnit'],
|
|
18
18
|
volume: [:string, nullable: true],
|
|
19
19
|
default: :boolean,
|
|
20
20
|
seller_id: [:string, nullable: true],
|
|
@@ -10,7 +10,7 @@ module Spree
|
|
|
10
10
|
include Alba::Resource
|
|
11
11
|
include Typelizer::DSL
|
|
12
12
|
|
|
13
|
-
typelize key: :string, resource: :string, kind: [:string, enum: %w[read write]], group: :string,
|
|
13
|
+
typelize key: :string, resource: :string, kind: [:string, enum: %w[read write], enum_type_name: 'PermissionKind'], group: :string,
|
|
14
14
|
group_label: :string, label: :string, description: :string
|
|
15
15
|
|
|
16
16
|
attributes :key
|
|
@@ -14,7 +14,7 @@ module Spree
|
|
|
14
14
|
starts_at: 'string | null',
|
|
15
15
|
ends_at: 'string | null',
|
|
16
16
|
deleted_at: 'string | null',
|
|
17
|
-
match_policy: [:string, enum: Spree::PriceList::MATCH_POLICIES],
|
|
17
|
+
match_policy: [:string, enum: Spree::PriceList::MATCH_POLICIES, enum_type_name: 'MatchPolicy'],
|
|
18
18
|
price_adjustment_percentage: 'string | null',
|
|
19
19
|
adjust_compare_at: :boolean,
|
|
20
20
|
automatic_pricing: :boolean,
|
|
@@ -34,13 +34,18 @@ module Spree
|
|
|
34
34
|
attribute :currently_active, &:currently_active?
|
|
35
35
|
|
|
36
36
|
# Cheap counts so the index can render "12 products / 36 prices"
|
|
37
|
-
# without forcing each row to expand the children.
|
|
37
|
+
# without forcing each row to expand the children. The index counts
|
|
38
|
+
# the whole page at once; a single list asks for its own.
|
|
38
39
|
attribute :products_count do |pl|
|
|
39
|
-
|
|
40
|
+
counts = params[:products_counts]
|
|
41
|
+
|
|
42
|
+
(counts || Spree::PriceList.products_count_by_list(pl.id)).fetch(pl.id, 0)
|
|
40
43
|
end
|
|
41
44
|
|
|
42
45
|
attribute :prices_count do |pl|
|
|
43
|
-
|
|
46
|
+
counts = params[:prices_counts]
|
|
47
|
+
|
|
48
|
+
counts ? counts.fetch(pl.id, 0) : pl.prices.count
|
|
44
49
|
end
|
|
45
50
|
|
|
46
51
|
# Always expanded: a list's bands are the rest of the sentence its
|
|
@@ -6,7 +6,7 @@ module Spree
|
|
|
6
6
|
# the merchant owes and expects, which no customer ever sees.
|
|
7
7
|
class PurchaseOrderSerializer < V3::BaseSerializer
|
|
8
8
|
typelize number: :string,
|
|
9
|
-
status: :string,
|
|
9
|
+
status: [:string, enum: Spree::PurchaseOrder.statuses, enum_type_name: 'PurchaseOrderStatus'],
|
|
10
10
|
currency: [:string, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
11
11
|
reference: 'string | null',
|
|
12
12
|
notes: 'string | null',
|
|
@@ -32,8 +32,8 @@ module Spree
|
|
|
32
32
|
#
|
|
33
33
|
# Read from a count the controller made for the whole page when there
|
|
34
34
|
# is one; a single payout read falls back to asking for its own.
|
|
35
|
-
attribute(:transfers_count) do |payout
|
|
36
|
-
counts = params
|
|
35
|
+
attribute(:transfers_count) do |payout|
|
|
36
|
+
counts = params[:transfer_counts]
|
|
37
37
|
|
|
38
38
|
counts ? counts.fetch(payout.id, 0) : payout.transfers.count
|
|
39
39
|
end
|
|
@@ -12,7 +12,7 @@ module Spree
|
|
|
12
12
|
|
|
13
13
|
typelize id: :string, kind: [:string, comment: 'Requirement kind. Built-in: accept_terms, complete_profile, billing_address, returns_address, delivery_method, package_type, minimum_products, payout_account, required_custom_fields, policy, attestation, operator_review, document. Extensions may register more.'], name: :string,
|
|
14
14
|
description: [:string, nullable: true],
|
|
15
|
-
required: :boolean, position: :number, status: [:string, enum: Spree::SellerRequirementStatus::STATUSES],
|
|
15
|
+
required: :boolean, position: :number, status: [:string, enum: Spree::SellerRequirementStatus::STATUSES, enum_type_name: 'SellerRequirementState'],
|
|
16
16
|
blocking: :boolean, action_url: [:string, nullable: true],
|
|
17
17
|
blocker: ['{ state: string; message: string | null } | null'],
|
|
18
18
|
required_policy_name: [:string, nullable: true]
|
|
@@ -10,8 +10,8 @@ module Spree
|
|
|
10
10
|
legal_name: [:string, nullable: true],
|
|
11
11
|
registration_number: [:string, nullable: true],
|
|
12
12
|
contact_email: [:string, nullable: true], billing_email: [:string, nullable: true],
|
|
13
|
-
tax_remittance: :string,
|
|
14
|
-
payouts_schedule_interval: [:string, nullable: true],
|
|
13
|
+
tax_remittance: [:string, enum: Spree::Seller::TAX_REMITTANCES, enum_type_name: 'TaxRemittance'],
|
|
14
|
+
payouts_schedule_interval: [:string, nullable: true, enum: Spree::Seller::PAYOUT_INTERVALS, enum_type_name: 'PayoutScheduleInterval'],
|
|
15
15
|
minimum_payout_amount: [:string, nullable: true],
|
|
16
16
|
holiday_mode_until: [:string, nullable: true],
|
|
17
17
|
terms_accepted_at: [:string, nullable: true],
|
|
@@ -54,9 +54,7 @@ module Spree
|
|
|
54
54
|
# so the minimum-products requirement asks the same question free.
|
|
55
55
|
attributes :products_count
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
seller.users.size
|
|
59
|
-
end
|
|
57
|
+
attributes :users_count
|
|
60
58
|
|
|
61
59
|
# How far through the marketplace's checklist this seller is — what
|
|
62
60
|
# the list's progress column and the profile's badge render. The
|
|
@@ -14,7 +14,7 @@ module Spree
|
|
|
14
14
|
refund_id: 'string | null',
|
|
15
15
|
seller_name: 'string | null',
|
|
16
16
|
order_number: 'string | null',
|
|
17
|
-
kind: [:string, enum: Spree::SellerTransfer::KINDS],
|
|
17
|
+
kind: [:string, enum: Spree::SellerTransfer::KINDS, enum_type_name: 'SellerTransferKind'],
|
|
18
18
|
status: [:string, enum: Spree::SellerTransfer.statuses, enum_type_name: 'SellerTransferStatus'],
|
|
19
19
|
provider: [:string, comment: 'Payout provider. Built-in: system. Provider gems register more (e.g. stripe).'],
|
|
20
20
|
amount: :string,
|
|
@@ -7,15 +7,15 @@ module Spree
|
|
|
7
7
|
# The file is streamed through +download_url+, never linked to storage.
|
|
8
8
|
class ShippingLabelSerializer < V3::BaseSerializer
|
|
9
9
|
typelize owner_id: :string,
|
|
10
|
-
owner_type: [:string, enum: Spree::ShippingLabel::OWNER_TYPES.map { |type| Spree::Base.polymorphic_api_type(type) }],
|
|
11
|
-
source: [:string, enum: Spree::ShippingLabel::SOURCES],
|
|
10
|
+
owner_type: [:string, enum: Spree::ShippingLabel::OWNER_TYPES.map { |type| Spree::Base.polymorphic_api_type(type) }, enum_type_name: 'ShippingLabelOwnerType'],
|
|
11
|
+
source: [:string, enum: Spree::ShippingLabel::SOURCES, enum_type_name: 'ShippingLabelSource'],
|
|
12
12
|
status: [:string, enum: Spree::ShippingLabel.statuses, enum_type_name: 'ShippingLabelStatus'],
|
|
13
13
|
carrier: [:string, nullable: true],
|
|
14
14
|
carrier_name: [:string, nullable: true],
|
|
15
15
|
service: [:string, nullable: true],
|
|
16
16
|
tracking_number: [:string, nullable: true],
|
|
17
17
|
currency: [:string, nullable: true, enum: Spree::Money::Rounding::CURRENCY_CODES, enum_type_name: 'CurrencyCode'],
|
|
18
|
-
format: [:string, nullable: true],
|
|
18
|
+
format: [:string, nullable: true, enum: Spree::ShippingLabel::FORMATS, enum_type_name: 'ShippingLabelFormat'],
|
|
19
19
|
external_id: [:string, nullable: true],
|
|
20
20
|
integration_id: [:string, nullable: true],
|
|
21
21
|
download_url: [:string, nullable: true],
|
|
@@ -15,7 +15,7 @@ module Spree
|
|
|
15
15
|
address2: [:string, nullable: true], state_name: [:string, nullable: true],
|
|
16
16
|
phone: [:string, nullable: true], company: [:string, nullable: true],
|
|
17
17
|
kind: [:string, enum: Spree::StockLocation::KINDS, enum_type_name: 'StockLocationKind'],
|
|
18
|
-
pickup_stock_policy: [:string, enum: Spree::StockLocation::PICKUP_STOCK_POLICIES],
|
|
18
|
+
pickup_stock_policy: [:string, enum: Spree::StockLocation::PICKUP_STOCK_POLICIES, enum_type_name: 'PickupStockPolicy'],
|
|
19
19
|
pickup_ready_in_minutes: [:number, nullable: true],
|
|
20
20
|
pickup_instructions: [:string, nullable: true]
|
|
21
21
|
|
|
@@ -7,9 +7,9 @@ module Spree
|
|
|
7
7
|
class StockReceiptItemSerializer < V3::BaseSerializer
|
|
8
8
|
typelize quantity_accepted: :number,
|
|
9
9
|
quantity_rejected: :number,
|
|
10
|
-
rejection_reason: [:string, enum: Spree::StockReceiptItem::REJECTION_REASONS, nullable: true],
|
|
10
|
+
rejection_reason: [:string, enum: Spree::StockReceiptItem::REJECTION_REASONS, nullable: true, enum_type_name: 'StockReceiptRejectionReason'],
|
|
11
11
|
notes: 'string | null',
|
|
12
|
-
line_type: [:string, enum: %w[purchase_order_item stock_transfer_item]],
|
|
12
|
+
line_type: [:string, enum: %w[purchase_order_item stock_transfer_item], enum_type_name: 'StockReceiptLineType'],
|
|
13
13
|
line_id: 'string | null',
|
|
14
14
|
product_id: 'string | null',
|
|
15
15
|
variant_id: 'string | null',
|
|
@@ -9,7 +9,7 @@ module Spree
|
|
|
9
9
|
reference: 'string | null',
|
|
10
10
|
notes: 'string | null',
|
|
11
11
|
received_at: :string,
|
|
12
|
-
receivable_type: [:string, enum: %w[purchase_order stock_transfer]],
|
|
12
|
+
receivable_type: [:string, enum: %w[purchase_order stock_transfer], enum_type_name: 'StockReceiptReceivableType'],
|
|
13
13
|
receivable_id: :string,
|
|
14
14
|
received_by_id: 'string | null',
|
|
15
15
|
received_by_type: [:string, nullable: true, enum: Spree::Actor::BUILT_IN_KINDS, enum_type_name: 'ActorKind'],
|
|
@@ -6,7 +6,7 @@ module Spree
|
|
|
6
6
|
# has a middle: `shipped_at` is when the units left the source,
|
|
7
7
|
# `received_at` when the destination finished counting them in.
|
|
8
8
|
class StockTransferSerializer < V3::StockTransferSerializer
|
|
9
|
-
typelize status: :string,
|
|
9
|
+
typelize status: [:string, enum: Spree::StockTransfer.statuses, enum_type_name: 'StockTransferStatus'],
|
|
10
10
|
notes: 'string | null',
|
|
11
11
|
items_count: :number,
|
|
12
12
|
quantity_shipped_total: :number,
|
|
@@ -7,6 +7,7 @@ module Spree
|
|
|
7
7
|
|
|
8
8
|
typelize customer_id: [:string, nullable: true],
|
|
9
9
|
created_by_id: [:string, nullable: true],
|
|
10
|
+
created_by_type: [:string, nullable: true, enum: Spree::Actor::BUILT_IN_KINDS, enum_type_name: 'ActorKind'],
|
|
10
11
|
memo: [:string, nullable: true],
|
|
11
12
|
amount: [:string, nullable: false], amount_used: [:string, nullable: false],
|
|
12
13
|
amount_remaining: [:string, nullable: false],
|
|
@@ -27,7 +28,8 @@ module Spree
|
|
|
27
28
|
# money_attributes types its fields nullable for gated guests; the
|
|
28
29
|
# Admin API never gates prices.
|
|
29
30
|
typelize amount_authorized: [:string, nullable: false]
|
|
30
|
-
prefixed_id_attributes :customer
|
|
31
|
+
prefixed_id_attributes :customer
|
|
32
|
+
actor_attributes :created_by
|
|
31
33
|
|
|
32
34
|
# Why the credit exists: the return, exchange, claim or gift card
|
|
33
35
|
# that issued it, or null when an admin issued it by hand. The type
|
|
@@ -50,10 +52,6 @@ module Spree
|
|
|
50
52
|
one :customer,
|
|
51
53
|
resource: proc { Spree.api.admin_customer_serializer },
|
|
52
54
|
if: proc { expand?('customer') }
|
|
53
|
-
|
|
54
|
-
one :created_by,
|
|
55
|
-
resource: proc { Spree.api.admin_admin_user_serializer },
|
|
56
|
-
if: proc { expand?('created_by') }
|
|
57
55
|
end
|
|
58
56
|
end
|
|
59
57
|
end
|
|
@@ -36,6 +36,7 @@ module Spree
|
|
|
36
36
|
# and rate settings are formatted below.
|
|
37
37
|
preference_attributes Spree::Store, except: %i[order_routing_strategy payout_provider
|
|
38
38
|
default_minimum_payout_amount default_commission_tax_rate]
|
|
39
|
+
typelize weight_unit: [:string, enum: Spree::Variant::WEIGHT_UNITS, enum_type_name: 'WeightUnit']
|
|
39
40
|
|
|
40
41
|
# Once the counter has issued a number the starting value no longer
|
|
41
42
|
# applies, so the settings page can say that instead of accepting a
|
|
@@ -3,10 +3,10 @@ module Spree
|
|
|
3
3
|
module V3
|
|
4
4
|
module Admin
|
|
5
5
|
class TaxIdentifierSerializer < V3::TaxIdentifierSerializer
|
|
6
|
-
typelize validation_status: [:string, nullable: true, enum: Spree::TaxIdentifier::VALIDATION_STATUSES],
|
|
6
|
+
typelize validation_status: [:string, nullable: true, enum: Spree::TaxIdentifier::VALIDATION_STATUSES, enum_type_name: 'TaxIdentifierValidationStatus'],
|
|
7
7
|
validated_at: [:string, nullable: true],
|
|
8
8
|
validation_evidence: ['Record<string, unknown>', nullable: true],
|
|
9
|
-
source: [:string, nullable: true, enum: Spree::TaxIdentifier::SOURCES],
|
|
9
|
+
source: [:string, nullable: true, enum: Spree::TaxIdentifier::SOURCES, enum_type_name: 'TaxIdentifierSource'],
|
|
10
10
|
validatable: :boolean,
|
|
11
11
|
customer_id: [:string, nullable: true],
|
|
12
12
|
cart_id: [:string, nullable: true],
|