arazzo: 1.0.1 info: title: Block Square Location Payment Reconciliation summary: Resolve a location, list its recent payments, and detail the most recent one. description: >- An end-to-end reconciliation that starts from location discovery. The workflow lists the seller's locations, lists recent payments for the first location, and reads the most recent payment back in full when one exists. Each step inlines its bearer token and query parameters. version: 1.0.0 sourceDescriptions: - name: squareApi url: ../openapi/block-square-api-openapi.yaml type: openapi workflows: - workflowId: location-payment-reconciliation summary: List locations, list payments for the first location, then detail the latest. description: >- Lists locations and uses the first one to list recent payments, branching on whether any payments exist and retrieving the most recent payment in full when one is present. inputs: type: object required: - accessToken properties: accessToken: type: string description: Square access token presented as a Bearer credential. limit: type: integer description: Maximum number of payments to return (max 100). default: 25 steps: - stepId: listLocations description: List the seller's locations and select the first for reconciliation. operationId: list-locations parameters: - name: Authorization in: header value: Bearer $inputs.accessToken successCriteria: - condition: $statusCode == 200 outputs: locationId: $response.body#/locations/0/id locationName: $response.body#/locations/0/name - stepId: listPayments description: List recent payments for the resolved location and branch on results. operationId: list-payments parameters: - name: Authorization in: header value: Bearer $inputs.accessToken - name: location_id in: query value: $steps.listLocations.outputs.locationId - name: limit in: query value: $inputs.limit successCriteria: - condition: $statusCode == 200 outputs: latestPaymentId: $response.body#/payments/0/id onSuccess: - name: hasPayments type: goto stepId: getPayment criteria: - context: $response.body condition: $.payments.length > 0 type: jsonpath - name: noPayments type: end criteria: - context: $response.body condition: $.payments.length == 0 type: jsonpath - stepId: getPayment description: Retrieve the most recent payment by id for the reconciliation record. operationId: get-payment parameters: - name: Authorization in: header value: Bearer $inputs.accessToken - name: payment_id in: path value: $steps.listPayments.outputs.latestPaymentId successCriteria: - condition: $statusCode == 200 outputs: paymentStatus: $response.body#/payment/status totalMoney: $response.body#/payment/total_money outputs: locationId: $steps.listLocations.outputs.locationId latestPaymentId: $steps.listPayments.outputs.latestPaymentId paymentStatus: $steps.getPayment.outputs.paymentStatus