@takeal/cusfront-sdk 0.6.0 → 0.6.1

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 (37) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +166 -1
  3. package/dist/{cards-Ba1wZttb.d.ts → cards-CF3-He2x.d.ts} +144 -20
  4. package/dist/{cards-B_aNY35J.d.cts → cards-qfHz6xZY.d.cts} +144 -20
  5. package/dist/{deposits-DScyT_D9.d.ts → deposits-B2LBe2k1.d.ts} +71 -8
  6. package/dist/{deposits-BEc8U80M.d.cts → deposits-ZjT_btgi.d.cts} +71 -8
  7. package/dist/index.cjs +36 -9
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +6 -6
  10. package/dist/index.d.ts +6 -6
  11. package/dist/index.js +36 -9
  12. package/dist/index.js.map +1 -1
  13. package/dist/react/index.d.cts +2 -2
  14. package/dist/react/index.d.ts +2 -2
  15. package/dist/resources/cards.cjs +30 -6
  16. package/dist/resources/cards.cjs.map +1 -1
  17. package/dist/resources/cards.d.cts +1 -1
  18. package/dist/resources/cards.d.ts +1 -1
  19. package/dist/resources/cards.js +30 -6
  20. package/dist/resources/cards.js.map +1 -1
  21. package/dist/resources/deposits.cjs +4 -1
  22. package/dist/resources/deposits.cjs.map +1 -1
  23. package/dist/resources/deposits.d.cts +2 -2
  24. package/dist/resources/deposits.d.ts +2 -2
  25. package/dist/resources/deposits.js +4 -1
  26. package/dist/resources/deposits.js.map +1 -1
  27. package/dist/resources/funding-options.cjs.map +1 -1
  28. package/dist/resources/funding-options.d.cts +2 -2
  29. package/dist/resources/funding-options.d.ts +2 -2
  30. package/dist/resources/funding-options.js.map +1 -1
  31. package/dist/telegram.cjs +36 -9
  32. package/dist/telegram.cjs.map +1 -1
  33. package/dist/telegram.d.cts +2 -2
  34. package/dist/telegram.d.ts +2 -2
  35. package/dist/telegram.js +36 -9
  36. package/dist/telegram.js.map +1 -1
  37. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,45 @@ All notable changes to `@takeal/cusfront-sdk` are documented here. The format
4
4
  follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project
5
5
  adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.6.1] — 2026-10-12
8
+
9
+ Needs platform (TKL) 0.6.4 or newer: `SUPPORTED_MEISTER` is `>=0.6.4, <0.7.0`.
10
+ The card states, the SBP method and the priced quotes below exist from that
11
+ version on.
12
+
13
+ ### Added
14
+
15
+ - Card states `pending` (the issuer took the order and has not issued the
16
+ card yet) and `terminating` (closing, the balance comes back later), and
17
+ the fields that go with them on `Card`: `status_source` (`holder`,
18
+ `operator` or `provider`; a `provider` freeze is lifted through the
19
+ issuer's support, so the README says not to offer "unfreeze" then),
20
+ `card_form` (`virtual` or `physical`), `close_blocked`, `topups_pending`
21
+ and `topups_held`.
22
+ - Top-up statuses `stalled`, `returned` and `written_off` on `CardTopUp`
23
+ (`CardTopUpStatus`), and what a `pending` top-up means for the balance.
24
+ - `cards.reveal()` may return `reveal_url` instead of the numbers, for
25
+ issuers that show them on a page of their own; `pan` and `cvv` are empty
26
+ then. The README shows the frame. The response also carries the
27
+ `cardholder` the issuer knows.
28
+ - `cards.setPin(id, { pin })` for physical cards (`POST /me/cards/{id}/pin`).
29
+ - README: the `card_otp` notification's `purpose` (`payment` or `wallet`), and
30
+ a table of the error codes the card screens meet, with `provider_unavailable`
31
+ explained as "the action failed, the card itself keeps paying".
32
+
33
+ - Deposits by SBP: the `sbp` method, `fundingOptions()` with `method_terms`
34
+ per method (currency, fee and its kind, quote lifetime, limits),
35
+ `deposits.quote({ amount, currency, connectorSlug, method })` priced on
36
+ the method's terms with `fee_kind` and `fee_bps` in the answer, the
37
+ deposit status `expired` and `expires_at` on the deposit. The README walks
38
+ through a rouble top-up and how to show the rate.
39
+
40
+ ### Changed
41
+
42
+ - Types regenerated from the platform API that carries the above.
43
+ - `SUPPORTED_MEISTER` narrowed to `>=0.6.4, <0.7.0`; `client.ready()` warns
44
+ on an older deployment.
45
+
7
46
  ## [0.6.0] — 2026-10-04
8
47
 
9
48
  ### Changed
package/README.md CHANGED
@@ -125,6 +125,52 @@ product are rejected with a 400 whose `code` says which check failed
125
125
  Calls without `productId` keep working as before: `type` is then required and
126
126
  the deployment picks the product.
127
127
 
128
+ ### Card states
129
+
130
+ A card is not always ready the moment it comes back from `create()`:
131
+
132
+ ```ts
133
+ switch (card.status) {
134
+ case "pending":
135
+ // The issuer took the order and has not issued the card yet. The price is
136
+ // paid. Show "being issued", no numbers, no actions; the card turns
137
+ // `active` by itself, or `failed` with the price back on the wallet.
138
+ break;
139
+ case "frozen":
140
+ // Who froze it decides what the user can do. The issuer's own freeze
141
+ // (a risk check, a lost-card report) is not the holder's to undo.
142
+ if (card.status_source === "provider") {
143
+ hideUnfreezeButton();
144
+ say("The card was frozen by the issuer. The freeze is lifted through the issuer's support.");
145
+ } else {
146
+ showUnfreezeButton(); // cards.unfreeze(card.id)
147
+ }
148
+ break;
149
+ case "terminating":
150
+ // Closing. The balance comes back to the wallet when the issuer is done.
151
+ break;
152
+ }
153
+
154
+ if (card.close_blocked === "first_purchase_required") {
155
+ // Hide "close": this card closes after its first purchase.
156
+ }
157
+ if (card.topups_pending) {
158
+ // Money on its way to the card, in the card's currency. Show it next to the
159
+ // balance; the balance itself has not moved yet.
160
+ }
161
+ if (card.topups_held) {
162
+ // A top-up waited too long. The money is safe and support settles it; say
163
+ // so instead of offering a retry.
164
+ }
165
+ if (card.card_form === "physical") {
166
+ // Plastic: the numbers are on the card, and it takes a PIN (see below).
167
+ }
168
+ ```
169
+
170
+ `status_source` is `holder`, `operator` or `provider`, or `null` for a card
171
+ whose status never changed. Trying to unfreeze a card the issuer froze answers
172
+ 409 `card_locked`.
173
+
128
174
  `resolveAssetUrl(baseUrl, url)` is the same helper as a standalone function,
129
175
  exported from the package root, for code that has no client at hand.
130
176
 
@@ -157,6 +203,15 @@ the wallet (402), amount outside the floor or cap (400), card frozen or still
157
203
  being issued (409), provider declined or unreachable (502/503, the wallet is
158
204
  untouched).
159
205
 
206
+ Some issuers load a card a little later than they take the order. Then
207
+ `topup.status` comes back as `pending`: the wallet has paid, `card_balance`
208
+ has not moved, and the amount shows in `card.topups_pending`. It turns
209
+ `confirmed` on its own (the user gets a `card_topup` notification), or
210
+ `failed` with the money back on the wallet. A top-up that waits longer than
211
+ the deployment allows is `stalled` and shows in `card.topups_held`: support
212
+ finishes it, either back to the wallet (`returned`) or, when the issuer kept
213
+ the money, closed with a reason (`written_off`).
214
+
160
215
  ## Topping up a card directly
161
216
 
162
217
  Some deployments let a top-up go straight onto a card, past the wallet, and
@@ -165,7 +220,7 @@ some have no wallet at all. Ask the API instead of hard-coding it:
165
220
  ```ts
166
221
  const options = await client.fundingOptions.list();
167
222
  // [{ slug, mode: "wallet" | "spool" | "mixed", targets: ["wallet", "card"],
168
- // methods: ["card", "crypto"], issue_card: true }]
223
+ // methods: ["card", "crypto"], issue_card: true, method_terms: [...] }]
169
224
  const direct = options.find((o) => o.targets.includes("card"));
170
225
  ```
171
226
 
@@ -188,6 +243,67 @@ Paying in another currency than the card's needs a quote in the card's
188
243
  currency first: `deposits.quote({ amount, currency, card_id })`, or
189
244
  `target_currency` for a card that doesn't exist yet.
190
245
 
246
+ ## Topping up by SBP
247
+
248
+ A rouble top-up through Russia's instant payments goes like this: the user
249
+ picks SBP, sees the rate, pays on the bank's page, comes back, and the wallet
250
+ is bigger. The API prices each way of paying on its own terms, so read them
251
+ before drawing the form.
252
+
253
+ ```ts
254
+ // 1. The connector that takes SBP, and what it costs. `method_terms` has
255
+ // one entry per method: the currency to ask for, the fee and its kind,
256
+ // how long a quote lives, the floor, the cap and the day's limit.
257
+ const options = await client.fundingOptions.list();
258
+ const funder = options.find((o) => o.methods.includes("sbp"))!;
259
+ const sbp = funder.method_terms.find((m) => m.method === "sbp")!;
260
+ // sbp.source_currency → "RUB"; sbp.fee_kind → "markup"; sbp.fee_bps → 2000;
261
+ // sbp.quote_ttl_seconds → 300; sbp.min_amount, sbp.max_amount, sbp.daily_limit_per_user
262
+
263
+ // 2. The user types roubles. The quote locks the rate for quote_ttl_seconds.
264
+ const quote = await client.deposits.quote({
265
+ amount: "1000",
266
+ currency: "RUB",
267
+ connectorSlug: funder.slug,
268
+ method: "sbp",
269
+ });
270
+ // quote.credited_amount → "10.41" USD at a bank rate of 80 ₽ and a 20 % markup.
271
+
272
+ // 3. What to show. With `fee_kind === "markup"` the fee sits in the rate: show
273
+ // the rate and the amount credited, no fee line. The rate in the form
274
+ // people know, roubles per unit of the wallet currency:
275
+ const perUnit = Number(quote.source_amount) / Number(quote.credited_amount); // 96.06 ₽ per $
276
+ show(`${quote.credited_amount} ${quote.credited_currency} at ${perUnit.toFixed(2)} ₽/$, until ${quote.expires_at}`);
277
+ // If the user types the wallet amount instead, work the roubles out on the
278
+ // client from the same rate and quote that: roubles = wanted × perUnit,
279
+ // rounded up to the kopeck, then `quote()` again with that amount.
280
+ // With `fee_kind === "commission"` show the fee as its own line:
281
+ // commission = credited × fee_bps / 10000.
282
+
283
+ // 4. Pay. The deposit is a redirect: send the user to the bank's page.
284
+ const deposit = await client.deposits.initiate({
285
+ amount: quote.source_amount,
286
+ currency: "RUB",
287
+ method: "sbp",
288
+ funder_slug: funder.slug,
289
+ quote_id: quote.id,
290
+ metadata: { return_url: `${location.origin}/wallet?deposit=` },
291
+ idempotencyKey: crypto.randomUUID(),
292
+ });
293
+ location.href = deposit.redirect_url!;
294
+
295
+ // 5. Back from the bank: poll until the deposit settles, then redraw the
296
+ // balance. `expires_at` is when the deposit stops waiting for the payment.
297
+ const final = await client.deposits.get(deposit.id);
298
+ // final.status: "confirmed" → balance updated; "expired" → nobody paid in
299
+ // time, offer a new quote; "failed" → the bank refused, final.failure_reason says why.
300
+ ```
301
+
302
+ A deposit that expired and is paid after all is still credited, at the rate
303
+ of its quote, and turns `confirmed`. The amount outside the method's floor or
304
+ cap, or over the day's limit, is refused by `quote()` and `initiate()` with
305
+ 400 `deposit_limit` and a sentence for the user.
306
+
191
307
  The deposit comes back with `target: "card"` and a `card_load_status`. It is
192
308
  `pending` until the card provider has loaded the card, then `succeeded`. If
193
309
  the card can't take it, the deployment either puts the money on the wallet
@@ -198,6 +314,37 @@ it for support to finish (`card_load_status: "failed"`). Errors:
198
314
  `amount_too_small` (a new card's price plus a starting balance don't fit in
199
315
  the amount).
200
316
 
317
+ ## Card details and PIN
318
+
319
+ `cards.reveal(id)` returns the full card number and CVV to the signed-in user,
320
+ with the billing address the card is registered at and, when the platform
321
+ keeps one, the `cardholder` (name, phone, address) a checkout asks for. No
322
+ password or code is asked again; the API rate-limits and logs every call.
323
+ Keep the result in memory only and clear it after `expires_in_seconds`.
324
+
325
+ Some issuers do not hand out the numbers and show them on a page of their
326
+ own instead. Then `reveal_url` is set and `pan` and `cvv` are empty:
327
+
328
+ ```tsx
329
+ const r = await client.cards.reveal(card.id);
330
+ if (r.reveal_url) {
331
+ // The issuer's page. Open it at once: the address is short-lived and
332
+ // often good for one opening. Never store or log it.
333
+ return <iframe src={r.reveal_url} sandbox="allow-scripts allow-same-origin" title="Card details" />;
334
+ }
335
+ showNumbers(r.pan, r.cvv, r.expiry_month, r.expiry_year);
336
+ ```
337
+
338
+ A physical card takes a PIN from the user. Send it once; neither the SDK nor
339
+ the API keeps it, and the user gets a notification that it was set:
340
+
341
+ ```ts
342
+ await client.cards.setPin(card.id, { pin: "4321" }); // four to six digits
343
+ ```
344
+
345
+ 400 when the PIN is not four to six digits or the card is not active, 409
346
+ `provider_refused` when the issuer did not take it, 501 for a virtual card.
347
+
201
348
  ## Telegram Mini App
202
349
 
203
350
  Run inside a Telegram Mini App? Exchange the Telegram-signed `initData` for a
@@ -673,6 +820,13 @@ about the event, and `href`: a path inside your app to open on tap
673
820
  (`/cards/<id>`, `/deposits/<id>`, `/subscription`, `/settings/sessions`) or
674
821
  `null`. Route `href` through your own router; the SDK doesn't navigate.
675
822
 
823
+ A `card_otp` item carries a code the card issuer sent and could not deliver
824
+ itself; the user needs it right now. `data.purpose` says what for: `payment`
825
+ (a 3-D Secure purchase; `merchant_name`, `amount` and `currency` are there)
826
+ or `wallet` (adding the card to Apple Pay or Google Pay). Show the code large,
827
+ with a copy button and a countdown from `expires_in_minutes`; `isCardOtp(item)`
828
+ narrows the type.
829
+
676
830
  A small inbox screen:
677
831
 
678
832
  ```tsx
@@ -1063,6 +1217,17 @@ try {
1063
1217
  }
1064
1218
  ```
1065
1219
 
1220
+ Codes worth a wording of their own on the card screens:
1221
+
1222
+ | `e.code` | What happened | What to tell the user |
1223
+ |---|---|---|
1224
+ | `provider_unavailable` (503) | The card issuer did not answer. Nothing was moved. | Try again in a few minutes. The card itself keeps paying: only the action failed. |
1225
+ | `provider_declined` (502) | The issuer refused the move. Nothing was moved. | The issuer would not do it; the wallet is untouched. |
1226
+ | `provider_refused` (409) | The issuer did not take the PIN. | Try another PIN or later. |
1227
+ | `card_locked` (409) | Support holds the card, or the issuer froze it. | Only support can change this card. |
1228
+ | `not_supported` (501) | This issuer cannot do that (take money back off a card, reveal, PIN). | Hide the control. |
1229
+ | `insufficient_funds` (402) | The wallet holds less than that. | Top up the wallet first. |
1230
+
1066
1231
  ## Development
1067
1232
 
1068
1233
  ```sh
@@ -52,16 +52,12 @@ interface CustomerInfo {
52
52
  * POST /me/cards/{id}/unfreeze → unfreeze
53
53
  * POST /me/cards/{id}/transfer → transfer (to another of their cards)
54
54
  * POST /me/cards/{id}/terminate → terminate (one-way)
55
+ * POST /me/cards/{id}/reveal → reveal (the numbers, or a provider page)
56
+ * POST /me/cards/{id}/pin → setPin (physical cards)
55
57
  *
56
58
  * The lifecycle actions are ownership-gated server-side: a caller can only
57
59
  * freeze / unfreeze / terminate a card that belongs to them (else 404).
58
60
  *
59
- * ## What is intentionally NOT here
60
- *
61
- * Card-data reveal (PAN / CVV) is a separate, security-sensitive flow with its
62
- * own re-auth + rate-limit + audit contract and is intentionally
63
- * NOT part of this resource (tracked separately).
64
- *
65
61
  * Today only PREPAID is wired end-to-end; CREDIT and GIFT return 400 from
66
62
  * the Takeal API until their issuer flows land.
67
63
  */
@@ -70,11 +66,36 @@ type CardType = "credit" | "prepaid" | "gift";
70
66
  /**
71
67
  * Card lifecycle state.
72
68
  *
73
- * `pending_payment` is a transient state: the row exists but the
74
- * per-card issuance-fee debit has not yet succeeded; such cards have no
75
- * provider reference and no user-visible side effects.
69
+ * - `pending_payment`: the row exists but the issuance fee has not been
70
+ * paid yet; the provider has not been called and nothing is visible.
71
+ * - `pending`: the issuer accepted the order and has not issued the card
72
+ * yet. The price is charged. Show the card as "being issued" with no
73
+ * numbers; it becomes `active` on its own, or `failed` with the price
74
+ * back on the wallet. Some issuers take minutes, some a day.
75
+ * - `active`, `frozen`: the usual states. Read `status_source` before
76
+ * offering to unfreeze.
77
+ * - `terminating`: the holder (or the issuer) closed the card and the
78
+ * issuer has not finished: the balance comes back to the wallet when it
79
+ * does. Show it as closing; no actions apply.
80
+ * - `terminated`, `redeemed`, `failed`: final.
81
+ */
82
+ type CardStatus = "pending_payment" | "pending" | "active" | "frozen" | "terminating" | "terminated" | "redeemed" | "failed";
83
+ /**
84
+ * Who made the card's last status change. `provider` on a `frozen` card
85
+ * means the issuer froze it (a risk check, a lost-card report): the holder
86
+ * cannot unfreeze it, so do not offer the button; say the freeze is lifted
87
+ * through the issuer's support. `holder` and `operator` freezes are undone
88
+ * with `unfreeze()` as usual.
76
89
  */
77
- type CardStatus = "pending_payment" | "active" | "frozen" | "terminated" | "redeemed" | "failed";
90
+ type CardStatusSource = "holder" | "operator" | "provider";
91
+ /** `virtual` cards show their numbers in the app; `physical` cards are plastic and have a PIN. */
92
+ type CardForm = "virtual" | "physical";
93
+ /**
94
+ * Why `terminate()` is refused right now: `first_purchase_required` (the
95
+ * card closes after its first purchase) or `card_locked` (only support can
96
+ * change it).
97
+ */
98
+ type CloseBlockedReason = "first_purchase_required" | "card_locked";
78
99
  /**
79
100
  * A card design: the artwork a card is shown with. `image_url` is the front,
80
101
  * `image_url_back` the back; both are either absolute URLs or paths relative
@@ -174,6 +195,24 @@ interface Card {
174
195
  initial_amount: string | null;
175
196
  currency: string;
176
197
  failure_reason: string | null;
198
+ /** Who changed the status last; `null` when it never changed. See {@link CardStatusSource}. */
199
+ status_source: CardStatusSource | null;
200
+ /** Virtual or plastic. A `physical` card takes a PIN with {@link CardsResource.setPin}. */
201
+ card_form: CardForm;
202
+ /** Why the card cannot be closed right now, or `null` when it can. */
203
+ close_blocked: CloseBlockedReason | null;
204
+ /**
205
+ * Top-ups the issuer has accepted and not loaded yet, summed, decimal
206
+ * string in `currency`; `null` when there are none. Show it next to the
207
+ * balance as money on its way to the card.
208
+ */
209
+ topups_pending: string | null;
210
+ /**
211
+ * Top-ups the issuer has held for too long, summed, decimal string in
212
+ * `currency`; `null` when there are none. The money is safe and waits for
213
+ * support to settle it; say so instead of offering a retry.
214
+ */
215
+ topups_held: string | null;
177
216
  /** The name the user gave the card, or `null`. */
178
217
  name: string | null;
179
218
  /** The artwork the card is shown with. Always present. */
@@ -299,11 +338,26 @@ interface TopUpInput {
299
338
  */
300
339
  idempotencyKey: string;
301
340
  }
341
+ /**
342
+ * Where a top-up stands.
343
+ *
344
+ * - `pending`: the issuer accepted it and has not loaded the card yet. The
345
+ * wallet is debited, the card balance is unchanged, the amount shows in
346
+ * `Card.topups_pending`. Most issuers finish within minutes.
347
+ * - `confirmed`: the money is on the card.
348
+ * - `failed`: the issuer refused; the wallet is credited back.
349
+ * - `stalled`: pending for longer than the deployment allows. The money is
350
+ * safe and waits for support; it shows in `Card.topups_held`.
351
+ * - `returned`: support sent the money back to the wallet.
352
+ * - `written_off`: support closed it without the money coming back (the
353
+ * issuer kept it); `failure_reason` says so.
354
+ */
355
+ type CardTopUpStatus = "pending" | "confirmed" | "failed" | "stalled" | "returned" | "written_off";
302
356
  /** One top-up attempt as the API records it. */
303
357
  interface CardTopUp {
304
358
  id: string;
305
359
  card_id: string;
306
- status: "pending" | "confirmed" | "failed";
360
+ status: CardTopUpStatus;
307
361
  /** What landed on the card, decimal string, in `currency`. */
308
362
  amount: string;
309
363
  currency: string;
@@ -314,7 +368,13 @@ interface CardTopUp {
314
368
  created_at: string;
315
369
  updated_at: string;
316
370
  }
317
- /** A completed top-up with the state to redraw: card, its balance, the wallet. */
371
+ /**
372
+ * The outcome of a top-up with the state to redraw: card, its balance, the
373
+ * wallet. When `topup.status` is `pending`, the wallet has paid and
374
+ * `card_balance` has not moved yet: show the amount as on its way
375
+ * (`card.topups_pending`) and refresh the card later or on the
376
+ * `card_topup` notification.
377
+ */
318
378
  interface TopUpResult {
319
379
  topup: CardTopUp;
320
380
  card: Card;
@@ -342,16 +402,33 @@ interface RevealCardInput {
342
402
  totpCode?: string;
343
403
  }
344
404
  /**
345
- * Full card data from a successful reveal. **Security**: never persist this —
405
+ * Full card data from a successful reveal. **Security**: never persist this,
346
406
  * keep it in volatile memory only, clear it within `expires_in_seconds`, and
347
407
  * never write it to localStorage / logs (the API marks the response no-store).
408
+ *
409
+ * Some issuers hand out a page that shows the numbers instead of the
410
+ * numbers themselves. Then `reveal_url` is set, `pan` and `cvv` are empty,
411
+ * and the client opens the page in a frame; see the README for the frame.
348
412
  */
349
413
  interface RevealedCard {
414
+ /** The card number; empty when `reveal_url` is set. */
350
415
  pan: string;
416
+ /** The security code; empty when `reveal_url` is set. */
351
417
  cvv: string;
352
418
  expiry_month: number;
353
419
  expiry_year: number;
354
420
  holder_name: string;
421
+ /**
422
+ * A page at the card issuer that shows the details to the holder. Present
423
+ * only for issuers that give a page instead of the numbers. Short-lived,
424
+ * often single use: open it at once in an `<iframe>` and never store it.
425
+ */
426
+ reveal_url?: string;
427
+ /**
428
+ * The person the card is registered to at its issuer: what a checkout
429
+ * asks for. Absent for cards issued before holders were kept.
430
+ */
431
+ cardholder?: Cardholder;
355
432
  /**
356
433
  * The address the card is registered at — what a merchant's checkout asks
357
434
  * for, and the postal code some of them decline a payment over. Absent
@@ -370,6 +447,33 @@ interface BillingAddress {
370
447
  postal_code?: string;
371
448
  country?: string;
372
449
  }
450
+ /**
451
+ * The cardholder the issuer knows: the details to type into a checkout
452
+ * that asks for the name, phone or address on the card. `source` says
453
+ * whether the platform made them up (`generated`), the user supplied them
454
+ * (`provided`) or both (`mixed`).
455
+ */
456
+ interface Cardholder {
457
+ id: string;
458
+ first_name: string;
459
+ last_name: string;
460
+ /** `YYYY-MM-DD`. */
461
+ birth_date: string;
462
+ /** E.164. */
463
+ phone: string;
464
+ /** A mailbox the platform owns; mail the issuer sends there reaches the user. */
465
+ email: string;
466
+ address: BillingAddress;
467
+ source: "generated" | "provided" | "mixed";
468
+ }
469
+ /** The new PIN for a physical card. */
470
+ interface SetPinInput {
471
+ /**
472
+ * Four to six digits, as the user typed them. Sent once to the issuer and
473
+ * kept nowhere: not by the SDK, not by the API. Never log it.
474
+ */
475
+ pin: string;
476
+ }
373
477
  /** What to move, and the key that makes a retry safe. */
374
478
  interface TransferInput {
375
479
  /** The card the money lands on. Must be the caller's, and of the same kind and currency. */
@@ -482,9 +586,11 @@ declare class CardsResource {
482
586
  */
483
587
  transfer(fromCardId: string, input: TransferInput): Promise<TransferResult>;
484
588
  /**
485
- * Freeze the caller's own card. Reversible via {@link unfreeze}. The optional
486
- * `reason` is recorded on the audit trail. Resolves to the updated card.
487
- * 404 if the card isn't the caller's; 501 if the issuer can't freeze.
589
+ * Freeze the caller's own card. Reversible via {@link unfreeze} while
590
+ * `status_source` is `holder` or `operator`. The optional `reason` is
591
+ * recorded on the audit trail. Resolves to the updated card. 404 if the
592
+ * card isn't the caller's; 409 `card_locked` when support holds it; 501 if
593
+ * the issuer can't freeze.
488
594
  */
489
595
  freeze(id: string, reason?: string): Promise<Card>;
490
596
  /**
@@ -497,12 +603,30 @@ declare class CardsResource {
497
603
  * keep the result in volatile memory only, never write it to
498
604
  * localStorage / logs, and clear it within `expires_in_seconds`.
499
605
  *
500
- * 401 bad re-auth · 403 not your card · 429 rate-limited · 501 connector
501
- * has no sensitive-data endpoint · 503 provider error.
606
+ * The result is the numbers, or `reveal_url` with empty `pan` and `cvv`
607
+ * when the issuer shows them on a page of its own: open that page in a
608
+ * frame right away, it is short-lived.
609
+ *
610
+ * 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
611
+ * has no sensitive-data endpoint · 503 `provider_unavailable`.
502
612
  */
503
613
  reveal(id: string, _input?: RevealCardInput): Promise<RevealedCard>;
504
- /** Unfreeze a previously-frozen card. Idempotent on an already-active card. */
614
+ /**
615
+ * Unfreeze a previously-frozen card. Idempotent on an already-active card.
616
+ * A card the issuer froze (`status_source: "provider"`) is not the
617
+ * holder's to unfreeze: the API answers 409 `card_locked`, so hide the
618
+ * button and say the freeze is lifted through the issuer's support.
619
+ */
505
620
  unfreeze(id: string): Promise<Card>;
621
+ /**
622
+ * Set the PIN of the caller's own physical card. The session is enough; the
623
+ * call is rate-limited like {@link reveal} and the PIN is kept nowhere.
624
+ * Resolves to the card; the user also gets a notification that the PIN
625
+ * was set. 400 not four to six digits or the card is not active · 403 not
626
+ * your card · 409 `card_locked`, or `provider_refused` when the issuer did
627
+ * not take it · 429 too many attempts · 501 a virtual card has no PIN.
628
+ */
629
+ setPin(id: string, input: SetPinInput): Promise<Card>;
506
630
  /**
507
631
  * Terminate the caller's own card. **One-way** — a terminated card cannot be
508
632
  * reactivated. The optional `reason` is audited. Idempotent on an
@@ -511,4 +635,4 @@ declare class CardsResource {
511
635
  terminate(id: string, reason?: string): Promise<Card>;
512
636
  }
513
637
 
514
- export { type Address as A, type BillingAddress as B, type CardProduct as C, type IssuanceBonus as I, type RevealCardInput as R, type TopUpInput as T, type UpdateCardInput as U, type Card as a, CardsResource as b, type CardBalance as c, type CardDesignRef as d, type CardProductPrice as e, type CardStatus as f, type CardTopUp as g, type CardTransfer as h, type CardType as i, type CreateCardInput as j, type CustomerInfo as k, type RevealedCard as l, type TopUpResult as m, type TopUpTerms as n, type TransferInput as o, type TransferResult as p, cardRequestBody as q };
638
+ export { type Address as A, type BillingAddress as B, type CardProduct as C, type IssuanceBonus as I, type RevealCardInput as R, type SetPinInput as S, type TopUpInput as T, type UpdateCardInput as U, type Card as a, CardsResource as b, type CardBalance as c, type CardDesignRef as d, type CardForm as e, type CardProductPrice as f, type CardStatus as g, type CardStatusSource as h, type CardTopUp as i, type CardTopUpStatus as j, type CardTransfer as k, type CardType as l, type Cardholder as m, type CloseBlockedReason as n, type CreateCardInput as o, type CustomerInfo as p, type RevealedCard as q, type TopUpResult as r, type TopUpTerms as s, type TransferInput as t, type TransferResult as u, cardRequestBody as v };