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.

Changed shared create/update request types to mark what create requires (#14876)

Damian Legawiec5c1eeee6b5f2
diff --git a/.changeset/typed-params-create-update-split.md b/.changeset/typed-params-create-update-split.md
new file mode 100644
index 0000000000..bc2556f4ff
--- /dev/null
+++ b/.changeset/typed-params-create-update-split.md
@@ -0,0 +1,10 @@
+---
+"@spree/sdk": minor
+"@spree/admin-sdk": minor
+"@spree/seller-sdk": minor
+"@spree/dashboard": patch
+---
+
+Request types that served both create and update are split by action, so creating marks what the API requires (a company's or tax rate's name, a tax registration's kind and value, an address's name, street, city and country) while updating takes any field. `AddressParams` and `CompanyAddressParams` in `@spree/sdk` stay as deprecated aliases until 6.1. The Admin SDK's `orders.payments.capture(orderId, id, params?, options?)` takes an optional `{ amount }` for a partial capture; request options move from the third argument to the fourth.
+
+A tax exemption certificate's `issued_at`, `expires_at` and `verified_at` are typed `string | null`: a certificate that is still pending has no dates yet.
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yaml
index 4206c88dd3..2a20fa0012 100644
--- a/docs/api-reference/admin.yaml
+++ b/docs/api-reference/admin.yaml
@@ -6383,7 +6383,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 26 Lovely Street
+ address1: 27 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -6507,7 +6507,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/CustomerAddressParams"
+ "$ref": "#/components/schemas/CustomerAddressCreateParams"
required: true
"/api/v3/admin/customers/{customer_id}/addresses/{id}":
patch:
@@ -6570,7 +6570,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 28 Lovely Street
+ address1: 29 Lovely Street
address2: Northwest
postal_code: '10118'
city: Manhattan
@@ -6596,7 +6596,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/CustomerAddressParams"
+ "$ref": "#/components/schemas/CustomerAddressUpdateParams"
required: true
delete:
summary: Delete a customer address
@@ -7363,6 +7363,66 @@ paths:
required:
- data
- meta
+ "/api/v3/admin/customers/{customer_id}/tax_identifiers/{id}":
+ patch:
+ summary: Update a customer tax registration
+ tags:
+ - Customers
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Corrects a registration number. A changed number is checked again before it counts as verified.
+
+ **Required scope:** `write_customers` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: customer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: registration updated
+ content:
+ application/json:
+ example:
+ id: txi_UkLWZg9DAJ
+ kind: eu_vat
+ value: DE100000008
+ validation_status:
+ validation_evidence:
+ source:
+ validated_at:
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ validatable: false
+ customer_id: cust_UkLWZg9DAJ
+ cart_id:
+ order_id:
+ schema:
+ "$ref": "#/components/schemas/TaxIdentifier"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/TaxIdentifierUpdateParams"
+ required: true
"/api/v3/admin/customers":
get:
summary: List customers
@@ -29150,7 +29210,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/TaxRateParams"
+ "$ref": "#/components/schemas/TaxRateCreateParams"
required: true
"/api/v3/admin/tax_rates/{id}":
parameters:
@@ -29248,7 +29308,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/TaxRateParams"
+ "$ref": "#/components/schemas/TaxRateUpdateParams"
required: true
delete:
summary: Delete a tax rate
@@ -35931,7 +35991,62 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/CatalogParams"
+ "$ref": "#/components/schemas/CatalogCreateParams"
+ required: true
+ "/api/v3/admin/catalogs/{id}":
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Update a catalog
+ tags:
+ - Catalogs
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Updates a catalog and its commercial terms. Only the attributes sent change.
+
+ **Required scope:** `write_products` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: catalog updated
+ content:
+ application/json:
+ example:
+ id: cat_UkLWZg9DAJ
+ name: Wholesale Plus
+ description:
+ active: true
+ position: 1
+ metadata: {}
+ minimum_order_quantity: 10
+ order_multiple: 5
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ products_count: 0
+ pricing_strategy: base
+ schema:
+ "$ref": "#/components/schemas/Catalog"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/CatalogUpdateParams"
required: true
"/api/v3/admin/catalogs/{id}/assign":
post:
@@ -38598,7 +38713,81 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/CompanyAddressParams"
+ "$ref": "#/components/schemas/CompanyAddressCreateParams"
+ required: true
+ "/api/v3/admin/companies/{company_id}/addresses/{id}":
+ patch:
+ summary: Update a company address
+ tags:
+ - Companies
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Changes an address of the business. Pass `default_billing` or `default_shipping` to move that default to it, or `false` to give it up.
+
+ **Required scope:** `write_customers` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: company_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: address updated
+ content:
+ application/json:
+ example:
+ id: addr_UkLWZg9DAJ
+ label: Northern Warehouse
+ first_name:
+ last_name:
+ full_name: ''
+ address1: 25 Lovely Street
+ address2: Northwest
+ postal_code: '10118'
+ city: New York
+ phone: 555-555-0199
+ company: Company
+ country_name: United States
+ country_code: US
+ state_text: NY
+ state_code: NY
+ quick_checkout: false
+ is_default_billing: true
+ is_default_shipping: false
+ state_name: New York
+ metadata: {}
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ latitude:
+ longitude:
+ customer_id:
+ owner_id: comp_UkLWZg9DAJ
+ owner_type: company
+ schema:
+ "$ref": "#/components/schemas/Address"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/CompanyAddressUpdateParams"
required: true
"/api/v3/admin/companies/{company_id}/invitations":
get:
@@ -39054,7 +39243,75 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/TaxExemptionCertificateParams"
+ "$ref": "#/components/schemas/TaxExemptionCertificateCreateParams"
+ required: true
+ "/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}":
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: company_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Update a tax exemption certificate
+ tags:
+ - Companies
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Corrects the details recorded for a certificate, such as its issuing authority or expiry date.
+
+ **Required scope:** `write_customers` (for API-key authentication).
+ parameters: []
+ responses:
+ '200':
+ description: certificate updated
+ content:
+ application/json:
+ example:
+ id: cert_UkLWZg9DAJ
+ certificate_number: DE-RESALE-1
+ reason_code: resale
+ status: pending
+ issuing_authority: Finanzamt Berlin
+ metadata: {}
+ issued_at:
+ expires_at: '2027-12-31T23:59:59.000Z'
+ verified_at:
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ company_id: comp_UkLWZg9DAJ
+ country_code:
+ state_code:
+ active: false
+ lapsed: false
+ can_be_deleted: true
+ document_filename:
+ document_byte_size:
+ document_url:
+ schema:
+ "$ref": "#/components/schemas/TaxExemptionCertificate"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/TaxExemptionCertificateUpdateParams"
required: true
"/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/verify":
parameters:
@@ -39445,7 +39702,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/TaxIdentifierParams"
+ "$ref": "#/components/schemas/TaxIdentifierCreateParams"
required: true
"/api/v3/admin/companies/{company_id}/tax_identifiers/{id}/validate":
parameters:
@@ -39718,7 +39975,61 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/CompanyParams"
+ "$ref": "#/components/schemas/CompanyCreateParams"
+ required: true
+ "/api/v3/admin/companies/{id}":
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ patch:
+ summary: Update a company
+ tags:
+ - Companies
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Updates a company node. Only the attributes sent change.
+
+ **Required scope:** `write_customers` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: company updated
+ content:
+ application/json:
+ example:
+ id: comp_UkLWZg9DAJ
+ name: Acme Industrial Group
+ kind: company
+ po_number_required: true
+ parent_id:
+ ancestors: []
+ external_references:
+ erp: ACME-1
+ metadata: {}
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ children_count: 0
+ members_count: 0
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/CompanyUpdateParams"
required: true
"/api/v3/admin/custom_field_definitions/resource_types":
get:
@@ -40265,7 +40576,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/DeliveryProfileParams"
+ "$ref": "#/components/schemas/DeliveryProfileCreateParams"
required: true
"/api/v3/admin/delivery_profiles/{delivery_profile_id}/origin_groups":
parameters:
@@ -40514,7 +40825,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/DeliveryProfileParams"
+ "$ref": "#/components/schemas/DeliveryProfileUpdateParams"
required: true
delete:
summary: Delete a delivery profile
@@ -40785,7 +41096,82 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/DeliveryMethodParams"
+ "$ref": "#/components/schemas/DeliveryMethodCreateParams"
+ required: true
+ "/api/v3/admin/delivery_methods/{id}":
+ patch:
+ summary: Update delivery method
+ tags:
+ - Delivery
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Updates a delivery method. Only the attributes sent change.
+
+ **Required scope:** `write_settings` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: delivery method updated
+ content:
+ application/json:
+ example:
+ id: dm_UkLWZg9DAJ
+ name: UPS Express
+ code: UPS_GROUND_11
+ estimated_transit_business_days_min: 1
+ estimated_transit_business_days_max: 2
+ digital: false
+ pickup: false
+ pickup_point: false
+ admin_name:
+ storefront_visible: true
+ tracking_url:
+ available_to_sellers: false
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ deleted_at:
+ markup_flat: '0.00'
+ markup_percent: '0'
+ seller_id:
+ seller_name:
+ services: []
+ rules: []
+ tax_category_id:
+ delivery_profile_id: fp_UkLWZg9DAJ
+ delivery_origin_group_id: og_UkLWZg9DAJ
+ delivery_zone_id:
+ stock_location_ids: []
+ fulfillment_provider: manual
+ pickup_point_provider:
+ rate_provider:
+ calculator:
+ type: flat_rate
+ preferences:
+ amounts: {}
+ amount: '10.00'
+ currency: USD
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/DeliveryMethodUpdateParams"
required: true
"/api/v3/admin/delivery_methods/calculators":
get:
@@ -41151,7 +41537,73 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/DeliveryZoneParams"
+ "$ref": "#/components/schemas/DeliveryZoneCreateParams"
+ required: true
+ "/api/v3/admin/delivery_zones/{id}":
+ patch:
+ summary: Update delivery zone
+ tags:
+ - Delivery
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Updates a delivery zone. Sending `members` replaces the whole member list; leaving it out keeps the current members.
+
+ **Required scope:** `write_settings` (for API-key authentication).
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to embed, e.g. `members`
+ schema:
+ type: string
+ responses:
+ '200':
+ description: delivery zone updated
+ content:
+ application/json:
+ example:
+ id: dz_UkLWZg9DAJ
+ name: US East Coast
+ description: Omnis ipsam provident laboriosam est.
+ members:
+ - id: dzm_UkLWZg9DAJ
+ member_type: postal_code
+ country_code: US
+ state_code:
+ postal_code_prefix:
+ postal_code_from: '10000'
+ postal_code_to: '14999'
+ country_name: United States
+ state_name:
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ delivery_profile_id: fp_UkLWZg9DAJ
+ delivery_origin_group_id: og_UkLWZg9DAJ
+ delivery_method_ids: []
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/DeliveryZoneUpdateParams"
required: true
"/api/v3/admin/delivery_methods/{delivery_method_id}/rules":
get:
@@ -65423,10 +65875,13 @@ components:
nullable: true
issued_at:
type: string
+ nullable: true
expires_at:
type: string
+ nullable: true
verified_at:
type: string
+ nullable: true
created_at:
type: string
updated_at:
@@ -68644,20 +69099,7 @@ components:
required:
- assignable_type
- assignable_id
- CatalogOrderMinimumParams:
- type: object
- properties:
- currency:
- allOf:
- - "$ref": "#/components/schemas/CurrencyCode"
- description: ISO 4217 code. Required on create; one minimum per currency.
- example: USD
- amount:
- type: string
- format: decimal
- pattern: "^-?\\d+(\\.\\d+)?$"
- example: '500.00'
- CatalogParams:
+ CatalogCreateParams:
type: object
properties:
name:
@@ -68708,6 +69150,21 @@ components:
A catalog with an empty assortment prices without hiding anything; curate
or import products to make it restrictive.'
nullable: true
+ required:
+ - name
+ CatalogOrderMinimumParams:
+ type: object
+ properties:
+ currency:
+ allOf:
+ - "$ref": "#/components/schemas/CurrencyCode"
+ description: ISO 4217 code. Required on create; one minimum per currency.
+ example: USD
+ amount:
+ type: string
+ format: decimal
+ pattern: "^-?\\d+(\\.\\d+)?$"
+ example: '500.00'
CatalogPriceListParams:
type: object
properties:
@@ -68772,6 +69229,57 @@ components:
order_multiple: 24
required:
- terms
+ CatalogUpdateParams:
+ type: object
+ properties:
+ name:
+ type: string
+ example: VIP Assortment
+ description:
+ type: string
+ description: Internal note on what the agreement is, never shown to shoppers.
+ nullable: true
+ active:
+ type: boolean
+ example: true
+ position:
+ type: integer
+ minimum_order_quantity:
+ type: integer
+ description: The catalog-wide quantity terms, between a variant's own rule
+ and a per-variant override. Null leaves the field to the variant's own
+ rule.
+ nullable: true
+ order_multiple:
+ type: integer
+ description: The catalog-wide quantity terms, between a variant's own rule
+ and a per-variant override. Null leaves the field to the variant's own
+ rule.
+ nullable: true
+ metadata:
+ type: object
+ additionalProperties: true
+ assignments:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CatalogAssignmentParams"
+ description: The whole audience. An entry left out is withdrawn; omitting
+ the key leaves the audience alone.
+ order_minimums:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CatalogOrderMinimumParams"
+ description: The whole order-minimum set. A currency left out has its minimum
+ lifted; omitting the key leaves them alone.
+ price_list:
+ allOf:
+ - "$ref": "#/components/schemas/CatalogPriceListParams"
+ description: 'The price list this catalog prices through, written inline:
+ an object creates the owned list or updates it. Null deletes the list
+ (a soft delete). Omit the key, or send `{}`, to leave the pricing alone.
+ A catalog with an empty assortment prices without hiding anything; curate
+ or import products to make it restrictive.'
+ nullable: true
CategoryCreateParams:
type: object
properties:
@@ -69428,7 +69936,7 @@ components:
description: For kinds that name products, which are kept outside preferences.
required:
- type
- CompanyAddressParams:
+ CompanyAddressCreateParams:
type: object
properties:
first_name:
@@ -69469,6 +69977,89 @@ components:
type: boolean
description: True makes this the default address of that kind, false gives
the slot up, and leaving it out keeps the current default.
+ required:
+ - first_name
+ - last_name
+ - address1
+ - city
+ - country_code
+ CompanyAddressUpdateParams:
+ type: object
+ properties:
+ first_name:
+ type: string
+ last_name:
+ type: string
+ company:
+ type: string
+ address1:
+ type: string
+ address2:
+ type: string
+ city:
+ type: string
+ postal_code:
+ type: string
+ phone:
+ type: string
+ label:
+ type: string
+ country_code:
+ allOf:
+ - "$ref": "#/components/schemas/CountryCode"
+ description: ISO 3166-1 alpha-2 code, such as `US`.
+ example: US
+ state_code:
+ type: string
+ description: The state or province abbreviation, such as `NY`.
+ example: NY
+ state_name:
+ type: string
+ description: For countries without states in the database.
+ default_billing:
+ type: boolean
+ description: True makes this the default address of that kind, false gives
+ the slot up, and leaving it out keeps the current default.
+ default_shipping:
+ type: boolean
+ description: True makes this the default address of that kind, false gives
+ the slot up, and leaving it out keeps the current default.
+ CompanyCreateParams:
+ type: object
+ properties:
+ external_references:
+ type: object
+ additionalProperties: true
+ description: 'Identities the record has in external systems, keyed by system:
+ the same `{ system: external_id }` map the Admin API renders, so what
+ you read can be sent straight back. Systems you do not name keep the reference
+ they have. A list of `{ system, external_id }` entries is accepted too.'
+ name:
+ type: string
+ example: Globex Corporation
+ kind:
+ type: string
+ enum:
+ - company
+ - division
+ description: "`company` is a legal entity (may hold tax registrations),
+ `division` an organizational unit. Roots must be `company`."
+ example: company
+ parent_id:
+ type: string
+ description: The parent node. Omit or null for a root.
+ example: comp_86Rf07xd4z
+ nullable: true
+ po_number_required:
+ type: boolean
+ description: 'Whether this buyer''s own procurement process demands a PO
+ reference on every order: checkout asks for one and refuses to complete
+ without it.'
+ metadata:
+ type: object
+ additionalProperties: true
+ required:
+ - name
CompanyMembershipCreateParams:
type: object
properties:
@@ -69483,7 +70074,7 @@ components:
additionalProperties: true
required:
- customer_email
- CompanyParams:
+ CompanyUpdateParams:
type: object
properties:
external_references:
@@ -69495,7 +70086,6 @@ components:
they have. A list of `{ system, external_id }` entries is accepted too.'
name:
type: string
- description: Required when creating.
example: Globex Corporation
kind:
type: string
@@ -69620,7 +70210,56 @@ components:
value:
description: A scalar for text, number and boolean fields; a list or a hash
for JSON fields.
- CustomerAddressParams:
+ CustomerAddressCreateParams:
+ type: object
+ properties:
+ first_name:
+ type: string
+ last_name:
+ type: string
+ company:
+ type: string
+ address1:
+ type: string
+ address2:
+ type: string
+ city:
+ type: string
+ postal_code:
+ type: string
+ phone:
+ type: string
+ label:
+ type: string
+ country_code:
+ allOf:
+ - "$ref": "#/components/schemas/CountryCode"
+ description: ISO 3166-1 alpha-2 code, such as `US`.
+ example: US
+ state_code:
+ type: string
+ description: The state or province abbreviation, such as `NY`.
+ example: NY
+ state_name:
+ type: string
+ description: For countries without states in the database.
+ alternative_phone:
+ type: string
+ quick_checkout:
+ type: boolean
+ is_default_billing:
+ type: boolean
+ description: Makes this the customer's default address of that kind.
+ is_default_shipping:
+ type: boolean
+ description: Makes this the customer's default address of that kind.
+ required:
+ - first_name
+ - last_name
+ - address1
+ - city
+ - country_code
+ CustomerAddressUpdateParams:
type: object
properties:
first_name:
@@ -69875,7 +70514,7 @@ components:
type: boolean
description: Whether the customer gets a delivery notification once the
parcel completes. Defaults to true.
- DeliveryMethodParams:
+ DeliveryMethodCreateParams:
type: object
properties:
name:
@@ -69997,6 +70636,8 @@ components:
description: 'Carrier service rows: which provider services this method
offers. Replaces the full set: omitted rows are removed; no rows means
every service the provider returns is offered.'
+ required:
+ - name
DeliveryMethodRuleCreateParams:
type: object
properties:
@@ -70071,6 +70712,128 @@ components:
required:
- carrier
- service
+ DeliveryMethodUpdateParams:
+ type: object
+ properties:
+ name:
+ type: string
+ example: Express
+ admin_name:
+ type: string
+ nullable: true
+ code:
+ type: string
+ nullable: true
+ fulfillment_provider:
+ type: string
+ description: Fulfillment provider shorthand (see the fulfillment providers
+ endpoint), e.g. `manual`.
+ example: manual
+ pickup_point_provider:
+ type: string
+ nullable: true
+ rate_provider:
+ type: string
+ description: Rate provider shorthand (see the rate providers endpoint),
+ e.g. `easy_post`. Omit or send null for the built-in provider, which prices
+ through the method's calculator.
+ nullable: true
+ storefront_visible:
+ type: boolean
+ available_to_sellers:
+ type: boolean
+ description: 'Marketplace only: whether a seller''s packages may be quoted
+ by this method. Off by default, and refused on a method that belongs to
+ a seller.'
+ tracking_url:
+ type: string
+ nullable: true
+ estimated_transit_business_days_min:
+ type: integer
+ nullable: true
+ estimated_transit_business_days_max:
+ type: integer
+ nullable: true
+ tax_category_id:
+ type: string
+ description: Prefixed tax category ID (`taxcat_...`), or null to clear.
+ nullable: true
+ markup_flat:
+ type: string
+ format: decimal
+ pattern: "^-?\\d+(\\.\\d+)?$"
+ description: Method-level flat handling fee added on top of provider-quoted
+ rates.
+ nullable: true
+ markup_percent:
+ type: string
+ format: decimal
+ pattern: "^-?\\d+(\\.\\d+)?$"
+ description: Method-level percentage handling fee added on top of provider-quoted
+ rates. Ignored for calculator-priced methods.
+ nullable: true
+ delivery_profile_id:
+ type: string
+ description: Delivery profile this method belongs to (`fp_...`); defaults
+ to the store default profile.
+ example: fp_86Rf07xd4z
+ delivery_origin_group_id:
+ type: string
+ description: Origin group offering this method (`og_...`); defaults to the
+ zone's group, else the profile's default group.
+ delivery_zone_id:
+ type: string
+ description: Delivery zone narrowing destinations (`dz_...`), or null for
+ no restriction. Must belong to the method's profile.
+ nullable: true
+ stock_location_ids:
+ type: array
+ items:
+ type: string
+ description: Pickup locations (`sloc_...`); replaces the full set.
+ calculator:
+ type: object
+ properties:
+ type:
+ type: string
+ example: flat_rate
+ preferences:
+ type: object
+ additionalProperties: true
+ example:
+ amount: '12.5'
+ description: 'How the method prices a shipment: a type from the calculators
+ endpoint and its preferences, matching that type''s `schema`.'
+ rules:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: string
+ type:
+ type: string
+ description: A rule kind from the delivery method rule types endpoint.
+ active:
+ type: boolean
+ preferences:
+ type: object
+ additionalProperties: true
+ product_ids:
+ type: array
+ items:
+ type: string
+ description: Products an association-backed rule (`excluded_products_rule`)
+ applies to.
+ description: 'Eligibility rules. Replaces the full set: omitted rules are
+ removed.'
+ services:
+ type: array
+ items:
+ "$ref": "#/components/schemas/DeliveryMethodServiceParams"
+ description: 'Carrier service rows: which provider services this method
+ offers. Replaces the full set: omitted rows are removed; no rows means
+ every service the provider returns is offered.'
DeliveryOriginGroupParams:
type: object
properties:
@@ -70086,7 +70849,32 @@ components:
type: string
description: Prefixed stock location IDs (`sloc_...`); replaces the full
set. Empty means every store location.
- DeliveryProfileParams:
+ DeliveryProfileCreateParams:
+ type: object
+ properties:
+ name:
+ type: string
+ example: Oversized
+ kind:
+ type: string
+ description: Registered profile kind (`shipping`, `digital`, extension kinds)
+ from the kinds endpoint. Read on create only; defaults to shipping.
+ example: shipping
+ default:
+ type: boolean
+ description: Promotes this profile to the store default; the previous default
+ is demoted.
+ position:
+ type: integer
+ stock_location_ids:
+ type: array
+ items:
+ type: string
+ description: Prefixed stock location IDs (`sloc_...`); replaces the full
+ set. Empty means every store location.
+ required:
+ - name
+ DeliveryProfileUpdateParams:
type: object
properties:
name:
@@ -70124,6 +70912,29 @@ components:
type: string
tracking_url:
type: string
+ DeliveryZoneCreateParams:
+ type: object
+ properties:
+ name:
+ type: string
+ example: US North-East
+ description:
+ type: string
+ nullable: true
+ delivery_profile_id:
+ type: string
+ description: Delivery profile this zone belongs to (`fp_...`); defaults
+ to the store default profile.
+ delivery_origin_group_id:
+ type: string
+ description: Origin group this zone belongs to (`og_...`).
+ members:
+ type: array
+ items:
+ "$ref": "#/components/schemas/DeliveryZoneMemberParams"
+ description: Replaces the zone's full member set atomically.
+ required:
+ - name
DeliveryZoneMemberParams:
type: object
properties:
@@ -70149,7 +70960,7 @@ components:
type: string
required:
- member_type
- DeliveryZoneParams:
+ DeliveryZoneUpdateParams:
type: object
properties:
name:
@@ -74810,16 +75621,15 @@ components:
nullable: true
is_default:
type: boolean
- TaxExemptionCertificateParams:
+ TaxExemptionCertificateCreateParams:
type: object
properties:
certificate_number:
type: string
- description: Required when creating.
example: DE-RESALE-7
reason_code:
type: string
- description: Becomes the tax provider's entity use code. Required when creating.
+ description: Becomes the tax provider's entity use code.
example: resale
issuing_authority:
type: string
@@ -74848,21 +75658,116 @@ components:
metadata:
type: object
additionalProperties: true
- TaxIdentifierParams:
+ required:
+ - certificate_number
+ - reason_code
+ TaxExemptionCertificateUpdateParams:
+ type: object
+ properties:
+ certificate_number:
+ type: string
+ example: DE-RESALE-7
+ reason_code:
+ type: string
+ description: Becomes the tax provider's entity use code.
+ example: resale
+ issuing_authority:
+ type: string
+ example: Finanzamt Berlin
+ nullable: true
+ issued_at:
+ type: string
+ format: date-time
+ nullable: true
+ expires_at:
+ type: string
+ format: date-time
+ nullable: true
+ country_code:
+ allOf:
+ - "$ref": "#/components/schemas/CountryCode"
+ description: Where the certificate holds. Omit it and `state_code` for one
+ valid everywhere.
+ nullable: true
+ state_code:
+ type: string
+ nullable: true
+ document_signed_id:
+ type: string
+ description: 'A `signed_id` from `files.upload()` with `visibility: ''private''`.'
+ metadata:
+ type: object
+ additionalProperties: true
+ TaxIdentifierCreateParams:
+ type: object
+ properties:
+ kind:
+ type: string
+ description: 'The registration the number belongs to, such as `eu_vat` or
+ `gb_vat`. Any kind is accepted; one with a registered validator is checked
+ by it. Built-in: `eu_vat`. Extensions may register more.'
+ example: gb_vat
+ value:
+ type: string
+ example: GB123456789
+ required:
+ - kind
+ - value
+ TaxIdentifierUpdateParams:
type: object
properties:
kind:
type: string
description: 'The registration the number belongs to, such as `eu_vat` or
`gb_vat`. Any kind is accepted; one with a registered validator is checked
- by it. Built-in: `eu_vat`. Extensions may register more. Required when
- creating.'
+ by it. Built-in: `eu_vat`. Extensions may register more.'
example: gb_vat
value:
type: string
- description: Required when creating.
example: GB123456789
- TaxRateParams:
+ TaxRateCreateParams:
+ type: object
+ properties:
+ name:
+ type: string
+ description: Customer-facing rate name.
+ example: VAT
+ rate:
+ type: string
+ format: decimal
+ pattern: "^-?\\d+(\\.\\d+)?$"
+ description: The rate as a fraction. Send this or `rate_percent`.
+ example: '0.19'
+ rate_percent:
+ type: string
+ format: decimal
+ pattern: "^-?\\d+(\\.\\d+)?$"
+ description: The rate as a percentage.
+ example: '19'
+ included_in_price:
+ type: boolean
+ show_rate_in_label:
+ type: boolean
+ tax_category_id:
+ type: string
+ country_code:
+ allOf:
+ - "$ref": "#/components/schemas/CountryCode"
+ description: ISO country code. A rate naming no country taxes everywhere.
+ example: DE
+ nullable: true
+ state_code:
+ type: string
+ description: State abbreviation within that country.
+ example: CA
+ nullable: true
+ metadata:
+ type: object
+ additionalProperties: true
+ required:
+ - name
+ - tax_category_id
+ TaxRateUpdateParams:
type: object
properties:
name:
diff --git a/docs/api-reference/seller.yaml b/docs/api-reference/seller.yaml
index d2300389a2..0cd2cdf26f 100644
--- a/docs/api-reference/seller.yaml
+++ b/docs/api-reference/seller.yaml
@@ -12564,7 +12564,7 @@ paths:
data:
- id: dm_UkLWZg9DAJ
name: My courier
- code: UPS_GROUND_115
+ code: UPS_GROUND_116
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -12587,7 +12587,7 @@ paths:
currency: USD
- id: dm_gbHJdmfrXB
name: Marketplace post
- code: UPS_GROUND_116
+ code: UPS_GROUND_117
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -12714,7 +12714,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/DeliveryMethodParams"
+ "$ref": "#/components/schemas/DeliveryMethodCreateParams"
required: true
"/api/v3/seller/delivery_methods/{id}":
parameters:
@@ -12756,7 +12756,7 @@ paths:
example:
id: dm_UkLWZg9DAJ
name: My courier
- code: UPS_GROUND_121
+ code: UPS_GROUND_122
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -12813,7 +12813,7 @@ paths:
example:
id: dm_UkLWZg9DAJ
name: My express courier
- code: UPS_GROUND_123
+ code: UPS_GROUND_124
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -12840,7 +12840,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/DeliveryMethodParams"
+ "$ref": "#/components/schemas/DeliveryMethodUpdateParams"
required: true
delete:
summary: Retire a delivery method
@@ -14578,7 +14578,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/ProductParams"
+ "$ref": "#/components/schemas/ProductCreateParams"
required: true
"/api/v3/seller/products/{id}":
parameters:
@@ -14760,7 +14760,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/ProductParams"
+ "$ref": "#/components/schemas/ProductUpdateParams"
required: true
delete:
summary: Delete a product
@@ -15294,7 +15294,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/StockLocationParams"
+ "$ref": "#/components/schemas/StockLocationCreateParams"
required: true
"/api/v3/seller/stock_locations/{id}":
parameters:
@@ -15438,7 +15438,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/StockLocationParams"
+ "$ref": "#/components/schemas/StockLocationUpdateParams"
required: true
"/api/v3/seller/invitations":
get:
@@ -19663,7 +19663,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 263 Lovely Street
+ address1: 264 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -19683,7 +19683,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 262 Lovely Street
+ address1: 263 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -19859,7 +19859,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 265 Lovely Street
+ address1: 266 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -19879,7 +19879,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 264 Lovely Street
+ address1: 265 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -20055,7 +20055,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 271 Lovely Street
+ address1: 272 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -20075,7 +20075,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 270 Lovely Street
+ address1: 271 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -20261,7 +20261,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 272 Lovely Street
+ address1: 273 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -20434,7 +20434,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 277 Lovely Street
+ address1: 278 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -20454,7 +20454,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 276 Lovely Street
+ address1: 277 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -20604,7 +20604,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 279 Lovely Street
+ address1: 280 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -20624,7 +20624,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 278 Lovely Street
+ address1: 279 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -20993,7 +20993,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/PackageTypeParams"
+ "$ref": "#/components/schemas/PackageTypeCreateParams"
required: true
"/api/v3/seller/package_types/{id}":
parameters:
@@ -21123,7 +21123,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/PackageTypeParams"
+ "$ref": "#/components/schemas/PackageTypeUpdateParams"
required: true
delete:
summary: Delete a package type
@@ -22075,7 +22075,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/SellerTaxIdentifierParams"
+ "$ref": "#/components/schemas/SellerTaxIdentifierCreateParams"
required: true
"/api/v3/seller/tax_identifiers/{id}":
parameters:
@@ -22129,7 +22129,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/SellerTaxIdentifierParams"
+ "$ref": "#/components/schemas/SellerTaxIdentifierUpdateParams"
required: true
delete:
summary: Remove a tax registration
@@ -29777,7 +29777,7 @@ components:
type: string
required:
- tracking_number
- DeliveryMethodParams:
+ DeliveryMethodCreateParams:
type: object
properties:
name:
@@ -29826,6 +29826,8 @@ components:
"$ref": "#/components/schemas/DeliveryMethodRuleParams"
description: 'Replaces the whole set: a rule dropped here is deleted, so
re-send surviving rules with their `id`. An empty list clears every condition.'
+ required:
+ - name
DeliveryMethodRuleParams:
type: object
properties:
@@ -29841,6 +29843,55 @@ components:
additionalProperties: true
required:
- type
+ DeliveryMethodUpdateParams:
+ type: object
+ properties:
+ name:
+ type: string
+ admin_name:
+ type: string
+ nullable: true
+ code:
+ type: string
+ nullable: true
+ delivery_profile_id:
+ type: string
+ description: One of the marketplace's delivery profiles.
+ delivery_zone_id:
+ type: string
+ description: Narrows where the method ships; null serves everywhere the
+ profile reaches.
+ nullable: true
+ storefront_visible:
+ type: boolean
+ tracking_url:
+ type: string
+ nullable: true
+ estimated_transit_business_days_min:
+ type: integer
+ nullable: true
+ estimated_transit_business_days_max:
+ type: integer
+ nullable: true
+ calculator:
+ type: object
+ properties:
+ type:
+ type: string
+ example: flat_rate
+ preferences:
+ type: object
+ additionalProperties: true
+ example:
+ amount: '12.5'
+ description: 'How the method is priced: a type from `/delivery_methods/calculators`
+ and its preferences, per that type''s `schema`.'
+ rules:
+ type: array
+ items:
+ "$ref": "#/components/schemas/DeliveryMethodRuleParams"
+ description: 'Replaces the whole set: a rule dropped here is deleted, so
+ re-send surviving rules with their `id`. An empty list clears every condition.'
DeliveryUpdateParams:
type: object
properties:
@@ -30182,7 +30233,62 @@ components:
description: The seller's own working note, as HTML. Sanitized on save;
`internal_note_html` reads it back.
nullable: true
- PackageTypeParams:
+ PackageTypeCreateParams:
+ type: object
+ properties:
+ name:
+ type: string
+ kind:
+ type: string
+ enum:
+ - box
+ - envelope
+ - carton
+ - pallet
+ - container
+ length:
+ type: number
+ nullable: true
+ width:
+ type: number
+ nullable: true
+ height:
+ type: number
+ nullable: true
+ dimensions_unit:
+ type: string
+ enum:
+ - mm
+ - cm
+ - in
+ - ft
+ nullable: true
+ weight:
+ type: number
+ description: The empty package's own weight, added to every quote.
+ nullable: true
+ max_weight:
+ type: number
+ nullable: true
+ weight_unit:
+ type: string
+ enum:
+ - g
+ - kg
+ - lb
+ - oz
+ nullable: true
+ default:
+ type: boolean
+ description: Makes this the box this seller's parcels are quoted with. One
+ default per seller, so it never displaces the marketplace's.
+ metadata:
+ type: object
+ additionalProperties: true
+ nullable: true
+ required:
+ - name
+ PackageTypeUpdateParams:
type: object
properties:
name:
@@ -30325,7 +30431,79 @@ components:
counted in `skipped_count`.
required:
- ids
- ProductParams:
+ ProductCreateParams:
+ type: object
+ properties:
+ name:
+ type: string
+ example: Hand-thrown mug
+ description:
+ type: string
+ slug:
+ type: string
+ example: hand-thrown-mug
+ meta_title:
+ type: string
+ meta_description:
+ type: string
+ meta_keywords:
+ type: string
+ metadata:
+ type: object
+ additionalProperties: true
+ product_type_id:
+ type: string
+ description: The marketplace's product type this product is listed against,
+ from the product types endpoint. Null detaches it. Saving with a type
+ seeds its option types onto the product.
+ nullable: true
+ delivery_profile_id:
+ type: string
+ description: Which of the marketplace's delivery profiles the product ships
+ under. A new product sent without one lands on the profile marked default.
+ prices:
+ type: array
+ items:
+ type: object
+ properties:
+ currency:
+ allOf:
+ - "$ref": "#/components/schemas/CurrencyCode"
+ description: Omit to price in the store's currency. A seller has no
+ currency of their own.
+ example: USD
+ amount:
+ type: string
+ format: decimal
+ pattern: "^-?\\d+(\\.\\d+)?$"
+ description: 'A canonical decimal string (`"1234.56"`: period decimal,
+ no grouping). The API does not parse localized input.'
+ example: '24.00'
+ compare_at_amount:
+ type: string
+ format: decimal
+ pattern: "^-?\\d+(\\.\\d+)?$"
+ example: '30.00'
+ nullable: true
+ required:
+ - amount
+ description: 'Shorthand for a simple (no-options) product: per-currency
+ prices that forward to the product''s sole variant.'
+ media:
+ type: array
+ items:
+ "$ref": "#/components/schemas/SellerProductMediaParams"
+ description: 'The gallery, as a whole: a file absent from the list is removed.
+ `signed_id` attaches a fresh upload; `id` updates one already there.'
+ variants:
+ type: array
+ items:
+ "$ref": "#/components/schemas/SellerProductVariantParams"
+ description: 'The variants, as a whole: one absent from the list is removed.
+ Pass `id` to update an existing variant.'
+ required:
+ - name
+ ProductUpdateParams:
type: object
properties:
name:
@@ -30759,7 +30937,25 @@ components:
"$ref": "#/components/schemas/StockLevelParams"
description: 'Stock per location, at this seller''s own locations only:
a location belonging to anyone else is ignored.'
- SellerTaxIdentifierParams:
+ SellerTaxIdentifierCreateParams:
+ type: object
+ properties:
+ kind:
+ type: string
+ description: 'The registration the number belongs to, such as `eu_vat` or
+ `gb_vat`. Any kind is accepted; one with a registered validator is checked
+ by it. Built-in: `eu_vat`. Extensions may register more. One registration
+ per kind.'
+ example: eu_vat
+ value:
+ type: string
+ description: A number the validator for its kind refuses is rejected rather
+ than stored.
+ example: DE100000008
+ required:
+ - kind
+ - value
+ SellerTaxIdentifierUpdateParams:
type: object
properties:
kind:
@@ -30831,7 +31027,90 @@ components:
required:
- stock_location_id
- count_on_hand
- StockLocationParams:
+ StockLocationCreateParams:
+ type: object
+ properties:
+ name:
+ type: string
+ example: Main warehouse
+ admin_name:
+ type: string
+ nullable: true
+ active:
+ type: boolean
+ description: 'Set `false` to retire a location: there is no delete.'
+ default:
+ type: boolean
+ kind:
+ anyOf:
+ - type: string
+ enum:
+ - warehouse
+ - store
+ - fulfillment_center
+ - type: string
+ description: Categorizes the location. The values listed are the built-in
+ ones; extensions may add more.
+ example: warehouse
+ propagate_all_variants:
+ type: boolean
+ backorderable_default:
+ type: boolean
+ address1:
+ type: string
+ nullable: true
+ address2:
+ type: string
+ nullable: true
+ city:
+ type: string
+ nullable: true
+ zipcode:
+ type: string
+ nullable: true
+ phone:
+ type: string
+ nullable: true
+ company:
+ type: string
+ nullable: true
+ country_code:
+ allOf:
+ - "$ref": "#/components/schemas/CountryCode"
+ description: ISO-3166 alpha-2 country code.
+ example: US
+ nullable: true
+ state_code:
+ type: string
+ description: State or province abbreviation, resolved against the selected
+ country's states.
+ example: OR
+ nullable: true
+ state_name:
+ type: string
+ description: Free-text state for countries that don't have a states list.
+ nullable: true
+ pickup_enabled:
+ type: boolean
+ pickup_stock_policy:
+ type: string
+ enum:
+ - local
+ - any
+ description: "`local` collects only items at this location; `any` lets items
+ transfer in from other locations (ship-to-store)."
+ pickup_ready_in_minutes:
+ type: integer
+ nullable: true
+ returns_enabled:
+ type: boolean
+ description: Whether customers may send returns to this location.
+ pickup_instructions:
+ type: string
+ nullable: true
+ required:
+ - name
+ StockLocationUpdateParams:
type: object
properties:
name:
diff --git a/docs/api-reference/store.yaml b/docs/api-reference/store.yaml
index c1a1e034cc..0d1fda8e5e 100644
--- a/docs/api-reference/store.yaml
+++ b/docs/api-reference/store.yaml
@@ -3156,7 +3156,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 354 Lovely Street
+ address1: 355 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -3178,7 +3178,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 353 Lovely Street
+ address1: 354 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -3395,7 +3395,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 163
- code: UPS_GROUND_180
+ code: UPS_GROUND_181
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -3436,7 +3436,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 163
- code: UPS_GROUND_180
+ code: UPS_GROUND_181
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -3474,7 +3474,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 360 Lovely Street
+ address1: 361 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -3496,7 +3496,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 359 Lovely Street
+ address1: 360 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -4121,7 +4121,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 184
- code: UPS_GROUND_202
+ code: UPS_GROUND_203
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -4162,7 +4162,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 184
- code: UPS_GROUND_202
+ code: UPS_GROUND_203
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -4176,7 +4176,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 472 Lovely Street
+ address1: 476 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -6474,7 +6474,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 198
- code: UPS_GROUND_216
+ code: UPS_GROUND_217
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -6515,7 +6515,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 198
- code: UPS_GROUND_216
+ code: UPS_GROUND_217
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -6528,7 +6528,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 528 Lovely Street
+ address1: 532 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -6550,7 +6550,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 529 Lovely Street
+ address1: 533 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -6878,7 +6878,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 314 Lovely Street
+ address1: 315 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -6899,7 +6899,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 315 Lovely Street
+ address1: 316 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -6920,7 +6920,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 316 Lovely Street
+ address1: 317 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -7068,7 +7068,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/AddressParams"
+ "$ref": "#/components/schemas/AddressCreateParams"
required: true
"/api/v3/store/customers/me/addresses/{id}":
get:
@@ -7126,7 +7126,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 328 Lovely Street
+ address1: 329 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -7208,7 +7208,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 334 Lovely Street
+ address1: 335 Lovely Street
address2: Northwest
postal_code: '10118'
city: Los Angeles
@@ -7230,7 +7230,7 @@ paths:
content:
application/json:
schema:
- "$ref": "#/components/schemas/AddressParams"
+ "$ref": "#/components/schemas/AddressUpdateParams"
required: true
delete:
summary: Delete an address
@@ -7821,7 +7821,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 176
- code: UPS_GROUND_193
+ code: UPS_GROUND_194
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -7862,7 +7862,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 176
- code: UPS_GROUND_193
+ code: UPS_GROUND_194
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -7875,7 +7875,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 416 Lovely Street
+ address1: 420 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -7897,7 +7897,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 417 Lovely Street
+ address1: 421 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -8145,7 +8145,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 178
- code: UPS_GROUND_195
+ code: UPS_GROUND_196
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -8186,7 +8186,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 178
- code: UPS_GROUND_195
+ code: UPS_GROUND_196
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -8199,7 +8199,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 422 Lovely Street
+ address1: 426 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -8221,7 +8221,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 423 Lovely Street
+ address1: 427 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -8414,7 +8414,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 428 Lovely Street
+ address1: 432 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -8435,7 +8435,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 429 Lovely Street
+ address1: 433 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -8457,7 +8457,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 429 Lovely Street
+ address1: 433 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -8479,7 +8479,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 428 Lovely Street
+ address1: 432 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -8571,7 +8571,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 430 Lovely Street
+ address1: 434 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -8592,7 +8592,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 431 Lovely Street
+ address1: 435 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -8614,7 +8614,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 431 Lovely Street
+ address1: 435 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -8636,7 +8636,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 430 Lovely Street
+ address1: 434 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -11980,7 +11980,7 @@ paths:
first_name:
last_name:
full_name: ''
- address1: 389 Lovely Street
+ address1: 390 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -12006,6 +12006,61 @@ paths:
in: 1
previous:
next:
+ post:
+ summary: Add an address book entry
+ tags:
+ - Companies
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: 'Adds a labeled site to the node. Pass `default_billing: true`
+ or `default_shipping: true` to make it the default of that kind.'
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ responses:
+ '201':
+ description: address book entry created
+ content:
+ application/json:
+ example:
+ id: addr_VqXmZF31wY
+ label: Northern Warehouse
+ first_name: Ada
+ last_name: Lovelace
+ full_name: Ada Lovelace
+ address1: 350 Fifth Avenue
+ address2:
+ postal_code: '10118'
+ city: New York
+ phone: "+12125551234"
+ company: Acme Industrial
+ country_name: United States
+ country_code: US
+ state_text: NY
+ state_code: NY
+ quick_checkout: false
+ is_default_billing: false
+ is_default_shipping: true
+ state_abbr: NY
+ country_iso: US
+ state_name: New York
+ schema:
+ "$ref": "#/components/schemas/Address"
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/CompanyAddressCreateParams"
+ required: true
"/api/v3/store/companies/{company_id}/addresses/{id}":
parameters:
- name: company_id
@@ -12051,7 +12106,7 @@ paths:
first_name:
last_name:
full_name: ''
- address1: 392 Lovely Street
+ address1: 396 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -12067,11 +12122,13 @@ paths:
state_abbr: NY
country_iso: US
state_name: New York
+ schema:
+ "$ref": "#/components/schemas/Address"
requestBody:
content:
application/json:
schema:
- "$ref": "#/components/schemas/CompanyAddressParams"
+ "$ref": "#/components/schemas/CompanyAddressUpdateParams"
required: true
delete:
summary: Remove an address book entry
@@ -12373,7 +12430,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 167
- code: UPS_GROUND_184
+ code: UPS_GROUND_185
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -12414,7 +12471,7 @@ paths:
delivery_method:
id: dm_UkLWZg9DAJ
name: UPS Ground 167
- code: UPS_GROUND_184
+ code: UPS_GROUND_185
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -12427,7 +12484,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 400 Lovely Street
+ address1: 404 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -12449,7 +12506,7 @@ paths:
first_name: John
last_name: Doe
full_name: John Doe
- address1: 401 Lovely Street
+ address1: 405 Lovely Street
address2: Northwest
postal_code: '10118'
city: New York
@@ -21687,7 +21744,59 @@ components:
description: Values for line item attributes an extension adds.
required:
- variant_id
- AddressParams:
+ AddressCreateParams:
+ type: object
+ properties:
+ first_name:
+ type: string
+ last_name:
+ type: string
+ company:
+ type: string
+ address1:
+ type: string
+ address2:
+ type: string
+ city:
+ type: string
+ postal_code:
+ type: string
+ phone:
+ type: string
+ country_code:
+ allOf:
+ - "$ref": "#/components/schemas/CountryCode"
+ description: ISO 3166-1 alpha-2 country code, such as `US` or `DE`.
+ example: US
+ state_code:
+ type: string
+ description: ISO 3166-2 subdivision code without the country prefix, such
+ as `CA` or `NY`.
+ example: NY
+ state_name:
+ type: string
+ description: The state name, for countries without predefined states.
+ country_iso:
+ type: string
+ description: 'Deprecated: Use `country_code`. Removed in 6.1.'
+ deprecated: true
+ state_abbr:
+ type: string
+ description: 'Deprecated: Use `state_code`. Removed in 6.1.'
+ deprecated: true
+ is_default_billing:
+ type: boolean
+ description: Makes this the default billing address.
+ is_default_shipping:
+ type: boolean
+ description: Makes this the default shipping address.
+ required:
+ - first_name
+ - last_name
+ - address1
+ - city
+ - country_code
+ AddressUpdateParams:
type: object
properties:
first_name:
@@ -21808,7 +21917,58 @@ components:
type: boolean
description: Relaxes validation (name, phone, postal code, street), for
express checkouts that share a partial address.
- CompanyAddressParams:
+ CompanyAddressCreateParams:
+ type: object
+ properties:
+ first_name:
+ type: string
+ last_name:
+ type: string
+ company:
+ type: string
+ address1:
+ type: string
+ address2:
+ type: string
+ city:
+ type: string
+ postal_code:
+ type: string
+ phone:
+ type: string
+ label:
+ type: string
+ country_code:
+ allOf:
+ - "$ref": "#/components/schemas/CountryCode"
+ description: ISO 3166-1 alpha-2 code, such as `US`.
+ example: US
+ state_code:
+ type: string
+ description: The state or province abbreviation, such as `NY`.
+ example: NY
+ state_name:
+ type: string
+ description: For countries without states in the database.
+ zipcode:
+ type: string
+ description: 'Deprecated: Use `postal_code`. Removed in 6.1.'
+ deprecated: true
+ default_billing:
+ type: boolean
+ description: True makes this the node's default billing address, false gives
+ that up, and leaving it out changes nothing.
+ default_shipping:
+ type: boolean
+ description: True makes this the node's default shipping address, false
+ gives that up, and leaving it out changes nothing.
+ required:
+ - first_name
+ - last_name
+ - address1
+ - city
+ - country_code
+ CompanyAddressUpdateParams:
type: object
properties:
first_name:
diff --git a/docs/developer/upgrades/5.6-to-6.0.mdx b/docs/developer/upgrades/5.6-to-6.0.mdx
index 06d7208b94..215de4f2e3 100644
--- a/docs/developer/upgrades/5.6-to-6.0.mdx
+++ b/docs/developer/upgrades/5.6-to-6.0.mdx
@@ -1140,7 +1140,7 @@ Request types (`CreateCartParams`, `UpdateCartParams`, `AddLineItemParams`, `Add
```
- **Some requirements relaxed.** `AddLineItemParams.quantity` is optional (it defaults to 1), and `RegisterParams.password_confirmation` is optional.
-- **Renamed types keep their old names until 6.1, marked deprecated:** `LineItemInput` is `LineItemInputParams`.
+- **Renamed types keep their old names until 6.1, marked deprecated:** `LineItemInput` is `LineItemInputParams`. `AddressParams` and `CompanyAddressParams` are split by action into `AddressCreateParams` / `AddressUpdateParams` and `CompanyAddressCreateParams` / `CompanyAddressUpdateParams`: creating requires the name, street, city and country, and updating takes any of them.
### Country and currency codes are typed
diff --git a/packages/admin-sdk/src/admin-client.ts b/packages/admin-sdk/src/admin-client.ts
index a79c388db9..db70c057c4 100644
--- a/packages/admin-sdk/src/admin-client.ts
+++ b/packages/admin-sdk/src/admin-client.ts
@@ -398,9 +398,10 @@ import type {
ApiKeyUpdateParams,
BulkTagsParams,
CatalogAssignParams,
+ CatalogCreateParams,
CatalogOrderMinimumParams,
- CatalogParams,
CatalogProductTermsParams,
+ CatalogUpdateParams,
CategoryCreateParams,
CategoryRepositionParams,
CategoryUpdateParams,
@@ -418,10 +419,13 @@ import type {
CommissionRateCreateParams,
CommissionRateUpdateParams,
CommissionRuleType,
- CompanyAddressParams,
+ CompanyAddressCreateParams,
+ CompanyAddressUpdateParams,
+ CompanyCreateParams,
CompanyMembershipCreateParams,
- CompanyParams,
- CustomerAddressParams,
+ CompanyUpdateParams,
+ CustomerAddressCreateParams,
+ CustomerAddressUpdateParams,
CustomerBulkGroupsParams,
CustomerCreateParams,
CustomerGroupCreateParams,
@@ -437,13 +441,16 @@ import type {
CustomFieldUpdateParams,
DeliveryCreateParams,
DeliveryMarkDeliveredParams,
- DeliveryMethodParams,
+ DeliveryMethodCreateParams,
DeliveryMethodRuleCreateParams,
DeliveryMethodRuleUpdateParams,
+ DeliveryMethodUpdateParams,
DeliveryOriginGroupParams,
- DeliveryProfileParams,
+ DeliveryProfileCreateParams,
+ DeliveryProfileUpdateParams,
DeliveryUpdateParams,
- DeliveryZoneParams,
+ DeliveryZoneCreateParams,
+ DeliveryZoneUpdateParams,
DigitalAssetCreateParams,
DigitalAssetProvider,
DigitalAssetUpdateParams,
@@ -501,6 +508,7 @@ import type {
PackageTypeUpdateParams,
PasswordResetParams,
PasswordResetRequestParams,
+ PaymentCaptureParams,
PaymentCreateParams,
PaymentMethodCreateParams,
PaymentMethodType,
@@ -585,9 +593,12 @@ import type {
SupplierUpdateParams,
TaxCategoryCreateParams,
TaxCategoryUpdateParams,
- TaxExemptionCertificateParams,
- TaxIdentifierParams,
- TaxRateParams,
+ TaxExemptionCertificateCreateParams,
+ TaxExemptionCertificateUpdateParams,
+ TaxIdentifierCreateParams,
+ TaxIdentifierUpdateParams,
+ TaxRateCreateParams,
+ TaxRateUpdateParams,
TrackingCarrierOption,
VariantCreateParams,
VariantUpdateParams,
@@ -2324,8 +2335,17 @@ export class AdminClient {
): Promise<Payment> =>
this.request<Payment>('POST', `/orders/${orderId}/payments`, { ...options, body: params }),
- capture: (orderId: string, id: string, options?: RequestOptions): Promise<Payment> =>
- this.request<Payment>('PATCH', `/orders/${orderId}/payments/${id}/capture`, options),
+ /** Captures the payment: the full authorized amount, or `amount` for a partial capture. */
+ capture: (
+ orderId: string,
+ id: string,
+ params?: PaymentCaptureParams,
+ options?: RequestOptions,
+ ): Promise<Payment> =>
+ this.request<Payment>('PATCH', `/orders/${orderId}/payments/${id}/capture`, {
+ ...options,
+ body: params,
+ }),
void: (orderId: string, id: string, options?: RequestOptions): Promise<Payment> =>
this.request<Payment>('PATCH', `/orders/${orderId}/payments/${id}/void`, options),
@@ -2528,12 +2548,15 @@ export class AdminClient {
get: (id: string, options?: RequestOptions): Promise<DeliveryMethod> =>
this.request<DeliveryMethod>('GET', `/delivery_methods/${id}`, options),
- create: (params: DeliveryMethodParams, options?: RequestOptions): Promise<DeliveryMethod> =>
+ create: (
+ params: DeliveryMethodCreateParams,
+ options?: RequestOptions,
+ ): Promise<DeliveryMethod> =>
this.request<DeliveryMethod>('POST', '/delivery_methods', { ...options, body: params }),
update: (
id: string,
- params: DeliveryMethodParams,
+ params: DeliveryMethodUpdateParams,
options?: RequestOptions,
): Promise<DeliveryMethod> =>
this.request<DeliveryMethod>('PATCH', `/delivery_methods/${id}`, {
@@ -2653,7 +2676,10 @@ export class AdminClient {
get: (id: string, options?: RequestOptions): Promise<DeliveryProfile> =>
this.request<DeliveryProfile>('GET', `/delivery_profiles/${id}`, options),
- create: (params: DeliveryProfileParams, options?: RequestOptions): Promise<DeliveryProfile> =>
+ create: (
+ params: DeliveryProfileCreateParams,
+ options?: RequestOptions,
+ ): Promise<DeliveryProfile> =>
this.request<DeliveryProfile>('POST', '/delivery_profiles', {
...options,
body: params,
@@ -2662,7 +2688,7 @@ export class AdminClient {
/** `stock_location_ids` replaces the profile's full location set. */
update: (
id: string,
- params: DeliveryProfileParams,
+ params: DeliveryProfileUpdateParams,
options?: RequestOptions,
): Promise<DeliveryProfile> =>
this.request<DeliveryProfile>('PATCH', `/delivery_profiles/${id}`, {
@@ -2754,13 +2780,13 @@ export class AdminClient {
params: getParams(params),
}),
- create: (params: DeliveryZoneParams, options?: RequestOptions): Promise<DeliveryZone> =>
+ create: (params: DeliveryZoneCreateParams, options?: RequestOptions): Promise<DeliveryZone> =>
this.request<DeliveryZone>('POST', '/delivery_zones', { ...options, body: params }),
/** `members` replaces the zone's full member set atomically. */
update: (
id: string,
- params: DeliveryZoneParams,
+ params: DeliveryZoneUpdateParams,
options?: RequestOptions,
): Promise<DeliveryZone> =>
this.request<DeliveryZone>('PATCH', `/delivery_zones/${id}`, { ...options, body: params }),
@@ -3855,10 +3881,10 @@ export class AdminClient {
get: (id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<TaxRate> =>
this.request<TaxRate>('GET', `/tax_rates/${id}`, { ...options, params: getParams(params) }),
- create: (params: TaxRateParams, options?: RequestOptions): Promise<TaxRate> =>
+ create: (params: TaxRateCreateParams, options?: RequestOptions): Promise<TaxRate> =>
this.request<TaxRate>('POST', '/tax_rates', { ...options, body: params }),
- update: (id: string, params: TaxRateParams, options?: RequestOptions): Promise<TaxRate> =>
+ update: (id: string, params: TaxRateUpdateParams, options?: RequestOptions): Promise<TaxRate> =>
this.request<TaxRate>('PATCH', `/tax_rates/${id}`, { ...options, body: params }),
delete: (id: string, options?: RequestOptions): Promise<void> =>
@@ -3920,11 +3946,11 @@ export class AdminClient {
get: (id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<Company> =>
this.request<Company>('GET', `/companies/${id}`, { ...options, params: getParams(params) }),
- create: (params: CompanyParams, options?: RequestOptions): Promise<Company> =>
+ create: (params: CompanyCreateParams, options?: RequestOptions): Promise<Company> =>
this.request<Company>('POST', '/companies', { ...options, body: params }),
/** Re-parenting is an ordinary update — depth, cycle and store revalidate. */
- update: (id: string, params: CompanyParams, options?: RequestOptions): Promise<Company> =>
+ update: (id: string, params: CompanyUpdateParams, options?: RequestOptions): Promise<Company> =>
this.request<Company>('PATCH', `/companies/${id}`, { ...options, body: params }),
/** Destroys the node and its whole subtree. */
@@ -3944,7 +3970,7 @@ export class AdminClient {
create: (
companyId: string,
- params: CompanyAddressParams,
+ params: CompanyAddressCreateParams,
options?: RequestOptions,
): Promise<Address> =>
this.request<Address>('POST', `/companies/${companyId}/addresses`, {
@@ -3959,7 +3985,7 @@ export class AdminClient {
update: (
companyId: string,
id: string,
- params: CompanyAddressParams,
+ params: CompanyAddressUpdateParams,
options?: RequestOptions,
): Promise<Address> =>
this.request<Address>('PATCH', `/companies/${companyId}/addresses/${id}`, {
@@ -4066,7 +4092,7 @@ export class AdminClient {
create: (
companyId: string,
- params: TaxIdentifierParams,
+ params: TaxIdentifierCreateParams,
options?: RequestOptions,
): Promise<TaxIdentifier> =>
this.request<TaxIdentifier>('POST', `/companies/${companyId}/tax_identifiers`, {
@@ -4077,7 +4103,7 @@ export class AdminClient {
update: (
companyId: string,
id: string,
- params: TaxIdentifierParams,
+ params: TaxIdentifierUpdateParams,
options?: RequestOptions,
): Promise<TaxIdentifier> =>
this.request<TaxIdentifier>('PATCH', `/companies/${companyId}/tax_identifiers/${id}`, {
@@ -4140,7 +4166,7 @@ export class AdminClient {
create: (
companyId: string,
- params: TaxExemptionCertificateParams,
+ params: TaxExemptionCertificateCreateParams,
options?: RequestOptions,
): Promise<TaxExemptionCertificate> =>
this.request<TaxExemptionCertificate>(
@@ -4152,7 +4178,7 @@ export class AdminClient {
update: (
companyId: string,
id: string,
- params: TaxExemptionCertificateParams,
+ params: TaxExemptionCertificateUpdateParams,
options?: RequestOptions,
): Promise<TaxExemptionCertificate> =>
this.request<TaxExemptionCertificate>(
@@ -4226,10 +4252,10 @@ export class AdminClient {
get: (id: string, params?: { expand?: string[] }, options?: RequestOptions): Promise<Catalog> =>
this.request<Catalog>('GET', `/catalogs/${id}`, { ...options, params: getParams(params) }),
- create: (params: CatalogParams, options?: RequestOptions): Promise<Catalog> =>
+ create: (params: CatalogCreateParams, options?: RequestOptions): Promise<Catalog> =>
this.request<Catalog>('POST', '/catalogs', { ...options, body: params }),
- update: (id: string, params: CatalogParams, options?: RequestOptions): Promise<Catalog> =>
+ update: (id: string, params: CatalogUpdateParams, options?: RequestOptions): Promise<Catalog> =>
this.request<Catalog>('PATCH', `/catalogs/${id}`, { ...options, body: params }),
delete: (id: string, options?: RequestOptions): Promise<void> =>
@@ -4576,7 +4602,7 @@ export class AdminClient {
create: (
customerId: string,
- params: CustomerAddressParams,
+ params: CustomerAddressCreateParams,
options?: RequestOptions,
): Promise<Address> =>
this.request<Address>('POST', `/customers/${customerId}/addresses`, {
@@ -4587,7 +4613,7 @@ export class AdminClient {
update: (
customerId: string,
id: string,
- params: CustomerAddressParams,
+ params: CustomerAddressUpdateParams,
options?: RequestOptions,
): Promise<Address> =>
this.request<Address>('PATCH', `/customers/${customerId}/addresses/${id}`, {
@@ -4625,7 +4651,7 @@ export class AdminClient {
create: (
customerId: string,
- params: TaxIdentifierParams,
+ params: TaxIdentifierCreateParams,
options?: RequestOptions,
): Promise<TaxIdentifier> =>
this.request<TaxIdentifier>('POST', `/customers/${customerId}/tax_identifiers`, {
@@ -4636,7 +4662,7 @@ export class AdminClient {
update: (
customerId: string,
id: string,
- params: TaxIdentifierParams,
+ params: TaxIdentifierUpdateParams,
options?: RequestOptions,
): Promise<TaxIdentifier> =>
this.request<TaxIdentifier>('PATCH', `/customers/${customerId}/tax_identifiers/${id}`, {
diff --git a/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts b/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts
index 8ab233b304..3eb9b71905 100644
--- a/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts
+++ b/packages/admin-sdk/src/types/generated/TaxExemptionCertificate.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 032a43324d0961779d3ce9f302bda211
+// Typelizer digest b43c78cad5d130684a4db151a0be6c39
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {TaxExemptionCertificateStatus, CountryCode} from '@/types'
@@ -10,9 +10,9 @@ interface TaxExemptionCertificate {
status: TaxExemptionCertificateStatus;
issuing_authority: string | null;
metadata: Record<string, unknown> | null;
- issued_at: string;
- expires_at: string;
- verified_at: string;
+ issued_at: string | null;
+ expires_at: string | null;
+ verified_at: string | null;
created_at: string;
updated_at: string;
company_id: string;
diff --git a/packages/admin-sdk/src/types/params/CatalogCreateParams.ts b/packages/admin-sdk/src/types/params/CatalogCreateParams.ts
new file mode 100644
index 0000000000..94d2dc7b8a
--- /dev/null
+++ b/packages/admin-sdk/src/types/params/CatalogCreateParams.ts
@@ -0,0 +1,40 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { CatalogAssignmentParams } from './CatalogAssignmentParams'
+import type { CatalogOrderMinimumParams } from './CatalogOrderMinimumParams'
+import type { CatalogPriceListParams } from './CatalogPriceListParams'
+
+export type CatalogCreateParams = {
+ name: string
+ /** Internal note on what the agreement is, never shown to shoppers. */
+ description?: string | null
+ active?: boolean
+ position?: number
+ /**
+ * The catalog-wide quantity terms, between a variant's own rule and a per-variant override. Null
+ * leaves the field to the variant's own rule.
+ */
+ minimum_order_quantity?: number | null
+ /**
+ * The catalog-wide quantity terms, between a variant's own rule and a per-variant override. Null
+ * leaves the field to the variant's own rule.
+ */
+ order_multiple?: number | null
+ metadata?: Record<string, unknown>
+ /**
+ * The whole audience. An entry left out is withdrawn; omitting the key leaves the audience alone.
+ */
+ assignments?: CatalogAssignmentParams[]
+ /**
+ * The whole order-minimum set. A currency left out has its minimum lifted; omitting the key
+ * leaves them alone.
+ */
+ order_minimums?: CatalogOrderMinimumParams[]
+ /**
+ * The price list this catalog prices through, written inline: an object creates the owned list or
+ * updates it. Null deletes the list (a soft delete). Omit the key, or send `{}`, to leave the
+ * pricing alone. A catalog with an empty assortment prices without hiding anything; curate or
+ * import products to make it restrictive.
+ */
+ price_list?: CatalogPriceListParams | null
+}
diff --git a/packages/admin-sdk/src/types/params/CatalogParams.ts b/packages/admin-sdk/src/types/params/CatalogUpdateParams.ts
similarity index 97%
rename from packages/admin-sdk/src/types/params/CatalogParams.ts
rename to packages/admin-sdk/src/types/params/CatalogUpdateParams.ts
index adafd248b9..e7c4a682f9 100644
--- a/packages/admin-sdk/src/types/params/CatalogParams.ts
+++ b/packages/admin-sdk/src/types/params/CatalogUpdateParams.ts
@@ -4,7 +4,7 @@ import type { CatalogAssignmentParams } from './CatalogAssignmentParams'
import type { CatalogOrderMinimumParams } from './CatalogOrderMinimumParams'
import type { CatalogPriceListParams } from './CatalogPriceListParams'
-export type CatalogParams = {
+export type CatalogUpdateParams = {
name?: string
/** Internal note on what the agreement is, never shown to shoppers. */
description?: string | null
diff --git a/packages/admin-sdk/src/types/params/CompanyAddressCreateParams.ts b/packages/admin-sdk/src/types/params/CompanyAddressCreateParams.ts
new file mode 100644
index 0000000000..61b5683e4f
--- /dev/null
+++ b/packages/admin-sdk/src/types/params/CompanyAddressCreateParams.ts
@@ -0,0 +1,31 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { CountryCode } from '../generated'
+
+export type CompanyAddressCreateParams = {
+ first_name: string
+ last_name: string
+ company?: string
+ address1: string
+ address2?: string
+ city: string
+ postal_code?: string
+ phone?: string
+ label?: string
+ /** ISO 3166-1 alpha-2 code, such as `US`. */
+ country_code: CountryCode
+ /** The state or province abbreviation, such as `NY`. */
+ state_code?: string
+ /** For countries without states in the database. */
+ state_name?: string
+ /**
+ * True makes this the default address of that kind, false gives the slot up, and leaving it out
+ * keeps the current default.
+ */
+ default_billing?: boolean
+ /**
+ * True makes this the default address of that kind, false gives the slot up, and leaving it out
+ * keeps the current default.
+ */
+ default_shipping?: boolean
+}
diff --git a/packages/admin-sdk/src/types/params/CompanyAddressParams.ts b/packages/admin-sdk/src/types/params/CompanyAddressUpdateParams.ts
similarity index 95%
rename from packages/admin-sdk/src/types/params/CompanyAddressParams.ts
rename to packages/admin-sdk/src/types/params/CompanyAddressUpdateParams.ts
index baf8fe9f14..3e98e5b044 100644
--- a/packages/admin-sdk/src/types/params/CompanyAddressParams.ts
+++ b/packages/admin-sdk/src/types/params/CompanyAddressUpdateParams.ts
@@ -2,7 +2,7 @@
import type { CountryCode } from '../generated'
-export type CompanyAddressParams = {
+export type CompanyAddressUpdateParams = {
first_name?: string
last_name?: string
company?: string
diff --git a/packages/admin-sdk/src/types/params/CompanyCreateParams.ts b/packages/admin-sdk/src/types/params/CompanyCreateParams.ts
new file mode 100644
index 0000000000..07e7e7f96d
--- /dev/null
+++ b/packages/admin-sdk/src/types/params/CompanyCreateParams.ts
@@ -0,0 +1,25 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+export type CompanyCreateParams = {
+ /**
+ * Identities the record has in external systems, keyed by system: the same
+ * `{ system: external_id }` map the Admin API renders, so what you read can be sent straight
+ * back. Systems you do not name keep the reference they have. A list of `{ system, external_id }`
+ * entries is accepted too.
+ */
+ external_references?: Record<string, unknown>
+ name: string
+ /**
+ * `company` is a legal entity (may hold tax registrations), `division` an organizational unit.
+ * Roots must be `company`.
+ */
+ kind?: 'company' | 'division'
+ /** The parent node. Omit or null for a root. */
+ parent_id?: string | null
+ /**
+ * Whether this buyer's own procurement process demands a PO reference on every order: checkout
+ * asks for one and refuses to complete without it.
+ */
+ po_number_required?: boolean
+ metadata?: Record<string, unknown>
+}
diff --git a/packages/admin-sdk/src/types/params/CompanyParams.ts b/packages/admin-sdk/src/types/params/CompanyUpdateParams.ts
similarity index 94%
rename from packages/admin-sdk/src/types/params/CompanyParams.ts
rename to packages/admin-sdk/src/types/params/CompanyUpdateParams.ts
index 42853201af..ab61ec8289 100644
--- a/packages/admin-sdk/src/types/params/CompanyParams.ts
+++ b/packages/admin-sdk/src/types/params/CompanyUpdateParams.ts
@@ -1,6 +1,6 @@
// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
-export type CompanyParams = {
+export type CompanyUpdateParams = {
/**
* Identities the record has in external systems, keyed by system: the same
* `{ system: external_id }` map the Admin API renders, so what you read can be sent straight
@@ -8,7 +8,6 @@ export type CompanyParams = {
* entries is accepted too.
*/
external_references?: Record<string, unknown>
- /** Required when creating. */
name?: string
/**
* `company` is a legal entity (may hold tax registrations), `division` an organizational unit.
diff --git a/packages/admin-sdk/src/types/params/CustomerAddressCreateParams.ts b/packages/admin-sdk/src/types/params/CustomerAddressCreateParams.ts
new file mode 100644
index 0000000000..46ad16e0ec
--- /dev/null
+++ b/packages/admin-sdk/src/types/params/CustomerAddressCreateParams.ts
@@ -0,0 +1,27 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { CountryCode } from '../generated'
+
+export type CustomerAddressCreateParams = {
+ first_name: string
+ last_name: string
+ company?: string
+ address1: string
+ address2?: string
+ city: string
+ postal_code?: string
+ phone?: string
+ label?: string
+ /** ISO 3166-1 alpha-2 code, such as `US`. */
+ country_code: CountryCode
+ /** The state or province abbreviation, such as `NY`. */
+ state_code?: string
+ /** For countries without states in the database. */
+ state_name?: string
+ alternative_phone?: string
+ quick_checkout?: boolean
+ /** Makes this the customer's default address of that kind. */
+ is_default_billing?: boolean
+ /** Makes this the customer's default address of that kind. */
+ is_default_shipping?: boolean
+}
diff --git a/packages/admin-sdk/src/types/params/CustomerAddressParams.ts b/packages/admin-sdk/src/types/params/CustomerAddressUpdateParams.ts
similarity index 95%
rename from packages/admin-sdk/src/types/params/CustomerAddressParams.ts
rename to packages/admin-sdk/src/types/params/CustomerAddressUpdateParams.ts
index 28260a3849..22fd88fa94 100644
--- a/packages/admin-sdk/src/types/params/CustomerAddressParams.ts
+++ b/packages/admin-sdk/src/types/params/CustomerAddressUpdateParams.ts
@@ -2,7 +2,7 @@
import type { CountryCode } from '../generated'
-export type CustomerAddressParams = {
+export type CustomerAddressUpdateParams = {
first_name?: string
last_name?: string
company?: string
diff --git a/packages/admin-sdk/src/types/params/DeliveryMethodCreateParams.ts b/packages/admin-sdk/src/types/params/DeliveryMethodCreateParams.ts
new file mode 100644
index 0000000000..8e49592c5c
--- /dev/null
+++ b/packages/admin-sdk/src/types/params/DeliveryMethodCreateParams.ts
@@ -0,0 +1,72 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { DeliveryMethodServiceParams } from './DeliveryMethodServiceParams'
+
+export type DeliveryMethodCreateParams = {
+ name: string
+ admin_name?: string | null
+ code?: string | null
+ /** Fulfillment provider shorthand (see the fulfillment providers endpoint), e.g. `manual`. */
+ fulfillment_provider?: string
+ pickup_point_provider?: string | null
+ /**
+ * Rate provider shorthand (see the rate providers endpoint), e.g. `easy_post`. Omit or send null
+ * for the built-in provider, which prices through the method's calculator.
+ */
+ rate_provider?: string | null
+ storefront_visible?: boolean
+ /**
+ * Marketplace only: whether a seller's packages may be quoted by this method. Off by default, and
+ * refused on a method that belongs to a seller.
+ */
+ available_to_sellers?: boolean
+ tracking_url?: string | null
+ estimated_transit_business_days_min?: number | null
+ estimated_transit_business_days_max?: number | null
+ /** Prefixed tax category ID (`taxcat_...`), or null to clear. */
+ tax_category_id?: string | null
+ /** Method-level flat handling fee added on top of provider-quoted rates. */
+ markup_flat?: string | null
+ /**
+ * Method-level percentage handling fee added on top of provider-quoted rates. Ignored for
+ * calculator-priced methods.
+ */
+ markup_percent?: string | null
+ /** Delivery profile this method belongs to (`fp_...`); defaults to the store default profile. */
+ delivery_profile_id?: string
+ /**
+ * Origin group offering this method (`og_...`); defaults to the zone's group, else the profile's
+ * default group.
+ */
+ delivery_origin_group_id?: string
+ /**
+ * Delivery zone narrowing destinations (`dz_...`), or null for no restriction. Must belong to the
+ * method's profile.
+ */
+ delivery_zone_id?: string | null
+ /** Pickup locations (`sloc_...`); replaces the full set. */
+ stock_location_ids?: string[]
+ /**
+ * How the method prices a shipment: a type from the calculators endpoint and its preferences,
+ * matching that type's `schema`.
+ */
+ calculator?: {
+ type?: string
+ preferences?: Record<string, unknown>
+ }
+ /** Eligibility rules. Replaces the full set: omitted rules are removed. */
+ rules?: {
+ id?: string
+ /** A rule kind from the delivery method rule types endpoint. */
+ type?: string
+ active?: boolean
+ preferences?: Record<string, unknown>
+ /** Products an association-backed rule (`excluded_products_rule`) applies to. */
+ product_ids?: string[]
+ }[]
+ /**
+ * Carrier service rows: which provider services this method offers. Replaces the full set:
+ * omitted rows are removed; no rows means every service the provider returns is offered.
+ */
+ services?: DeliveryMethodServiceParams[]
+}
diff --git a/packages/admin-sdk/src/types/params/DeliveryMethodParams.ts b/packages/admin-sdk/src/types/params/DeliveryMethodUpdateParams.ts
similarity index 98%
rename from packages/admin-sdk/src/types/params/DeliveryMethodParams.ts
rename to packages/admin-sdk/src/types/params/DeliveryMethodUpdateParams.ts
index 70c78d4233..13086f26bc 100644
--- a/packages/admin-sdk/src/types/params/DeliveryMethodParams.ts
+++ b/packages/admin-sdk/src/types/params/DeliveryMethodUpdateParams.ts
@@ -2,7 +2,7 @@
import type { DeliveryMethodServiceParams } from './DeliveryMethodServiceParams'
-export type DeliveryMethodParams = {
+export type DeliveryMethodUpdateParams = {
name?: string
admin_name?: string | null
code?: string | null
diff --git a/packages/admin-sdk/src/types/params/DeliveryProfileCreateParams.ts b/packages/admin-sdk/src/types/params/DeliveryProfileCreateParams.ts
new file mode 100644
index 0000000000..5e9580c9a2
--- /dev/null
+++ b/packages/admin-sdk/src/types/params/DeliveryProfileCreateParams.ts
@@ -0,0 +1,18 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+export type DeliveryProfileCreateParams = {
+ name: string
+ /**
+ * Registered profile kind (`shipping`, `digital`, extension kinds) from the kinds endpoint. Read
+ * on create only; defaults to shipping.
+ */
+ kind?: string
+ /** Promotes this profile to the store default; the previous default is demoted. */
+ default?: boolean
+ position?: number
+ /**
+ * Prefixed stock location IDs (`sloc_...`); replaces the full set. Empty means every store
+ * location.
+ */
+ stock_location_ids?: string[]
+}
diff --git a/packages/admin-sdk/src/types/params/DeliveryProfileParams.ts b/packages/admin-sdk/src/types/params/DeliveryProfileUpdateParams.ts
similarity index 93%
rename from packages/admin-sdk/src/types/params/DeliveryProfileParams.ts
rename to packages/admin-sdk/src/types/params/DeliveryProfileUpdateParams.ts
index 506fc94c3f..0de110b153 100644
--- a/packages/admin-sdk/src/types/params/DeliveryProfileParams.ts
+++ b/packages/admin-sdk/src/types/params/DeliveryProfileUpdateParams.ts
@@ -1,6 +1,6 @@
// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
-export type DeliveryProfileParams = {
+export type DeliveryProfileUpdateParams = {
name?: string
/**
* Registered profile kind (`shipping`, `digital`, extension kinds) from the kinds endpoint. Read
diff --git a/packages/admin-sdk/src/types/params/DeliveryZoneCreateParams.ts b/packages/admin-sdk/src/types/params/DeliveryZoneCreateParams.ts
new file mode 100644
index 0000000000..42403f2aa9
--- /dev/null
+++ b/packages/admin-sdk/src/types/params/DeliveryZoneCreateParams.ts
@@ -0,0 +1,14 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { DeliveryZoneMemberParams } from './DeliveryZoneMemberParams'
+
+export type DeliveryZoneCreateParams = {
+ name: string
+ description?: string | null
+ /** Delivery profile this zone belongs to (`fp_...`); defaults to the store default profile. */
+ delivery_profile_id?: string
+ /** Origin group this zone belongs to (`og_...`). */
+ delivery_origin_group_id?: string
+ /** Replaces the zone's full member set atomically. */
+ members?: DeliveryZoneMemberParams[]
+}
diff --git a/packages/admin-sdk/src/types/params/DeliveryZoneParams.ts b/packages/admin-sdk/src/types/params/DeliveryZoneUpdateParams.ts
similarity index 93%
rename from packages/admin-sdk/src/types/params/DeliveryZoneParams.ts
rename to packages/admin-sdk/src/types/params/DeliveryZoneUpdateParams.ts
index dba712b3d4..3fc8cff096 100644
--- a/packages/admin-sdk/src/types/params/DeliveryZoneParams.ts
+++ b/packages/admin-sdk/src/types/params/DeliveryZoneUpdateParams.ts
@@ -2,7 +2,7 @@
import type { DeliveryZoneMemberParams } from './DeliveryZoneMemberParams'
-export type DeliveryZoneParams = {
+export type DeliveryZoneUpdateParams = {
name?: string
description?: string | null
/** Delivery profile this zone belongs to (`fp_...`); defaults to the store default profile. */
diff --git a/packages/admin-sdk/src/types/params/TaxExemptionCertificateCreateParams.ts b/packages/admin-sdk/src/types/params/TaxExemptionCertificateCreateParams.ts
new file mode 100644
index 0000000000..3890893c10
--- /dev/null
+++ b/packages/admin-sdk/src/types/params/TaxExemptionCertificateCreateParams.ts
@@ -0,0 +1,18 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { CountryCode } from '../generated'
+
+export type TaxExemptionCertificateCreateParams = {
+ certificate_number: string
+ /** Becomes the tax provider's entity use code. */
+ reason_code: string
+ issuing_authority?: string | null
+ issued_at?: string | null
+ expires_at?: string | null
+ /** Where the certificate holds. Omit it and `state_code` for one valid everywhere. */
+ country_code?: CountryCode | null
+ state_code?: string | null
+ /** A `signed_id` from `files.upload()` with `visibility: 'private'`. */
+ document_signed_id?: string
+ metadata?: Record<string, unknown>
+}
diff --git a/packages/admin-sdk/src/types/params/TaxExemptionCertificateParams.ts b/packages/admin-sdk/src/types/params/TaxExemptionCertificateUpdateParams.ts
similarity index 79%
rename from packages/admin-sdk/src/types/params/TaxExemptionCertificateParams.ts
rename to packages/admin-sdk/src/types/params/TaxExemptionCertificateUpdateParams.ts
index 8efbd617e7..4f2c2b8ecf 100644
--- a/packages/admin-sdk/src/types/params/TaxExemptionCertificateParams.ts
+++ b/packages/admin-sdk/src/types/params/TaxExemptionCertificateUpdateParams.ts
@@ -2,10 +2,9 @@
import type { CountryCode } from '../generated'
-export type TaxExemptionCertificateParams = {
- /** Required when creating. */
+export type TaxExemptionCertificateUpdateParams = {
certificate_number?: string
- /** Becomes the tax provider's entity use code. Required when creating. */
+ /** Becomes the tax provider's entity use code. */
reason_code?: string
issuing_authority?: string | null
issued_at?: string | null
diff --git a/packages/admin-sdk/src/types/params/TaxIdentifierCreateParams.ts b/packages/admin-sdk/src/types/params/TaxIdentifierCreateParams.ts
new file mode 100644
index 0000000000..410f49bf83
--- /dev/null
+++ b/packages/admin-sdk/src/types/params/TaxIdentifierCreateParams.ts
@@ -0,0 +1,10 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+export type TaxIdentifierCreateParams = {
+ /**
+ * The registration the number belongs to, such as `eu_vat` or `gb_vat`. Any kind is accepted; one
+ * with a registered validator is checked by it. Built-in: `eu_vat`. Extensions may register more.
+ */
+ kind: string
+ value: string
+}
diff --git a/packages/admin-sdk/src/types/params/TaxIdentifierParams.ts b/packages/admin-sdk/src/types/params/TaxIdentifierUpdateParams.ts
similarity index 79%
rename from packages/admin-sdk/src/types/params/TaxIdentifierParams.ts
rename to packages/admin-sdk/src/types/params/TaxIdentifierUpdateParams.ts
index 094c5d4af0..9da495633d 100644
--- a/packages/admin-sdk/src/types/params/TaxIdentifierParams.ts
+++ b/packages/admin-sdk/src/types/params/TaxIdentifierUpdateParams.ts
@@ -1,12 +1,10 @@
// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
-export type TaxIdentifierParams = {
+export type TaxIdentifierUpdateParams = {
/**
* The registration the number belongs to, such as `eu_vat` or `gb_vat`. Any kind is accepted; one
* with a registered validator is checked by it. Built-in: `eu_vat`. Extensions may register more.
- * Required when creating.
*/
kind?: string
- /** Required when creating. */
value?: string
}
diff --git a/packages/admin-sdk/src/types/params/TaxRateCreateParams.ts b/packages/admin-sdk/src/types/params/TaxRateCreateParams.ts
new file mode 100644
index 0000000000..04a98d58a1
--- /dev/null
+++ b/packages/admin-sdk/src/types/params/TaxRateCreateParams.ts
@@ -0,0 +1,20 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { CountryCode } from '../generated'
+
+export type TaxRateCreateParams = {
+ /** Customer-facing rate name. */
+ name: string
+ /** The rate as a fraction. Send this or `rate_percent`. */
+ rate?: string
+ /** The rate as a percentage. */
+ rate_percent?: string
+ included_in_price?: boolean
+ show_rate_in_label?: boolean
+ tax_category_id: string
+ /** ISO country code. A rate naming no country taxes everywhere. */
+ country_code?: CountryCode | null
+ /** State abbreviation within that country. */
+ state_code?: string | null
+ metadata?: Record<string, unknown>
+}
diff --git a/packages/admin-sdk/src/types/params/TaxRateParams.ts b/packages/admin-sdk/src/types/params/TaxRateUpdateParams.ts
similarity index 94%
rename from packages/admin-sdk/src/types/params/TaxRateParams.ts
rename to packages/admin-sdk/src/types/params/TaxRateUpdateParams.ts
index 37ae0728f0..69b08e2c7a 100644
--- a/packages/admin-sdk/src/types/params/TaxRateParams.ts
+++ b/packages/admin-sdk/src/types/params/TaxRateUpdateParams.ts
@@ -2,7 +2,7 @@
import type { CountryCode } from '../generated'
-export type TaxRateParams = {
+export type TaxRateUpdateParams = {
/** Customer-facing rate name. */
name?: string
/** The rate as a fraction. Send this or `rate_percent`. */
diff --git a/packages/admin-sdk/src/types/params/index.ts b/packages/admin-sdk/src/types/params/index.ts
index 0a4c3b520c..e63f574bb6 100644
--- a/packages/admin-sdk/src/types/params/index.ts
+++ b/packages/admin-sdk/src/types/params/index.ts
@@ -9,10 +9,11 @@ export type { ApiKeyUpdateParams } from './ApiKeyUpdateParams'
export type { BulkTagsParams } from './BulkTagsParams'
export type { CatalogAssignParams } from './CatalogAssignParams'
export type { CatalogAssignmentParams } from './CatalogAssignmentParams'
+export type { CatalogCreateParams } from './CatalogCreateParams'
export type { CatalogOrderMinimumParams } from './CatalogOrderMinimumParams'
-export type { CatalogParams } from './CatalogParams'
export type { CatalogPriceListParams } from './CatalogPriceListParams'
export type { CatalogProductTermsParams } from './CatalogProductTermsParams'
+export type { CatalogUpdateParams } from './CatalogUpdateParams'
export type { CategoryCreateParams } from './CategoryCreateParams'
export type { CategoryRepositionParams } from './CategoryRepositionParams'
export type { CategoryUpdateParams } from './CategoryUpdateParams'
@@ -31,15 +32,18 @@ export type { CollectionUpdateParams } from './CollectionUpdateParams'
export type { CommissionRateCreateParams } from './CommissionRateCreateParams'
export type { CommissionRateUpdateParams } from './CommissionRateUpdateParams'
export type { CommissionRuleDraftParams } from './CommissionRuleDraftParams'
-export type { CompanyAddressParams } from './CompanyAddressParams'
+export type { CompanyAddressCreateParams } from './CompanyAddressCreateParams'
+export type { CompanyAddressUpdateParams } from './CompanyAddressUpdateParams'
+export type { CompanyCreateParams } from './CompanyCreateParams'
export type { CompanyMembershipCreateParams } from './CompanyMembershipCreateParams'
-export type { CompanyParams } from './CompanyParams'
+export type { CompanyUpdateParams } from './CompanyUpdateParams'
export type { CustomFieldCreateParams } from './CustomFieldCreateParams'
export type { CustomFieldDefinitionCreateParams } from './CustomFieldDefinitionCreateParams'
export type { CustomFieldDefinitionUpdateParams } from './CustomFieldDefinitionUpdateParams'
export type { CustomFieldUpdateParams } from './CustomFieldUpdateParams'
export type { CustomFieldValueParams } from './CustomFieldValueParams'
-export type { CustomerAddressParams } from './CustomerAddressParams'
+export type { CustomerAddressCreateParams } from './CustomerAddressCreateParams'
+export type { CustomerAddressUpdateParams } from './CustomerAddressUpdateParams'
export type { CustomerBulkGroupsParams } from './CustomerBulkGroupsParams'
export type { CustomerCreateParams } from './CustomerCreateParams'
export type { CustomerGroupCreateParams } from './CustomerGroupCreateParams'
@@ -50,15 +54,18 @@ export type { CustomerUpdateParams } from './CustomerUpdateParams'
export type { DataRequestCreateParams } from './DataRequestCreateParams'
export type { DeliveryCreateParams } from './DeliveryCreateParams'
export type { DeliveryMarkDeliveredParams } from './DeliveryMarkDeliveredParams'
-export type { DeliveryMethodParams } from './DeliveryMethodParams'
+export type { DeliveryMethodCreateParams } from './DeliveryMethodCreateParams'
export type { DeliveryMethodRuleCreateParams } from './DeliveryMethodRuleCreateParams'
export type { DeliveryMethodRuleUpdateParams } from './DeliveryMethodRuleUpdateParams'
export type { DeliveryMethodServiceParams } from './DeliveryMethodServiceParams'
+export type { DeliveryMethodUpdateParams } from './DeliveryMethodUpdateParams'
export type { DeliveryOriginGroupParams } from './DeliveryOriginGroupParams'
-export type { DeliveryProfileParams } from './DeliveryProfileParams'
+export type { DeliveryProfileCreateParams } from './DeliveryProfileCreateParams'
+export type { DeliveryProfileUpdateParams } from './DeliveryProfileUpdateParams'
export type { DeliveryUpdateParams } from './DeliveryUpdateParams'
+export type { DeliveryZoneCreateParams } from './DeliveryZoneCreateParams'
export type { DeliveryZoneMemberParams } from './DeliveryZoneMemberParams'
-export type { DeliveryZoneParams } from './DeliveryZoneParams'
+export type { DeliveryZoneUpdateParams } from './DeliveryZoneUpdateParams'
export type { DigitalAssetCreateParams } from './DigitalAssetCreateParams'
export type { DigitalAssetUpdateParams } from './DigitalAssetUpdateParams'
export type { DiscountCodeApplyParams } from './DiscountCodeApplyParams'
@@ -210,9 +217,12 @@ export type { SupplierCreateParams } from './SupplierCreateParams'
export type { SupplierUpdateParams } from './SupplierUpdateParams'
export type { TaxCategoryCreateParams } from './TaxCategoryCreateParams'
export type { TaxCategoryUpdateParams } from './TaxCategoryUpdateParams'
-export type { TaxExemptionCertificateParams } from './TaxExemptionCertificateParams'
-export type { TaxIdentifierParams } from './TaxIdentifierParams'
-export type { TaxRateParams } from './TaxRateParams'
+export type { TaxExemptionCertificateCreateParams } from './TaxExemptionCertificateCreateParams'
+export type { TaxExemptionCertificateUpdateParams } from './TaxExemptionCertificateUpdateParams'
+export type { TaxIdentifierCreateParams } from './TaxIdentifierCreateParams'
+export type { TaxIdentifierUpdateParams } from './TaxIdentifierUpdateParams'
+export type { TaxRateCreateParams } from './TaxRateCreateParams'
+export type { TaxRateUpdateParams } from './TaxRateUpdateParams'
export type { TranslationBatchEntryParams } from './TranslationBatchEntryParams'
export type { TranslationBatchParams } from './TranslationBatchParams'
export type { VariantCreateParams } from './VariantCreateParams'
diff --git a/packages/admin-sdk/src/zod/generated/TaxExemptionCertificate.ts b/packages/admin-sdk/src/zod/generated/TaxExemptionCertificate.ts
index 08f31179d2..828827afd9 100644
--- a/packages/admin-sdk/src/zod/generated/TaxExemptionCertificate.ts
+++ b/packages/admin-sdk/src/zod/generated/TaxExemptionCertificate.ts
@@ -8,9 +8,9 @@ export const TaxExemptionCertificateSchema = z.object({
status: z.string(),
issuing_authority: z.string().nullable(),
metadata: z.record(z.string(), z.unknown()).nullable(),
- issued_at: z.string(),
- expires_at: z.string(),
- verified_at: z.string(),
+ issued_at: z.string().nullable(),
+ expires_at: z.string().nullable(),
+ verified_at: z.string().nullable(),
created_at: z.string(),
updated_at: z.string(),
company_id: z.string(),
diff --git a/packages/dashboard/src/hooks/use-catalogs.ts b/packages/dashboard/src/hooks/use-catalogs.ts
index dddb1d31b5..1033a3904d 100644
--- a/packages/dashboard/src/hooks/use-catalogs.ts
+++ b/packages/dashboard/src/hooks/use-catalogs.ts
@@ -2,7 +2,8 @@ import type {
Catalog,
CatalogAssignment,
CatalogAssignParams,
- CatalogParams,
+ CatalogCreateParams,
+ CatalogUpdateParams,
} from '@spree/admin-sdk'
import {
adminClient,
@@ -25,7 +26,7 @@ export function useCatalog(id: string | undefined) {
}
export function useCreateCatalog() {
- return useResourceMutation<Catalog, Error, CatalogParams>({
+ return useResourceMutation<Catalog, Error, CatalogCreateParams>({
mutationFn: (params) => adminClient.catalogs.create(params),
invalidate: [['catalogs']],
successMessage: i18n.t('admin.catalogs.messages.created'),
@@ -34,7 +35,7 @@ export function useCreateCatalog() {
}
export function useUpdateCatalog(id: string) {
- return useResourceMutation<Catalog, Error, CatalogParams>({
+ return useResourceMutation<Catalog, Error, CatalogUpdateParams>({
mutationFn: (params) => adminClient.catalogs.update(id, params),
invalidate: [['catalogs'], ['catalogs', id]],
successMessage: i18n.t('admin.catalogs.messages.updated'),
@@ -113,7 +114,7 @@ export function listCatalogProductsPage(catalogId: string, page: number, limit =
export interface CatalogSavePayload {
/** Settings PATCH body; omitted when the form is clean. */
- attributes?: CatalogParams
+ attributes?: CatalogUpdateParams
/** Staged assortment additions, flushed on Save. */
addProductIds?: string[]
/** Staged assortment removals, flushed on Save. */
diff --git a/packages/dashboard/src/hooks/use-companies.ts b/packages/dashboard/src/hooks/use-companies.ts
index 885ac5c6fb..deda621af7 100644
--- a/packages/dashboard/src/hooks/use-companies.ts
+++ b/packages/dashboard/src/hooks/use-companies.ts
@@ -1,15 +1,18 @@
import type {
Address,
Company,
- CompanyAddressParams,
+ CompanyAddressCreateParams,
+ CompanyAddressUpdateParams,
+ CompanyCreateParams,
CompanyInvitation,
CompanyMembership,
CompanyMembershipCreateParams,
- CompanyParams,
+ CompanyUpdateParams,
TaxExemptionCertificate,
- TaxExemptionCertificateParams,
+ TaxExemptionCertificateCreateParams,
TaxIdentifier,
- TaxIdentifierParams,
+ TaxIdentifierCreateParams,
+ TaxIdentifierUpdateParams,
} from '@spree/admin-sdk'
import {
adminClient,
@@ -59,7 +62,7 @@ export function useCompanyChildren(parentId: string | undefined, page = 1, limit
}
export function useCreateCompany() {
- return useResourceMutation<Company, Error, CompanyParams>({
+ return useResourceMutation<Company, Error, CompanyCreateParams>({
mutationFn: (params) => adminClient.companies.create(params),
invalidate: [['companies']],
successMessage: i18n.t('admin.companies.messages.created'),
@@ -68,7 +71,7 @@ export function useCreateCompany() {
}
export function useUpdateCompany(id: string) {
- return useResourceMutation<Company, Error, CompanyParams>({
+ return useResourceMutation<Company, Error, CompanyUpdateParams>({
mutationFn: (params) => adminClient.companies.update(id, params),
invalidate: [['companies'], ['companies', id]],
successMessage: i18n.t('admin.companies.messages.updated'),
@@ -106,7 +109,7 @@ export function useCompanyAddresses(companyId: string | undefined, page = 1, lim
/** Adds a labeled address to the node; the address row is owned by the entry. */
export function useCreateCompanyAddress(companyId: string) {
- return useResourceMutation<Address, Error, CompanyAddressParams>({
+ return useResourceMutation<Address, Error, CompanyAddressCreateParams>({
mutationFn: (params) => adminClient.companies.addresses.create(companyId, params),
invalidate: [['companies', companyId, 'addresses']],
successMessage: i18n.t('admin.company_addresses.messages.created'),
@@ -116,7 +119,7 @@ export function useCreateCompanyAddress(companyId: string) {
/** Edits an entry in place — the address row is updated, never replaced. */
export function useUpdateCompanyAddress(companyId: string) {
- return useResourceMutation<Address, Error, { id: string; params: CompanyAddressParams }>({
+ return useResourceMutation<Address, Error, { id: string; params: CompanyAddressUpdateParams }>({
mutationFn: ({ id, params }) => adminClient.companies.addresses.update(companyId, id, params),
invalidate: [['companies', companyId, 'addresses']],
successMessage: i18n.t('admin.company_addresses.messages.updated'),
@@ -215,7 +218,7 @@ export function useCompanyTaxIdentifiers(companyId: string | undefined) {
}
export function useCreateCompanyTaxIdentifier(companyId: string) {
- return useResourceMutation<TaxIdentifier, Error, TaxIdentifierParams>({
+ return useResourceMutation<TaxIdentifier, Error, TaxIdentifierCreateParams>({
mutationFn: (params) => adminClient.companies.taxIdentifiers.create(companyId, params),
invalidate: [['companies', companyId, 'tax-identifiers']],
successMessage: i18n.t('admin.tax_identifiers.messages.created'),
@@ -228,7 +231,11 @@ export function useCreateCompanyTaxIdentifier(companyId: string) {
* travels with the variables rather than being bound when the hook is created.
*/
export function useUpdateCompanyTaxIdentifier(companyId: string) {
- return useResourceMutation<TaxIdentifier, Error, { id: string; params: TaxIdentifierParams }>({
+ return useResourceMutation<
+ TaxIdentifier,
+ Error,
+ { id: string; params: TaxIdentifierUpdateParams }
+ >({
mutationFn: ({ id, params }) =>
adminClient.companies.taxIdentifiers.update(companyId, id, params),
invalidate: [['companies', companyId, 'tax-identifiers']],
@@ -273,7 +280,7 @@ export function useTaxExemptionCertificates(companyId: string | undefined) {
}
export function useCreateTaxExemptionCertificate(companyId: string) {
- return useResourceMutation<TaxExemptionCertificate, Error, TaxExemptionCertificateParams>({
+ return useResourceMutation<TaxExemptionCertificate, Error, TaxExemptionCertificateCreateParams>({
mutationFn: (params) =>
adminClient.companies.taxExemptionCertificates.create(companyId, params),
invalidate: [['companies', companyId, 'tax-exemption-certificates']],
diff --git a/packages/dashboard/src/hooks/use-customers.ts b/packages/dashboard/src/hooks/use-customers.ts
index 49a0e1a261..81bba0251f 100644
--- a/packages/dashboard/src/hooks/use-customers.ts
+++ b/packages/dashboard/src/hooks/use-customers.ts
@@ -1,4 +1,9 @@
-import type { Customer, TaxIdentifier, TaxIdentifierParams } from '@spree/admin-sdk'
+import type {
+ Customer,
+ TaxIdentifier,
+ TaxIdentifierCreateParams,
+ TaxIdentifierUpdateParams,
+} from '@spree/admin-sdk'
import {
adminClient,
i18n,
@@ -201,7 +206,7 @@ export function useCustomerTaxIdentifiers(customerId: string | undefined) {
}
export function useCreateCustomerTaxIdentifier(customerId: string) {
- return useResourceMutation<TaxIdentifier, Error, TaxIdentifierParams>({
+ return useResourceMutation<TaxIdentifier, Error, TaxIdentifierCreateParams>({
mutationFn: (params) => adminClient.customers.taxIdentifiers.create(customerId, params),
invalidate: [['customers', customerId, 'tax-identifiers']],
successMessage: i18n.t('admin.tax_identifiers.messages.created'),
@@ -211,7 +216,11 @@ export function useCreateCustomerTaxIdentifier(customerId: string) {
/** The id travels with the variables so one hook serves every row. */
export function useUpdateCustomerTaxIdentifier(customerId: string) {
- return useResourceMutation<TaxIdentifier, Error, { id: string; params: TaxIdentifierParams }>({
+ return useResourceMutation<
+ TaxIdentifier,
+ Error,
+ { id: string; params: TaxIdentifierUpdateParams }
+ >({
mutationFn: ({ id, params }) =>
adminClient.customers.taxIdentifiers.update(customerId, id, params),
invalidate: [['customers', customerId, 'tax-identifiers']],
diff --git a/packages/dashboard/src/hooks/use-delivery-methods.ts b/packages/dashboard/src/hooks/use-delivery-methods.ts
index 52689db0f1..373751ce10 100644
--- a/packages/dashboard/src/hooks/use-delivery-methods.ts
+++ b/packages/dashboard/src/hooks/use-delivery-methods.ts
@@ -1,4 +1,8 @@
-import type { DeliveryMethod, DeliveryMethodParams } from '@spree/admin-sdk'
+import type {
+ DeliveryMethod,
+ DeliveryMethodCreateParams,
+ DeliveryMethodUpdateParams,
+} from '@spree/admin-sdk'
import {
adminClient,
useResourceKey,
@@ -62,7 +66,7 @@ export function useAllDeliveryMethods() {
}
export function useCreateDeliveryMethod() {
- return useResourceMutation<DeliveryMethod, Error, DeliveryMethodParams>({
+ return useResourceMutation<DeliveryMethod, Error, DeliveryMethodCreateParams>({
mutationFn: (params) => adminClient.deliveryMethods.create(params),
invalidate: [['delivery-methods']],
successMessage: i18n.t('admin.delivery_methods.messages.created'),
@@ -71,7 +75,7 @@ export function useCreateDeliveryMethod() {
}
export function useUpdateDeliveryMethod(id: string) {
- return useResourceMutation<DeliveryMethod, Error, DeliveryMethodParams>({
+ return useResourceMutation<DeliveryMethod, Error, DeliveryMethodUpdateParams>({
mutationFn: (params) => adminClient.deliveryMethods.update(id, params),
invalidate: [['delivery-methods'], ['delivery-methods', id]],
successMessage: i18n.t('admin.delivery_methods.messages.updated'),
diff --git a/packages/dashboard/src/hooks/use-delivery-profiles.ts b/packages/dashboard/src/hooks/use-delivery-profiles.ts
index d0b99c49c8..f730f493fe 100644
--- a/packages/dashboard/src/hooks/use-delivery-profiles.ts
+++ b/packages/dashboard/src/hooks/use-delivery-profiles.ts
@@ -1,4 +1,8 @@
-import type { DeliveryProfile, DeliveryProfileParams } from '@spree/admin-sdk'
+import type {
+ DeliveryProfile,
+ DeliveryProfileCreateParams,
+ DeliveryProfileUpdateParams,
+} from '@spree/admin-sdk'
import {
adminClient,
useResourceKey,
@@ -40,7 +44,11 @@ export function useDeliveryProfileKinds() {
}
export function useCreateDeliveryProfile() {
- return useResourceMutation<DeliveryProfile, Error, DeliveryProfileParams & { name: string }>({
+ return useResourceMutation<
+ DeliveryProfile,
+ Error,
+ DeliveryProfileCreateParams & { name: string }
+ >({
mutationFn: (params) => adminClient.deliveryProfiles.create(params),
invalidate: [['delivery-profiles']],
successMessage: i18n.t('admin.delivery_profiles.messages.created'),
@@ -49,7 +57,7 @@ export function useCreateDeliveryProfile() {
}
export function useUpdateDeliveryProfile(id: string) {
- return useResourceMutation<DeliveryProfile, Error, DeliveryProfileParams>({
+ return useResourceMutation<DeliveryProfile, Error, DeliveryProfileUpdateParams>({
mutationFn: (params) => adminClient.deliveryProfiles.update(id, params),
invalidate: [['delivery-profiles'], ['delivery-profiles', id]],
successMessage: i18n.t('admin.delivery_profiles.messages.updated'),
diff --git a/packages/dashboard/src/hooks/use-delivery-zones.ts b/packages/dashboard/src/hooks/use-delivery-zones.ts
index 593fd39cc6..1cd077862a 100644
--- a/packages/dashboard/src/hooks/use-delivery-zones.ts
+++ b/packages/dashboard/src/hooks/use-delivery-zones.ts
@@ -1,4 +1,8 @@
-import type { DeliveryZone, DeliveryZoneParams } from '@spree/admin-sdk'
+import type {
+ DeliveryZone,
+ DeliveryZoneCreateParams,
+ DeliveryZoneUpdateParams,
+} from '@spree/admin-sdk'
import {
adminClient,
useResourceKey,
@@ -53,7 +57,7 @@ export function useDeliveryZone(id: string | undefined) {
}
export function useCreateDeliveryZone() {
- return useResourceMutation<DeliveryZone, Error, DeliveryZoneParams>({
+ return useResourceMutation<DeliveryZone, Error, DeliveryZoneCreateParams>({
mutationFn: (params) => adminClient.deliveryZones.create(params),
invalidate: [['delivery-zones']],
successMessage: i18n.t('admin.delivery_zones.messages.created'),
@@ -62,7 +66,7 @@ export function useCreateDeliveryZone() {
}
export function useUpdateDeliveryZone(id: string) {
- return useResourceMutation<DeliveryZone, Error, DeliveryZoneParams>({
+ return useResourceMutation<DeliveryZone, Error, DeliveryZoneUpdateParams>({
mutationFn: (params) => adminClient.deliveryZones.update(id, params),
invalidate: [['delivery-zones'], ['delivery-zones', id]],
successMessage: i18n.t('admin.delivery_zones.messages.updated'),
diff --git a/packages/dashboard/src/hooks/use-tax-rates.ts b/packages/dashboard/src/hooks/use-tax-rates.ts
index 67ce62936a..fb221cd0ce 100644
--- a/packages/dashboard/src/hooks/use-tax-rates.ts
+++ b/packages/dashboard/src/hooks/use-tax-rates.ts
@@ -1,4 +1,4 @@
-import type { TaxRate, TaxRateParams } from '@spree/admin-sdk'
+import type { TaxRate, TaxRateCreateParams, TaxRateUpdateParams } from '@spree/admin-sdk'
import {
adminClient,
useResourceKey,
@@ -17,7 +17,7 @@ export function useTaxRate(id: string | undefined) {
}
export function useCreateTaxRate() {
- return useResourceMutation<TaxRate, Error, TaxRateParams>({
+ return useResourceMutation<TaxRate, Error, TaxRateCreateParams>({
mutationFn: (params) => adminClient.taxRates.create(params),
invalidate: [['tax-rates']],
successMessage: i18n.t('admin.tax_rates.messages.created'),
@@ -26,7 +26,7 @@ export function useCreateTaxRate() {
}
export function useUpdateTaxRate(id: string) {
- return useResourceMutation<TaxRate, Error, TaxRateParams>({
+ return useResourceMutation<TaxRate, Error, TaxRateUpdateParams>({
mutationFn: (params) => adminClient.taxRates.update(id, params),
invalidate: [['tax-rates'], ['tax-rates', id]],
successMessage: i18n.t('admin.tax_rates.messages.updated'),
diff --git a/packages/dashboard/src/schemas/catalog.ts b/packages/dashboard/src/schemas/catalog.ts
index 4d26f60b82..0f647c8fac 100644
--- a/packages/dashboard/src/schemas/catalog.ts
+++ b/packages/dashboard/src/schemas/catalog.ts
@@ -1,4 +1,4 @@
-import type { CatalogParams, CurrencyCode, PriceList } from '@spree/admin-sdk'
+import type { CatalogCreateParams, CurrencyCode, PriceList } from '@spree/admin-sdk'
import { compareMoney, negateMoney } from '@spree/admin-sdk'
import {
blankToNull,
@@ -268,7 +268,7 @@ export const CATALOG_DEFAULTS: CatalogFormValues = {
export function catalogValuesToParams(
values: CatalogFormValues,
loaded?: CatalogPricingValues,
-): CatalogParams {
+): CatalogCreateParams {
return {
name: values.name,
description: blankToNull(values.description),
diff --git a/packages/dashboard/src/schemas/company.ts b/packages/dashboard/src/schemas/company.ts
index 2f70877b95..de0287ec45 100644
--- a/packages/dashboard/src/schemas/company.ts
+++ b/packages/dashboard/src/schemas/company.ts
@@ -1,7 +1,7 @@
import type {
- CompanyParams,
- TaxExemptionCertificateParams,
- TaxIdentifierParams,
+ CompanyCreateParams,
+ TaxExemptionCertificateCreateParams,
+ TaxIdentifierCreateParams,
} from '@spree/admin-sdk'
import { blankToNull, countryCodeSchema, signedIdParam } from '@spree/dashboard-core'
import { requiredMessage } from '@spree/dashboard-ui'
@@ -20,7 +20,7 @@ export type CompanyFormValues = z.infer<typeof companyFormSchema>
export const COMPANY_DEFAULTS: CompanyFormValues = { name: '', po_number_required: false }
-export function companyValuesToParams(values: CompanyFormValues): CompanyParams {
+export function companyValuesToParams(values: CompanyFormValues): CompanyCreateParams {
return {
name: values.name,
po_number_required: values.po_number_required,
@@ -47,7 +47,9 @@ export type TaxIdentifierFormValues = z.infer<typeof taxIdentifierFormSchema>
export const TAX_IDENTIFIER_DEFAULTS: TaxIdentifierFormValues = { kind: '', value: '' }
-export function taxIdentifierValuesToParams(values: TaxIdentifierFormValues): TaxIdentifierParams {
+export function taxIdentifierValuesToParams(
+ values: TaxIdentifierFormValues,
+): TaxIdentifierCreateParams {
return { kind: values.kind, value: values.value }
}
@@ -98,7 +100,7 @@ export const TAX_EXEMPTION_REASON_CODES = [
export function taxExemptionCertificateValuesToParams(
values: TaxExemptionCertificateFormValues,
-): TaxExemptionCertificateParams {
+): TaxExemptionCertificateCreateParams {
return {
certificate_number: values.certificate_number,
reason_code: values.reason_code,
diff --git a/packages/dashboard/src/schemas/tax-rate.ts b/packages/dashboard/src/schemas/tax-rate.ts
index 94a867eb6f..f63bd0b749 100644
--- a/packages/dashboard/src/schemas/tax-rate.ts
+++ b/packages/dashboard/src/schemas/tax-rate.ts
@@ -1,4 +1,4 @@
-import { compareMoney, isDecimalString, type TaxRateParams } from '@spree/admin-sdk'
+import { compareMoney, isDecimalString, type TaxRateCreateParams } from '@spree/admin-sdk'
import { blankToNull, countryCodeSchema } from '@spree/dashboard-core'
import { decimalPlacesMessage, requiredMessage } from '@spree/dashboard-ui'
import { z } from 'zod/v4'
@@ -42,7 +42,7 @@ export const TAX_RATE_DEFAULTS: TaxRateFormValues = {
* country on an existing rate has to widen it back to everywhere, which an
* omitted key would not do.
*/
-export function taxRateValuesToParams(values: TaxRateFormValues): TaxRateParams {
+export function taxRateValuesToParams(values: TaxRateFormValues): TaxRateCreateParams {
return {
name: values.name,
rate_percent: values.rate_percent,
diff --git a/packages/sdk/src/store-client.ts b/packages/sdk/src/store-client.ts
index 640098d920..a53e7771cd 100644
--- a/packages/sdk/src/store-client.ts
+++ b/packages/sdk/src/store-client.ts
@@ -11,7 +11,8 @@ import type {
AddCompanyMemberParams,
AddLineItemParams,
Address,
- AddressParams,
+ AddressCreateParams,
+ AddressUpdateParams,
AuthTokens,
Cart,
Category,
@@ -23,7 +24,8 @@ import type {
Collection,
CollectionListParams,
Company,
- CompanyAddressParams,
+ CompanyAddressCreateParams,
+ CompanyAddressUpdateParams,
CompanyInvitation,
CompanyInvitationFilters,
CompanyInvitationSort,
@@ -1007,7 +1009,7 @@ export class StoreClient {
/**
* Create an address
*/
- create: (params: AddressParams, options?: RequestOptions): Promise<Address> =>
+ create: (params: AddressCreateParams, options?: RequestOptions): Promise<Address> =>
this.request<Address>('POST', '/customers/me/addresses', {
...options,
body: params,
@@ -1016,7 +1018,11 @@ export class StoreClient {
/**
* Update an address
*/
- update: (id: string, params: AddressParams, options?: RequestOptions): Promise<Address> =>
+ update: (
+ id: string,
+ params: AddressUpdateParams,
+ options?: RequestOptions,
+ ): Promise<Address> =>
this.request<Address>('PATCH', `/customers/me/addresses/${id}`, {
...options,
body: params,
@@ -1274,7 +1280,7 @@ export class StoreClient {
create: (
companyId: string,
- params: CompanyAddressParams,
+ params: CompanyAddressCreateParams,
options?: RequestOptions,
): Promise<Address> =>
this.request<Address>('POST', `/companies/${companyId}/addresses`, {
@@ -1285,7 +1291,7 @@ export class StoreClient {
update: (
companyId: string,
id: string,
- params: CompanyAddressParams,
+ params: CompanyAddressUpdateParams,
options?: RequestOptions,
): Promise<Address> =>
this.request<Address>('PATCH', `/companies/${companyId}/addresses/${id}`, {
diff --git a/packages/sdk/src/types/index.ts b/packages/sdk/src/types/index.ts
index 2b01914a32..7a59552154 100644
--- a/packages/sdk/src/types/index.ts
+++ b/packages/sdk/src/types/index.ts
@@ -10,7 +10,7 @@ import type {
ProductSort,
} from './filters.generated'
import type { Cart as CartType } from './generated'
-import type { LineItemInputParams } from './params'
+import type { AddressUpdateParams, CompanyAddressUpdateParams, LineItemInputParams } from './params'
export * from './filters.generated'
// Re-export all generated types (unprefixed: Product, Order, etc.)
@@ -122,6 +122,12 @@ export type OrderListParams = ListParams<OrderFilters, OrderSort>
/** @deprecated Renamed to `LineItemInputParams`. */
export type LineItemInput = LineItemInputParams
+/** @deprecated Split by action: `AddressCreateParams` and `AddressUpdateParams`. Removed in 6.1. */
+export type AddressParams = AddressUpdateParams
+
+/** @deprecated Split by action: `CompanyAddressCreateParams` and `CompanyAddressUpdateParams`. Removed in 6.1. */
+export type CompanyAddressParams = CompanyAddressUpdateParams
+
// Cart operations
// Payments
// Payment Sessions
diff --git a/packages/sdk/src/types/params/AddressCreateParams.ts b/packages/sdk/src/types/params/AddressCreateParams.ts
new file mode 100644
index 0000000000..0dcec50672
--- /dev/null
+++ b/packages/sdk/src/types/params/AddressCreateParams.ts
@@ -0,0 +1,28 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { CountryCode } from '../generated'
+
+export type AddressCreateParams = {
+ first_name: string
+ last_name: string
+ company?: string
+ address1: string
+ address2?: string
+ city: string
+ postal_code?: string
+ phone?: string
+ /** ISO 3166-1 alpha-2 country code, such as `US` or `DE`. */
+ country_code: CountryCode
+ /** ISO 3166-2 subdivision code without the country prefix, such as `CA` or `NY`. */
+ state_code?: string
+ /** The state name, for countries without predefined states. */
+ state_name?: string
+ /** @deprecated Use `country_code`. Removed in 6.1. */
+ country_iso?: string
+ /** @deprecated Use `state_code`. Removed in 6.1. */
+ state_abbr?: string
+ /** Makes this the default billing address. */
+ is_default_billing?: boolean
+ /** Makes this the default shipping address. */
+ is_default_shipping?: boolean
+}
diff --git a/packages/sdk/src/types/params/AddressParams.ts b/packages/sdk/src/types/params/AddressUpdateParams.ts
similarity index 96%
rename from packages/sdk/src/types/params/AddressParams.ts
rename to packages/sdk/src/types/params/AddressUpdateParams.ts
index 01c9f16601..2711c926db 100644
--- a/packages/sdk/src/types/params/AddressParams.ts
+++ b/packages/sdk/src/types/params/AddressUpdateParams.ts
@@ -2,7 +2,7 @@
import type { CountryCode } from '../generated'
-export type AddressParams = {
+export type AddressUpdateParams = {
first_name?: string
last_name?: string
company?: string
diff --git a/packages/sdk/src/types/params/CompanyAddressCreateParams.ts b/packages/sdk/src/types/params/CompanyAddressCreateParams.ts
new file mode 100644
index 0000000000..473fc54c14
--- /dev/null
+++ b/packages/sdk/src/types/params/CompanyAddressCreateParams.ts
@@ -0,0 +1,33 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { CountryCode } from '../generated'
+
+export type CompanyAddressCreateParams = {
+ first_name: string
+ last_name: string
+ company?: string
+ address1: string
+ address2?: string
+ city: string
+ postal_code?: string
+ phone?: string
+ label?: string
+ /** ISO 3166-1 alpha-2 code, such as `US`. */
+ country_code: CountryCode
+ /** The state or province abbreviation, such as `NY`. */
+ state_code?: string
+ /** For countries without states in the database. */
+ state_name?: string
+ /** @deprecated Use `postal_code`. Removed in 6.1. */
+ zipcode?: string
+ /**
+ * True makes this the node's default billing address, false gives that up, and leaving it out
+ * changes nothing.
+ */
+ default_billing?: boolean
+ /**
+ * True makes this the node's default shipping address, false gives that up, and leaving it out
+ * changes nothing.
+ */
+ default_shipping?: boolean
+}
diff --git a/packages/sdk/src/types/params/CompanyAddressParams.ts b/packages/sdk/src/types/params/CompanyAddressUpdateParams.ts
similarity index 95%
rename from packages/sdk/src/types/params/CompanyAddressParams.ts
rename to packages/sdk/src/types/params/CompanyAddressUpdateParams.ts
index 799346eece..a7c0c557c9 100644
--- a/packages/sdk/src/types/params/CompanyAddressParams.ts
+++ b/packages/sdk/src/types/params/CompanyAddressUpdateParams.ts
@@ -2,7 +2,7 @@
import type { CountryCode } from '../generated'
-export type CompanyAddressParams = {
+export type CompanyAddressUpdateParams = {
first_name?: string
last_name?: string
company?: string
diff --git a/packages/sdk/src/types/params/index.ts b/packages/sdk/src/types/params/index.ts
index 91519beb6e..a4dc85c185 100644
--- a/packages/sdk/src/types/params/index.ts
+++ b/packages/sdk/src/types/params/index.ts
@@ -3,12 +3,14 @@
export type { AcceptCompanyInvitationParams } from './AcceptCompanyInvitationParams'
export type { AddCompanyMemberParams } from './AddCompanyMemberParams'
export type { AddLineItemParams } from './AddLineItemParams'
-export type { AddressParams } from './AddressParams'
+export type { AddressCreateParams } from './AddressCreateParams'
+export type { AddressUpdateParams } from './AddressUpdateParams'
export type { ApplyDiscountCodeParams } from './ApplyDiscountCodeParams'
export type { ApplyGiftCardParams } from './ApplyGiftCardParams'
export type { ApplyStoreCreditParams } from './ApplyStoreCreditParams'
export type { CartAddressParams } from './CartAddressParams'
-export type { CompanyAddressParams } from './CompanyAddressParams'
+export type { CompanyAddressCreateParams } from './CompanyAddressCreateParams'
+export type { CompanyAddressUpdateParams } from './CompanyAddressUpdateParams'
export type { CompletePaymentSessionParams } from './CompletePaymentSessionParams'
export type { CompletePaymentSetupSessionParams } from './CompletePaymentSetupSessionParams'
export type { CreateCartParams } from './CreateCartParams'
diff --git a/packages/seller-dashboard/src/components/seller-returns-location-card.tsx b/packages/seller-dashboard/src/components/seller-returns-location-card.tsx
index d62ab95df3..617f335349 100644
--- a/packages/seller-dashboard/src/components/seller-returns-location-card.tsx
+++ b/packages/seller-dashboard/src/components/seller-returns-location-card.tsx
@@ -17,7 +17,7 @@ import {
toastManager,
} from '@spree/dashboard-ui'
import { PencilIcon, PlusIcon } from '@spree/dashboard-ui/icons'
-import type { StockLocationParams } from '@spree/seller-sdk'
+import type { StockLocationUpdateParams } from '@spree/seller-sdk'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { useParams } from '@tanstack/react-router'
import { useState } from 'react'
@@ -67,7 +67,7 @@ export function SellerReturnsLocationCard({ headless = false }: { headless?: boo
const title = t('profile.returns_address')
const save = useMutation({
- mutationFn: (params: StockLocationParams) => {
+ mutationFn: (params: StockLocationUpdateParams) => {
if (!location) throw new Error(t('common.error'))
return sellerClient().stockLocations.update(location.id, params)
},
diff --git a/packages/seller-dashboard/src/pages/product.tsx b/packages/seller-dashboard/src/pages/product.tsx
index 229ab0f5ff..65752087da 100644
--- a/packages/seller-dashboard/src/pages/product.tsx
+++ b/packages/seller-dashboard/src/pages/product.tsx
@@ -19,7 +19,7 @@ import {
variantToWirePayload,
} from '@spree/dashboard-core'
import { FormActions, ResourceLayout, StatusBadge, toastManager } from '@spree/dashboard-ui'
-import type { ProductParams } from '@spree/seller-sdk'
+import type { ProductCreateParams } from '@spree/seller-sdk'
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
import { useNavigate, useParams } from '@tanstack/react-router'
import { useEffect } from 'react'
@@ -119,7 +119,7 @@ export function ProductPage({ mode }: { mode: 'new' | 'edit' }) {
values: ProductFormValues
extensionValues: Record<string, unknown>
}) => {
- const payload: ProductParams = {
+ const payload: ProductCreateParams = {
...extensionValues,
name: values.name,
description: values.description,
@@ -150,7 +150,7 @@ export function ProductPage({ mode }: { mode: 'new' | 'edit' }) {
})),
variants: (values.variants ?? []).map((variant, index) =>
variantToWirePayload(variant, index),
- ) as ProductParams['variants'],
+ ) as ProductCreateParams['variants'],
}
return productId
diff --git a/packages/seller-sdk/src/index.ts b/packages/seller-sdk/src/index.ts
index 24af935d68..84943707df 100644
--- a/packages/seller-sdk/src/index.ts
+++ b/packages/seller-sdk/src/index.ts
@@ -25,24 +25,28 @@ export type {
AccountUpdateParams,
BulkProductResult,
DeliveryCalculatorType,
- DeliveryMethodParams,
+ DeliveryMethodCreateParams,
DeliveryMethodRuleParams,
DeliveryMethodRuleType,
+ DeliveryMethodUpdateParams,
DeliveryZoneListParams,
MeResource,
MeResponse,
OnboardingResponse,
OrderAddressParams,
- PackageTypeParams,
+ PackageTypeCreateParams,
+ PackageTypeUpdateParams,
PermissionRule,
- ProductParams,
+ ProductCreateParams,
+ ProductUpdateParams,
ProfileUpdateParams,
RequirementSubmissionParams,
SellerAddressParams,
SellerCountry,
SellerExportCreateParams,
SellerExportType,
- StockLocationParams,
+ StockLocationCreateParams,
+ StockLocationUpdateParams,
} from './seller-client'
// Client class, for advanced use and subclassing
export { SellerClient } from './seller-client'
diff --git a/packages/seller-sdk/src/seller-client.ts b/packages/seller-sdk/src/seller-client.ts
index 9eb8235773..dcc5b34276 100644
--- a/packages/seller-sdk/src/seller-client.ts
+++ b/packages/seller-sdk/src/seller-client.ts
@@ -76,7 +76,8 @@ import type {
ClaimDenyParams,
ClaimResolveParams,
DeliveryCreateParams,
- DeliveryMethodParams,
+ DeliveryMethodCreateParams,
+ DeliveryMethodUpdateParams,
DeliveryUpdateParams,
ExchangeCancelParams,
ExchangeCreateParams,
@@ -94,14 +95,16 @@ import type {
OrderAddressCorrectionParams,
OrderCancelParams,
OrderNotesParams,
- PackageTypeParams,
+ PackageTypeCreateParams,
+ PackageTypeUpdateParams,
PasswordResetCreateParams,
PasswordResetUpdateParams,
PolicyCreateParams,
PolicyUpdateParams,
ProductBulkStatusParams,
ProductBulkSubmitParams,
- ProductParams,
+ ProductCreateParams,
+ ProductUpdateParams,
ProfileUpdateParams,
RequirementSubmissionParams,
ReturnCancelParams,
@@ -109,9 +112,11 @@ import type {
ReturnReceiveParams,
ReturnRefundParams,
SellerExportCreateParams,
- SellerTaxIdentifierParams,
+ SellerTaxIdentifierCreateParams,
+ SellerTaxIdentifierUpdateParams,
ShippingLabelCreateParams,
- StockLocationParams,
+ StockLocationCreateParams,
+ StockLocationUpdateParams,
TeamMemberCreateParams,
} from './types/params'
@@ -263,12 +268,15 @@ export class SellerClient {
list: (options?: RequestOptions): Promise<{ data: TaxIdentifier[] }> =>
this.request<{ data: TaxIdentifier[] }>('GET', '/tax_identifiers', options),
- create: (params: SellerTaxIdentifierParams, options?: RequestOptions): Promise<TaxIdentifier> =>
+ create: (
+ params: SellerTaxIdentifierCreateParams,
+ options?: RequestOptions,
+ ): Promise<TaxIdentifier> =>
this.request<TaxIdentifier>('POST', '/tax_identifiers', { ...options, body: params }),
update: (
id: string,
- params: SellerTaxIdentifierParams,
+ params: SellerTaxIdentifierUpdateParams,
options?: RequestOptions,
): Promise<TaxIdentifier> =>
this.request<TaxIdentifier>('PATCH', `/tax_identifiers/${id}`, {
@@ -422,10 +430,10 @@ export class SellerClient {
params: expand ? { expand } : undefined,
}),
- create: (params: ProductParams, options?: RequestOptions): Promise<Product> =>
+ create: (params: ProductCreateParams, options?: RequestOptions): Promise<Product> =>
this.request<Product>('POST', '/products', { ...options, body: params }),
- update: (id: string, params: ProductParams, options?: RequestOptions): Promise<Product> =>
+ update: (id: string, params: ProductUpdateParams, options?: RequestOptions): Promise<Product> =>
this.request<Product>('PATCH', `/products/${id}`, { ...options, body: params }),
delete: (id: string, options?: RequestOptions): Promise<void> =>
@@ -1104,12 +1112,15 @@ export class SellerClient {
get: (id: string, options?: RequestOptions): Promise<DeliveryMethod> =>
this.request<DeliveryMethod>('GET', `/delivery_methods/${id}`, options),
- create: (params: DeliveryMethodParams, options?: RequestOptions): Promise<DeliveryMethod> =>
+ create: (
+ params: DeliveryMethodCreateParams,
+ options?: RequestOptions,
+ ): Promise<DeliveryMethod> =>
this.request<DeliveryMethod>('POST', '/delivery_methods', { ...options, body: params }),
update: (
id: string,
- params: DeliveryMethodParams,
+ params: DeliveryMethodUpdateParams,
options?: RequestOptions,
): Promise<DeliveryMethod> =>
this.request<DeliveryMethod>('PATCH', `/delivery_methods/${id}`, {
@@ -1156,12 +1167,12 @@ export class SellerClient {
get: (id: string, options?: RequestOptions): Promise<StockLocation> =>
this.request<StockLocation>('GET', `/stock_locations/${id}`, options),
- create: (params: StockLocationParams, options?: RequestOptions): Promise<StockLocation> =>
+ create: (params: StockLocationCreateParams, options?: RequestOptions): Promise<StockLocation> =>
this.request<StockLocation>('POST', '/stock_locations', { ...options, body: params }),
update: (
id: string,
- params: StockLocationParams,
+ params: StockLocationUpdateParams,
options?: RequestOptions,
): Promise<StockLocation> =>
this.request<StockLocation>('PATCH', `/stock_locations/${id}`, {
@@ -1202,12 +1213,12 @@ export class SellerClient {
get: (id: string, options?: RequestOptions): Promise<PackageType> =>
this.request<PackageType>('GET', `/package_types/${id}`, options),
- create: (params: PackageTypeParams, options?: RequestOptions): Promise<PackageType> =>
+ create: (params: PackageTypeCreateParams, options?: RequestOptions): Promise<PackageType> =>
this.request<PackageType>('POST', '/package_types', { ...options, body: params }),
update: (
id: string,
- params: PackageTypeParams,
+ params: PackageTypeUpdateParams,
options?: RequestOptions,
): Promise<PackageType> =>
this.request<PackageType>('PATCH', `/package_types/${id}`, {
diff --git a/packages/seller-sdk/src/types/params/DeliveryMethodCreateParams.ts b/packages/seller-sdk/src/types/params/DeliveryMethodCreateParams.ts
new file mode 100644
index 0000000000..1ccc19de0e
--- /dev/null
+++ b/packages/seller-sdk/src/types/params/DeliveryMethodCreateParams.ts
@@ -0,0 +1,30 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { DeliveryMethodRuleParams } from './DeliveryMethodRuleParams'
+
+export type DeliveryMethodCreateParams = {
+ name: string
+ admin_name?: string | null
+ code?: string | null
+ /** One of the marketplace's delivery profiles. */
+ delivery_profile_id?: string
+ /** Narrows where the method ships; null serves everywhere the profile reaches. */
+ delivery_zone_id?: string | null
+ storefront_visible?: boolean
+ tracking_url?: string | null
+ estimated_transit_business_days_min?: number | null
+ estimated_transit_business_days_max?: number | null
+ /**
+ * How the method is priced: a type from `/delivery_methods/calculators` and its preferences, per
+ * that type's `schema`.
+ */
+ calculator?: {
+ type?: string
+ preferences?: Record<string, unknown>
+ }
+ /**
+ * Replaces the whole set: a rule dropped here is deleted, so re-send surviving rules with their
+ * `id`. An empty list clears every condition.
+ */
+ rules?: DeliveryMethodRuleParams[]
+}
diff --git a/packages/seller-sdk/src/types/params/DeliveryMethodParams.ts b/packages/seller-sdk/src/types/params/DeliveryMethodUpdateParams.ts
similarity index 96%
rename from packages/seller-sdk/src/types/params/DeliveryMethodParams.ts
rename to packages/seller-sdk/src/types/params/DeliveryMethodUpdateParams.ts
index 070f0aff05..93091be94c 100644
--- a/packages/seller-sdk/src/types/params/DeliveryMethodParams.ts
+++ b/packages/seller-sdk/src/types/params/DeliveryMethodUpdateParams.ts
@@ -2,7 +2,7 @@
import type { DeliveryMethodRuleParams } from './DeliveryMethodRuleParams'
-export type DeliveryMethodParams = {
+export type DeliveryMethodUpdateParams = {
name?: string
admin_name?: string | null
code?: string | null
diff --git a/packages/seller-sdk/src/types/params/PackageTypeCreateParams.ts b/packages/seller-sdk/src/types/params/PackageTypeCreateParams.ts
new file mode 100644
index 0000000000..864ba9233d
--- /dev/null
+++ b/packages/seller-sdk/src/types/params/PackageTypeCreateParams.ts
@@ -0,0 +1,20 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+export type PackageTypeCreateParams = {
+ name: string
+ kind?: 'box' | 'envelope' | 'carton' | 'pallet' | 'container'
+ length?: number | null
+ width?: number | null
+ height?: number | null
+ dimensions_unit?: 'mm' | 'cm' | 'in' | 'ft' | null
+ /** The empty package's own weight, added to every quote. */
+ weight?: number | null
+ max_weight?: number | null
+ weight_unit?: 'g' | 'kg' | 'lb' | 'oz' | null
+ /**
+ * Makes this the box this seller's parcels are quoted with. One default per seller, so it never
+ * displaces the marketplace's.
+ */
+ default?: boolean
+ metadata?: Record<string, unknown> | null
+}
diff --git a/packages/seller-sdk/src/types/params/PackageTypeParams.ts b/packages/seller-sdk/src/types/params/PackageTypeUpdateParams.ts
similarity index 94%
rename from packages/seller-sdk/src/types/params/PackageTypeParams.ts
rename to packages/seller-sdk/src/types/params/PackageTypeUpdateParams.ts
index 7e37f5035d..a617580b2b 100644
--- a/packages/seller-sdk/src/types/params/PackageTypeParams.ts
+++ b/packages/seller-sdk/src/types/params/PackageTypeUpdateParams.ts
@@ -1,6 +1,6 @@
// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
-export type PackageTypeParams = {
+export type PackageTypeUpdateParams = {
name?: string
kind?: 'box' | 'envelope' | 'carton' | 'pallet' | 'container'
length?: number | null
diff --git a/packages/seller-sdk/src/types/params/ProductCreateParams.ts b/packages/seller-sdk/src/types/params/ProductCreateParams.ts
new file mode 100644
index 0000000000..b39dee7ff6
--- /dev/null
+++ b/packages/seller-sdk/src/types/params/ProductCreateParams.ts
@@ -0,0 +1,49 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { CurrencyCode } from '../generated'
+import type { SellerProductMediaParams } from './SellerProductMediaParams'
+import type { SellerProductVariantParams } from './SellerProductVariantParams'
+
+export type ProductCreateParams = {
+ name: string
+ description?: string
+ slug?: string
+ meta_title?: string
+ meta_description?: string
+ meta_keywords?: string
+ metadata?: Record<string, unknown>
+ /**
+ * The marketplace's product type this product is listed against, from the product types endpoint.
+ * Null detaches it. Saving with a type seeds its option types onto the product.
+ */
+ product_type_id?: string | null
+ /**
+ * Which of the marketplace's delivery profiles the product ships under. A new product sent
+ * without one lands on the profile marked default.
+ */
+ delivery_profile_id?: string
+ /**
+ * Shorthand for a simple (no-options) product: per-currency prices that forward to the product's
+ * sole variant.
+ */
+ prices?: {
+ /** Omit to price in the store's currency. A seller has no currency of their own. */
+ currency?: CurrencyCode
+ /**
+ * A canonical decimal string (`"1234.56"`: period decimal, no grouping). The API does not parse
+ * localized input.
+ */
+ amount: string
+ compare_at_amount?: string | null
+ }[]
+ /**
+ * The gallery, as a whole: a file absent from the list is removed. `signed_id` attaches a fresh
+ * upload; `id` updates one already there.
+ */
+ media?: SellerProductMediaParams[]
+ /**
+ * The variants, as a whole: one absent from the list is removed. Pass `id` to update an existing
+ * variant.
+ */
+ variants?: SellerProductVariantParams[]
+}
diff --git a/packages/seller-sdk/src/types/params/ProductParams.ts b/packages/seller-sdk/src/types/params/ProductUpdateParams.ts
similarity index 97%
rename from packages/seller-sdk/src/types/params/ProductParams.ts
rename to packages/seller-sdk/src/types/params/ProductUpdateParams.ts
index 8581073a98..f10d2b1ac3 100644
--- a/packages/seller-sdk/src/types/params/ProductParams.ts
+++ b/packages/seller-sdk/src/types/params/ProductUpdateParams.ts
@@ -4,7 +4,7 @@ import type { CurrencyCode } from '../generated'
import type { SellerProductMediaParams } from './SellerProductMediaParams'
import type { SellerProductVariantParams } from './SellerProductVariantParams'
-export type ProductParams = {
+export type ProductUpdateParams = {
name?: string
description?: string
slug?: string
diff --git a/packages/seller-sdk/src/types/params/SellerTaxIdentifierCreateParams.ts b/packages/seller-sdk/src/types/params/SellerTaxIdentifierCreateParams.ts
new file mode 100644
index 0000000000..6ba4b6a835
--- /dev/null
+++ b/packages/seller-sdk/src/types/params/SellerTaxIdentifierCreateParams.ts
@@ -0,0 +1,12 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+export type SellerTaxIdentifierCreateParams = {
+ /**
+ * The registration the number belongs to, such as `eu_vat` or `gb_vat`. Any kind is accepted; one
+ * with a registered validator is checked by it. Built-in: `eu_vat`. Extensions may register more.
+ * One registration per kind.
+ */
+ kind: string
+ /** A number the validator for its kind refuses is rejected rather than stored. */
+ value: string
+}
diff --git a/packages/seller-sdk/src/types/params/SellerTaxIdentifierParams.ts b/packages/seller-sdk/src/types/params/SellerTaxIdentifierUpdateParams.ts
similarity index 91%
rename from packages/seller-sdk/src/types/params/SellerTaxIdentifierParams.ts
rename to packages/seller-sdk/src/types/params/SellerTaxIdentifierUpdateParams.ts
index b6acb3d283..dd128ac11d 100644
--- a/packages/seller-sdk/src/types/params/SellerTaxIdentifierParams.ts
+++ b/packages/seller-sdk/src/types/params/SellerTaxIdentifierUpdateParams.ts
@@ -1,6 +1,6 @@
// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
-export type SellerTaxIdentifierParams = {
+export type SellerTaxIdentifierUpdateParams = {
/**
* The registration the number belongs to, such as `eu_vat` or `gb_vat`. Any kind is accepted; one
* with a registered validator is checked by it. Built-in: `eu_vat`. Extensions may register more.
diff --git a/packages/seller-sdk/src/types/params/StockLocationCreateParams.ts b/packages/seller-sdk/src/types/params/StockLocationCreateParams.ts
new file mode 100644
index 0000000000..beecdadb98
--- /dev/null
+++ b/packages/seller-sdk/src/types/params/StockLocationCreateParams.ts
@@ -0,0 +1,37 @@
+// This file is auto-generated from the request schemas in docs/api-reference by `pnpm generate:params`. Do not edit directly.
+
+import type { CountryCode } from '../generated'
+
+export type StockLocationCreateParams = {
+ name: string
+ admin_name?: string | null
+ /** Set `false` to retire a location: there is no delete. */
+ active?: boolean
+ default?: boolean
+ /** Categorizes the location. The values listed are the built-in ones; extensions may add more. */
+ kind?: 'warehouse' | 'store' | 'fulfillment_center' | (string & {})
+ propagate_all_variants?: boolean
+ backorderable_default?: boolean
+ address1?: string | null
+ address2?: string | null
+ city?: string | null
+ zipcode?: string | null
+ phone?: string | null
+ company?: string | null
+ /** ISO-3166 alpha-2 country code. */
+ country_code?: CountryCode | null
+ /** State or province abbreviation, resolved against the selected country's states. */
+ state_code?: string | null
+ /** Free-text state for countries that don't have a states list. */
+ state_name?: string | null
+ pickup_enabled?: boolean
+ /**
+ * `local` collects only items at this location; `any` lets items transfer in from other locations
+ * (ship-to-store).
+ */
+ pickup_stock_policy?: 'local' | 'any'
+ pickup_ready_in_minutes?: number | null
+ /** Whether customers may send returns to this location. */
+ returns_enabled?: boolean
+ pickup_instructions?: string | null
+}
diff --git a/packages/seller-sdk/src/types/params/StockLocationParams.ts b/packages/seller-sdk/src/types/params/StockLocationUpdateParams.ts
similarity index 97%
rename from packages/seller-sdk/src/types/params/StockLocationParams.ts
rename to packages/seller-sdk/src/types/params/StockLocationUpdateParams.ts
index 7498516e78..ab1fc90e53 100644
--- a/packages/seller-sdk/src/types/params/StockLocationParams.ts
+++ b/packages/seller-sdk/src/types/params/StockLocationUpdateParams.ts
@@ -2,7 +2,7 @@
import type { CountryCode } from '../generated'
-export type StockLocationParams = {
+export type StockLocationUpdateParams = {
name?: string
admin_name?: string | null
/** Set `false` to retire a location: there is no delete. */
diff --git a/packages/seller-sdk/src/types/params/index.ts b/packages/seller-sdk/src/types/params/index.ts
index c20e1ac9aa..b8805a64e4 100644
--- a/packages/seller-sdk/src/types/params/index.ts
+++ b/packages/seller-sdk/src/types/params/index.ts
@@ -7,8 +7,9 @@ export type { ClaimDenyParams } from './ClaimDenyParams'
export type { ClaimResolveParams } from './ClaimResolveParams'
export type { CustomFieldValueParams } from './CustomFieldValueParams'
export type { DeliveryCreateParams } from './DeliveryCreateParams'
-export type { DeliveryMethodParams } from './DeliveryMethodParams'
+export type { DeliveryMethodCreateParams } from './DeliveryMethodCreateParams'
export type { DeliveryMethodRuleParams } from './DeliveryMethodRuleParams'
+export type { DeliveryMethodUpdateParams } from './DeliveryMethodUpdateParams'
export type { DeliveryUpdateParams } from './DeliveryUpdateParams'
export type { ExchangeCancelParams } from './ExchangeCancelParams'
export type { ExchangeCreateParams } from './ExchangeCreateParams'
@@ -27,14 +28,16 @@ export type { OrderAddressCorrectionParams } from './OrderAddressCorrectionParam
export type { OrderAddressParams } from './OrderAddressParams'
export type { OrderCancelParams } from './OrderCancelParams'
export type { OrderNotesParams } from './OrderNotesParams'
-export type { PackageTypeParams } from './PackageTypeParams'
+export type { PackageTypeCreateParams } from './PackageTypeCreateParams'
+export type { PackageTypeUpdateParams } from './PackageTypeUpdateParams'
export type { PasswordResetCreateParams } from './PasswordResetCreateParams'
export type { PasswordResetUpdateParams } from './PasswordResetUpdateParams'
export type { PolicyCreateParams } from './PolicyCreateParams'
export type { PolicyUpdateParams } from './PolicyUpdateParams'
export type { ProductBulkStatusParams } from './ProductBulkStatusParams'
export type { ProductBulkSubmitParams } from './ProductBulkSubmitParams'
-export type { ProductParams } from './ProductParams'
+export type { ProductCreateParams } from './ProductCreateParams'
+export type { ProductUpdateParams } from './ProductUpdateParams'
export type { ProfileUpdateParams } from './ProfileUpdateParams'
export type { RequirementSubmissionParams } from './RequirementSubmissionParams'
export type { ReturnCancelParams } from './ReturnCancelParams'
@@ -45,9 +48,11 @@ export type { SellerAddressParams } from './SellerAddressParams'
export type { SellerExportCreateParams } from './SellerExportCreateParams'
export type { SellerProductMediaParams } from './SellerProductMediaParams'
export type { SellerProductVariantParams } from './SellerProductVariantParams'
-export type { SellerTaxIdentifierParams } from './SellerTaxIdentifierParams'
+export type { SellerTaxIdentifierCreateParams } from './SellerTaxIdentifierCreateParams'
+export type { SellerTaxIdentifierUpdateParams } from './SellerTaxIdentifierUpdateParams'
export type { ShippingLabelCreateParams } from './ShippingLabelCreateParams'
export type { StockLevelParams } from './StockLevelParams'
-export type { StockLocationParams } from './StockLocationParams'
+export type { StockLocationCreateParams } from './StockLocationCreateParams'
+export type { StockLocationUpdateParams } from './StockLocationUpdateParams'
export type { TeamMemberCreateParams } from './TeamMemberCreateParams'
export type { VariantOptionParams } from './VariantOptionParams'
diff --git a/packages/seller-sdk/tests/code-samples.test.ts b/packages/seller-sdk/tests/code-samples.test.ts
index 722c21e710..98854f66bd 100644
--- a/packages/seller-sdk/tests/code-samples.test.ts
+++ b/packages/seller-sdk/tests/code-samples.test.ts
@@ -9,28 +9,36 @@ const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)),
type CodeSample = { label?: string; source?: string }
+// Parses the whole API reference, which a busy CI runner can take well over
+// the default five seconds to do.
+const TIMEOUT = 30_000
+
describe('Seller SDK examples', () => {
- it('appear on every endpoint in the Seller API reference', () => {
- const spec = parse(
- readFileSync(path.resolve(PACKAGE_ROOT, '../../docs/api-reference/seller.yaml'), 'utf8'),
- )
- const missing: string[] = []
-
- for (const [route, operations] of Object.entries<
- Record<string, { 'x-codeSamples'?: CodeSample[] }>
- >(spec.paths)) {
- for (const [method, operation] of Object.entries(operations)) {
- if (!HTTP_METHODS.includes(method)) continue
-
- const hasSample = operation['x-codeSamples']?.some(
- (sample) => sample.label === 'Spree Seller SDK' && sample.source?.trim(),
- )
- if (!hasSample) missing.push(`${method.toUpperCase()} ${route}`)
+ it(
+ 'appear on every endpoint in the Seller API reference',
+ () => {
+ const spec = parse(
+ readFileSync(path.resolve(PACKAGE_ROOT, '../../docs/api-reference/seller.yaml'), 'utf8'),
+ )
+ const missing: string[] = []
+
+ for (const [route, operations] of Object.entries<
+ Record<string, { 'x-codeSamples'?: CodeSample[] }>
+ >(spec.paths)) {
+ for (const [method, operation] of Object.entries(operations)) {
+ if (!HTTP_METHODS.includes(method)) continue
+
+ const hasSample = operation['x-codeSamples']?.some(
+ (sample) => sample.label === 'Spree Seller SDK' && sample.source?.trim(),
+ )
+ if (!hasSample) missing.push(`${method.toUpperCase()} ${route}`)
+ }
}
- }
- expect(missing).toEqual([])
- })
+ expect(missing).toEqual([])
+ },
+ TIMEOUT,
+ )
// The API reference shows only the code between these markers, and a
// formatter can drop a trailing marker along with the code around it.
diff --git a/spree/api/app/controllers/spree/api/v3/admin/catalogs_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/catalogs_controller.rb
index 62cf74e393..7f84a6e796 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/catalogs_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/catalogs_controller.rb
@@ -21,8 +21,8 @@ module Spree
only: [:show, :update, :destroy, :assign, :import_products,
:activate, :deactivate]
- request_params 'CatalogParams' do |body|
- body.attribute :name, :string, example: 'VIP Assortment'
+ request_params :catalog do |body|
+ body.attribute :name, :string, required: true, on: :create, example: 'VIP Assortment'
body.attribute :description, :string,
nullable: true,
description: 'Internal note on what the agreement is, never shown to shoppers.'
diff --git a/spree/api/app/controllers/spree/api/v3/admin/companies/addresses_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/companies/addresses_controller.rb
index d90c6e1129..b03a312f7c 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/companies/addresses_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/companies/addresses_controller.rb
@@ -8,8 +8,9 @@ module Spree
class AddressesController < BaseController
include Spree::Api::V3::CompanyAddressWrites
- request_params 'CompanyAddressParams' do |body|
+ request_params :company_address do |body|
body.include_attributes Spree::Api::V3::AddressRequestSchema
+ body.require_attributes :first_name, :last_name, :address1, :city, :country_code, on: :create
body.attribute :default_billing, :boolean,
permit: false,
description: 'True makes this the default address of that kind, false gives the slot up, and leaving it out keeps the current default.'
diff --git a/spree/api/app/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller.rb
index f1ce825a60..d08426fa9f 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/companies/tax_exemption_certificates_controller.rb
@@ -9,13 +9,12 @@ module Spree
class TaxExemptionCertificatesController < BaseController
include ActiveStorage::SetCurrent
- request_params 'TaxExemptionCertificateParams' do |body|
- body.attribute :certificate_number, :string,
- example: 'DE-RESALE-7',
- description: 'Required when creating.'
- body.attribute :reason_code, :string,
+ request_params :tax_exemption_certificate do |body|
+ body.attribute :certificate_number, :string, required: true, on: :create,
+ example: 'DE-RESALE-7'
+ body.attribute :reason_code, :string, required: true, on: :create,
example: 'resale',
- description: "Becomes the tax provider's entity use code. Required when creating."
+ description: "Becomes the tax provider's entity use code."
body.attribute :issuing_authority, :string, nullable: true, example: 'Finanzamt Berlin'
body.attribute :issued_at, :datetime, nullable: true
body.attribute :expires_at, :datetime, nullable: true
diff --git a/spree/api/app/controllers/spree/api/v3/admin/companies/tax_identifiers_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/companies/tax_identifiers_controller.rb
index d148da7ba9..77b5c437cc 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/companies/tax_identifiers_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/companies/tax_identifiers_controller.rb
@@ -12,8 +12,9 @@ module Spree
class TaxIdentifiersController < BaseController
include Spree::Api::V3::TaxIdentifierValidation
- request_params 'TaxIdentifierParams' do |body|
+ request_params :tax_identifier do |body|
body.include_attributes Spree::Api::V3::Admin::TaxIdentifierRequestSchema
+ body.require_attributes :kind, :value, on: :create
end
before_action :authorize_parent_access!
diff --git a/spree/api/app/controllers/spree/api/v3/admin/companies_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/companies_controller.rb
index a1861b586a..a17e6a47f7 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/companies_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/companies_controller.rb
@@ -12,9 +12,9 @@ module Spree
class CompaniesController < ResourceController
scoped_resource :customers
- request_params 'CompanyParams' do |body|
+ request_params :company do |body|
body.external_references
- body.attribute :name, :string, example: 'Globex Corporation', description: 'Required when creating.'
+ body.attribute :name, :string, required: true, on: :create, example: 'Globex Corporation'
body.attribute :kind, :string,
choices: Spree::Company::KINDS,
example: 'company',
diff --git a/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb
index f1aca9fecf..18b00cd8d4 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/customers/addresses_controller.rb
@@ -4,8 +4,9 @@ module Spree
module Admin
module Customers
class AddressesController < BaseController
- request_params 'CustomerAddressParams' do |body|
+ request_params :customer_address do |body|
body.include_attributes Spree::Api::V3::Admin::AddressRequestSchema
+ body.require_attributes :first_name, :last_name, :address1, :city, :country_code, on: :create
body.attribute :quick_checkout, :boolean
body.attribute :is_default_billing, :boolean,
permit: false,
diff --git a/spree/api/app/controllers/spree/api/v3/admin/customers/tax_identifiers_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/customers/tax_identifiers_controller.rb
index c0f58d4eaa..c4760a71e2 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/customers/tax_identifiers_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/customers/tax_identifiers_controller.rb
@@ -8,8 +8,9 @@ module Spree
include Spree::Api::V3::TaxIdentifierValidation
- request_params 'TaxIdentifierParams' do |body|
+ request_params :tax_identifier do |body|
body.include_attributes Spree::Api::V3::Admin::TaxIdentifierRequestSchema
+ body.require_attributes :kind, :value, on: :create
end
# Re-declaring the filter replaces the inherited options, so the
diff --git a/spree/api/app/controllers/spree/api/v3/admin/delivery_methods_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/delivery_methods_controller.rb
index 481505022f..aa906bec14 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/delivery_methods_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/delivery_methods_controller.rb
@@ -9,8 +9,8 @@ module Spree
# rows alongside the basics; `DeliveryMethod#rules=` / `#services=`
# reconcile to the desired set, so the dashboard saves the whole
# sheet in one round-trip.
- request_params 'DeliveryMethodParams' do |body|
- body.attribute :name, :string, example: 'Express'
+ request_params :delivery_method do |body|
+ body.attribute :name, :string, required: true, on: :create, example: 'Express'
body.attribute :admin_name, :string, nullable: true
body.attribute :code, :string, nullable: true
body.attribute :fulfillment_provider, :string,
diff --git a/spree/api/app/controllers/spree/api/v3/admin/delivery_profiles_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/delivery_profiles_controller.rb
index 3fe710bf7f..bc36b062e5 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/delivery_profiles_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/delivery_profiles_controller.rb
@@ -9,8 +9,8 @@ module Spree
class DeliveryProfilesController < ResourceController
scoped_resource :settings
- request_params 'DeliveryProfileParams' do |body|
- body.attribute :name, :string, example: 'Oversized'
+ request_params :delivery_profile do |body|
+ body.attribute :name, :string, required: true, on: :create, example: 'Oversized'
body.attribute :kind, :string,
example: 'shipping',
description: 'Registered profile kind (`shipping`, `digital`, extension kinds) from the kinds endpoint. Read on create only; defaults to shipping.'
diff --git a/spree/api/app/controllers/spree/api/v3/admin/delivery_zones_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/delivery_zones_controller.rb
index 47468adcb7..82122e786c 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/delivery_zones_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/delivery_zones_controller.rb
@@ -8,8 +8,8 @@ module Spree
class DeliveryZonesController < ResourceController
scoped_resource :settings
- request_params 'DeliveryZoneParams' do |body|
- body.attribute :name, :string, example: 'US North-East'
+ request_params :delivery_zone do |body|
+ body.attribute :name, :string, required: true, on: :create, example: 'US North-East'
body.attribute :description, :string, nullable: true
body.attribute :delivery_profile_id, :id,
description: 'Delivery profile this zone belongs to (`fp_...`); defaults to the store default profile.'
diff --git a/spree/api/app/controllers/spree/api/v3/admin/tax_rates_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/tax_rates_controller.rb
index 93a2632b5b..614aef17ff 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/tax_rates_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/tax_rates_controller.rb
@@ -7,15 +7,15 @@ module Spree
class TaxRatesController < ResourceController
scoped_resource :settings
- request_params 'TaxRateParams' do |body|
- body.attribute :name, :string, example: 'VAT', description: 'Customer-facing rate name.'
+ request_params :tax_rate do |body|
+ body.attribute :name, :string, required: true, on: :create, example: 'VAT', description: 'Customer-facing rate name.'
body.attribute :rate, :decimal,
example: '0.19',
description: 'The rate as a fraction. Send this or `rate_percent`.'
body.attribute :rate_percent, :decimal, example: '19', description: 'The rate as a percentage.'
body.attribute :included_in_price, :boolean
body.attribute :show_rate_in_label, :boolean
- body.attribute :tax_category_id, :id
+ body.attribute :tax_category_id, :id, required: true, on: :create
body.attribute :country_code, :country,
nullable: true,
example: 'DE',
diff --git a/spree/api/app/controllers/spree/api/v3/seller/delivery_methods_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/delivery_methods_controller.rb
index 1fba44e57b..9cfdbf47df 100644
--- a/spree/api/app/controllers/spree/api/v3/seller/delivery_methods_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/seller/delivery_methods_controller.rb
@@ -23,8 +23,8 @@ module Spree
# permitting them would let a write fail validation for a choice the
# seller was never offered. No markup either — that prices a
# carrier's quote, and a seller has no carrier.
- request_params 'DeliveryMethodParams' do |body|
- body.attribute :name, :string
+ request_params :delivery_method do |body|
+ body.attribute :name, :string, required: true, on: :create
body.attribute :admin_name, :string, nullable: true
body.attribute :code, :string, nullable: true
body.attribute :delivery_profile_id, :id, description: "One of the marketplace's delivery profiles."
diff --git a/spree/api/app/controllers/spree/api/v3/seller/package_types_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/package_types_controller.rb
index bf9078cc11..400c368358 100644
--- a/spree/api/app/controllers/spree/api/v3/seller/package_types_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/seller/package_types_controller.rb
@@ -22,8 +22,8 @@ module Spree
# their own packaging, so every field on the shared form is theirs
# to set. `seller_id` is deliberately absent: ownership comes from
# the authenticated seller, never the payload.
- request_params 'PackageTypeParams' do |body|
- body.attribute :name, :string
+ request_params :package_type do |body|
+ body.attribute :name, :string, required: true, on: :create
body.attribute :kind, :string, choices: Spree::PackageType::KINDS
body.attribute :length, :number, nullable: true
body.attribute :width, :number, nullable: true
diff --git a/spree/api/app/controllers/spree/api/v3/seller/products_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/products_controller.rb
index 49e20c4c30..cc0e065994 100644
--- a/spree/api/app/controllers/spree/api/v3/seller/products_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/seller/products_controller.rb
@@ -56,8 +56,8 @@ module Spree
scoped_resource :products
- request_params 'ProductParams' do |body|
- body.attribute :name, :string, example: 'Hand-thrown mug'
+ request_params :product do |body|
+ body.attribute :name, :string, required: true, on: :create, example: 'Hand-thrown mug'
body.attribute :description, :string
body.attribute :slug, :string, example: 'hand-thrown-mug'
body.attribute :meta_title, :string
diff --git a/spree/api/app/controllers/spree/api/v3/seller/stock_locations_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/stock_locations_controller.rb
index b3a3d44113..f642de291c 100644
--- a/spree/api/app/controllers/spree/api/v3/seller/stock_locations_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/seller/stock_locations_controller.rb
@@ -28,8 +28,8 @@ module Spree
# their own warehouse, so every field on the shared form is theirs to
# set. Anything missing here is dropped by `permit` without a word,
# and the form would appear to save while quietly discarding it.
- request_params 'StockLocationParams' do |body|
- body.attribute :name, :string, example: 'Main warehouse'
+ request_params :stock_location do |body|
+ body.attribute :name, :string, required: true, on: :create, example: 'Main warehouse'
body.attribute :admin_name, :string, nullable: true
body.attribute :active, :boolean, description: 'Set `false` to retire a location: there is no delete.'
body.attribute :default, :boolean
diff --git a/spree/api/app/controllers/spree/api/v3/seller/tax_identifiers_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/tax_identifiers_controller.rb
index b8877bb78d..e8f58f6670 100644
--- a/spree/api/app/controllers/spree/api/v3/seller/tax_identifiers_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/seller/tax_identifiers_controller.rb
@@ -24,11 +24,11 @@ module Spree
# standard actions have to be listed alongside the custom one.
before_action :set_resource, only: [:show, :update, :destroy, :validate]
- request_params 'SellerTaxIdentifierParams' do |body|
- body.attribute :kind, :string,
+ request_params :seller_tax_identifier do |body|
+ body.attribute :kind, :string, required: true, on: :create,
example: 'eu_vat',
description: "#{Spree::Api::V3::TaxIdentifierRequestSchema::KIND_DESCRIPTION} One registration per kind."
- body.attribute :value, :string,
+ body.attribute :value, :string, required: true, on: :create,
example: 'DE100000008',
description: 'A number the validator for its kind refuses is rejected rather than stored.'
end
diff --git a/spree/api/app/controllers/spree/api/v3/store/companies/addresses_controller.rb b/spree/api/app/controllers/spree/api/v3/store/companies/addresses_controller.rb
index 769ed91642..467edad69e 100644
--- a/spree/api/app/controllers/spree/api/v3/store/companies/addresses_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/store/companies/addresses_controller.rb
@@ -9,8 +9,9 @@ module Spree
class AddressesController < BaseController
include Spree::Api::V3::CompanyAddressWrites
- request_params 'CompanyAddressParams' do |body|
+ request_params :company_address do |body|
body.include_attributes Spree::Api::V3::AddressRequestSchema
+ body.require_attributes :first_name, :last_name, :address1, :city, :country_code, on: :create
body.attribute :zipcode, :string, deprecated: 'Use `postal_code`. Removed in 6.1.'
body.attribute :default_billing, :boolean,
permit: false,
diff --git a/spree/api/app/controllers/spree/api/v3/store/customer/addresses_controller.rb b/spree/api/app/controllers/spree/api/v3/store/customer/addresses_controller.rb
index 76903bb9ab..85723e73ac 100644
--- a/spree/api/app/controllers/spree/api/v3/store/customer/addresses_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/store/customer/addresses_controller.rb
@@ -7,8 +7,9 @@ module Spree
prepend_before_action :require_authentication!
before_action :set_resource, only: [:show, :update, :destroy]
- request_params 'AddressParams' do |body|
+ request_params :address do |body|
body.include_attributes Spree::Api::V3::Store::AddressRequestSchema
+ body.require_attributes :first_name, :last_name, :address1, :city, :country_code, on: :create
body.attribute :is_default_billing, :boolean, description: 'Makes this the default billing address.'
body.attribute :is_default_shipping, :boolean, description: 'Makes this the default shipping address.'
end
diff --git a/spree/api/app/request_schemas/spree/api/v3/admin/tax_identifier_request_schema.rb b/spree/api/app/request_schemas/spree/api/v3/admin/tax_identifier_request_schema.rb
index cf49fcf969..72317274ae 100644
--- a/spree/api/app/request_schemas/spree/api/v3/admin/tax_identifier_request_schema.rb
+++ b/spree/api/app/request_schemas/spree/api/v3/admin/tax_identifier_request_schema.rb
@@ -6,8 +6,8 @@ module Spree
class TaxIdentifierRequestSchema < Spree::Api::V3::RequestSchema
attribute :kind, :string,
example: 'gb_vat',
- description: "#{Spree::Api::V3::TaxIdentifierRequestSchema::KIND_DESCRIPTION} Required when creating."
- attribute :value, :string, example: 'GB123456789', description: 'Required when creating.'
+ description: "#{Spree::Api::V3::TaxIdentifierRequestSchema::KIND_DESCRIPTION}"
+ attribute :value, :string, example: 'GB123456789'
end
end
end
diff --git a/spree/api/app/serializers/spree/api/v3/admin/tax_exemption_certificate_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/tax_exemption_certificate_serializer.rb
index 3ef06059c5..da12cc07b4 100644
--- a/spree/api/app/serializers/spree/api/v3/admin/tax_exemption_certificate_serializer.rb
+++ b/spree/api/app/serializers/spree/api/v3/admin/tax_exemption_certificate_serializer.rb
@@ -7,6 +7,8 @@ module Spree
class TaxExemptionCertificateSerializer < V3::BaseSerializer
typelize certificate_number: :string, reason_code: :string, status: [:string, enum: Spree::TaxExemptionCertificate.statuses, enum_type_name: 'TaxExemptionCertificateStatus'],
issuing_authority: [:string, nullable: true],
+ issued_at: [:string, nullable: true], expires_at: [:string, nullable: true],
+ verified_at: [:string, nullable: true],
company_id: :string,
country_code: [:string, nullable: true, enum: Spree::IsoData.country_codes, enum_type_name: 'CountryCode'], state_code: [:string, nullable: true],
active: :boolean, lapsed: :boolean, can_be_deleted: :boolean,
diff --git a/spree/api/app/services/spree/api/v3/request_schema.rb b/spree/api/app/services/spree/api/v3/request_schema.rb
index cb9442c066..b59d35f84a 100644
--- a/spree/api/app/services/spree/api/v3/request_schema.rb
+++ b/spree/api/app/services/spree/api/v3/request_schema.rb
@@ -100,6 +100,17 @@ module Spree
required == true || (required == :create && action == :create)
end
+ # This field, required on `on` (`:create`) or always. A field
+ # already required always stays required always.
+ #
+ # @param on [Symbol, nil] `:create`, or nil for every action
+ # @return [Field]
+ def required_copy(on)
+ copy = dup
+ copy.instance_variable_set(:@required, required == true ? true : on || true)
+ copy
+ end
+
# A hash of any keys, such as `metadata` or `provider_settings`.
def free_object?
kind == :object && schema.nil?
@@ -159,7 +170,7 @@ module Spree
value.is_a?(Class) ? value.definition : value
end
- %i[attribute include_attributes external_references].each do |method|
+ %i[attribute include_attributes require_attributes external_references].each do |method|
define_method(method) { |*args, **options, &block| definition.public_send(method, *args, **options, &block) }
end
end
@@ -224,6 +235,22 @@ module Spree
RequestSchema.resolve(other).fields.each_value { |field| add(field) }
end
+ # Marks attributes this schema took from another as required, for an
+ # endpoint whose model needs what the shared set leaves optional.
+ #
+ # @param names [Array<Symbol>]
+ # @param on [Symbol, nil] `:create` to require them only when creating
+ # @return [void]
+ def require_attributes(*names, on: nil)
+ raise ArgumentError, '`on:` is :create' if on && on != :create
+
+ names.each do |name|
+ field = fields.fetch(name) { raise ArgumentError, "#{name} is not an attribute of this schema" }
+ fields[name] = field.required_copy(on)
+ end
+ @permit_lists = nil
+ end
+
# The `params.permit` list for an action.
#
# @param action [Symbol, String, nil] `create` or `update`; nil
diff --git a/spree/api/spec/integration/spree/api/v3/admin/catalogs_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/catalogs_spec.rb
index ceef54f76c..4516670797 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/catalogs_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/catalogs_spec.rb
@@ -64,6 +64,35 @@ RSpec.describe 'Admin Catalogs API', type: :request, swagger_doc: 'api-reference
end
end
+ path '/api/v3/admin/catalogs/{id}' do
+ parameter name: :id, in: :path, type: :string, required: true
+
+ patch 'Update a catalog' do
+ tags 'Catalogs'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Updates a catalog and its commercial terms. Only the attributes sent change.'
+ admin_scope :write, :products
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ request_body_for
+
+ response '200', 'catalog updated' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:id) { catalog.prefixed_id }
+ let(:body) { { name: 'Wholesale Plus', minimum_order_quantity: 10, order_multiple: 5 } }
+
+ schema '$ref' => '#/components/schemas/Catalog'
+
+ run_test! do |response|
+ expect(JSON.parse(response.body)['name']).to eq('Wholesale Plus')
+ end
+ end
+ end
+ end
+
path '/api/v3/admin/catalogs/{id}/assign' do
post 'Assign a catalog to an audience' do
tags 'Catalogs'
diff --git a/spree/api/spec/integration/spree/api/v3/admin/companies/addresses_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/companies/addresses_spec.rb
index e67d1b1918..4b1921682f 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/companies/addresses_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/companies/addresses_spec.rb
@@ -70,4 +70,37 @@ RSpec.describe 'Admin Company Addresses API', type: :request, swagger_doc: 'api-
end
end
end
+
+ path '/api/v3/admin/companies/{company_id}/addresses/{id}' do
+ let(:company_id) { company.prefixed_id }
+ let(:id) { address.prefixed_id }
+
+ patch 'Update a company address' do
+ tags 'Companies'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Changes an address of the business. Pass `default_billing` or `default_shipping` to move that default to it, or `false` to give it up.'
+ admin_scope :write, :customers
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :company_id, in: :path, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+ request_body_for
+
+ response '200', 'address updated' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:body) { { label: 'Northern Warehouse', default_billing: true } }
+
+ schema '$ref' => '#/components/schemas/Address'
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['label']).to eq('Northern Warehouse')
+ expect(company.reload.default_billing_address&.prefixed_id).to eq(data['id'])
+ end
+ end
+ end
+ end
end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/companies/tax_exemption_certificates_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/companies/tax_exemption_certificates_spec.rb
index a2e5c49142..437c3c06db 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/companies/tax_exemption_certificates_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/companies/tax_exemption_certificates_spec.rb
@@ -96,6 +96,38 @@ RSpec.describe 'Admin Tax Exemption Certificates API', type: :request, swagger_d
end
end
+ path '/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}' do
+ let(:company_id) { company.prefixed_id }
+ let(:id) { certificate.prefixed_id }
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :company_id, in: :path, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+
+ patch 'Update a tax exemption certificate' do
+ tags 'Companies'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Corrects the details recorded for a certificate, such as its issuing authority or expiry date.'
+ admin_scope :write, :customers
+
+ request_body_for
+
+ response '200', 'certificate updated' do
+ let(:body) { { issuing_authority: 'Finanzamt Berlin', expires_at: '2027-12-31T23:59:59Z' } }
+
+ schema '$ref' => '#/components/schemas/TaxExemptionCertificate'
+
+ run_test! do |response|
+ expect(JSON.parse(response.body)['issuing_authority']).to eq('Finanzamt Berlin')
+ end
+ end
+ end
+ end
+
path '/api/v3/admin/companies/{company_id}/tax_exemption_certificates/{id}/verify' do
let(:company_id) { company.prefixed_id }
let(:id) { certificate.prefixed_id }
diff --git a/spree/api/spec/integration/spree/api/v3/admin/companies_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/companies_spec.rb
index 7566cacb6e..e315765674 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/companies_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/companies_spec.rb
@@ -68,4 +68,33 @@ RSpec.describe 'Admin Companies API', type: :request, swagger_doc: 'api-referenc
end
end
end
+
+ path '/api/v3/admin/companies/{id}' do
+ parameter name: :id, in: :path, type: :string, required: true
+
+ patch 'Update a company' do
+ tags 'Companies'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Updates a company node. Only the attributes sent change.'
+ admin_scope :write, :customers
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ request_body_for
+
+ response '200', 'company updated' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:id) { company.prefixed_id }
+ let(:body) { { name: 'Acme Industrial Group', po_number_required: true } }
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['name']).to eq('Acme Industrial Group')
+ expect(data['po_number_required']).to be(true)
+ end
+ end
+ end
+ end
end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/customers/tax_identifiers_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/customers/tax_identifiers_spec.rb
index f49e958a25..761e7fb49d 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/customers/tax_identifiers_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/customers/tax_identifiers_spec.rb
@@ -36,4 +36,36 @@ RSpec.describe 'Admin Customer Tax Identifiers API', type: :request, swagger_doc
end
end
end
+
+ path '/api/v3/admin/customers/{customer_id}/tax_identifiers/{id}' do
+ let(:customer_id) { customer.prefixed_id }
+ let(:id) { tax_identifier.prefixed_id }
+
+ patch 'Update a customer tax registration' do
+ tags 'Customers'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Corrects a registration number. A changed number is checked again before it counts as verified.'
+ admin_scope :write, :customers
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :customer_id, in: :path, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+ request_body_for
+
+ response '200', 'registration updated' do
+ let(:'x-spree-api-key') { secret_api_key.plaintext_token }
+ let(:new_value) { (TaxIdentifierValidatorHelpers.eu_vat_numbers - [tax_identifier.value]).first }
+ let(:body) { { value: new_value } }
+
+ schema '$ref' => '#/components/schemas/TaxIdentifier'
+
+ run_test! do |response|
+ expect(JSON.parse(response.body)['value']).to eq(new_value)
+ end
+ end
+ end
+ end
end
diff --git a/spree/api/spec/integration/spree/api/v3/admin/delivery_settings_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/delivery_settings_spec.rb
index 45d12bb9d3..ec0a3477f8 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/delivery_settings_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/delivery_settings_spec.rb
@@ -64,6 +64,33 @@ RSpec.describe 'Admin Delivery Settings API', type: :request, swagger_doc: 'api-
end
end
+ path '/api/v3/admin/delivery_methods/{id}' do
+ let(:delivery_method) { create(:delivery_method, name: 'UPS Ground') }
+ let(:id) { delivery_method.prefixed_id }
+
+ patch 'Update delivery method' do
+ tags 'Delivery'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Updates a delivery method. Only the attributes sent change.'
+ admin_scope :write, :settings
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+ request_body_for
+
+ response '200', 'delivery method updated' do
+ let(:body) { { name: 'UPS Express', estimated_transit_business_days_min: 1, estimated_transit_business_days_max: 2 } }
+
+ run_test! do |response|
+ expect(JSON.parse(response.body)['name']).to eq('UPS Express')
+ end
+ end
+ end
+ end
+
path '/api/v3/admin/delivery_methods/calculators' do
get 'List delivery calculators' do
tags 'Delivery'
@@ -148,6 +175,45 @@ RSpec.describe 'Admin Delivery Settings API', type: :request, swagger_doc: 'api-
end
end
+ path '/api/v3/admin/delivery_zones/{id}' do
+ let(:delivery_zone) { create(:delivery_zone, store: store, name: 'US North-East') }
+ let(:id) { delivery_zone.prefixed_id }
+
+ patch 'Update delivery zone' do
+ tags 'Delivery'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Updates a delivery zone. Sending `members` replaces the whole member list; leaving it out keeps the current members.'
+ admin_scope :write, :settings
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: :Authorization, in: :header, type: :string, required: true
+ parameter name: :id, in: :path, type: :string, required: true
+ parameter name: :expand, in: :query, type: :string, required: false,
+ description: 'Comma-separated associations to embed, e.g. `members`'
+ request_body_for
+
+ response '200', 'delivery zone updated' do
+ before { Spree::Country.by_iso('US') }
+
+ let(:expand) { 'members' }
+ let(:body) do
+ {
+ name: 'US East Coast',
+ members: [{ member_type: 'postal_code', country_code: 'US', postal_code_from: '10000', postal_code_to: '14999' }]
+ }
+ end
+
+ run_test! do |response|
+ data = JSON.parse(response.body)
+ expect(data['name']).to eq('US East Coast')
+ expect(data['members'].length).to eq(1)
+ end
+ end
+ end
+ end
+
path '/api/v3/admin/delivery_methods/{delivery_method_id}/rules' do
let(:delivery_method) { create(:delivery_method) }
let(:delivery_method_id) { delivery_method.prefixed_id }
diff --git a/spree/api/spec/integration/spree/api/v3/store/companies_spec.rb b/spree/api/spec/integration/spree/api/v3/store/companies_spec.rb
index 6089cdbd1f..ba1da1bd31 100644
--- a/spree/api/spec/integration/spree/api/v3/store/companies_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/store/companies_spec.rb
@@ -221,6 +221,40 @@ RSpec.describe 'Company Self-Service API', type: :request, swagger_doc: 'api-ref
end
end
end
+
+ post 'Add an address book entry' do
+ tags 'Companies'
+ consumes 'application/json'
+ produces 'application/json'
+ security [api_key: [], bearer_auth: []]
+ description 'Adds a labeled site to the node. Pass `default_billing: true` or `default_shipping: true` to make it the default of that kind.'
+
+ parameter name: 'x-spree-api-key', in: :header, type: :string, required: true
+ parameter name: 'Authorization', in: :header, type: :string, required: true
+ request_body_for
+
+ response '201', 'address book entry created' do
+ let!(:membership) { create(:company_membership, company: company, customer: user) }
+ let(:existing) { create(:company_address, owner: company, label: 'Headquarters') }
+ let(:company_id) { company.prefixed_id }
+ let(:body) do
+ {
+ label: 'Northern Warehouse', first_name: 'Ada', last_name: 'Lovelace',
+ address1: '350 Fifth Avenue', city: 'New York', postal_code: '10118',
+ country_code: existing.country.iso, state_code: existing.state.abbr, phone: '+12125551234',
+ default_shipping: true
+ }
+ end
+ let(:'x-spree-api-key') { api_key.token }
+ let(:'Authorization') { "Bearer #{jwt_token}" }
+
+ schema '$ref' => '#/components/schemas/Address'
+
+ run_test! do |response|
+ expect(JSON.parse(response.body)['label']).to eq('Northern Warehouse')
+ end
+ end
+ end
end
path '/api/v3/store/companies/{company_id}/addresses/{id}' do
@@ -247,6 +281,8 @@ RSpec.describe 'Company Self-Service API', type: :request, swagger_doc: 'api-ref
let(:'x-spree-api-key') { api_key.token }
let(:'Authorization') { "Bearer #{jwt_token}" }
+ schema '$ref' => '#/components/schemas/Address'
+
run_test! do |response|
expect(JSON.parse(response.body)['label']).to eq('Northern Warehouse')
end
diff --git a/spree/api/spec/services/spree/api/v3/request_schema_spec.rb b/spree/api/spec/services/spree/api/v3/request_schema_spec.rb
index 9a65cb2048..91597c2376 100644
--- a/spree/api/spec/services/spree/api/v3/request_schema_spec.rb
+++ b/spree/api/spec/services/spree/api/v3/request_schema_spec.rb
@@ -218,6 +218,25 @@ RSpec.describe Spree::Api::V3::RequestSchema do
expect { declare { |schema| schema.attribute :rows, :array, of: :any, permit: false } }.not_to raise_error
end
+ it 'requires attributes taken from a shared set' do
+ shared = described_class.new { |schema| schema.attribute :city, :string }
+ schema = declare do |body|
+ body.include_attributes shared
+ body.require_attributes :city, on: :create
+ end
+
+ expect(schema.json_schema(:create)[:required]).to eq(['city'])
+ expect(schema.json_schema(:update)).not_to have_key(:required)
+ expect(shared.json_schema).not_to have_key(:required)
+ expect { declare { |body| body.require_attributes :missing } }.to raise_error(ArgumentError, /not an attribute/)
+
+ always = declare do |body|
+ body.include_attributes(described_class.new { |schema| schema.attribute :city, :string, required: true })
+ body.require_attributes :city, on: :create
+ end
+ expect(always.json_schema(:update)[:required]).to eq(['city'])
+ end
+
it 'rejects an :object without a shape' do
expect { declare { |schema| schema.attribute :address, :object } }.to raise_error(ArgumentError, /use :hash/)
end