@codespar/sdk 0.16.4 → 0.16.6

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.
@@ -6141,6 +6141,11 @@ export interface paths {
6141
6141
  status: "active" | "blocked" | "canceled";
6142
6142
  /** @description The card's token in the cardholder-data environment. Null until ingest lands, which is its own step after the card exists, so a freshly issued card can be readable here with no token yet. */
6143
6143
  token_id: string | null;
6144
+ /**
6145
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
6146
+ * @enum {string}
6147
+ */
6148
+ cde: "ingested" | "not_ingested" | "not_configured";
6144
6149
  /** Format: date-time */
6145
6150
  created_at: string;
6146
6151
  }[];
@@ -6269,6 +6274,11 @@ export interface paths {
6269
6274
  status: "active" | "blocked" | "canceled";
6270
6275
  /** @description The card's token in the cardholder-data environment. Null until ingest lands, which is its own step after the card exists, so a freshly issued card can be readable here with no token yet. */
6271
6276
  token_id: string | null;
6277
+ /**
6278
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
6279
+ * @enum {string}
6280
+ */
6281
+ cde: "ingested" | "not_ingested" | "not_configured";
6272
6282
  /** Format: date-time */
6273
6283
  created_at: string;
6274
6284
  };
@@ -6313,6 +6323,11 @@ export interface paths {
6313
6323
  status: "active" | "blocked" | "canceled";
6314
6324
  /** @description The card's token in the cardholder-data environment. Null until ingest lands, which is its own step after the card exists, so a freshly issued card can be readable here with no token yet. */
6315
6325
  token_id: string | null;
6326
+ /**
6327
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
6328
+ * @enum {string}
6329
+ */
6330
+ cde: "ingested" | "not_ingested" | "not_configured";
6316
6331
  /** Format: date-time */
6317
6332
  created_at: string;
6318
6333
  } | null;
@@ -6353,6 +6368,11 @@ export interface paths {
6353
6368
  status: "active" | "blocked" | "canceled";
6354
6369
  /** @description The card's token in the cardholder-data environment. Null until ingest lands, which is its own step after the card exists, so a freshly issued card can be readable here with no token yet. */
6355
6370
  token_id: string | null;
6371
+ /**
6372
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
6373
+ * @enum {string}
6374
+ */
6375
+ cde: "ingested" | "not_ingested" | "not_configured";
6356
6376
  /** Format: date-time */
6357
6377
  created_at: string;
6358
6378
  };
@@ -6406,6 +6426,11 @@ export interface paths {
6406
6426
  status: "active" | "blocked" | "canceled";
6407
6427
  /** @description The card's token in the cardholder-data environment. Null until ingest lands, which is its own step after the card exists, so a freshly issued card can be readable here with no token yet. */
6408
6428
  token_id: string | null;
6429
+ /**
6430
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
6431
+ * @enum {string}
6432
+ */
6433
+ cde: "ingested" | "not_ingested" | "not_configured";
6409
6434
  /** Format: date-time */
6410
6435
  created_at: string;
6411
6436
  } | null;
