arazzo: 1.0.1 info: title: SAP BRIM Provision a New Subscription summary: Create a subscription plan, subscribe a customer, activate the subscription, and confirm its state. description: >- End-to-end provisioning of a recurring subscription on SAP BRIM Subscription Billing. The workflow first publishes a plan into the product catalog, then creates a subscription that binds a customer to that plan, activates the subscription so the billing cycle begins, and finally reads the subscription back to confirm it reached the ACTIVE status. Every step spells out its request inline so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: subscriptionBillingApi url: ../openapi/sap-brim-subscription-billing-openapi.yml type: openapi workflows: - workflowId: provision-subscription summary: Create a plan, subscribe a customer to it, and activate the subscription. description: >- Creates a subscription plan, creates a subscription for the supplied customer against that plan, activates the subscription, and reads it back to verify it is ACTIVE. inputs: type: object required: - customerId - planName - billingFrequency - price - currency properties: customerId: type: string description: Identifier of the customer to subscribe. planName: type: string description: Display name for the new subscription plan. billingFrequency: type: string description: Billing cadence (MONTHLY, QUARTERLY, SEMI_ANNUAL, ANNUAL, CUSTOM). price: type: number description: Recurring price value for the plan. currency: type: string description: ISO 4217 currency code for the price (e.g. USD). trialPeriodDays: type: integer description: Optional number of trial days before billing begins. steps: - stepId: createPlan description: Publish a new subscription plan into the product catalog. operationId: createPlan requestBody: contentType: application/json payload: name: $inputs.planName billingFrequency: $inputs.billingFrequency price: value: $inputs.price currency: $inputs.currency successCriteria: - condition: $statusCode == 201 outputs: planId: $response.body#/planId - stepId: createSubscription description: Create a subscription binding the customer to the newly created plan. operationId: createSubscription requestBody: contentType: application/json payload: customerId: $inputs.customerId planId: $steps.createPlan.outputs.planId billingFrequency: $inputs.billingFrequency trialPeriodDays: $inputs.trialPeriodDays autoRenew: true successCriteria: - condition: $statusCode == 201 outputs: subscriptionId: $response.body#/subscriptionId status: $response.body#/status - stepId: activateSubscription description: Activate the pending subscription so the billing cycle starts. operationId: activateSubscription parameters: - name: subscriptionId in: path value: $steps.createSubscription.outputs.subscriptionId requestBody: contentType: application/json payload: {} successCriteria: - condition: $statusCode == 200 outputs: status: $response.body#/status - stepId: confirmSubscription description: Read the subscription back to confirm it reached the ACTIVE status. operationId: getSubscription parameters: - name: subscriptionId in: path value: $steps.createSubscription.outputs.subscriptionId successCriteria: - condition: $statusCode == 200 - context: $response.body condition: $.status == "ACTIVE" type: jsonpath outputs: subscriptionId: $response.body#/subscriptionId status: $response.body#/status nextBillingDate: $response.body#/nextBillingDate outputs: planId: $steps.createPlan.outputs.planId subscriptionId: $steps.confirmSubscription.outputs.subscriptionId status: $steps.confirmSubscription.outputs.status nextBillingDate: $steps.confirmSubscription.outputs.nextBillingDate