1. Créer un compte financier
Observé — mutation createFinancialAccount capturée depuis /admin/company/bank-details.
Pourquoi
Une organisation (Business Unit) doit pouvoir être liée à un compte bancaire (IBAN/BIC) pour encaissements et mentions sur avis/reçus.
Prérequis
- Token API
- IBAN / BIC valides (ici anonymisés)
Étape — Créer le compte
- GraphQL
- Node.js
- curl
mutation createFinancialAccount($financialAccount: FinancialAccountInput!) {
createFinancialAccount(financialAccount: $financialAccount) {
id
iban
bic
bankName
accountHolderName
isPrimaryAccount
}
}
{
"financialAccount": {
"bankName": "Banque Exemple",
"bic": "BNPAFRPP",
"iban": "FR76XXXXXXXXXXXXXXXXXXXXXXX",
"isPrimaryAccount": false,
"bankAddress": {}
}
}
import { ublo } from '../ubloClient.mjs';
const data = await ublo(
`mutation createFinancialAccount($financialAccount: FinancialAccountInput!) {
createFinancialAccount(financialAccount: $financialAccount) {
id
iban
bic
bankName
isPrimaryAccount
}
}`,
{
financialAccount: {
bankName: 'Banque Exemple',
bic: 'BNPAFRPP',
iban: 'FR76XXXXXXXXXXXXXXXXXXXXXXX',
isPrimaryAccount: false,
bankAddress: {},
},
},
);
const financialAccountId = data.createFinancialAccount.id;
console.log({ financialAccountId });
- Bearer
- Cookie session
curl -sS -X POST "$UBLO_GRAPHQL_URL" \
-H "Authorization: Bearer $UBLO_API_TOKEN" \
-H 'Content-Type: application/json' \
-d @- <<'EOF'
{
"query": "mutation createFinancialAccount($financialAccount: FinancialAccountInput!) { createFinancialAccount(financialAccount: $financialAccount) { id iban bic bankName isPrimaryAccount } }",
"variables": {
"financialAccount": {
"bankName": "Banque Exemple",
"bic": "BNPAFRPP",
"iban": "FR76XXXXXXXXXXXXXXXXXXXXXXX",
"isPrimaryAccount": false,
"bankAddress": {}
}
}
}
EOF
curl -sS -X POST "$UBLO_GRAPHQL_URL" \
-H 'Content-Type: application/json' \
-b cookies.txt \
-d @- <<'EOF'
{
"query": "mutation createFinancialAccount($financialAccount: FinancialAccountInput!) { createFinancialAccount(financialAccount: $financialAccount) { id iban bic bankName isPrimaryAccount } }",
"variables": {
"financialAccount": {
"bankName": "Banque Exemple",
"bic": "BNPAFRPP",
"iban": "FR76XXXXXXXXXXXXXXXXXXXXXXX",
"isPrimaryAccount": false,
"bankAddress": {}
}
}
}
EOF
Mise à jour
Mutation observée : updateFinancialAccount(id, financialAccount).
Suite
Conservez financialAccountId → Créer une organisation.
Schéma : createFinancialAccount · domaine Banking / Organization.