@insurance-broker/api-client 5.6.0 → 5.8.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 +121 -1
  2. package/package.json +1 -1
package/dist/schema.d.ts CHANGED
@@ -66,6 +66,8 @@ export interface paths {
66
66
  * @description PAY-002. Another broker's obligation and another customer's are invisible here rather than refused: the tenant and owner query filters remove them before the read runs, so all three cases answer the same `404` (ADR-0008, ADR-0030).
67
67
  *
68
68
  * There is **no overdue field**. Whether an obligation is overdue is a comparison between its due date and the clock, and step 9.10's lists compute it at read time and return the day they measured against — ADR-0035 §4's rule, which forbids storing a status a date comparison answers.
69
+ *
70
+ * **`paid` and `balance` are computed as the response is written** (#595), by the same rule as the list. `paid` is read a moment after the charge itself, so a payment that lands in between can show in `paid` and `balance` before `status` reflects it; read again and the two agree. `balance` is not always `amount` less `paid`: a cancelled charge is owed nothing, so money paid against one leaves the customer in credit, and a written-off charge is owed what actually arrived and no more.
69
71
  */
70
72
  get: operations["GetObligation"];
71
73
  put?: never;
@@ -133,7 +135,15 @@ export interface paths {
133
135
  path?: never;
134
136
  cookie?: never;
135
137
  };
136
- get?: never;
138
+ /**
139
+ * List what this broker has invoiced, newest first
140
+ * @description ADR-0042 section 8, ADR-0031. Every invoice this broker has drafted — drafts, issued invoices and discarded drafts — **most recently drafted first**, ordered by `draftedAtUtc` and then `id`, both descending, and paged by cursor. The drafting instant is the key because it never changes: an invoice keeps its place in the walk when it is issued or discarded.
141
+ *
142
+ * `customerId`, `policyId` and `status` (`Draft`, `Issued`, `Discarded`) narrow the list and combine. **None of them is authorisation**: the broker whose invoices these are comes from the session, and naming another broker's customer selects nothing rather than refusing.
143
+ *
144
+ * A row carries no lines; `GET /invoices/{id}` returns one invoice with its lines. There is no total and no count: `nextCursor` is null at the end of the walk (ADR-0031 section 4). A cursor this endpoint did not issue is a `400`.
145
+ */
146
+ get: operations["ListInvoices"];
137
147
  put?: never;
138
148
  /**
139
149
  * Open a draft invoice against a policy
@@ -142,6 +152,14 @@ export interface paths {
142
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.
143
153
  *
144
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.
145
163
  */
146
164
  post: operations["DraftInvoice"];
147
165
  delete?: never;
@@ -226,6 +244,12 @@ export interface paths {
226
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).
227
245
  *
228
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.
229
253
  */
230
254
  post: operations["IssueCreditNote"];
231
255
  delete?: never;
@@ -552,6 +576,12 @@ export interface paths {
552
576
  * **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.
553
577
  *
554
578
  * **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.
579
+ *
580
+ * **`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.
581
+ *
582
+ * **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.
583
+ *
584
+ * **The key collision `409` is settled**: retrying it can only fail again, and it carries no `retryable` marker.
555
585
  */
556
586
  post: operations["ProduceStatement"];
557
587
  delete?: never;
@@ -7209,6 +7239,7 @@ export interface components {
7209
7239
  DraftInvoiceRequest: {
7210
7240
  /** Format: uuid */
7211
7241
  policyId: string;
7242
+ idempotencyKey?: null | string;
7212
7243
  };
7213
7244
  EmergencyContactDetailsResponse: {
7214
7245
  providerName: string;
@@ -7750,6 +7781,10 @@ export interface components {
7750
7781
  amount: number | string;
7751
7782
  currency: string;
7752
7783
  };
7784
+ InvoicePage: {
7785
+ items: components["schemas"]["InvoiceSummaryResponse"][];
7786
+ nextCursor: null | string;
7787
+ };
7753
7788
  InvoiceResponse: {
7754
7789
  /** Format: uuid */
7755
7790
  id: string;
@@ -7777,9 +7812,36 @@ export interface components {
7777
7812
  retentionAnchorAtUtc: null | string;
7778
7813
  lines: components["schemas"]["InvoiceLineResponse"][];
7779
7814
  };
7815
+ InvoiceSummaryResponse: {
7816
+ /** Format: uuid */
7817
+ id: string;
7818
+ /** Format: uuid */
7819
+ customerId: string;
7820
+ /** Format: uuid */
7821
+ policyId: string;
7822
+ /** Format: uuid */
7823
+ productId: string;
7824
+ /** Format: double */
7825
+ premiumAmount: number | string;
7826
+ currency: string;
7827
+ /** Format: date */
7828
+ coverStart: null | string;
7829
+ /** Format: date */
7830
+ coverEnd: null | string;
7831
+ status: string;
7832
+ /** Format: date-time */
7833
+ draftedAtUtc: string;
7834
+ /** Format: date-time */
7835
+ issuedAtUtc: null | string;
7836
+ /** Format: double */
7837
+ totalAmount: null | number | string;
7838
+ /** Format: date-time */
7839
+ retentionAnchorAtUtc: null | string;
7840
+ };
7780
7841
  IssueCreditNoteRequest: {
7781
7842
  reason: string;
7782
7843
  lines: components["schemas"]["CreditNoteLineRequest"][];
7844
+ idempotencyKey?: null | string;
7783
7845
  };
7784
7846
  IssuedCustomerInvitationResponse: {
7785
7847
  /** Format: uuid */
@@ -7965,6 +8027,10 @@ export interface components {
7965
8027
  productId: string;
7966
8028
  /** Format: double */
7967
8029
  amount: number | string;
8030
+ /** Format: double */
8031
+ paid: number | string;
8032
+ /** Format: double */
8033
+ balance: number | string;
7968
8034
  currency: string;
7969
8035
  /** Format: date */
7970
8036
  dueOn: string;
@@ -8564,6 +8630,7 @@ export interface components {
8564
8630
  periodStart: string;
8565
8631
  /** Format: date */
8566
8632
  periodEnd: string;
8633
+ idempotencyKey?: null | string;
8567
8634
  };
8568
8635
  ProductCategoryResponse: {
8569
8636
  /** Format: uuid */
@@ -10023,6 +10090,41 @@ export interface operations {
10023
10090
  };
10024
10091
  };
10025
10092
  };
10093
+ ListInvoices: {
10094
+ parameters: {
10095
+ query?: {
10096
+ customerId?: string;
10097
+ policyId?: string;
10098
+ status?: string;
10099
+ cursor?: string;
10100
+ limit?: number | string;
10101
+ };
10102
+ header?: never;
10103
+ path?: never;
10104
+ cookie?: never;
10105
+ };
10106
+ requestBody?: never;
10107
+ responses: {
10108
+ /** @description OK */
10109
+ 200: {
10110
+ headers: {
10111
+ [name: string]: unknown;
10112
+ };
10113
+ content: {
10114
+ "application/json": components["schemas"]["InvoicePage"];
10115
+ };
10116
+ };
10117
+ /** @description Bad Request */
10118
+ 400: {
10119
+ headers: {
10120
+ [name: string]: unknown;
10121
+ };
10122
+ content: {
10123
+ "application/problem+json": components["schemas"]["HttpValidationProblemDetails"];
10124
+ };
10125
+ };
10126
+ };
10127
+ };
10026
10128
  DraftInvoice: {
10027
10129
  parameters: {
10028
10130
  query?: never;
@@ -10054,6 +10156,15 @@ export interface operations {
10054
10156
  "application/problem+json": components["schemas"]["HttpValidationProblemDetails"];
10055
10157
  };
10056
10158
  };
10159
+ /** @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. */
10160
+ 409: {
10161
+ headers: {
10162
+ [name: string]: unknown;
10163
+ };
10164
+ content: {
10165
+ "application/problem+json": components["schemas"]["ConcurrencyConflictProblem"] | components["schemas"]["ProblemDetails"];
10166
+ };
10167
+ };
10057
10168
  };
10058
10169
  };
10059
10170
  AddInvoiceLine: {
@@ -10765,6 +10876,15 @@ export interface operations {
10765
10876
  "application/problem+json": components["schemas"]["HttpValidationProblemDetails"];
10766
10877
  };
10767
10878
  };
10879
+ /** @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. */
10880
+ 409: {
10881
+ headers: {
10882
+ [name: string]: unknown;
10883
+ };
10884
+ content: {
10885
+ "application/problem+json": components["schemas"]["ConcurrencyConflictProblem"] | components["schemas"]["ProblemDetails"];
10886
+ };
10887
+ };
10768
10888
  /** @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. */
10769
10889
  429: {
10770
10890
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insurance-broker/api-client",
3
- "version": "5.6.0",
3
+ "version": "5.8.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,