arazzo: 1.0.1 info: title: Swell Capture and Refund Payment summary: Record a payment against an order, then issue a refund against that payment. description: >- A back-office money-movement flow. The workflow creates a payment tied to an order and account with a method and amount, captures the payment id, and then posts a refund against that payment for a given amount and reason. Each 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: swellBackendApi url: ../openapi/swell-backend-api-openapi.yml type: openapi workflows: - workflowId: capture-and-refund-payment summary: Create a payment, then refund it. description: >- Posts a payment against an order and account, then posts a refund against the returned payment id. inputs: type: object required: - order_id - amount properties: order_id: type: string description: The order the payment settles. account_id: type: string description: The account the payment belongs to. amount: type: number description: Payment amount in store currency. method: type: string description: Payment method (card, account, amazon, paypal, manual). currency: type: string description: ISO 4217 currency code. refund_amount: type: number description: Amount to refund against the payment. refund_reason: type: string description: Reason recorded on the refund. steps: - stepId: createPaymentStep description: Record a payment against the order with the supplied method and amount. operationId: createPayment requestBody: contentType: application/json payload: order_id: $inputs.order_id account_id: $inputs.account_id amount: $inputs.amount method: $inputs.method currency: $inputs.currency successCriteria: - condition: $statusCode == 201 outputs: paymentId: $response.body#/id amountRefundable: $response.body#/amount_refundable - stepId: refundPaymentStep description: Issue a refund against the captured payment. operationId: refundPayment parameters: - name: id in: path value: $steps.createPaymentStep.outputs.paymentId requestBody: contentType: application/json payload: amount: $inputs.refund_amount reason: $inputs.refund_reason successCriteria: - condition: $statusCode == 201 outputs: refundId: $response.body#/id refundAmount: $response.body#/amount outputs: paymentId: $steps.createPaymentStep.outputs.paymentId refundId: $steps.refundPaymentStep.outputs.refundId