@codespar/sdk 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/api-client.test.js +7 -2
- package/dist/__tests__/api-client.test.js.map +1 -1
- package/dist/generated/openapi.d.ts +780 -60
- package/dist/generated/openapi.d.ts.map +1 -1
- package/dist/generated/operations.d.ts +30 -0
- package/dist/generated/operations.d.ts.map +1 -1
- package/dist/generated/operations.js +6 -0
- package/dist/generated/operations.js.map +1 -1
- package/package.json +2 -2
|
@@ -427,6 +427,114 @@ export interface paths {
|
|
|
427
427
|
patch?: never;
|
|
428
428
|
trace?: never;
|
|
429
429
|
};
|
|
430
|
+
"/meta-tools.json": {
|
|
431
|
+
parameters: {
|
|
432
|
+
query?: never;
|
|
433
|
+
header?: never;
|
|
434
|
+
path?: never;
|
|
435
|
+
cookie?: never;
|
|
436
|
+
};
|
|
437
|
+
/**
|
|
438
|
+
* The tool catalogue the execute operation dispatches
|
|
439
|
+
* @description THE LEGAL VALUES OF `tool`, and what each one accepts. `POST /v1/sessions/{id}/execute` names a tool by string; this is the document that gives those strings meaning, one entry per tool with a JSON Schema for its input.
|
|
440
|
+
*
|
|
441
|
+
* Served with no credential, `Access-Control-Allow-Origin: *`, cached for five minutes. It carries no tenant data: names, descriptions and schemas, identical for every caller. `/meta-tools.json` and `/v1/meta-tools.json` return the same bytes.
|
|
442
|
+
*
|
|
443
|
+
* READ IT BEFORE CONCLUDING A CAPABILITY IS MISSING. The tool descriptions and their schemas carry contracts this OpenAPI document does not repeat — which `action` values exist, which arguments are mandatory for which combination, and what a create answers when the instrument is not ready yet. A capability can be fully implemented and still read as absent to someone holding only this document.
|
|
444
|
+
*/
|
|
445
|
+
get: {
|
|
446
|
+
parameters: {
|
|
447
|
+
query?: never;
|
|
448
|
+
header?: never;
|
|
449
|
+
path?: never;
|
|
450
|
+
cookie?: never;
|
|
451
|
+
};
|
|
452
|
+
requestBody?: never;
|
|
453
|
+
responses: {
|
|
454
|
+
/** @description OK */
|
|
455
|
+
200: {
|
|
456
|
+
headers: {
|
|
457
|
+
[name: string]: unknown;
|
|
458
|
+
};
|
|
459
|
+
content: {
|
|
460
|
+
"application/json": {
|
|
461
|
+
/**
|
|
462
|
+
* @description Names the source so the reader does not have to take the document's word for it: this is the same output the MCP transport answers `tools/list` with, not a second reading of the catalogue that could drift from it.
|
|
463
|
+
* @enum {string}
|
|
464
|
+
*/
|
|
465
|
+
generated_from: "tools/list";
|
|
466
|
+
tools: {
|
|
467
|
+
/** @description The value to send as `tool` on the execute operation. */
|
|
468
|
+
name: string;
|
|
469
|
+
description: string;
|
|
470
|
+
/** @description JSON Schema for that tool's input, which is what goes in `params`. */
|
|
471
|
+
inputSchema: Record<string, never>;
|
|
472
|
+
}[];
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
put?: never;
|
|
479
|
+
post?: never;
|
|
480
|
+
delete?: never;
|
|
481
|
+
options?: never;
|
|
482
|
+
head?: never;
|
|
483
|
+
patch?: never;
|
|
484
|
+
trace?: never;
|
|
485
|
+
};
|
|
486
|
+
"/v1/meta-tools.json": {
|
|
487
|
+
parameters: {
|
|
488
|
+
query?: never;
|
|
489
|
+
header?: never;
|
|
490
|
+
path?: never;
|
|
491
|
+
cookie?: never;
|
|
492
|
+
};
|
|
493
|
+
/**
|
|
494
|
+
* The tool catalogue, under the /v1 mount
|
|
495
|
+
* @description Identical to `/meta-tools.json`, for a caller already pointed at the versioned prefix. Same bytes, same absence of a credential.
|
|
496
|
+
*/
|
|
497
|
+
get: {
|
|
498
|
+
parameters: {
|
|
499
|
+
query?: never;
|
|
500
|
+
header?: never;
|
|
501
|
+
path?: never;
|
|
502
|
+
cookie?: never;
|
|
503
|
+
};
|
|
504
|
+
requestBody?: never;
|
|
505
|
+
responses: {
|
|
506
|
+
/** @description OK */
|
|
507
|
+
200: {
|
|
508
|
+
headers: {
|
|
509
|
+
[name: string]: unknown;
|
|
510
|
+
};
|
|
511
|
+
content: {
|
|
512
|
+
"application/json": {
|
|
513
|
+
/**
|
|
514
|
+
* @description Names the source so the reader does not have to take the document's word for it: this is the same output the MCP transport answers `tools/list` with, not a second reading of the catalogue that could drift from it.
|
|
515
|
+
* @enum {string}
|
|
516
|
+
*/
|
|
517
|
+
generated_from: "tools/list";
|
|
518
|
+
tools: {
|
|
519
|
+
/** @description The value to send as `tool` on the execute operation. */
|
|
520
|
+
name: string;
|
|
521
|
+
description: string;
|
|
522
|
+
/** @description JSON Schema for that tool's input, which is what goes in `params`. */
|
|
523
|
+
inputSchema: Record<string, never>;
|
|
524
|
+
}[];
|
|
525
|
+
};
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
};
|
|
529
|
+
};
|
|
530
|
+
put?: never;
|
|
531
|
+
post?: never;
|
|
532
|
+
delete?: never;
|
|
533
|
+
options?: never;
|
|
534
|
+
head?: never;
|
|
535
|
+
patch?: never;
|
|
536
|
+
trace?: never;
|
|
537
|
+
};
|
|
430
538
|
"/v1/providers": {
|
|
431
539
|
parameters: {
|
|
432
540
|
query?: never;
|
|
@@ -4526,7 +4634,7 @@ export interface paths {
|
|
|
4526
4634
|
* @deprecated
|
|
4527
4635
|
* @description What to ask an operator for before connecting this provider, and where the request will go once connected. It NEVER returns a stored secret: the vault is write-only from this side, and `fields` describes inputs to collect, not values that exist.
|
|
4528
4636
|
*
|
|
4529
|
-
* AN EMPTY `fields` DOES NOT MEAN NOTHING TO DO, and four auth types produce one. `oauth` collects nothing here because the browser leg starts at `POST /v1/connections/start` instead. `none` needs no credential. And `jwt_ecdsa` and `cdp` reach no field-building branch at all, so they come back empty while still needing operator-issued material: read that pair as unsupported by this form rather than as ready to connect. The
|
|
4637
|
+
* AN EMPTY `fields` DOES NOT MEAN NOTHING TO DO, and four of the auth types produce one. `oauth` collects nothing here because the browser leg starts at `POST /v1/connections/start` instead. `none` needs no credential. And `jwt_ecdsa` and `cdp` reach no field-building branch at all, so they come back empty while still needing operator-issued material: read that pair as unsupported by this form rather than as ready to connect. The rest all return at least one field, `cert` included.
|
|
4530
4638
|
*
|
|
4531
4639
|
* `base_url` IS ENVIRONMENT-RESOLVED against the credential in hand: a test key sees the provider's test host when the catalog declares one, and the live host otherwise. It is the empty string when the provider has no endpoint row, which is a catalog gap rather than a value to dial.
|
|
4532
4640
|
*
|
|
@@ -10920,27 +11028,27 @@ export interface paths {
|
|
|
10920
11028
|
get?: never;
|
|
10921
11029
|
put?: never;
|
|
10922
11030
|
/**
|
|
10923
|
-
*
|
|
10924
|
-
* @description
|
|
11031
|
+
* Spend under a mandate already projected here
|
|
11032
|
+
* @description Moves money out under a mandate already projected into this organization, addressed by id. This is the path the `codespar_pay` meta-tool takes internally, so the behaviour here is the behaviour an agent gets; the route exists so a caller who does not use the SDK reaches the same place.
|
|
10925
11033
|
*
|
|
10926
|
-
*
|
|
11034
|
+
* With `ted` present the provider leg is a real bank transfer, debited from the consumer's own sub-account. Without `ted`, `payee` is a Pix key or a copy-and-paste string.
|
|
10927
11035
|
*
|
|
10928
|
-
* **TED
|
|
11036
|
+
* **TED carries three requirements the other payment methods do not, and all three bind BEFORE any money step:**
|
|
10929
11037
|
*
|
|
10930
|
-
* 1. `attempt_id`
|
|
10931
|
-
* 2. `payee`
|
|
10932
|
-
* 3.
|
|
11038
|
+
* 1. `attempt_id` is MANDATORY. A TED has no copy-and-paste string and no nonce to derive correlation from, and two TEDs under the same mandate must never collide on a derived id.
|
|
11039
|
+
* 2. `payee` must EQUAL the destination's canonical string, `ted:<ispb>:<branch>:<account>`, alphanumerics only and upper-cased. The comparison normalizes whitespace and nothing else, so an entry carrying a dot or a hyphen does NOT match. The rule is what makes the signed-allowlist pin and the wire name the SAME destination: without it, an approved payee fronts for a different bank account.
|
|
11040
|
+
* 3. The destination must be NAMED in a signed list of the mandate, and a merchant-list wildcard `"*"` NEVER authorizes money out. Which list is accepted is mid-rollout, so read this one carefully: the target rule is `withdrawal_allowlist` alone, and while the rollout flag is off a destination named explicitly in the signed `merchant_allowlist` is ALSO accepted, with the stricter rule's refusal recorded rather than applied. Tolerance never widens what passes: a wildcard is refused on both paths, and a destination in neither list is refused with its own code. Build against `withdrawal_allowlist`: it is the list that keeps working when the flag turns on.
|
|
10933
11041
|
*
|
|
10934
|
-
*
|
|
11042
|
+
* The cumulative cap is checked and CONSUMED under an advisory lock, and the wallet hold is taken inside that same lock. The lock is released before the provider call, so a slow provider does not serialize everyone else.
|
|
10935
11043
|
*
|
|
10936
|
-
* **
|
|
11044
|
+
* **There is no read route for the outcome.** An `attempt_id` that answered `psp_dispatch_uncertain` has no endpoint to ask about afterwards. Keep the `attempt_id` and present it again: the lifecycle is idempotent on it and answers the state that attempt stopped in, instead of firing a second one. Do NOT restart the same intent under a fresh `attempt_id`. That is how a payment gets made twice.
|
|
10937
11045
|
*/
|
|
10938
11046
|
post: {
|
|
10939
11047
|
parameters: {
|
|
10940
11048
|
query?: never;
|
|
10941
11049
|
header?: never;
|
|
10942
11050
|
path: {
|
|
10943
|
-
/** @description
|
|
11051
|
+
/** @description The mandate's id. */
|
|
10944
11052
|
id: string;
|
|
10945
11053
|
};
|
|
10946
11054
|
cookie?: never;
|
|
@@ -10948,12 +11056,12 @@ export interface paths {
|
|
|
10948
11056
|
requestBody?: {
|
|
10949
11057
|
content: {
|
|
10950
11058
|
"application/json": {
|
|
10951
|
-
/** @description
|
|
11059
|
+
/** @description Amount in minor units. */
|
|
10952
11060
|
amount_minor: number;
|
|
10953
|
-
/** @description
|
|
11061
|
+
/** @description A Pix key, a copy-and-paste string, or, for TED, the destination's canonical string. The 1024 limit is there to fit a copy-and-paste string. */
|
|
10954
11062
|
payee: string;
|
|
10955
11063
|
agent_id?: string;
|
|
10956
|
-
/** @description
|
|
11064
|
+
/** @description Mandatory when `ted` is present. Present the same one again on every retry. */
|
|
10957
11065
|
attempt_id?: string;
|
|
10958
11066
|
ted?: components["schemas"]["TedDestination"];
|
|
10959
11067
|
quote?: components["schemas"]["SpendQuote"];
|
|
@@ -10970,7 +11078,7 @@ export interface paths {
|
|
|
10970
11078
|
"application/json": components["schemas"]["SpendOutcome"];
|
|
10971
11079
|
};
|
|
10972
11080
|
};
|
|
10973
|
-
/** @description
|
|
11081
|
+
/** @description The body did not match the schema. */
|
|
10974
11082
|
400: {
|
|
10975
11083
|
headers: {
|
|
10976
11084
|
[name: string]: unknown;
|
|
@@ -10990,7 +11098,7 @@ export interface paths {
|
|
|
10990
11098
|
};
|
|
10991
11099
|
};
|
|
10992
11100
|
};
|
|
10993
|
-
/** @description
|
|
11101
|
+
/** @description The destination is not on the mandate's signed withdrawal allowlist. Nothing was sent to the provider. The response carries the next consent step. */
|
|
10994
11102
|
403: {
|
|
10995
11103
|
headers: {
|
|
10996
11104
|
[name: string]: unknown;
|
|
@@ -11010,7 +11118,7 @@ export interface paths {
|
|
|
11010
11118
|
};
|
|
11011
11119
|
};
|
|
11012
11120
|
};
|
|
11013
|
-
/** @description
|
|
11121
|
+
/** @description No mandate with that id exists in this organization. */
|
|
11014
11122
|
404: {
|
|
11015
11123
|
headers: {
|
|
11016
11124
|
[name: string]: unknown;
|
|
@@ -11030,7 +11138,7 @@ export interface paths {
|
|
|
11030
11138
|
};
|
|
11031
11139
|
};
|
|
11032
11140
|
};
|
|
11033
|
-
/** @description
|
|
11141
|
+
/** @description Local state refuses. `psp_attempt_in_flight`: the same attempt is already in flight. `psp_attempt_uncertain`: an earlier attempt ended with an unknown outcome and this intent is PINNED to it, so present the same `attempt_id` again, never a new one. `psp_attempt_conflict`: the earlier attempt was already compensated. */
|
|
11034
11142
|
409: {
|
|
11035
11143
|
headers: {
|
|
11036
11144
|
[name: string]: unknown;
|
|
@@ -11050,7 +11158,7 @@ export interface paths {
|
|
|
11050
11158
|
};
|
|
11051
11159
|
};
|
|
11052
11160
|
};
|
|
11053
|
-
/** @description
|
|
11161
|
+
/** @description The mandate refuses. `mandate_verify`: signature, agent, purpose or payee do not check out. `mandate_projection_mismatch`: the signature presented differs from the stored one, or the mandate is not active. `no_funding_source`: the consumer has no funding source that serves this rail; TED requires a registered bank account. */
|
|
11054
11162
|
422: {
|
|
11055
11163
|
headers: {
|
|
11056
11164
|
[name: string]: unknown;
|
|
@@ -11070,7 +11178,7 @@ export interface paths {
|
|
|
11070
11178
|
};
|
|
11071
11179
|
};
|
|
11072
11180
|
};
|
|
11073
|
-
/** @description
|
|
11181
|
+
/** @description The verifier answered without resolving the cumulative cap, so the re-check under the lock would have no limit to compare against. A deliberate refusal: nothing is debited. */
|
|
11074
11182
|
500: {
|
|
11075
11183
|
headers: {
|
|
11076
11184
|
[name: string]: unknown;
|
|
@@ -11090,7 +11198,7 @@ export interface paths {
|
|
|
11090
11198
|
};
|
|
11091
11199
|
};
|
|
11092
11200
|
};
|
|
11093
|
-
/** @description
|
|
11201
|
+
/** @description The provider refused or did not answer. `psp_dispatch_failed`: a known refusal, nothing left. `psp_dispatch_uncertain`: it is NOT known whether anything left, so the hold stands and the attempt stays pinned. */
|
|
11094
11202
|
502: {
|
|
11095
11203
|
headers: {
|
|
11096
11204
|
[name: string]: unknown;
|
|
@@ -11128,18 +11236,18 @@ export interface paths {
|
|
|
11128
11236
|
get?: never;
|
|
11129
11237
|
put?: never;
|
|
11130
11238
|
/**
|
|
11131
|
-
*
|
|
11132
|
-
* @description
|
|
11239
|
+
* Spend by presenting the signed mandate
|
|
11240
|
+
* @description The same lifecycle as the by-id route, for a caller who carries the signed envelope instead of a mandate already projected here. Use this one when the mandate arrives from the consumer at call time; use `/consumers/mandates/{id}/spend` when it is already registered here.
|
|
11133
11241
|
*
|
|
11134
|
-
* `signature`
|
|
11242
|
+
* `signature` is the 64-character hexadecimal HMAC over the canonical mandate. The body's `agent_id` is checked against the SIGNED one: attribution of the spend belongs to the mandate, not to the caller.
|
|
11135
11243
|
*
|
|
11136
|
-
* **TED
|
|
11244
|
+
* **TED carries three requirements the other payment methods do not, and all three bind BEFORE any money step:**
|
|
11137
11245
|
*
|
|
11138
|
-
* 1. `attempt_id`
|
|
11139
|
-
* 2. `payee`
|
|
11140
|
-
* 3.
|
|
11246
|
+
* 1. `attempt_id` is MANDATORY. A TED has no copy-and-paste string and no nonce to derive correlation from, and two TEDs under the same mandate must never collide on a derived id.
|
|
11247
|
+
* 2. `payee` must EQUAL the destination's canonical string, `ted:<ispb>:<branch>:<account>`, alphanumerics only and upper-cased. The comparison normalizes whitespace and nothing else, so an entry carrying a dot or a hyphen does NOT match. The rule is what makes the signed-allowlist pin and the wire name the SAME destination: without it, an approved payee fronts for a different bank account.
|
|
11248
|
+
* 3. The destination must be NAMED in a signed list of the mandate, and a merchant-list wildcard `"*"` NEVER authorizes money out. Which list is accepted is mid-rollout, so read this one carefully: the target rule is `withdrawal_allowlist` alone, and while the rollout flag is off a destination named explicitly in the signed `merchant_allowlist` is ALSO accepted, with the stricter rule's refusal recorded rather than applied. Tolerance never widens what passes: a wildcard is refused on both paths, and a destination in neither list is refused with its own code. Build against `withdrawal_allowlist`: it is the list that keeps working when the flag turns on.
|
|
11141
11249
|
*
|
|
11142
|
-
* **
|
|
11250
|
+
* **There is no read route for the outcome.** An `attempt_id` that answered `psp_dispatch_uncertain` has no endpoint to ask about afterwards. Keep the `attempt_id` and present it again: the lifecycle is idempotent on it and answers the state that attempt stopped in, instead of firing a second one. Do NOT restart the same intent under a fresh `attempt_id`. That is how a payment gets made twice.
|
|
11143
11251
|
*/
|
|
11144
11252
|
post: {
|
|
11145
11253
|
parameters: {
|
|
@@ -11151,9 +11259,9 @@ export interface paths {
|
|
|
11151
11259
|
requestBody?: {
|
|
11152
11260
|
content: {
|
|
11153
11261
|
"application/json": {
|
|
11154
|
-
/** @description
|
|
11262
|
+
/** @description The canonical mandate, in the form it was signed in. */
|
|
11155
11263
|
mandate?: unknown;
|
|
11156
|
-
/** @description HMAC
|
|
11264
|
+
/** @description HMAC in hexadecimal, 64 characters. */
|
|
11157
11265
|
signature: string;
|
|
11158
11266
|
amount_minor: number;
|
|
11159
11267
|
purpose: string;
|
|
@@ -11175,7 +11283,7 @@ export interface paths {
|
|
|
11175
11283
|
"application/json": components["schemas"]["SpendOutcome"];
|
|
11176
11284
|
};
|
|
11177
11285
|
};
|
|
11178
|
-
/** @description
|
|
11286
|
+
/** @description The body did not match the schema. */
|
|
11179
11287
|
400: {
|
|
11180
11288
|
headers: {
|
|
11181
11289
|
[name: string]: unknown;
|
|
@@ -11195,7 +11303,7 @@ export interface paths {
|
|
|
11195
11303
|
};
|
|
11196
11304
|
};
|
|
11197
11305
|
};
|
|
11198
|
-
/** @description
|
|
11306
|
+
/** @description The destination is not on the signed withdrawal allowlist. Nothing was sent to the provider. */
|
|
11199
11307
|
403: {
|
|
11200
11308
|
headers: {
|
|
11201
11309
|
[name: string]: unknown;
|
|
@@ -11215,7 +11323,7 @@ export interface paths {
|
|
|
11215
11323
|
};
|
|
11216
11324
|
};
|
|
11217
11325
|
};
|
|
11218
|
-
/** @description
|
|
11326
|
+
/** @description Local state refuses, on the same three conditions as the by-id route. */
|
|
11219
11327
|
409: {
|
|
11220
11328
|
headers: {
|
|
11221
11329
|
[name: string]: unknown;
|
|
@@ -11235,7 +11343,7 @@ export interface paths {
|
|
|
11235
11343
|
};
|
|
11236
11344
|
};
|
|
11237
11345
|
};
|
|
11238
|
-
/** @description
|
|
11346
|
+
/** @description The mandate refuses, or the consumer has no funding source for this rail. */
|
|
11239
11347
|
422: {
|
|
11240
11348
|
headers: {
|
|
11241
11349
|
[name: string]: unknown;
|
|
@@ -11255,7 +11363,7 @@ export interface paths {
|
|
|
11255
11363
|
};
|
|
11256
11364
|
};
|
|
11257
11365
|
};
|
|
11258
|
-
/** @description
|
|
11366
|
+
/** @description The cumulative cap was not resolved by the verifier. Nothing is debited. */
|
|
11259
11367
|
500: {
|
|
11260
11368
|
headers: {
|
|
11261
11369
|
[name: string]: unknown;
|
|
@@ -11275,7 +11383,7 @@ export interface paths {
|
|
|
11275
11383
|
};
|
|
11276
11384
|
};
|
|
11277
11385
|
};
|
|
11278
|
-
/** @description
|
|
11386
|
+
/** @description The provider refused, or the outcome is unknown. */
|
|
11279
11387
|
502: {
|
|
11280
11388
|
headers: {
|
|
11281
11389
|
[name: string]: unknown;
|
|
@@ -11313,12 +11421,12 @@ export interface paths {
|
|
|
11313
11421
|
get?: never;
|
|
11314
11422
|
put?: never;
|
|
11315
11423
|
/**
|
|
11316
|
-
*
|
|
11317
|
-
* @description
|
|
11424
|
+
* Spend by presenting the mandate, with the steps streamed
|
|
11425
|
+
* @description Same body and same gates as `/v1/consumer-payments/execute`. Only the response transport differs: the lifecycle steps (mandate verification, funding-source routing, hold, provider debit, receipt seal) arrive as `text/event-stream` events as they happen, instead of one JSON at the end.
|
|
11318
11426
|
*
|
|
11319
|
-
*
|
|
11427
|
+
* The outcome is the same object the sibling route returns, carried on the last event. A client that does not need to follow progress should use `/execute`: streaming does not make settlement faster, it makes it observable while it runs.
|
|
11320
11428
|
*
|
|
11321
|
-
* **
|
|
11429
|
+
* **There is no read route for the outcome.** An `attempt_id` that answered `psp_dispatch_uncertain` has no endpoint to ask about afterwards. Keep the `attempt_id` and present it again: the lifecycle is idempotent on it and answers the state that attempt stopped in, instead of firing a second one. Do NOT restart the same intent under a fresh `attempt_id`. That is how a payment gets made twice.
|
|
11322
11430
|
*/
|
|
11323
11431
|
post: {
|
|
11324
11432
|
parameters: {
|
|
@@ -11343,7 +11451,7 @@ export interface paths {
|
|
|
11343
11451
|
};
|
|
11344
11452
|
};
|
|
11345
11453
|
responses: {
|
|
11346
|
-
/** @description
|
|
11454
|
+
/** @description An event stream. Each event is one lifecycle step; the last one carries the same outcome object `/execute` returns. */
|
|
11347
11455
|
200: {
|
|
11348
11456
|
headers: {
|
|
11349
11457
|
[name: string]: unknown;
|
|
@@ -11352,7 +11460,7 @@ export interface paths {
|
|
|
11352
11460
|
"text/event-stream": string;
|
|
11353
11461
|
};
|
|
11354
11462
|
};
|
|
11355
|
-
/** @description
|
|
11463
|
+
/** @description The body did not match the schema. */
|
|
11356
11464
|
400: {
|
|
11357
11465
|
headers: {
|
|
11358
11466
|
[name: string]: unknown;
|
|
@@ -11372,7 +11480,7 @@ export interface paths {
|
|
|
11372
11480
|
};
|
|
11373
11481
|
};
|
|
11374
11482
|
};
|
|
11375
|
-
/** @description
|
|
11483
|
+
/** @description The destination is not on the signed withdrawal allowlist. */
|
|
11376
11484
|
403: {
|
|
11377
11485
|
headers: {
|
|
11378
11486
|
[name: string]: unknown;
|
|
@@ -11392,7 +11500,7 @@ export interface paths {
|
|
|
11392
11500
|
};
|
|
11393
11501
|
};
|
|
11394
11502
|
};
|
|
11395
|
-
/** @description
|
|
11503
|
+
/** @description The mandate refuses, or there is no funding source for this rail. */
|
|
11396
11504
|
422: {
|
|
11397
11505
|
headers: {
|
|
11398
11506
|
[name: string]: unknown;
|
|
@@ -11412,7 +11520,7 @@ export interface paths {
|
|
|
11412
11520
|
};
|
|
11413
11521
|
};
|
|
11414
11522
|
};
|
|
11415
|
-
/** @description
|
|
11523
|
+
/** @description The provider refused, or the outcome is unknown. */
|
|
11416
11524
|
502: {
|
|
11417
11525
|
headers: {
|
|
11418
11526
|
[name: string]: unknown;
|
|
@@ -11440,6 +11548,605 @@ export interface paths {
|
|
|
11440
11548
|
patch?: never;
|
|
11441
11549
|
trace?: never;
|
|
11442
11550
|
};
|
|
11551
|
+
"/v1/charges": {
|
|
11552
|
+
parameters: {
|
|
11553
|
+
query?: never;
|
|
11554
|
+
header?: never;
|
|
11555
|
+
path?: never;
|
|
11556
|
+
cookie?: never;
|
|
11557
|
+
};
|
|
11558
|
+
/**
|
|
11559
|
+
* List charges
|
|
11560
|
+
* @description The charges this project issued, newest first. Page with `limit` (1 to 200, default 50) and `cursor`, which is the `created_at` of the last row you saw; `next_cursor` comes back null when the page is the last one.
|
|
11561
|
+
*
|
|
11562
|
+
* **The `settlement` here is the LAST KNOWN, and the one on the by-id read is the one from now.** The by-id read calls the issuer and compares; a list cannot do that per row, because 200 rows would be 200 provider calls and paging would become a flood. So every item carries `settlement_as_of`: when we last knew the issuer's state for that charge, or null if we never did.
|
|
11563
|
+
*
|
|
11564
|
+
* The same charge can therefore answer a different `settlement` here and there. That is the age of the data, not a defect, which is why the freshness field is required rather than optional. A charge we never read carries `settlement_as_of: null` and can never be `unconfirmable` on this list, because there is nothing to conflict with.
|
|
11565
|
+
*
|
|
11566
|
+
* `settlement=none` selects the charge with no settlement to report: nobody paid it, so there is no pending settlement, only an open receivable. It is not the same as omitting the filter.
|
|
11567
|
+
*/
|
|
11568
|
+
get: {
|
|
11569
|
+
parameters: {
|
|
11570
|
+
query?: {
|
|
11571
|
+
/** @description Our own row status: `pending`, `settled`, `expired`. */
|
|
11572
|
+
status?: string;
|
|
11573
|
+
/** @description Filters on the same three facts the field is derived from, in SQL. */
|
|
11574
|
+
settlement?: "confirmed" | "pending" | "unconfirmable" | "none";
|
|
11575
|
+
limit?: string;
|
|
11576
|
+
cursor?: string;
|
|
11577
|
+
};
|
|
11578
|
+
header?: never;
|
|
11579
|
+
path?: never;
|
|
11580
|
+
cookie?: never;
|
|
11581
|
+
};
|
|
11582
|
+
requestBody?: never;
|
|
11583
|
+
responses: {
|
|
11584
|
+
/** @description OK */
|
|
11585
|
+
200: {
|
|
11586
|
+
headers: {
|
|
11587
|
+
[name: string]: unknown;
|
|
11588
|
+
};
|
|
11589
|
+
content: {
|
|
11590
|
+
"application/json": {
|
|
11591
|
+
data: {
|
|
11592
|
+
id: string | null;
|
|
11593
|
+
status: string;
|
|
11594
|
+
local_status: string;
|
|
11595
|
+
status_conflict: boolean;
|
|
11596
|
+
currency: string;
|
|
11597
|
+
amount_minor: number;
|
|
11598
|
+
due_date: string | null;
|
|
11599
|
+
created_at: string;
|
|
11600
|
+
/** @enum {string|null} */
|
|
11601
|
+
settlement: "confirmed" | "pending" | "unconfirmable" | null;
|
|
11602
|
+
/** @description When we last knew the issuer's state. Null means we never did. */
|
|
11603
|
+
settlement_as_of: string | null;
|
|
11604
|
+
}[];
|
|
11605
|
+
next_cursor: string | null;
|
|
11606
|
+
};
|
|
11607
|
+
};
|
|
11608
|
+
};
|
|
11609
|
+
/** @description The query is malformed, or the credential names no project. */
|
|
11610
|
+
400: {
|
|
11611
|
+
headers: {
|
|
11612
|
+
[name: string]: unknown;
|
|
11613
|
+
};
|
|
11614
|
+
content: {
|
|
11615
|
+
"application/json": {
|
|
11616
|
+
error: {
|
|
11617
|
+
/** @enum {string} */
|
|
11618
|
+
code: "project_scope_missing" | "invalid_settlement_filter" | "invalid_limit";
|
|
11619
|
+
message: string;
|
|
11620
|
+
details?: {
|
|
11621
|
+
[key: string]: unknown;
|
|
11622
|
+
};
|
|
11623
|
+
};
|
|
11624
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
11625
|
+
request_id: string | null;
|
|
11626
|
+
};
|
|
11627
|
+
};
|
|
11628
|
+
};
|
|
11629
|
+
};
|
|
11630
|
+
};
|
|
11631
|
+
put?: never;
|
|
11632
|
+
/**
|
|
11633
|
+
* Issue a charge
|
|
11634
|
+
* @description Issues an inbound charge: the buyer pays the merchant. The RAIL IS A FIELD, not a path. `method: "pix"` mints an immediate Pix that hands back its copy-and-paste string right away and expires in about an hour. `method: "boleto"` WITH a `due_date` issues a cobrança com vencimento: ONE receivable the payer settles either as a boleto (barcode and linha digitável) or by Pix. One debt, two payable legs, never two documents.
|
|
11635
|
+
*
|
|
11636
|
+
* **The cobrança com vencimento answers `PROCESSING` with `payable: false` and no document.** The instrument registers with the clearing house first. Subscribe to `commerce.charge.created` rather than polling for a barcode that is not late, only not made yet. `commerce.charge.paid` is the event that means the funds arrived, by either leg.
|
|
11637
|
+
*
|
|
11638
|
+
* **`idempotency_key` is REQUIRED for that combination**, and it is checked before anything reaches the issuer. A repeat with the same key returns the charge already issued, or its still-open reservation, instead of a second receivable the same debtor could pay twice. Send it as the `Idempotency-Key` header, as the body's `idempotency_key`, or as both with the SAME value; two different values are refused rather than one silently winning.
|
|
11639
|
+
*
|
|
11640
|
+
* An agreement in N instalments is N cobranças, one per parcela, each with its own `due_date` and its own key. There is no single instalment charge.
|
|
11641
|
+
*
|
|
11642
|
+
* **Each refusal names a `reason`, and the reason is what to branch on.** The two error `code` values (`invalid_args`, `provider_error`) are too coarse: they cover six different situations, and reading them as one would turn `not found` into `bad request`.
|
|
11643
|
+
*
|
|
11644
|
+
* | reason | status | what it means |
|
|
11645
|
+
* |---|---|---|
|
|
11646
|
+
* | `charge_id_missing` | 400 | the call named no charge |
|
|
11647
|
+
* | `project_scope_missing` | 400 | the credential is not project-scoped, and a charge belongs to one project |
|
|
11648
|
+
* | `charge_not_found` | 404 | no charge under that id FOR THIS TENANT |
|
|
11649
|
+
* | `issuance_unconfirmed` | 409 | the key holds a reservation whose create never got an answer |
|
|
11650
|
+
* | `already_payment_notified` | 409 | the clearing house already notified a payment |
|
|
11651
|
+
* | `not_cancellable_in_this_state` | 409 | the issuer accepts a cancellation only in some states |
|
|
11652
|
+
* | `provider_status_unreadable` | 502 | the issuer did not answer the read |
|
|
11653
|
+
* | `provider_cancel_failed` | 502 | the issuer refused the withdrawal |
|
|
11654
|
+
*
|
|
11655
|
+
* `charge_not_found` is deliberately the SAME answer for an id that belongs to another project and for an id that exists nowhere. Telling those apart would be an oracle about another tenant over a string anyone can guess.
|
|
11656
|
+
*/
|
|
11657
|
+
post: {
|
|
11658
|
+
parameters: {
|
|
11659
|
+
query?: never;
|
|
11660
|
+
header?: never;
|
|
11661
|
+
path?: never;
|
|
11662
|
+
cookie?: never;
|
|
11663
|
+
};
|
|
11664
|
+
requestBody?: {
|
|
11665
|
+
content: {
|
|
11666
|
+
"application/json": {
|
|
11667
|
+
/** @description In minor units. */
|
|
11668
|
+
amount: number;
|
|
11669
|
+
currency: string;
|
|
11670
|
+
/** @description `pix`, `boleto`, `card` or `wallet`. */
|
|
11671
|
+
method: string;
|
|
11672
|
+
description?: string;
|
|
11673
|
+
buyer?: {
|
|
11674
|
+
[key: string]: unknown;
|
|
11675
|
+
};
|
|
11676
|
+
/** @description `YYYY-MM-DD`. With `method: "boleto"` this is what makes it a cobrança com vencimento; an immediate Pix has no due date and refuses one. */
|
|
11677
|
+
due_date?: string;
|
|
11678
|
+
/** @description Required for a cobrança com vencimento. Stable per debt: it is what makes a retry the SAME charge instead of a second one. */
|
|
11679
|
+
idempotency_key?: string;
|
|
11680
|
+
country?: string;
|
|
11681
|
+
metadata?: {
|
|
11682
|
+
[key: string]: unknown;
|
|
11683
|
+
};
|
|
11684
|
+
};
|
|
11685
|
+
};
|
|
11686
|
+
};
|
|
11687
|
+
responses: {
|
|
11688
|
+
/** @description OK */
|
|
11689
|
+
200: {
|
|
11690
|
+
headers: {
|
|
11691
|
+
[name: string]: unknown;
|
|
11692
|
+
};
|
|
11693
|
+
content: {
|
|
11694
|
+
"application/json": {
|
|
11695
|
+
/** @description The issuer's charge id. Null while the issuance is unconfirmed. */
|
|
11696
|
+
id: string | null;
|
|
11697
|
+
/** @description The provider's state as far as we know it, normalized. Forced to PROCESSING until the issuance is confirmed. */
|
|
11698
|
+
status: string;
|
|
11699
|
+
/** @description What CodeSpar recorded, which is a different question from `status`. */
|
|
11700
|
+
local_status: string;
|
|
11701
|
+
/** @description True when the two disagree terminally, instead of one of them silently winning. */
|
|
11702
|
+
status_conflict: boolean;
|
|
11703
|
+
method: string;
|
|
11704
|
+
currency: string;
|
|
11705
|
+
/** @description In units. */
|
|
11706
|
+
amount: number;
|
|
11707
|
+
/** @description In minor units. */
|
|
11708
|
+
amount_minor: number;
|
|
11709
|
+
due_date: string | null;
|
|
11710
|
+
/** @description True only when all four hold: the issuance is confirmed, our row is still open, the provider says PENDING, and at least one document exists. This is the field to branch on, not `status`. */
|
|
11711
|
+
payable: boolean;
|
|
11712
|
+
boleto_bar_code: string | null;
|
|
11713
|
+
boleto_bank_line: string | null;
|
|
11714
|
+
/** @description The Pix leg of the same debt. One receivable, two payable legs. */
|
|
11715
|
+
pix_copy_paste: string | null;
|
|
11716
|
+
/** @description Whether an inbound Pix on this charge's Pix leg can resolve a wallet on its own. False until registration hands us the leg's identifier. */
|
|
11717
|
+
credit_correlation_armed: boolean;
|
|
11718
|
+
/** @description True when a payment was notified and the receivable is still open. Read this before you write anything off: the issuer can answer EXPIRED for a boleto it already told us was paid, because the baixa happened before the due date and the credit lands on the next business day. */
|
|
11719
|
+
payment_in_flight: boolean;
|
|
11720
|
+
/**
|
|
11721
|
+
* @description The settlement tri-state (decision 10b of the canonical matrix). `confirmed`: the money is in the account. `pending`: the clearing house notified a payment and the credit has not landed, which is the D+1 window. `unconfirmable`: our terminal state disagrees with the issuer's, so settlement cannot be established.
|
|
11722
|
+
*
|
|
11723
|
+
* NULL MEANS NOT APPLICABLE, never `pending`. A charge nobody paid has no pending settlement: it has an open receivable. Reading null as pending would tell you money is on its way.
|
|
11724
|
+
* @enum {string|null}
|
|
11725
|
+
*/
|
|
11726
|
+
settlement: "confirmed" | "pending" | "unconfirmable" | null;
|
|
11727
|
+
/** @description True while the row is a reservation with no charge id: the issuer's answer to the create was lost, or a create is in flight elsewhere under the same key. Nothing is payable and nothing was duplicated. */
|
|
11728
|
+
issuance_unconfirmed: boolean;
|
|
11729
|
+
};
|
|
11730
|
+
};
|
|
11731
|
+
};
|
|
11732
|
+
/** @description The call is malformed, or the two idempotency keys disagree. */
|
|
11733
|
+
400: {
|
|
11734
|
+
headers: {
|
|
11735
|
+
[name: string]: unknown;
|
|
11736
|
+
};
|
|
11737
|
+
content: {
|
|
11738
|
+
"application/json": {
|
|
11739
|
+
error: {
|
|
11740
|
+
/** @enum {string} */
|
|
11741
|
+
code: "charge_idempotency_key_required" | "idempotency_key_conflict";
|
|
11742
|
+
message: string;
|
|
11743
|
+
details?: {
|
|
11744
|
+
[key: string]: unknown;
|
|
11745
|
+
};
|
|
11746
|
+
};
|
|
11747
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
11748
|
+
request_id: string | null;
|
|
11749
|
+
};
|
|
11750
|
+
};
|
|
11751
|
+
};
|
|
11752
|
+
/** @description The idempotency slot is held by a row this project cannot read. */
|
|
11753
|
+
409: {
|
|
11754
|
+
headers: {
|
|
11755
|
+
[name: string]: unknown;
|
|
11756
|
+
};
|
|
11757
|
+
content: {
|
|
11758
|
+
"application/json": {
|
|
11759
|
+
error: {
|
|
11760
|
+
/** @enum {string} */
|
|
11761
|
+
code: "charge_idempotency_slot_unreadable";
|
|
11762
|
+
message: string;
|
|
11763
|
+
details?: {
|
|
11764
|
+
[key: string]: unknown;
|
|
11765
|
+
};
|
|
11766
|
+
};
|
|
11767
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
11768
|
+
request_id: string | null;
|
|
11769
|
+
};
|
|
11770
|
+
};
|
|
11771
|
+
};
|
|
11772
|
+
/** @description The slot could not be reserved, or the issuer refused. Nothing was sent. */
|
|
11773
|
+
502: {
|
|
11774
|
+
headers: {
|
|
11775
|
+
[name: string]: unknown;
|
|
11776
|
+
};
|
|
11777
|
+
content: {
|
|
11778
|
+
"application/json": {
|
|
11779
|
+
error: {
|
|
11780
|
+
/** @enum {string} */
|
|
11781
|
+
code: "charge_idempotency_reserve_failed";
|
|
11782
|
+
message: string;
|
|
11783
|
+
details?: {
|
|
11784
|
+
[key: string]: unknown;
|
|
11785
|
+
};
|
|
11786
|
+
};
|
|
11787
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
11788
|
+
request_id: string | null;
|
|
11789
|
+
};
|
|
11790
|
+
};
|
|
11791
|
+
};
|
|
11792
|
+
};
|
|
11793
|
+
};
|
|
11794
|
+
delete?: never;
|
|
11795
|
+
options?: never;
|
|
11796
|
+
head?: never;
|
|
11797
|
+
patch?: never;
|
|
11798
|
+
trace?: never;
|
|
11799
|
+
};
|
|
11800
|
+
"/v1/charges/{chargeId}": {
|
|
11801
|
+
parameters: {
|
|
11802
|
+
query?: never;
|
|
11803
|
+
header?: never;
|
|
11804
|
+
path?: never;
|
|
11805
|
+
cookie?: never;
|
|
11806
|
+
};
|
|
11807
|
+
/**
|
|
11808
|
+
* Read a charge
|
|
11809
|
+
* @description Reads a charge this project issued. `chargeId` accepts EITHER the id the create returned OR the caller's own `idempotency_key` — the row is resolved under this credential's org and project, which is what makes another tenant's id simply not found.
|
|
11810
|
+
*
|
|
11811
|
+
* **Branch on `payable`, not on `status`.** `payable` is true only when the issuance is confirmed, our row is still open, the provider says PENDING, and at least one payable document exists. A cobrança com vencimento answers PROCESSING with `payable: false` and no document at first, because the instrument registers with the clearing house before it can be paid.
|
|
11812
|
+
*
|
|
11813
|
+
* This read also ARMS the Pix leg's correlation when the provider's answer carries it, which is why `credit_correlation_armed` can flip from a read. Nothing else about it writes: no ledger row, no money.
|
|
11814
|
+
*
|
|
11815
|
+
* **Each refusal names a `reason`, and the reason is what to branch on.** The two error `code` values (`invalid_args`, `provider_error`) are too coarse: they cover six different situations, and reading them as one would turn `not found` into `bad request`.
|
|
11816
|
+
*
|
|
11817
|
+
* | reason | status | what it means |
|
|
11818
|
+
* |---|---|---|
|
|
11819
|
+
* | `charge_id_missing` | 400 | the call named no charge |
|
|
11820
|
+
* | `project_scope_missing` | 400 | the credential is not project-scoped, and a charge belongs to one project |
|
|
11821
|
+
* | `charge_not_found` | 404 | no charge under that id FOR THIS TENANT |
|
|
11822
|
+
* | `issuance_unconfirmed` | 409 | the key holds a reservation whose create never got an answer |
|
|
11823
|
+
* | `already_payment_notified` | 409 | the clearing house already notified a payment |
|
|
11824
|
+
* | `not_cancellable_in_this_state` | 409 | the issuer accepts a cancellation only in some states |
|
|
11825
|
+
* | `provider_status_unreadable` | 502 | the issuer did not answer the read |
|
|
11826
|
+
* | `provider_cancel_failed` | 502 | the issuer refused the withdrawal |
|
|
11827
|
+
*
|
|
11828
|
+
* `charge_not_found` is deliberately the SAME answer for an id that belongs to another project and for an id that exists nowhere. Telling those apart would be an oracle about another tenant over a string anyone can guess.
|
|
11829
|
+
*/
|
|
11830
|
+
get: {
|
|
11831
|
+
parameters: {
|
|
11832
|
+
query?: never;
|
|
11833
|
+
header?: never;
|
|
11834
|
+
path: {
|
|
11835
|
+
chargeId: string;
|
|
11836
|
+
};
|
|
11837
|
+
cookie?: never;
|
|
11838
|
+
};
|
|
11839
|
+
requestBody?: never;
|
|
11840
|
+
responses: {
|
|
11841
|
+
/** @description OK */
|
|
11842
|
+
200: {
|
|
11843
|
+
headers: {
|
|
11844
|
+
[name: string]: unknown;
|
|
11845
|
+
};
|
|
11846
|
+
content: {
|
|
11847
|
+
"application/json": {
|
|
11848
|
+
/** @description The issuer's charge id. Null while the issuance is unconfirmed. */
|
|
11849
|
+
id: string | null;
|
|
11850
|
+
/** @description The provider's state as far as we know it, normalized. Forced to PROCESSING until the issuance is confirmed. */
|
|
11851
|
+
status: string;
|
|
11852
|
+
/** @description What CodeSpar recorded, which is a different question from `status`. */
|
|
11853
|
+
local_status: string;
|
|
11854
|
+
/** @description True when the two disagree terminally, instead of one of them silently winning. */
|
|
11855
|
+
status_conflict: boolean;
|
|
11856
|
+
method: string;
|
|
11857
|
+
currency: string;
|
|
11858
|
+
/** @description In units. */
|
|
11859
|
+
amount: number;
|
|
11860
|
+
/** @description In minor units. */
|
|
11861
|
+
amount_minor: number;
|
|
11862
|
+
due_date: string | null;
|
|
11863
|
+
/** @description True only when all four hold: the issuance is confirmed, our row is still open, the provider says PENDING, and at least one document exists. This is the field to branch on, not `status`. */
|
|
11864
|
+
payable: boolean;
|
|
11865
|
+
boleto_bar_code: string | null;
|
|
11866
|
+
boleto_bank_line: string | null;
|
|
11867
|
+
/** @description The Pix leg of the same debt. One receivable, two payable legs. */
|
|
11868
|
+
pix_copy_paste: string | null;
|
|
11869
|
+
/** @description Whether an inbound Pix on this charge's Pix leg can resolve a wallet on its own. False until registration hands us the leg's identifier. */
|
|
11870
|
+
credit_correlation_armed: boolean;
|
|
11871
|
+
/** @description True when a payment was notified and the receivable is still open. Read this before you write anything off: the issuer can answer EXPIRED for a boleto it already told us was paid, because the baixa happened before the due date and the credit lands on the next business day. */
|
|
11872
|
+
payment_in_flight: boolean;
|
|
11873
|
+
/**
|
|
11874
|
+
* @description The settlement tri-state (decision 10b of the canonical matrix). `confirmed`: the money is in the account. `pending`: the clearing house notified a payment and the credit has not landed, which is the D+1 window. `unconfirmable`: our terminal state disagrees with the issuer's, so settlement cannot be established.
|
|
11875
|
+
*
|
|
11876
|
+
* NULL MEANS NOT APPLICABLE, never `pending`. A charge nobody paid has no pending settlement: it has an open receivable. Reading null as pending would tell you money is on its way.
|
|
11877
|
+
* @enum {string|null}
|
|
11878
|
+
*/
|
|
11879
|
+
settlement: "confirmed" | "pending" | "unconfirmable" | null;
|
|
11880
|
+
/** @description True while the row is a reservation with no charge id: the issuer's answer to the create was lost, or a create is in flight elsewhere under the same key. Nothing is payable and nothing was duplicated. */
|
|
11881
|
+
issuance_unconfirmed: boolean;
|
|
11882
|
+
};
|
|
11883
|
+
};
|
|
11884
|
+
};
|
|
11885
|
+
/** @description The call is malformed. `reason` says which half. */
|
|
11886
|
+
400: {
|
|
11887
|
+
headers: {
|
|
11888
|
+
[name: string]: unknown;
|
|
11889
|
+
};
|
|
11890
|
+
content: {
|
|
11891
|
+
"application/json": {
|
|
11892
|
+
error: {
|
|
11893
|
+
/** @enum {string} */
|
|
11894
|
+
code: "charge_id_missing" | "project_scope_missing";
|
|
11895
|
+
message: string;
|
|
11896
|
+
details?: {
|
|
11897
|
+
[key: string]: unknown;
|
|
11898
|
+
};
|
|
11899
|
+
};
|
|
11900
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
11901
|
+
request_id: string | null;
|
|
11902
|
+
};
|
|
11903
|
+
};
|
|
11904
|
+
};
|
|
11905
|
+
/** @description No charge under that id for this tenant. */
|
|
11906
|
+
404: {
|
|
11907
|
+
headers: {
|
|
11908
|
+
[name: string]: unknown;
|
|
11909
|
+
};
|
|
11910
|
+
content: {
|
|
11911
|
+
"application/json": {
|
|
11912
|
+
error: {
|
|
11913
|
+
/** @enum {string} */
|
|
11914
|
+
code: "charge_not_found";
|
|
11915
|
+
message: string;
|
|
11916
|
+
details?: {
|
|
11917
|
+
[key: string]: unknown;
|
|
11918
|
+
};
|
|
11919
|
+
};
|
|
11920
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
11921
|
+
request_id: string | null;
|
|
11922
|
+
};
|
|
11923
|
+
};
|
|
11924
|
+
};
|
|
11925
|
+
/** @description The charge exists and is not readable in this state. */
|
|
11926
|
+
409: {
|
|
11927
|
+
headers: {
|
|
11928
|
+
[name: string]: unknown;
|
|
11929
|
+
};
|
|
11930
|
+
content: {
|
|
11931
|
+
"application/json": {
|
|
11932
|
+
error: {
|
|
11933
|
+
/** @enum {string} */
|
|
11934
|
+
code: "issuance_unconfirmed";
|
|
11935
|
+
message: string;
|
|
11936
|
+
details?: {
|
|
11937
|
+
[key: string]: unknown;
|
|
11938
|
+
};
|
|
11939
|
+
};
|
|
11940
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
11941
|
+
request_id: string | null;
|
|
11942
|
+
};
|
|
11943
|
+
};
|
|
11944
|
+
};
|
|
11945
|
+
/** @description The issuer did not answer. */
|
|
11946
|
+
502: {
|
|
11947
|
+
headers: {
|
|
11948
|
+
[name: string]: unknown;
|
|
11949
|
+
};
|
|
11950
|
+
content: {
|
|
11951
|
+
"application/json": {
|
|
11952
|
+
error: {
|
|
11953
|
+
/** @enum {string} */
|
|
11954
|
+
code: "provider_status_unreadable";
|
|
11955
|
+
message: string;
|
|
11956
|
+
details?: {
|
|
11957
|
+
[key: string]: unknown;
|
|
11958
|
+
};
|
|
11959
|
+
};
|
|
11960
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
11961
|
+
request_id: string | null;
|
|
11962
|
+
};
|
|
11963
|
+
};
|
|
11964
|
+
};
|
|
11965
|
+
};
|
|
11966
|
+
};
|
|
11967
|
+
put?: never;
|
|
11968
|
+
post?: never;
|
|
11969
|
+
delete?: never;
|
|
11970
|
+
options?: never;
|
|
11971
|
+
head?: never;
|
|
11972
|
+
patch?: never;
|
|
11973
|
+
trace?: never;
|
|
11974
|
+
};
|
|
11975
|
+
"/v1/charges/{chargeId}/cancel": {
|
|
11976
|
+
parameters: {
|
|
11977
|
+
query?: never;
|
|
11978
|
+
header?: never;
|
|
11979
|
+
path?: never;
|
|
11980
|
+
cookie?: never;
|
|
11981
|
+
};
|
|
11982
|
+
get?: never;
|
|
11983
|
+
put?: never;
|
|
11984
|
+
/**
|
|
11985
|
+
* Withdraw a charge
|
|
11986
|
+
* @description Withdraws a charge that has not been paid. Takes no body: the id is the whole request, and it accepts the same two forms the read does.
|
|
11987
|
+
*
|
|
11988
|
+
* **This never moves money.** It is not a refund: an unpaid receivable is withdrawn, and a charge whose payment the clearing house already notified is REFUSED with `already_payment_notified` rather than withdrawn. That refusal is the D+1 guard: a boleto paid after the convênio's cut-off is notified on one day and credited on the next business day, so the due date can fall between the two, and withdrawing there would write off a receivable somebody paid.
|
|
11989
|
+
*
|
|
11990
|
+
* A charge the issuer already reports as cancelled is a no-op that closes our row, not a second withdrawal.
|
|
11991
|
+
*
|
|
11992
|
+
* **Each refusal names a `reason`, and the reason is what to branch on.** The two error `code` values (`invalid_args`, `provider_error`) are too coarse: they cover six different situations, and reading them as one would turn `not found` into `bad request`.
|
|
11993
|
+
*
|
|
11994
|
+
* | reason | status | what it means |
|
|
11995
|
+
* |---|---|---|
|
|
11996
|
+
* | `charge_id_missing` | 400 | the call named no charge |
|
|
11997
|
+
* | `project_scope_missing` | 400 | the credential is not project-scoped, and a charge belongs to one project |
|
|
11998
|
+
* | `charge_not_found` | 404 | no charge under that id FOR THIS TENANT |
|
|
11999
|
+
* | `issuance_unconfirmed` | 409 | the key holds a reservation whose create never got an answer |
|
|
12000
|
+
* | `already_payment_notified` | 409 | the clearing house already notified a payment |
|
|
12001
|
+
* | `not_cancellable_in_this_state` | 409 | the issuer accepts a cancellation only in some states |
|
|
12002
|
+
* | `provider_status_unreadable` | 502 | the issuer did not answer the read |
|
|
12003
|
+
* | `provider_cancel_failed` | 502 | the issuer refused the withdrawal |
|
|
12004
|
+
*
|
|
12005
|
+
* `charge_not_found` is deliberately the SAME answer for an id that belongs to another project and for an id that exists nowhere. Telling those apart would be an oracle about another tenant over a string anyone can guess.
|
|
12006
|
+
*/
|
|
12007
|
+
post: {
|
|
12008
|
+
parameters: {
|
|
12009
|
+
query?: never;
|
|
12010
|
+
header?: never;
|
|
12011
|
+
path: {
|
|
12012
|
+
chargeId: string;
|
|
12013
|
+
};
|
|
12014
|
+
cookie?: never;
|
|
12015
|
+
};
|
|
12016
|
+
requestBody?: never;
|
|
12017
|
+
responses: {
|
|
12018
|
+
/** @description OK */
|
|
12019
|
+
200: {
|
|
12020
|
+
headers: {
|
|
12021
|
+
[name: string]: unknown;
|
|
12022
|
+
};
|
|
12023
|
+
content: {
|
|
12024
|
+
"application/json": {
|
|
12025
|
+
/** @description The issuer's charge id. Null while the issuance is unconfirmed. */
|
|
12026
|
+
id: string | null;
|
|
12027
|
+
/** @description The provider's state as far as we know it, normalized. Forced to PROCESSING until the issuance is confirmed. */
|
|
12028
|
+
status: string;
|
|
12029
|
+
/** @description What CodeSpar recorded, which is a different question from `status`. */
|
|
12030
|
+
local_status: string;
|
|
12031
|
+
/** @description True when the two disagree terminally, instead of one of them silently winning. */
|
|
12032
|
+
status_conflict: boolean;
|
|
12033
|
+
method: string;
|
|
12034
|
+
currency: string;
|
|
12035
|
+
/** @description In units. */
|
|
12036
|
+
amount: number;
|
|
12037
|
+
/** @description In minor units. */
|
|
12038
|
+
amount_minor: number;
|
|
12039
|
+
due_date: string | null;
|
|
12040
|
+
/** @description True only when all four hold: the issuance is confirmed, our row is still open, the provider says PENDING, and at least one document exists. This is the field to branch on, not `status`. */
|
|
12041
|
+
payable: boolean;
|
|
12042
|
+
boleto_bar_code: string | null;
|
|
12043
|
+
boleto_bank_line: string | null;
|
|
12044
|
+
/** @description The Pix leg of the same debt. One receivable, two payable legs. */
|
|
12045
|
+
pix_copy_paste: string | null;
|
|
12046
|
+
/** @description Whether an inbound Pix on this charge's Pix leg can resolve a wallet on its own. False until registration hands us the leg's identifier. */
|
|
12047
|
+
credit_correlation_armed: boolean;
|
|
12048
|
+
/** @description True when a payment was notified and the receivable is still open. Read this before you write anything off: the issuer can answer EXPIRED for a boleto it already told us was paid, because the baixa happened before the due date and the credit lands on the next business day. */
|
|
12049
|
+
payment_in_flight: boolean;
|
|
12050
|
+
/**
|
|
12051
|
+
* @description The settlement tri-state (decision 10b of the canonical matrix). `confirmed`: the money is in the account. `pending`: the clearing house notified a payment and the credit has not landed, which is the D+1 window. `unconfirmable`: our terminal state disagrees with the issuer's, so settlement cannot be established.
|
|
12052
|
+
*
|
|
12053
|
+
* NULL MEANS NOT APPLICABLE, never `pending`. A charge nobody paid has no pending settlement: it has an open receivable. Reading null as pending would tell you money is on its way.
|
|
12054
|
+
* @enum {string|null}
|
|
12055
|
+
*/
|
|
12056
|
+
settlement: "confirmed" | "pending" | "unconfirmable" | null;
|
|
12057
|
+
/** @description True while the row is a reservation with no charge id: the issuer's answer to the create was lost, or a create is in flight elsewhere under the same key. Nothing is payable and nothing was duplicated. */
|
|
12058
|
+
issuance_unconfirmed: boolean;
|
|
12059
|
+
};
|
|
12060
|
+
};
|
|
12061
|
+
};
|
|
12062
|
+
/** @description The call is malformed. */
|
|
12063
|
+
400: {
|
|
12064
|
+
headers: {
|
|
12065
|
+
[name: string]: unknown;
|
|
12066
|
+
};
|
|
12067
|
+
content: {
|
|
12068
|
+
"application/json": {
|
|
12069
|
+
error: {
|
|
12070
|
+
/** @enum {string} */
|
|
12071
|
+
code: "charge_id_missing" | "project_scope_missing";
|
|
12072
|
+
message: string;
|
|
12073
|
+
details?: {
|
|
12074
|
+
[key: string]: unknown;
|
|
12075
|
+
};
|
|
12076
|
+
};
|
|
12077
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
12078
|
+
request_id: string | null;
|
|
12079
|
+
};
|
|
12080
|
+
};
|
|
12081
|
+
};
|
|
12082
|
+
/** @description No charge under that id for this tenant. */
|
|
12083
|
+
404: {
|
|
12084
|
+
headers: {
|
|
12085
|
+
[name: string]: unknown;
|
|
12086
|
+
};
|
|
12087
|
+
content: {
|
|
12088
|
+
"application/json": {
|
|
12089
|
+
error: {
|
|
12090
|
+
/** @enum {string} */
|
|
12091
|
+
code: "charge_not_found";
|
|
12092
|
+
message: string;
|
|
12093
|
+
details?: {
|
|
12094
|
+
[key: string]: unknown;
|
|
12095
|
+
};
|
|
12096
|
+
};
|
|
12097
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
12098
|
+
request_id: string | null;
|
|
12099
|
+
};
|
|
12100
|
+
};
|
|
12101
|
+
};
|
|
12102
|
+
/** @description The charge exists and this state does not accept a withdrawal. `already_payment_notified` is the D+1 guard and is never a retry case. */
|
|
12103
|
+
409: {
|
|
12104
|
+
headers: {
|
|
12105
|
+
[name: string]: unknown;
|
|
12106
|
+
};
|
|
12107
|
+
content: {
|
|
12108
|
+
"application/json": {
|
|
12109
|
+
error: {
|
|
12110
|
+
/** @enum {string} */
|
|
12111
|
+
code: "issuance_unconfirmed" | "already_payment_notified" | "not_cancellable_in_this_state";
|
|
12112
|
+
message: string;
|
|
12113
|
+
details?: {
|
|
12114
|
+
[key: string]: unknown;
|
|
12115
|
+
};
|
|
12116
|
+
};
|
|
12117
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
12118
|
+
request_id: string | null;
|
|
12119
|
+
};
|
|
12120
|
+
};
|
|
12121
|
+
};
|
|
12122
|
+
/** @description The issuer refused the withdrawal, or did not answer. */
|
|
12123
|
+
502: {
|
|
12124
|
+
headers: {
|
|
12125
|
+
[name: string]: unknown;
|
|
12126
|
+
};
|
|
12127
|
+
content: {
|
|
12128
|
+
"application/json": {
|
|
12129
|
+
error: {
|
|
12130
|
+
/** @enum {string} */
|
|
12131
|
+
code: "provider_cancel_failed" | "provider_status_unreadable";
|
|
12132
|
+
message: string;
|
|
12133
|
+
details?: {
|
|
12134
|
+
[key: string]: unknown;
|
|
12135
|
+
};
|
|
12136
|
+
};
|
|
12137
|
+
/** @description Echoes the `X-Request-Id` header when the request carried one. */
|
|
12138
|
+
request_id: string | null;
|
|
12139
|
+
};
|
|
12140
|
+
};
|
|
12141
|
+
};
|
|
12142
|
+
};
|
|
12143
|
+
};
|
|
12144
|
+
delete?: never;
|
|
12145
|
+
options?: never;
|
|
12146
|
+
head?: never;
|
|
12147
|
+
patch?: never;
|
|
12148
|
+
trace?: never;
|
|
12149
|
+
};
|
|
11443
12150
|
"/v1/consumers/{consumerId}/dda/subscriptions/{document}": {
|
|
11444
12151
|
parameters: {
|
|
11445
12152
|
query?: never;
|
|
@@ -18823,7 +19530,7 @@ export interface paths {
|
|
|
18823
19530
|
*
|
|
18824
19531
|
* `linked_consumer_id` is set on first write and then kept: a later call that sends a different one does not overwrite it. The other KYB fields are overwritten by the re-POST.
|
|
18825
19532
|
*
|
|
18826
|
-
* `document_number` is stored with every non-digit stripped. A value that survives the schema but contains no digits at all leaves nothing to store, and that surfaces as 502 `seller_document_required`, not as 400: the check lives in the provisioning flow, past the point where the body was validated.
|
|
19533
|
+
* `document_number` must be a CPF (11 digits) or a CNPJ (14 characters, letters allowed in the twelve base positions per IN RFB 2229/2024) whose check digits verify, and `document_type` / `document_tax_type` must agree with it (CPF ↔ PF, CNPJ ↔ PJ | MEI | ME); any of those failing is 400 `invalid_body` with the offending field in `issues[].path`, before Rinne is reached. It is then stored with every non-digit stripped. A value that survives the schema but contains no digits at all leaves nothing to store, and that surfaces as 502 `seller_document_required`, not as 400: the check lives in the provisioning flow, past the point where the body was validated.
|
|
18827
19534
|
*
|
|
18828
19535
|
* The response is the seller row, not Rinne's. `status` and `affiliation_status` reflect whatever the affiliation was at that instant, which for a fresh onboarding is normally pending rather than active.
|
|
18829
19536
|
*/
|
|
@@ -20227,6 +20934,18 @@ export interface paths {
|
|
|
20227
20934
|
* Three refusals arrive IN BAND on the catalog branch, as a 200 whose `error` starts with `policy_denied: `, `approval_required: ` or `policy_engine_error: `. The policy 403 and the policy 503 below are the same decisions taken one layer earlier, by the route's guard, before the handler runs. A caller that only checks the status code will read an in-band refusal as a successful request.
|
|
20228
20935
|
*
|
|
20229
20936
|
* 413 is absent from this operation on purpose: the guard here does not hand the caller's tool input to the policy engine, so the engine's payload cap cannot fire. `POST /v1/sessions/{id}/proxy_execute` does hand it over, and does answer 413.
|
|
20937
|
+
*
|
|
20938
|
+
* WHICH STRINGS ARE LEGAL IN `tool`. This operation takes the name opaquely and this document does not enumerate it. `GET /v1/meta-tools.json` does: one entry per tool, each with a JSON Schema for what goes in `params`, served with no credential. Read that before hardcoding a name or concluding a capability is missing, because the per-tool contracts live there and not here.
|
|
20939
|
+
*
|
|
20940
|
+
* SEVERAL OF THOSE TOOLS MOVE MONEY, and the envelope above shows none of what they require. `codespar_pay` spends outbound under a mandate; `codespar_charge` issues an inbound receivable. Both answer in this same 200 envelope, so `success` is the field that says whether the money instruction was accepted, and a refusal that starts with `policy_denied: ` or `approval_required: ` is a refusal even though the status is 200.
|
|
20941
|
+
*
|
|
20942
|
+
* THE COBRANÇA COM VENCIMENTO IS THE ONE THAT SURPRISES CALLERS. `codespar_charge` with `action: "create"`, `method: "boleto"` and a `due_date` issues ONE receivable the payer settles EITHER as a boleto (barcode and linha digitável) OR by Pix — one debt, two payable legs, never two documents. Three properties of it are not visible from this envelope and each one costs money to learn late:
|
|
20943
|
+
*
|
|
20944
|
+
* 1. `idempotency_key` is REQUIRED for that combination. A create without one is refused before anything reaches the provider, and a repeat with the same key returns the charge already issued rather than a second document for the same debt. An agent that retries on a timeout without it bills the payer twice.
|
|
20945
|
+
* 2. The create answers `status: "PROCESSING"` with `payable: false` and NO document. The instrument registers with the clearing house first. Subscribe to `commerce.charge.created` instead of polling for a barcode that is not late, only not made yet.
|
|
20946
|
+
* 3. `commerce.charge.paid` is the event that means the funds arrived, by either leg. A boleto payment can be preceded by `commerce.charge.payment_notified`, which is the clearing house posting its operational baixa and which the issuer states is not proof of payment; every convênio has a daily cut-off, so a boleto paid after it is notified on one day and credited on the next business day. Ship on `paid`.
|
|
20947
|
+
*
|
|
20948
|
+
* An agreement in N instalments is N cobranças, one per parcela, each with its own `due_date` and its own `idempotency_key`. There is no single instalment charge.
|
|
20230
20949
|
*/
|
|
20231
20950
|
post: {
|
|
20232
20951
|
parameters: {
|
|
@@ -22871,12 +23590,12 @@ export interface components {
|
|
|
22871
23590
|
};
|
|
22872
23591
|
payment: {
|
|
22873
23592
|
transactionId: string;
|
|
22874
|
-
/** @description
|
|
23593
|
+
/** @description The Pix endToEndId when the rail produces one. Null for rails that have none, TED included. */
|
|
22875
23594
|
endToEndId: string | null;
|
|
22876
23595
|
amountMinor: number;
|
|
22877
23596
|
rail: string;
|
|
22878
23597
|
provider: string;
|
|
22879
|
-
/** @description False
|
|
23598
|
+
/** @description False when the adapter is a mock or a staging stub. True when real money left. */
|
|
22880
23599
|
moneyMoved: boolean;
|
|
22881
23600
|
adapter: string;
|
|
22882
23601
|
};
|
|
@@ -22886,7 +23605,7 @@ export interface components {
|
|
|
22886
23605
|
fundEntryId: string | null;
|
|
22887
23606
|
debitEntryId: string | null;
|
|
22888
23607
|
};
|
|
22889
|
-
/** @description
|
|
23608
|
+
/** @description The sealed Control Record. Null when there was no consumer secret to sign it with. */
|
|
22890
23609
|
receipt: {
|
|
22891
23610
|
id: string;
|
|
22892
23611
|
/** @enum {string} */
|
|
@@ -22894,34 +23613,35 @@ export interface components {
|
|
|
22894
23613
|
chain: string;
|
|
22895
23614
|
exceptions: unknown[];
|
|
22896
23615
|
} | null;
|
|
22897
|
-
/** @description
|
|
23616
|
+
/** @description The lifecycle steps, in order, each with a timestamp and an outcome. */
|
|
22898
23617
|
audit: unknown[];
|
|
22899
23618
|
};
|
|
23619
|
+
/** @description The destination of a TED, the Brazilian same-day bank wire. Present this object on a spend to send a wire instead of a Pix: its presence is what switches the rail, and what makes the three TED requirements on those operations bind. Money leaves the consumer's own sub-account, never a pooled one. */
|
|
22900
23620
|
TedDestination: {
|
|
22901
|
-
/** @description ISPB
|
|
23621
|
+
/** @description ISPB of the destination institution, digits only. */
|
|
22902
23622
|
bank: string;
|
|
22903
|
-
/** @description
|
|
23623
|
+
/** @description Branch, with no separate check digit. */
|
|
22904
23624
|
branch: string;
|
|
22905
|
-
/** @description
|
|
23625
|
+
/** @description Account, including the check digit. */
|
|
22906
23626
|
account: string;
|
|
22907
|
-
/** @description CPF
|
|
23627
|
+
/** @description CPF or CNPJ of the destination account holder. */
|
|
22908
23628
|
tax_id: string;
|
|
22909
|
-
/** @description
|
|
23629
|
+
/** @description Name of the destination account holder. */
|
|
22910
23630
|
name: string;
|
|
22911
23631
|
/**
|
|
22912
|
-
* @description
|
|
23632
|
+
* @description Checking, investment, payment or savings. This is the TED product's OWN enum, different from the Pix account enum (`CACC`, `SLRY`, `SVGS`, `TRAN`): they are distinct endpoints and distinct products at the provider.
|
|
22913
23633
|
* @enum {string}
|
|
22914
23634
|
*/
|
|
22915
23635
|
account_type?: "CC" | "CI" | "PG" | "PP";
|
|
22916
23636
|
/**
|
|
22917
|
-
* @description
|
|
23637
|
+
* @description A natural person or a legal entity.
|
|
22918
23638
|
* @enum {string}
|
|
22919
23639
|
*/
|
|
22920
23640
|
person_type?: "F" | "J";
|
|
22921
|
-
/** @description
|
|
23641
|
+
/** @description The banking partner's purpose code. Defaults to `1`, a generic transfer. */
|
|
22922
23642
|
client_finality?: string;
|
|
22923
23643
|
};
|
|
22924
|
-
/** @description
|
|
23644
|
+
/** @description The offer the agent approved. When present it is signed into the receipt, and at close the price and the payee are compared against what actually settled. A divergence is RECORDED on the receipt; it does not abort settlement. */
|
|
22925
23645
|
SpendQuote: {
|
|
22926
23646
|
seller: string;
|
|
22927
23647
|
resource: string;
|