From 1dccfd91c060e6a09eefa670eb808da4f995c947 Mon Sep 17 00:00:00 2001 From: Arman Tuyakbayev Date: Thu, 22 Feb 2024 17:28:22 +0600 Subject: [PATCH] Migrate rich billing portals to common billing portals (#1796) * Migrate rich billing portals to common billing portals * Use flexible plan * Add separated endpoint * Fix Flexible plan in one more place --- .../storefront/PostSubscription.yaml | 4 +- openapi/components/schemas/BillingPortal.yaml | 41 ++++++++ .../components/schemas/RichBillingPortal.yaml | 93 ------------------- .../schemas/StorefrontBillingPortal.yaml | 12 +++ .../schemas/StorefrontOrderPreview.yaml | 4 +- .../schemas/StorefrontRichBillingPortal.yaml | 66 ------------- .../schemas/StorefrontSubscription.yaml | 2 +- openapi/components/schemas/Subscription.yaml | 2 +- openapi/openapi.yaml | 8 +- openapi/paths/rich-billing-portals.yaml | 73 --------------- openapi/paths/rich-billing-portals@{id}.yaml | 67 ------------- ... experimental@billing-portals@{slug}.yaml} | 23 +++-- 12 files changed, 75 insertions(+), 320 deletions(-) delete mode 100644 openapi/components/schemas/RichBillingPortal.yaml delete mode 100644 openapi/components/schemas/StorefrontRichBillingPortal.yaml delete mode 100644 openapi/paths/rich-billing-portals.yaml delete mode 100644 openapi/paths/rich-billing-portals@{id}.yaml rename openapi/paths/storefront/{rich-billing-portals@{id}.yaml => experimental@billing-portals@{slug}.yaml} (51%) diff --git a/openapi/components/requestBodies/storefront/PostSubscription.yaml b/openapi/components/requestBodies/storefront/PostSubscription.yaml index 770e5f5248..5a0b32e8be 100644 --- a/openapi/components/requestBodies/storefront/PostSubscription.yaml +++ b/openapi/components/requestBodies/storefront/PostSubscription.yaml @@ -1,9 +1,9 @@ type: object required: - - richBillingPortalId + - billingPortalId - items properties: - richBillingPortalId: + billingPortalId: type: string description: ID of the billing portal. maxLength: 50 diff --git a/openapi/components/schemas/BillingPortal.yaml b/openapi/components/schemas/BillingPortal.yaml index 7adba4f913..b7114af283 100644 --- a/openapi/components/schemas/BillingPortal.yaml +++ b/openapi/components/schemas/BillingPortal.yaml @@ -117,6 +117,47 @@ properties: - active - inactive default: active + plans: + type: array + minItems: 1 + description: Details of selected plans. + items: + type: object + properties: + plan: + $ref: ./FlexiblePlan.yaml + status: + type: string + description: |- + Status of the plan in the billing portal. + If the status is `archived`, customers can continue using the billing portal, + but can not select it as a new item. + enum: + - active + - archived + default: active + example: active + addons: + type: array + description: Details of selected add-ons. + items: + type: object + description: Add-on plan details. + properties: + plan: + $ref: ./FlexiblePlan.yaml + status: + type: string + description: |- + Status of the plan in the billing portal. + If the status is `archived`, customers can continue using the billing portal, + but can not select it as a new item. + enum: + - active + - archived + default: active + example: active + default: [ ] createdTime: $ref: ./CreatedTime.yaml updatedTime: diff --git a/openapi/components/schemas/RichBillingPortal.yaml b/openapi/components/schemas/RichBillingPortal.yaml deleted file mode 100644 index 823cb912be..0000000000 --- a/openapi/components/schemas/RichBillingPortal.yaml +++ /dev/null @@ -1,93 +0,0 @@ -type: object -required: - - websiteId - - name - - plans -properties: - id: - type: string - description: ID of the billing portal. - readOnly: true - maxLength: 50 - example: bill_prt_0YV7K5TYV5D1P9ZNKDT39KZC3C - websiteId: - $ref: ./WebsiteId.yaml - name: - type: string - description: Name of the billing portal. - status: - description: Status of the billing portal. - type: string - enum: - - active - - inactive - default: active - plans: - type: array - minItems: 1 - description: Details of selected plans. - items: - type: object - properties: - plan: - allOf: - - type: object - description: Plan details. - required: - - id - properties: - id: - type: string - description: ID of the plan. - maxLength: 50 - example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X - - $ref: ./SubscriptionOrderPlan.yaml - status: - type: string - description: |- - Status of the plan in the billing portal. - If the status is `archived`, customers can continue using the billing portal, - but can not select it as a new item. - enum: - - active - - archived - default: active - example: active - addons: - type: array - description: Details of selected add-ons. - items: - type: object - description: Add-on plan details. - properties: - plan: - allOf: - - type: object - description: Plan details. - required: - - id - properties: - id: - type: string - description: ID of the plan. - maxLength: 50 - example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X - - $ref: ./SubscriptionOrderPlan.yaml - status: - type: string - description: |- - Status of the plan in the billing portal. - If the status is `archived`, customers can continue using the billing portal, - but can not select it as a new item. - enum: - - active - - archived - default: active - example: active - default: [] - createdTime: - $ref: ./CreatedTime.yaml - updatedTime: - $ref: ./UpdatedTime.yaml - _links: - $ref: ./SelfLink.yaml diff --git a/openapi/components/schemas/StorefrontBillingPortal.yaml b/openapi/components/schemas/StorefrontBillingPortal.yaml index 90c5f80b6c..d74505b445 100644 --- a/openapi/components/schemas/StorefrontBillingPortal.yaml +++ b/openapi/components/schemas/StorefrontBillingPortal.yaml @@ -87,6 +87,18 @@ properties: description: Website terms of service URL. type: string format: url + plans: + type: array + minItems: 1 + description: Details of selected plans. + items: + $ref: ./FlexiblePlan.yaml + addons: + type: array + description: Details of selected add-ons. + items: + $ref: ./FlexiblePlan.yaml + default: [ ] createdTime: $ref: ./CreatedTime.yaml updatedTime: diff --git a/openapi/components/schemas/StorefrontOrderPreview.yaml b/openapi/components/schemas/StorefrontOrderPreview.yaml index 7ca27fea28..bde9ab3c8f 100644 --- a/openapi/components/schemas/StorefrontOrderPreview.yaml +++ b/openapi/components/schemas/StorefrontOrderPreview.yaml @@ -155,6 +155,6 @@ properties: If unset the cheapest applicable shipping rate is chosen. writeOnly: true $ref: ./ResourceId.yaml - richBillingPortalId: + billingPortalId: description: |- - ID of the rich billing portal to validate items against. + ID of the billing portal to validate items against. diff --git a/openapi/components/schemas/StorefrontRichBillingPortal.yaml b/openapi/components/schemas/StorefrontRichBillingPortal.yaml deleted file mode 100644 index 777b2c2b75..0000000000 --- a/openapi/components/schemas/StorefrontRichBillingPortal.yaml +++ /dev/null @@ -1,66 +0,0 @@ -type: object -properties: - id: - type: string - description: ID of the billing portal. - readOnly: true - maxLength: 50 - example: bill_prt_0YV7K5TYV5D1P9ZNKDT39KZC3C - websiteId: - $ref: ./WebsiteId.yaml - name: - type: string - description: Name of the billing portal. - status: - description: Status of the billing portal. - type: string - enum: - - active - - inactive - token: - description: Token used for session authentication. - type: string - readOnly: true - plans: - type: array - minItems: 1 - description: Details of selected plans. - items: - allOf: - - type: object - description: Plan details. - properties: - id: - type: string - description: ID of the plan. - maxLength: 50 - example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X - - $ref: ./SubscriptionOrderPlan.yaml - addons: - type: array - description: Details of selected add-ons. - items: - allOf: - - type: object - description: Add-on plan details. - properties: - id: - type: string - description: ID of the add-on plan. - maxLength: 50 - example: plan_0YV7DENSVGDBW9S71XZNNYYQ0X - - $ref: ./SubscriptionOrderPlan.yaml - default: [] - createdTime: - $ref: ./CreatedTime.yaml - updatedTime: - $ref: ./UpdatedTime.yaml - _links: - $ref: ./SelfLink.yaml - _embedded: - type: object - description: Embedded objects that are requested by the `expand` query parameter. - readOnly: true - properties: - subscription: - type: object diff --git a/openapi/components/schemas/StorefrontSubscription.yaml b/openapi/components/schemas/StorefrontSubscription.yaml index dcc68a04b7..6df93c9f73 100644 --- a/openapi/components/schemas/StorefrontSubscription.yaml +++ b/openapi/components/schemas/StorefrontSubscription.yaml @@ -416,7 +416,7 @@ properties: type: string readOnly: true maxLength: 255 - richBillingPortalId: + billingPortalId: type: string description: ID of the billing portal. default: null diff --git a/openapi/components/schemas/Subscription.yaml b/openapi/components/schemas/Subscription.yaml index 5405366452..acf28e5a59 100644 --- a/openapi/components/schemas/Subscription.yaml +++ b/openapi/components/schemas/Subscription.yaml @@ -435,7 +435,7 @@ properties: If this value is `null`, this field uses risk metadata that is captured when creating the payment token. allOf: - $ref: ./RiskMetadata.yaml - richBillingPortalId: + billingPortalId: type: string description: ID of the billing portal. default: null diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index f07d10f1f3..1e8abc0c69 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -1201,10 +1201,6 @@ paths: $ref: ./paths/profile.yaml /profile/mfa: $ref: ./paths/profile@mfa.yaml - /rich-billing-portals: - $ref: ./paths/rich-billing-portals.yaml - /rich-billing-portals/{id}: - $ref: ./paths/rich-billing-portals@{id}.yaml '/roles': $ref: ./paths/roles.yaml '/roles/{id}': @@ -1321,6 +1317,8 @@ paths: $ref: paths/storefront/account@verification@{token}.yaml '/storefront/billing-portals/{slug}': $ref: paths/storefront/billing-portals@{slug}.yaml + '/storefront/experimental/billing-portals/{slug}': + $ref: paths/storefront/experimental@billing-portals@{slug}.yaml '/storefront/deposit-strategies/{id}': $ref: paths/storefront/deposit-strategies@{id}.yaml '/storefront/deposit-requests/{id}': @@ -1389,8 +1387,6 @@ paths: $ref: paths/storefront/purchase.yaml '/storefront/preview-purchase': $ref: paths/storefront/preview-purchase.yaml - '/storefront/rich-billing-portals/{id}': - $ref: paths/storefront/rich-billing-portals@{id}.yaml '/storefront/quotes/{id}': $ref: paths/storefront/quotes@{id}.yaml '/storefront/quotes/{id}/accept': diff --git a/openapi/paths/rich-billing-portals.yaml b/openapi/paths/rich-billing-portals.yaml deleted file mode 100644 index f78a06517a..0000000000 --- a/openapi/paths/rich-billing-portals.yaml +++ /dev/null @@ -1,73 +0,0 @@ -get: - x-badge: Experimental - x-products: - - Core - tags: - - Billing portals - summary: Retrieve rich billing portals - operationId: GetRichBillingPortalCollection - x-sdk-operation-name: getAll - security: - - SecretApiKey: [] - - JWT: [] - - ApplicationJWT: [] - description: Retrieves a list of rich billing portals. - parameters: - - $ref: ../components/parameters/collectionFilter.yaml - - $ref: ../components/parameters/collectionSort.yaml - - $ref: ../components/parameters/collectionLimit.yaml - - $ref: ../components/parameters/collectionOffset.yaml - - $ref: ../components/parameters/collectionQuery.yaml - responses: - '200': - description: List of rich billing portals retrieved. - headers: - Pagination-Total: - $ref: ../components/headers/Pagination-Total.yaml - Pagination-Limit: - $ref: ../components/headers/Pagination-Limit.yaml - Pagination-Offset: - $ref: ../components/headers/Pagination-Offset.yaml - content: - application/json: - schema: - type: array - items: - $ref: ../components/schemas/RichBillingPortal.yaml - '401': - $ref: ../components/responses/Unauthorized.yaml - '403': - $ref: ../components/responses/Forbidden.yaml -post: - x-badge: Experimental - x-products: - - Core - tags: - - Billing portals - summary: Create a rich billing portal - operationId: PostRichBillingPortal - x-sdk-operation-name: create - description: Creates a rich billing portal. - requestBody: - content: - application/json: - schema: - $ref: ../components/schemas/RichBillingPortal.yaml - description: Rich billing portal resource. - required: true - responses: - '201': - description: Rich billing portal created. - headers: - Location: - $ref: ../components/headers/Location.yaml - content: - application/json: - schema: - $ref: ../components/schemas/RichBillingPortal.yaml - '401': - $ref: ../components/responses/Unauthorized.yaml - '403': - $ref: ../components/responses/Forbidden.yaml - '422': - $ref: ../components/responses/ValidationError.yaml diff --git a/openapi/paths/rich-billing-portals@{id}.yaml b/openapi/paths/rich-billing-portals@{id}.yaml deleted file mode 100644 index bdbfd7a288..0000000000 --- a/openapi/paths/rich-billing-portals@{id}.yaml +++ /dev/null @@ -1,67 +0,0 @@ -parameters: - - $ref: ../components/parameters/resourceId.yaml -get: - x-badge: Experimental - x-products: - - Core - tags: - - Billing portals - summary: Retrieve a rich billing portal - operationId: GetRichBillingPortal - x-sdk-operation-name: get - description: Retrieves a rich billing portal. - responses: - '200': - description: Rich billing portal retrieved. - content: - application/json: - schema: - $ref: ../components/schemas/RichBillingPortal.yaml - '401': - $ref: ../components/responses/Unauthorized.yaml - '403': - $ref: ../components/responses/Forbidden.yaml - '404': - $ref: ../components/responses/NotFound.yaml -put: - x-badge: Experimental - x-products: - - Core - tags: - - Billing portals - summary: Update a rich billing portal - operationId: PutRichBillingPortal - x-sdk-operation-name: update - description: Updates a rich billing portal. - requestBody: - content: - application/json: - schema: - $ref: ../components/schemas/RichBillingPortal.yaml - description: Rich billing portal resource. - required: true - responses: - '200': - description: Rich billing portal updated. - headers: - Location: - $ref: ../components/headers/Location.yaml - content: - application/json: - schema: - $ref: ../components/schemas/RichBillingPortal.yaml - '201': - description: Rich billing portal created. - headers: - Location: - $ref: ../components/headers/Location.yaml - content: - application/json: - schema: - $ref: ../components/schemas/RichBillingPortal.yaml - '401': - $ref: ../components/responses/Unauthorized.yaml - '403': - $ref: ../components/responses/Forbidden.yaml - '422': - $ref: ../components/responses/ValidationError.yaml diff --git a/openapi/paths/storefront/rich-billing-portals@{id}.yaml b/openapi/paths/storefront/experimental@billing-portals@{slug}.yaml similarity index 51% rename from openapi/paths/storefront/rich-billing-portals@{id}.yaml rename to openapi/paths/storefront/experimental@billing-portals@{slug}.yaml index 0f9df6f34f..2f2e8dd1c9 100644 --- a/openapi/paths/storefront/rich-billing-portals@{id}.yaml +++ b/openapi/paths/storefront/experimental@billing-portals@{slug}.yaml @@ -1,25 +1,30 @@ parameters: - - $ref: ../../components/parameters/resourceId.yaml + - name: slug + in: path + description: Resource slug. + required: true + schema: + type: string + maxLength: 100 + pattern: '^[@~\-\.\w]+$' get: - x-badge: Experimental x-products: - Storefront tags: - Storefront billing portals - summary: Retrieve a rich billing portal - operationId: StorefrontGetRichBillingPortal + summary: Retrieve a billing portal + operationId: StorefrontGetExperimentalBillingPortal x-sdk-operation-name: get - security: [] - description: Retrieves a rich billing portal. - parameters: - - $ref: ../../components/parameters/collectionExpand.yaml + security: + - CustomerJWT: [ ] + description: Retrieve a billing portal with a specified slug. responses: '200': description: Billing portal retrieved. content: application/json: schema: - $ref: ../../components/schemas/StorefrontRichBillingPortal.yaml + $ref: ../../components/schemas/StorefrontBillingPortal.yaml '401': $ref: ../../components/responses/Unauthorized.yaml '403':