Repository navigation
Add a Qonto template generated from Qonto's OpenAPI documents - #375
Conversation
Qonto's Business API as 185 typed methods: business accounts, transactions and attachments, SEPA, internal and international transfers, beneficiaries, requests, SEPA Direct Debit, cards, clients, products, client and supplier invoices, quotes, credit notes, payment links, terminals, memberships, teams, insurance contracts and webhook subscriptions. Each organization connects through its own Qonto app for the "Automate your business operations" use case. Trusting beneficiaries and reviewing requests are not offered, so Qonto's own approvals stay with the people Qonto names. When Qonto answers 428 for its own approval, the method asks the user to approve in the Qonto app, checks the SCA session when they confirm and repeats the first request with the session token and the same idempotency key. Every change carries an idempotency key. The generator joins descriptions a provider publishes in parts, one OpenAPI document per reference page, reads OpenAPI 3.1 type lists and `const`, leaves out `allOf` parts that only annotate and no longer repeats `null` for enums that list it.
…onto reads them - Widefleet's question before a change keeps the request's idempotency key, so an answer repeated after a lost response pays once. - An explicit decline stands even after the user's level stops asking. - A rate-limited SCA check returns `rate_limited` with `retryAfter`. - `revokeAccess` removes the saved connection once Qonto confirms. - `createClientInvoice` and `createRecurringInvoice` send and `createCreditNote` updates, since each can reach clients or cancel an invoice. - `createSupplierInvoice` sends one invoice's file, attachment and key as the separate parts Qonto reads. The generator sends a form that carries files as multipart when an operation also takes a plain form, falls back to the schema's own type when every `allOf` part only annotates, keeps each type's keywords in 3.1 type unions and compares joined parts regardless of key order.
| if (result.status === "connected") | ||
| await accountConnection(this.env, this.ctx.props).disconnect(); |
There was a problem hiding this comment.
Revocation can disconnect another account
If a user switches Qonto accounts while revokeAccess waits for Qonto, disconnect() deletes the new link when Qonto confirms revocation of the old one. It matches only the user and provider. Keep track of the grant used for the request and delete the saved link only if it still matches.
There was a problem hiding this comment.
Fixed in 4baf45e. revokeAccess now records which account is connected when it sends the request. Once Qonto confirms, it removes only that account (userId, provider and accountId). The test switches the saved account while Qonto handles the revocation and checks that the new link stays.
…oke only the revoked account - `createSupplierInvoice` takes either a file or an attachment ID, each with a required idempotency key, and requires its body. - `revokeAccess` removes only the account it revoked, so an account the user connects meanwhile stays. The generator takes a `form` rule that replaces a form body's schema, such as with variants, and requires a form body whose every variant requires fields.
| const sentForm = | ||
| forms.find( | ||
| ({ kind, entry }) => | ||
| kind === "multipart" && entry.schema && carriesFiles(entry.schema, new Set()), | ||
| ) ?? forms[0]; |
There was a problem hiding this comment.
If an API offers both form formats but its multipart schema doesn't mark a field as a file, adding format: "binary" in rule.form still produces a URL-encoded text field. The generator picks the format before applying the rule. Use the corrected schema to choose the format, and reject file rules if multipart isn't available.
There was a problem hiding this comment.
Fixed in 8de26b4. Choosing the form now also considers files that the rules' form or fields add, so such an operation goes out as multipart even when the description's multipart schema marks no file. Covered by a test.
…and check every form variant - A body is required when the description or the rules' `requiredBody` says so; required fields of an optional form no longer require it. - Files the rules' form or fields add choose the multipart form, though the description's forms carry none. - A plain form refuses an object field in any variant, also when another variant uses the same name for text.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | f80b659 | Nov 24 2026, 06:15 PM |
Change
A Qonto template.
Connection.
QONTO_CLIENT_IDandQONTO_CLIENT_SECRET. Qonto requires no review for that use case.GET /v2/membership.Qonto's own approval (SCA).
approveInQonto, with the session and idempotency key inrequestState.waitingasks againdenyreturnsrejected_in_qontoallowrepeats the first request withX-Qonto-Sca-Session-Tokenand the same idempotency keyX-Qonto-Idempotency-Key. Widefleet's question keeps the key inrequestState, so an answer repeated after a lost response pays once.revokeAccessremoves the saved connection once Qonto confirms.Generator.
downloadcan now return parts, which the generator joins. Parts that describe a shared component, path or document field differently stop it.["string", "null"], a barenulltype andconstare read as 3.0 schemas.allOfparts that only annotate, such as with an example, no longer add& JsonValue.nullno longer get a second| null.Screenshots
The template's connection page, in the WHOOP and Strava layout:
The favicon is Qonto's mark from qonto.com, beside other templates' icons:
Not shown: the dark color scheme of the favicon.
Tests
revokeAccesspnpm check, the generator tests, the template tests and the control-plane template tests.Hold the merge until revocation removes the link for the same Qonto account whose token it used.
Findings
Summary
This PR adds a Qonto template with 185 typed methods, per-user OAuth connections, and a payment flow that can pause for approval in Widefleet and Qonto.
Diagram
sequenceDiagram participant W as Widefleet participant T as Qonto template participant Q as Qonto API W->>T: Call a payment method opt Widefleet approval is required T-->>W: Ask for approval and save the request key W->>T: Return the approval and saved state end T->>Q: Send payment with the request key alt Qonto requires phone approval Q-->>T: Return an approval session T-->>W: Ask the user to approve in Qonto W->>T: Return the confirmation and saved state T->>Q: Check the session alt Allowed T->>Q: Resend with the session and same key else Waiting or denied T-->>W: Ask again or report refusal end else Qonto accepts the request Q-->>T: Return the payment result endReviews (5) · Last reviewed commit: "Stop the generator when the rules requir..." · Reviewed by Greptile