@insurance-broker/api-client 5.7.0 → 5.9.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.
Files changed (2) hide show
  1. package/dist/schema.d.ts +75 -8
  2. package/package.json +1 -1
package/dist/schema.d.ts CHANGED
@@ -152,6 +152,14 @@ export interface paths {
152
152
  * The **currency is not a field** — it is the policy's own, so BR-008's pair travels from one source. The **payer is not a field** either: an invoice is addressed to whoever owns the policy.
153
153
  *
154
154
  * A draft has **no total**. The total is fixed once, at issue, from the lines.
155
+ *
156
+ * A replay answers the invoice **as it is now**, lines and status included: a draft that has since gained lines, been issued or been discarded is still the one invoice the key drafted, so its body can differ from the first response's, `status` included.
157
+ *
158
+ * **`idempotencyKey` is optional, and it is what makes a retry after a lost response safe.** Without one, every request writes a new invoice. With one, a repeat carrying a key already used **answers the original invoice with the same `201 Created` and the same `Location`** and writes nothing; a repeat carrying that key with a **different** policy is a `409` and writes nothing. The key is trimmed, at most 200 characters, blank is no key, and it belongs to this broker alone.
159
+ *
160
+ * **A key is honoured for 30 days from the moment the invoice was written, and then stops being honoured** — after that the same key is one this platform has never seen. Mint a fresh key per intended invoice; do not recycle one.
161
+ *
162
+ * **The key collision `409` is settled**: retrying it can only fail again, and it carries no `retryable` marker.
155
163
  */
156
164
  post: operations["DraftInvoice"];
157
165
  delete?: never;
@@ -236,6 +244,12 @@ export interface paths {
236
244
  * **It may not credit more than the invoice demanded**, counting what earlier credit notes already credit. Crediting past the demand is a payment out rather than a correction, and a refund is its own record (WRK-004, Phase 2).
237
245
  *
238
246
  * Refused against a **draft** invoice: a draft was never demanded of anybody, so it is discarded rather than credited.
247
+ *
248
+ * **A retried credit note without a key credits the customer twice**, so send one. **`idempotencyKey` is optional, and it is what makes a retry after a lost response safe.** Without one, every request writes a new credit note. With one, a repeat carrying a key already used **answers the original credit note with the same `201 Created` and the same `Location`** and writes nothing; a repeat carrying that key with a **different** invoice, reason or set of lines is a `409` and writes nothing. The key is trimmed, at most 200 characters, blank is no key, and it belongs to this broker alone.
249
+ *
250
+ * **A key is honoured for 30 days from the moment the credit note was written, and then stops being honoured** — after that the same key is one this platform has never seen. Mint a fresh key per intended credit note; do not recycle one.
251
+ *
252
+ * **The key collision `409` is settled**: retrying it can only fail again, and it carries no `retryable` marker.
239
253
  */
240
254
  post: operations["IssueCreditNote"];
241
255
  delete?: never;
@@ -309,7 +323,9 @@ export interface paths {
309
323
  *
310
324
  * The currency is **not** a field: it is the obligation's, held by a foreign key rather than by this handler. Nil is refused — a payment of nothing is nothing having arrived.
311
325
  *
312
- * **Name a payment method or type a source, exactly one** (#530). `paymentMethodId` is one of this broker's active payment methods: its code becomes the payment's `source`, and customers see the method's label. `source` alone is free text, as before, and customers see it as typed. Both, neither, a retired method or another broker's method are refused with `400` and nothing is recorded.
326
+ * **Name a payment method or type a source, exactly one** (#530). `paymentMethodId` is one of this broker's active payment methods: its code becomes the payment's `source`, and customers see the method's label. `source` alone is free text, as before, and customers see it as typed. Both, neither, a retired method or another broker's method are refused with `400` and nothing is recorded. A typed source containing a control character is refused with `400` on `Source` (#601).
327
+ *
328
+ * **Each `409` carries a `type`** (#593): `urn:brokerplatform:problem:payment-already-recorded` (the same money is already recorded; the problem names the payment), `urn:brokerplatform:problem:payment-reference-amount-conflict` (that reference is recorded for a different amount), `urn:brokerplatform:problem:obligation-concluded` (the charge is settled, cancelled or written off, so nothing can be paid against it; nothing is recorded), and the platform's `urn:brokerplatform:problem:concurrency-conflict` with `retryable: true`. Only the last is worth retrying.
313
329
  */
314
330
  post: operations["RecordPayment"];
315
331
  delete?: never;
@@ -353,13 +369,15 @@ export interface paths {
353
369
  * List the money this broker has recorded, most recent first
354
370
  * @description PAY-005. The payments this broker has recorded, ordered by when they posted, paged by cursor. A `customerId` or an `obligationId` narrows the list.
355
371
  *
372
+ * **`awaitingApproval=true` is the approver's queue** (#593): only payments nobody has approved yet, that have not been reversed, and that the caller did not record - so it holds what this caller can approve, because nobody may approve a payment they recorded. The caller is the session's subject, so another approver's queue holds the payments this caller recorded. A payment with no clean evidence is still listed. It combines with the other filters and pages the same way. `false` or absent is no filter. A reversed payment is not in the queue, because the money it records did not arrive.
373
+ *
356
374
  * **There is no `asOf` here, unlike `GET /obligations`.** Nothing in this list's predicate reads the clock - a payment posted at an instant the row records - so a member reporting when the page was measured would read as a freshness guarantee while guaranteeing nothing.
357
375
  *
358
376
  * **A reversed payment stays on the list** and carries `reversed: true`. Money that arrived and was sent back is a fact a reconciliation has to see, and a reversal is its own record rather than an edit to this one (ADR-0042 section 8).
359
377
  *
360
378
  * **Rows carry no subject identifiers.** Who recorded a payment and who approved it is the separation-of-duties record and it is on the payment itself, so a page-sized read cannot enumerate a broker's finance staff.
361
379
  *
362
- * **`customerId` and `obligationId` are filters and never authorisation.** The broker whose payments these are comes from the session.
380
+ * **`customerId`, `obligationId` and `awaitingApproval` are filters and never authorisation.** The broker whose payments these are comes from the session.
363
381
  */
364
382
  get: operations["ListPayments"];
365
383
  put?: never;
@@ -528,6 +546,8 @@ export interface paths {
528
546
  * **The type is taken from the file's own bytes, never from the part header.** A part declaring one thing and holding another is refused rather than believed.
529
547
  *
530
548
  * **A payment cannot be approved until at least one of its files is `Clean`**, which is the other half of PAY-003 and the reason this route exists.
549
+ *
550
+ * **A reversed payment takes no evidence** (#593): the money it records did not arrive, so there is nothing left to approve. The answer is `409` `urn:brokerplatform:problem:payment-already-reversed`, the type reversing it again answers, and it is not retryable. The body is not read.
531
551
  */
532
552
  post: operations["UploadPaymentEvidence"];
533
553
  delete?: never;
@@ -562,6 +582,12 @@ export interface paths {
562
582
  * **One currency per statement.** A charge carries its own currency, and a balance in two of them is not a number. A customer owing in two currencies gets two statements.
563
583
  *
564
584
  * **Nothing about money is stored on the row.** There is no balance column: every figure is derived from the obligations and payments the statement renders, bounded by its period and by the instant it was produced.
585
+ *
586
+ * **`idempotencyKey` is optional, and it is what makes a retry after a lost response safe.** Without one, every request produces a statement. With one, a repeat carrying a key already used **answers the original statement with the same `201 Created` and the same `Location`** and produces nothing; a repeat carrying that key with a **different** customer, currency or period is a `409` and produces nothing. The key is trimmed, at most 200 characters, blank is no key, and it belongs to this broker alone.
587
+ *
588
+ * **A key is honoured for 30 days from the moment the statement was produced, and then stops being honoured** — after that the same key is one this platform has never seen. Mint a fresh key per intended statement; do not recycle one.
589
+ *
590
+ * **The key collision `409` is settled**: retrying it can only fail again, and it carries no `retryable` marker.
565
591
  */
566
592
  post: operations["ProduceStatement"];
567
593
  delete?: never;
@@ -897,7 +923,9 @@ export interface paths {
897
923
  *
898
924
  * **A mapping can be undone** with `POST /payment-methods/{id}/source-mappings/removal`, or pointed at another method with `POST /payment-methods/{id}/source-mappings/correction` (#588). A payment with this source that names this method through a mapping not marked as one (made by an API instance from before #588) is marked by this request, so it can then be corrected; it is counted in `alreadyMapped`.
899
925
  *
900
- * A retired method is `409`. A statement already produced keeps the wording it was produced with. A `409` can also be the platform's concurrency conflict, with `retryable: true`, when another write changed one of the payments while it was being mapped.
926
+ * **`skipped` lists payments only when the caller also holds `billing.payments.read`** (#602). Without it, `skipped` is empty and `skippedCount` still says how many were skipped: the entries name payments and their references, which is payment data. So **a `skippedCount` above zero with an empty `skipped` means the skipped payments are not shown to this caller**, not that the list was lost; with `billing.payments.read`, `skipped` is never empty while `skippedCount` is above zero.
927
+ *
928
+ * A retired method is `409` `urn:brokerplatform:problem:payment-method-retired`, which is not retryable: choose an active method. A statement already produced keeps the wording it was produced with. A `409` can also be the platform's concurrency conflict, `urn:brokerplatform:problem:concurrency-conflict` with `retryable: true`: another write changed one of the payments while it was being mapped, or a payment was recorded against the method under one of these payments' references while the mapping ran. Nothing was mapped; send it again, and a retry lists any payment it would now duplicate as skipped.
901
929
  */
902
930
  post: operations["MapFreeTextPaymentSource"];
903
931
  delete?: never;
@@ -943,7 +971,7 @@ export interface paths {
943
971
  * Correct a mapping: say the payments with a free-text source came through another method
944
972
  * @description #588. Every payment of this broker whose `source` is exactly the given text and that **a mapping** gave this method is given `paymentMethodId` instead, in one step. Customers then see that method's label. No amount, source or reference changes, and a payment recorded against this method is never moved (counted in `recordedAgainstMethod`). A payment mapped by an API instance from before #588 is counted in `notYetCorrectable` and left alone until the source is mapped to this method again.
945
973
  *
946
- * `paymentMethodId` must be another active method of this broker: the same method, an unknown or another broker's method is `400` on `PaymentMethodId`, and a retired one is `409`. The method in the route may be retired.
974
+ * `paymentMethodId` must be another active method of this broker: the same method, an unknown or another broker's method is `400` on `PaymentMethodId`, and a retired one is `409` `urn:brokerplatform:problem:payment-method-retired`, which is not retryable. The method in the route may be retired.
947
975
  *
948
976
  * **All or nothing.** If the target method already holds the reference of any of the payments (a payment recorded against it, one mapped to it, or a free-text payment typed exactly as its code), nothing is moved and the answer is `409` `urn:brokerplatform:problem:payment-source-remap-collision`, which is not retryable, with `collisionCount`. **`collisions` is present only when the caller also holds `billing.payments.read`**: up to 200 entries naming each payment, its reference and the payment holding it. Undo the mapping instead and map the source to the target: the mapping maps the rest and lists those it skips.
949
977
  *
@@ -7219,6 +7247,7 @@ export interface components {
7219
7247
  DraftInvoiceRequest: {
7220
7248
  /** Format: uuid */
7221
7249
  policyId: string;
7250
+ idempotencyKey?: null | string;
7222
7251
  };
7223
7252
  EmergencyContactDetailsResponse: {
7224
7253
  providerName: string;
@@ -7820,6 +7849,7 @@ export interface components {
7820
7849
  IssueCreditNoteRequest: {
7821
7850
  reason: string;
7822
7851
  lines: components["schemas"]["CreditNoteLineRequest"][];
7852
+ idempotencyKey?: null | string;
7823
7853
  };
7824
7854
  IssuedCustomerInvitationResponse: {
7825
7855
  /** Format: uuid */
@@ -8192,10 +8222,12 @@ export interface components {
8192
8222
  /** Format: double */
8193
8223
  existingAmount: null | number | string;
8194
8224
  };
8225
+ /** @enum {string} */
8226
+ PaymentEventKind: "Recorded" | "DuplicateRefused" | "ConflictingAmountRefused" | "EvidenceAttached" | "Approved" | "Reversed";
8195
8227
  PaymentEventResponse: {
8196
8228
  /** Format: uuid */
8197
8229
  id: string;
8198
- kind: string;
8230
+ kind: components["schemas"]["PaymentEventKind"];
8199
8231
  /** Format: date-time */
8200
8232
  occurredAtUtc: string;
8201
8233
  actorSubjectId: string;
@@ -8215,7 +8247,7 @@ export interface components {
8215
8247
  /** Format: date-time */
8216
8248
  uploadedAtUtc: string;
8217
8249
  uploadedBySubjectId: string;
8218
- scanVerdict: string;
8250
+ scanVerdict: components["schemas"]["ScanVerdict"];
8219
8251
  /** Format: date-time */
8220
8252
  scannedAtUtc: null | string;
8221
8253
  };
@@ -8266,7 +8298,7 @@ export interface components {
8266
8298
  currency: string;
8267
8299
  source: string;
8268
8300
  externalReference: string;
8269
- status: string;
8301
+ status: components["schemas"]["PaymentStatus"];
8270
8302
  recordedBySubjectId: string;
8271
8303
  /** Format: date-time */
8272
8304
  postedAtUtc: string;
@@ -8275,6 +8307,7 @@ export interface components {
8275
8307
  approvedAtUtc: null | string;
8276
8308
  /** Format: uuid */
8277
8309
  paymentMethodId: null | string;
8310
+ paymentMethodWasMapped: boolean;
8278
8311
  };
8279
8312
  PaymentReversalResponse: {
8280
8313
  /** Format: uuid */
@@ -8327,6 +8360,8 @@ export interface components {
8327
8360
  /** Format: int32 */
8328
8361
  notYetCorrectable: number;
8329
8362
  };
8363
+ /** @enum {string} */
8364
+ PaymentStatus: "Posted";
8330
8365
  PaymentSummaryResponse: {
8331
8366
  /** Format: uuid */
8332
8367
  id: string;
@@ -8339,7 +8374,7 @@ export interface components {
8339
8374
  currency: string;
8340
8375
  source: string;
8341
8376
  externalReference: string;
8342
- status: string;
8377
+ status: components["schemas"]["PaymentStatus"];
8343
8378
  /** Format: date-time */
8344
8379
  postedAtUtc: string;
8345
8380
  /** Format: date-time */
@@ -8347,6 +8382,7 @@ export interface components {
8347
8382
  reversed: boolean;
8348
8383
  /** Format: uuid */
8349
8384
  paymentMethodId: null | string;
8385
+ paymentMethodWasMapped: boolean;
8350
8386
  };
8351
8387
  PlacedMemberResponse: {
8352
8388
  /** Format: uuid */
@@ -8608,6 +8644,7 @@ export interface components {
8608
8644
  periodStart: string;
8609
8645
  /** Format: date */
8610
8646
  periodEnd: string;
8647
+ idempotencyKey?: null | string;
8611
8648
  };
8612
8649
  ProductCategoryResponse: {
8613
8650
  /** Format: uuid */
@@ -9253,6 +9290,8 @@ export interface components {
9253
9290
  email: null | string;
9254
9291
  phone: null | string;
9255
9292
  };
9293
+ /** @enum {string} */
9294
+ ScanVerdict: "Quarantined" | "Clean" | "Infected" | "Unscannable";
9256
9295
  ServiceLocationResponse: {
9257
9296
  /** Format: uuid */
9258
9297
  id: string;
@@ -10133,6 +10172,15 @@ export interface operations {
10133
10172
  "application/problem+json": components["schemas"]["HttpValidationProblemDetails"];
10134
10173
  };
10135
10174
  };
10175
+ /** @description Conflict. A type of urn:brokerplatform:problem:concurrency-conflict means someone else changed the record first and nothing was written: read it again and decide again. Any other type is a conflict this operation decided itself, and retrying it unchanged will not help. */
10176
+ 409: {
10177
+ headers: {
10178
+ [name: string]: unknown;
10179
+ };
10180
+ content: {
10181
+ "application/problem+json": components["schemas"]["ConcurrencyConflictProblem"] | components["schemas"]["ProblemDetails"];
10182
+ };
10183
+ };
10136
10184
  };
10137
10185
  };
10138
10186
  AddInvoiceLine: {
@@ -10456,6 +10504,7 @@ export interface operations {
10456
10504
  query?: {
10457
10505
  customerId?: string;
10458
10506
  obligationId?: string;
10507
+ awaitingApproval?: boolean;
10459
10508
  cursor?: string;
10460
10509
  limit?: number | string;
10461
10510
  };
@@ -10769,6 +10818,15 @@ export interface operations {
10769
10818
  };
10770
10819
  content?: never;
10771
10820
  };
10821
+ /** @description Conflict. A type of urn:brokerplatform:problem:concurrency-conflict means someone else changed the record first and nothing was written: read it again and decide again. Any other type is a conflict this operation decided itself, and retrying it unchanged will not help. */
10822
+ 409: {
10823
+ headers: {
10824
+ [name: string]: unknown;
10825
+ };
10826
+ content: {
10827
+ "application/problem+json": components["schemas"]["ConcurrencyConflictProblem"] | components["schemas"]["ProblemDetails"];
10828
+ };
10829
+ };
10772
10830
  /** @description Payload Too Large */
10773
10831
  413: {
10774
10832
  headers: {
@@ -10844,6 +10902,15 @@ export interface operations {
10844
10902
  "application/problem+json": components["schemas"]["HttpValidationProblemDetails"];
10845
10903
  };
10846
10904
  };
10905
+ /** @description Conflict. A type of urn:brokerplatform:problem:concurrency-conflict means someone else changed the record first and nothing was written: read it again and decide again. Any other type is a conflict this operation decided itself, and retrying it unchanged will not help. */
10906
+ 409: {
10907
+ headers: {
10908
+ [name: string]: unknown;
10909
+ };
10910
+ content: {
10911
+ "application/problem+json": components["schemas"]["ConcurrencyConflictProblem"] | components["schemas"]["ProblemDetails"];
10912
+ };
10913
+ };
10847
10914
  /** @description Too Many Requests (ADR-0050). This operation renders, produces or exports, and the caller's own budget for such work, or their organisation's, is spent. Nothing was done: no document, statement, export or receipt exists for this request. Wait the number of seconds in Retry-After (also in retryAfterSeconds) before trying again. */
10848
10915
  429: {
10849
10916
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insurance-broker/api-client",
3
- "version": "5.7.0",
3
+ "version": "5.9.0",
4
4
  "description": "Generated TypeScript client for the Insurance Broker Platform API. Do not edit by hand: regenerate with scripts/update-api-contract.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,