Skip to content

Commit ff20118

Browse files
XaosSintezlucasxcivnoon-dawg
authored
Add Storefront change-items endpoint (#1769)
* Add Storefront change-items endpoint * Remove usage limits * Adjust subscription terms * Add preview field * Apply suggestions from code review Co-authored-by: Chris <[email protected]> * Adjust status code --------- Co-authored-by: Lucas de Oliveira <[email protected]> Co-authored-by: Chris <[email protected]>
1 parent 4dbdc2f commit ff20118

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
type: object
2+
description: Change customer subscription items.
3+
properties:
4+
effectiveTime:
5+
type: string
6+
description: Effective time when changes are applied.
7+
default: now
8+
enum:
9+
- now
10+
- next-service-period
11+
x-enumDescriptions:
12+
now: Apply changes immediately.
13+
next-service-period: Apply changes at the beginning of next service period.
14+
items:
15+
type: array
16+
description: Details of items in the subscription.
17+
minItems: 1
18+
items:
19+
type: object
20+
required:
21+
- planId
22+
properties:
23+
planId:
24+
type: string
25+
description: ID of the plan.
26+
maxLength: 50
27+
example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X
28+
quantity:
29+
description: Number of units of the product on the given plan.
30+
type: integer
31+
minimum: 0
32+
preview:
33+
description: |-
34+
Specifies if the quote must be previewed before it is created.
35+
Subscriptions cannot be changed in the preview.
36+
type: boolean
37+
default: false
38+
example: true

openapi/openapi.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,8 @@ paths:
13591359
$ref: paths/storefront/orders@{id}@cancellation.yaml
13601360
'/storefront/orders/{id}/pause':
13611361
$ref: paths/storefront/orders@{id}@pause.yaml
1362+
'/storefront/subscriptions/{id}/change-items':
1363+
$ref: paths/storefront/subscriptions@{id}@change-items.yaml
13621364
'/storefront/payment':
13631365
$ref: paths/storefront/payment.yaml
13641366
'/storefront/payment-instruments':
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
parameters:
2+
- $ref: ../../components/parameters/resourceId.yaml
3+
post:
4+
x-badge: Experimental
5+
x-products:
6+
- Storefront
7+
tags:
8+
- Storefront orders
9+
summary: Change subscription items
10+
operationId: StorefrontPostSubscriptionItemsChange
11+
x-sdk-operation-name: changeItems
12+
security:
13+
- CustomerJWT: []
14+
description: |-
15+
Creates a quote for requested changes to items and quantities.
16+
This operation applies the requested changes to the subscription when the quote is accepted.
17+
requestBody:
18+
content:
19+
application/json:
20+
schema:
21+
$ref: ../../components/requestBodies/storefront/PostSubscriptionItemsChange.yaml
22+
description: Change items request.
23+
required: true
24+
responses:
25+
'201':
26+
description: Quote for requested changes to items and quantities is created and issued.
27+
headers:
28+
Location:
29+
$ref: ../../components/headers/Location.yaml
30+
content:
31+
application/json:
32+
schema:
33+
$ref: ../../components/schemas/StorefrontQuoteChangeOrder.yaml
34+
'401':
35+
$ref: ../../components/responses/Unauthorized.yaml
36+
'403':
37+
$ref: ../../components/responses/Forbidden.yaml
38+
'404':
39+
$ref: ../../components/responses/NotFound.yaml
40+
'422':
41+
$ref: ../../components/responses/ValidationError.yaml

0 commit comments

Comments
 (0)