@@ -6621,6 +6646,11 @@ export interface paths {
6621
6646
  status: "active" | "blocked" | "canceled";
6622
6647
  /** @description The card's token in the cardholder-data environment. Null until ingest lands, which is its own step after the card exists, so a freshly issued card can be readable here with no token yet. */
6623
6648
  token_id: string | null;
6649
+ /**
6650
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
6651
+ * @enum {string}
6652
+ */
6653
+ cde: "ingested" | "not_ingested" | "not_configured";
6624
6654
  /** Format: date-time */
6625
6655
  created_at: string;
6626
6656
  } | {
@@ -6664,6 +6694,11 @@ export interface paths {
6664
6694
  status: "active" | "blocked" | "canceled";
6665
6695
  /** @description The card's token in the cardholder-data environment. Null until ingest lands, which is its own step after the card exists, so a freshly issued card can be readable here with no token yet. */
6666
6696
  token_id: string | null;
6697
+ /**
6698
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
6699
+ * @enum {string}
6700
+ */
6701
+ cde: "ingested" | "not_ingested" | "not_configured";
6667
6702
  /** Format: date-time */
6668
6703
  created_at: string;
6669
6704
  } | null;
@@ -8300,6 +8335,11 @@ export interface paths {
8300
8335
  status: "active" | "blocked" | "canceled";
8301
8336
  /** @description The card-data-environment token id, null until the mint flow allocates one. Allocation happens BEFORE the card material is ingested, so a token id with no material behind it is a recorded failure rather than a silent gap. It is the handle a PCI-scoped surface exchanges for card material; no card material is reachable through this API with it. */
8302
8337
  token_id: string | null;
8338
+ /**
8339
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
8340
+ * @enum {string}
8341
+ */
8342
+ cde: "ingested" | "not_ingested" | "not_configured";
8303
8343
  /** Format: date-time */
8304
8344
  created_at: string;
8305
8345
  } | {
@@ -8334,6 +8374,11 @@ export interface paths {
8334
8374
  status: "active" | "blocked" | "canceled";
8335
8375
  /** @description The card-data-environment token id, null until the mint flow allocates one. Allocation happens BEFORE the card material is ingested, so a token id with no material behind it is a recorded failure rather than a silent gap. It is the handle a PCI-scoped surface exchanges for card material; no card material is reachable through this API with it. */
8336
8376
  token_id: string | null;
8377
+ /**
8378
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
8379
+ * @enum {string}
8380
+ */
8381
+ cde: "ingested" | "not_ingested" | "not_configured";
8337
8382
  /** Format: date-time */
8338
8383
  created_at: string;
8339
8384
  } | null;
@@ -8455,6 +8500,11 @@ export interface paths {
8455
8500
  /** @enum {string} */
8456
8501
  status: "active" | "blocked" | "canceled";
8457
8502
  token_id: string | null;
8503
+ /**
8504
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
8505
+ * @enum {string}
8506
+ */
8507
+ cde: "ingested" | "not_ingested" | "not_configured";
8458
8508
  /** Format: date-time */
8459
8509
  created_at: string;
8460
8510
  };
@@ -8492,6 +8542,11 @@ export interface paths {
8492
8542
  /** @enum {string} */
8493
8543
  status: "active" | "blocked" | "canceled";
8494
8544
  token_id: string | null;
8545
+ /**
8546
+ * @description Whether the cardholder-data environment holds this card's PAN. `ingested`: it does, and `token_id` names the token. `not_configured`: this deployment has no CDE, the PAN was never asked for, and no retry of the Idempotency-Key changes that — a deployment posture, not a caller fault. `not_ingested`: a CDE exists and the card has no token; on a mint that is the 502 `issuer_ingest_failed` retry contract, on a read it is a card whose ingest has not landed.
8547
+ * @enum {string}
8548
+ */
8549
+ cde: "ingested" | "not_ingested" | "not_configured";
8495
8550
  /** Format: date-time */
8496
8551
  created_at: string;
8497
8552
  };
@@ -15132,6 +15187,8 @@ export interface paths {
15132
15187
  *
15133
15188
  * **`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.
15134
15189
  *
15190
+ * **`consumer_id` is REQUIRED for a `boleto` too**: it names the merchant-side consumer the receivable settles into, and its wallet is what the payment credits. Without it there is nothing to settle into and the call is refused with `consumer_id_required` before anything is sent. In a test project any stable id of your own works: the project's shared-sandbox receiver stands in for the consumer's account at the issuer (the consumer is never onboarded there), and `POST /v1/test/charges/{chargeId}/pay` settles the charge into that consumer's wallet.
15191
+ *
15135
15192
  * 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.
15136
15193
  *
15137
15194
  * **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`.
@@ -15140,7 +15197,9 @@ export interface paths {
15140
15197
  * |---|---|---|
15141
15198
  * | `charge_id_missing` | 400 | the call named no charge |
15142
15199
  * | `project_scope_missing` | 400 | the credential is not project-scoped, and a charge belongs to one project |
15200
+ * | `consumer_id_required` | 400 | a `boleto` create named no `consumer_id`, so there is no wallet for the receivable to settle into |
15143
15201
  * | `charge_not_found` | 404 | no charge under that id FOR THIS TENANT |
15202
+ * | `charge_reference_ambiguous` | 409 | the reference is one charge's id AND another's idempotency key; query by the charge id |
15144
15203
  * | `issuance_unconfirmed` | 409 | the key holds a reservation whose create never got an answer |
15145
15204
  * | `already_payment_notified` | 409 | the clearing house already notified a payment |
15146
15205
  * | `not_cancellable_in_this_state` | 409 | the issuer accepts a cancellation only in some states |
@@ -15159,11 +15218,13 @@ export interface paths {
15159
15218
  requestBody?: {
15160
15219
  content: {
15161
15220
  "application/json": {
15162
- /** @description In minor units. */
15221
+ /** @description In MAJOR units of `currency`, NOT minor: `12.5` is R$ 12,50 and comes back as `amount_minor: 1250`. Sending `1250` here issues a R$ 1.250,00 charge. This is the one field of the charge family that takes major units; every `*_minor` field, including the response's `amount_minor`, is in centavos. */
15163
15222
  amount: number;
15164
15223
  currency: string;
15165
15224
  /** @description `pix`, `boleto`, `card` or `wallet`. */
15166
15225
  method: string;
15226
+ /** @description The merchant-side consumer the charge settles into: its wallet is credited when the debtor pays. REQUIRED for `boleto` (refused with `consumer_id_required` otherwise); optional for the other methods, where an absent value falls back to the session's user when there is one. */
15227
+ consumer_id?: string;
15167
15228
  description?: string;
15168
15229
  buyer?: {
15169
15230
  [key: string]: unknown;
@@ -15189,7 +15250,11 @@ export interface paths {
15189
15250
  "application/json": {
15190
15251
  /** @description The issuer's charge id. Null while the issuance is unconfirmed. */
15191
15252
  id: string | null;
15192
- /** @description The provider's state as far as we know it, normalized. Forced to PROCESSING until the issuance is confirmed. */
15253
+ /**
15254
+ * @description The provider's state as far as we know it, normalized (`PROCESSING`, `PENDING`, `CONFIRMED`, `CANCELLED`, `EXPIRED`). Forced to PROCESSING until the issuance is confirmed.
15255
+ *
15256
+ * **A charge settled by the sandbox payer answers `CONFIRMED` here**, the same value a real payment leaves a live read answering — so a client that polls `status` sees the test payment exactly where it would see a live one. The issuer's homolog account never sees that money and keeps answering PENDING (EXPIRED after the due date); that answer stays in `raw` and is not reported as `status` or as a `status_conflict`, because for a test charge the fixture is the issuer's truth. `settlement: "confirmed"` and `local_status: "settled"` say the same thing from our side.
15257
+ */
15193
15258
  status: string;
15194
15259
  /** @description What CodeSpar recorded, which is a different question from `status`. */
15195
15260
  local_status: string;
@@ -15197,9 +15262,9 @@ export interface paths {
15197
15262
  status_conflict: boolean;
15198
15263
  method: string;
15199
15264
  currency: string;
15200
- /** @description In units. */
15265
+ /** @description In MAJOR units of `currency`: `12.5` is R$ 12,50. Always `amount_minor / 100`. */
15201
15266
  amount: number;
15202
- /** @description In minor units. */
15267
+ /** @description In minor units (centavos): `1250` is R$ 12,50. */
15203
15268
  amount_minor: number;
15204
15269
  due_date: string | null;
15205
15270
  /** @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`. */
@@ -15224,7 +15289,7 @@ export interface paths {
15224
15289
  };
15225
15290
  };
15226
15291
  };
15227
- /** @description The call is malformed, or the two idempotency keys disagree. */
15292
+ /** @description The call is malformed, names no consumer for a boleto, or the two idempotency keys disagree. */
15228
15293
  400: {
15229
15294
  headers: {
15230
15295
  [name: string]: unknown;
@@ -15233,7 +15298,7 @@ export interface paths {
15233
15298
  "application/json": {
15234
15299
  error: {
15235
15300
  /** @enum {string} */
15236
- code: "charge_idempotency_key_required" | "idempotency_key_conflict";
15301
+ code: "charge_idempotency_key_required" | "consumer_id_required" | "idempotency_key_conflict";
15237
15302
  message: string;
15238
15303
  details?: {
15239
15304
  [key: string]: unknown;
@@ -15301,7 +15366,9 @@ export interface paths {
15301
15366
  };
15302
15367
  /**
15303
15368
  * Read a charge
15304
- * @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.
15369
+ * @description Reads a charge this project issued. `chargeId` accepts EITHER the id the create returned (the issuer's charge transaction id) 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. A value that is one charge's id AND another charge's key is refused with `charge_reference_ambiguous` rather than answered for whichever came first; query by the charge id in that case. The Pix leg's own transaction id is not a reference here.
15370
+ *
15371
+ * **A charge the sandbox payer settled answers `status: "CONFIRMED"`** with `settlement: "confirmed"` and `local_status: "settled"` — see `status` on the response for why the issuer's own PENDING is not reported.
15305
15372
  *
15306
15373
  * **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.
15307
15374
  *
@@ -15313,7 +15380,9 @@ export interface paths {
15313
15380
  * |---|---|---|
15314
15381
  * | `charge_id_missing` | 400 | the call named no charge |
15315
15382
  * | `project_scope_missing` | 400 | the credential is not project-scoped, and a charge belongs to one project |
15383
+ * | `consumer_id_required` | 400 | a `boleto` create named no `consumer_id`, so there is no wallet for the receivable to settle into |
15316
15384
  * | `charge_not_found` | 404 | no charge under that id FOR THIS TENANT |
15385
+ * | `charge_reference_ambiguous` | 409 | the reference is one charge's id AND another's idempotency key; query by the charge id |
15317
15386
  * | `issuance_unconfirmed` | 409 | the key holds a reservation whose create never got an answer |
15318
15387
  * | `already_payment_notified` | 409 | the clearing house already notified a payment |
15319
15388
  * | `not_cancellable_in_this_state` | 409 | the issuer accepts a cancellation only in some states |
@@ -15342,7 +15411,11 @@ export interface paths {
15342
15411
  "application/json": {
15343
15412
  /** @description The issuer's charge id. Null while the issuance is unconfirmed. */
15344
15413
  id: string | null;
15345
- /** @description The provider's state as far as we know it, normalized. Forced to PROCESSING until the issuance is confirmed. */
15414
+ /**
15415
+ * @description The provider's state as far as we know it, normalized (`PROCESSING`, `PENDING`, `CONFIRMED`, `CANCELLED`, `EXPIRED`). Forced to PROCESSING until the issuance is confirmed.
15416
+ *
15417
+ * **A charge settled by the sandbox payer answers `CONFIRMED` here**, the same value a real payment leaves a live read answering — so a client that polls `status` sees the test payment exactly where it would see a live one. The issuer's homolog account never sees that money and keeps answering PENDING (EXPIRED after the due date); that answer stays in `raw` and is not reported as `status` or as a `status_conflict`, because for a test charge the fixture is the issuer's truth. `settlement: "confirmed"` and `local_status: "settled"` say the same thing from our side.
15418
+ */
15346
15419
  status: string;
15347
15420
  /** @description What CodeSpar recorded, which is a different question from `status`. */
15348
15421
  local_status: string;
@@ -15350,9 +15423,9 @@ export interface paths {
15350
15423
  status_conflict: boolean;
15351
15424
  method: string;
15352
15425
  currency: string;
15353
- /** @description In units. */
15426
+ /** @description In MAJOR units of `currency`: `12.5` is R$ 12,50. Always `amount_minor / 100`. */
15354
15427
  amount: number;
15355
- /** @description In minor units. */
15428
+ /** @description In minor units (centavos): `1250` is R$ 12,50. */
15356
15429
  amount_minor: number;
15357
15430
  due_date: string | null;
15358
15431
  /** @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`. */
@@ -15417,7 +15490,7 @@ export interface paths {
15417
15490
  };
15418
15491
  };
15419
15492
  };
15420
- /** @description The charge exists and is not readable in this state. */
15493
+ /** @description The charge exists and is not readable in this state, or the reference names two charges. */
15421
15494
  409: {
15422
15495
  headers: {
15423
15496
  [name: string]: unknown;
@@ -15426,7 +15499,7 @@ export interface paths {
15426
15499
  "application/json": {
15427
15500
  error: {
15428
15501
  /** @enum {string} */
15429
- code: "issuance_unconfirmed";
15502
+ code: "issuance_unconfirmed" | "charge_reference_ambiguous";
15430
15503
  message: string;
15431
15504
  details?: {
15432
15505
  [key: string]: unknown;
@@ -15490,7 +15563,9 @@ export interface paths {
15490
15563
  * |---|---|---|
15491
15564
  * | `charge_id_missing` | 400 | the call named no charge |
15492
15565
  * | `project_scope_missing` | 400 | the credential is not project-scoped, and a charge belongs to one project |
15566
+ * | `consumer_id_required` | 400 | a `boleto` create named no `consumer_id`, so there is no wallet for the receivable to settle into |
15493
15567
  * | `charge_not_found` | 404 | no charge under that id FOR THIS TENANT |
15568
+ * | `charge_reference_ambiguous` | 409 | the reference is one charge's id AND another's idempotency key; query by the charge id |
15494
15569
  * | `issuance_unconfirmed` | 409 | the key holds a reservation whose create never got an answer |
15495
15570
  * | `already_payment_notified` | 409 | the clearing house already notified a payment |
15496
15571
  * | `not_cancellable_in_this_state` | 409 | the issuer accepts a cancellation only in some states |
@@ -15519,7 +15594,11 @@ export interface paths {
15519
15594
  "application/json": {
15520
15595
  /** @description The issuer's charge id. Null while the issuance is unconfirmed. */
15521
15596
  id: string | null;
15522
- /** @description The provider's state as far as we know it, normalized. Forced to PROCESSING until the issuance is confirmed. */
15597
+ /**
15598
+ * @description The provider's state as far as we know it, normalized (`PROCESSING`, `PENDING`, `CONFIRMED`, `CANCELLED`, `EXPIRED`). Forced to PROCESSING until the issuance is confirmed.
15599
+ *
15600
+ * **A charge settled by the sandbox payer answers `CONFIRMED` here**, the same value a real payment leaves a live read answering — so a client that polls `status` sees the test payment exactly where it would see a live one. The issuer's homolog account never sees that money and keeps answering PENDING (EXPIRED after the due date); that answer stays in `raw` and is not reported as `status` or as a `status_conflict`, because for a test charge the fixture is the issuer's truth. `settlement: "confirmed"` and `local_status: "settled"` say the same thing from our side.
15601
+ */
15523
15602
  status: string;
15524
15603
  /** @description What CodeSpar recorded, which is a different question from `status`. */
15525
15604
  local_status: string;
@@ -15527,9 +15606,9 @@ export interface paths {
15527
15606
  status_conflict: boolean;
15528
15607
  method: string;
15529
15608
  currency: string;
15530
- /** @description In units. */
15609
+ /** @description In MAJOR units of `currency`: `12.5` is R$ 12,50. Always `amount_minor / 100`. */
15531
15610
  amount: number;
15532
- /** @description In minor units. */
15611
+ /** @description In minor units (centavos): `1250` is R$ 12,50. */
15533
15612
  amount_minor: number;
15534
15613
  due_date: string | null;
15535
15614
  /** @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`. */
@@ -15603,7 +15682,7 @@ export interface paths {
15603
15682
  "application/json": {
15604
15683
  error: {
15605
15684
  /** @enum {string} */
15606
- code: "issuance_unconfirmed" | "already_payment_notified" | "not_cancellable_in_this_state";
15685
+ code: "issuance_unconfirmed" | "already_payment_notified" | "not_cancellable_in_this_state" | "charge_reference_ambiguous";
15607
15686
  message: string;
15608
15687
  details?: {
15609
15688
  [key: string]: unknown;
@@ -15642,6 +15721,389 @@ export interface paths {
15642
15721
  patch?: never;
15643
15722
  trace?: never;
15644
15723
  };
15724
+ "/v1/test/charges/{chargeId}/pay": {
15725
+ parameters: {
15726
+ query?: never;
15727
+ header?: never;
15728
+ path?: never;
15729
+ cookie?: never;
15730
+ };
15731
+ get?: never;
15732
+ put?: never;
15733
+ /**
15734
+ * Pay a charge in the sandbox
15735
+ * @description Plays the DEBTOR of a test charge: settles it through the SAME path a Celcoin `charge-in` webhook takes (translate, publish `commerce.charge.paid`, reconcile, ledger `fund()` with the `pending -> settled` claim). It is not a status write, so the event fans out to your triggers exactly as a real payment would, and the ledger and receipt side effects are the ones production produces.
15736
+ *
15737
+ * **Test-mode only, fail-closed.** A live-environment key or project answers 403 `sandbox_pay_not_permitted` before the body is read or any query runs.
15738
+ *
15739
+ * **Nothing claims money moved.** The event payload, the ledger entry and the charge row all carry `simulated: true` and `settled_against: "sandbox_fixture"`; a real `charge-in` never carries either.
15740
+ *
15741
+ * **Idempotent.** The provider event id is the one the real delivery would carry, so a second pay dedupes at the event (no second trigger fire), the ledger dedupes on the charge, and a charge already `settled` answers its recorded state with `idempotent_replay: true` whatever amount the second call names.
15742
+ *
15743
+ * `chargeId` is the id `create` returned, or your own idempotency key, resolved under the caller's org and project: another tenant's charge is `charge_not_found`, never `forbidden`.
15744
+ */
15745
+ post: {
15746
+ parameters: {
15747
+ query?: never;
15748
+ header?: never;
15749
+ path: {
15750
+ chargeId: string;
15751
+ };
15752
+ cookie?: never;
15753
+ };
15754
+ requestBody?: {
15755
+ content: {
15756
+ "application/json": {
15757
+ /** @description Overrides the quoted amount, in minor units, to simulate a partial or divergent payment. The funding bridge credits what arrived and closes the charge, exactly as it does for a real `charge-in` that disagrees with the quote. Omitted: the quoted amount is paid in full. */
15758
+ amount_minor?: number;
15759
+ };
15760
+ };
15761
+ };
15762
+ responses: {
15763
+ /** @description OK */
15764
+ 200: {
15765
+ headers: {
15766
+ [name: string]: unknown;
15767
+ };
15768
+ content: {
15769
+ "application/json": {
15770
+ charge_id: string;
15771
+ /** @enum {string} */
15772
+ status: "paid";
15773
+ /** @description What CodeSpar recorded: `settled`. */
15774
+ local_status: string;
15775
+ currency: string;
15776
+ quoted_minor: number;
15777
+ /** @description What the ledger credited. */
15778
+ paid_minor: number;
15779
+ /** @enum {string} */
15780
+ payment: "full" | "partial" | "over";
15781
+ /** @description The leg the simulated debtor used. Always `Pix` today. */
15782
+ paid_via: string;
15783
+ wallet_id: string;
15784
+ /** @description The `fund` entry keyed `bolepix:<charge_id>`. Null only for a charge the other credit path settled. */
15785
+ ledger_entry_id: string | null;
15786
+ /** @description The one `commerce.charge.paid` this charge has. A second pay never mints another. */
15787
+ event: {
15788
+ id: string;
15789
+ /** @enum {string} */
15790
+ type: "commerce.charge.paid";
15791
+ } | null;
15792
+ /** @description True when a sandbox fixture settled it. Read off the records, never off the request. */
15793
+ simulated: boolean;
15794
+ /** @enum {string|null} */
15795
+ settled_against: "sandbox_fixture" | null;
15796
+ /**
15797
+ * @description Nothing moved anywhere, including at the provider's sandbox.
15798
+ * @enum {boolean}
15799
+ */
15800
+ money_moved: false;
15801
+ /** @description True when the charge was already settled and this call answered from the record. */
15802
+ idempotent_replay: boolean;
15803
+ };
15804
+ };
15805
+ };
15806
+ /** @description The body is outside the schema, or the credential names no project. */
15807
+ 400: {
15808
+ headers: {
15809
+ [name: string]: unknown;
15810
+ };
15811
+ content: {
15812
+ "application/json": {
15813
+ error: {
15814
+ /** @enum {string} */
15815
+ code: "invalid_body" | "project_scope_missing";
15816
+ message: string;
15817
+ details?: {
15818
+ [key: string]: unknown;
15819
+ };
15820
+ };
15821
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15822
+ request_id: string | null;
15823
+ };
15824
+ };
15825
+ };
15826
+ /** @description Not a test-environment key/project. Terminal for that credential. */
15827
+ 403: {
15828
+ headers: {
15829
+ [name: string]: unknown;
15830
+ };
15831
+ content: {
15832
+ "application/json": {
15833
+ error: {
15834
+ /** @enum {string} */
15835
+ code: "sandbox_pay_not_permitted";
15836
+ message: string;
15837
+ details?: {
15838
+ [key: string]: unknown;
15839
+ };
15840
+ };
15841
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15842
+ request_id: string | null;
15843
+ };
15844
+ };
15845
+ };
15846
+ /** @description No charge under that id for this tenant. */
15847
+ 404: {
15848
+ headers: {
15849
+ [name: string]: unknown;
15850
+ };
15851
+ content: {
15852
+ "application/json": {
15853
+ error: {
15854
+ /** @enum {string} */
15855
+ code: "charge_not_found";
15856
+ message: string;
15857
+ details?: {
15858
+ [key: string]: unknown;
15859
+ };
15860
+ };
15861
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15862
+ request_id: string | null;
15863
+ };
15864
+ };
15865
+ };
15866
+ /** @description The charge exists and cannot be paid: `issuance_unconfirmed` is a reservation whose create never got an answer; `charge_not_payable` is a charge already closed (expired or cancelled); `charge_reference_ambiguous` is a reference that is one charge's id and another's idempotency key — pay by the charge id. */
15867
+ 409: {
15868
+ headers: {
15869
+ [name: string]: unknown;
15870
+ };
15871
+ content: {
15872
+ "application/json": {
15873
+ error: {
15874
+ /** @enum {string} */
15875
+ code: "issuance_unconfirmed" | "charge_not_payable" | "charge_reference_ambiguous";
15876
+ message: string;
15877
+ details?: {
15878
+ [key: string]: unknown;
15879
+ };
15880
+ };
15881
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15882
+ request_id: string | null;
15883
+ };
15884
+ };
15885
+ };
15886
+ /** @description The payment event was published but the ledger credit did not land; the charge is still open. Retrying is safe — the event dedupes and the credit is keyed on the charge. */
15887
+ 502: {
15888
+ headers: {
15889
+ [name: string]: unknown;
15890
+ };
15891
+ content: {
15892
+ "application/json": {
15893
+ error: {
15894
+ /** @enum {string} */
15895
+ code: "sandbox_settlement_failed";
15896
+ message: string;
15897
+ details?: {
15898
+ [key: string]: unknown;
15899
+ };
15900
+ };
15901
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
15902
+ request_id: string | null;
15903
+ };
15904
+ };
15905
+ };
15906
+ };
15907
+ };
15908
+ delete?: never;
15909
+ options?: never;
15910
+ head?: never;
15911
+ patch?: never;
15912
+ trace?: never;
15913
+ };
15914
+ "/v1/charges/{chargeId}/sandbox/pay": {
15915
+ parameters: {
15916
+ query?: never;
15917
+ header?: never;
15918
+ path?: never;
15919
+ cookie?: never;
15920
+ };
15921
+ get?: never;
15922
+ put?: never;
15923
+ /**
15924
+ * Pay a charge in the sandbox (alias path)
15925
+ * @deprecated
15926
+ * @description Alias of `POST /v1/test/charges/{chargeId}/pay` (ent#979 contract: one handler, two paths, one scope). Same body, same answers.
15927
+ *
15928
+ * Plays the DEBTOR of a test charge: settles it through the SAME path a Celcoin `charge-in` webhook takes (translate, publish `commerce.charge.paid`, reconcile, ledger `fund()` with the `pending -> settled` claim). It is not a status write, so the event fans out to your triggers exactly as a real payment would, and the ledger and receipt side effects are the ones production produces.
15929
+ *
15930
+ * **Test-mode only, fail-closed.** A live-environment key or project answers 403 `sandbox_pay_not_permitted` before the body is read or any query runs.
15931
+ *
15932
+ * **Nothing claims money moved.** The event payload, the ledger entry and the charge row all carry `simulated: true` and `settled_against: "sandbox_fixture"`; a real `charge-in` never carries either.
15933
+ *
15934
+ * **Idempotent.** The provider event id is the one the real delivery would carry, so a second pay dedupes at the event (no second trigger fire), the ledger dedupes on the charge, and a charge already `settled` answers its recorded state with `idempotent_replay: true` whatever amount the second call names.
15935
+ *
15936
+ * `chargeId` is the id `create` returned, or your own idempotency key, resolved under the caller's org and project: another tenant's charge is `charge_not_found`, never `forbidden`.
15937
+ */
15938
+ post: {
15939
+ parameters: {
15940
+ query?: never;
15941
+ header?: never;
15942
+ path: {
15943
+ chargeId: string;
15944
+ };
15945
+ cookie?: never;
15946
+ };
15947
+ requestBody?: {
15948
+ content: {
15949
+ "application/json": {
15950
+ /** @description Overrides the quoted amount, in minor units, to simulate a partial or divergent payment. The funding bridge credits what arrived and closes the charge, exactly as it does for a real `charge-in` that disagrees with the quote. Omitted: the quoted amount is paid in full. */
15951
+ amount_minor?: number;
15952
+ };
15953
+ };
15954
+ };
15955
+ responses: {
15956
+ /** @description OK */
15957
+ 200: {
15958
+ headers: {
15959
+ [name: string]: unknown;
15960
+ };
15961
+ content: {
15962
+ "application/json": {
15963
+ charge_id: string;
15964
+ /** @enum {string} */
15965
+ status: "paid";
15966
+ /** @description What CodeSpar recorded: `settled`. */
15967
+ local_status: string;
15968
+ currency: string;
15969
+ quoted_minor: number;
15970
+ /** @description What the ledger credited. */
15971
+ paid_minor: number;
15972
+ /** @enum {string} */
15973
+ payment: "full" | "partial" | "over";
15974
+ /** @description The leg the simulated debtor used. Always `Pix` today. */
15975
+ paid_via: string;
15976
+ wallet_id: string;
15977
+ /** @description The `fund` entry keyed `bolepix:<charge_id>`. Null only for a charge the other credit path settled. */
15978
+ ledger_entry_id: string | null;
15979
+ /** @description The one `commerce.charge.paid` this charge has. A second pay never mints another. */
15980
+ event: {
15981
+ id: string;
15982
+ /** @enum {string} */
15983
+ type: "commerce.charge.paid";
15984
+ } | null;
15985
+ /** @description True when a sandbox fixture settled it. Read off the records, never off the request. */
15986
+ simulated: boolean;
15987
+ /** @enum {string|null} */
15988
+ settled_against: "sandbox_fixture" | null;
15989
+ /**
15990
+ * @description Nothing moved anywhere, including at the provider's sandbox.
15991
+ * @enum {boolean}
15992
+ */
15993
+ money_moved: false;
15994
+ /** @description True when the charge was already settled and this call answered from the record. */
15995
+ idempotent_replay: boolean;
15996
+ };
15997
+ };
15998
+ };
15999
+ /** @description The body is outside the schema, or the credential names no project. */
16000
+ 400: {
16001
+ headers: {
16002
+ [name: string]: unknown;
16003
+ };
16004
+ content: {
16005
+ "application/json": {
16006
+ error: {
16007
+ /** @enum {string} */
16008
+ code: "invalid_body" | "project_scope_missing";
16009
+ message: string;
16010
+ details?: {
16011
+ [key: string]: unknown;
16012
+ };
16013
+ };
16014
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
16015
+ request_id: string | null;
16016
+ };
16017
+ };
16018
+ };
16019
+ /** @description Not a test-environment key/project. Terminal for that credential. */
16020
+ 403: {
16021
+ headers: {
16022
+ [name: string]: unknown;
16023
+ };
16024
+ content: {
16025
+ "application/json": {
16026
+ error: {
16027
+ /** @enum {string} */
16028
+ code: "sandbox_pay_not_permitted";
16029
+ message: string;
16030
+ details?: {
16031
+ [key: string]: unknown;
16032
+ };
16033
+ };
16034
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
16035
+ request_id: string | null;
16036
+ };
16037
+ };
16038
+ };
16039
+ /** @description No charge under that id for this tenant. */
16040
+ 404: {
16041
+ headers: {
16042
+ [name: string]: unknown;
16043
+ };
16044
+ content: {
16045
+ "application/json": {
16046
+ error: {
16047
+ /** @enum {string} */
16048
+ code: "charge_not_found";
16049
+ message: string;
16050
+ details?: {
16051
+ [key: string]: unknown;
16052
+ };
16053
+ };
16054
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
16055
+ request_id: string | null;
16056
+ };
16057
+ };
16058
+ };
16059
+ /** @description The charge exists and cannot be paid: `issuance_unconfirmed` is a reservation whose create never got an answer; `charge_not_payable` is a charge already closed (expired or cancelled); `charge_reference_ambiguous` is a reference that is one charge's id and another's idempotency key — pay by the charge id. */
16060
+ 409: {
16061
+ headers: {
16062
+ [name: string]: unknown;
16063
+ };
16064
+ content: {
16065
+ "application/json": {
16066
+ error: {
16067
+ /** @enum {string} */
16068
+ code: "issuance_unconfirmed" | "charge_not_payable" | "charge_reference_ambiguous";
16069
+ message: string;
16070
+ details?: {
16071
+ [key: string]: unknown;
16072
+ };
16073
+ };
16074
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
16075
+ request_id: string | null;
16076
+ };
16077
+ };
16078
+ };
16079
+ /** @description The payment event was published but the ledger credit did not land; the charge is still open. Retrying is safe — the event dedupes and the credit is keyed on the charge. */
16080
+ 502: {
16081
+ headers: {
16082
+ [name: string]: unknown;
16083
+ };
16084
+ content: {
16085
+ "application/json": {
16086
+ error: {
16087
+ /** @enum {string} */
16088
+ code: "sandbox_settlement_failed";
16089
+ message: string;
16090
+ details?: {
16091
+ [key: string]: unknown;
16092
+ };
16093
+ };
16094
+ /** @description Echoes the `X-Request-Id` header when the request carried one. */
16095
+ request_id: string | null;
16096
+ };
16097
+ };
16098
+ };
16099
+ };
16100
+ };
16101
+ delete?: never;
16102
+ options?: never;
16103
+ head?: never;
16104
+ patch?: never;
16105
+ trace?: never;
16106
+ };
15645
16107
  "/v1/consumers/consents": {
15646
16108
  parameters: {
15647
16109
  query?: never;