diff --git a/.github/actions/default/action.yml b/.github/actions/default/action.yml index 29614e7..4b2fe19 100644 --- a/.github/actions/default/action.yml +++ b/.github/actions/default/action.yml @@ -9,19 +9,11 @@ runs: steps: - name: Install Nix uses: cachix/install-nix-action@v31 - - name: Cache dependencies - uses: nix-community/cache-nix-action@v7 - with: - primary-key: nix-${{ runner.os }}-${{ hashFiles('**/flake.nix', '**/flake.lock') }} - restore-prefixes-first-match: nix-${{ runner.os }}- - name: Load dependencies shell: bash run: nix develop --install - - uses: actions/cache@v5 + - uses: namespacelabs/nscloud-cache-action@v1 with: path: | ~/.cache/go-build /tmp/go/pkg/mod/ - key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-${{ github.job }}-go- \ No newline at end of file diff --git a/.github/actions/docker/action.yml b/.github/actions/docker/action.yml index 839bff6..fdb7748 100644 --- a/.github/actions/docker/action.yml +++ b/.github/actions/docker/action.yml @@ -7,10 +7,8 @@ inputs: runs: using: composite steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: namespacelabs/nscloud-setup-buildx-action@v0 - name: "Put back the git branch into git (Earthly uses it for tagging)" shell: bash run: | diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 277477b..af4e9f8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: PR: if: github.event_name == 'pull_request' name: Check PR Title - runs-on: "shipfox-2vcpu-ubuntu-2404" + runs-on: "namespace-profile-linux-amd64-2vcpu" timeout-minutes: 1 permissions: statuses: write @@ -27,10 +27,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} Dirty: - runs-on: "shipfox-2vcpu-ubuntu-2404" + runs-on: "namespace-profile-linux-amd64-2vcpu" name: "Dirty" steps: - - uses: "actions/checkout@v6" + - uses: "namespacelabs/nscloud-checkout-action@v7" with: fetch-depth: 0 - name: Setup Nix @@ -47,9 +47,9 @@ jobs: run: "hasChanged=$(git status --porcelain) \nif (( $(echo ${#hasChanged}) != 0 )); then\n git status\n echo \"There are changes in the repository\"\n git diff\n exit 1\nfi\n" TestsUnit: name: "Tests (Unit)" - runs-on: "shipfox-4vcpu-ubuntu-2404" + runs-on: "namespace-profile-linux-amd64-4vcpu" steps: - - uses: "actions/checkout@v6" + - uses: "namespacelabs/nscloud-checkout-action@v7" with: fetch-depth: 0 - name: Setup Nix @@ -67,9 +67,9 @@ jobs: path: ./coverage/coverage_unit.txt TestsE2E: name: "Tests (E2E)" - runs-on: "shipfox-8vcpu-ubuntu-2404" + runs-on: "namespace-profile-linux-amd64-8vcpu" steps: - - uses: "actions/checkout@v6" + - uses: "namespacelabs/nscloud-checkout-action@v7" with: fetch-depth: 0 - name: Setup Nix @@ -94,9 +94,9 @@ jobs: path: ./coverage/coverage_e2e.txt TestsIntegration: name: "Tests (Integration)" - runs-on: "shipfox-8vcpu-ubuntu-2404" + runs-on: "namespace-profile-linux-amd64-8vcpu" steps: - - uses: "actions/checkout@v6" + - uses: "namespacelabs/nscloud-checkout-action@v7" with: fetch-depth: 0 - name: Setup Nix @@ -113,14 +113,14 @@ jobs: name: coverage-integration-report path: ./coverage/coverage_integration.txt Tests: - runs-on: "shipfox-2vcpu-ubuntu-2404" + runs-on: "namespace-profile-linux-amd64-2vcpu" name: "Tests" needs: - TestsUnit - TestsIntegration - TestsE2E steps: - - uses: "actions/checkout@v6" + - uses: "namespacelabs/nscloud-checkout-action@v7" with: fetch-depth: 0 - name: Setup Nix diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1b7076..126c714 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,9 +7,9 @@ permissions: contents: write jobs: Release: - runs-on: "shipfox-4vcpu-ubuntu-2404" + runs-on: "namespace-profile-linux-amd64-4vcpu" steps: - - uses: "actions/checkout@v6" + - uses: "namespacelabs/nscloud-checkout-action@v7" - name: Setup Env uses: ./.github/actions/default with: diff --git a/flake.nix b/flake.nix index 14ac521..5136942 100644 --- a/flake.nix +++ b/flake.nix @@ -41,7 +41,7 @@ "aarch64-darwin" = "darwin_arm64"; }; speakeasyHashes = { - "x86_64-linux" = "4419bff16df35eef8f1460de51d28f22b1ba8cd74cc0fce55e5252e8c6801fe9"; + "x86_64-linux" = "6a2d9a237bc4d7725c850bc85c1e85eb784924c64d0f2768350a0ede406f6c9b"; "aarch64-linux" = "4ac73e3a8d941821ea025bd71bfcf6ae41a1dcd830de9a526004324bdf20854f"; "x86_64-darwin" = "029f61f18ee222fc46e27fd4f2897b9058bb007428a003c89d1684c6a69e512a"; "aarch64-darwin" = "394b61250de8ef1ad6284f0990ac86dffe61b7a2f493e46d1d668bc91eb13a5b"; diff --git a/openapi/build.yaml b/openapi/build.yaml index a872b1a..06b6fa3 100644 --- a/openapi/build.yaml +++ b/openapi/build.yaml @@ -4647,6 +4647,126 @@ paths: security: - Authorization: - "payments:read" + /api/payments/v3/orders: + get: + tags: + - "payments.v3" + summary: "List orders ingested from exchange-style connectors" + description: "Returns the full list of orders ingested by Formance from connectors\nthat implement the orders capability (e.g. `coinbaseprime`). Orders\nrepresent trade placements on an exchange-style PSP and are\n**read-only** through the Formance API — submission, cancellation,\nand lifecycle transitions are owned by the underlying connector.\n\nResults are cursor-paginated. The optional request body accepts a\nquery builder for filtering over top-level `V3Order` fields such as\n`connectorID`, `reference`, `direction`, `status`, `type`,\n`sourceAsset`, `destinationAsset`, and `createdAt`.\n\nSee `V3Order` for the full response shape, including the\n`adjustments` array that captures each observed state transition on\nthe exchange.\n" + operationId: "v3ListOrders" + x-speakeasy-name-override: "ListOrders" + parameters: + - $ref: "#/components/parameters/V3PageSize" + - $ref: "#/components/parameters/V3Cursor" + - 'name': 'query' + 'in': 'query' + 'content': + 'application/json': + 'schema': + 'type': 'object' + 'additionalProperties': true + responses: + "200": + description: "OK" + content: + application/json: + schema: + $ref: "#/components/schemas/V3OrdersCursorResponse" + default: + description: "Error" + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - "payments:read" + /api/payments/v3/orders/{orderID}: + get: + tags: + - "payments.v3" + summary: "Get a single order by its Formance ID" + description: "Returns one order identified by its Formance-assigned `id` (composed\nfrom the PSP `reference` and the connector ID — **not** the PSP's\nnative reference). The response includes the full `adjustments`\nhistory ordered from oldest to most recent; the last adjustment\nreflects the order's current top-level `status`.\n\nReturns an error via `V3ErrorResponse` when no order exists for the\ngiven ID, or when the ID cannot be decoded.\n" + operationId: "v3GetOrder" + x-speakeasy-name-override: "GetOrder" + parameters: + - $ref: "#/components/parameters/V3OrderID" + responses: + "200": + description: "OK" + content: + application/json: + schema: + $ref: "#/components/schemas/V3GetOrderResponse" + default: + description: "Error" + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - "payments:read" + /api/payments/v3/conversions: + get: + tags: + - "payments.v3" + summary: "List currency and asset conversions ingested from connectors" + description: "Returns the full list of conversions ingested by Formance from\nconnectors that implement the conversions capability. A conversion\nis a direct swap between two assets on a PSP (e.g. USD → USDC on\nCoinbase Prime). Conversions are **read-only** through the Formance\nAPI.\n\nUnlike orders, conversions do not carry an adjustment history —\nFormance records only the final observed state (`status`,\n`destinationAmount`, and `fee` when settled).\n\nResults are cursor-paginated. The optional request body accepts a\nquery builder for filtering over top-level `V3Conversion` fields\nsuch as `connectorID`, `reference`, `status`, `sourceAsset`,\n`destinationAsset`, and `createdAt`.\n" + operationId: "v3ListConversions" + x-speakeasy-name-override: "ListConversions" + parameters: + - $ref: "#/components/parameters/V3PageSize" + - $ref: "#/components/parameters/V3Cursor" + - 'name': 'query' + 'in': 'query' + 'content': + 'application/json': + 'schema': + 'type': 'object' + 'additionalProperties': true + responses: + "200": + description: "OK" + content: + application/json: + schema: + $ref: "#/components/schemas/V3ConversionsCursorResponse" + default: + description: "Error" + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - "payments:read" + /api/payments/v3/conversions/{conversionID}: + get: + tags: + - "payments.v3" + summary: "Get a single conversion by its Formance ID" + description: "Returns one conversion identified by its Formance-assigned `id`\n(**not** the PSP's native `reference`). See `V3Conversion` for the\nresponse shape — on `COMPLETED` status the `destinationAmount` and\n`fee` fields reflect the settled values; on `FAILED` the `error`\nfield carries the PSP's rejection reason.\n\nReturns an error via `V3ErrorResponse` when no conversion exists\nfor the given ID.\n" + operationId: "v3GetConversion" + x-speakeasy-name-override: "GetConversion" + parameters: + - $ref: "#/components/parameters/V3ConversionID" + responses: + "200": + description: "OK" + content: + application/json: + schema: + $ref: "#/components/schemas/V3GetConversionResponse" + default: + description: "Error" + content: + application/json: + schema: + $ref: "#/components/schemas/V3ErrorResponse" + security: + - Authorization: + - "payments:read" /api/payments/v3/payments: post: tags: @@ -12059,6 +12179,379 @@ components: - "CAPTURE" - "CAPTURE_FAILED" - "OTHER" + V3OrdersCursorResponse: + type: "object" + required: + - "cursor" + properties: + cursor: + type: "object" + required: + - "pageSize" + - "hasMore" + - "data" + properties: + pageSize: + type: "integer" + format: "int64" + minimum: 1 + example: 15 + hasMore: + type: "boolean" + example: false + previous: + type: "string" + example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + next: + type: "string" + example: "" + data: + type: "array" + items: + $ref: "#/components/schemas/V3Order" + V3GetOrderResponse: + type: "object" + required: + - "data" + properties: + data: + $ref: "#/components/schemas/V3Order" + V3Order: + type: "object" + description: "A trade order submitted to an exchange-style PSP. Orders are read-only\nin the Formance API: they are fetched from the underlying connector.\nStatus transitions are captured via the `adjustments` array; each\nadjustment is a point-in-time snapshot from the PSP.\n" + required: + - "id" + - "connectorID" + - "provider" + - "reference" + - "createdAt" + - "updatedAt" + - "direction" + - "sourceAsset" + - "destinationAsset" + - "type" + - "status" + - "baseQuantityOrdered" + - "timeInForce" + properties: + id: + type: "string" + description: "Formance-assigned unique order ID (composed from the PSP reference and connector ID)." + connectorID: + type: "string" + format: "byte" + description: "ID of the Formance connector this order was fetched from." + provider: + type: "string" + description: "Provider name of the connector (e.g. `coinbaseprime`)." + reference: + type: "string" + description: "PSP-assigned order reference. Unique within the connector; used as the storage dedup key." + clientOrderID: + type: "string" + nullable: true + description: "Client-assigned ID supplied to the PSP for placement idempotency\n(e.g. Coinbase `client_order_id`, Kraken `cl_ord_id`, Binance\n`clientOrderId`). Stored for traceability only — Formance does\nNOT dedup on this field.\n" + createdAt: + type: "string" + format: "date-time" + description: "When the order was created on the PSP." + updatedAt: + type: "string" + format: "date-time" + description: "When Formance last observed a state change on the order. Equivalent to the latest adjustment's `createdAt`." + direction: + $ref: "#/components/schemas/V3OrderDirectionEnum" + sourceAsset: + type: "string" + description: "Asset being spent, in `SYMBOL/precision` form (e.g. `USD/2`,\n`BTC/8`). For BUY: the quote currency. For SELL: the base\ncurrency.\n" + destinationAsset: + type: "string" + description: "Asset being received, in `SYMBOL/precision` form.\nFor BUY: the base currency. For SELL: the quote currency.\n" + type: + $ref: "#/components/schemas/V3OrderTypeEnum" + status: + $ref: "#/components/schemas/V3OrderStatusEnum" + baseQuantityOrdered: + type: "integer" + format: "bigint" + description: "Amount of base asset the order was placed for, as an integer at the base asset's precision." + baseQuantityFilled: + type: "integer" + format: "bigint" + nullable: true + description: "Amount of base asset filled so far, as an integer at the base asset's precision. Null before any fill." + limitPrice: + type: "integer" + format: "bigint" + nullable: true + description: "Maximum price (for BUY) or minimum price (for SELL) at which the order may execute, in `priceAsset` precision. Required for LIMIT-family order types; null otherwise." + stopPrice: + type: "integer" + format: "bigint" + nullable: true + description: "Trigger price at which a STOP / STOP_LIMIT order activates, in `priceAsset` precision. Null for non-stop order types." + timeInForce: + $ref: "#/components/schemas/V3TimeInForceEnum" + expiresAt: + type: "string" + format: "date-time" + nullable: true + description: "Expiration instant for `GOOD_UNTIL_DATE_TIME` orders. Null for other time-in-force values." + fee: + type: "integer" + format: "bigint" + nullable: true + description: "Commission charged by the PSP for the order, as an integer in `feeAsset` precision." + feeAsset: + type: "string" + nullable: true + description: "Currency the fee is denominated in, in `SYMBOL/precision` form. Typically the quote asset." + averageFillPrice: + type: "integer" + format: "bigint" + nullable: true + description: "Volume-weighted average price across all fills so far, in `priceAsset` precision. Analytics field — may be absent if the PSP does not report it." + quoteAmount: + type: "integer" + format: "bigint" + nullable: true + description: "Total amount of quote currency exchanged so far, as reported by\nthe PSP (e.g. Coinbase `filled_value`), at `quoteAsset`\nprecision. For BUY: amount spent. For SELL: amount received.\n" + quoteAsset: + type: "string" + nullable: true + description: "Quote currency with precision (e.g. `USD/2`). Null when the order has no quote-side amounts reported yet." + priceAsset: + type: "string" + nullable: true + description: "Currency + precision under which `limitPrice`, `stopPrice`, and\n`averageFillPrice` should be interpreted. Separate from\n`quoteAsset` because some PSPs return price strings with more\ndecimal digits than the quote currency's natural precision.\n" + sourceAccountID: + type: "string" + nullable: true + description: "Formance account ID of the wallet the source asset was debited\nfrom. Null if the PSP did not return enough information to\nresolve it at ingestion time.\n" + destinationAccountID: + type: "string" + nullable: true + description: "Formance account ID of the wallet the destination asset was credited to. Null if unresolvable." + metadata: + $ref: "#/components/schemas/V3Metadata" + adjustments: + type: "array" + nullable: true + items: + $ref: "#/components/schemas/V3OrderAdjustment" + description: "Ordered history of state snapshots for this order. The most recent element reflects the current `status`." + error: + type: "string" + nullable: true + description: "Human-readable error from the PSP (e.g. rejection reason) when `status` is `FAILED`. Null otherwise." + V3OrderAdjustment: + type: "object" + description: "Immutable snapshot of an order's state at a single observation.\nFormance records one adjustment per distinct state the PSP reports\n(status change, fill progress, fee update). Events are emitted\nper-adjustment, not per-order — so a single order can produce many\nevents over its lifetime.\n" + required: + - "id" + - "reference" + - "createdAt" + - "status" + properties: + id: + type: "string" + description: "Adjustment ID, composed from the order ID plus the state fields that define uniqueness (status, filled quantity, fee). Idempotent — replaying the same observation produces the same ID." + reference: + type: "string" + description: "PSP reference the adjustment belongs to (equal to the parent order's `reference`)." + createdAt: + type: "string" + format: "date-time" + description: "When Formance observed this state. Not the PSP's own timestamp — reflects ingestion time." + status: + $ref: "#/components/schemas/V3OrderStatusEnum" + baseQuantityFilled: + type: "integer" + format: "bigint" + nullable: true + description: "Base asset filled at this observation, at the base asset's precision." + fee: + type: "integer" + format: "bigint" + nullable: true + description: "Cumulative fee at this observation, at `feeAsset` precision." + feeAsset: + type: "string" + nullable: true + description: "Currency the fee is denominated in, in `SYMBOL/precision` form." + metadata: + $ref: "#/components/schemas/V3Metadata" + raw: + type: "object" + description: "Untransformed PSP response payload that produced this adjustment. Retained for debugging and replay." + V3OrderDirectionEnum: + type: "string" + description: "Whether an order buys or sells the base asset." + enum: + - "UNKNOWN" + - "BUY" + - "SELL" + V3OrderTypeEnum: + type: "string" + description: "Exchange order type. Determines which price fields are meaningful on\n`V3Order`: LIMIT-family types use `limitPrice`; STOP-family types use\n`stopPrice`; TWAP/VWAP are time-weighted execution algorithms.\n" + enum: + - "UNKNOWN" + - "MARKET" + - "LIMIT" + - "STOP_LIMIT" + - "STOP" + - "TWAP" + - "VWAP" + - "PEG" + - "BLOCK" + - "RFQ" + - "TRAILING_STOP" + - "TRAILING_STOP_LIMIT" + - "TAKE_PROFIT" + - "TAKE_PROFIT_LIMIT" + - "LIMIT_MAKER" + V3OrderStatusEnum: + type: "string" + description: "Lifecycle of an order on the exchange.\n`PENDING` — accepted by the exchange, not yet working.\n`OPEN` — live on the book, no fills yet.\n`PARTIALLY_FILLED` — live on the book, some base quantity filled.\n`FILLED` — fully filled, terminal.\n`CANCELLED` — cancelled by the user or system, terminal.\n`FAILED` — rejected by the exchange, terminal. See `error` for details.\n`EXPIRED` — `timeInForce` elapsed before full fill, terminal.\n" + enum: + - "UNKNOWN" + - "PENDING" + - "OPEN" + - "PARTIALLY_FILLED" + - "FILLED" + - "CANCELLED" + - "FAILED" + - "EXPIRED" + V3TimeInForceEnum: + type: "string" + description: "How long an order is valid on the exchange.\n`GOOD_UNTIL_CANCELLED` — rests until explicitly cancelled.\n`GOOD_UNTIL_DATE_TIME` — rests until `expiresAt`.\n`IMMEDIATE_OR_CANCEL` — fill immediately, cancel any unfilled portion.\n`FILL_OR_KILL` — fill fully and immediately, or cancel entirely.\n" + enum: + - "UNKNOWN" + - "GOOD_UNTIL_CANCELLED" + - "GOOD_UNTIL_DATE_TIME" + - "IMMEDIATE_OR_CANCEL" + - "FILL_OR_KILL" + V3ConversionsCursorResponse: + type: "object" + required: + - "cursor" + properties: + cursor: + type: "object" + required: + - "pageSize" + - "hasMore" + - "data" + properties: + pageSize: + type: "integer" + format: "int64" + minimum: 1 + example: 15 + hasMore: + type: "boolean" + example: false + previous: + type: "string" + example: "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + next: + type: "string" + example: "" + data: + type: "array" + items: + $ref: "#/components/schemas/V3Conversion" + V3GetConversionResponse: + type: "object" + required: + - "data" + properties: + data: + $ref: "#/components/schemas/V3Conversion" + V3Conversion: + type: "object" + description: "A currency or asset conversion executed on a PSP (e.g. Coinbase Prime\ntransfer between a USD and USDC wallet). Conversions are read-only in\nthe Formance API: they are fetched from the underlying connector.\nUnlike orders, conversions do not carry an adjustment history —\nFormance records the final state only.\n" + required: + - "id" + - "connectorID" + - "provider" + - "reference" + - "createdAt" + - "updatedAt" + - "sourceAsset" + - "destinationAsset" + - "sourceAmount" + - "status" + properties: + id: + type: "string" + description: "Formance-assigned unique conversion ID." + connectorID: + type: "string" + format: "byte" + description: "ID of the Formance connector this conversion was fetched from." + provider: + type: "string" + description: "Provider name of the connector (e.g. `coinbaseprime`)." + reference: + type: "string" + description: "PSP-assigned conversion reference. Unique within the connector." + createdAt: + type: "string" + format: "date-time" + description: "When the conversion was initiated on the PSP." + updatedAt: + type: "string" + format: "date-time" + description: "When Formance last observed a state change on the conversion." + sourceAsset: + type: "string" + description: "Asset being converted from, in `SYMBOL/precision` form (e.g. `USD/2`)." + destinationAsset: + type: "string" + description: "Asset being converted to, in `SYMBOL/precision` form (e.g. `USDC/6`)." + sourceAmount: + type: "integer" + format: "bigint" + description: "Amount of source asset debited, as an integer at `sourceAsset` precision." + destinationAmount: + type: "integer" + format: "bigint" + nullable: true + description: "Amount of destination asset credited, at `destinationAsset` precision. Null until the conversion completes." + fee: + type: "integer" + format: "bigint" + nullable: true + description: "PSP fee for the conversion, at `feeAsset` precision." + feeAsset: + type: "string" + nullable: true + description: "Currency the fee is denominated in, in `SYMBOL/precision` form." + status: + $ref: "#/components/schemas/V3ConversionStatusEnum" + sourceAccountID: + type: "string" + nullable: true + description: "Formance account ID of the wallet the source asset was debited from." + destinationAccountID: + type: "string" + nullable: true + description: "Formance account ID of the wallet the destination asset was credited to." + metadata: + $ref: "#/components/schemas/V3Metadata" + error: + type: "string" + nullable: true + description: "Human-readable error from the PSP when `status` is `FAILED`. Null otherwise." + V3ConversionStatusEnum: + type: "string" + description: "Lifecycle of a conversion.\n`PENDING` — accepted by the PSP, not yet settled.\n`COMPLETED` — settled, terminal.\n`FAILED` — rejected or reverted, terminal. See `error`.\n" + enum: + - "UNKNOWN" + - "PENDING" + - "COMPLETED" + - "FAILED" V3InitiatePaymentRequest: type: "object" required: @@ -14581,6 +15074,16 @@ components: type: "string" ledger: type: "string" + throughAccount: + type: "string" + description: "Account used when this ledger account interacts with external systems (payments, cross-ledger).\n- As SOURCE going to payment: funds are sent to this account (e.g., \"liabilities:payouts-pending\")\n- As DESTINATION from payment: funds come from this account (e.g., \"assets:stripe:incoming\")\n- For cross-ledger transfers: replaces \"world\" on both sides\n" + default: "world" + example: "liabilities:payouts-pending" + allowOverdraft: + type: "boolean" + description: "Enables unbounded overdraft on the throughAccount when set to true.\nThis is useful when the throughAccount represents a liability or bridge account\nthat needs to go negative (e.g., \"liabilities:payouts-pending\").\nOnly applies when throughAccount is not \"world\" (which already has unbounded overdraft).\n" + default: false + example: true StageSendDestinationAccount: $ref: "#/components/schemas/StageSendSourceAccount" StageSendSourcePayment: @@ -14590,6 +15093,20 @@ components: properties: id: type: "string" + ledger: + type: "string" + description: "Ledger to use for payment ingestion.\nDefaults to the internal orchestration ledger.\n" + holdingAccount: + type: "string" + description: "Intermediate account where payment funds are held.\nDefaults to \"payment:{paymentID}\" format.\n" + throughAccount: + type: "string" + description: "Source account for the payment ingestion transaction.\nDefaults to \"world\".\n" + default: "world" + allowOverdraft: + type: "boolean" + description: "Enables unbounded overdraft on the throughAccount when set to true.\nOnly applies when throughAccount is not \"world\" (which already has unbounded overdraft).\n" + default: false StageSendDestinationPayment: type: "object" required: @@ -14597,6 +15114,19 @@ components: properties: psp: type: "string" + description: "Payment service provider name (e.g., stripe, wise, mangopay).\nValidated by the Payments service based on installed connectors.\n" + example: "stripe" + type: + type: "string" + description: "Type of transfer initiation:\n- TRANSFER: Internal to internal account transfer\n- PAYOUT: Internal to external account payout\n" + enum: + - "TRANSFER" + - "PAYOUT" + default: "TRANSFER" + example: "PAYOUT" + sourceAccount: + type: "string" + description: "Formance Payments account ID for the source (internal PSP account).\nIf not specified, the Payments service may use a default account for the connector.\n" StageSendSource: type: "object" properties: @@ -14699,6 +15229,51 @@ components: order_id: "6735" ActivityStripeTransfer: $ref: "#/components/schemas/StripeTransferRequest" + CreateTransferInitiationRequest: + type: "object" + properties: + connectorID: + type: "string" + provider: + type: "string" + description: "Payment service provider name (e.g., stripe, wise, mangopay).\nValidated by the Payments service based on installed connectors.\n" + example: "stripe" + amount: + type: "integer" + format: "bigint" + minimum: 0 + example: 100 + asset: + type: "string" + example: "USD" + destination: + type: "string" + description: "Destination account ID" + example: "acct_1Gqj58KZcSIg2N2q" + source: + type: "string" + description: "Source account ID (required for TRANSFER type)" + type: + type: "string" + description: "Type of transfer initiation:\n- TRANSFER: Internal to internal account transfer\n- PAYOUT: Internal to external account payout\n" + enum: + - "TRANSFER" + - "PAYOUT" + default: "TRANSFER" + description: + type: "string" + description: "Description for the transfer initiation" + waitingValidation: + type: "boolean" + example: false + default: false + metadata: + type: "object" + description: "A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format.\n" + example: + order_id: "6735" + ActivityCreateTransferInitiation: + $ref: "#/components/schemas/CreateTransferInitiationRequest" ActivityListWallets: type: "object" properties: @@ -15091,6 +15666,8 @@ components: $ref: "#/components/schemas/ActivityRevertTransaction" StripeTransfer: $ref: "#/components/schemas/ActivityStripeTransfer" + CreateTransferInitiation: + $ref: "#/components/schemas/ActivityCreateTransferInitiation" GetPayment: $ref: "#/components/schemas/ActivityGetPayment" ConfirmHold: @@ -15609,6 +16186,16 @@ components: type: "string" ledger: type: "string" + throughAccount: + type: "string" + description: "Account used when this ledger account interacts with external systems (payments, cross-ledger).\n- As SOURCE going to payment: funds are sent to this account (e.g., \"liabilities:payouts-pending\")\n- As DESTINATION from payment: funds come from this account (e.g., \"assets:stripe:incoming\")\n- For cross-ledger transfers: replaces \"world\" on both sides\n" + default: "world" + example: "liabilities:payouts-pending" + allowOverdraft: + type: "boolean" + description: "Enables unbounded overdraft on the throughAccount when set to true.\nThis is useful when the throughAccount represents a liability or bridge account\nthat needs to go negative (e.g., \"liabilities:payouts-pending\").\nOnly applies when throughAccount is not \"world\" (which already has unbounded overdraft).\n" + default: false + example: true V2StageSendDestinationAccount: $ref: "#/components/schemas/V2StageSendSourceAccount" V2StageSendSourcePayment: @@ -15618,6 +16205,20 @@ components: properties: id: type: "string" + ledger: + type: "string" + description: "Ledger to use for payment ingestion.\nDefaults to the internal orchestration ledger.\n" + holdingAccount: + type: "string" + description: "Intermediate account where payment funds are held.\nDefaults to \"payment:{paymentID}\" format.\n" + throughAccount: + type: "string" + description: "Source account for the payment ingestion transaction.\nDefaults to \"world\".\n" + default: "world" + allowOverdraft: + type: "boolean" + description: "Enables unbounded overdraft on the throughAccount when set to true.\nOnly applies when throughAccount is not \"world\" (which already has unbounded overdraft).\n" + default: false V2StageSendDestinationPayment: type: "object" required: @@ -15625,6 +16226,19 @@ components: properties: psp: type: "string" + description: "Payment service provider name (e.g., stripe, wise, mangopay).\nValidated by the Payments service based on installed connectors.\n" + example: "stripe" + type: + type: "string" + description: "Type of transfer initiation:\n- TRANSFER: Internal to internal account transfer\n- PAYOUT: Internal to external account payout\n" + enum: + - "TRANSFER" + - "PAYOUT" + default: "TRANSFER" + example: "PAYOUT" + sourceAccount: + type: "string" + description: "Formance Payments account ID for the source (internal PSP account).\nIf not specified, the Payments service may use a default account for the connector.\n" V2StageSendSource: type: "object" properties: @@ -15727,6 +16341,51 @@ components: order_id: "6735" V2ActivityStripeTransfer: $ref: "#/components/schemas/V2StripeTransferRequest" + V2CreateTransferInitiationRequest: + type: "object" + properties: + connectorID: + type: "string" + provider: + type: "string" + description: "Payment service provider name (e.g., stripe, wise, mangopay).\nValidated by the Payments service based on installed connectors.\n" + example: "stripe" + amount: + type: "integer" + format: "bigint" + minimum: 0 + example: 100 + asset: + type: "string" + example: "USD" + destination: + type: "string" + description: "Destination account ID" + example: "acct_1Gqj58KZcSIg2N2q" + source: + type: "string" + description: "Source account ID (required for TRANSFER type)" + type: + type: "string" + description: "Type of transfer initiation:\n- TRANSFER: Internal to internal account transfer\n- PAYOUT: Internal to external account payout\n" + enum: + - "TRANSFER" + - "PAYOUT" + default: "TRANSFER" + description: + type: "string" + description: "Description for the transfer initiation" + waitingValidation: + type: "boolean" + example: false + default: false + metadata: + type: "object" + description: "A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format.\n" + example: + order_id: "6735" + V2ActivityCreateTransferInitiation: + $ref: "#/components/schemas/V2CreateTransferInitiationRequest" V2ActivityListWallets: type: "object" properties: @@ -16239,6 +16898,8 @@ components: $ref: "#/components/schemas/V2ActivityCreateTransaction" StripeTransfer: $ref: "#/components/schemas/V2ActivityStripeTransfer" + CreateTransferInitiation: + $ref: "#/components/schemas/V2ActivityCreateTransferInitiation" GetPayment: $ref: "#/components/schemas/V2ActivityGetPayment" ConfirmHold: @@ -16968,6 +17629,20 @@ components: description: "The task ID" schema: type: "string" + V3OrderID: + name: "orderID" + in: "path" + required: true + description: "The order ID" + schema: + type: "string" + V3ConversionID: + name: "conversionID" + in: "path" + required: true + description: "The conversion ID" + schema: + type: "string" V3Connector: name: "connector" in: "path" diff --git a/openapi/flows/openapi.yaml b/openapi/flows/openapi.yaml index cda6974..a3afab3 100644 --- a/openapi/flows/openapi.yaml +++ b/openapi/flows/openapi.yaml @@ -1261,6 +1261,24 @@ components: type: string ledger: type: string + throughAccount: + type: string + description: | + Account used when this ledger account interacts with external systems (payments, cross-ledger). + - As SOURCE going to payment: funds are sent to this account (e.g., "liabilities:payouts-pending") + - As DESTINATION from payment: funds come from this account (e.g., "assets:stripe:incoming") + - For cross-ledger transfers: replaces "world" on both sides + default: world + example: liabilities:payouts-pending + allowOverdraft: + type: boolean + description: | + Enables unbounded overdraft on the throughAccount when set to true. + This is useful when the throughAccount represents a liability or bridge account + that needs to go negative (e.g., "liabilities:payouts-pending"). + Only applies when throughAccount is not "world" (which already has unbounded overdraft). + default: false + example: true StageSendDestinationAccount: $ref: '#/components/schemas/StageSendSourceAccount' StageSendSourcePayment: @@ -1270,6 +1288,28 @@ components: properties: id: type: string + ledger: + type: string + description: | + Ledger to use for payment ingestion. + Defaults to the internal orchestration ledger. + holdingAccount: + type: string + description: | + Intermediate account where payment funds are held. + Defaults to "payment:{paymentID}" format. + throughAccount: + type: string + description: | + Source account for the payment ingestion transaction. + Defaults to "world". + default: world + allowOverdraft: + type: boolean + description: | + Enables unbounded overdraft on the throughAccount when set to true. + Only applies when throughAccount is not "world" (which already has unbounded overdraft). + default: false StageSendDestinationPayment: type: object required: @@ -1277,6 +1317,26 @@ components: properties: psp: type: string + description: | + Payment service provider name (e.g., stripe, wise, mangopay). + Validated by the Payments service based on installed connectors. + example: stripe + type: + type: string + description: | + Type of transfer initiation: + - TRANSFER: Internal to internal account transfer + - PAYOUT: Internal to external account payout + enum: + - TRANSFER + - PAYOUT + default: TRANSFER + example: PAYOUT + sourceAccount: + type: string + description: | + Formance Payments account ID for the source (internal PSP account). + If not specified, the Payments service may use a default account for the connector. StageSendSource: type: object properties: @@ -1383,6 +1443,58 @@ components: order_id: '6735' ActivityStripeTransfer: $ref: '#/components/schemas/StripeTransferRequest' + CreateTransferInitiationRequest: + type: object + properties: + connectorID: + type: string + provider: + type: string + description: | + Payment service provider name (e.g., stripe, wise, mangopay). + Validated by the Payments service based on installed connectors. + example: stripe + amount: + type: integer + format: bigint + minimum: 0 + example: 100 + asset: + type: string + example: USD + destination: + type: string + description: Destination account ID + example: acct_1Gqj58KZcSIg2N2q + source: + type: string + description: Source account ID (required for TRANSFER type) + type: + type: string + description: | + Type of transfer initiation: + - TRANSFER: Internal to internal account transfer + - PAYOUT: Internal to external account payout + enum: + - TRANSFER + - PAYOUT + default: TRANSFER + description: + type: string + description: Description for the transfer initiation + waitingValidation: + type: boolean + example: false + default: false + metadata: + type: object + description: > + A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format. + + example: + order_id: '6735' + ActivityCreateTransferInitiation: + $ref: '#/components/schemas/CreateTransferInitiationRequest' ActivityListWallets: type: object properties: @@ -1913,6 +2025,8 @@ components: $ref: '#/components/schemas/ActivityRevertTransaction' StripeTransfer: $ref: '#/components/schemas/ActivityStripeTransfer' + CreateTransferInitiation: + $ref: '#/components/schemas/ActivityCreateTransferInitiation' GetPayment: $ref: '#/components/schemas/ActivityGetPayment' ConfirmHold: @@ -2498,6 +2612,24 @@ components: type: string ledger: type: string + throughAccount: + type: string + description: | + Account used when this ledger account interacts with external systems (payments, cross-ledger). + - As SOURCE going to payment: funds are sent to this account (e.g., "liabilities:payouts-pending") + - As DESTINATION from payment: funds come from this account (e.g., "assets:stripe:incoming") + - For cross-ledger transfers: replaces "world" on both sides + default: world + example: liabilities:payouts-pending + allowOverdraft: + type: boolean + description: | + Enables unbounded overdraft on the throughAccount when set to true. + This is useful when the throughAccount represents a liability or bridge account + that needs to go negative (e.g., "liabilities:payouts-pending"). + Only applies when throughAccount is not "world" (which already has unbounded overdraft). + default: false + example: true V2StageSendDestinationAccount: $ref: '#/components/schemas/V2StageSendSourceAccount' V2StageSendSourcePayment: @@ -2507,6 +2639,28 @@ components: properties: id: type: string + ledger: + type: string + description: | + Ledger to use for payment ingestion. + Defaults to the internal orchestration ledger. + holdingAccount: + type: string + description: | + Intermediate account where payment funds are held. + Defaults to "payment:{paymentID}" format. + throughAccount: + type: string + description: | + Source account for the payment ingestion transaction. + Defaults to "world". + default: world + allowOverdraft: + type: boolean + description: | + Enables unbounded overdraft on the throughAccount when set to true. + Only applies when throughAccount is not "world" (which already has unbounded overdraft). + default: false V2StageSendDestinationPayment: type: object required: @@ -2514,6 +2668,26 @@ components: properties: psp: type: string + description: | + Payment service provider name (e.g., stripe, wise, mangopay). + Validated by the Payments service based on installed connectors. + example: stripe + type: + type: string + description: | + Type of transfer initiation: + - TRANSFER: Internal to internal account transfer + - PAYOUT: Internal to external account payout + enum: + - TRANSFER + - PAYOUT + default: TRANSFER + example: PAYOUT + sourceAccount: + type: string + description: | + Formance Payments account ID for the source (internal PSP account). + If not specified, the Payments service may use a default account for the connector. V2StageSendSource: type: object properties: @@ -2620,6 +2794,58 @@ components: order_id: '6735' V2ActivityStripeTransfer: $ref: '#/components/schemas/V2StripeTransferRequest' + V2CreateTransferInitiationRequest: + type: object + properties: + connectorID: + type: string + provider: + type: string + description: | + Payment service provider name (e.g., stripe, wise, mangopay). + Validated by the Payments service based on installed connectors. + example: stripe + amount: + type: integer + format: bigint + minimum: 0 + example: 100 + asset: + type: string + example: USD + destination: + type: string + description: Destination account ID + example: acct_1Gqj58KZcSIg2N2q + source: + type: string + description: Source account ID (required for TRANSFER type) + type: + type: string + description: | + Type of transfer initiation: + - TRANSFER: Internal to internal account transfer + - PAYOUT: Internal to external account payout + enum: + - TRANSFER + - PAYOUT + default: TRANSFER + description: + type: string + description: Description for the transfer initiation + waitingValidation: + type: boolean + example: false + default: false + metadata: + type: object + description: > + A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format. + + example: + order_id: '6735' + V2ActivityCreateTransferInitiation: + $ref: '#/components/schemas/V2CreateTransferInitiationRequest' V2ActivityListWallets: type: object properties: @@ -3133,6 +3359,8 @@ components: $ref: '#/components/schemas/V2ActivityCreateTransaction' StripeTransfer: $ref: '#/components/schemas/V2ActivityStripeTransfer' + CreateTransferInitiation: + $ref: '#/components/schemas/V2ActivityCreateTransferInitiation' GetPayment: $ref: '#/components/schemas/V2ActivityGetPayment' ConfirmHold: diff --git a/openapi/generate.json b/openapi/generate.json index dc0442b..fe8ca3a 100644 --- a/openapi/generate.json +++ b/openapi/generate.json @@ -7626,6 +7626,210 @@ ] } }, + "/api/payments/v3/orders": { + "get": { + "tags": [ + "payments.v3" + ], + "summary": "List orders ingested from exchange-style connectors", + "description": "Returns the full list of orders ingested by Formance from connectors\nthat implement the orders capability (e.g. `coinbaseprime`). Orders\nrepresent trade placements on an exchange-style PSP and are\n**read-only** through the Formance API — submission, cancellation,\nand lifecycle transitions are owned by the underlying connector.\n\nResults are cursor-paginated. The optional request body accepts a\nquery builder for filtering over top-level `V3Order` fields such as\n`connectorID`, `reference`, `direction`, `status`, `type`,\n`sourceAsset`, `destinationAsset`, and `createdAt`.\n\nSee `V3Order` for the full response shape, including the\n`adjustments` array that captures each observed state transition on\nthe exchange.\n", + "operationId": "v3ListOrders", + "x-speakeasy-name-override": "ListOrders", + "parameters": [ + { + "$ref": "#/components/parameters/V3PageSize" + }, + { + "$ref": "#/components/parameters/V3Cursor" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V3QueryBuilder" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V3OrdersCursorResponse" + } + } + } + }, + "default": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V3ErrorResponse" + } + } + } + } + }, + "security": [ + { + "Authorization": [ + "payments:read" + ] + } + ] + } + }, + "/api/payments/v3/orders/{orderID}": { + "get": { + "tags": [ + "payments.v3" + ], + "summary": "Get a single order by its Formance ID", + "description": "Returns one order identified by its Formance-assigned `id` (composed\nfrom the PSP `reference` and the connector ID — **not** the PSP's\nnative reference). The response includes the full `adjustments`\nhistory ordered from oldest to most recent; the last adjustment\nreflects the order's current top-level `status`.\n\nReturns an error via `V3ErrorResponse` when no order exists for the\ngiven ID, or when the ID cannot be decoded.\n", + "operationId": "v3GetOrder", + "x-speakeasy-name-override": "GetOrder", + "parameters": [ + { + "$ref": "#/components/parameters/V3OrderID" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V3GetOrderResponse" + } + } + } + }, + "default": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V3ErrorResponse" + } + } + } + } + }, + "security": [ + { + "Authorization": [ + "payments:read" + ] + } + ] + } + }, + "/api/payments/v3/conversions": { + "get": { + "tags": [ + "payments.v3" + ], + "summary": "List currency and asset conversions ingested from connectors", + "description": "Returns the full list of conversions ingested by Formance from\nconnectors that implement the conversions capability. A conversion\nis a direct swap between two assets on a PSP (e.g. USD → USDC on\nCoinbase Prime). Conversions are **read-only** through the Formance\nAPI.\n\nUnlike orders, conversions do not carry an adjustment history —\nFormance records only the final observed state (`status`,\n`destinationAmount`, and `fee` when settled).\n\nResults are cursor-paginated. The optional request body accepts a\nquery builder for filtering over top-level `V3Conversion` fields\nsuch as `connectorID`, `reference`, `status`, `sourceAsset`,\n`destinationAsset`, and `createdAt`.\n", + "operationId": "v3ListConversions", + "x-speakeasy-name-override": "ListConversions", + "parameters": [ + { + "$ref": "#/components/parameters/V3PageSize" + }, + { + "$ref": "#/components/parameters/V3Cursor" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V3QueryBuilder" + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V3ConversionsCursorResponse" + } + } + } + }, + "default": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V3ErrorResponse" + } + } + } + } + }, + "security": [ + { + "Authorization": [ + "payments:read" + ] + } + ] + } + }, + "/api/payments/v3/conversions/{conversionID}": { + "get": { + "tags": [ + "payments.v3" + ], + "summary": "Get a single conversion by its Formance ID", + "description": "Returns one conversion identified by its Formance-assigned `id`\n(**not** the PSP's native `reference`). See `V3Conversion` for the\nresponse shape — on `COMPLETED` status the `destinationAmount` and\n`fee` fields reflect the settled values; on `FAILED` the `error`\nfield carries the PSP's rejection reason.\n\nReturns an error via `V3ErrorResponse` when no conversion exists\nfor the given ID.\n", + "operationId": "v3GetConversion", + "x-speakeasy-name-override": "GetConversion", + "parameters": [ + { + "$ref": "#/components/parameters/V3ConversionID" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V3GetConversionResponse" + } + } + } + }, + "default": { + "description": "Error", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/V3ErrorResponse" + } + } + } + } + }, + "security": [ + { + "Authorization": [ + "payments:read" + ] + } + ] + } + }, "/api/payments/v3/payments": { "post": { "tags": [ @@ -19164,37 +19368,517 @@ "OTHER" ] }, - "V3InitiatePaymentRequest": { + "V3OrdersCursorResponse": { "type": "object", "required": [ - "reference", - "scheduledAt", + "cursor" + ], + "properties": { + "cursor": { + "type": "object", + "required": [ + "pageSize", + "hasMore", + "data" + ], + "properties": { + "pageSize": { + "type": "integer", + "format": "int64", + "minimum": 1, + "example": 15 + }, + "hasMore": { + "type": "boolean", + "example": false + }, + "previous": { + "type": "string", + "example": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + }, + "next": { + "type": "string", + "example": "" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V3Order" + } + } + } + } + } + }, + "V3GetOrderResponse": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/components/schemas/V3Order" + } + } + }, + "V3Order": { + "type": "object", + "description": "A trade order submitted to an exchange-style PSP. Orders are read-only\nin the Formance API: they are fetched from the underlying connector.\nStatus transitions are captured via the `adjustments` array; each\nadjustment is a point-in-time snapshot from the PSP.\n", + "required": [ + "id", "connectorID", - "description", + "provider", + "reference", + "createdAt", + "updatedAt", + "direction", + "sourceAsset", + "destinationAsset", "type", - "amount", - "asset" + "status", + "baseQuantityOrdered", + "timeInForce" ], "properties": { - "reference": { - "type": "string", - "minLength": 3, - "maxLength": 1000 - }, - "scheduledAt": { + "id": { "type": "string", - "format": "date-time" + "description": "Formance-assigned unique order ID (composed from the PSP reference and connector ID)." }, "connectorID": { "type": "string", - "format": "byte" + "format": "byte", + "description": "ID of the Formance connector this order was fetched from." }, - "description": { + "provider": { "type": "string", - "maxLength": 10000 + "description": "Provider name of the connector (e.g. `coinbaseprime`)." }, - "type": { - "$ref": "#/components/schemas/V3PaymentInitiationTypeEnum" + "reference": { + "type": "string", + "description": "PSP-assigned order reference. Unique within the connector; used as the storage dedup key." + }, + "clientOrderID": { + "type": "string", + "nullable": true, + "description": "Client-assigned ID supplied to the PSP for placement idempotency\n(e.g. Coinbase `client_order_id`, Kraken `cl_ord_id`, Binance\n`clientOrderId`). Stored for traceability only — Formance does\nNOT dedup on this field.\n" + }, + "createdAt": { + "type": "string", + "format": "date-time", + "description": "When the order was created on the PSP." + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "description": "When Formance last observed a state change on the order. Equivalent to the latest adjustment's `createdAt`." + }, + "direction": { + "$ref": "#/components/schemas/V3OrderDirectionEnum" + }, + "sourceAsset": { + "type": "string", + "description": "Asset being spent, in `SYMBOL/precision` form (e.g. `USD/2`,\n`BTC/8`). For BUY: the quote currency. For SELL: the base\ncurrency.\n" + }, + "destinationAsset": { + "type": "string", + "description": "Asset being received, in `SYMBOL/precision` form.\nFor BUY: the base currency. For SELL: the quote currency.\n" + }, + "type": { + "$ref": "#/components/schemas/V3OrderTypeEnum" + }, + "status": { + "$ref": "#/components/schemas/V3OrderStatusEnum" + }, + "baseQuantityOrdered": { + "type": "integer", + "format": "bigint", + "description": "Amount of base asset the order was placed for, as an integer at the base asset's precision." + }, + "baseQuantityFilled": { + "type": "integer", + "format": "bigint", + "nullable": true, + "description": "Amount of base asset filled so far, as an integer at the base asset's precision. Null before any fill." + }, + "limitPrice": { + "type": "integer", + "format": "bigint", + "nullable": true, + "description": "Maximum price (for BUY) or minimum price (for SELL) at which the order may execute, in `priceAsset` precision. Required for LIMIT-family order types; null otherwise." + }, + "stopPrice": { + "type": "integer", + "format": "bigint", + "nullable": true, + "description": "Trigger price at which a STOP / STOP_LIMIT order activates, in `priceAsset` precision. Null for non-stop order types." + }, + "timeInForce": { + "$ref": "#/components/schemas/V3TimeInForceEnum" + }, + "expiresAt": { + "type": "string", + "format": "date-time", + "nullable": true, + "description": "Expiration instant for `GOOD_UNTIL_DATE_TIME` orders. Null for other time-in-force values." + }, + "fee": { + "type": "integer", + "format": "bigint", + "nullable": true, + "description": "Commission charged by the PSP for the order, as an integer in `feeAsset` precision." + }, + "feeAsset": { + "type": "string", + "nullable": true, + "description": "Currency the fee is denominated in, in `SYMBOL/precision` form. Typically the quote asset." + }, + "averageFillPrice": { + "type": "integer", + "format": "bigint", + "nullable": true, + "description": "Volume-weighted average price across all fills so far, in `priceAsset` precision. Analytics field — may be absent if the PSP does not report it." + }, + "quoteAmount": { + "type": "integer", + "format": "bigint", + "nullable": true, + "description": "Total amount of quote currency exchanged so far, as reported by\nthe PSP (e.g. Coinbase `filled_value`), at `quoteAsset`\nprecision. For BUY: amount spent. For SELL: amount received.\n" + }, + "quoteAsset": { + "type": "string", + "nullable": true, + "description": "Quote currency with precision (e.g. `USD/2`). Null when the order has no quote-side amounts reported yet." + }, + "priceAsset": { + "type": "string", + "nullable": true, + "description": "Currency + precision under which `limitPrice`, `stopPrice`, and\n`averageFillPrice` should be interpreted. Separate from\n`quoteAsset` because some PSPs return price strings with more\ndecimal digits than the quote currency's natural precision.\n" + }, + "sourceAccountID": { + "type": "string", + "nullable": true, + "description": "Formance account ID of the wallet the source asset was debited\nfrom. Null if the PSP did not return enough information to\nresolve it at ingestion time.\n" + }, + "destinationAccountID": { + "type": "string", + "nullable": true, + "description": "Formance account ID of the wallet the destination asset was credited to. Null if unresolvable." + }, + "metadata": { + "$ref": "#/components/schemas/V3Metadata" + }, + "adjustments": { + "type": "array", + "nullable": true, + "items": { + "$ref": "#/components/schemas/V3OrderAdjustment" + }, + "description": "Ordered history of state snapshots for this order. The most recent element reflects the current `status`." + }, + "error": { + "type": "string", + "nullable": true, + "description": "Human-readable error from the PSP (e.g. rejection reason) when `status` is `FAILED`. Null otherwise." + } + } + }, + "V3OrderAdjustment": { + "type": "object", + "description": "Immutable snapshot of an order's state at a single observation.\nFormance records one adjustment per distinct state the PSP reports\n(status change, fill progress, fee update). Events are emitted\nper-adjustment, not per-order — so a single order can produce many\nevents over its lifetime.\n", + "required": [ + "id", + "reference", + "createdAt", + "status" + ], + "properties": { + "id": { + "type": "string", + "description": "Adjustment ID, composed from the order ID plus the state fields that define uniqueness (status, filled quantity, fee). Idempotent — replaying the same observation produces the same ID." + }, + "reference": { + "type": "string", + "description": "PSP reference the adjustment belongs to (equal to the parent order's `reference`)." + }, + "createdAt": { + "type": "string", + "format": "date-time", + "description": "When Formance observed this state. Not the PSP's own timestamp — reflects ingestion time." + }, + "status": { + "$ref": "#/components/schemas/V3OrderStatusEnum" + }, + "baseQuantityFilled": { + "type": "integer", + "format": "bigint", + "nullable": true, + "description": "Base asset filled at this observation, at the base asset's precision." + }, + "fee": { + "type": "integer", + "format": "bigint", + "nullable": true, + "description": "Cumulative fee at this observation, at `feeAsset` precision." + }, + "feeAsset": { + "type": "string", + "nullable": true, + "description": "Currency the fee is denominated in, in `SYMBOL/precision` form." + }, + "metadata": { + "$ref": "#/components/schemas/V3Metadata" + }, + "raw": { + "type": "object", + "description": "Untransformed PSP response payload that produced this adjustment. Retained for debugging and replay." + } + } + }, + "V3OrderDirectionEnum": { + "type": "string", + "description": "Whether an order buys or sells the base asset.", + "enum": [ + "UNKNOWN", + "BUY", + "SELL" + ] + }, + "V3OrderTypeEnum": { + "type": "string", + "description": "Exchange order type. Determines which price fields are meaningful on\n`V3Order`: LIMIT-family types use `limitPrice`; STOP-family types use\n`stopPrice`; TWAP/VWAP are time-weighted execution algorithms.\n", + "enum": [ + "UNKNOWN", + "MARKET", + "LIMIT", + "STOP_LIMIT", + "STOP", + "TWAP", + "VWAP", + "PEG", + "BLOCK", + "RFQ", + "TRAILING_STOP", + "TRAILING_STOP_LIMIT", + "TAKE_PROFIT", + "TAKE_PROFIT_LIMIT", + "LIMIT_MAKER" + ] + }, + "V3OrderStatusEnum": { + "type": "string", + "description": "Lifecycle of an order on the exchange.\n`PENDING` — accepted by the exchange, not yet working.\n`OPEN` — live on the book, no fills yet.\n`PARTIALLY_FILLED` — live on the book, some base quantity filled.\n`FILLED` — fully filled, terminal.\n`CANCELLED` — cancelled by the user or system, terminal.\n`FAILED` — rejected by the exchange, terminal. See `error` for details.\n`EXPIRED` — `timeInForce` elapsed before full fill, terminal.\n", + "enum": [ + "UNKNOWN", + "PENDING", + "OPEN", + "PARTIALLY_FILLED", + "FILLED", + "CANCELLED", + "FAILED", + "EXPIRED" + ] + }, + "V3TimeInForceEnum": { + "type": "string", + "description": "How long an order is valid on the exchange.\n`GOOD_UNTIL_CANCELLED` — rests until explicitly cancelled.\n`GOOD_UNTIL_DATE_TIME` — rests until `expiresAt`.\n`IMMEDIATE_OR_CANCEL` — fill immediately, cancel any unfilled portion.\n`FILL_OR_KILL` — fill fully and immediately, or cancel entirely.\n", + "enum": [ + "UNKNOWN", + "GOOD_UNTIL_CANCELLED", + "GOOD_UNTIL_DATE_TIME", + "IMMEDIATE_OR_CANCEL", + "FILL_OR_KILL" + ] + }, + "V3ConversionsCursorResponse": { + "type": "object", + "required": [ + "cursor" + ], + "properties": { + "cursor": { + "type": "object", + "required": [ + "pageSize", + "hasMore", + "data" + ], + "properties": { + "pageSize": { + "type": "integer", + "format": "int64", + "minimum": 1, + "example": 15 + }, + "hasMore": { + "type": "boolean", + "example": false + }, + "previous": { + "type": "string", + "example": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol=" + }, + "next": { + "type": "string", + "example": "" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/V3Conversion" + } + } + } + } + } + }, + "V3GetConversionResponse": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "$ref": "#/components/schemas/V3Conversion" + } + } + }, + "V3Conversion": { + "type": "object", + "description": "A currency or asset conversion executed on a PSP (e.g. Coinbase Prime\ntransfer between a USD and USDC wallet). Conversions are read-only in\nthe Formance API: they are fetched from the underlying connector.\nUnlike orders, conversions do not carry an adjustment history —\nFormance records the final state only.\n", + "required": [ + "id", + "connectorID", + "provider", + "reference", + "createdAt", + "updatedAt", + "sourceAsset", + "destinationAsset", + "sourceAmount", + "status" + ], + "properties": { + "id": { + "type": "string", + "description": "Formance-assigned unique conversion ID." + }, + "connectorID": { + "type": "string", + "format": "byte", + "description": "ID of the Formance connector this conversion was fetched from." + }, + "provider": { + "type": "string", + "description": "Provider name of the connector (e.g. `coinbaseprime`)." + }, + "reference": { + "type": "string", + "description": "PSP-assigned conversion reference. Unique within the connector." + }, + "createdAt": { + "type": "string", + "format": "date-time", + "description": "When the conversion was initiated on the PSP." + }, + "updatedAt": { + "type": "string", + "format": "date-time", + "description": "When Formance last observed a state change on the conversion." + }, + "sourceAsset": { + "type": "string", + "description": "Asset being converted from, in `SYMBOL/precision` form (e.g. `USD/2`)." + }, + "destinationAsset": { + "type": "string", + "description": "Asset being converted to, in `SYMBOL/precision` form (e.g. `USDC/6`)." + }, + "sourceAmount": { + "type": "integer", + "format": "bigint", + "description": "Amount of source asset debited, as an integer at `sourceAsset` precision." + }, + "destinationAmount": { + "type": "integer", + "format": "bigint", + "nullable": true, + "description": "Amount of destination asset credited, at `destinationAsset` precision. Null until the conversion completes." + }, + "fee": { + "type": "integer", + "format": "bigint", + "nullable": true, + "description": "PSP fee for the conversion, at `feeAsset` precision." + }, + "feeAsset": { + "type": "string", + "nullable": true, + "description": "Currency the fee is denominated in, in `SYMBOL/precision` form." + }, + "status": { + "$ref": "#/components/schemas/V3ConversionStatusEnum" + }, + "sourceAccountID": { + "type": "string", + "nullable": true, + "description": "Formance account ID of the wallet the source asset was debited from." + }, + "destinationAccountID": { + "type": "string", + "nullable": true, + "description": "Formance account ID of the wallet the destination asset was credited to." + }, + "metadata": { + "$ref": "#/components/schemas/V3Metadata" + }, + "error": { + "type": "string", + "nullable": true, + "description": "Human-readable error from the PSP when `status` is `FAILED`. Null otherwise." + } + } + }, + "V3ConversionStatusEnum": { + "type": "string", + "description": "Lifecycle of a conversion.\n`PENDING` — accepted by the PSP, not yet settled.\n`COMPLETED` — settled, terminal.\n`FAILED` — rejected or reverted, terminal. See `error`.\n", + "enum": [ + "UNKNOWN", + "PENDING", + "COMPLETED", + "FAILED" + ] + }, + "V3InitiatePaymentRequest": { + "type": "object", + "required": [ + "reference", + "scheduledAt", + "connectorID", + "description", + "type", + "amount", + "asset" + ], + "properties": { + "reference": { + "type": "string", + "minLength": 3, + "maxLength": 1000 + }, + "scheduledAt": { + "type": "string", + "format": "date-time" + }, + "connectorID": { + "type": "string", + "format": "byte" + }, + "description": { + "type": "string", + "maxLength": 10000 + }, + "type": { + "$ref": "#/components/schemas/V3PaymentInitiationTypeEnum" }, "amount": { "type": "integer", @@ -22794,6 +23478,18 @@ }, "ledger": { "type": "string" + }, + "throughAccount": { + "type": "string", + "description": "Account used when this ledger account interacts with external systems (payments, cross-ledger).\n- As SOURCE going to payment: funds are sent to this account (e.g., \"liabilities:payouts-pending\")\n- As DESTINATION from payment: funds come from this account (e.g., \"assets:stripe:incoming\")\n- For cross-ledger transfers: replaces \"world\" on both sides\n", + "default": "world", + "example": "liabilities:payouts-pending" + }, + "allowOverdraft": { + "type": "boolean", + "description": "Enables unbounded overdraft on the throughAccount when set to true.\nThis is useful when the throughAccount represents a liability or bridge account\nthat needs to go negative (e.g., \"liabilities:payouts-pending\").\nOnly applies when throughAccount is not \"world\" (which already has unbounded overdraft).\n", + "default": false, + "example": true } } }, @@ -22808,6 +23504,24 @@ "properties": { "id": { "type": "string" + }, + "ledger": { + "type": "string", + "description": "Ledger to use for payment ingestion.\nDefaults to the internal orchestration ledger.\n" + }, + "holdingAccount": { + "type": "string", + "description": "Intermediate account where payment funds are held.\nDefaults to \"payment:{paymentID}\" format.\n" + }, + "throughAccount": { + "type": "string", + "description": "Source account for the payment ingestion transaction.\nDefaults to \"world\".\n", + "default": "world" + }, + "allowOverdraft": { + "type": "boolean", + "description": "Enables unbounded overdraft on the throughAccount when set to true.\nOnly applies when throughAccount is not \"world\" (which already has unbounded overdraft).\n", + "default": false } } }, @@ -22818,7 +23532,23 @@ ], "properties": { "psp": { - "type": "string" + "type": "string", + "description": "Payment service provider name (e.g., stripe, wise, mangopay).\nValidated by the Payments service based on installed connectors.\n", + "example": "stripe" + }, + "type": { + "type": "string", + "description": "Type of transfer initiation:\n- TRANSFER: Internal to internal account transfer\n- PAYOUT: Internal to external account payout\n", + "enum": [ + "TRANSFER", + "PAYOUT" + ], + "default": "TRANSFER", + "example": "PAYOUT" + }, + "sourceAccount": { + "type": "string", + "description": "Formance Payments account ID for the source (internal PSP account).\nIf not specified, the Payments service may use a default account for the connector.\n" } } }, @@ -22980,6 +23710,66 @@ "ActivityStripeTransfer": { "$ref": "#/components/schemas/StripeTransferRequest" }, + "CreateTransferInitiationRequest": { + "type": "object", + "properties": { + "connectorID": { + "type": "string" + }, + "provider": { + "type": "string", + "description": "Payment service provider name (e.g., stripe, wise, mangopay).\nValidated by the Payments service based on installed connectors.\n", + "example": "stripe" + }, + "amount": { + "type": "integer", + "format": "bigint", + "minimum": 0, + "example": 100 + }, + "asset": { + "type": "string", + "example": "USD" + }, + "destination": { + "type": "string", + "description": "Destination account ID", + "example": "acct_1Gqj58KZcSIg2N2q" + }, + "source": { + "type": "string", + "description": "Source account ID (required for TRANSFER type)" + }, + "type": { + "type": "string", + "description": "Type of transfer initiation:\n- TRANSFER: Internal to internal account transfer\n- PAYOUT: Internal to external account payout\n", + "enum": [ + "TRANSFER", + "PAYOUT" + ], + "default": "TRANSFER" + }, + "description": { + "type": "string", + "description": "Description for the transfer initiation" + }, + "waitingValidation": { + "type": "boolean", + "example": false, + "default": false + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format.\n", + "example": { + "order_id": "6735" + } + } + } + }, + "ActivityCreateTransferInitiation": { + "$ref": "#/components/schemas/CreateTransferInitiationRequest" + }, "ActivityListWallets": { "type": "object", "properties": { @@ -23535,6 +24325,9 @@ "StripeTransfer": { "$ref": "#/components/schemas/ActivityStripeTransfer" }, + "CreateTransferInitiation": { + "$ref": "#/components/schemas/ActivityCreateTransferInitiation" + }, "GetPayment": { "$ref": "#/components/schemas/ActivityGetPayment" }, @@ -24290,6 +25083,18 @@ }, "ledger": { "type": "string" + }, + "throughAccount": { + "type": "string", + "description": "Account used when this ledger account interacts with external systems (payments, cross-ledger).\n- As SOURCE going to payment: funds are sent to this account (e.g., \"liabilities:payouts-pending\")\n- As DESTINATION from payment: funds come from this account (e.g., \"assets:stripe:incoming\")\n- For cross-ledger transfers: replaces \"world\" on both sides\n", + "default": "world", + "example": "liabilities:payouts-pending" + }, + "allowOverdraft": { + "type": "boolean", + "description": "Enables unbounded overdraft on the throughAccount when set to true.\nThis is useful when the throughAccount represents a liability or bridge account\nthat needs to go negative (e.g., \"liabilities:payouts-pending\").\nOnly applies when throughAccount is not \"world\" (which already has unbounded overdraft).\n", + "default": false, + "example": true } } }, @@ -24304,6 +25109,24 @@ "properties": { "id": { "type": "string" + }, + "ledger": { + "type": "string", + "description": "Ledger to use for payment ingestion.\nDefaults to the internal orchestration ledger.\n" + }, + "holdingAccount": { + "type": "string", + "description": "Intermediate account where payment funds are held.\nDefaults to \"payment:{paymentID}\" format.\n" + }, + "throughAccount": { + "type": "string", + "description": "Source account for the payment ingestion transaction.\nDefaults to \"world\".\n", + "default": "world" + }, + "allowOverdraft": { + "type": "boolean", + "description": "Enables unbounded overdraft on the throughAccount when set to true.\nOnly applies when throughAccount is not \"world\" (which already has unbounded overdraft).\n", + "default": false } } }, @@ -24314,7 +25137,23 @@ ], "properties": { "psp": { - "type": "string" + "type": "string", + "description": "Payment service provider name (e.g., stripe, wise, mangopay).\nValidated by the Payments service based on installed connectors.\n", + "example": "stripe" + }, + "type": { + "type": "string", + "description": "Type of transfer initiation:\n- TRANSFER: Internal to internal account transfer\n- PAYOUT: Internal to external account payout\n", + "enum": [ + "TRANSFER", + "PAYOUT" + ], + "default": "TRANSFER", + "example": "PAYOUT" + }, + "sourceAccount": { + "type": "string", + "description": "Formance Payments account ID for the source (internal PSP account).\nIf not specified, the Payments service may use a default account for the connector.\n" } } }, @@ -24476,6 +25315,66 @@ "V2ActivityStripeTransfer": { "$ref": "#/components/schemas/V2StripeTransferRequest" }, + "V2CreateTransferInitiationRequest": { + "type": "object", + "properties": { + "connectorID": { + "type": "string" + }, + "provider": { + "type": "string", + "description": "Payment service provider name (e.g., stripe, wise, mangopay).\nValidated by the Payments service based on installed connectors.\n", + "example": "stripe" + }, + "amount": { + "type": "integer", + "format": "bigint", + "minimum": 0, + "example": 100 + }, + "asset": { + "type": "string", + "example": "USD" + }, + "destination": { + "type": "string", + "description": "Destination account ID", + "example": "acct_1Gqj58KZcSIg2N2q" + }, + "source": { + "type": "string", + "description": "Source account ID (required for TRANSFER type)" + }, + "type": { + "type": "string", + "description": "Type of transfer initiation:\n- TRANSFER: Internal to internal account transfer\n- PAYOUT: Internal to external account payout\n", + "enum": [ + "TRANSFER", + "PAYOUT" + ], + "default": "TRANSFER" + }, + "description": { + "type": "string", + "description": "Description for the transfer initiation" + }, + "waitingValidation": { + "type": "boolean", + "example": false, + "default": false + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format.\n", + "example": { + "order_id": "6735" + } + } + } + }, + "V2ActivityCreateTransferInitiation": { + "$ref": "#/components/schemas/V2CreateTransferInitiationRequest" + }, "V2ActivityListWallets": { "type": "object", "properties": { @@ -25206,6 +26105,9 @@ "StripeTransfer": { "$ref": "#/components/schemas/V2ActivityStripeTransfer" }, + "CreateTransferInitiation": { + "$ref": "#/components/schemas/V2ActivityCreateTransferInitiation" + }, "GetPayment": { "$ref": "#/components/schemas/V2ActivityGetPayment" }, @@ -26285,6 +27187,24 @@ "type": "string" } }, + "V3OrderID": { + "name": "orderID", + "in": "path", + "required": true, + "description": "The order ID", + "schema": { + "type": "string" + } + }, + "V3ConversionID": { + "name": "conversionID", + "in": "path", + "required": true, + "description": "The conversion ID", + "schema": { + "type": "string" + } + }, "V3Connector": { "name": "connector", "in": "path", diff --git a/openapi/payments/openapi.yaml b/openapi/payments/openapi.yaml index 9cade36..7ea4b09 100644 --- a/openapi/payments/openapi.yaml +++ b/openapi/payments/openapi.yaml @@ -1353,6 +1353,166 @@ paths: security: - Authorization: - payments:read + /v3/orders: + get: + tags: + - payments.v3 + summary: List orders ingested from exchange-style connectors + description: | + Returns the full list of orders ingested by Formance from connectors + that implement the orders capability (e.g. `coinbaseprime`). Orders + represent trade placements on an exchange-style PSP and are + **read-only** through the Formance API — submission, cancellation, + and lifecycle transitions are owned by the underlying connector. + + Results are cursor-paginated. The optional request body accepts a + query builder for filtering over top-level `V3Order` fields such as + `connectorID`, `reference`, `direction`, `status`, `type`, + `sourceAsset`, `destinationAsset`, and `createdAt`. + + See `V3Order` for the full response shape, including the + `adjustments` array that captures each observed state transition on + the exchange. + operationId: v3ListOrders + x-speakeasy-name-override: ListOrders + parameters: + - $ref: '#/components/parameters/V3PageSize' + - $ref: '#/components/parameters/V3Cursor' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/V3QueryBuilder' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/V3OrdersCursorResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:read + /v3/orders/{orderID}: + get: + tags: + - payments.v3 + summary: Get a single order by its Formance ID + description: | + Returns one order identified by its Formance-assigned `id` (composed + from the PSP `reference` and the connector ID — **not** the PSP's + native reference). The response includes the full `adjustments` + history ordered from oldest to most recent; the last adjustment + reflects the order's current top-level `status`. + + Returns an error via `V3ErrorResponse` when no order exists for the + given ID, or when the ID cannot be decoded. + operationId: v3GetOrder + x-speakeasy-name-override: GetOrder + parameters: + - $ref: '#/components/parameters/V3OrderID' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/V3GetOrderResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:read + /v3/conversions: + get: + tags: + - payments.v3 + summary: List currency and asset conversions ingested from connectors + description: | + Returns the full list of conversions ingested by Formance from + connectors that implement the conversions capability. A conversion + is a direct swap between two assets on a PSP (e.g. USD → USDC on + Coinbase Prime). Conversions are **read-only** through the Formance + API. + + Unlike orders, conversions do not carry an adjustment history — + Formance records only the final observed state (`status`, + `destinationAmount`, and `fee` when settled). + + Results are cursor-paginated. The optional request body accepts a + query builder for filtering over top-level `V3Conversion` fields + such as `connectorID`, `reference`, `status`, `sourceAsset`, + `destinationAsset`, and `createdAt`. + operationId: v3ListConversions + x-speakeasy-name-override: ListConversions + parameters: + - $ref: '#/components/parameters/V3PageSize' + - $ref: '#/components/parameters/V3Cursor' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/V3QueryBuilder' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/V3ConversionsCursorResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:read + /v3/conversions/{conversionID}: + get: + tags: + - payments.v3 + summary: Get a single conversion by its Formance ID + description: | + Returns one conversion identified by its Formance-assigned `id` + (**not** the PSP's native `reference`). See `V3Conversion` for the + response shape — on `COMPLETED` status the `destinationAmount` and + `fee` fields reflect the settled values; on `FAILED` the `error` + field carries the PSP's rejection reason. + + Returns an error via `V3ErrorResponse` when no conversion exists + for the given ID. + operationId: v3GetConversion + x-speakeasy-name-override: GetConversion + parameters: + - $ref: '#/components/parameters/V3ConversionID' + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/V3GetConversionResponse' + default: + description: Error + content: + application/json: + schema: + $ref: '#/components/schemas/V3ErrorResponse' + security: + - Authorization: + - payments:read /v3/payments: post: tags: @@ -4890,6 +5050,432 @@ components: - CAPTURE - CAPTURE_FAILED - OTHER + V3OrdersCursorResponse: + type: object + required: + - cursor + properties: + cursor: + type: object + required: + - pageSize + - hasMore + - data + properties: + pageSize: + type: integer + format: int64 + minimum: 1 + example: 15 + hasMore: + type: boolean + example: false + previous: + type: string + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= + next: + type: string + example: "" + data: + type: array + items: + $ref: '#/components/schemas/V3Order' + V3GetOrderResponse: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/V3Order' + V3Order: + type: object + description: | + A trade order submitted to an exchange-style PSP. Orders are read-only + in the Formance API: they are fetched from the underlying connector. + Status transitions are captured via the `adjustments` array; each + adjustment is a point-in-time snapshot from the PSP. + required: + - id + - connectorID + - provider + - reference + - createdAt + - updatedAt + - direction + - sourceAsset + - destinationAsset + - type + - status + - baseQuantityOrdered + - timeInForce + properties: + id: + type: string + description: Formance-assigned unique order ID (composed from the PSP reference and connector ID). + connectorID: + type: string + format: byte + description: ID of the Formance connector this order was fetched from. + provider: + type: string + description: Provider name of the connector (e.g. `coinbaseprime`). + reference: + type: string + description: PSP-assigned order reference. Unique within the connector; used as the storage dedup key. + clientOrderID: + type: string + nullable: true + description: | + Client-assigned ID supplied to the PSP for placement idempotency + (e.g. Coinbase `client_order_id`, Kraken `cl_ord_id`, Binance + `clientOrderId`). Stored for traceability only — Formance does + NOT dedup on this field. + createdAt: + type: string + format: date-time + description: When the order was created on the PSP. + updatedAt: + type: string + format: date-time + description: When Formance last observed a state change on the order. Equivalent to the latest adjustment's `createdAt`. + direction: + $ref: '#/components/schemas/V3OrderDirectionEnum' + sourceAsset: + type: string + description: | + Asset being spent, in `SYMBOL/precision` form (e.g. `USD/2`, + `BTC/8`). For BUY: the quote currency. For SELL: the base + currency. + destinationAsset: + type: string + description: | + Asset being received, in `SYMBOL/precision` form. + For BUY: the base currency. For SELL: the quote currency. + type: + $ref: '#/components/schemas/V3OrderTypeEnum' + status: + $ref: '#/components/schemas/V3OrderStatusEnum' + baseQuantityOrdered: + type: integer + format: bigint + description: Amount of base asset the order was placed for, as an integer at the base asset's precision. + baseQuantityFilled: + type: integer + format: bigint + nullable: true + description: Amount of base asset filled so far, as an integer at the base asset's precision. Null before any fill. + limitPrice: + type: integer + format: bigint + nullable: true + description: Maximum price (for BUY) or minimum price (for SELL) at which the order may execute, in `priceAsset` precision. Required for LIMIT-family order types; null otherwise. + stopPrice: + type: integer + format: bigint + nullable: true + description: Trigger price at which a STOP / STOP_LIMIT order activates, in `priceAsset` precision. Null for non-stop order types. + timeInForce: + $ref: '#/components/schemas/V3TimeInForceEnum' + expiresAt: + type: string + format: date-time + nullable: true + description: Expiration instant for `GOOD_UNTIL_DATE_TIME` orders. Null for other time-in-force values. + fee: + type: integer + format: bigint + nullable: true + description: Commission charged by the PSP for the order, as an integer in `feeAsset` precision. + feeAsset: + type: string + nullable: true + description: Currency the fee is denominated in, in `SYMBOL/precision` form. Typically the quote asset. + averageFillPrice: + type: integer + format: bigint + nullable: true + description: Volume-weighted average price across all fills so far, in `priceAsset` precision. Analytics field — may be absent if the PSP does not report it. + quoteAmount: + type: integer + format: bigint + nullable: true + description: | + Total amount of quote currency exchanged so far, as reported by + the PSP (e.g. Coinbase `filled_value`), at `quoteAsset` + precision. For BUY: amount spent. For SELL: amount received. + quoteAsset: + type: string + nullable: true + description: Quote currency with precision (e.g. `USD/2`). Null when the order has no quote-side amounts reported yet. + priceAsset: + type: string + nullable: true + description: | + Currency + precision under which `limitPrice`, `stopPrice`, and + `averageFillPrice` should be interpreted. Separate from + `quoteAsset` because some PSPs return price strings with more + decimal digits than the quote currency's natural precision. + sourceAccountID: + type: string + nullable: true + description: | + Formance account ID of the wallet the source asset was debited + from. Null if the PSP did not return enough information to + resolve it at ingestion time. + destinationAccountID: + type: string + nullable: true + description: Formance account ID of the wallet the destination asset was credited to. Null if unresolvable. + metadata: + $ref: '#/components/schemas/V3Metadata' + adjustments: + type: array + nullable: true + items: + $ref: '#/components/schemas/V3OrderAdjustment' + description: Ordered history of state snapshots for this order. The most recent element reflects the current `status`. + error: + type: string + nullable: true + description: Human-readable error from the PSP (e.g. rejection reason) when `status` is `FAILED`. Null otherwise. + V3OrderAdjustment: + type: object + description: | + Immutable snapshot of an order's state at a single observation. + Formance records one adjustment per distinct state the PSP reports + (status change, fill progress, fee update). Events are emitted + per-adjustment, not per-order — so a single order can produce many + events over its lifetime. + required: + - id + - reference + - createdAt + - status + properties: + id: + type: string + description: Adjustment ID, composed from the order ID plus the state fields that define uniqueness (status, filled quantity, fee). Idempotent — replaying the same observation produces the same ID. + reference: + type: string + description: PSP reference the adjustment belongs to (equal to the parent order's `reference`). + createdAt: + type: string + format: date-time + description: When Formance observed this state. Not the PSP's own timestamp — reflects ingestion time. + status: + $ref: '#/components/schemas/V3OrderStatusEnum' + baseQuantityFilled: + type: integer + format: bigint + nullable: true + description: Base asset filled at this observation, at the base asset's precision. + fee: + type: integer + format: bigint + nullable: true + description: Cumulative fee at this observation, at `feeAsset` precision. + feeAsset: + type: string + nullable: true + description: Currency the fee is denominated in, in `SYMBOL/precision` form. + metadata: + $ref: '#/components/schemas/V3Metadata' + raw: + type: object + description: Untransformed PSP response payload that produced this adjustment. Retained for debugging and replay. + V3OrderDirectionEnum: + type: string + description: Whether an order buys or sells the base asset. + enum: + - UNKNOWN + - BUY + - SELL + V3OrderTypeEnum: + type: string + description: | + Exchange order type. Determines which price fields are meaningful on + `V3Order`: LIMIT-family types use `limitPrice`; STOP-family types use + `stopPrice`; TWAP/VWAP are time-weighted execution algorithms. + enum: + - UNKNOWN + - MARKET + - LIMIT + - STOP_LIMIT + - STOP + - TWAP + - VWAP + - PEG + - BLOCK + - RFQ + - TRAILING_STOP + - TRAILING_STOP_LIMIT + - TAKE_PROFIT + - TAKE_PROFIT_LIMIT + - LIMIT_MAKER + V3OrderStatusEnum: + type: string + description: | + Lifecycle of an order on the exchange. + `PENDING` — accepted by the exchange, not yet working. + `OPEN` — live on the book, no fills yet. + `PARTIALLY_FILLED` — live on the book, some base quantity filled. + `FILLED` — fully filled, terminal. + `CANCELLED` — cancelled by the user or system, terminal. + `FAILED` — rejected by the exchange, terminal. See `error` for details. + `EXPIRED` — `timeInForce` elapsed before full fill, terminal. + enum: + - UNKNOWN + - PENDING + - OPEN + - PARTIALLY_FILLED + - FILLED + - CANCELLED + - FAILED + - EXPIRED + V3TimeInForceEnum: + type: string + description: | + How long an order is valid on the exchange. + `GOOD_UNTIL_CANCELLED` — rests until explicitly cancelled. + `GOOD_UNTIL_DATE_TIME` — rests until `expiresAt`. + `IMMEDIATE_OR_CANCEL` — fill immediately, cancel any unfilled portion. + `FILL_OR_KILL` — fill fully and immediately, or cancel entirely. + enum: + - UNKNOWN + - GOOD_UNTIL_CANCELLED + - GOOD_UNTIL_DATE_TIME + - IMMEDIATE_OR_CANCEL + - FILL_OR_KILL + V3ConversionsCursorResponse: + type: object + required: + - cursor + properties: + cursor: + type: object + required: + - pageSize + - hasMore + - data + properties: + pageSize: + type: integer + format: int64 + minimum: 1 + example: 15 + hasMore: + type: boolean + example: false + previous: + type: string + example: YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= + next: + type: string + example: "" + data: + type: array + items: + $ref: '#/components/schemas/V3Conversion' + V3GetConversionResponse: + type: object + required: + - data + properties: + data: + $ref: '#/components/schemas/V3Conversion' + V3Conversion: + type: object + description: | + A currency or asset conversion executed on a PSP (e.g. Coinbase Prime + transfer between a USD and USDC wallet). Conversions are read-only in + the Formance API: they are fetched from the underlying connector. + Unlike orders, conversions do not carry an adjustment history — + Formance records the final state only. + required: + - id + - connectorID + - provider + - reference + - createdAt + - updatedAt + - sourceAsset + - destinationAsset + - sourceAmount + - status + properties: + id: + type: string + description: Formance-assigned unique conversion ID. + connectorID: + type: string + format: byte + description: ID of the Formance connector this conversion was fetched from. + provider: + type: string + description: Provider name of the connector (e.g. `coinbaseprime`). + reference: + type: string + description: PSP-assigned conversion reference. Unique within the connector. + createdAt: + type: string + format: date-time + description: When the conversion was initiated on the PSP. + updatedAt: + type: string + format: date-time + description: When Formance last observed a state change on the conversion. + sourceAsset: + type: string + description: Asset being converted from, in `SYMBOL/precision` form (e.g. `USD/2`). + destinationAsset: + type: string + description: Asset being converted to, in `SYMBOL/precision` form (e.g. `USDC/6`). + sourceAmount: + type: integer + format: bigint + description: Amount of source asset debited, as an integer at `sourceAsset` precision. + destinationAmount: + type: integer + format: bigint + nullable: true + description: Amount of destination asset credited, at `destinationAsset` precision. Null until the conversion completes. + fee: + type: integer + format: bigint + nullable: true + description: PSP fee for the conversion, at `feeAsset` precision. + feeAsset: + type: string + nullable: true + description: Currency the fee is denominated in, in `SYMBOL/precision` form. + status: + $ref: '#/components/schemas/V3ConversionStatusEnum' + sourceAccountID: + type: string + nullable: true + description: Formance account ID of the wallet the source asset was debited from. + destinationAccountID: + type: string + nullable: true + description: Formance account ID of the wallet the destination asset was credited to. + metadata: + $ref: '#/components/schemas/V3Metadata' + error: + type: string + nullable: true + description: Human-readable error from the PSP when `status` is `FAILED`. Null otherwise. + V3ConversionStatusEnum: + type: string + description: | + Lifecycle of a conversion. + `PENDING` — accepted by the PSP, not yet settled. + `COMPLETED` — settled, terminal. + `FAILED` — rejected or reverted, terminal. See `error`. + enum: + - UNKNOWN + - PENDING + - COMPLETED + - FAILED V3InitiatePaymentRequest: type: object required: @@ -6548,6 +7134,20 @@ components: description: The task ID schema: type: string + V3OrderID: + name: orderID + in: path + required: true + description: The order ID + schema: + type: string + V3ConversionID: + name: conversionID + in: path + required: true + description: The conversion ID + schema: + type: string V3Connector: name: connector in: path diff --git a/pkg/stack/.speakeasy/gen.lock b/pkg/stack/.speakeasy/gen.lock index a495840..6fd4272 100644 --- a/pkg/stack/.speakeasy/gen.lock +++ b/pkg/stack/.speakeasy/gen.lock @@ -1,16 +1,16 @@ lockVersion: 2.0.0 id: c8558e29-cc40-460f-b7ee-ccbe35392546 management: - docChecksum: 53130f75db5624b1ad1176f5d222f686 + docChecksum: 61fc2f55ee7ab5ee0738e57acb61b7e5 docVersion: SDK_VERSION speakeasyVersion: 1.761.4 generationVersion: 2.879.13 releaseVersion: 3.12.0 configChecksum: 212188f4e256d04ac6127595722c7f5b persistentEdits: - generation_id: 10299df1-7b9c-4767-a314-a2c8e8e11f94 - pristine_commit_hash: e6c716fc03f8c7c8118f33c70f4e571706f9a31d - pristine_tree_hash: 3b8efc5c5eb59636294b5d2b89fdf041eb5f7cfd + generation_id: a57b6971-1278-415a-812c-46240270db19 + pristine_commit_hash: d5fcc8ae9bdcaf7de350c6476c4fa32b93f4b92a + pristine_tree_hash: ced15a5f3bf08f40521d6c7179da68e77a6d9bf2 features: go: acceptHeaders: 2.81.2 @@ -1647,6 +1647,22 @@ trackedFiles: id: c3557bf29702 last_write_checksum: sha1:da5bbce16ce4c84455091154bcbbca350a222ec9 pristine_git_object: e4d4f53cba83209668a4cc3c3a0c2ac339c6951d + docs/pkg/models/operations/v3getconversionrequest.md: + id: 61cd6861f24d + last_write_checksum: sha1:cac1d75d1f38f4343af7f5d9a86cb67363458e9d + pristine_git_object: 84847a3c7b09904666b17222ca2d898cddc841eb + docs/pkg/models/operations/v3getconversionresponse.md: + id: 4868c8c6b755 + last_write_checksum: sha1:4828d51d10281c1f053edc985b690d6e81c69012 + pristine_git_object: c46abc8d369fb762fc3981c43acc29b64f065622 + docs/pkg/models/operations/v3getorderrequest.md: + id: d82712f8b05f + last_write_checksum: sha1:761ee43dd86fb1c2ac2a593e3130f123e08d10c2 + pristine_git_object: fe3cefcef00eba743767fa090174f43f144259b2 + docs/pkg/models/operations/v3getorderresponse.md: + id: 541d66924906 + last_write_checksum: sha1:5cdfaea9ff6bcced349c25cdedafedfb2c4cce59 + pristine_git_object: 988cfe5bd43db838fb16f8098bebbd1a08b9fce7 docs/pkg/models/operations/v3getpaymentinitiationrequest.md: id: a746d45c3c20 last_write_checksum: sha1:9c223f1ec73827c776df9e70e1c169a4dd9e9fec @@ -1771,6 +1787,22 @@ trackedFiles: id: 2ea9cfcb1706 last_write_checksum: sha1:5ea7f12b7e8d71f26924d16e7990de480b861eb9 pristine_git_object: a36a8c4124bc99e09786e1331ef8505932195099 + docs/pkg/models/operations/v3listconversionsrequest.md: + id: c59a32371a44 + last_write_checksum: sha1:0ddd38d25e962917630f9fa28f79620eae4f77a6 + pristine_git_object: 2e7005ed4693d0908c8e0bdaca71c3d8e2ca4d3a + docs/pkg/models/operations/v3listconversionsresponse.md: + id: 87fb9bb32ef5 + last_write_checksum: sha1:c7fcad8e18b1753789dba933bb25f252db28a78a + pristine_git_object: 95af0638da568b013e447ee0dfbcbac2798522f3 + docs/pkg/models/operations/v3listordersrequest.md: + id: a0b3105ecae5 + last_write_checksum: sha1:8bb178bcf0521630bb03cd6778f38506fece5c82 + pristine_git_object: 588c3d775f34bc6c902b81741586b0ef0fa7a069 + docs/pkg/models/operations/v3listordersresponse.md: + id: c0257fd8119f + last_write_checksum: sha1:5068cdaa79a26b61b4dbace56376bd48105fa1e4 + pristine_git_object: 94dcc7740c530d94587cc31d3c86bc2b3115272e docs/pkg/models/operations/v3listpaymentinitiationadjustmentsrequest.md: id: 25f4667b1d74 last_write_checksum: sha1:f7a225f2b7d687d039d2cf96e995290f97ce42a6 @@ -2003,6 +2035,10 @@ trackedFiles: id: b9b150a9da17 last_write_checksum: sha1:72ebee6335986b820eecafe74a734b6c8825a6ca pristine_git_object: 6346c91a119fc9baeb9ada31a01009b5227bfed5 + docs/pkg/models/shared/activitycreatetransferinitiation.md: + id: d13600fc0381 + last_write_checksum: sha1:93880f13f2b46f5136f7d8ed11587712b04f4ab1 + pristine_git_object: ceb5aca73bee42c233ed0541402f1eeaf8c8404d docs/pkg/models/shared/activitycreditwallet.md: id: c1b261b0f46f last_write_checksum: sha1:e90428eb0a14a8545e5ad4baaa9732aa223d2a57 @@ -2049,8 +2085,12 @@ trackedFiles: pristine_git_object: 1f38a2714c45aa3848622e2978f3b35e4ce37979 docs/pkg/models/shared/activitystripetransfer.md: id: 9a9b70b501d9 - last_write_checksum: sha1:28ad24688523d184860baab4ef5356d24ecf7c26 - pristine_git_object: 6877e7fe3c1430aa8e228f2b65b2d13f40289e13 + last_write_checksum: sha1:ad29f7e8ce379288615cd961e64a95a5e6155e27 + pristine_git_object: 8981afb948f0acfce790481dba36fd75127f9942 + docs/pkg/models/shared/activitystripetransfermetadata.md: + id: 7a16ff1f6e36 + last_write_checksum: sha1:e33a1245bed1d74d54b10c532e6201ee2ab2c4c4 + pristine_git_object: 055e707c8ace4ff3f30087d77a081c13b506a32c docs/pkg/models/shared/activityvoidhold.md: id: f409a7e18048 last_write_checksum: sha1:6cc9938a3de0849c7450dc6e39d0c5a990764937 @@ -2541,8 +2581,8 @@ trackedFiles: pristine_git_object: 7ea3676f1caa62d2f644751270b3b2c4d2fa4116 docs/pkg/models/shared/log.md: id: cf8b10843e79 - last_write_checksum: sha1:dbd0e1792e412eb07e2571050c5a46e29d2ad343 - pristine_git_object: 5fd4cbf0d2eba089d9a76831811f981f06c8bca9 + last_write_checksum: sha1:27331acf095e4afecaf3cc6f24934fcb6e37590f + pristine_git_object: c380ab7a916bcfb04186cd4597525698b9385f4c docs/pkg/models/shared/logscursorresponse.md: id: b9d624fe3adc last_write_checksum: sha1:14b16f8cf4a4ea8fd5c121fd96a327ba54260b24 @@ -2551,6 +2591,10 @@ trackedFiles: id: dbf9dee76dc6 last_write_checksum: sha1:1005dc054ed5cae3573202c8f42f0f42fba5abe1 pristine_git_object: faf5d72ffb50e5ccdab08e746608d8d108e8e3a1 + docs/pkg/models/shared/logtype.md: + id: f88689714f38 + last_write_checksum: sha1:424d04fcabbbef6fe844e3108f44e668191f7a99 + pristine_git_object: 6c9c8c85f8ca65eeedd37c30b117c6d899fceec7 docs/pkg/models/shared/mangopayconfig.md: id: 790f53130a43 last_write_checksum: sha1:0e9505348d0d92d2d207105b1f4cb0579dae9324 @@ -2565,8 +2609,8 @@ trackedFiles: pristine_git_object: 36ed49e86538b5f73dffbc5762d264bb689337de docs/pkg/models/shared/metadata.md: id: 6a57b025150d - last_write_checksum: sha1:ea63144364ee6d7492ce2e653e6dacdd54c93c82 - pristine_git_object: c10fe9f9ea8ddb4f8fb06cba573ddb2bd52ffb1e + last_write_checksum: sha1:7e06017ee3297311968dff846207855563f1d475 + pristine_git_object: b6437a41e7c6caf509d41fe8bbd4a46297a7e7a9 docs/pkg/models/shared/migrationinfo.md: id: 6b3d9dca6ac1 last_write_checksum: sha1:52db5c299c496ea034b79a3914e0f7d2a8b846a2 @@ -2841,12 +2885,16 @@ trackedFiles: pristine_git_object: d7bd53b80a1e49a3370334ca770e659581d138e6 docs/pkg/models/shared/stagesenddestinationaccount.md: id: bc477868e5f7 - last_write_checksum: sha1:5792237c82b2cc6e45426c2ec9e4a398ca68714c - pristine_git_object: 5fc590baccfb762b959d4ae3a8aaeb90911bb719 + last_write_checksum: sha1:efbd246e542d57627745e2a3fe581475eddc8ac0 + pristine_git_object: 7cf616038a2435e9d43cb7637e40792617db857b docs/pkg/models/shared/stagesenddestinationpayment.md: id: 7baa3b84871c - last_write_checksum: sha1:425db00362b57dabfcc49c35a20e3758f922cbe6 - pristine_git_object: be75a5a1bad8ce9f6176b2f86cdd3505a124d303 + last_write_checksum: sha1:317a1636d15cfd75d94458854688f89b91cb81d5 + pristine_git_object: 571b4302eec6c41c3303e6c1817796bdd21c3e14 + docs/pkg/models/shared/stagesenddestinationpaymenttype.md: + id: 7869718a6adf + last_write_checksum: sha1:eba9614d295e2568071940bcc5b329514083c3ee + pristine_git_object: c86e0be7144a3c3c21b66585452e9df960c5c943 docs/pkg/models/shared/stagesenddestinationwallet.md: id: c88b0b2a865e last_write_checksum: sha1:efba2cca559e32777857a4182d05e66fd1b8974e @@ -2857,8 +2905,8 @@ trackedFiles: pristine_git_object: 24bd1d64b91ea80dce8fb7fef1b637621639cf66 docs/pkg/models/shared/stagesendsourcepayment.md: id: 120e95125c0e - last_write_checksum: sha1:96b3d4c817e22c02a2b2b452b5f37a562b138602 - pristine_git_object: 2bb6edf3ecea063308e17b64ad1953854191756e + last_write_checksum: sha1:e1227578f90e07034fd4273e5c5d8b128c7a5d03 + pristine_git_object: 46d6217cd07114908f4b2b727bbc285a4483e360 docs/pkg/models/shared/stagestatus.md: id: 2cc84e0985f2 last_write_checksum: sha1:2588e2a0d142526b46b5b31718583a5f075f38bc @@ -3109,8 +3157,8 @@ trackedFiles: pristine_git_object: f3369f4309fd5a40c2228c8e6e55cb9eb017612f docs/pkg/models/shared/type.md: id: 3be06dc2911c - last_write_checksum: sha1:f5cd0db653808d5617ee8fbfbf65efd56661ba1b - pristine_git_object: 35d7e4177872daee4735dedf323ec846fc5ae055 + last_write_checksum: sha1:dd72ef50ffd96258ce17616f1a845fe2c91c71b8 + pristine_git_object: 3f498949ee3c1af31e92e964c28c6cb87fbf9d77 docs/pkg/models/shared/update.md: id: b7f0d6cd81dd last_write_checksum: sha1:89cfe807f79bb1e193a4d99d07827f1eaa963391 @@ -3171,6 +3219,18 @@ trackedFiles: id: 0163e35636c9 last_write_checksum: sha1:3d08f8ca6d5da3f0744a9c233e1d0f2b2a51939c pristine_git_object: 1269a458b894a3301be5f3c7b582bf96267e2bae + docs/pkg/models/shared/v2activitycreatetransferinitiation.md: + id: 67d7c718caa2 + last_write_checksum: sha1:34b636493bf9a6c5cd3453b89329dc75cc227f20 + pristine_git_object: b45ad01a5f474778c2b9a6644f323cf3a57827e9 + docs/pkg/models/shared/v2activitycreatetransferinitiationmetadata.md: + id: 02771a8f71ab + last_write_checksum: sha1:715ab24e9b0e180bd48e46d9a638c35952e202be + pristine_git_object: 58cc736fe9319e4c6028678ae58dacf0e205b7b1 + docs/pkg/models/shared/v2activitycreatetransferinitiationtype.md: + id: 6bca61b5bd0b + last_write_checksum: sha1:add3598384a7616288b69dd37aca66ba0444c260 + pristine_git_object: af41337c527126e5977c991576f1a2c2a08ad7d4 docs/pkg/models/shared/v2activitycreditwallet.md: id: 554dee461f94 last_write_checksum: sha1:ac3918c4eaece8794a2da69a04111dd29fea9dcf @@ -3677,12 +3737,16 @@ trackedFiles: pristine_git_object: a3bc2885619265dd6c27107c64b5dceba3102f20 docs/pkg/models/shared/v2stagesenddestinationaccount.md: id: 142658c7743b - last_write_checksum: sha1:a34b469568a816f2c0fe09796afb3404509282e3 - pristine_git_object: 53d9d3ac6397219d9920af42c31b668225986f3e + last_write_checksum: sha1:7525ac9828bd48c906988c829ae18dd8e5800422 + pristine_git_object: 2b18171fb81bb95dc7a32c8e19d8468d8fd1d89a docs/pkg/models/shared/v2stagesenddestinationpayment.md: id: da1f9009e0fd - last_write_checksum: sha1:6388e98eb4ed934015a58c131b6a4e3a9e038bc8 - pristine_git_object: 26f0a2f4fa2d28e17da4a8fc72071dbd0e0b93df + last_write_checksum: sha1:1478c5b208985401d9a3eb10e52182cf73c470fa + pristine_git_object: 40b36fe2cc588098ffe3bde8b7b4241efc7228f6 + docs/pkg/models/shared/v2stagesenddestinationpaymenttype.md: + id: d50221b16c6c + last_write_checksum: sha1:730abdddc9019f5eb7dcecd4316c1e0279d1d399 + pristine_git_object: b63477c9704541c557f00291ae33bf149ad65f6a docs/pkg/models/shared/v2stagesenddestinationwallet.md: id: 9585cc06fa53 last_write_checksum: sha1:10fc87d32a1e7ed55672aabb4c30912b38186172 @@ -3693,8 +3757,8 @@ trackedFiles: pristine_git_object: 88d7c96d8b17f221551d9d8dc8767bf25174631d docs/pkg/models/shared/v2stagesendsourcepayment.md: id: e5d6d56fc683 - last_write_checksum: sha1:5f5b3de9e7c37c05d7cb1dd08eff64efe2553bc0 - pristine_git_object: c6b88b2e50e14635093a8a803a7061c21a84606d + last_write_checksum: sha1:231a1c954f610a0af209695a0916729496da7d2d + pristine_git_object: 721f6f672eac39fff5c1332b69788bdb0054dae6 docs/pkg/models/shared/v2stagestatus.md: id: e87390b95173 last_write_checksum: sha1:767aaa4f58ee3b0eb7182724dc5d92cc7a873acd @@ -3821,8 +3885,8 @@ trackedFiles: pristine_git_object: 38a23c8f7360e277749466b62f844d02d4eb63b0 docs/pkg/models/shared/v2workflowinstancehistorystageinput.md: id: 74f40588487a - last_write_checksum: sha1:ab2ce949c2211d75811cbcc824b2d4a891328a27 - pristine_git_object: b4369d5ca0ccea833cfba6f82f605123352147f5 + last_write_checksum: sha1:8d7f234406d90a46138f6cd68060806f28ffd86f + pristine_git_object: dbac6f8deb2d50472067eff223d7b172057c8048 docs/pkg/models/shared/v2workflowinstancehistorystageoutput.md: id: 23562ec34c85 last_write_checksum: sha1:6479f6f9cc821ff8f7b2473a2bd46f862f57719d @@ -3975,6 +4039,22 @@ trackedFiles: id: 039d1c6a4c4e last_write_checksum: sha1:86800d55f01e53be9ffb8205e536be0f372cb927 pristine_git_object: 17b45811ff590444c8864322f7118250ff786f08 + docs/pkg/models/shared/v3conversion.md: + id: 09cdf2330def + last_write_checksum: sha1:ba9e4dbab62ce978a0ec128ae826680b134b2f0c + pristine_git_object: 382ce29351c28ddaa3dc13b62a020e07d4da5088 + docs/pkg/models/shared/v3conversionscursorresponse.md: + id: f35581f60c34 + last_write_checksum: sha1:63d383a8ba1a832131a2d4687f627ec9668ba5e0 + pristine_git_object: 4a8a41b914b7689a5b1863aa477442a7f5571c28 + docs/pkg/models/shared/v3conversionscursorresponsecursor.md: + id: 7653b041f352 + last_write_checksum: sha1:eab9dcc3067fa58cd3dfba61c18d448683d83146 + pristine_git_object: 606659ada812970da6b0b7d4c469b4e45c6c75fe + docs/pkg/models/shared/v3conversionstatusenum.md: + id: ec35a3a436c1 + last_write_checksum: sha1:078bd02050c29ad5a76d0cfc59a4fe180e2bb251 + pristine_git_object: e91240a08bd2ab29effeb383f9a8a6fca63aa71e docs/pkg/models/shared/v3createaccountrequest.md: id: be435454f712 last_write_checksum: sha1:304ca1fb8e45950667d8258b21cbafcc65299691 @@ -4079,6 +4159,14 @@ trackedFiles: id: 71e6546c90c5 last_write_checksum: sha1:c2aef98eabcd0d0f3c669c05e4a42487a2c1933a pristine_git_object: b7c50201f7c1ce25d2ef5eb2f253fba6704485c5 + docs/pkg/models/shared/v3getconversionresponse.md: + id: b3242a1a9dbf + last_write_checksum: sha1:41292640656e0e87e5b934a2ee8ff06b43ab0921 + pristine_git_object: 7ba8b0bc8e134ff3f9fccf151ceca146b9d7cc80 + docs/pkg/models/shared/v3getorderresponse.md: + id: ad346b0e7902 + last_write_checksum: sha1:ec0e7a03bf14dbf67d41e64761efe4eb464b2d1b + pristine_git_object: 00b9ea31a862cf8b4a1979d4c163a66e6302fef5 docs/pkg/models/shared/v3getpaymentinitiationresponse.md: id: 70fce3dd588b last_write_checksum: sha1:4c1a1ffff0ebfa232dd54f7073ed86a174a680bb @@ -4143,6 +4231,38 @@ trackedFiles: id: 06650772a149 last_write_checksum: sha1:6d9922105ba4e4201ad62bf49dbdeb1f0b442521 pristine_git_object: c9c79d3079d8273df1770acb7ce067526a91a5cf + docs/pkg/models/shared/v3order.md: + id: 3eb2b41724dd + last_write_checksum: sha1:97ae3dfb20b98bb432ac6d55ff461ad8430a506b + pristine_git_object: be96c7a4aec2817658c986cbc8fad1413c4b19e4 + docs/pkg/models/shared/v3orderadjustment.md: + id: 438a47a92696 + last_write_checksum: sha1:42c4b103677ac16377a3603c9020f87362864ccc + pristine_git_object: 6de03e1a4f53bea2c54c9cf8179e99368945c544 + docs/pkg/models/shared/v3orderadjustmentraw.md: + id: 20637dcf11e4 + last_write_checksum: sha1:b994af0cf462c87c140db1e0c2118dd05db7f85f + pristine_git_object: 40fdc07d462a5ef9e07470f51bbf3344b7ae6414 + docs/pkg/models/shared/v3orderdirectionenum.md: + id: 5efc95126696 + last_write_checksum: sha1:52d4d7fc5607762054bbc46681aff73e2d48101b + pristine_git_object: cd7d11402b04716952984a16c92b9e3e308ab6fc + docs/pkg/models/shared/v3orderscursorresponse.md: + id: f37453017a1c + last_write_checksum: sha1:1a0b400f79d88aad72a90425df98aa12b795a444 + pristine_git_object: 2e427948b0f3db3be48635d04fccf28ed8e73765 + docs/pkg/models/shared/v3orderscursorresponsecursor.md: + id: fea17b4cd3fc + last_write_checksum: sha1:66981b3e09db3766f6be004d7b1c734d4a9f2e25 + pristine_git_object: ee3f72144e62214272428ccadc3249e16b6d8ca0 + docs/pkg/models/shared/v3orderstatusenum.md: + id: 047a6b4afd0d + last_write_checksum: sha1:276d9325ca97ecc751120dfe4a3aa47623796642 + pristine_git_object: 3f8ec3943c075cf0dc18a84c62b0cab92e736b31 + docs/pkg/models/shared/v3ordertypeenum.md: + id: c36ad186e711 + last_write_checksum: sha1:1355a4b9afc54e7e7c5eb09d9b65df17b20d9b3c + pristine_git_object: a4e504f0303aca3a55854700145eebcf6a16181d docs/pkg/models/shared/v3payment.md: id: 5755eca6877b last_write_checksum: sha1:9c688b3ea2dc073cd65bccc9d19a4772633dfb49 @@ -4363,6 +4483,10 @@ trackedFiles: id: a86da6b180dc last_write_checksum: sha1:fad5f80d01f7a719201a4b039536fe2f866435ef pristine_git_object: 82aadb1c39df43c98290747007800082fbf8f783 + docs/pkg/models/shared/v3timeinforceenum.md: + id: 2a7e8f03cba4 + last_write_checksum: sha1:2dd972a2a4a47c351a9c2a8a17ddf0ed754577dc + pristine_git_object: a021e096342653646303bf36b07755c3030ae4c7 docs/pkg/models/shared/v3tinkconfig.md: id: 30046697bc99 last_write_checksum: sha1:719e49c287455c3f97782c52f8f47616ff24dd5d @@ -4477,8 +4601,8 @@ trackedFiles: pristine_git_object: 1553719d57c1576e83af11b38149de974744dd13 docs/pkg/models/shared/workflowinstancehistorystageinput.md: id: db72e26a88a0 - last_write_checksum: sha1:0f1167a38eafd7ab096d65323589cf8c5b751ee9 - pristine_git_object: 84a8096e76ad7f27586e833faa32e3e624cca202 + last_write_checksum: sha1:e0170d8b0fd44032537ce36ad967d75321ec4e91 + pristine_git_object: 5436562c60f675f55468da93cda11e4e5e2b0dc3 docs/pkg/models/shared/workflowinstancehistorystageoutput.md: id: 84e274ea5a3f last_write_checksum: sha1:18487b18ec69d96d7cd99403983915c74a9c895f @@ -4529,8 +4653,8 @@ trackedFiles: pristine_git_object: e1d187472925784332ad18560b4241178012af0a docs/sdks/v3/README.md: id: ee683463fcdd - last_write_checksum: sha1:86835c309b5914e63ea2f9f3ed1777b3b30fcf4d - pristine_git_object: 20a0cb46067ba2e28d087af7bd0ea1f62900e527 + last_write_checksum: sha1:a459c069f478c5eae621d95396d2e519672aab46 + pristine_git_object: 142e13af1ed8644939fc011eb7446648b5c494b8 formance.go: id: 6a39aafd73d7 last_write_checksum: sha1:8da787d1994c6428479dd2a964489d22cb42a66e @@ -5431,6 +5555,14 @@ trackedFiles: id: 7b013e93b2ef last_write_checksum: sha1:4513c05ac9646fc1d41dac5ec7547c053d593cd3 pristine_git_object: 6dc9b8079b4d41080ca3b8f60d67f91df545ebf6 + pkg/models/operations/v3getconversion.go: + id: 568829b983d1 + last_write_checksum: sha1:edcb76b89f798ac617035459951f2a4ed610a32b + pristine_git_object: 52614588310c30e584913d8eff5f2d4f547b84b6 + pkg/models/operations/v3getorder.go: + id: 0a2861a819b4 + last_write_checksum: sha1:8bdbc677a495f3c0c322bb79f07822ef28ea643e + pristine_git_object: ab335cc4c236d5d0b93bd1fdd6f2e4ae86e76a35 pkg/models/operations/v3getpayment.go: id: 8454f5666369 last_write_checksum: sha1:cf3c4d685ea6a6db772ff0b0439ba5201664ce84 @@ -5495,6 +5627,14 @@ trackedFiles: id: c25fc98aa6cc last_write_checksum: sha1:5f11739f182d84bf5ff9c582fd6703187e60c943 pristine_git_object: b33aed5d9d46b2a726fa04bad6795323ccdecd8f + pkg/models/operations/v3listconversions.go: + id: 805f56b26cd4 + last_write_checksum: sha1:863da0ad14603c7021edbcf999c2061fcf1f0c8d + pristine_git_object: 0e7290743aff4fe495a3d896c221e231cd199baa + pkg/models/operations/v3listorders.go: + id: d3755fee4f08 + last_write_checksum: sha1:b5b1664108b547624b5f3a9a731a5e7ce8732226 + pristine_git_object: b249d1e0790fb8ade195fc471771b2abcfc43470 pkg/models/operations/v3listpaymentinitiationadjustments.go: id: f60088ec41b3 last_write_checksum: sha1:ea34d57f646daf7d98c4c41e03d6da9f12084827 @@ -5643,6 +5783,10 @@ trackedFiles: id: f8e359d37bf5 last_write_checksum: sha1:de75560f798b7fc5adef1f44dafe1e9689f0bfb4 pristine_git_object: 64dce777e21ade079c31d2ab30a0a1746ea2c1a4 + pkg/models/shared/activitycreatetransferinitiation.go: + id: b547774054ae + last_write_checksum: sha1:2dd85c9e6693cd333941398ec465f8403fd8fd73 + pristine_git_object: 56e571137d4e7b2c29ade3a037a43bc4d5ac543e pkg/models/shared/activitycreditwallet.go: id: 183dc29f71fd last_write_checksum: sha1:7e5a55aa4d9e1a93b4c7ffb9c1a3359c594ea037 @@ -5689,8 +5833,8 @@ trackedFiles: pristine_git_object: 806b813f711b72f0d3795020c454e97022f8f85b pkg/models/shared/activitystripetransfer.go: id: 51262df9fd45 - last_write_checksum: sha1:a666724a7425eff45d2e2ac9420acb12e116bb3b - pristine_git_object: 46aab79cc2a9bfbafecf5a24732c0434600df533 + last_write_checksum: sha1:787971a18e42964b40f67bc7a003528fa8926433 + pristine_git_object: eaa8350a5d55eccdd1157cd30b80f2ca469f0949 pkg/models/shared/activityvoidhold.go: id: 979fcacab3a1 last_write_checksum: sha1:0481517cf8da7306898d796f0a71c6fa9cce507f @@ -6081,8 +6225,8 @@ trackedFiles: pristine_git_object: 55fb6cc2c5b2ddbd4590c68d729a3ba30b59873a pkg/models/shared/log.go: id: 0be83777426a - last_write_checksum: sha1:4ae9e987e5b4a31b2a8c4f82e229deea46aa709e - pristine_git_object: 6897be8678a32e4bbe1444c6203f5f9b98f85e75 + last_write_checksum: sha1:334176ae2debf43ef0cd57fe98101dd8b78d07f1 + pristine_git_object: 7b451a41f20ad7078b9e7333bf6492d8e6824e80 pkg/models/shared/logscursorresponse.go: id: 8bc537055864 last_write_checksum: sha1:653f9986742844f16428737a1bea2ee990aad027 @@ -6313,12 +6457,12 @@ trackedFiles: pristine_git_object: 4b44e7ea1d50812b43c176a9db676bb0845a1aea pkg/models/shared/stagesenddestinationaccount.go: id: 1ca81ce64406 - last_write_checksum: sha1:4976b2852bbca062d77df4de94cb5086646ed477 - pristine_git_object: f0483cfb63553460c6ea140f4f33af7333a2abb4 + last_write_checksum: sha1:35cba45e3351116876de2df2ddb287429f7975a2 + pristine_git_object: d04f8334992a83d1c74bdaae5398e1864cfeabcf pkg/models/shared/stagesenddestinationpayment.go: id: b4c1cd6601b6 - last_write_checksum: sha1:b86fd10c12ac22412778245414b87eeb363b05a1 - pristine_git_object: 6b7e742bca1e07ecfa3e88e79b09c85d55da1111 + last_write_checksum: sha1:f411ce42cb37ab57fc385214976c93a8d7b13c2e + pristine_git_object: 7af3b9640bcd5653a3dafb7d1c5d44411ab1dced pkg/models/shared/stagesenddestinationwallet.go: id: 7d0fdef2d7f4 last_write_checksum: sha1:43bfd3abead1009d54f0ac28334a586594bde964 @@ -6329,8 +6473,8 @@ trackedFiles: pristine_git_object: 24d2873ac265964a0e7d73e274bf3f9f76fff6ff pkg/models/shared/stagesendsourcepayment.go: id: 6d500960c052 - last_write_checksum: sha1:2e98211aa00f337ca1a652e0a2b852b45c8c9c8c - pristine_git_object: b6d03438fcaed966e232306ece6941a9b95a643c + last_write_checksum: sha1:2be53331d2759599daa00f07226a6db58f88e393 + pristine_git_object: b7a038c228e2d3d319f388bb095137e33cf48e44 pkg/models/shared/stagestatus.go: id: 0d81c5683e20 last_write_checksum: sha1:79635a8047bca20f3c2d56f56611f56b4fa3cc00 @@ -6527,6 +6671,10 @@ trackedFiles: id: 719ef693927b last_write_checksum: sha1:26cc06ca1417e4ecd3d06b0603bd1f6173bb7250 pristine_git_object: 9e2516542d09cd09f05caa325e25aae396e13632 + pkg/models/shared/v2activitycreatetransferinitiation.go: + id: 11d014811ec8 + last_write_checksum: sha1:d10f4e84db0c519b393b680509ddcf3ad931628b + pristine_git_object: ee0ac03a66e01feac983b6e3e9ede843f8b05b18 pkg/models/shared/v2activitycreditwallet.go: id: 87f93d5e5c36 last_write_checksum: sha1:2ce4fe61a619c09c5ad4b304ae09795954988173 @@ -6901,12 +7049,12 @@ trackedFiles: pristine_git_object: 7bd668c905589d6a8bc0ee3025cc359eb9286869 pkg/models/shared/v2stagesenddestinationaccount.go: id: 4ed0b96f8aff - last_write_checksum: sha1:ec6109e571144974a2de3cf236c1d3e3ef276a19 - pristine_git_object: 48a7cd2e422fa9d4d2a0db02576804d39209e508 + last_write_checksum: sha1:475ba51abf40b648c1109bb08e16768d07b95714 + pristine_git_object: dc62df076d40781aae75e9da1d17feb66713a1f3 pkg/models/shared/v2stagesenddestinationpayment.go: id: 17fa9d24aa0e - last_write_checksum: sha1:3b9fcad91708d8efef34f432ead8e27028a53d14 - pristine_git_object: b096d10d1a26e14bc2307279523aeba5790ab559 + last_write_checksum: sha1:da09dad956d9c8a39646453660c8bbe9914b4f58 + pristine_git_object: 2946326cb7a7dd0c4da89b9e50b3da2a9b847a5f pkg/models/shared/v2stagesenddestinationwallet.go: id: 736d4c661dbe last_write_checksum: sha1:97f30b310c466a7affa4e23e3172112d3a3d27d4 @@ -6917,8 +7065,8 @@ trackedFiles: pristine_git_object: 3a0b464f612e7e0f56ccecbdf1b35c7ed5478b9a pkg/models/shared/v2stagesendsourcepayment.go: id: 0fa87c7decc3 - last_write_checksum: sha1:ebb08ce037e1d66938315cffc76812791c8a87e4 - pristine_git_object: a58849bb2c7bb32a85ba20dfbcf882e6b76d75fe + last_write_checksum: sha1:24e0f4b808891338b10481f75cc468f9fe851da7 + pristine_git_object: a15683672f7c8825bb110b2dbdd43d82178b46b4 pkg/models/shared/v2stagestatus.go: id: ab48de337b2b last_write_checksum: sha1:145847e519dce333cf55239fa0bab2cfe513634a @@ -7029,8 +7177,8 @@ trackedFiles: pristine_git_object: e2fc1fe6827f7cf0a295ea956372db3f6a49f44f pkg/models/shared/v2workflowinstancehistorystageinput.go: id: 58b40641df53 - last_write_checksum: sha1:3a3329cf084e09f146e691a22f50d1b8860031cd - pristine_git_object: f254cd5f39c6e28ead8341e501933de03c35795b + last_write_checksum: sha1:b29e0e209dc42b71abc3345567c9be8ffc5f9054 + pristine_git_object: f233d8ae55875f124bf808982c5eb5d0e853a164 pkg/models/shared/v2workflowinstancehistorystageoutput.go: id: 520962b2629e last_write_checksum: sha1:857b39c438ae67c5e6c355574278a178bca2196e @@ -7143,6 +7291,18 @@ trackedFiles: id: 47f87f88830b last_write_checksum: sha1:f9e1ad0e5e252be98f6a901dcb581fa3c712798d pristine_git_object: 5e1752d6a55e497a1b1d715a2e9b3e9d9433970d + pkg/models/shared/v3conversion.go: + id: 5e01f95ffbbe + last_write_checksum: sha1:465b046599d83408506591e46b8264ad9cd685eb + pristine_git_object: 73b62dacc7ffba421d5c672b2a76747d7abc7b87 + pkg/models/shared/v3conversionscursorresponse.go: + id: 05d518c15228 + last_write_checksum: sha1:ccb03466bb46a3fb854bf35f15b351262a7d3024 + pristine_git_object: ea66d9de3b9e67b72ec34f7c95e907afeaf2aab5 + pkg/models/shared/v3conversionstatusenum.go: + id: 1b3fe3069321 + last_write_checksum: sha1:f2c1126e9716546de2278bdd492c467f90e08c6c + pristine_git_object: c5ab0abcf80c3a750677ab8f70169fae8f5e1808 pkg/models/shared/v3createaccountrequest.go: id: ed063953fbcf last_write_checksum: sha1:27a47e05760702555e1012d2dbb2c2890ce39f48 @@ -7239,6 +7399,14 @@ trackedFiles: id: 765ad58102e6 last_write_checksum: sha1:764ffac802d60169be3c07a3fe4d9e4421cd1dff pristine_git_object: 9979b962214e77faa50c0ed0963286ff999b89eb + pkg/models/shared/v3getconversionresponse.go: + id: 92ca39b490c5 + last_write_checksum: sha1:c1f0ec72435119be68028bce2cac7ca982114600 + pristine_git_object: 6de18c0ebcb4e6add95dc09f96f8023b36cb335f + pkg/models/shared/v3getorderresponse.go: + id: 1c15047aca90 + last_write_checksum: sha1:5080957425bcbba120a9c6c5274a7af4bd272a61 + pristine_git_object: 4decfb5774dce45c817f2eb14d492b77460adba8 pkg/models/shared/v3getpaymentinitiationresponse.go: id: 4b3ab087aa33 last_write_checksum: sha1:3c15f7bc8b9fa2571b8c7ebe6a5070870358dd6e @@ -7299,6 +7467,30 @@ trackedFiles: id: 4b3de005bcd5 last_write_checksum: sha1:c5616e8ef0a90fc3cb5c5746f900e3141a63acac pristine_git_object: f064c8b144029fc25c78119b0329880e04f7d330 + pkg/models/shared/v3order.go: + id: 2fa6b6e70a34 + last_write_checksum: sha1:70c532547f994bad9c8cebaad21ee3e9c6b04d85 + pristine_git_object: 3c556fb3a2f27d6d18a0317fc0f76fb2c6853c35 + pkg/models/shared/v3orderadjustment.go: + id: 51e4e99b9a0c + last_write_checksum: sha1:b992c3c48768c3f4a00e67b45425a3f12fbeda9e + pristine_git_object: 1de30741b637f3d6b6c394503db11544f600c4d3 + pkg/models/shared/v3orderdirectionenum.go: + id: e01ce8c61ab3 + last_write_checksum: sha1:2e30b90d1916a553382bd337d238673900190cc8 + pristine_git_object: ba3e52db2f23f52e055120bae29c2424c98a9318 + pkg/models/shared/v3orderscursorresponse.go: + id: 4b24762f3e60 + last_write_checksum: sha1:b143c9b80e57c33d3fbd8b4dd6e0f808ed005c2f + pristine_git_object: 0907917c474b4aab49ef1fccf4f96871e092eee4 + pkg/models/shared/v3orderstatusenum.go: + id: c7ba6bf51ae5 + last_write_checksum: sha1:ca4127566a0891efc89b6b0d3feb0fbd7f2fe94c + pristine_git_object: 279237078db9c07284938115400661a4fe0a9d23 + pkg/models/shared/v3ordertypeenum.go: + id: 2cda34d7318f + last_write_checksum: sha1:d20f79f2252c81ee69f8d4631d88bf53e97dabe4 + pristine_git_object: a4b60a73b180d13c6f02164f08f6ca181049149f pkg/models/shared/v3payment.go: id: 24f20f4b6d68 last_write_checksum: sha1:e59974bdf53aec20f10fb6e31497887a3dec1d15 @@ -7463,6 +7655,10 @@ trackedFiles: id: 5ead778e1161 last_write_checksum: sha1:c59a979bc0b175f40d42cedefd1cdcd88f45d2e8 pristine_git_object: 533490a58012121a1200e7b32491b1c8734bf6c3 + pkg/models/shared/v3timeinforceenum.go: + id: c1e50c1a03e7 + last_write_checksum: sha1:9f5a35d95f2694e2f9130bbadf63ee8a97c220b9 + pristine_git_object: ec9bc0fd7974bf0369e892539e954b631534f525 pkg/models/shared/v3tinkconfig.go: id: dc52107962fd last_write_checksum: sha1:d46754ff458103cbfe23232b070495df69daa9ba @@ -7557,8 +7753,8 @@ trackedFiles: pristine_git_object: 6af8c7d23c71a6d800dd3667ea72fa305714138a pkg/models/shared/workflowinstancehistorystageinput.go: id: d113295aa187 - last_write_checksum: sha1:d4d4fe4152e982358d5076f9e82be0e552cd2779 - pristine_git_object: 60a268858227e3b49a41dcc8b24639bc3620cf11 + last_write_checksum: sha1:3b7e6662390f89daf9ab928503d266c36eedb69d + pristine_git_object: c30b25af7d3e3403bfcb0c687517ffb885d1073d pkg/models/shared/workflowinstancehistorystageoutput.go: id: ad0839ebf9d9 last_write_checksum: sha1:8bccfb63e8f074243ced2bfee333019704433eff @@ -7665,8 +7861,8 @@ trackedFiles: pristine_git_object: 0c65ed29629834dafa055813a25ff7fdd66a5a40 v3.go: id: 71e6067bd243 - last_write_checksum: sha1:e90f1fd7ee85e6543c3edba094528105601d1c92 - pristine_git_object: 5b72872f893d840f67df7292082dc54675bf4a96 + last_write_checksum: sha1:bc293519de72c2a2a971c8bbd65fa7af0d94f890 + pristine_git_object: 83b1c54815fd60ffd64b232987593118149fc6cd wallets.go: id: 548ba02ed90f last_write_checksum: sha1:5dadc33dfe2cf24eb47a64a3a63deceab5cc8f2e @@ -10173,6 +10369,48 @@ examples: application/json: {"cursor": {"data": [{"id": 641325, "metadata": {"admin": "true"}, "postCommitEffectiveVolumes": {"orders:1": {"USD": {"balance": 90, "input": 100, "output": 10}}, "orders:2": {"USD": {"balance": 90, "input": 100, "output": 10}}}, "postCommitVolumes": {"orders:1": {"USD": {"balance": 90, "input": 100, "output": 10}}, "orders:2": {"USD": {"balance": 90, "input": 100, "output": 10}}}, "postings": [], "preCommitEffectiveVolumes": {"orders:1": {"USD": {"balance": 90, "input": 100, "output": 10}}, "orders:2": {"USD": {"balance": 90, "input": 100, "output": 10}}}, "preCommitVolumes": {"orders:1": {"USD": {"balance": 90, "input": 100, "output": 10}}, "orders:2": {"USD": {"balance": 90, "input": 100, "output": 10}}}, "reference": "ref:001", "reverted": false, "timestamp": "2026-09-10T15:36:45.313Z"}], "hasMore": false, "next": "aW0gdmVuaWFtLCBxdWlzIG5vc3RydWQ=", "pageSize": 15, "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol="}} default: application/json: {"details": "https://play.numscript.org/?payload=eyJlcnJvciI6ImFjY291bnQgaGFkIGluc3VmZmljaWVudCBmdW5kcyJ9", "errorCode": "VALIDATION", "errorMessage": "[VALIDATION] invalid 'cursor' query param"} + v3GetConversion: + speakeasy-default-v3-get-conversion: + parameters: + path: + conversionID: "" + responses: + "200": + application/json: {"data": {"connectorID": "", "createdAt": "2025-03-19T11:59:54.615Z", "destinationAsset": "", "id": "", "provider": "", "reference": "", "sourceAmount": 897573, "sourceAsset": "", "status": "PENDING", "updatedAt": "2024-06-16T04:28:16.391Z"}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3GetOrder: + speakeasy-default-v3-get-order: + parameters: + path: + orderID: "" + responses: + "200": + application/json: {"data": {"baseQuantityOrdered": 767592, "connectorID": "", "createdAt": "2025-07-08T11:26:50.385Z", "destinationAsset": "", "direction": "SELL", "id": "", "provider": "", "reference": "", "sourceAsset": "", "status": "CANCELLED", "timeInForce": "FILL_OR_KILL", "type": "STOP", "updatedAt": "2026-07-07T17:10:53.430Z"}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3ListConversions: + speakeasy-default-v3-list-conversions: + parameters: + query: + pageSize: 100 + cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==" + responses: + "200": + application/json: {"cursor": {"data": [{"connectorID": "", "createdAt": "2026-08-26T17:16:20.558Z", "destinationAsset": "", "id": "", "provider": "", "reference": "", "sourceAmount": 788359, "sourceAsset": "", "status": "FAILED", "updatedAt": "2026-07-08T12:36:32.390Z"}], "hasMore": false, "next": "", "pageSize": 15, "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol="}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} + v3ListOrders: + speakeasy-default-v3-list-orders: + parameters: + query: + pageSize: 100 + cursor: "aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==" + responses: + "200": + application/json: {"cursor": {"data": [], "hasMore": false, "next": "", "pageSize": 15, "previous": "YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol="}} + default: + application/json: {"errorCode": "VALIDATION", "errorMessage": "[VALIDATION] missing required config field: pollingPeriod"} examplesVersion: 1.0.2 generatedTests: {} generatedFiles: diff --git a/pkg/stack/README.md b/pkg/stack/README.md index 5c3f9dc..1cdf4cf 100644 --- a/pkg/stack/README.md +++ b/pkg/stack/README.md @@ -363,6 +363,8 @@ func main() { * [GetBankAccount](docs/sdks/v3/README.md#getbankaccount) - Get a Bank Account by ID * [GetConnectorConfig](docs/sdks/v3/README.md#getconnectorconfig) - Get a connector configuration by ID * [GetConnectorSchedule](docs/sdks/v3/README.md#getconnectorschedule) - Get a connector schedule by ID +* [GetConversion](docs/sdks/v3/README.md#getconversion) - Get a single conversion by its Formance ID +* [GetOrder](docs/sdks/v3/README.md#getorder) - Get a single order by its Formance ID * [GetPayment](docs/sdks/v3/README.md#getpayment) - Get a payment by ID * [GetPaymentInitiation](docs/sdks/v3/README.md#getpaymentinitiation) - Get a payment initiation by ID * [GetPaymentServiceUser](docs/sdks/v3/README.md#getpaymentserviceuser) - Get a payment service user by ID @@ -379,6 +381,8 @@ func main() { * [ListConnectorScheduleInstances](docs/sdks/v3/README.md#listconnectorscheduleinstances) - List all connector schedule instances * [ListConnectorSchedules](docs/sdks/v3/README.md#listconnectorschedules) - List all connector schedules * [ListConnectors](docs/sdks/v3/README.md#listconnectors) - List all connectors +* [ListConversions](docs/sdks/v3/README.md#listconversions) - List currency and asset conversions ingested from connectors +* [ListOrders](docs/sdks/v3/README.md#listorders) - List orders ingested from exchange-style connectors * [ListPaymentInitiationAdjustments](docs/sdks/v3/README.md#listpaymentinitiationadjustments) - List all payment initiation adjustments * [ListPaymentInitiationRelatedPayments](docs/sdks/v3/README.md#listpaymentinitiationrelatedpayments) - List all payments related to a payment initiation * [ListPaymentInitiations](docs/sdks/v3/README.md#listpaymentinitiations) - List all payment initiations diff --git a/pkg/stack/docs/pkg/models/operations/v3getconversionrequest.md b/pkg/stack/docs/pkg/models/operations/v3getconversionrequest.md new file mode 100644 index 0000000..84847a3 --- /dev/null +++ b/pkg/stack/docs/pkg/models/operations/v3getconversionrequest.md @@ -0,0 +1,8 @@ +# V3GetConversionRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `ConversionID` | `string` | :heavy_check_mark: | The conversion ID | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/operations/v3getconversionresponse.md b/pkg/stack/docs/pkg/models/operations/v3getconversionresponse.md new file mode 100644 index 0000000..c46abc8 --- /dev/null +++ b/pkg/stack/docs/pkg/models/operations/v3getconversionresponse.md @@ -0,0 +1,12 @@ +# V3GetConversionResponse + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `ContentType` | `string` | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | `int` | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `V3ErrorResponse` | [*shared.V3ErrorResponse](../../../pkg/models/shared/v3errorresponse.md) | :heavy_minus_sign: | Error | +| `V3GetConversionResponse` | [*shared.V3GetConversionResponse](../../../pkg/models/shared/v3getconversionresponse.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/operations/v3getorderrequest.md b/pkg/stack/docs/pkg/models/operations/v3getorderrequest.md new file mode 100644 index 0000000..fe3cefc --- /dev/null +++ b/pkg/stack/docs/pkg/models/operations/v3getorderrequest.md @@ -0,0 +1,8 @@ +# V3GetOrderRequest + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `OrderID` | `string` | :heavy_check_mark: | The order ID | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/operations/v3getorderresponse.md b/pkg/stack/docs/pkg/models/operations/v3getorderresponse.md new file mode 100644 index 0000000..988cfe5 --- /dev/null +++ b/pkg/stack/docs/pkg/models/operations/v3getorderresponse.md @@ -0,0 +1,12 @@ +# V3GetOrderResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `ContentType` | `string` | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | `int` | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `V3ErrorResponse` | [*shared.V3ErrorResponse](../../../pkg/models/shared/v3errorresponse.md) | :heavy_minus_sign: | Error | +| `V3GetOrderResponse` | [*shared.V3GetOrderResponse](../../../pkg/models/shared/v3getorderresponse.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/operations/v3listconversionsrequest.md b/pkg/stack/docs/pkg/models/operations/v3listconversionsrequest.md new file mode 100644 index 0000000..2e7005e --- /dev/null +++ b/pkg/stack/docs/pkg/models/operations/v3listconversionsrequest.md @@ -0,0 +1,10 @@ +# V3ListConversionsRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Cursor` | `*string` | :heavy_minus_sign: | Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set.
| aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== | +| `PageSize` | `*int64` | :heavy_minus_sign: | The number of items to return | 100 | +| `Query` | map[string]`any` | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/operations/v3listconversionsresponse.md b/pkg/stack/docs/pkg/models/operations/v3listconversionsresponse.md new file mode 100644 index 0000000..95af063 --- /dev/null +++ b/pkg/stack/docs/pkg/models/operations/v3listconversionsresponse.md @@ -0,0 +1,12 @@ +# V3ListConversionsResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `ContentType` | `string` | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | `int` | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `V3ConversionsCursorResponse` | [*shared.V3ConversionsCursorResponse](../../../pkg/models/shared/v3conversionscursorresponse.md) | :heavy_minus_sign: | OK | +| `V3ErrorResponse` | [*shared.V3ErrorResponse](../../../pkg/models/shared/v3errorresponse.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/operations/v3listordersrequest.md b/pkg/stack/docs/pkg/models/operations/v3listordersrequest.md new file mode 100644 index 0000000..588c3d7 --- /dev/null +++ b/pkg/stack/docs/pkg/models/operations/v3listordersrequest.md @@ -0,0 +1,10 @@ +# V3ListOrdersRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Cursor` | `*string` | :heavy_minus_sign: | Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set.
| aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ== | +| `PageSize` | `*int64` | :heavy_minus_sign: | The number of items to return | 100 | +| `Query` | map[string]`any` | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/operations/v3listordersresponse.md b/pkg/stack/docs/pkg/models/operations/v3listordersresponse.md new file mode 100644 index 0000000..94dcc77 --- /dev/null +++ b/pkg/stack/docs/pkg/models/operations/v3listordersresponse.md @@ -0,0 +1,12 @@ +# V3ListOrdersResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `ContentType` | `string` | :heavy_check_mark: | HTTP response content type for this operation | +| `StatusCode` | `int` | :heavy_check_mark: | HTTP response status code for this operation | +| `RawResponse` | [*http.Response](https://pkg.go.dev/net/http#Response) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `V3ErrorResponse` | [*shared.V3ErrorResponse](../../../pkg/models/shared/v3errorresponse.md) | :heavy_minus_sign: | Error | +| `V3OrdersCursorResponse` | [*shared.V3OrdersCursorResponse](../../../pkg/models/shared/v3orderscursorresponse.md) | :heavy_minus_sign: | OK | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/activitycreatetransferinitiation.md b/pkg/stack/docs/pkg/models/shared/activitycreatetransferinitiation.md new file mode 100644 index 0000000..ceb5aca --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/activitycreatetransferinitiation.md @@ -0,0 +1,17 @@ +# ActivityCreateTransferInitiation + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Amount` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | N/A | 100 | +| `Asset` | `*string` | :heavy_minus_sign: | N/A | USD | +| `ConnectorID` | `*string` | :heavy_minus_sign: | N/A | | +| `Description` | `*string` | :heavy_minus_sign: | Description for the transfer initiation | | +| `Destination` | `*string` | :heavy_minus_sign: | Destination account ID | acct_1Gqj58KZcSIg2N2q | +| `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format.
| {
"order_id": "6735"
} | +| `Provider` | `*string` | :heavy_minus_sign: | Payment service provider name (e.g., stripe, wise, mangopay).
Validated by the Payments service based on installed connectors.
| stripe | +| `Source` | `*string` | :heavy_minus_sign: | Source account ID (required for TRANSFER type) | | +| `Type` | [*shared.Type](../../../pkg/models/shared/type.md) | :heavy_minus_sign: | Type of transfer initiation:
- TRANSFER: Internal to internal account transfer
- PAYOUT: Internal to external account payout
| | +| `WaitingValidation` | `*bool` | :heavy_minus_sign: | N/A | false | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/activitystripetransfer.md b/pkg/stack/docs/pkg/models/shared/activitystripetransfer.md index 6877e7f..8981afb 100644 --- a/pkg/stack/docs/pkg/models/shared/activitystripetransfer.md +++ b/pkg/stack/docs/pkg/models/shared/activitystripetransfer.md @@ -9,5 +9,5 @@ | `Asset` | `*string` | :heavy_minus_sign: | N/A | USD | | `ConnectorID` | `*string` | :heavy_minus_sign: | N/A | | | `Destination` | `*string` | :heavy_minus_sign: | N/A | acct_1Gqj58KZcSIg2N2q | -| `Metadata` | [*shared.Metadata](../../../pkg/models/shared/metadata.md) | :heavy_minus_sign: | A set of key/value pairs that you can attach to a transfer object.
It can be useful for storing additional information about the transfer in a structured format.
| {
"order_id": "6735"
} | +| `Metadata` | [*shared.ActivityStripeTransferMetadata](../../../pkg/models/shared/activitystripetransfermetadata.md) | :heavy_minus_sign: | A set of key/value pairs that you can attach to a transfer object.
It can be useful for storing additional information about the transfer in a structured format.
| {
"order_id": "6735"
} | | `WaitingValidation` | `*bool` | :heavy_minus_sign: | N/A | false | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/activitystripetransfermetadata.md b/pkg/stack/docs/pkg/models/shared/activitystripetransfermetadata.md new file mode 100644 index 0000000..055e707 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/activitystripetransfermetadata.md @@ -0,0 +1,11 @@ +# ActivityStripeTransferMetadata + +A set of key/value pairs that you can attach to a transfer object. +It can be useful for storing additional information about the transfer in a structured format. + + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/log.md b/pkg/stack/docs/pkg/models/shared/log.md index 5fd4cbf..c380ab7 100644 --- a/pkg/stack/docs/pkg/models/shared/log.md +++ b/pkg/stack/docs/pkg/models/shared/log.md @@ -9,4 +9,4 @@ | `Date` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | N/A | | | `Hash` | `string` | :heavy_check_mark: | N/A | 9ee060170400f556b7e1575cb13f9db004f150a08355c7431c62bc639166431e | | `ID` | `int64` | :heavy_check_mark: | N/A | 1234 | -| `Type` | [shared.Type](../../../pkg/models/shared/type.md) | :heavy_check_mark: | N/A | | \ No newline at end of file +| `Type` | [shared.LogType](../../../pkg/models/shared/logtype.md) | :heavy_check_mark: | N/A | | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/logtype.md b/pkg/stack/docs/pkg/models/shared/logtype.md new file mode 100644 index 0000000..6c9c8c8 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/logtype.md @@ -0,0 +1,19 @@ +# LogType + +## Example Usage + +```go +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" +) + +value := shared.LogTypeNewTransaction +``` + + +## Values + +| Name | Value | +| ----------------------- | ----------------------- | +| `LogTypeNewTransaction` | NEW_TRANSACTION | +| `LogTypeSetMetadata` | SET_METADATA | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/metadata.md b/pkg/stack/docs/pkg/models/shared/metadata.md index c10fe9f..b6437a4 100644 --- a/pkg/stack/docs/pkg/models/shared/metadata.md +++ b/pkg/stack/docs/pkg/models/shared/metadata.md @@ -1,7 +1,6 @@ # Metadata -A set of key/value pairs that you can attach to a transfer object. -It can be useful for storing additional information about the transfer in a structured format. +A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format. diff --git a/pkg/stack/docs/pkg/models/shared/stagesenddestinationaccount.md b/pkg/stack/docs/pkg/models/shared/stagesenddestinationaccount.md index 5fc590b..7cf6160 100644 --- a/pkg/stack/docs/pkg/models/shared/stagesenddestinationaccount.md +++ b/pkg/stack/docs/pkg/models/shared/stagesenddestinationaccount.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | -| `Ledger` | `*string` | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AllowOverdraft` | `*bool` | :heavy_minus_sign: | Enables unbounded overdraft on the throughAccount when set to true.
This is useful when the throughAccount represents a liability or bridge account
that needs to go negative (e.g., "liabilities:payouts-pending").
Only applies when throughAccount is not "world" (which already has unbounded overdraft).
| true | +| `ID` | `string` | :heavy_check_mark: | N/A | | +| `Ledger` | `*string` | :heavy_minus_sign: | N/A | | +| `ThroughAccount` | `*string` | :heavy_minus_sign: | Account used when this ledger account interacts with external systems (payments, cross-ledger).
- As SOURCE going to payment: funds are sent to this account (e.g., "liabilities:payouts-pending")
- As DESTINATION from payment: funds come from this account (e.g., "assets:stripe:incoming")
- For cross-ledger transfers: replaces "world" on both sides
| liabilities:payouts-pending | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/stagesenddestinationpayment.md b/pkg/stack/docs/pkg/models/shared/stagesenddestinationpayment.md index be75a5a..571b430 100644 --- a/pkg/stack/docs/pkg/models/shared/stagesenddestinationpayment.md +++ b/pkg/stack/docs/pkg/models/shared/stagesenddestinationpayment.md @@ -3,6 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `Psp` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Psp` | `string` | :heavy_check_mark: | Payment service provider name (e.g., stripe, wise, mangopay).
Validated by the Payments service based on installed connectors.
| stripe | +| `SourceAccount` | `*string` | :heavy_minus_sign: | Formance Payments account ID for the source (internal PSP account).
If not specified, the Payments service may use a default account for the connector.
| | +| `Type` | [*shared.StageSendDestinationPaymentType](../../../pkg/models/shared/stagesenddestinationpaymenttype.md) | :heavy_minus_sign: | Type of transfer initiation:
- TRANSFER: Internal to internal account transfer
- PAYOUT: Internal to external account payout
| PAYOUT | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/stagesenddestinationpaymenttype.md b/pkg/stack/docs/pkg/models/shared/stagesenddestinationpaymenttype.md new file mode 100644 index 0000000..c86e0be --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/stagesenddestinationpaymenttype.md @@ -0,0 +1,24 @@ +# StageSendDestinationPaymentType + +Type of transfer initiation: +- TRANSFER: Internal to internal account transfer +- PAYOUT: Internal to external account payout + + +## Example Usage + +```go +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" +) + +value := shared.StageSendDestinationPaymentTypeTransfer +``` + + +## Values + +| Name | Value | +| ----------------------------------------- | ----------------------------------------- | +| `StageSendDestinationPaymentTypeTransfer` | TRANSFER | +| `StageSendDestinationPaymentTypePayout` | PAYOUT | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/stagesendsourcepayment.md b/pkg/stack/docs/pkg/models/shared/stagesendsourcepayment.md index 2bb6edf..46d6217 100644 --- a/pkg/stack/docs/pkg/models/shared/stagesendsourcepayment.md +++ b/pkg/stack/docs/pkg/models/shared/stagesendsourcepayment.md @@ -3,6 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AllowOverdraft` | `*bool` | :heavy_minus_sign: | Enables unbounded overdraft on the throughAccount when set to true.
Only applies when throughAccount is not "world" (which already has unbounded overdraft).
| +| `HoldingAccount` | `*string` | :heavy_minus_sign: | Intermediate account where payment funds are held.
Defaults to "payment:{paymentID}" format.
| +| `ID` | `string` | :heavy_check_mark: | N/A | +| `Ledger` | `*string` | :heavy_minus_sign: | Ledger to use for payment ingestion.
Defaults to the internal orchestration ledger.
| +| `ThroughAccount` | `*string` | :heavy_minus_sign: | Source account for the payment ingestion transaction.
Defaults to "world".
| \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/type.md b/pkg/stack/docs/pkg/models/shared/type.md index 35d7e41..3f49894 100644 --- a/pkg/stack/docs/pkg/models/shared/type.md +++ b/pkg/stack/docs/pkg/models/shared/type.md @@ -1,5 +1,10 @@ # Type +Type of transfer initiation: +- TRANSFER: Internal to internal account transfer +- PAYOUT: Internal to external account payout + + ## Example Usage ```go @@ -7,13 +12,13 @@ import ( "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" ) -value := shared.TypeNewTransaction +value := shared.TypeTransfer ``` ## Values -| Name | Value | -| -------------------- | -------------------- | -| `TypeNewTransaction` | NEW_TRANSACTION | -| `TypeSetMetadata` | SET_METADATA | \ No newline at end of file +| Name | Value | +| -------------- | -------------- | +| `TypeTransfer` | TRANSFER | +| `TypePayout` | PAYOUT | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v2activitycreatetransferinitiation.md b/pkg/stack/docs/pkg/models/shared/v2activitycreatetransferinitiation.md new file mode 100644 index 0000000..b45ad01 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v2activitycreatetransferinitiation.md @@ -0,0 +1,17 @@ +# V2ActivityCreateTransferInitiation + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `Amount` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | N/A | 100 | +| `Asset` | `*string` | :heavy_minus_sign: | N/A | USD | +| `ConnectorID` | `*string` | :heavy_minus_sign: | N/A | | +| `Description` | `*string` | :heavy_minus_sign: | Description for the transfer initiation | | +| `Destination` | `*string` | :heavy_minus_sign: | Destination account ID | acct_1Gqj58KZcSIg2N2q | +| `Metadata` | [*shared.V2ActivityCreateTransferInitiationMetadata](../../../pkg/models/shared/v2activitycreatetransferinitiationmetadata.md) | :heavy_minus_sign: | A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format.
| {
"order_id": "6735"
} | +| `Provider` | `*string` | :heavy_minus_sign: | Payment service provider name (e.g., stripe, wise, mangopay).
Validated by the Payments service based on installed connectors.
| stripe | +| `Source` | `*string` | :heavy_minus_sign: | Source account ID (required for TRANSFER type) | | +| `Type` | [*shared.V2ActivityCreateTransferInitiationType](../../../pkg/models/shared/v2activitycreatetransferinitiationtype.md) | :heavy_minus_sign: | Type of transfer initiation:
- TRANSFER: Internal to internal account transfer
- PAYOUT: Internal to external account payout
| | +| `WaitingValidation` | `*bool` | :heavy_minus_sign: | N/A | false | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v2activitycreatetransferinitiationmetadata.md b/pkg/stack/docs/pkg/models/shared/v2activitycreatetransferinitiationmetadata.md new file mode 100644 index 0000000..58cc736 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v2activitycreatetransferinitiationmetadata.md @@ -0,0 +1,10 @@ +# V2ActivityCreateTransferInitiationMetadata + +A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format. + + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v2activitycreatetransferinitiationtype.md b/pkg/stack/docs/pkg/models/shared/v2activitycreatetransferinitiationtype.md new file mode 100644 index 0000000..af41337 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v2activitycreatetransferinitiationtype.md @@ -0,0 +1,24 @@ +# V2ActivityCreateTransferInitiationType + +Type of transfer initiation: +- TRANSFER: Internal to internal account transfer +- PAYOUT: Internal to external account payout + + +## Example Usage + +```go +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" +) + +value := shared.V2ActivityCreateTransferInitiationTypeTransfer +``` + + +## Values + +| Name | Value | +| ------------------------------------------------ | ------------------------------------------------ | +| `V2ActivityCreateTransferInitiationTypeTransfer` | TRANSFER | +| `V2ActivityCreateTransferInitiationTypePayout` | PAYOUT | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationaccount.md b/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationaccount.md index 53d9d3a..2b18171 100644 --- a/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationaccount.md +++ b/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationaccount.md @@ -3,7 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | -| `Ledger` | `*string` | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AllowOverdraft` | `*bool` | :heavy_minus_sign: | Enables unbounded overdraft on the throughAccount when set to true.
This is useful when the throughAccount represents a liability or bridge account
that needs to go negative (e.g., "liabilities:payouts-pending").
Only applies when throughAccount is not "world" (which already has unbounded overdraft).
| true | +| `ID` | `string` | :heavy_check_mark: | N/A | | +| `Ledger` | `*string` | :heavy_minus_sign: | N/A | | +| `ThroughAccount` | `*string` | :heavy_minus_sign: | Account used when this ledger account interacts with external systems (payments, cross-ledger).
- As SOURCE going to payment: funds are sent to this account (e.g., "liabilities:payouts-pending")
- As DESTINATION from payment: funds come from this account (e.g., "assets:stripe:incoming")
- For cross-ledger transfers: replaces "world" on both sides
| liabilities:payouts-pending | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationpayment.md b/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationpayment.md index 26f0a2f..40b36fe 100644 --- a/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationpayment.md +++ b/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationpayment.md @@ -3,6 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `Psp` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | Example | +| -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Psp` | `string` | :heavy_check_mark: | Payment service provider name (e.g., stripe, wise, mangopay).
Validated by the Payments service based on installed connectors.
| stripe | +| `SourceAccount` | `*string` | :heavy_minus_sign: | Formance Payments account ID for the source (internal PSP account).
If not specified, the Payments service may use a default account for the connector.
| | +| `Type` | [*shared.V2StageSendDestinationPaymentType](../../../pkg/models/shared/v2stagesenddestinationpaymenttype.md) | :heavy_minus_sign: | Type of transfer initiation:
- TRANSFER: Internal to internal account transfer
- PAYOUT: Internal to external account payout
| PAYOUT | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationpaymenttype.md b/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationpaymenttype.md new file mode 100644 index 0000000..b63477c --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v2stagesenddestinationpaymenttype.md @@ -0,0 +1,24 @@ +# V2StageSendDestinationPaymentType + +Type of transfer initiation: +- TRANSFER: Internal to internal account transfer +- PAYOUT: Internal to external account payout + + +## Example Usage + +```go +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" +) + +value := shared.V2StageSendDestinationPaymentTypeTransfer +``` + + +## Values + +| Name | Value | +| ------------------------------------------- | ------------------------------------------- | +| `V2StageSendDestinationPaymentTypeTransfer` | TRANSFER | +| `V2StageSendDestinationPaymentTypePayout` | PAYOUT | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v2stagesendsourcepayment.md b/pkg/stack/docs/pkg/models/shared/v2stagesendsourcepayment.md index c6b88b2..721f6f6 100644 --- a/pkg/stack/docs/pkg/models/shared/v2stagesendsourcepayment.md +++ b/pkg/stack/docs/pkg/models/shared/v2stagesendsourcepayment.md @@ -3,6 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------ | ------------------ | ------------------ | ------------------ | -| `ID` | `string` | :heavy_check_mark: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `AllowOverdraft` | `*bool` | :heavy_minus_sign: | Enables unbounded overdraft on the throughAccount when set to true.
Only applies when throughAccount is not "world" (which already has unbounded overdraft).
| +| `HoldingAccount` | `*string` | :heavy_minus_sign: | Intermediate account where payment funds are held.
Defaults to "payment:{paymentID}" format.
| +| `ID` | `string` | :heavy_check_mark: | N/A | +| `Ledger` | `*string` | :heavy_minus_sign: | Ledger to use for payment ingestion.
Defaults to the internal orchestration ledger.
| +| `ThroughAccount` | `*string` | :heavy_minus_sign: | Source account for the payment ingestion transaction.
Defaults to "world".
| \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v2workflowinstancehistorystageinput.md b/pkg/stack/docs/pkg/models/shared/v2workflowinstancehistorystageinput.md index b4369d5..dbac6f8 100644 --- a/pkg/stack/docs/pkg/models/shared/v2workflowinstancehistorystageinput.md +++ b/pkg/stack/docs/pkg/models/shared/v2workflowinstancehistorystageinput.md @@ -3,16 +3,17 @@ ## Fields -| Field | Type | Required | Description | -| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -| `AddAccountMetadata` | [*shared.V2ActivityAddAccountMetadata](../../../pkg/models/shared/v2activityaddaccountmetadata.md) | :heavy_minus_sign: | N/A | -| `ConfirmHold` | [*shared.V2ActivityConfirmHold](../../../pkg/models/shared/v2activityconfirmhold.md) | :heavy_minus_sign: | N/A | -| `CreateTransaction` | [*shared.V2ActivityCreateTransaction](../../../pkg/models/shared/v2activitycreatetransaction.md) | :heavy_minus_sign: | N/A | -| `CreditWallet` | [*shared.V2ActivityCreditWallet](../../../pkg/models/shared/v2activitycreditwallet.md) | :heavy_minus_sign: | N/A | -| `DebitWallet` | [*shared.V2ActivityDebitWallet](../../../pkg/models/shared/v2activitydebitwallet.md) | :heavy_minus_sign: | N/A | -| `GetAccount` | [*shared.V2ActivityGetAccount](../../../pkg/models/shared/v2activitygetaccount.md) | :heavy_minus_sign: | N/A | -| `GetPayment` | [*shared.V2ActivityGetPayment](../../../pkg/models/shared/v2activitygetpayment.md) | :heavy_minus_sign: | N/A | -| `GetWallet` | [*shared.V2ActivityGetWallet](../../../pkg/models/shared/v2activitygetwallet.md) | :heavy_minus_sign: | N/A | -| `ListWallets` | [*shared.V2ActivityListWallets](../../../pkg/models/shared/v2activitylistwallets.md) | :heavy_minus_sign: | N/A | -| `StripeTransfer` | [*shared.V2ActivityStripeTransfer](../../../pkg/models/shared/v2activitystripetransfer.md) | :heavy_minus_sign: | N/A | -| `VoidHold` | [*shared.V2ActivityVoidHold](../../../pkg/models/shared/v2activityvoidhold.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `AddAccountMetadata` | [*shared.V2ActivityAddAccountMetadata](../../../pkg/models/shared/v2activityaddaccountmetadata.md) | :heavy_minus_sign: | N/A | +| `ConfirmHold` | [*shared.V2ActivityConfirmHold](../../../pkg/models/shared/v2activityconfirmhold.md) | :heavy_minus_sign: | N/A | +| `CreateTransaction` | [*shared.V2ActivityCreateTransaction](../../../pkg/models/shared/v2activitycreatetransaction.md) | :heavy_minus_sign: | N/A | +| `CreateTransferInitiation` | [*shared.V2ActivityCreateTransferInitiation](../../../pkg/models/shared/v2activitycreatetransferinitiation.md) | :heavy_minus_sign: | N/A | +| `CreditWallet` | [*shared.V2ActivityCreditWallet](../../../pkg/models/shared/v2activitycreditwallet.md) | :heavy_minus_sign: | N/A | +| `DebitWallet` | [*shared.V2ActivityDebitWallet](../../../pkg/models/shared/v2activitydebitwallet.md) | :heavy_minus_sign: | N/A | +| `GetAccount` | [*shared.V2ActivityGetAccount](../../../pkg/models/shared/v2activitygetaccount.md) | :heavy_minus_sign: | N/A | +| `GetPayment` | [*shared.V2ActivityGetPayment](../../../pkg/models/shared/v2activitygetpayment.md) | :heavy_minus_sign: | N/A | +| `GetWallet` | [*shared.V2ActivityGetWallet](../../../pkg/models/shared/v2activitygetwallet.md) | :heavy_minus_sign: | N/A | +| `ListWallets` | [*shared.V2ActivityListWallets](../../../pkg/models/shared/v2activitylistwallets.md) | :heavy_minus_sign: | N/A | +| `StripeTransfer` | [*shared.V2ActivityStripeTransfer](../../../pkg/models/shared/v2activitystripetransfer.md) | :heavy_minus_sign: | N/A | +| `VoidHold` | [*shared.V2ActivityVoidHold](../../../pkg/models/shared/v2activityvoidhold.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3conversion.md b/pkg/stack/docs/pkg/models/shared/v3conversion.md new file mode 100644 index 0000000..382ce29 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3conversion.md @@ -0,0 +1,31 @@ +# V3Conversion + +A currency or asset conversion executed on a PSP (e.g. Coinbase Prime +transfer between a USD and USDC wallet). Conversions are read-only in +the Formance API: they are fetched from the underlying connector. +Unlike orders, conversions do not carry an adjustment history — +Formance records the final state only. + + + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ConnectorID` | `string` | :heavy_check_mark: | ID of the Formance connector this conversion was fetched from. | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | When the conversion was initiated on the PSP. | +| `DestinationAccountID` | `*string` | :heavy_minus_sign: | Formance account ID of the wallet the destination asset was credited to. | +| `DestinationAmount` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | Amount of destination asset credited, at `destinationAsset` precision. Null until the conversion completes. | +| `DestinationAsset` | `string` | :heavy_check_mark: | Asset being converted to, in `SYMBOL/precision` form (e.g. `USDC/6`). | +| `Error` | `*string` | :heavy_minus_sign: | Human-readable error from the PSP when `status` is `FAILED`. Null otherwise. | +| `Fee` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | PSP fee for the conversion, at `feeAsset` precision. | +| `FeeAsset` | `*string` | :heavy_minus_sign: | Currency the fee is denominated in, in `SYMBOL/precision` form. | +| `ID` | `string` | :heavy_check_mark: | Formance-assigned unique conversion ID. | +| `Metadata` | map[string]`string` | :heavy_minus_sign: | N/A | +| `Provider` | `string` | :heavy_check_mark: | Provider name of the connector (e.g. `coinbaseprime`). | +| `Reference` | `string` | :heavy_check_mark: | PSP-assigned conversion reference. Unique within the connector. | +| `SourceAccountID` | `*string` | :heavy_minus_sign: | Formance account ID of the wallet the source asset was debited from. | +| `SourceAmount` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_check_mark: | Amount of source asset debited, as an integer at `sourceAsset` precision. | +| `SourceAsset` | `string` | :heavy_check_mark: | Asset being converted from, in `SYMBOL/precision` form (e.g. `USD/2`). | +| `Status` | [shared.V3ConversionStatusEnum](../../../pkg/models/shared/v3conversionstatusenum.md) | :heavy_check_mark: | Lifecycle of a conversion.
`PENDING` — accepted by the PSP, not yet settled.
`COMPLETED` — settled, terminal.
`FAILED` — rejected or reverted, terminal. See `error`.
| +| `UpdatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | When Formance last observed a state change on the conversion. | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3conversionscursorresponse.md b/pkg/stack/docs/pkg/models/shared/v3conversionscursorresponse.md new file mode 100644 index 0000000..4a8a41b --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3conversionscursorresponse.md @@ -0,0 +1,8 @@ +# V3ConversionsCursorResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| `Cursor` | [shared.V3ConversionsCursorResponseCursor](../../../pkg/models/shared/v3conversionscursorresponsecursor.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3conversionscursorresponsecursor.md b/pkg/stack/docs/pkg/models/shared/v3conversionscursorresponsecursor.md new file mode 100644 index 0000000..606659a --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3conversionscursorresponsecursor.md @@ -0,0 +1,12 @@ +# V3ConversionsCursorResponseCursor + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `Data` | [][shared.V3Conversion](../../../pkg/models/shared/v3conversion.md) | :heavy_check_mark: | N/A | | +| `HasMore` | `bool` | :heavy_check_mark: | N/A | false | +| `Next` | `*string` | :heavy_minus_sign: | N/A | | +| `PageSize` | `int64` | :heavy_check_mark: | N/A | 15 | +| `Previous` | `*string` | :heavy_minus_sign: | N/A | YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3conversionstatusenum.md b/pkg/stack/docs/pkg/models/shared/v3conversionstatusenum.md new file mode 100644 index 0000000..e91240a --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3conversionstatusenum.md @@ -0,0 +1,27 @@ +# V3ConversionStatusEnum + +Lifecycle of a conversion. +`PENDING` — accepted by the PSP, not yet settled. +`COMPLETED` — settled, terminal. +`FAILED` — rejected or reverted, terminal. See `error`. + + +## Example Usage + +```go +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" +) + +value := shared.V3ConversionStatusEnumUnknown +``` + + +## Values + +| Name | Value | +| --------------------------------- | --------------------------------- | +| `V3ConversionStatusEnumUnknown` | UNKNOWN | +| `V3ConversionStatusEnumPending` | PENDING | +| `V3ConversionStatusEnumCompleted` | COMPLETED | +| `V3ConversionStatusEnumFailed` | FAILED | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3getconversionresponse.md b/pkg/stack/docs/pkg/models/shared/v3getconversionresponse.md new file mode 100644 index 0000000..7ba8b0b --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3getconversionresponse.md @@ -0,0 +1,8 @@ +# V3GetConversionResponse + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Data` | [shared.V3Conversion](../../../pkg/models/shared/v3conversion.md) | :heavy_check_mark: | A currency or asset conversion executed on a PSP (e.g. Coinbase Prime
transfer between a USD and USDC wallet). Conversions are read-only in
the Formance API: they are fetched from the underlying connector.
Unlike orders, conversions do not carry an adjustment history —
Formance records the final state only.
| \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3getorderresponse.md b/pkg/stack/docs/pkg/models/shared/v3getorderresponse.md new file mode 100644 index 0000000..00b9ea3 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3getorderresponse.md @@ -0,0 +1,8 @@ +# V3GetOrderResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Data` | [shared.V3Order](../../../pkg/models/shared/v3order.md) | :heavy_check_mark: | A trade order submitted to an exchange-style PSP. Orders are read-only
in the Formance API: they are fetched from the underlying connector.
Status transitions are captured via the `adjustments` array; each
adjustment is a point-in-time snapshot from the PSP.
| \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3order.md b/pkg/stack/docs/pkg/models/shared/v3order.md new file mode 100644 index 0000000..be96c7a --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3order.md @@ -0,0 +1,42 @@ +# V3Order + +A trade order submitted to an exchange-style PSP. Orders are read-only +in the Formance API: they are fetched from the underlying connector. +Status transitions are captured via the `adjustments` array; each +adjustment is a point-in-time snapshot from the PSP. + + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Adjustments` | [][shared.V3OrderAdjustment](../../../pkg/models/shared/v3orderadjustment.md) | :heavy_minus_sign: | Ordered history of state snapshots for this order. The most recent element reflects the current `status`. | +| `AverageFillPrice` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | Volume-weighted average price across all fills so far, in `priceAsset` precision. Analytics field — may be absent if the PSP does not report it. | +| `BaseQuantityFilled` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | Amount of base asset filled so far, as an integer at the base asset's precision. Null before any fill. | +| `BaseQuantityOrdered` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_check_mark: | Amount of base asset the order was placed for, as an integer at the base asset's precision. | +| `ClientOrderID` | `*string` | :heavy_minus_sign: | Client-assigned ID supplied to the PSP for placement idempotency
(e.g. Coinbase `client_order_id`, Kraken `cl_ord_id`, Binance
`clientOrderId`). Stored for traceability only — Formance does
NOT dedup on this field.
| +| `ConnectorID` | `string` | :heavy_check_mark: | ID of the Formance connector this order was fetched from. | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | When the order was created on the PSP. | +| `DestinationAccountID` | `*string` | :heavy_minus_sign: | Formance account ID of the wallet the destination asset was credited to. Null if unresolvable. | +| `DestinationAsset` | `string` | :heavy_check_mark: | Asset being received, in `SYMBOL/precision` form.
For BUY: the base currency. For SELL: the quote currency.
| +| `Direction` | [shared.V3OrderDirectionEnum](../../../pkg/models/shared/v3orderdirectionenum.md) | :heavy_check_mark: | Whether an order buys or sells the base asset. | +| `Error` | `*string` | :heavy_minus_sign: | Human-readable error from the PSP (e.g. rejection reason) when `status` is `FAILED`. Null otherwise. | +| `ExpiresAt` | [*time.Time](https://pkg.go.dev/time#Time) | :heavy_minus_sign: | Expiration instant for `GOOD_UNTIL_DATE_TIME` orders. Null for other time-in-force values. | +| `Fee` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | Commission charged by the PSP for the order, as an integer in `feeAsset` precision. | +| `FeeAsset` | `*string` | :heavy_minus_sign: | Currency the fee is denominated in, in `SYMBOL/precision` form. Typically the quote asset. | +| `ID` | `string` | :heavy_check_mark: | Formance-assigned unique order ID (composed from the PSP reference and connector ID). | +| `LimitPrice` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | Maximum price (for BUY) or minimum price (for SELL) at which the order may execute, in `priceAsset` precision. Required for LIMIT-family order types; null otherwise. | +| `Metadata` | map[string]`string` | :heavy_minus_sign: | N/A | +| `PriceAsset` | `*string` | :heavy_minus_sign: | Currency + precision under which `limitPrice`, `stopPrice`, and
`averageFillPrice` should be interpreted. Separate from
`quoteAsset` because some PSPs return price strings with more
decimal digits than the quote currency's natural precision.
| +| `Provider` | `string` | :heavy_check_mark: | Provider name of the connector (e.g. `coinbaseprime`). | +| `QuoteAmount` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | Total amount of quote currency exchanged so far, as reported by
the PSP (e.g. Coinbase `filled_value`), at `quoteAsset`
precision. For BUY: amount spent. For SELL: amount received.
| +| `QuoteAsset` | `*string` | :heavy_minus_sign: | Quote currency with precision (e.g. `USD/2`). Null when the order has no quote-side amounts reported yet. | +| `Reference` | `string` | :heavy_check_mark: | PSP-assigned order reference. Unique within the connector; used as the storage dedup key. | +| `SourceAccountID` | `*string` | :heavy_minus_sign: | Formance account ID of the wallet the source asset was debited
from. Null if the PSP did not return enough information to
resolve it at ingestion time.
| +| `SourceAsset` | `string` | :heavy_check_mark: | Asset being spent, in `SYMBOL/precision` form (e.g. `USD/2`,
`BTC/8`). For BUY: the quote currency. For SELL: the base
currency.
| +| `Status` | [shared.V3OrderStatusEnum](../../../pkg/models/shared/v3orderstatusenum.md) | :heavy_check_mark: | Lifecycle of an order on the exchange.
`PENDING` — accepted by the exchange, not yet working.
`OPEN` — live on the book, no fills yet.
`PARTIALLY_FILLED` — live on the book, some base quantity filled.
`FILLED` — fully filled, terminal.
`CANCELLED` — cancelled by the user or system, terminal.
`FAILED` — rejected by the exchange, terminal. See `error` for details.
`EXPIRED` — `timeInForce` elapsed before full fill, terminal.
| +| `StopPrice` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | Trigger price at which a STOP / STOP_LIMIT order activates, in `priceAsset` precision. Null for non-stop order types. | +| `TimeInForce` | [shared.V3TimeInForceEnum](../../../pkg/models/shared/v3timeinforceenum.md) | :heavy_check_mark: | How long an order is valid on the exchange.
`GOOD_UNTIL_CANCELLED` — rests until explicitly cancelled.
`GOOD_UNTIL_DATE_TIME` — rests until `expiresAt`.
`IMMEDIATE_OR_CANCEL` — fill immediately, cancel any unfilled portion.
`FILL_OR_KILL` — fill fully and immediately, or cancel entirely.
| +| `Type` | [shared.V3OrderTypeEnum](../../../pkg/models/shared/v3ordertypeenum.md) | :heavy_check_mark: | Exchange order type. Determines which price fields are meaningful on
`V3Order`: LIMIT-family types use `limitPrice`; STOP-family types use
`stopPrice`; TWAP/VWAP are time-weighted execution algorithms.
| +| `UpdatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | When Formance last observed a state change on the order. Equivalent to the latest adjustment's `createdAt`. | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3orderadjustment.md b/pkg/stack/docs/pkg/models/shared/v3orderadjustment.md new file mode 100644 index 0000000..6de03e1 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3orderadjustment.md @@ -0,0 +1,23 @@ +# V3OrderAdjustment + +Immutable snapshot of an order's state at a single observation. +Formance records one adjustment per distinct state the PSP reports +(status change, fill progress, fee update). Events are emitted +per-adjustment, not per-order — so a single order can produce many +events over its lifetime. + + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `BaseQuantityFilled` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | Base asset filled at this observation, at the base asset's precision. | +| `CreatedAt` | [time.Time](https://pkg.go.dev/time#Time) | :heavy_check_mark: | When Formance observed this state. Not the PSP's own timestamp — reflects ingestion time. | +| `Fee` | [*big.Int](https://pkg.go.dev/math/big#Int) | :heavy_minus_sign: | Cumulative fee at this observation, at `feeAsset` precision. | +| `FeeAsset` | `*string` | :heavy_minus_sign: | Currency the fee is denominated in, in `SYMBOL/precision` form. | +| `ID` | `string` | :heavy_check_mark: | Adjustment ID, composed from the order ID plus the state fields that define uniqueness (status, filled quantity, fee). Idempotent — replaying the same observation produces the same ID. | +| `Metadata` | map[string]`string` | :heavy_minus_sign: | N/A | +| `Raw` | [*shared.V3OrderAdjustmentRaw](../../../pkg/models/shared/v3orderadjustmentraw.md) | :heavy_minus_sign: | Untransformed PSP response payload that produced this adjustment. Retained for debugging and replay. | +| `Reference` | `string` | :heavy_check_mark: | PSP reference the adjustment belongs to (equal to the parent order's `reference`). | +| `Status` | [shared.V3OrderStatusEnum](../../../pkg/models/shared/v3orderstatusenum.md) | :heavy_check_mark: | Lifecycle of an order on the exchange.
`PENDING` — accepted by the exchange, not yet working.
`OPEN` — live on the book, no fills yet.
`PARTIALLY_FILLED` — live on the book, some base quantity filled.
`FILLED` — fully filled, terminal.
`CANCELLED` — cancelled by the user or system, terminal.
`FAILED` — rejected by the exchange, terminal. See `error` for details.
`EXPIRED` — `timeInForce` elapsed before full fill, terminal.
| \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3orderadjustmentraw.md b/pkg/stack/docs/pkg/models/shared/v3orderadjustmentraw.md new file mode 100644 index 0000000..40fdc07 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3orderadjustmentraw.md @@ -0,0 +1,9 @@ +# V3OrderAdjustmentRaw + +Untransformed PSP response payload that produced this adjustment. Retained for debugging and replay. + + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3orderdirectionenum.md b/pkg/stack/docs/pkg/models/shared/v3orderdirectionenum.md new file mode 100644 index 0000000..cd7d114 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3orderdirectionenum.md @@ -0,0 +1,22 @@ +# V3OrderDirectionEnum + +Whether an order buys or sells the base asset. + +## Example Usage + +```go +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" +) + +value := shared.V3OrderDirectionEnumUnknown +``` + + +## Values + +| Name | Value | +| ----------------------------- | ----------------------------- | +| `V3OrderDirectionEnumUnknown` | UNKNOWN | +| `V3OrderDirectionEnumBuy` | BUY | +| `V3OrderDirectionEnumSell` | SELL | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3orderscursorresponse.md b/pkg/stack/docs/pkg/models/shared/v3orderscursorresponse.md new file mode 100644 index 0000000..2e42794 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3orderscursorresponse.md @@ -0,0 +1,8 @@ +# V3OrdersCursorResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| `Cursor` | [shared.V3OrdersCursorResponseCursor](../../../pkg/models/shared/v3orderscursorresponsecursor.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3orderscursorresponsecursor.md b/pkg/stack/docs/pkg/models/shared/v3orderscursorresponsecursor.md new file mode 100644 index 0000000..ee3f721 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3orderscursorresponsecursor.md @@ -0,0 +1,12 @@ +# V3OrdersCursorResponseCursor + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- | +| `Data` | [][shared.V3Order](../../../pkg/models/shared/v3order.md) | :heavy_check_mark: | N/A | | +| `HasMore` | `bool` | :heavy_check_mark: | N/A | false | +| `Next` | `*string` | :heavy_minus_sign: | N/A | | +| `PageSize` | `int64` | :heavy_check_mark: | N/A | 15 | +| `Previous` | `*string` | :heavy_minus_sign: | N/A | YXVsdCBhbmQgYSBtYXhpbXVtIG1heF9yZXN1bHRzLol= | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3orderstatusenum.md b/pkg/stack/docs/pkg/models/shared/v3orderstatusenum.md new file mode 100644 index 0000000..3f8ec39 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3orderstatusenum.md @@ -0,0 +1,35 @@ +# V3OrderStatusEnum + +Lifecycle of an order on the exchange. +`PENDING` — accepted by the exchange, not yet working. +`OPEN` — live on the book, no fills yet. +`PARTIALLY_FILLED` — live on the book, some base quantity filled. +`FILLED` — fully filled, terminal. +`CANCELLED` — cancelled by the user or system, terminal. +`FAILED` — rejected by the exchange, terminal. See `error` for details. +`EXPIRED` — `timeInForce` elapsed before full fill, terminal. + + +## Example Usage + +```go +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" +) + +value := shared.V3OrderStatusEnumUnknown +``` + + +## Values + +| Name | Value | +| ---------------------------------- | ---------------------------------- | +| `V3OrderStatusEnumUnknown` | UNKNOWN | +| `V3OrderStatusEnumPending` | PENDING | +| `V3OrderStatusEnumOpen` | OPEN | +| `V3OrderStatusEnumPartiallyFilled` | PARTIALLY_FILLED | +| `V3OrderStatusEnumFilled` | FILLED | +| `V3OrderStatusEnumCancelled` | CANCELLED | +| `V3OrderStatusEnumFailed` | FAILED | +| `V3OrderStatusEnumExpired` | EXPIRED | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3ordertypeenum.md b/pkg/stack/docs/pkg/models/shared/v3ordertypeenum.md new file mode 100644 index 0000000..a4e504f --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3ordertypeenum.md @@ -0,0 +1,37 @@ +# V3OrderTypeEnum + +Exchange order type. Determines which price fields are meaningful on +`V3Order`: LIMIT-family types use `limitPrice`; STOP-family types use +`stopPrice`; TWAP/VWAP are time-weighted execution algorithms. + + +## Example Usage + +```go +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" +) + +value := shared.V3OrderTypeEnumUnknown +``` + + +## Values + +| Name | Value | +| ---------------------------------- | ---------------------------------- | +| `V3OrderTypeEnumUnknown` | UNKNOWN | +| `V3OrderTypeEnumMarket` | MARKET | +| `V3OrderTypeEnumLimit` | LIMIT | +| `V3OrderTypeEnumStopLimit` | STOP_LIMIT | +| `V3OrderTypeEnumStop` | STOP | +| `V3OrderTypeEnumTwap` | TWAP | +| `V3OrderTypeEnumVwap` | VWAP | +| `V3OrderTypeEnumPeg` | PEG | +| `V3OrderTypeEnumBlock` | BLOCK | +| `V3OrderTypeEnumRfq` | RFQ | +| `V3OrderTypeEnumTrailingStop` | TRAILING_STOP | +| `V3OrderTypeEnumTrailingStopLimit` | TRAILING_STOP_LIMIT | +| `V3OrderTypeEnumTakeProfit` | TAKE_PROFIT | +| `V3OrderTypeEnumTakeProfitLimit` | TAKE_PROFIT_LIMIT | +| `V3OrderTypeEnumLimitMaker` | LIMIT_MAKER | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/v3timeinforceenum.md b/pkg/stack/docs/pkg/models/shared/v3timeinforceenum.md new file mode 100644 index 0000000..a021e09 --- /dev/null +++ b/pkg/stack/docs/pkg/models/shared/v3timeinforceenum.md @@ -0,0 +1,29 @@ +# V3TimeInForceEnum + +How long an order is valid on the exchange. +`GOOD_UNTIL_CANCELLED` — rests until explicitly cancelled. +`GOOD_UNTIL_DATE_TIME` — rests until `expiresAt`. +`IMMEDIATE_OR_CANCEL` — fill immediately, cancel any unfilled portion. +`FILL_OR_KILL` — fill fully and immediately, or cancel entirely. + + +## Example Usage + +```go +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" +) + +value := shared.V3TimeInForceEnumUnknown +``` + + +## Values + +| Name | Value | +| ------------------------------------- | ------------------------------------- | +| `V3TimeInForceEnumUnknown` | UNKNOWN | +| `V3TimeInForceEnumGoodUntilCancelled` | GOOD_UNTIL_CANCELLED | +| `V3TimeInForceEnumGoodUntilDateTime` | GOOD_UNTIL_DATE_TIME | +| `V3TimeInForceEnumImmediateOrCancel` | IMMEDIATE_OR_CANCEL | +| `V3TimeInForceEnumFillOrKill` | FILL_OR_KILL | \ No newline at end of file diff --git a/pkg/stack/docs/pkg/models/shared/workflowinstancehistorystageinput.md b/pkg/stack/docs/pkg/models/shared/workflowinstancehistorystageinput.md index 84a8096..5436562 100644 --- a/pkg/stack/docs/pkg/models/shared/workflowinstancehistorystageinput.md +++ b/pkg/stack/docs/pkg/models/shared/workflowinstancehistorystageinput.md @@ -3,17 +3,18 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | -| `AddAccountMetadata` | [*shared.ActivityAddAccountMetadata](../../../pkg/models/shared/activityaddaccountmetadata.md) | :heavy_minus_sign: | N/A | -| `ConfirmHold` | [*shared.ActivityConfirmHold](../../../pkg/models/shared/activityconfirmhold.md) | :heavy_minus_sign: | N/A | -| `CreateTransaction` | [*shared.ActivityCreateTransaction](../../../pkg/models/shared/activitycreatetransaction.md) | :heavy_minus_sign: | N/A | -| `CreditWallet` | [*shared.ActivityCreditWallet](../../../pkg/models/shared/activitycreditwallet.md) | :heavy_minus_sign: | N/A | -| `DebitWallet` | [*shared.ActivityDebitWallet](../../../pkg/models/shared/activitydebitwallet.md) | :heavy_minus_sign: | N/A | -| `GetAccount` | [*shared.ActivityGetAccount](../../../pkg/models/shared/activitygetaccount.md) | :heavy_minus_sign: | N/A | -| `GetPayment` | [*shared.ActivityGetPayment](../../../pkg/models/shared/activitygetpayment.md) | :heavy_minus_sign: | N/A | -| `GetWallet` | [*shared.ActivityGetWallet](../../../pkg/models/shared/activitygetwallet.md) | :heavy_minus_sign: | N/A | -| `ListWallets` | [*shared.ActivityListWallets](../../../pkg/models/shared/activitylistwallets.md) | :heavy_minus_sign: | N/A | -| `RevertTransaction` | [*shared.ActivityRevertTransaction](../../../pkg/models/shared/activityreverttransaction.md) | :heavy_minus_sign: | N/A | -| `StripeTransfer` | [*shared.ActivityStripeTransfer](../../../pkg/models/shared/activitystripetransfer.md) | :heavy_minus_sign: | N/A | -| `VoidHold` | [*shared.ActivityVoidHold](../../../pkg/models/shared/activityvoidhold.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `AddAccountMetadata` | [*shared.ActivityAddAccountMetadata](../../../pkg/models/shared/activityaddaccountmetadata.md) | :heavy_minus_sign: | N/A | +| `ConfirmHold` | [*shared.ActivityConfirmHold](../../../pkg/models/shared/activityconfirmhold.md) | :heavy_minus_sign: | N/A | +| `CreateTransaction` | [*shared.ActivityCreateTransaction](../../../pkg/models/shared/activitycreatetransaction.md) | :heavy_minus_sign: | N/A | +| `CreateTransferInitiation` | [*shared.ActivityCreateTransferInitiation](../../../pkg/models/shared/activitycreatetransferinitiation.md) | :heavy_minus_sign: | N/A | +| `CreditWallet` | [*shared.ActivityCreditWallet](../../../pkg/models/shared/activitycreditwallet.md) | :heavy_minus_sign: | N/A | +| `DebitWallet` | [*shared.ActivityDebitWallet](../../../pkg/models/shared/activitydebitwallet.md) | :heavy_minus_sign: | N/A | +| `GetAccount` | [*shared.ActivityGetAccount](../../../pkg/models/shared/activitygetaccount.md) | :heavy_minus_sign: | N/A | +| `GetPayment` | [*shared.ActivityGetPayment](../../../pkg/models/shared/activitygetpayment.md) | :heavy_minus_sign: | N/A | +| `GetWallet` | [*shared.ActivityGetWallet](../../../pkg/models/shared/activitygetwallet.md) | :heavy_minus_sign: | N/A | +| `ListWallets` | [*shared.ActivityListWallets](../../../pkg/models/shared/activitylistwallets.md) | :heavy_minus_sign: | N/A | +| `RevertTransaction` | [*shared.ActivityRevertTransaction](../../../pkg/models/shared/activityreverttransaction.md) | :heavy_minus_sign: | N/A | +| `StripeTransfer` | [*shared.ActivityStripeTransfer](../../../pkg/models/shared/activitystripetransfer.md) | :heavy_minus_sign: | N/A | +| `VoidHold` | [*shared.ActivityVoidHold](../../../pkg/models/shared/activityvoidhold.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/pkg/stack/docs/sdks/v3/README.md b/pkg/stack/docs/sdks/v3/README.md index 20a0cb4..142e13a 100644 --- a/pkg/stack/docs/sdks/v3/README.md +++ b/pkg/stack/docs/sdks/v3/README.md @@ -29,6 +29,8 @@ * [GetBankAccount](#getbankaccount) - Get a Bank Account by ID * [GetConnectorConfig](#getconnectorconfig) - Get a connector configuration by ID * [GetConnectorSchedule](#getconnectorschedule) - Get a connector schedule by ID +* [GetConversion](#getconversion) - Get a single conversion by its Formance ID +* [GetOrder](#getorder) - Get a single order by its Formance ID * [GetPayment](#getpayment) - Get a payment by ID * [GetPaymentInitiation](#getpaymentinitiation) - Get a payment initiation by ID * [GetPaymentServiceUser](#getpaymentserviceuser) - Get a payment service user by ID @@ -45,6 +47,8 @@ * [ListConnectorScheduleInstances](#listconnectorscheduleinstances) - List all connector schedule instances * [ListConnectorSchedules](#listconnectorschedules) - List all connector schedules * [ListConnectors](#listconnectors) - List all connectors +* [ListConversions](#listconversions) - List currency and asset conversions ingested from connectors +* [ListOrders](#listorders) - List orders ingested from exchange-style connectors * [ListPaymentInitiationAdjustments](#listpaymentinitiationadjustments) - List all payment initiation adjustments * [ListPaymentInitiationRelatedPayments](#listpaymentinitiationrelatedpayments) - List all payments related to a payment initiation * [ListPaymentInitiations](#listpaymentinitiations) - List all payment initiations @@ -1385,6 +1389,138 @@ func main() { | ------------------ | ------------------ | ------------------ | | sdkerrors.SDKError | 4XX, 5XX | \*/\* | +## GetConversion + +Returns one conversion identified by its Formance-assigned `id` +(**not** the PSP's native `reference`). See `V3Conversion` for the +response shape — on `COMPLETED` status the `destinationAmount` and +`fee` fields reflect the settled values; on `FAILED` the `error` +field carries the PSP's rejection reason. + +Returns an error via `V3ErrorResponse` when no conversion exists +for the given ID. + + +### Example Usage + + +```go +package main + +import( + "context" + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" + "github.com/formancehq/formance-sdk-go/v3" + "github.com/formancehq/formance-sdk-go/v3/pkg/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := v3.New( + v3.WithSecurity(shared.Security{ + ClientID: "", + ClientSecret: "", + }), + ) + + res, err := s.Payments.V3.GetConversion(ctx, operations.V3GetConversionRequest{ + ConversionID: "", + }) + if err != nil { + log.Fatal(err) + } + if res.V3GetConversionResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.V3GetConversionRequest](../../pkg/models/operations/v3getconversionrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3GetConversionResponse](../../pkg/models/operations/v3getconversionresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## GetOrder + +Returns one order identified by its Formance-assigned `id` (composed +from the PSP `reference` and the connector ID — **not** the PSP's +native reference). The response includes the full `adjustments` +history ordered from oldest to most recent; the last adjustment +reflects the order's current top-level `status`. + +Returns an error via `V3ErrorResponse` when no order exists for the +given ID, or when the ID cannot be decoded. + + +### Example Usage + + +```go +package main + +import( + "context" + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" + "github.com/formancehq/formance-sdk-go/v3" + "github.com/formancehq/formance-sdk-go/v3/pkg/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := v3.New( + v3.WithSecurity(shared.Security{ + ClientID: "", + ClientSecret: "", + }), + ) + + res, err := s.Payments.V3.GetOrder(ctx, operations.V3GetOrderRequest{ + OrderID: "", + }) + if err != nil { + log.Fatal(err) + } + if res.V3GetOrderResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.V3GetOrderRequest](../../pkg/models/operations/v3getorderrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3GetOrderResponse](../../pkg/models/operations/v3getorderresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + ## GetPayment Get a payment by ID @@ -2317,6 +2453,152 @@ func main() { | ------------------ | ------------------ | ------------------ | | sdkerrors.SDKError | 4XX, 5XX | \*/\* | +## ListConversions + +Returns the full list of conversions ingested by Formance from +connectors that implement the conversions capability. A conversion +is a direct swap between two assets on a PSP (e.g. USD → USDC on +Coinbase Prime). Conversions are **read-only** through the Formance +API. + +Unlike orders, conversions do not carry an adjustment history — +Formance records only the final observed state (`status`, +`destinationAmount`, and `fee` when settled). + +Results are cursor-paginated. The optional request body accepts a +query builder for filtering over top-level `V3Conversion` fields +such as `connectorID`, `reference`, `status`, `sourceAsset`, +`destinationAsset`, and `createdAt`. + + +### Example Usage + + +```go +package main + +import( + "context" + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" + "github.com/formancehq/formance-sdk-go/v3" + "github.com/formancehq/formance-sdk-go/v3/pkg/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := v3.New( + v3.WithSecurity(shared.Security{ + ClientID: "", + ClientSecret: "", + }), + ) + + res, err := s.Payments.V3.ListConversions(ctx, operations.V3ListConversionsRequest{ + Cursor: v3.Pointer("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="), + PageSize: v3.Pointer[int64](100), + }) + if err != nil { + log.Fatal(err) + } + if res.V3ConversionsCursorResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.V3ListConversionsRequest](../../pkg/models/operations/v3listconversionsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3ListConversionsResponse](../../pkg/models/operations/v3listconversionsresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## ListOrders + +Returns the full list of orders ingested by Formance from connectors +that implement the orders capability (e.g. `coinbaseprime`). Orders +represent trade placements on an exchange-style PSP and are +**read-only** through the Formance API — submission, cancellation, +and lifecycle transitions are owned by the underlying connector. + +Results are cursor-paginated. The optional request body accepts a +query builder for filtering over top-level `V3Order` fields such as +`connectorID`, `reference`, `direction`, `status`, `type`, +`sourceAsset`, `destinationAsset`, and `createdAt`. + +See `V3Order` for the full response shape, including the +`adjustments` array that captures each observed state transition on +the exchange. + + +### Example Usage + + +```go +package main + +import( + "context" + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" + "github.com/formancehq/formance-sdk-go/v3" + "github.com/formancehq/formance-sdk-go/v3/pkg/models/operations" + "log" +) + +func main() { + ctx := context.Background() + + s := v3.New( + v3.WithSecurity(shared.Security{ + ClientID: "", + ClientSecret: "", + }), + ) + + res, err := s.Payments.V3.ListOrders(ctx, operations.V3ListOrdersRequest{ + Cursor: v3.Pointer("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ=="), + PageSize: v3.Pointer[int64](100), + }) + if err != nil { + log.Fatal(err) + } + if res.V3OrdersCursorResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.V3ListOrdersRequest](../../pkg/models/operations/v3listordersrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../pkg/models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.V3ListOrdersResponse](../../pkg/models/operations/v3listordersresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + ## ListPaymentInitiationAdjustments List all payment initiation adjustments diff --git a/pkg/stack/pkg/models/operations/v3getconversion.go b/pkg/stack/pkg/models/operations/v3getconversion.go new file mode 100644 index 0000000..5261458 --- /dev/null +++ b/pkg/stack/pkg/models/operations/v3getconversion.go @@ -0,0 +1,74 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" + "net/http" +) + +type V3GetConversionRequest struct { + // The conversion ID + ConversionID string `pathParam:"style=simple,explode=false,name=conversionID"` +} + +func (v *V3GetConversionRequest) GetConversionID() string { + if v == nil { + return "" + } + return v.ConversionID +} + +// #region class-body-v3getconversionrequest +// #endregion class-body-v3getconversionrequest + +type V3GetConversionResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Error + V3ErrorResponse *shared.V3ErrorResponse + // OK + V3GetConversionResponse *shared.V3GetConversionResponse +} + +func (v *V3GetConversionResponse) GetContentType() string { + if v == nil { + return "" + } + return v.ContentType +} + +func (v *V3GetConversionResponse) GetStatusCode() int { + if v == nil { + return 0 + } + return v.StatusCode +} + +func (v *V3GetConversionResponse) GetRawResponse() *http.Response { + if v == nil { + return nil + } + return v.RawResponse +} + +func (v *V3GetConversionResponse) GetV3ErrorResponse() *shared.V3ErrorResponse { + if v == nil { + return nil + } + return v.V3ErrorResponse +} + +func (v *V3GetConversionResponse) GetV3GetConversionResponse() *shared.V3GetConversionResponse { + if v == nil { + return nil + } + return v.V3GetConversionResponse +} + +// #region class-body-v3getconversionresponse +// #endregion class-body-v3getconversionresponse diff --git a/pkg/stack/pkg/models/operations/v3getorder.go b/pkg/stack/pkg/models/operations/v3getorder.go new file mode 100644 index 0000000..ab335cc --- /dev/null +++ b/pkg/stack/pkg/models/operations/v3getorder.go @@ -0,0 +1,74 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" + "net/http" +) + +type V3GetOrderRequest struct { + // The order ID + OrderID string `pathParam:"style=simple,explode=false,name=orderID"` +} + +func (v *V3GetOrderRequest) GetOrderID() string { + if v == nil { + return "" + } + return v.OrderID +} + +// #region class-body-v3getorderrequest +// #endregion class-body-v3getorderrequest + +type V3GetOrderResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Error + V3ErrorResponse *shared.V3ErrorResponse + // OK + V3GetOrderResponse *shared.V3GetOrderResponse +} + +func (v *V3GetOrderResponse) GetContentType() string { + if v == nil { + return "" + } + return v.ContentType +} + +func (v *V3GetOrderResponse) GetStatusCode() int { + if v == nil { + return 0 + } + return v.StatusCode +} + +func (v *V3GetOrderResponse) GetRawResponse() *http.Response { + if v == nil { + return nil + } + return v.RawResponse +} + +func (v *V3GetOrderResponse) GetV3ErrorResponse() *shared.V3ErrorResponse { + if v == nil { + return nil + } + return v.V3ErrorResponse +} + +func (v *V3GetOrderResponse) GetV3GetOrderResponse() *shared.V3GetOrderResponse { + if v == nil { + return nil + } + return v.V3GetOrderResponse +} + +// #region class-body-v3getorderresponse +// #endregion class-body-v3getorderresponse diff --git a/pkg/stack/pkg/models/operations/v3listconversions.go b/pkg/stack/pkg/models/operations/v3listconversions.go new file mode 100644 index 0000000..0e72907 --- /dev/null +++ b/pkg/stack/pkg/models/operations/v3listconversions.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" + "net/http" +) + +type V3ListConversionsRequest struct { + // Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. + // + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // The number of items to return + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + Query map[string]any `queryParam:"serialization=json,name=query"` +} + +func (v *V3ListConversionsRequest) GetCursor() *string { + if v == nil { + return nil + } + return v.Cursor +} + +func (v *V3ListConversionsRequest) GetPageSize() *int64 { + if v == nil { + return nil + } + return v.PageSize +} + +func (v *V3ListConversionsRequest) GetQuery() map[string]any { + if v == nil { + return nil + } + return v.Query +} + +// #region class-body-v3listconversionsrequest +// #endregion class-body-v3listconversionsrequest + +type V3ListConversionsResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // OK + V3ConversionsCursorResponse *shared.V3ConversionsCursorResponse + // Error + V3ErrorResponse *shared.V3ErrorResponse +} + +func (v *V3ListConversionsResponse) GetContentType() string { + if v == nil { + return "" + } + return v.ContentType +} + +func (v *V3ListConversionsResponse) GetStatusCode() int { + if v == nil { + return 0 + } + return v.StatusCode +} + +func (v *V3ListConversionsResponse) GetRawResponse() *http.Response { + if v == nil { + return nil + } + return v.RawResponse +} + +func (v *V3ListConversionsResponse) GetV3ConversionsCursorResponse() *shared.V3ConversionsCursorResponse { + if v == nil { + return nil + } + return v.V3ConversionsCursorResponse +} + +func (v *V3ListConversionsResponse) GetV3ErrorResponse() *shared.V3ErrorResponse { + if v == nil { + return nil + } + return v.V3ErrorResponse +} + +// #region class-body-v3listconversionsresponse +// #endregion class-body-v3listconversionsresponse diff --git a/pkg/stack/pkg/models/operations/v3listorders.go b/pkg/stack/pkg/models/operations/v3listorders.go new file mode 100644 index 0000000..b249d1e --- /dev/null +++ b/pkg/stack/pkg/models/operations/v3listorders.go @@ -0,0 +1,92 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/models/shared" + "net/http" +) + +type V3ListOrdersRequest struct { + // Parameter used in pagination requests. Set to the value of next for the next page of results. Set to the value of previous for the previous page of results. No other parameters can be set when this parameter is set. + // + Cursor *string `queryParam:"style=form,explode=true,name=cursor"` + // The number of items to return + PageSize *int64 `queryParam:"style=form,explode=true,name=pageSize"` + Query map[string]any `queryParam:"serialization=json,name=query"` +} + +func (v *V3ListOrdersRequest) GetCursor() *string { + if v == nil { + return nil + } + return v.Cursor +} + +func (v *V3ListOrdersRequest) GetPageSize() *int64 { + if v == nil { + return nil + } + return v.PageSize +} + +func (v *V3ListOrdersRequest) GetQuery() map[string]any { + if v == nil { + return nil + } + return v.Query +} + +// #region class-body-v3listordersrequest +// #endregion class-body-v3listordersrequest + +type V3ListOrdersResponse struct { + // HTTP response content type for this operation + ContentType string + // HTTP response status code for this operation + StatusCode int + // Raw HTTP response; suitable for custom response parsing + RawResponse *http.Response + // Error + V3ErrorResponse *shared.V3ErrorResponse + // OK + V3OrdersCursorResponse *shared.V3OrdersCursorResponse +} + +func (v *V3ListOrdersResponse) GetContentType() string { + if v == nil { + return "" + } + return v.ContentType +} + +func (v *V3ListOrdersResponse) GetStatusCode() int { + if v == nil { + return 0 + } + return v.StatusCode +} + +func (v *V3ListOrdersResponse) GetRawResponse() *http.Response { + if v == nil { + return nil + } + return v.RawResponse +} + +func (v *V3ListOrdersResponse) GetV3ErrorResponse() *shared.V3ErrorResponse { + if v == nil { + return nil + } + return v.V3ErrorResponse +} + +func (v *V3ListOrdersResponse) GetV3OrdersCursorResponse() *shared.V3OrdersCursorResponse { + if v == nil { + return nil + } + return v.V3OrdersCursorResponse +} + +// #region class-body-v3listordersresponse +// #endregion class-body-v3listordersresponse diff --git a/pkg/stack/pkg/models/shared/activitycreatetransferinitiation.go b/pkg/stack/pkg/models/shared/activitycreatetransferinitiation.go new file mode 100644 index 0000000..56e5711 --- /dev/null +++ b/pkg/stack/pkg/models/shared/activitycreatetransferinitiation.go @@ -0,0 +1,149 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" + "github.com/formancehq/formance-sdk-go/v3/pkg/utils" + "math/big" +) + +// Metadata - A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format. +type Metadata struct { +} + +// Type of transfer initiation: +// - TRANSFER: Internal to internal account transfer +// - PAYOUT: Internal to external account payout +type Type string + +const ( + TypeTransfer Type = "TRANSFER" + TypePayout Type = "PAYOUT" +) + +func (e Type) ToPointer() *Type { + return &e +} +func (e *Type) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "TRANSFER": + fallthrough + case "PAYOUT": + *e = Type(v) + return nil + default: + return fmt.Errorf("invalid value for Type: %v", v) + } +} + +type ActivityCreateTransferInitiation struct { + Amount *big.Int `json:"amount,omitempty"` + Asset *string `json:"asset,omitempty"` + ConnectorID *string `json:"connectorID,omitempty"` + // Description for the transfer initiation + Description *string `json:"description,omitempty"` + // Destination account ID + Destination *string `json:"destination,omitempty"` + // A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format. + // + Metadata *Metadata `json:"metadata,omitempty"` + // Payment service provider name (e.g., stripe, wise, mangopay). + // Validated by the Payments service based on installed connectors. + // + Provider *string `json:"provider,omitempty"` + // Source account ID (required for TRANSFER type) + Source *string `json:"source,omitempty"` + // Type of transfer initiation: + // - TRANSFER: Internal to internal account transfer + // - PAYOUT: Internal to external account payout + // + Type *Type `default:"TRANSFER" json:"type"` + WaitingValidation *bool `default:"false" json:"waitingValidation"` +} + +func (a ActivityCreateTransferInitiation) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(a, "", false) +} + +func (a *ActivityCreateTransferInitiation) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &a, "", false, nil); err != nil { + return err + } + return nil +} + +func (a *ActivityCreateTransferInitiation) GetAmount() *big.Int { + if a == nil { + return nil + } + return a.Amount +} + +func (a *ActivityCreateTransferInitiation) GetAsset() *string { + if a == nil { + return nil + } + return a.Asset +} + +func (a *ActivityCreateTransferInitiation) GetConnectorID() *string { + if a == nil { + return nil + } + return a.ConnectorID +} + +func (a *ActivityCreateTransferInitiation) GetDescription() *string { + if a == nil { + return nil + } + return a.Description +} + +func (a *ActivityCreateTransferInitiation) GetDestination() *string { + if a == nil { + return nil + } + return a.Destination +} + +func (a *ActivityCreateTransferInitiation) GetMetadata() *Metadata { + if a == nil { + return nil + } + return a.Metadata +} + +func (a *ActivityCreateTransferInitiation) GetProvider() *string { + if a == nil { + return nil + } + return a.Provider +} + +func (a *ActivityCreateTransferInitiation) GetSource() *string { + if a == nil { + return nil + } + return a.Source +} + +func (a *ActivityCreateTransferInitiation) GetType() *Type { + if a == nil { + return nil + } + return a.Type +} + +func (a *ActivityCreateTransferInitiation) GetWaitingValidation() *bool { + if a == nil { + return nil + } + return a.WaitingValidation +} diff --git a/pkg/stack/pkg/models/shared/activitystripetransfer.go b/pkg/stack/pkg/models/shared/activitystripetransfer.go index 46aab79..eaa8350 100644 --- a/pkg/stack/pkg/models/shared/activitystripetransfer.go +++ b/pkg/stack/pkg/models/shared/activitystripetransfer.go @@ -7,9 +7,9 @@ import ( "math/big" ) -// Metadata - A set of key/value pairs that you can attach to a transfer object. +// ActivityStripeTransferMetadata - A set of key/value pairs that you can attach to a transfer object. // It can be useful for storing additional information about the transfer in a structured format. -type Metadata struct { +type ActivityStripeTransferMetadata struct { } type ActivityStripeTransfer struct { @@ -20,8 +20,8 @@ type ActivityStripeTransfer struct { // A set of key/value pairs that you can attach to a transfer object. // It can be useful for storing additional information about the transfer in a structured format. // - Metadata *Metadata `json:"metadata,omitempty"` - WaitingValidation *bool `default:"false" json:"waitingValidation"` + Metadata *ActivityStripeTransferMetadata `json:"metadata,omitempty"` + WaitingValidation *bool `default:"false" json:"waitingValidation"` } func (a ActivityStripeTransfer) MarshalJSON() ([]byte, error) { @@ -63,7 +63,7 @@ func (a *ActivityStripeTransfer) GetDestination() *string { return a.Destination } -func (a *ActivityStripeTransfer) GetMetadata() *Metadata { +func (a *ActivityStripeTransfer) GetMetadata() *ActivityStripeTransferMetadata { if a == nil { return nil } diff --git a/pkg/stack/pkg/models/shared/log.go b/pkg/stack/pkg/models/shared/log.go index 6897be8..7b451a4 100644 --- a/pkg/stack/pkg/models/shared/log.go +++ b/pkg/stack/pkg/models/shared/log.go @@ -9,17 +9,17 @@ import ( "time" ) -type Type string +type LogType string const ( - TypeNewTransaction Type = "NEW_TRANSACTION" - TypeSetMetadata Type = "SET_METADATA" + LogTypeNewTransaction LogType = "NEW_TRANSACTION" + LogTypeSetMetadata LogType = "SET_METADATA" ) -func (e Type) ToPointer() *Type { +func (e LogType) ToPointer() *LogType { return &e } -func (e *Type) UnmarshalJSON(data []byte) error { +func (e *LogType) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -28,10 +28,10 @@ func (e *Type) UnmarshalJSON(data []byte) error { case "NEW_TRANSACTION": fallthrough case "SET_METADATA": - *e = Type(v) + *e = LogType(v) return nil default: - return fmt.Errorf("invalid value for Type: %v", v) + return fmt.Errorf("invalid value for LogType: %v", v) } } @@ -40,7 +40,7 @@ type Log struct { Date time.Time `json:"date"` Hash string `json:"hash"` ID int64 `json:"id"` - Type Type `json:"type"` + Type LogType `json:"type"` } func (l Log) MarshalJSON() ([]byte, error) { @@ -82,9 +82,9 @@ func (l *Log) GetID() int64 { return l.ID } -func (l *Log) GetType() Type { +func (l *Log) GetType() LogType { if l == nil { - return Type("") + return LogType("") } return l.Type } diff --git a/pkg/stack/pkg/models/shared/stagesenddestinationaccount.go b/pkg/stack/pkg/models/shared/stagesenddestinationaccount.go index f0483cf..d04f833 100644 --- a/pkg/stack/pkg/models/shared/stagesenddestinationaccount.go +++ b/pkg/stack/pkg/models/shared/stagesenddestinationaccount.go @@ -7,8 +7,20 @@ import ( ) type StageSendDestinationAccount struct { - ID string `json:"id"` - Ledger *string `json:"ledger,omitempty"` + // Enables unbounded overdraft on the throughAccount when set to true. + // This is useful when the throughAccount represents a liability or bridge account + // that needs to go negative (e.g., "liabilities:payouts-pending"). + // Only applies when throughAccount is not "world" (which already has unbounded overdraft). + // + AllowOverdraft *bool `default:"false" json:"allowOverdraft"` + ID string `json:"id"` + Ledger *string `json:"ledger,omitempty"` + // Account used when this ledger account interacts with external systems (payments, cross-ledger). + // - As SOURCE going to payment: funds are sent to this account (e.g., "liabilities:payouts-pending") + // - As DESTINATION from payment: funds come from this account (e.g., "assets:stripe:incoming") + // - For cross-ledger transfers: replaces "world" on both sides + // + ThroughAccount *string `default:"world" json:"throughAccount"` } func (s StageSendDestinationAccount) MarshalJSON() ([]byte, error) { @@ -22,6 +34,13 @@ func (s *StageSendDestinationAccount) UnmarshalJSON(data []byte) error { return nil } +func (s *StageSendDestinationAccount) GetAllowOverdraft() *bool { + if s == nil { + return nil + } + return s.AllowOverdraft +} + func (s *StageSendDestinationAccount) GetID() string { if s == nil { return "" @@ -35,3 +54,10 @@ func (s *StageSendDestinationAccount) GetLedger() *string { } return s.Ledger } + +func (s *StageSendDestinationAccount) GetThroughAccount() *string { + if s == nil { + return nil + } + return s.ThroughAccount +} diff --git a/pkg/stack/pkg/models/shared/stagesenddestinationpayment.go b/pkg/stack/pkg/models/shared/stagesenddestinationpayment.go index 6b7e742..7af3b96 100644 --- a/pkg/stack/pkg/models/shared/stagesenddestinationpayment.go +++ b/pkg/stack/pkg/models/shared/stagesenddestinationpayment.go @@ -3,11 +3,54 @@ package shared import ( + "encoding/json" + "fmt" "github.com/formancehq/formance-sdk-go/v3/pkg/utils" ) +// StageSendDestinationPaymentType - Type of transfer initiation: +// - TRANSFER: Internal to internal account transfer +// - PAYOUT: Internal to external account payout +type StageSendDestinationPaymentType string + +const ( + StageSendDestinationPaymentTypeTransfer StageSendDestinationPaymentType = "TRANSFER" + StageSendDestinationPaymentTypePayout StageSendDestinationPaymentType = "PAYOUT" +) + +func (e StageSendDestinationPaymentType) ToPointer() *StageSendDestinationPaymentType { + return &e +} +func (e *StageSendDestinationPaymentType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "TRANSFER": + fallthrough + case "PAYOUT": + *e = StageSendDestinationPaymentType(v) + return nil + default: + return fmt.Errorf("invalid value for StageSendDestinationPaymentType: %v", v) + } +} + type StageSendDestinationPayment struct { + // Payment service provider name (e.g., stripe, wise, mangopay). + // Validated by the Payments service based on installed connectors. + // Psp string `json:"psp"` + // Formance Payments account ID for the source (internal PSP account). + // If not specified, the Payments service may use a default account for the connector. + // + SourceAccount *string `json:"sourceAccount,omitempty"` + // Type of transfer initiation: + // - TRANSFER: Internal to internal account transfer + // - PAYOUT: Internal to external account payout + // + Type *StageSendDestinationPaymentType `default:"TRANSFER" json:"type"` } func (s StageSendDestinationPayment) MarshalJSON() ([]byte, error) { @@ -27,3 +70,17 @@ func (s *StageSendDestinationPayment) GetPsp() string { } return s.Psp } + +func (s *StageSendDestinationPayment) GetSourceAccount() *string { + if s == nil { + return nil + } + return s.SourceAccount +} + +func (s *StageSendDestinationPayment) GetType() *StageSendDestinationPaymentType { + if s == nil { + return nil + } + return s.Type +} diff --git a/pkg/stack/pkg/models/shared/stagesendsourcepayment.go b/pkg/stack/pkg/models/shared/stagesendsourcepayment.go index b6d0343..b7a038c 100644 --- a/pkg/stack/pkg/models/shared/stagesendsourcepayment.go +++ b/pkg/stack/pkg/models/shared/stagesendsourcepayment.go @@ -7,7 +7,23 @@ import ( ) type StageSendSourcePayment struct { - ID string `json:"id"` + // Enables unbounded overdraft on the throughAccount when set to true. + // Only applies when throughAccount is not "world" (which already has unbounded overdraft). + // + AllowOverdraft *bool `default:"false" json:"allowOverdraft"` + // Intermediate account where payment funds are held. + // Defaults to "payment:{paymentID}" format. + // + HoldingAccount *string `json:"holdingAccount,omitempty"` + ID string `json:"id"` + // Ledger to use for payment ingestion. + // Defaults to the internal orchestration ledger. + // + Ledger *string `json:"ledger,omitempty"` + // Source account for the payment ingestion transaction. + // Defaults to "world". + // + ThroughAccount *string `default:"world" json:"throughAccount"` } func (s StageSendSourcePayment) MarshalJSON() ([]byte, error) { @@ -21,9 +37,37 @@ func (s *StageSendSourcePayment) UnmarshalJSON(data []byte) error { return nil } +func (s *StageSendSourcePayment) GetAllowOverdraft() *bool { + if s == nil { + return nil + } + return s.AllowOverdraft +} + +func (s *StageSendSourcePayment) GetHoldingAccount() *string { + if s == nil { + return nil + } + return s.HoldingAccount +} + func (s *StageSendSourcePayment) GetID() string { if s == nil { return "" } return s.ID } + +func (s *StageSendSourcePayment) GetLedger() *string { + if s == nil { + return nil + } + return s.Ledger +} + +func (s *StageSendSourcePayment) GetThroughAccount() *string { + if s == nil { + return nil + } + return s.ThroughAccount +} diff --git a/pkg/stack/pkg/models/shared/v2activitycreatetransferinitiation.go b/pkg/stack/pkg/models/shared/v2activitycreatetransferinitiation.go new file mode 100644 index 0000000..ee0ac03 --- /dev/null +++ b/pkg/stack/pkg/models/shared/v2activitycreatetransferinitiation.go @@ -0,0 +1,155 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" + "github.com/formancehq/formance-sdk-go/v3/pkg/utils" + "math/big" +) + +// V2ActivityCreateTransferInitiationMetadata - A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format. +type V2ActivityCreateTransferInitiationMetadata struct { +} + +// #region class-body-v2activitycreatetransferinitiationmetadata +// #endregion class-body-v2activitycreatetransferinitiationmetadata + +// V2ActivityCreateTransferInitiationType - Type of transfer initiation: +// - TRANSFER: Internal to internal account transfer +// - PAYOUT: Internal to external account payout +type V2ActivityCreateTransferInitiationType string + +const ( + V2ActivityCreateTransferInitiationTypeTransfer V2ActivityCreateTransferInitiationType = "TRANSFER" + V2ActivityCreateTransferInitiationTypePayout V2ActivityCreateTransferInitiationType = "PAYOUT" +) + +func (e V2ActivityCreateTransferInitiationType) ToPointer() *V2ActivityCreateTransferInitiationType { + return &e +} +func (e *V2ActivityCreateTransferInitiationType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "TRANSFER": + fallthrough + case "PAYOUT": + *e = V2ActivityCreateTransferInitiationType(v) + return nil + default: + return fmt.Errorf("invalid value for V2ActivityCreateTransferInitiationType: %v", v) + } +} + +type V2ActivityCreateTransferInitiation struct { + Amount *big.Int `json:"amount,omitempty"` + Asset *string `json:"asset,omitempty"` + ConnectorID *string `json:"connectorID,omitempty"` + // Description for the transfer initiation + Description *string `json:"description,omitempty"` + // Destination account ID + Destination *string `json:"destination,omitempty"` + // A set of key/value pairs that you can attach to a transfer object. It can be useful for storing additional information about the transfer in a structured format. + // + Metadata *V2ActivityCreateTransferInitiationMetadata `json:"metadata,omitempty"` + // Payment service provider name (e.g., stripe, wise, mangopay). + // Validated by the Payments service based on installed connectors. + // + Provider *string `json:"provider,omitempty"` + // Source account ID (required for TRANSFER type) + Source *string `json:"source,omitempty"` + // Type of transfer initiation: + // - TRANSFER: Internal to internal account transfer + // - PAYOUT: Internal to external account payout + // + Type *V2ActivityCreateTransferInitiationType `default:"TRANSFER" json:"type"` + WaitingValidation *bool `default:"false" json:"waitingValidation"` +} + +func (v V2ActivityCreateTransferInitiation) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(v, "", false) +} + +func (v *V2ActivityCreateTransferInitiation) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &v, "", false, nil); err != nil { + return err + } + return nil +} + +func (v *V2ActivityCreateTransferInitiation) GetAmount() *big.Int { + if v == nil { + return nil + } + return v.Amount +} + +func (v *V2ActivityCreateTransferInitiation) GetAsset() *string { + if v == nil { + return nil + } + return v.Asset +} + +func (v *V2ActivityCreateTransferInitiation) GetConnectorID() *string { + if v == nil { + return nil + } + return v.ConnectorID +} + +func (v *V2ActivityCreateTransferInitiation) GetDescription() *string { + if v == nil { + return nil + } + return v.Description +} + +func (v *V2ActivityCreateTransferInitiation) GetDestination() *string { + if v == nil { + return nil + } + return v.Destination +} + +func (v *V2ActivityCreateTransferInitiation) GetMetadata() *V2ActivityCreateTransferInitiationMetadata { + if v == nil { + return nil + } + return v.Metadata +} + +func (v *V2ActivityCreateTransferInitiation) GetProvider() *string { + if v == nil { + return nil + } + return v.Provider +} + +func (v *V2ActivityCreateTransferInitiation) GetSource() *string { + if v == nil { + return nil + } + return v.Source +} + +func (v *V2ActivityCreateTransferInitiation) GetType() *V2ActivityCreateTransferInitiationType { + if v == nil { + return nil + } + return v.Type +} + +func (v *V2ActivityCreateTransferInitiation) GetWaitingValidation() *bool { + if v == nil { + return nil + } + return v.WaitingValidation +} + +// #region class-body-v2activitycreatetransferinitiation +// #endregion class-body-v2activitycreatetransferinitiation diff --git a/pkg/stack/pkg/models/shared/v2stagesenddestinationaccount.go b/pkg/stack/pkg/models/shared/v2stagesenddestinationaccount.go index 48a7cd2..dc62df0 100644 --- a/pkg/stack/pkg/models/shared/v2stagesenddestinationaccount.go +++ b/pkg/stack/pkg/models/shared/v2stagesenddestinationaccount.go @@ -7,8 +7,20 @@ import ( ) type V2StageSendDestinationAccount struct { - ID string `json:"id"` - Ledger *string `json:"ledger,omitempty"` + // Enables unbounded overdraft on the throughAccount when set to true. + // This is useful when the throughAccount represents a liability or bridge account + // that needs to go negative (e.g., "liabilities:payouts-pending"). + // Only applies when throughAccount is not "world" (which already has unbounded overdraft). + // + AllowOverdraft *bool `default:"false" json:"allowOverdraft"` + ID string `json:"id"` + Ledger *string `json:"ledger,omitempty"` + // Account used when this ledger account interacts with external systems (payments, cross-ledger). + // - As SOURCE going to payment: funds are sent to this account (e.g., "liabilities:payouts-pending") + // - As DESTINATION from payment: funds come from this account (e.g., "assets:stripe:incoming") + // - For cross-ledger transfers: replaces "world" on both sides + // + ThroughAccount *string `default:"world" json:"throughAccount"` } func (v V2StageSendDestinationAccount) MarshalJSON() ([]byte, error) { @@ -22,6 +34,13 @@ func (v *V2StageSendDestinationAccount) UnmarshalJSON(data []byte) error { return nil } +func (v *V2StageSendDestinationAccount) GetAllowOverdraft() *bool { + if v == nil { + return nil + } + return v.AllowOverdraft +} + func (v *V2StageSendDestinationAccount) GetID() string { if v == nil { return "" @@ -36,5 +55,12 @@ func (v *V2StageSendDestinationAccount) GetLedger() *string { return v.Ledger } +func (v *V2StageSendDestinationAccount) GetThroughAccount() *string { + if v == nil { + return nil + } + return v.ThroughAccount +} + // #region class-body-v2stagesenddestinationaccount // #endregion class-body-v2stagesenddestinationaccount diff --git a/pkg/stack/pkg/models/shared/v2stagesenddestinationpayment.go b/pkg/stack/pkg/models/shared/v2stagesenddestinationpayment.go index b096d10..2946326 100644 --- a/pkg/stack/pkg/models/shared/v2stagesenddestinationpayment.go +++ b/pkg/stack/pkg/models/shared/v2stagesenddestinationpayment.go @@ -3,11 +3,54 @@ package shared import ( + "encoding/json" + "fmt" "github.com/formancehq/formance-sdk-go/v3/pkg/utils" ) +// V2StageSendDestinationPaymentType - Type of transfer initiation: +// - TRANSFER: Internal to internal account transfer +// - PAYOUT: Internal to external account payout +type V2StageSendDestinationPaymentType string + +const ( + V2StageSendDestinationPaymentTypeTransfer V2StageSendDestinationPaymentType = "TRANSFER" + V2StageSendDestinationPaymentTypePayout V2StageSendDestinationPaymentType = "PAYOUT" +) + +func (e V2StageSendDestinationPaymentType) ToPointer() *V2StageSendDestinationPaymentType { + return &e +} +func (e *V2StageSendDestinationPaymentType) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "TRANSFER": + fallthrough + case "PAYOUT": + *e = V2StageSendDestinationPaymentType(v) + return nil + default: + return fmt.Errorf("invalid value for V2StageSendDestinationPaymentType: %v", v) + } +} + type V2StageSendDestinationPayment struct { + // Payment service provider name (e.g., stripe, wise, mangopay). + // Validated by the Payments service based on installed connectors. + // Psp string `json:"psp"` + // Formance Payments account ID for the source (internal PSP account). + // If not specified, the Payments service may use a default account for the connector. + // + SourceAccount *string `json:"sourceAccount,omitempty"` + // Type of transfer initiation: + // - TRANSFER: Internal to internal account transfer + // - PAYOUT: Internal to external account payout + // + Type *V2StageSendDestinationPaymentType `default:"TRANSFER" json:"type"` } func (v V2StageSendDestinationPayment) MarshalJSON() ([]byte, error) { @@ -28,5 +71,19 @@ func (v *V2StageSendDestinationPayment) GetPsp() string { return v.Psp } +func (v *V2StageSendDestinationPayment) GetSourceAccount() *string { + if v == nil { + return nil + } + return v.SourceAccount +} + +func (v *V2StageSendDestinationPayment) GetType() *V2StageSendDestinationPaymentType { + if v == nil { + return nil + } + return v.Type +} + // #region class-body-v2stagesenddestinationpayment // #endregion class-body-v2stagesenddestinationpayment diff --git a/pkg/stack/pkg/models/shared/v2stagesendsourcepayment.go b/pkg/stack/pkg/models/shared/v2stagesendsourcepayment.go index a58849b..a156836 100644 --- a/pkg/stack/pkg/models/shared/v2stagesendsourcepayment.go +++ b/pkg/stack/pkg/models/shared/v2stagesendsourcepayment.go @@ -7,7 +7,23 @@ import ( ) type V2StageSendSourcePayment struct { - ID string `json:"id"` + // Enables unbounded overdraft on the throughAccount when set to true. + // Only applies when throughAccount is not "world" (which already has unbounded overdraft). + // + AllowOverdraft *bool `default:"false" json:"allowOverdraft"` + // Intermediate account where payment funds are held. + // Defaults to "payment:{paymentID}" format. + // + HoldingAccount *string `json:"holdingAccount,omitempty"` + ID string `json:"id"` + // Ledger to use for payment ingestion. + // Defaults to the internal orchestration ledger. + // + Ledger *string `json:"ledger,omitempty"` + // Source account for the payment ingestion transaction. + // Defaults to "world". + // + ThroughAccount *string `default:"world" json:"throughAccount"` } func (v V2StageSendSourcePayment) MarshalJSON() ([]byte, error) { @@ -21,6 +37,20 @@ func (v *V2StageSendSourcePayment) UnmarshalJSON(data []byte) error { return nil } +func (v *V2StageSendSourcePayment) GetAllowOverdraft() *bool { + if v == nil { + return nil + } + return v.AllowOverdraft +} + +func (v *V2StageSendSourcePayment) GetHoldingAccount() *string { + if v == nil { + return nil + } + return v.HoldingAccount +} + func (v *V2StageSendSourcePayment) GetID() string { if v == nil { return "" @@ -28,5 +58,19 @@ func (v *V2StageSendSourcePayment) GetID() string { return v.ID } +func (v *V2StageSendSourcePayment) GetLedger() *string { + if v == nil { + return nil + } + return v.Ledger +} + +func (v *V2StageSendSourcePayment) GetThroughAccount() *string { + if v == nil { + return nil + } + return v.ThroughAccount +} + // #region class-body-v2stagesendsourcepayment // #endregion class-body-v2stagesendsourcepayment diff --git a/pkg/stack/pkg/models/shared/v2workflowinstancehistorystageinput.go b/pkg/stack/pkg/models/shared/v2workflowinstancehistorystageinput.go index f254cd5..f233d8a 100644 --- a/pkg/stack/pkg/models/shared/v2workflowinstancehistorystageinput.go +++ b/pkg/stack/pkg/models/shared/v2workflowinstancehistorystageinput.go @@ -3,17 +3,18 @@ package shared type V2WorkflowInstanceHistoryStageInput struct { - AddAccountMetadata *V2ActivityAddAccountMetadata `json:"AddAccountMetadata,omitempty"` - ConfirmHold *V2ActivityConfirmHold `json:"ConfirmHold,omitempty"` - CreateTransaction *V2ActivityCreateTransaction `json:"CreateTransaction,omitempty"` - CreditWallet *V2ActivityCreditWallet `json:"CreditWallet,omitempty"` - DebitWallet *V2ActivityDebitWallet `json:"DebitWallet,omitempty"` - GetAccount *V2ActivityGetAccount `json:"GetAccount,omitempty"` - GetPayment *V2ActivityGetPayment `json:"GetPayment,omitempty"` - GetWallet *V2ActivityGetWallet `json:"GetWallet,omitempty"` - ListWallets *V2ActivityListWallets `json:"ListWallets,omitempty"` - StripeTransfer *V2ActivityStripeTransfer `json:"StripeTransfer,omitempty"` - VoidHold *V2ActivityVoidHold `json:"VoidHold,omitempty"` + AddAccountMetadata *V2ActivityAddAccountMetadata `json:"AddAccountMetadata,omitempty"` + ConfirmHold *V2ActivityConfirmHold `json:"ConfirmHold,omitempty"` + CreateTransaction *V2ActivityCreateTransaction `json:"CreateTransaction,omitempty"` + CreateTransferInitiation *V2ActivityCreateTransferInitiation `json:"CreateTransferInitiation,omitempty"` + CreditWallet *V2ActivityCreditWallet `json:"CreditWallet,omitempty"` + DebitWallet *V2ActivityDebitWallet `json:"DebitWallet,omitempty"` + GetAccount *V2ActivityGetAccount `json:"GetAccount,omitempty"` + GetPayment *V2ActivityGetPayment `json:"GetPayment,omitempty"` + GetWallet *V2ActivityGetWallet `json:"GetWallet,omitempty"` + ListWallets *V2ActivityListWallets `json:"ListWallets,omitempty"` + StripeTransfer *V2ActivityStripeTransfer `json:"StripeTransfer,omitempty"` + VoidHold *V2ActivityVoidHold `json:"VoidHold,omitempty"` } func (v *V2WorkflowInstanceHistoryStageInput) GetAddAccountMetadata() *V2ActivityAddAccountMetadata { @@ -37,6 +38,13 @@ func (v *V2WorkflowInstanceHistoryStageInput) GetCreateTransaction() *V2Activity return v.CreateTransaction } +func (v *V2WorkflowInstanceHistoryStageInput) GetCreateTransferInitiation() *V2ActivityCreateTransferInitiation { + if v == nil { + return nil + } + return v.CreateTransferInitiation +} + func (v *V2WorkflowInstanceHistoryStageInput) GetCreditWallet() *V2ActivityCreditWallet { if v == nil { return nil diff --git a/pkg/stack/pkg/models/shared/v3conversion.go b/pkg/stack/pkg/models/shared/v3conversion.go new file mode 100644 index 0000000..73b62da --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3conversion.go @@ -0,0 +1,187 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/utils" + "math/big" + "time" +) + +// V3Conversion - A currency or asset conversion executed on a PSP (e.g. Coinbase Prime +// transfer between a USD and USDC wallet). Conversions are read-only in +// the Formance API: they are fetched from the underlying connector. +// Unlike orders, conversions do not carry an adjustment history — +// Formance records the final state only. +type V3Conversion struct { + // ID of the Formance connector this conversion was fetched from. + ConnectorID string `json:"connectorID"` + // When the conversion was initiated on the PSP. + CreatedAt time.Time `json:"createdAt"` + // Formance account ID of the wallet the destination asset was credited to. + DestinationAccountID *string `json:"destinationAccountID,omitempty"` + // Amount of destination asset credited, at `destinationAsset` precision. Null until the conversion completes. + DestinationAmount *big.Int `json:"destinationAmount,omitempty"` + // Asset being converted to, in `SYMBOL/precision` form (e.g. `USDC/6`). + DestinationAsset string `json:"destinationAsset"` + // Human-readable error from the PSP when `status` is `FAILED`. Null otherwise. + Error *string `json:"error,omitempty"` + // PSP fee for the conversion, at `feeAsset` precision. + Fee *big.Int `json:"fee,omitempty"` + // Currency the fee is denominated in, in `SYMBOL/precision` form. + FeeAsset *string `json:"feeAsset,omitempty"` + // Formance-assigned unique conversion ID. + ID string `json:"id"` + Metadata map[string]string `json:"metadata,omitempty"` + // Provider name of the connector (e.g. `coinbaseprime`). + Provider string `json:"provider"` + // PSP-assigned conversion reference. Unique within the connector. + Reference string `json:"reference"` + // Formance account ID of the wallet the source asset was debited from. + SourceAccountID *string `json:"sourceAccountID,omitempty"` + // Amount of source asset debited, as an integer at `sourceAsset` precision. + SourceAmount *big.Int `json:"sourceAmount"` + // Asset being converted from, in `SYMBOL/precision` form (e.g. `USD/2`). + SourceAsset string `json:"sourceAsset"` + // Lifecycle of a conversion. + // `PENDING` — accepted by the PSP, not yet settled. + // `COMPLETED` — settled, terminal. + // `FAILED` — rejected or reverted, terminal. See `error`. + // + Status V3ConversionStatusEnum `json:"status"` + // When Formance last observed a state change on the conversion. + UpdatedAt time.Time `json:"updatedAt"` +} + +func (v V3Conversion) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(v, "", false) +} + +func (v *V3Conversion) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &v, "", false, nil); err != nil { + return err + } + return nil +} + +func (v *V3Conversion) GetConnectorID() string { + if v == nil { + return "" + } + return v.ConnectorID +} + +func (v *V3Conversion) GetCreatedAt() time.Time { + if v == nil { + return time.Time{} + } + return v.CreatedAt +} + +func (v *V3Conversion) GetDestinationAccountID() *string { + if v == nil { + return nil + } + return v.DestinationAccountID +} + +func (v *V3Conversion) GetDestinationAmount() *big.Int { + if v == nil { + return nil + } + return v.DestinationAmount +} + +func (v *V3Conversion) GetDestinationAsset() string { + if v == nil { + return "" + } + return v.DestinationAsset +} + +func (v *V3Conversion) GetError() *string { + if v == nil { + return nil + } + return v.Error +} + +func (v *V3Conversion) GetFee() *big.Int { + if v == nil { + return nil + } + return v.Fee +} + +func (v *V3Conversion) GetFeeAsset() *string { + if v == nil { + return nil + } + return v.FeeAsset +} + +func (v *V3Conversion) GetID() string { + if v == nil { + return "" + } + return v.ID +} + +func (v *V3Conversion) GetMetadata() map[string]string { + if v == nil { + return nil + } + return v.Metadata +} + +func (v *V3Conversion) GetProvider() string { + if v == nil { + return "" + } + return v.Provider +} + +func (v *V3Conversion) GetReference() string { + if v == nil { + return "" + } + return v.Reference +} + +func (v *V3Conversion) GetSourceAccountID() *string { + if v == nil { + return nil + } + return v.SourceAccountID +} + +func (v *V3Conversion) GetSourceAmount() *big.Int { + if v == nil { + return big.NewInt(0) + } + return v.SourceAmount +} + +func (v *V3Conversion) GetSourceAsset() string { + if v == nil { + return "" + } + return v.SourceAsset +} + +func (v *V3Conversion) GetStatus() V3ConversionStatusEnum { + if v == nil { + return V3ConversionStatusEnum("") + } + return v.Status +} + +func (v *V3Conversion) GetUpdatedAt() time.Time { + if v == nil { + return time.Time{} + } + return v.UpdatedAt +} + +// #region class-body-v3conversion +// #endregion class-body-v3conversion diff --git a/pkg/stack/pkg/models/shared/v3conversionscursorresponse.go b/pkg/stack/pkg/models/shared/v3conversionscursorresponse.go new file mode 100644 index 0000000..ea66d9d --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3conversionscursorresponse.go @@ -0,0 +1,63 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type V3ConversionsCursorResponseCursor struct { + Data []V3Conversion `json:"data"` + HasMore bool `json:"hasMore"` + Next *string `json:"next,omitempty"` + PageSize int64 `json:"pageSize"` + Previous *string `json:"previous,omitempty"` +} + +func (v *V3ConversionsCursorResponseCursor) GetData() []V3Conversion { + if v == nil { + return []V3Conversion{} + } + return v.Data +} + +func (v *V3ConversionsCursorResponseCursor) GetHasMore() bool { + if v == nil { + return false + } + return v.HasMore +} + +func (v *V3ConversionsCursorResponseCursor) GetNext() *string { + if v == nil { + return nil + } + return v.Next +} + +func (v *V3ConversionsCursorResponseCursor) GetPageSize() int64 { + if v == nil { + return 0 + } + return v.PageSize +} + +func (v *V3ConversionsCursorResponseCursor) GetPrevious() *string { + if v == nil { + return nil + } + return v.Previous +} + +// #region class-body-v3conversionscursorresponsecursor +// #endregion class-body-v3conversionscursorresponsecursor + +type V3ConversionsCursorResponse struct { + Cursor V3ConversionsCursorResponseCursor `json:"cursor"` +} + +func (v *V3ConversionsCursorResponse) GetCursor() V3ConversionsCursorResponseCursor { + if v == nil { + return V3ConversionsCursorResponseCursor{} + } + return v.Cursor +} + +// #region class-body-v3conversionscursorresponse +// #endregion class-body-v3conversionscursorresponse diff --git a/pkg/stack/pkg/models/shared/v3conversionstatusenum.go b/pkg/stack/pkg/models/shared/v3conversionstatusenum.go new file mode 100644 index 0000000..c5ab0ab --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3conversionstatusenum.go @@ -0,0 +1,44 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// V3ConversionStatusEnum - Lifecycle of a conversion. +// `PENDING` — accepted by the PSP, not yet settled. +// `COMPLETED` — settled, terminal. +// `FAILED` — rejected or reverted, terminal. See `error`. +type V3ConversionStatusEnum string + +const ( + V3ConversionStatusEnumUnknown V3ConversionStatusEnum = "UNKNOWN" + V3ConversionStatusEnumPending V3ConversionStatusEnum = "PENDING" + V3ConversionStatusEnumCompleted V3ConversionStatusEnum = "COMPLETED" + V3ConversionStatusEnumFailed V3ConversionStatusEnum = "FAILED" +) + +func (e V3ConversionStatusEnum) ToPointer() *V3ConversionStatusEnum { + return &e +} +func (e *V3ConversionStatusEnum) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "UNKNOWN": + fallthrough + case "PENDING": + fallthrough + case "COMPLETED": + fallthrough + case "FAILED": + *e = V3ConversionStatusEnum(v) + return nil + default: + return fmt.Errorf("invalid value for V3ConversionStatusEnum: %v", v) + } +} diff --git a/pkg/stack/pkg/models/shared/v3getconversionresponse.go b/pkg/stack/pkg/models/shared/v3getconversionresponse.go new file mode 100644 index 0000000..6de18c0 --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3getconversionresponse.go @@ -0,0 +1,23 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type V3GetConversionResponse struct { + // A currency or asset conversion executed on a PSP (e.g. Coinbase Prime + // transfer between a USD and USDC wallet). Conversions are read-only in + // the Formance API: they are fetched from the underlying connector. + // Unlike orders, conversions do not carry an adjustment history — + // Formance records the final state only. + // + Data V3Conversion `json:"data"` +} + +func (v *V3GetConversionResponse) GetData() V3Conversion { + if v == nil { + return V3Conversion{} + } + return v.Data +} + +// #region class-body-v3getconversionresponse +// #endregion class-body-v3getconversionresponse diff --git a/pkg/stack/pkg/models/shared/v3getorderresponse.go b/pkg/stack/pkg/models/shared/v3getorderresponse.go new file mode 100644 index 0000000..4decfb5 --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3getorderresponse.go @@ -0,0 +1,22 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type V3GetOrderResponse struct { + // A trade order submitted to an exchange-style PSP. Orders are read-only + // in the Formance API: they are fetched from the underlying connector. + // Status transitions are captured via the `adjustments` array; each + // adjustment is a point-in-time snapshot from the PSP. + // + Data V3Order `json:"data"` +} + +func (v *V3GetOrderResponse) GetData() V3Order { + if v == nil { + return V3Order{} + } + return v.Data +} + +// #region class-body-v3getorderresponse +// #endregion class-body-v3getorderresponse diff --git a/pkg/stack/pkg/models/shared/v3order.go b/pkg/stack/pkg/models/shared/v3order.go new file mode 100644 index 0000000..3c556fb --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3order.go @@ -0,0 +1,325 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/utils" + "math/big" + "time" +) + +// V3Order - A trade order submitted to an exchange-style PSP. Orders are read-only +// in the Formance API: they are fetched from the underlying connector. +// Status transitions are captured via the `adjustments` array; each +// adjustment is a point-in-time snapshot from the PSP. +type V3Order struct { + // Ordered history of state snapshots for this order. The most recent element reflects the current `status`. + Adjustments []V3OrderAdjustment `json:"adjustments,omitempty"` + // Volume-weighted average price across all fills so far, in `priceAsset` precision. Analytics field — may be absent if the PSP does not report it. + AverageFillPrice *big.Int `json:"averageFillPrice,omitempty"` + // Amount of base asset filled so far, as an integer at the base asset's precision. Null before any fill. + BaseQuantityFilled *big.Int `json:"baseQuantityFilled,omitempty"` + // Amount of base asset the order was placed for, as an integer at the base asset's precision. + BaseQuantityOrdered *big.Int `json:"baseQuantityOrdered"` + // Client-assigned ID supplied to the PSP for placement idempotency + // (e.g. Coinbase `client_order_id`, Kraken `cl_ord_id`, Binance + // `clientOrderId`). Stored for traceability only — Formance does + // NOT dedup on this field. + // + ClientOrderID *string `json:"clientOrderID,omitempty"` + // ID of the Formance connector this order was fetched from. + ConnectorID string `json:"connectorID"` + // When the order was created on the PSP. + CreatedAt time.Time `json:"createdAt"` + // Formance account ID of the wallet the destination asset was credited to. Null if unresolvable. + DestinationAccountID *string `json:"destinationAccountID,omitempty"` + // Asset being received, in `SYMBOL/precision` form. + // For BUY: the base currency. For SELL: the quote currency. + // + DestinationAsset string `json:"destinationAsset"` + // Whether an order buys or sells the base asset. + Direction V3OrderDirectionEnum `json:"direction"` + // Human-readable error from the PSP (e.g. rejection reason) when `status` is `FAILED`. Null otherwise. + Error *string `json:"error,omitempty"` + // Expiration instant for `GOOD_UNTIL_DATE_TIME` orders. Null for other time-in-force values. + ExpiresAt *time.Time `json:"expiresAt,omitempty"` + // Commission charged by the PSP for the order, as an integer in `feeAsset` precision. + Fee *big.Int `json:"fee,omitempty"` + // Currency the fee is denominated in, in `SYMBOL/precision` form. Typically the quote asset. + FeeAsset *string `json:"feeAsset,omitempty"` + // Formance-assigned unique order ID (composed from the PSP reference and connector ID). + ID string `json:"id"` + // Maximum price (for BUY) or minimum price (for SELL) at which the order may execute, in `priceAsset` precision. Required for LIMIT-family order types; null otherwise. + LimitPrice *big.Int `json:"limitPrice,omitempty"` + Metadata map[string]string `json:"metadata,omitempty"` + // Currency + precision under which `limitPrice`, `stopPrice`, and + // `averageFillPrice` should be interpreted. Separate from + // `quoteAsset` because some PSPs return price strings with more + // decimal digits than the quote currency's natural precision. + // + PriceAsset *string `json:"priceAsset,omitempty"` + // Provider name of the connector (e.g. `coinbaseprime`). + Provider string `json:"provider"` + // Total amount of quote currency exchanged so far, as reported by + // the PSP (e.g. Coinbase `filled_value`), at `quoteAsset` + // precision. For BUY: amount spent. For SELL: amount received. + // + QuoteAmount *big.Int `json:"quoteAmount,omitempty"` + // Quote currency with precision (e.g. `USD/2`). Null when the order has no quote-side amounts reported yet. + QuoteAsset *string `json:"quoteAsset,omitempty"` + // PSP-assigned order reference. Unique within the connector; used as the storage dedup key. + Reference string `json:"reference"` + // Formance account ID of the wallet the source asset was debited + // from. Null if the PSP did not return enough information to + // resolve it at ingestion time. + // + SourceAccountID *string `json:"sourceAccountID,omitempty"` + // Asset being spent, in `SYMBOL/precision` form (e.g. `USD/2`, + // `BTC/8`). For BUY: the quote currency. For SELL: the base + // currency. + // + SourceAsset string `json:"sourceAsset"` + // Lifecycle of an order on the exchange. + // `PENDING` — accepted by the exchange, not yet working. + // `OPEN` — live on the book, no fills yet. + // `PARTIALLY_FILLED` — live on the book, some base quantity filled. + // `FILLED` — fully filled, terminal. + // `CANCELLED` — cancelled by the user or system, terminal. + // `FAILED` — rejected by the exchange, terminal. See `error` for details. + // `EXPIRED` — `timeInForce` elapsed before full fill, terminal. + // + Status V3OrderStatusEnum `json:"status"` + // Trigger price at which a STOP / STOP_LIMIT order activates, in `priceAsset` precision. Null for non-stop order types. + StopPrice *big.Int `json:"stopPrice,omitempty"` + // How long an order is valid on the exchange. + // `GOOD_UNTIL_CANCELLED` — rests until explicitly cancelled. + // `GOOD_UNTIL_DATE_TIME` — rests until `expiresAt`. + // `IMMEDIATE_OR_CANCEL` — fill immediately, cancel any unfilled portion. + // `FILL_OR_KILL` — fill fully and immediately, or cancel entirely. + // + TimeInForce V3TimeInForceEnum `json:"timeInForce"` + // Exchange order type. Determines which price fields are meaningful on + // `V3Order`: LIMIT-family types use `limitPrice`; STOP-family types use + // `stopPrice`; TWAP/VWAP are time-weighted execution algorithms. + // + Type V3OrderTypeEnum `json:"type"` + // When Formance last observed a state change on the order. Equivalent to the latest adjustment's `createdAt`. + UpdatedAt time.Time `json:"updatedAt"` +} + +func (v V3Order) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(v, "", false) +} + +func (v *V3Order) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &v, "", false, nil); err != nil { + return err + } + return nil +} + +func (v *V3Order) GetAdjustments() []V3OrderAdjustment { + if v == nil { + return nil + } + return v.Adjustments +} + +func (v *V3Order) GetAverageFillPrice() *big.Int { + if v == nil { + return nil + } + return v.AverageFillPrice +} + +func (v *V3Order) GetBaseQuantityFilled() *big.Int { + if v == nil { + return nil + } + return v.BaseQuantityFilled +} + +func (v *V3Order) GetBaseQuantityOrdered() *big.Int { + if v == nil { + return big.NewInt(0) + } + return v.BaseQuantityOrdered +} + +func (v *V3Order) GetClientOrderID() *string { + if v == nil { + return nil + } + return v.ClientOrderID +} + +func (v *V3Order) GetConnectorID() string { + if v == nil { + return "" + } + return v.ConnectorID +} + +func (v *V3Order) GetCreatedAt() time.Time { + if v == nil { + return time.Time{} + } + return v.CreatedAt +} + +func (v *V3Order) GetDestinationAccountID() *string { + if v == nil { + return nil + } + return v.DestinationAccountID +} + +func (v *V3Order) GetDestinationAsset() string { + if v == nil { + return "" + } + return v.DestinationAsset +} + +func (v *V3Order) GetDirection() V3OrderDirectionEnum { + if v == nil { + return V3OrderDirectionEnum("") + } + return v.Direction +} + +func (v *V3Order) GetError() *string { + if v == nil { + return nil + } + return v.Error +} + +func (v *V3Order) GetExpiresAt() *time.Time { + if v == nil { + return nil + } + return v.ExpiresAt +} + +func (v *V3Order) GetFee() *big.Int { + if v == nil { + return nil + } + return v.Fee +} + +func (v *V3Order) GetFeeAsset() *string { + if v == nil { + return nil + } + return v.FeeAsset +} + +func (v *V3Order) GetID() string { + if v == nil { + return "" + } + return v.ID +} + +func (v *V3Order) GetLimitPrice() *big.Int { + if v == nil { + return nil + } + return v.LimitPrice +} + +func (v *V3Order) GetMetadata() map[string]string { + if v == nil { + return nil + } + return v.Metadata +} + +func (v *V3Order) GetPriceAsset() *string { + if v == nil { + return nil + } + return v.PriceAsset +} + +func (v *V3Order) GetProvider() string { + if v == nil { + return "" + } + return v.Provider +} + +func (v *V3Order) GetQuoteAmount() *big.Int { + if v == nil { + return nil + } + return v.QuoteAmount +} + +func (v *V3Order) GetQuoteAsset() *string { + if v == nil { + return nil + } + return v.QuoteAsset +} + +func (v *V3Order) GetReference() string { + if v == nil { + return "" + } + return v.Reference +} + +func (v *V3Order) GetSourceAccountID() *string { + if v == nil { + return nil + } + return v.SourceAccountID +} + +func (v *V3Order) GetSourceAsset() string { + if v == nil { + return "" + } + return v.SourceAsset +} + +func (v *V3Order) GetStatus() V3OrderStatusEnum { + if v == nil { + return V3OrderStatusEnum("") + } + return v.Status +} + +func (v *V3Order) GetStopPrice() *big.Int { + if v == nil { + return nil + } + return v.StopPrice +} + +func (v *V3Order) GetTimeInForce() V3TimeInForceEnum { + if v == nil { + return V3TimeInForceEnum("") + } + return v.TimeInForce +} + +func (v *V3Order) GetType() V3OrderTypeEnum { + if v == nil { + return V3OrderTypeEnum("") + } + return v.Type +} + +func (v *V3Order) GetUpdatedAt() time.Time { + if v == nil { + return time.Time{} + } + return v.UpdatedAt +} + +// #region class-body-v3order +// #endregion class-body-v3order diff --git a/pkg/stack/pkg/models/shared/v3orderadjustment.go b/pkg/stack/pkg/models/shared/v3orderadjustment.go new file mode 100644 index 0000000..1de3074 --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3orderadjustment.go @@ -0,0 +1,126 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "github.com/formancehq/formance-sdk-go/v3/pkg/utils" + "math/big" + "time" +) + +// V3OrderAdjustmentRaw - Untransformed PSP response payload that produced this adjustment. Retained for debugging and replay. +type V3OrderAdjustmentRaw struct { +} + +// #region class-body-v3orderadjustmentraw +// #endregion class-body-v3orderadjustmentraw + +// V3OrderAdjustment - Immutable snapshot of an order's state at a single observation. +// Formance records one adjustment per distinct state the PSP reports +// (status change, fill progress, fee update). Events are emitted +// per-adjustment, not per-order — so a single order can produce many +// events over its lifetime. +type V3OrderAdjustment struct { + // Base asset filled at this observation, at the base asset's precision. + BaseQuantityFilled *big.Int `json:"baseQuantityFilled,omitempty"` + // When Formance observed this state. Not the PSP's own timestamp — reflects ingestion time. + CreatedAt time.Time `json:"createdAt"` + // Cumulative fee at this observation, at `feeAsset` precision. + Fee *big.Int `json:"fee,omitempty"` + // Currency the fee is denominated in, in `SYMBOL/precision` form. + FeeAsset *string `json:"feeAsset,omitempty"` + // Adjustment ID, composed from the order ID plus the state fields that define uniqueness (status, filled quantity, fee). Idempotent — replaying the same observation produces the same ID. + ID string `json:"id"` + Metadata map[string]string `json:"metadata,omitempty"` + // Untransformed PSP response payload that produced this adjustment. Retained for debugging and replay. + Raw *V3OrderAdjustmentRaw `json:"raw,omitempty"` + // PSP reference the adjustment belongs to (equal to the parent order's `reference`). + Reference string `json:"reference"` + // Lifecycle of an order on the exchange. + // `PENDING` — accepted by the exchange, not yet working. + // `OPEN` — live on the book, no fills yet. + // `PARTIALLY_FILLED` — live on the book, some base quantity filled. + // `FILLED` — fully filled, terminal. + // `CANCELLED` — cancelled by the user or system, terminal. + // `FAILED` — rejected by the exchange, terminal. See `error` for details. + // `EXPIRED` — `timeInForce` elapsed before full fill, terminal. + // + Status V3OrderStatusEnum `json:"status"` +} + +func (v V3OrderAdjustment) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(v, "", false) +} + +func (v *V3OrderAdjustment) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &v, "", false, nil); err != nil { + return err + } + return nil +} + +func (v *V3OrderAdjustment) GetBaseQuantityFilled() *big.Int { + if v == nil { + return nil + } + return v.BaseQuantityFilled +} + +func (v *V3OrderAdjustment) GetCreatedAt() time.Time { + if v == nil { + return time.Time{} + } + return v.CreatedAt +} + +func (v *V3OrderAdjustment) GetFee() *big.Int { + if v == nil { + return nil + } + return v.Fee +} + +func (v *V3OrderAdjustment) GetFeeAsset() *string { + if v == nil { + return nil + } + return v.FeeAsset +} + +func (v *V3OrderAdjustment) GetID() string { + if v == nil { + return "" + } + return v.ID +} + +func (v *V3OrderAdjustment) GetMetadata() map[string]string { + if v == nil { + return nil + } + return v.Metadata +} + +func (v *V3OrderAdjustment) GetRaw() *V3OrderAdjustmentRaw { + if v == nil { + return nil + } + return v.Raw +} + +func (v *V3OrderAdjustment) GetReference() string { + if v == nil { + return "" + } + return v.Reference +} + +func (v *V3OrderAdjustment) GetStatus() V3OrderStatusEnum { + if v == nil { + return V3OrderStatusEnum("") + } + return v.Status +} + +// #region class-body-v3orderadjustment +// #endregion class-body-v3orderadjustment diff --git a/pkg/stack/pkg/models/shared/v3orderdirectionenum.go b/pkg/stack/pkg/models/shared/v3orderdirectionenum.go new file mode 100644 index 0000000..ba3e52d --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3orderdirectionenum.go @@ -0,0 +1,38 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// V3OrderDirectionEnum - Whether an order buys or sells the base asset. +type V3OrderDirectionEnum string + +const ( + V3OrderDirectionEnumUnknown V3OrderDirectionEnum = "UNKNOWN" + V3OrderDirectionEnumBuy V3OrderDirectionEnum = "BUY" + V3OrderDirectionEnumSell V3OrderDirectionEnum = "SELL" +) + +func (e V3OrderDirectionEnum) ToPointer() *V3OrderDirectionEnum { + return &e +} +func (e *V3OrderDirectionEnum) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "UNKNOWN": + fallthrough + case "BUY": + fallthrough + case "SELL": + *e = V3OrderDirectionEnum(v) + return nil + default: + return fmt.Errorf("invalid value for V3OrderDirectionEnum: %v", v) + } +} diff --git a/pkg/stack/pkg/models/shared/v3orderscursorresponse.go b/pkg/stack/pkg/models/shared/v3orderscursorresponse.go new file mode 100644 index 0000000..0907917 --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3orderscursorresponse.go @@ -0,0 +1,63 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +type V3OrdersCursorResponseCursor struct { + Data []V3Order `json:"data"` + HasMore bool `json:"hasMore"` + Next *string `json:"next,omitempty"` + PageSize int64 `json:"pageSize"` + Previous *string `json:"previous,omitempty"` +} + +func (v *V3OrdersCursorResponseCursor) GetData() []V3Order { + if v == nil { + return []V3Order{} + } + return v.Data +} + +func (v *V3OrdersCursorResponseCursor) GetHasMore() bool { + if v == nil { + return false + } + return v.HasMore +} + +func (v *V3OrdersCursorResponseCursor) GetNext() *string { + if v == nil { + return nil + } + return v.Next +} + +func (v *V3OrdersCursorResponseCursor) GetPageSize() int64 { + if v == nil { + return 0 + } + return v.PageSize +} + +func (v *V3OrdersCursorResponseCursor) GetPrevious() *string { + if v == nil { + return nil + } + return v.Previous +} + +// #region class-body-v3orderscursorresponsecursor +// #endregion class-body-v3orderscursorresponsecursor + +type V3OrdersCursorResponse struct { + Cursor V3OrdersCursorResponseCursor `json:"cursor"` +} + +func (v *V3OrdersCursorResponse) GetCursor() V3OrdersCursorResponseCursor { + if v == nil { + return V3OrdersCursorResponseCursor{} + } + return v.Cursor +} + +// #region class-body-v3orderscursorresponse +// #endregion class-body-v3orderscursorresponse diff --git a/pkg/stack/pkg/models/shared/v3orderstatusenum.go b/pkg/stack/pkg/models/shared/v3orderstatusenum.go new file mode 100644 index 0000000..2792370 --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3orderstatusenum.go @@ -0,0 +1,60 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// V3OrderStatusEnum - Lifecycle of an order on the exchange. +// `PENDING` — accepted by the exchange, not yet working. +// `OPEN` — live on the book, no fills yet. +// `PARTIALLY_FILLED` — live on the book, some base quantity filled. +// `FILLED` — fully filled, terminal. +// `CANCELLED` — cancelled by the user or system, terminal. +// `FAILED` — rejected by the exchange, terminal. See `error` for details. +// `EXPIRED` — `timeInForce` elapsed before full fill, terminal. +type V3OrderStatusEnum string + +const ( + V3OrderStatusEnumUnknown V3OrderStatusEnum = "UNKNOWN" + V3OrderStatusEnumPending V3OrderStatusEnum = "PENDING" + V3OrderStatusEnumOpen V3OrderStatusEnum = "OPEN" + V3OrderStatusEnumPartiallyFilled V3OrderStatusEnum = "PARTIALLY_FILLED" + V3OrderStatusEnumFilled V3OrderStatusEnum = "FILLED" + V3OrderStatusEnumCancelled V3OrderStatusEnum = "CANCELLED" + V3OrderStatusEnumFailed V3OrderStatusEnum = "FAILED" + V3OrderStatusEnumExpired V3OrderStatusEnum = "EXPIRED" +) + +func (e V3OrderStatusEnum) ToPointer() *V3OrderStatusEnum { + return &e +} +func (e *V3OrderStatusEnum) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "UNKNOWN": + fallthrough + case "PENDING": + fallthrough + case "OPEN": + fallthrough + case "PARTIALLY_FILLED": + fallthrough + case "FILLED": + fallthrough + case "CANCELLED": + fallthrough + case "FAILED": + fallthrough + case "EXPIRED": + *e = V3OrderStatusEnum(v) + return nil + default: + return fmt.Errorf("invalid value for V3OrderStatusEnum: %v", v) + } +} diff --git a/pkg/stack/pkg/models/shared/v3ordertypeenum.go b/pkg/stack/pkg/models/shared/v3ordertypeenum.go new file mode 100644 index 0000000..a4b60a7 --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3ordertypeenum.go @@ -0,0 +1,76 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// V3OrderTypeEnum - Exchange order type. Determines which price fields are meaningful on +// `V3Order`: LIMIT-family types use `limitPrice`; STOP-family types use +// `stopPrice`; TWAP/VWAP are time-weighted execution algorithms. +type V3OrderTypeEnum string + +const ( + V3OrderTypeEnumUnknown V3OrderTypeEnum = "UNKNOWN" + V3OrderTypeEnumMarket V3OrderTypeEnum = "MARKET" + V3OrderTypeEnumLimit V3OrderTypeEnum = "LIMIT" + V3OrderTypeEnumStopLimit V3OrderTypeEnum = "STOP_LIMIT" + V3OrderTypeEnumStop V3OrderTypeEnum = "STOP" + V3OrderTypeEnumTwap V3OrderTypeEnum = "TWAP" + V3OrderTypeEnumVwap V3OrderTypeEnum = "VWAP" + V3OrderTypeEnumPeg V3OrderTypeEnum = "PEG" + V3OrderTypeEnumBlock V3OrderTypeEnum = "BLOCK" + V3OrderTypeEnumRfq V3OrderTypeEnum = "RFQ" + V3OrderTypeEnumTrailingStop V3OrderTypeEnum = "TRAILING_STOP" + V3OrderTypeEnumTrailingStopLimit V3OrderTypeEnum = "TRAILING_STOP_LIMIT" + V3OrderTypeEnumTakeProfit V3OrderTypeEnum = "TAKE_PROFIT" + V3OrderTypeEnumTakeProfitLimit V3OrderTypeEnum = "TAKE_PROFIT_LIMIT" + V3OrderTypeEnumLimitMaker V3OrderTypeEnum = "LIMIT_MAKER" +) + +func (e V3OrderTypeEnum) ToPointer() *V3OrderTypeEnum { + return &e +} +func (e *V3OrderTypeEnum) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "UNKNOWN": + fallthrough + case "MARKET": + fallthrough + case "LIMIT": + fallthrough + case "STOP_LIMIT": + fallthrough + case "STOP": + fallthrough + case "TWAP": + fallthrough + case "VWAP": + fallthrough + case "PEG": + fallthrough + case "BLOCK": + fallthrough + case "RFQ": + fallthrough + case "TRAILING_STOP": + fallthrough + case "TRAILING_STOP_LIMIT": + fallthrough + case "TAKE_PROFIT": + fallthrough + case "TAKE_PROFIT_LIMIT": + fallthrough + case "LIMIT_MAKER": + *e = V3OrderTypeEnum(v) + return nil + default: + return fmt.Errorf("invalid value for V3OrderTypeEnum: %v", v) + } +} diff --git a/pkg/stack/pkg/models/shared/v3timeinforceenum.go b/pkg/stack/pkg/models/shared/v3timeinforceenum.go new file mode 100644 index 0000000..ec9bc0f --- /dev/null +++ b/pkg/stack/pkg/models/shared/v3timeinforceenum.go @@ -0,0 +1,48 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package shared + +import ( + "encoding/json" + "fmt" +) + +// V3TimeInForceEnum - How long an order is valid on the exchange. +// `GOOD_UNTIL_CANCELLED` — rests until explicitly cancelled. +// `GOOD_UNTIL_DATE_TIME` — rests until `expiresAt`. +// `IMMEDIATE_OR_CANCEL` — fill immediately, cancel any unfilled portion. +// `FILL_OR_KILL` — fill fully and immediately, or cancel entirely. +type V3TimeInForceEnum string + +const ( + V3TimeInForceEnumUnknown V3TimeInForceEnum = "UNKNOWN" + V3TimeInForceEnumGoodUntilCancelled V3TimeInForceEnum = "GOOD_UNTIL_CANCELLED" + V3TimeInForceEnumGoodUntilDateTime V3TimeInForceEnum = "GOOD_UNTIL_DATE_TIME" + V3TimeInForceEnumImmediateOrCancel V3TimeInForceEnum = "IMMEDIATE_OR_CANCEL" + V3TimeInForceEnumFillOrKill V3TimeInForceEnum = "FILL_OR_KILL" +) + +func (e V3TimeInForceEnum) ToPointer() *V3TimeInForceEnum { + return &e +} +func (e *V3TimeInForceEnum) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "UNKNOWN": + fallthrough + case "GOOD_UNTIL_CANCELLED": + fallthrough + case "GOOD_UNTIL_DATE_TIME": + fallthrough + case "IMMEDIATE_OR_CANCEL": + fallthrough + case "FILL_OR_KILL": + *e = V3TimeInForceEnum(v) + return nil + default: + return fmt.Errorf("invalid value for V3TimeInForceEnum: %v", v) + } +} diff --git a/pkg/stack/pkg/models/shared/workflowinstancehistorystageinput.go b/pkg/stack/pkg/models/shared/workflowinstancehistorystageinput.go index 60a2688..c30b25a 100644 --- a/pkg/stack/pkg/models/shared/workflowinstancehistorystageinput.go +++ b/pkg/stack/pkg/models/shared/workflowinstancehistorystageinput.go @@ -3,18 +3,19 @@ package shared type WorkflowInstanceHistoryStageInput struct { - AddAccountMetadata *ActivityAddAccountMetadata `json:"AddAccountMetadata,omitempty"` - ConfirmHold *ActivityConfirmHold `json:"ConfirmHold,omitempty"` - CreateTransaction *ActivityCreateTransaction `json:"CreateTransaction,omitempty"` - CreditWallet *ActivityCreditWallet `json:"CreditWallet,omitempty"` - DebitWallet *ActivityDebitWallet `json:"DebitWallet,omitempty"` - GetAccount *ActivityGetAccount `json:"GetAccount,omitempty"` - GetPayment *ActivityGetPayment `json:"GetPayment,omitempty"` - GetWallet *ActivityGetWallet `json:"GetWallet,omitempty"` - ListWallets *ActivityListWallets `json:"ListWallets,omitempty"` - RevertTransaction *ActivityRevertTransaction `json:"RevertTransaction,omitempty"` - StripeTransfer *ActivityStripeTransfer `json:"StripeTransfer,omitempty"` - VoidHold *ActivityVoidHold `json:"VoidHold,omitempty"` + AddAccountMetadata *ActivityAddAccountMetadata `json:"AddAccountMetadata,omitempty"` + ConfirmHold *ActivityConfirmHold `json:"ConfirmHold,omitempty"` + CreateTransaction *ActivityCreateTransaction `json:"CreateTransaction,omitempty"` + CreateTransferInitiation *ActivityCreateTransferInitiation `json:"CreateTransferInitiation,omitempty"` + CreditWallet *ActivityCreditWallet `json:"CreditWallet,omitempty"` + DebitWallet *ActivityDebitWallet `json:"DebitWallet,omitempty"` + GetAccount *ActivityGetAccount `json:"GetAccount,omitempty"` + GetPayment *ActivityGetPayment `json:"GetPayment,omitempty"` + GetWallet *ActivityGetWallet `json:"GetWallet,omitempty"` + ListWallets *ActivityListWallets `json:"ListWallets,omitempty"` + RevertTransaction *ActivityRevertTransaction `json:"RevertTransaction,omitempty"` + StripeTransfer *ActivityStripeTransfer `json:"StripeTransfer,omitempty"` + VoidHold *ActivityVoidHold `json:"VoidHold,omitempty"` } func (w *WorkflowInstanceHistoryStageInput) GetAddAccountMetadata() *ActivityAddAccountMetadata { @@ -38,6 +39,13 @@ func (w *WorkflowInstanceHistoryStageInput) GetCreateTransaction() *ActivityCrea return w.CreateTransaction } +func (w *WorkflowInstanceHistoryStageInput) GetCreateTransferInitiation() *ActivityCreateTransferInitiation { + if w == nil { + return nil + } + return w.CreateTransferInitiation +} + func (w *WorkflowInstanceHistoryStageInput) GetCreditWallet() *ActivityCreditWallet { if w == nil { return nil diff --git a/pkg/stack/v3.go b/pkg/stack/v3.go index 5b72872..83b1c54 100644 --- a/pkg/stack/v3.go +++ b/pkg/stack/v3.go @@ -4814,8 +4814,16 @@ func (s *V3) GetConnectorSchedule(ctx context.Context, request operations.V3GetC } -// GetPayment - Get a payment by ID -func (s *V3) GetPayment(ctx context.Context, request operations.V3GetPaymentRequest, opts ...operations.Option) (*operations.V3GetPaymentResponse, error) { +// GetConversion - Get a single conversion by its Formance ID +// Returns one conversion identified by its Formance-assigned `id` +// (**not** the PSP's native `reference`). See `V3Conversion` for the +// response shape — on `COMPLETED` status the `destinationAmount` and +// `fee` fields reflect the settled values; on `FAILED` the `error` +// field carries the PSP's rejection reason. +// +// Returns an error via `V3ErrorResponse` when no conversion exists +// for the given ID. +func (s *V3) GetConversion(ctx context.Context, request operations.V3GetConversionRequest, opts ...operations.Option) (*operations.V3GetConversionResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -4834,7 +4842,7 @@ func (s *V3) GetPayment(ctx context.Context, request operations.V3GetPaymentRequ } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/payments/{paymentID}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/conversions/{conversionID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -4844,7 +4852,7 @@ func (s *V3) GetPayment(ctx context.Context, request operations.V3GetPaymentRequ SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3GetPayment", + OperationID: "v3GetConversion", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -4966,7 +4974,7 @@ func (s *V3) GetPayment(ctx context.Context, request operations.V3GetPaymentRequ } } - res := &operations.V3GetPaymentResponse{ + res := &operations.V3GetConversionResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -4981,12 +4989,12 @@ func (s *V3) GetPayment(ctx context.Context, request operations.V3GetPaymentRequ return nil, err } - var out shared.V3GetPaymentResponse + var out shared.V3GetConversionResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3GetPaymentResponse = &out + res.V3GetConversionResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -5033,8 +5041,16 @@ func (s *V3) GetPayment(ctx context.Context, request operations.V3GetPaymentRequ } -// GetPaymentInitiation - Get a payment initiation by ID -func (s *V3) GetPaymentInitiation(ctx context.Context, request operations.V3GetPaymentInitiationRequest, opts ...operations.Option) (*operations.V3GetPaymentInitiationResponse, error) { +// GetOrder - Get a single order by its Formance ID +// Returns one order identified by its Formance-assigned `id` (composed +// from the PSP `reference` and the connector ID — **not** the PSP's +// native reference). The response includes the full `adjustments` +// history ordered from oldest to most recent; the last adjustment +// reflects the order's current top-level `status`. +// +// Returns an error via `V3ErrorResponse` when no order exists for the +// given ID, or when the ID cannot be decoded. +func (s *V3) GetOrder(ctx context.Context, request operations.V3GetOrderRequest, opts ...operations.Option) (*operations.V3GetOrderResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -5053,7 +5069,7 @@ func (s *V3) GetPaymentInitiation(ctx context.Context, request operations.V3GetP } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/payment-initiations/{paymentInitiationID}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/orders/{orderID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -5063,7 +5079,7 @@ func (s *V3) GetPaymentInitiation(ctx context.Context, request operations.V3GetP SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3GetPaymentInitiation", + OperationID: "v3GetOrder", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5185,7 +5201,7 @@ func (s *V3) GetPaymentInitiation(ctx context.Context, request operations.V3GetP } } - res := &operations.V3GetPaymentInitiationResponse{ + res := &operations.V3GetOrderResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -5200,12 +5216,12 @@ func (s *V3) GetPaymentInitiation(ctx context.Context, request operations.V3GetP return nil, err } - var out shared.V3GetPaymentInitiationResponse + var out shared.V3GetOrderResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3GetPaymentInitiationResponse = &out + res.V3GetOrderResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -5252,8 +5268,8 @@ func (s *V3) GetPaymentInitiation(ctx context.Context, request operations.V3GetP } -// GetPaymentServiceUser - Get a payment service user by ID -func (s *V3) GetPaymentServiceUser(ctx context.Context, request operations.V3GetPaymentServiceUserRequest, opts ...operations.Option) (*operations.V3GetPaymentServiceUserResponse, error) { +// GetPayment - Get a payment by ID +func (s *V3) GetPayment(ctx context.Context, request operations.V3GetPaymentRequest, opts ...operations.Option) (*operations.V3GetPaymentResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -5272,7 +5288,7 @@ func (s *V3) GetPaymentServiceUser(ctx context.Context, request operations.V3Get } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/payment-service-users/{paymentServiceUserID}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/payments/{paymentID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -5282,7 +5298,7 @@ func (s *V3) GetPaymentServiceUser(ctx context.Context, request operations.V3Get SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3GetPaymentServiceUser", + OperationID: "v3GetPayment", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5404,7 +5420,7 @@ func (s *V3) GetPaymentServiceUser(ctx context.Context, request operations.V3Get } } - res := &operations.V3GetPaymentServiceUserResponse{ + res := &operations.V3GetPaymentResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -5419,12 +5435,12 @@ func (s *V3) GetPaymentServiceUser(ctx context.Context, request operations.V3Get return nil, err } - var out shared.V3GetPaymentServiceUserResponse + var out shared.V3GetPaymentResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3GetPaymentServiceUserResponse = &out + res.V3GetPaymentResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -5471,8 +5487,8 @@ func (s *V3) GetPaymentServiceUser(ctx context.Context, request operations.V3Get } -// GetPaymentServiceUserLinkAttemptFromConnectorID - Get a link attempt for a payment service user on a connector -func (s *V3) GetPaymentServiceUserLinkAttemptFromConnectorID(ctx context.Context, request operations.V3GetPaymentServiceUserLinkAttemptFromConnectorIDRequest, opts ...operations.Option) (*operations.V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse, error) { +// GetPaymentInitiation - Get a payment initiation by ID +func (s *V3) GetPaymentInitiation(ctx context.Context, request operations.V3GetPaymentInitiationRequest, opts ...operations.Option) (*operations.V3GetPaymentInitiationResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -5491,7 +5507,7 @@ func (s *V3) GetPaymentServiceUserLinkAttemptFromConnectorID(ctx context.Context } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts/{attemptID}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/payment-initiations/{paymentInitiationID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -5501,7 +5517,7 @@ func (s *V3) GetPaymentServiceUserLinkAttemptFromConnectorID(ctx context.Context SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3GetPaymentServiceUserLinkAttemptFromConnectorID", + OperationID: "v3GetPaymentInitiation", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5623,7 +5639,7 @@ func (s *V3) GetPaymentServiceUserLinkAttemptFromConnectorID(ctx context.Context } } - res := &operations.V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse{ + res := &operations.V3GetPaymentInitiationResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -5638,12 +5654,12 @@ func (s *V3) GetPaymentServiceUserLinkAttemptFromConnectorID(ctx context.Context return nil, err } - var out shared.V3PaymentServiceUserLinkAttempt + var out shared.V3GetPaymentInitiationResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3PaymentServiceUserLinkAttempt = &out + res.V3GetPaymentInitiationResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -5690,8 +5706,8 @@ func (s *V3) GetPaymentServiceUserLinkAttemptFromConnectorID(ctx context.Context } -// GetPool - Get a pool by ID -func (s *V3) GetPool(ctx context.Context, request operations.V3GetPoolRequest, opts ...operations.Option) (*operations.V3GetPoolResponse, error) { +// GetPaymentServiceUser - Get a payment service user by ID +func (s *V3) GetPaymentServiceUser(ctx context.Context, request operations.V3GetPaymentServiceUserRequest, opts ...operations.Option) (*operations.V3GetPaymentServiceUserResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -5710,7 +5726,7 @@ func (s *V3) GetPool(ctx context.Context, request operations.V3GetPoolRequest, o } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/pools/{poolID}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/payment-service-users/{paymentServiceUserID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -5720,7 +5736,7 @@ func (s *V3) GetPool(ctx context.Context, request operations.V3GetPoolRequest, o SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3GetPool", + OperationID: "v3GetPaymentServiceUser", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5842,7 +5858,7 @@ func (s *V3) GetPool(ctx context.Context, request operations.V3GetPoolRequest, o } } - res := &operations.V3GetPoolResponse{ + res := &operations.V3GetPaymentServiceUserResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -5857,12 +5873,12 @@ func (s *V3) GetPool(ctx context.Context, request operations.V3GetPoolRequest, o return nil, err } - var out shared.V3GetPoolResponse + var out shared.V3GetPaymentServiceUserResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3GetPoolResponse = &out + res.V3GetPaymentServiceUserResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -5909,8 +5925,8 @@ func (s *V3) GetPool(ctx context.Context, request operations.V3GetPoolRequest, o } -// GetPoolBalances - Get historical pool balances from a particular point in time -func (s *V3) GetPoolBalances(ctx context.Context, request operations.V3GetPoolBalancesRequest, opts ...operations.Option) (*operations.V3GetPoolBalancesResponse, error) { +// GetPaymentServiceUserLinkAttemptFromConnectorID - Get a link attempt for a payment service user on a connector +func (s *V3) GetPaymentServiceUserLinkAttemptFromConnectorID(ctx context.Context, request operations.V3GetPaymentServiceUserLinkAttemptFromConnectorIDRequest, opts ...operations.Option) (*operations.V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -5929,7 +5945,7 @@ func (s *V3) GetPoolBalances(ctx context.Context, request operations.V3GetPoolBa } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/pools/{poolID}/balances", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/payment-service-users/{paymentServiceUserID}/connectors/{connectorID}/link-attempts/{attemptID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -5939,7 +5955,7 @@ func (s *V3) GetPoolBalances(ctx context.Context, request operations.V3GetPoolBa SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3GetPoolBalances", + OperationID: "v3GetPaymentServiceUserLinkAttemptFromConnectorID", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -5962,10 +5978,6 @@ func (s *V3) GetPoolBalances(ctx context.Context, request operations.V3GetPoolBa req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } - if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } @@ -6065,7 +6077,7 @@ func (s *V3) GetPoolBalances(ctx context.Context, request operations.V3GetPoolBa } } - res := &operations.V3GetPoolBalancesResponse{ + res := &operations.V3GetPaymentServiceUserLinkAttemptFromConnectorIDResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -6080,12 +6092,12 @@ func (s *V3) GetPoolBalances(ctx context.Context, request operations.V3GetPoolBa return nil, err } - var out shared.V3PoolBalancesResponse + var out shared.V3PaymentServiceUserLinkAttempt if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3PoolBalancesResponse = &out + res.V3PaymentServiceUserLinkAttempt = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -6132,8 +6144,8 @@ func (s *V3) GetPoolBalances(ctx context.Context, request operations.V3GetPoolBa } -// GetPoolBalancesLatest - Get latest pool balances -func (s *V3) GetPoolBalancesLatest(ctx context.Context, request operations.V3GetPoolBalancesLatestRequest, opts ...operations.Option) (*operations.V3GetPoolBalancesLatestResponse, error) { +// GetPool - Get a pool by ID +func (s *V3) GetPool(ctx context.Context, request operations.V3GetPoolRequest, opts ...operations.Option) (*operations.V3GetPoolResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -6152,7 +6164,7 @@ func (s *V3) GetPoolBalancesLatest(ctx context.Context, request operations.V3Get } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/pools/{poolID}/balances/latest", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/pools/{poolID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -6162,7 +6174,7 @@ func (s *V3) GetPoolBalancesLatest(ctx context.Context, request operations.V3Get SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3GetPoolBalancesLatest", + OperationID: "v3GetPool", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -6284,7 +6296,7 @@ func (s *V3) GetPoolBalancesLatest(ctx context.Context, request operations.V3Get } } - res := &operations.V3GetPoolBalancesLatestResponse{ + res := &operations.V3GetPoolResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -6299,12 +6311,12 @@ func (s *V3) GetPoolBalancesLatest(ctx context.Context, request operations.V3Get return nil, err } - var out shared.V3PoolBalancesResponse + var out shared.V3GetPoolResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3PoolBalancesResponse = &out + res.V3GetPoolResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -6351,8 +6363,8 @@ func (s *V3) GetPoolBalancesLatest(ctx context.Context, request operations.V3Get } -// GetTask - Get a task and its result by ID -func (s *V3) GetTask(ctx context.Context, request operations.V3GetTaskRequest, opts ...operations.Option) (*operations.V3GetTaskResponse, error) { +// GetPoolBalances - Get historical pool balances from a particular point in time +func (s *V3) GetPoolBalances(ctx context.Context, request operations.V3GetPoolBalancesRequest, opts ...operations.Option) (*operations.V3GetPoolBalancesResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -6371,7 +6383,7 @@ func (s *V3) GetTask(ctx context.Context, request operations.V3GetTaskRequest, o } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/tasks/{taskID}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/pools/{poolID}/balances", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -6381,7 +6393,7 @@ func (s *V3) GetTask(ctx context.Context, request operations.V3GetTaskRequest, o SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3GetTask", + OperationID: "v3GetPoolBalances", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -6404,6 +6416,10 @@ func (s *V3) GetTask(ctx context.Context, request operations.V3GetTaskRequest, o req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } @@ -6503,7 +6519,7 @@ func (s *V3) GetTask(ctx context.Context, request operations.V3GetTaskRequest, o } } - res := &operations.V3GetTaskResponse{ + res := &operations.V3GetPoolBalancesResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -6518,12 +6534,12 @@ func (s *V3) GetTask(ctx context.Context, request operations.V3GetTaskRequest, o return nil, err } - var out shared.V3GetTaskResponse + var out shared.V3PoolBalancesResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3GetTaskResponse = &out + res.V3PoolBalancesResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -6570,8 +6586,8 @@ func (s *V3) GetTask(ctx context.Context, request operations.V3GetTaskRequest, o } -// InitiatePayment - Initiate a payment -func (s *V3) InitiatePayment(ctx context.Context, request operations.V3InitiatePaymentRequest, opts ...operations.Option) (*operations.V3InitiatePaymentResponse, error) { +// GetPoolBalancesLatest - Get latest pool balances +func (s *V3) GetPoolBalancesLatest(ctx context.Context, request operations.V3GetPoolBalancesLatestRequest, opts ...operations.Option) (*operations.V3GetPoolBalancesLatestResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -6590,7 +6606,7 @@ func (s *V3) InitiatePayment(ctx context.Context, request operations.V3InitiateP } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/api/payments/v3/payment-initiations") + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/pools/{poolID}/balances/latest", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -6600,14 +6616,10 @@ func (s *V3) InitiatePayment(ctx context.Context, request operations.V3InitiateP SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3InitiatePayment", - OAuth2Scopes: []string{"payments:write"}, + OperationID: "v3GetPoolBalancesLatest", + OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "V3InitiatePaymentRequest", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } timeout := o.Timeout if timeout == nil { @@ -6620,19 +6632,12 @@ func (s *V3) InitiatePayment(ctx context.Context, request operations.V3InitiateP defer cancel() } - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - if reqContentType != "" { - req.Header.Set("Content-Type", reqContentType) - } - - if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) - } if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err @@ -6733,14 +6738,14 @@ func (s *V3) InitiatePayment(ctx context.Context, request operations.V3InitiateP } } - res := &operations.V3InitiatePaymentResponse{ + res := &operations.V3GetPoolBalancesLatestResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } switch { - case httpRes.StatusCode == 202: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -6748,12 +6753,12 @@ func (s *V3) InitiatePayment(ctx context.Context, request operations.V3InitiateP return nil, err } - var out shared.V3InitiatePaymentResponse + var out shared.V3PoolBalancesResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3InitiatePaymentResponse = &out + res.V3PoolBalancesResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -6800,8 +6805,8 @@ func (s *V3) InitiatePayment(ctx context.Context, request operations.V3InitiateP } -// InstallConnector - Install a connector -func (s *V3) InstallConnector(ctx context.Context, request operations.V3InstallConnectorRequest, opts ...operations.Option) (*operations.V3InstallConnectorResponse, error) { +// GetTask - Get a task and its result by ID +func (s *V3) GetTask(ctx context.Context, request operations.V3GetTaskRequest, opts ...operations.Option) (*operations.V3GetTaskResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -6820,7 +6825,7 @@ func (s *V3) InstallConnector(ctx context.Context, request operations.V3InstallC } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/connectors/install/{connector}", request, nil) + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/tasks/{taskID}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -6830,14 +6835,10 @@ func (s *V3) InstallConnector(ctx context.Context, request operations.V3InstallC SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3InstallConnector", - OAuth2Scopes: []string{"payments:write"}, + OperationID: "v3GetTask", + OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } - bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "V3InstallConnectorRequest", "json", `request:"mediaType=application/json"`) - if err != nil { - return nil, err - } timeout := o.Timeout if timeout == nil { @@ -6850,15 +6851,12 @@ func (s *V3) InstallConnector(ctx context.Context, request operations.V3InstallC defer cancel() } - req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - if reqContentType != "" { - req.Header.Set("Content-Type", reqContentType) - } if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err @@ -6959,14 +6957,14 @@ func (s *V3) InstallConnector(ctx context.Context, request operations.V3InstallC } } - res := &operations.V3InstallConnectorResponse{ + res := &operations.V3GetTaskResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } switch { - case httpRes.StatusCode == 202: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -6974,12 +6972,12 @@ func (s *V3) InstallConnector(ctx context.Context, request operations.V3InstallC return nil, err } - var out shared.V3InstallConnectorResponse + var out shared.V3GetTaskResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3InstallConnectorResponse = &out + res.V3GetTaskResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -7026,8 +7024,8 @@ func (s *V3) InstallConnector(ctx context.Context, request operations.V3InstallC } -// ListAccounts - List all accounts -func (s *V3) ListAccounts(ctx context.Context, request operations.V3ListAccountsRequest, opts ...operations.Option) (*operations.V3ListAccountsResponse, error) { +// InitiatePayment - Initiate a payment +func (s *V3) InitiatePayment(ctx context.Context, request operations.V3InitiatePaymentRequest, opts ...operations.Option) (*operations.V3InitiatePaymentResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -7046,7 +7044,7 @@ func (s *V3) ListAccounts(ctx context.Context, request operations.V3ListAccounts } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/api/payments/v3/accounts") + opURL, err := url.JoinPath(baseURL, "/api/payments/v3/payment-initiations") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -7056,10 +7054,14 @@ func (s *V3) ListAccounts(ctx context.Context, request operations.V3ListAccounts SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3ListAccounts", - OAuth2Scopes: []string{"payments:read"}, + OperationID: "v3InitiatePayment", + OAuth2Scopes: []string{"payments:write"}, SecuritySource: s.sdkConfiguration.Security, } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "V3InitiatePaymentRequest", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } timeout := o.Timeout if timeout == nil { @@ -7072,12 +7074,15 @@ func (s *V3) ListAccounts(ctx context.Context, request operations.V3ListAccounts defer cancel() } - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) + } if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { return nil, fmt.Errorf("error populating query params: %w", err) @@ -7182,14 +7187,14 @@ func (s *V3) ListAccounts(ctx context.Context, request operations.V3ListAccounts } } - res := &operations.V3ListAccountsResponse{ + res := &operations.V3InitiatePaymentResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 202: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -7197,12 +7202,12 @@ func (s *V3) ListAccounts(ctx context.Context, request operations.V3ListAccounts return nil, err } - var out shared.V3AccountsCursorResponse + var out shared.V3InitiatePaymentResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3AccountsCursorResponse = &out + res.V3InitiatePaymentResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -7249,8 +7254,8 @@ func (s *V3) ListAccounts(ctx context.Context, request operations.V3ListAccounts } -// ListBankAccounts - List all bank accounts -func (s *V3) ListBankAccounts(ctx context.Context, request operations.V3ListBankAccountsRequest, opts ...operations.Option) (*operations.V3ListBankAccountsResponse, error) { +// InstallConnector - Install a connector +func (s *V3) InstallConnector(ctx context.Context, request operations.V3InstallConnectorRequest, opts ...operations.Option) (*operations.V3InstallConnectorResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -7269,7 +7274,7 @@ func (s *V3) ListBankAccounts(ctx context.Context, request operations.V3ListBank } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/api/payments/v3/bank-accounts") + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/connectors/install/{connector}", request, nil) if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -7279,10 +7284,14 @@ func (s *V3) ListBankAccounts(ctx context.Context, request operations.V3ListBank SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3ListBankAccounts", - OAuth2Scopes: []string{"payments:read"}, + OperationID: "v3InstallConnector", + OAuth2Scopes: []string{"payments:write"}, SecuritySource: s.sdkConfiguration.Security, } + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, true, "V3InstallConnectorRequest", "json", `request:"mediaType=application/json"`) + if err != nil { + return nil, err + } timeout := o.Timeout if timeout == nil { @@ -7295,15 +7304,14 @@ func (s *V3) ListBankAccounts(ctx context.Context, request operations.V3ListBank defer cancel() } - req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) if err != nil { return nil, fmt.Errorf("error creating request: %w", err) } req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) - - if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { - return nil, fmt.Errorf("error populating query params: %w", err) + if reqContentType != "" { + req.Header.Set("Content-Type", reqContentType) } if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { @@ -7405,14 +7413,14 @@ func (s *V3) ListBankAccounts(ctx context.Context, request operations.V3ListBank } } - res := &operations.V3ListBankAccountsResponse{ + res := &operations.V3InstallConnectorResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, } switch { - case httpRes.StatusCode == 200: + case httpRes.StatusCode == 202: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): rawBody, err := utils.ConsumeRawBody(httpRes) @@ -7420,12 +7428,12 @@ func (s *V3) ListBankAccounts(ctx context.Context, request operations.V3ListBank return nil, err } - var out shared.V3BankAccountsCursorResponse + var out shared.V3InstallConnectorResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3BankAccountsCursorResponse = &out + res.V3InstallConnectorResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -7472,8 +7480,8 @@ func (s *V3) ListBankAccounts(ctx context.Context, request operations.V3ListBank } -// ListConnectorConfigs - List all connector configurations -func (s *V3) ListConnectorConfigs(ctx context.Context, opts ...operations.Option) (*operations.V3ListConnectorConfigsResponse, error) { +// ListAccounts - List all accounts +func (s *V3) ListAccounts(ctx context.Context, request operations.V3ListAccountsRequest, opts ...operations.Option) (*operations.V3ListAccountsResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -7492,7 +7500,7 @@ func (s *V3) ListConnectorConfigs(ctx context.Context, opts ...operations.Option } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/api/payments/v3/connectors/configs") + opURL, err := url.JoinPath(baseURL, "/api/payments/v3/accounts") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -7502,7 +7510,7 @@ func (s *V3) ListConnectorConfigs(ctx context.Context, opts ...operations.Option SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3ListConnectorConfigs", + OperationID: "v3ListAccounts", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -7525,6 +7533,10 @@ func (s *V3) ListConnectorConfigs(ctx context.Context, opts ...operations.Option req.Header.Set("Accept", "application/json") req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { return nil, err } @@ -7624,7 +7636,7 @@ func (s *V3) ListConnectorConfigs(ctx context.Context, opts ...operations.Option } } - res := &operations.V3ListConnectorConfigsResponse{ + res := &operations.V3ListAccountsResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -7639,12 +7651,12 @@ func (s *V3) ListConnectorConfigs(ctx context.Context, opts ...operations.Option return nil, err } - var out shared.V3ConnectorConfigsResponse + var out shared.V3AccountsCursorResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3ConnectorConfigsResponse = &out + res.V3AccountsCursorResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -7691,8 +7703,8 @@ func (s *V3) ListConnectorConfigs(ctx context.Context, opts ...operations.Option } -// ListConnectorScheduleInstances - List all connector schedule instances -func (s *V3) ListConnectorScheduleInstances(ctx context.Context, request operations.V3ListConnectorScheduleInstancesRequest, opts ...operations.Option) (*operations.V3ListConnectorScheduleInstancesResponse, error) { +// ListBankAccounts - List all bank accounts +func (s *V3) ListBankAccounts(ctx context.Context, request operations.V3ListBankAccountsRequest, opts ...operations.Option) (*operations.V3ListBankAccountsResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -7711,7 +7723,7 @@ func (s *V3) ListConnectorScheduleInstances(ctx context.Context, request operati } else { baseURL = *o.ServerURL } - opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/connectors/{connectorID}/schedules/{scheduleID}/instances", request, nil) + opURL, err := url.JoinPath(baseURL, "/api/payments/v3/bank-accounts") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -7721,7 +7733,7 @@ func (s *V3) ListConnectorScheduleInstances(ctx context.Context, request operati SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3ListConnectorScheduleInstances", + OperationID: "v3ListBankAccounts", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -7847,7 +7859,7 @@ func (s *V3) ListConnectorScheduleInstances(ctx context.Context, request operati } } - res := &operations.V3ListConnectorScheduleInstancesResponse{ + res := &operations.V3ListBankAccountsResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -7862,12 +7874,12 @@ func (s *V3) ListConnectorScheduleInstances(ctx context.Context, request operati return nil, err } - var out shared.V3ConnectorScheduleInstancesCursorResponse + var out shared.V3BankAccountsCursorResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3ConnectorScheduleInstancesCursorResponse = &out + res.V3BankAccountsCursorResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -7914,8 +7926,450 @@ func (s *V3) ListConnectorScheduleInstances(ctx context.Context, request operati } -// ListConnectorSchedules - List all connector schedules -func (s *V3) ListConnectorSchedules(ctx context.Context, request operations.V3ListConnectorSchedulesRequest, opts ...operations.Option) (*operations.V3ListConnectorSchedulesResponse, error) { +// ListConnectorConfigs - List all connector configurations +func (s *V3) ListConnectorConfigs(ctx context.Context, opts ...operations.Option) (*operations.V3ListConnectorConfigsResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/api/payments/v3/connectors/configs") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "v3ListConnectorConfigs", + OAuth2Scopes: []string{"payments:read"}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3ListConnectorConfigsResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out shared.V3ConnectorConfigsResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ConnectorConfigsResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out shared.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// ListConnectorScheduleInstances - List all connector schedule instances +func (s *V3) ListConnectorScheduleInstances(ctx context.Context, request operations.V3ListConnectorScheduleInstancesRequest, opts ...operations.Option) (*operations.V3ListConnectorScheduleInstancesResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := utils.GenerateURL(ctx, baseURL, "/api/payments/v3/connectors/{connectorID}/schedules/{scheduleID}/instances", request, nil) + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "v3ListConnectorScheduleInstances", + OAuth2Scopes: []string{"payments:read"}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3ListConnectorScheduleInstancesResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out shared.V3ConnectorScheduleInstancesCursorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ConnectorScheduleInstancesCursorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out shared.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// ListConnectorSchedules - List all connector schedules +func (s *V3) ListConnectorSchedules(ctx context.Context, request operations.V3ListConnectorSchedulesRequest, opts ...operations.Option) (*operations.V3ListConnectorSchedulesResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -7944,7 +8398,230 @@ func (s *V3) ListConnectorSchedules(ctx context.Context, request operations.V3Li SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3ListConnectorSchedules", + OperationID: "v3ListConnectorSchedules", + OAuth2Scopes: []string{"payments:read"}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3ListConnectorSchedulesResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out shared.V3ConnectorSchedulesCursorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ConnectorSchedulesCursorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out shared.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// ListConnectors - List all connectors +func (s *V3) ListConnectors(ctx context.Context, request operations.V3ListConnectorsRequest, opts ...operations.Option) (*operations.V3ListConnectorsResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/api/payments/v3/connectors") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "v3ListConnectors", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -8070,7 +8747,7 @@ func (s *V3) ListConnectorSchedules(ctx context.Context, request operations.V3Li } } - res := &operations.V3ListConnectorSchedulesResponse{ + res := &operations.V3ListConnectorsResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -8085,12 +8762,12 @@ func (s *V3) ListConnectorSchedules(ctx context.Context, request operations.V3Li return nil, err } - var out shared.V3ConnectorSchedulesCursorResponse + var out shared.V3ConnectorsCursorResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3ConnectorSchedulesCursorResponse = &out + res.V3ConnectorsCursorResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { @@ -8137,8 +8814,22 @@ func (s *V3) ListConnectorSchedules(ctx context.Context, request operations.V3Li } -// ListConnectors - List all connectors -func (s *V3) ListConnectors(ctx context.Context, request operations.V3ListConnectorsRequest, opts ...operations.Option) (*operations.V3ListConnectorsResponse, error) { +// ListConversions - List currency and asset conversions ingested from connectors +// Returns the full list of conversions ingested by Formance from +// connectors that implement the conversions capability. A conversion +// is a direct swap between two assets on a PSP (e.g. USD → USDC on +// Coinbase Prime). Conversions are **read-only** through the Formance +// API. +// +// Unlike orders, conversions do not carry an adjustment history — +// Formance records only the final observed state (`status`, +// `destinationAmount`, and `fee` when settled). +// +// Results are cursor-paginated. The optional request body accepts a +// query builder for filtering over top-level `V3Conversion` fields +// such as `connectorID`, `reference`, `status`, `sourceAsset`, +// `destinationAsset`, and `createdAt`. +func (s *V3) ListConversions(ctx context.Context, request operations.V3ListConversionsRequest, opts ...operations.Option) (*operations.V3ListConversionsResponse, error) { o := operations.Options{} supportedOptions := []string{ operations.SupportedOptionRetries, @@ -8157,7 +8848,7 @@ func (s *V3) ListConnectors(ctx context.Context, request operations.V3ListConnec } else { baseURL = *o.ServerURL } - opURL, err := url.JoinPath(baseURL, "/api/payments/v3/connectors") + opURL, err := url.JoinPath(baseURL, "/api/payments/v3/conversions") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -8167,7 +8858,7 @@ func (s *V3) ListConnectors(ctx context.Context, request operations.V3ListConnec SDKConfiguration: s.sdkConfiguration, BaseURL: baseURL, Context: ctx, - OperationID: "v3ListConnectors", + OperationID: "v3ListConversions", OAuth2Scopes: []string{"payments:read"}, SecuritySource: s.sdkConfiguration.Security, } @@ -8293,7 +8984,7 @@ func (s *V3) ListConnectors(ctx context.Context, request operations.V3ListConnec } } - res := &operations.V3ListConnectorsResponse{ + res := &operations.V3ListConversionsResponse{ StatusCode: httpRes.StatusCode, ContentType: httpRes.Header.Get("Content-Type"), RawResponse: httpRes, @@ -8308,12 +8999,249 @@ func (s *V3) ListConnectors(ctx context.Context, request operations.V3ListConnec return nil, err } - var out shared.V3ConnectorsCursorResponse + var out shared.V3ConversionsCursorResponse if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } - res.V3ConnectorsCursorResponse = &out + res.V3ConversionsCursorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out shared.V3ErrorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3ErrorResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// ListOrders - List orders ingested from exchange-style connectors +// Returns the full list of orders ingested by Formance from connectors +// that implement the orders capability (e.g. `coinbaseprime`). Orders +// represent trade placements on an exchange-style PSP and are +// **read-only** through the Formance API — submission, cancellation, +// and lifecycle transitions are owned by the underlying connector. +// +// Results are cursor-paginated. The optional request body accepts a +// query builder for filtering over top-level `V3Order` fields such as +// `connectorID`, `reference`, `direction`, `status`, `type`, +// `sourceAsset`, `destinationAsset`, and `createdAt`. +// +// See `V3Order` for the full response shape, including the +// `adjustments` array that captures each observed state transition on +// the exchange. +func (s *V3) ListOrders(ctx context.Context, request operations.V3ListOrdersRequest, opts ...operations.Option) (*operations.V3ListOrdersResponse, error) { + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + var baseURL string + if o.ServerURL == nil { + baseURL = utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + } else { + baseURL = *o.ServerURL + } + opURL, err := url.JoinPath(baseURL, "/api/payments/v3/orders") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + hookCtx := hooks.HookContext{ + SDK: s.rootSDK, + SDKConfiguration: s.sdkConfiguration, + BaseURL: baseURL, + Context: ctx, + OperationID: "v3ListOrders", + OAuth2Scopes: []string{"payments:read"}, + SecuritySource: s.sdkConfiguration.Security, + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + for k, v := range o.SetHeaders { + req.Header.Set(k, v) + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil && req.Body != http.NoBody && req.GetBody != nil { + copyBody, err := req.GetBody() + + if err != nil { + return nil, err + } + + req.Body = copyBody + } + + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + if retry.IsPermanentError(err) || retry.IsTemporaryError(err) { + return nil, err + } + + return nil, retry.Permanent(err) + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.V3ListOrdersResponse{ + StatusCode: httpRes.StatusCode, + ContentType: httpRes.Header.Get("Content-Type"), + RawResponse: httpRes, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out shared.V3OrdersCursorResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.V3OrdersCursorResponse = &out default: rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil {