diff --git a/shared/management/http/api/openapi.yml b/shared/management/http/api/openapi.yml index f131f4d01..59ea69ca1 100644 --- a/shared/management/http/api/openapi.yml +++ b/shared/management/http/api/openapi.yml @@ -9046,6 +9046,165 @@ paths: description: The tenant was not found "500": $ref: "#/components/responses/internal_error" + /api/integrations/msp/reseller/msps/{id}/subscription: + post: + summary: Create MSP subscription under reseller + description: Creates a managed Stripe subscription for an MSP managed by the reseller + tags: + - MSP + parameters: + - in: path + name: id + required: true + schema: + type: string + description: The MSP account ID + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + price_id: + type: string + description: The Stripe price ID for the plan + required: + - price_id + responses: + "200": + description: Subscription created successfully + "400": + $ref: "#/components/responses/bad_request" + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "404": + description: MSP not found or not managed by this reseller + "412": + description: MSP already has an active subscription or reseller has no subscription + "500": + $ref: "#/components/responses/internal_error" + put: + summary: Change MSP subscription plan + description: Changes the plan of an MSP subscription managed by the reseller + tags: + - MSP + parameters: + - in: path + name: id + required: true + schema: + type: string + description: The MSP account ID + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + price_id: + type: string + description: The new Stripe price ID + required: + - price_id + responses: + "200": + description: Subscription updated successfully + "400": + $ref: "#/components/responses/bad_request" + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "404": + description: MSP not found or not managed by this reseller + "412": + description: Subscription was recently updated + "500": + $ref: "#/components/responses/internal_error" + /api/integrations/msp/reseller/invoices: + get: + summary: List reseller invoices + description: Returns paid invoices for the reseller account + tags: + - MSP + responses: + "200": + description: List of paid invoices + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/InvoiceResponse" + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "404": + description: No invoices found + "500": + $ref: "#/components/responses/internal_error" + /api/integrations/msp/reseller/invoices/{invoiceId}/pdf: + get: + summary: Get reseller invoice PDF + description: Returns the Stripe hosted URL for a reseller invoice + tags: + - MSP + parameters: + - in: path + name: invoiceId + required: true + schema: + type: string + description: The Stripe invoice ID + responses: + "200": + description: Invoice PDF URL + content: + application/json: + schema: + $ref: "#/components/schemas/InvoicePDFResponse" + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "404": + description: Invoice not found + "500": + $ref: "#/components/responses/internal_error" + /api/integrations/msp/reseller/invoices/{invoiceId}/csv: + get: + summary: Get reseller invoice CSV + description: Returns the invoice data as CSV + tags: + - MSP + parameters: + - in: path + name: invoiceId + required: true + schema: + type: string + description: The Stripe invoice ID + responses: + "200": + description: CSV file + content: + text/csv: + schema: + type: string + format: binary + "401": + $ref: "#/components/responses/requires_authentication" + "403": + $ref: "#/components/responses/forbidden" + "404": + description: Invoice not found + "500": + $ref: "#/components/responses/internal_error" /api/integrations/edr/intune: post: tags: diff --git a/shared/management/http/api/types.gen.go b/shared/management/http/api/types.gen.go index f37c258e6..482f3f706 100644 --- a/shared/management/http/api/types.gen.go +++ b/shared/management/http/api/types.gen.go @@ -4681,6 +4681,18 @@ type PutApiIntegrationsMspResellerMspsIdInviteJSONBody struct { // PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValue defines parameters for PutApiIntegrationsMspResellerMspsIdInvite. type PutApiIntegrationsMspResellerMspsIdInviteJSONBodyValue string +// PostApiIntegrationsMspResellerMspsIdSubscriptionJSONBody defines parameters for PostApiIntegrationsMspResellerMspsIdSubscription. +type PostApiIntegrationsMspResellerMspsIdSubscriptionJSONBody struct { + // PriceId The Stripe price ID for the plan + PriceId string `json:"price_id"` +} + +// PutApiIntegrationsMspResellerMspsIdSubscriptionJSONBody defines parameters for PutApiIntegrationsMspResellerMspsIdSubscription. +type PutApiIntegrationsMspResellerMspsIdSubscriptionJSONBody struct { + // PriceId The new Stripe price ID + PriceId string `json:"price_id"` +} + // PutApiIntegrationsMspTenantsIdInviteJSONBody defines parameters for PutApiIntegrationsMspTenantsIdInvite. type PutApiIntegrationsMspTenantsIdInviteJSONBody struct { // Value Accept or decline the invitation. @@ -4819,6 +4831,12 @@ type PostApiIntegrationsMspResellerMspsJSONRequestBody = CreateResellerMSPReques // PutApiIntegrationsMspResellerMspsIdInviteJSONRequestBody defines body for PutApiIntegrationsMspResellerMspsIdInvite for application/json ContentType. type PutApiIntegrationsMspResellerMspsIdInviteJSONRequestBody PutApiIntegrationsMspResellerMspsIdInviteJSONBody +// PostApiIntegrationsMspResellerMspsIdSubscriptionJSONRequestBody defines body for PostApiIntegrationsMspResellerMspsIdSubscription for application/json ContentType. +type PostApiIntegrationsMspResellerMspsIdSubscriptionJSONRequestBody PostApiIntegrationsMspResellerMspsIdSubscriptionJSONBody + +// PutApiIntegrationsMspResellerMspsIdSubscriptionJSONRequestBody defines body for PutApiIntegrationsMspResellerMspsIdSubscription for application/json ContentType. +type PutApiIntegrationsMspResellerMspsIdSubscriptionJSONRequestBody PutApiIntegrationsMspResellerMspsIdSubscriptionJSONBody + // PostApiIntegrationsMspTenantsJSONRequestBody defines body for PostApiIntegrationsMspTenants for application/json ContentType. type PostApiIntegrationsMspTenantsJSONRequestBody = CreateTenantRequest