arazzo: 1.0.1 info: title: WooCommerce Create Order and Refund summary: Place an order, mark it completed, then issue a refund against it. description: >- Exercises the order lifecycle through to a refund. The workflow creates an order with a line item, updates the order to a completed status so it is eligible for refunding, and then creates a refund against the order for a supplied amount. 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: woocommerceRestApi url: ../openapi/woocommerce-rest-api-openapi.yml type: openapi workflows: - workflowId: create-order-and-refund summary: Create an order, complete it, and issue a refund against it. description: >- Creates an order, transitions it to completed, and creates a refund for the supplied amount and reason. inputs: type: object required: - productId - quantity - refundAmount properties: productId: type: integer description: ID of the product to add as a line item on the order. quantity: type: integer description: Quantity of the product to order. refundAmount: type: string description: Amount to refund as a decimal string. refundReason: type: string description: Optional human-readable reason for the refund. steps: - stepId: createOrder description: >- Create an order with a single product line item. operationId: createOrder requestBody: contentType: application/json payload: status: pending line_items: - product_id: $inputs.productId quantity: $inputs.quantity successCriteria: - condition: $statusCode == 201 outputs: orderId: $response.body#/id - stepId: completeOrder description: >- Update the order status to completed so it becomes eligible for a refund. operationId: updateOrder parameters: - name: id in: path value: $steps.createOrder.outputs.orderId requestBody: contentType: application/json payload: status: completed successCriteria: - condition: $statusCode == 200 outputs: orderStatus: $response.body#/status - stepId: createRefund description: >- Create a refund against the completed order for the supplied amount and reason. operationId: createOrderRefund parameters: - name: order_id in: path value: $steps.createOrder.outputs.orderId requestBody: contentType: application/json payload: amount: $inputs.refundAmount reason: $inputs.refundReason api_refund: false successCriteria: - condition: $statusCode == 201 outputs: refundId: $response.body#/id refundAmount: $response.body#/amount outputs: orderId: $steps.createOrder.outputs.orderId refundId: $steps.createRefund.outputs.refundId refundAmount: $steps.createRefund.outputs.refundAmount