@takeal/cusfront-sdk 0.6.0 → 0.6.2

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 (57) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +221 -1
  3. package/dist/{cards-B_aNY35J.d.cts → cards-DU2DdhYO.d.cts} +154 -20
  4. package/dist/{cards-Ba1wZttb.d.ts → cards-DzhPVA9N.d.ts} +154 -20
  5. package/dist/{deposits-BEc8U80M.d.cts → deposits-BEkNeE-v.d.cts} +71 -8
  6. package/dist/{deposits-DScyT_D9.d.ts → deposits-Dt6A76MB.d.ts} +71 -8
  7. package/dist/index.cjs +129 -14
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +16 -8
  10. package/dist/index.d.ts +16 -8
  11. package/dist/index.js +129 -14
  12. package/dist/index.js.map +1 -1
  13. package/dist/react/index.d.cts +4 -2
  14. package/dist/react/index.d.ts +4 -2
  15. package/dist/resources/auth.cjs +25 -4
  16. package/dist/resources/auth.cjs.map +1 -1
  17. package/dist/resources/auth.d.cts +40 -5
  18. package/dist/resources/auth.d.ts +40 -5
  19. package/dist/resources/auth.js +25 -4
  20. package/dist/resources/auth.js.map +1 -1
  21. package/dist/resources/cards.cjs +32 -6
  22. package/dist/resources/cards.cjs.map +1 -1
  23. package/dist/resources/cards.d.cts +2 -1
  24. package/dist/resources/cards.d.ts +2 -1
  25. package/dist/resources/cards.js +32 -6
  26. package/dist/resources/cards.js.map +1 -1
  27. package/dist/resources/consents.cjs +91 -0
  28. package/dist/resources/consents.cjs.map +1 -0
  29. package/dist/resources/consents.d.cts +83 -0
  30. package/dist/resources/consents.d.ts +83 -0
  31. package/dist/resources/consents.js +89 -0
  32. package/dist/resources/consents.js.map +1 -0
  33. package/dist/resources/deposits.cjs +6 -1
  34. package/dist/resources/deposits.cjs.map +1 -1
  35. package/dist/resources/deposits.d.cts +3 -2
  36. package/dist/resources/deposits.d.ts +3 -2
  37. package/dist/resources/deposits.js +6 -1
  38. package/dist/resources/deposits.js.map +1 -1
  39. package/dist/resources/funding-options.cjs.map +1 -1
  40. package/dist/resources/funding-options.d.cts +3 -2
  41. package/dist/resources/funding-options.d.ts +3 -2
  42. package/dist/resources/funding-options.js.map +1 -1
  43. package/dist/resources/me.d.cts +1 -0
  44. package/dist/resources/me.d.ts +1 -0
  45. package/dist/resources/receipts.cjs +22 -0
  46. package/dist/resources/receipts.cjs.map +1 -0
  47. package/dist/resources/receipts.d.cts +51 -0
  48. package/dist/resources/receipts.d.ts +51 -0
  49. package/dist/resources/receipts.js +20 -0
  50. package/dist/resources/receipts.js.map +1 -0
  51. package/dist/telegram.cjs +167 -14
  52. package/dist/telegram.cjs.map +1 -1
  53. package/dist/telegram.d.cts +4 -2
  54. package/dist/telegram.d.ts +4 -2
  55. package/dist/telegram.js +167 -14
  56. package/dist/telegram.js.map +1 -1
  57. package/package.json +11 -1
@@ -1,3 +1,4 @@
1
+ import { ConsentKind, ConsentChannel } from './resources/consents.js';
1
2
  import { H as HttpClient } from './http-DeANAoTs.js';
2
3
 
3
4
  /**
@@ -52,16 +53,12 @@ interface CustomerInfo {
52
53
  * POST /me/cards/{id}/unfreeze → unfreeze
53
54
  * POST /me/cards/{id}/transfer → transfer (to another of their cards)
54
55
  * POST /me/cards/{id}/terminate → terminate (one-way)
56
+ * POST /me/cards/{id}/reveal → reveal (the numbers, or a provider page)
57
+ * POST /me/cards/{id}/pin → setPin (physical cards)
55
58
  *
56
59
  * The lifecycle actions are ownership-gated server-side: a caller can only
57
60
  * freeze / unfreeze / terminate a card that belongs to them (else 404).
58
61
  *
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
62
  * Today only PREPAID is wired end-to-end; CREDIT and GIFT return 400 from
66
63
  * the Takeal API until their issuer flows land.
67
64
  */
@@ -70,11 +67,36 @@ type CardType = "credit" | "prepaid" | "gift";
70
67
  /**
71
68
  * Card lifecycle state.
72
69
  *
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.
70
+ * - `pending_payment`: the row exists but the issuance fee has not been
71
+ * paid yet; the provider has not been called and nothing is visible.
72
+ * - `pending`: the issuer accepted the order and has not issued the card
73
+ * yet. The price is charged. Show the card as "being issued" with no
74
+ * numbers; it becomes `active` on its own, or `failed` with the price
75
+ * back on the wallet. Some issuers take minutes, some a day.
76
+ * - `active`, `frozen`: the usual states. Read `status_source` before
77
+ * offering to unfreeze.
78
+ * - `terminating`: the holder (or the issuer) closed the card and the
79
+ * issuer has not finished: the balance comes back to the wallet when it
80
+ * does. Show it as closing; no actions apply.
81
+ * - `terminated`, `redeemed`, `failed`: final.
76
82
  */
77
- type CardStatus = "pending_payment" | "active" | "frozen" | "terminated" | "redeemed" | "failed";
83
+ type CardStatus = "pending_payment" | "pending" | "active" | "frozen" | "terminating" | "terminated" | "redeemed" | "failed";
84
+ /**
85
+ * Who made the card's last status change. `provider` on a `frozen` card
86
+ * means the issuer froze it (a risk check, a lost-card report): the holder
87
+ * cannot unfreeze it, so do not offer the button; say the freeze is lifted
88
+ * through the issuer's support. `holder` and `operator` freezes are undone
89
+ * with `unfreeze()` as usual.
90
+ */
91
+ type CardStatusSource = "holder" | "operator" | "provider";
92
+ /** `virtual` cards show their numbers in the app; `physical` cards are plastic and have a PIN. */
93
+ type CardForm = "virtual" | "physical";
94
+ /**
95
+ * Why `terminate()` is refused right now: `first_purchase_required` (the
96
+ * card closes after its first purchase) or `card_locked` (only support can
97
+ * change it).
98
+ */
99
+ type CloseBlockedReason = "first_purchase_required" | "card_locked";
78
100
  /**
79
101
  * A card design: the artwork a card is shown with. `image_url` is the front,
80
102
  * `image_url_back` the back; both are either absolute URLs or paths relative
@@ -174,6 +196,24 @@ interface Card {
174
196
  initial_amount: string | null;
175
197
  currency: string;
176
198
  failure_reason: string | null;
199
+ /** Who changed the status last; `null` when it never changed. See {@link CardStatusSource}. */
200
+ status_source: CardStatusSource | null;
201
+ /** Virtual or plastic. A `physical` card takes a PIN with {@link CardsResource.setPin}. */
202
+ card_form: CardForm;
203
+ /** Why the card cannot be closed right now, or `null` when it can. */
204
+ close_blocked: CloseBlockedReason | null;
205
+ /**
206
+ * Top-ups the issuer has accepted and not loaded yet, summed, decimal
207
+ * string in `currency`; `null` when there are none. Show it next to the
208
+ * balance as money on its way to the card.
209
+ */
210
+ topups_pending: string | null;
211
+ /**
212
+ * Top-ups the issuer has held for too long, summed, decimal string in
213
+ * `currency`; `null` when there are none. The money is safe and waits for
214
+ * support to settle it; say so instead of offering a retry.
215
+ */
216
+ topups_held: string | null;
177
217
  /** The name the user gave the card, or `null`. */
178
218
  name: string | null;
179
219
  /** The artwork the card is shown with. Always present. */
@@ -255,6 +295,15 @@ interface CreateCardInput {
255
295
  * `promo_code` on the top-up there.
256
296
  */
257
297
  promoCode?: string;
298
+ /**
299
+ * Consents the user gave with the order (`terms`, `personal_data`,
300
+ * `marketing`). Recorded with the card, or with the top-up inside
301
+ * `deposits.initiate({ issue_card })`, at the version of their documents
302
+ * in force now.
303
+ */
304
+ consents?: ConsentKind[];
305
+ /** Where they were given. Sent as `consent_channel`. */
306
+ consentChannel?: ConsentChannel;
258
307
  /**
259
308
  * Required by the Takeal API on this write endpoint. Same key + body replays the
260
309
  * original card; same key + different body returns 409.
@@ -299,11 +348,26 @@ interface TopUpInput {
299
348
  */
300
349
  idempotencyKey: string;
301
350
  }
351
+ /**
352
+ * Where a top-up stands.
353
+ *
354
+ * - `pending`: the issuer accepted it and has not loaded the card yet. The
355
+ * wallet is debited, the card balance is unchanged, the amount shows in
356
+ * `Card.topups_pending`. Most issuers finish within minutes.
357
+ * - `confirmed`: the money is on the card.
358
+ * - `failed`: the issuer refused; the wallet is credited back.
359
+ * - `stalled`: pending for longer than the deployment allows. The money is
360
+ * safe and waits for support; it shows in `Card.topups_held`.
361
+ * - `returned`: support sent the money back to the wallet.
362
+ * - `written_off`: support closed it without the money coming back (the
363
+ * issuer kept it); `failure_reason` says so.
364
+ */
365
+ type CardTopUpStatus = "pending" | "confirmed" | "failed" | "stalled" | "returned" | "written_off";
302
366
  /** One top-up attempt as the API records it. */
303
367
  interface CardTopUp {
304
368
  id: string;
305
369
  card_id: string;
306
- status: "pending" | "confirmed" | "failed";
370
+ status: CardTopUpStatus;
307
371
  /** What landed on the card, decimal string, in `currency`. */
308
372
  amount: string;
309
373
  currency: string;
@@ -314,7 +378,13 @@ interface CardTopUp {
314
378
  created_at: string;
315
379
  updated_at: string;
316
380
  }
317
- /** A completed top-up with the state to redraw: card, its balance, the wallet. */
381
+ /**
382
+ * The outcome of a top-up with the state to redraw: card, its balance, the
383
+ * wallet. When `topup.status` is `pending`, the wallet has paid and
384
+ * `card_balance` has not moved yet: show the amount as on its way
385
+ * (`card.topups_pending`) and refresh the card later or on the
386
+ * `card_topup` notification.
387
+ */
318
388
  interface TopUpResult {
319
389
  topup: CardTopUp;
320
390
  card: Card;
@@ -342,16 +412,33 @@ interface RevealCardInput {
342
412
  totpCode?: string;
343
413
  }
344
414
  /**
345
- * Full card data from a successful reveal. **Security**: never persist this —
415
+ * Full card data from a successful reveal. **Security**: never persist this,
346
416
  * keep it in volatile memory only, clear it within `expires_in_seconds`, and
347
417
  * never write it to localStorage / logs (the API marks the response no-store).
418
+ *
419
+ * Some issuers hand out a page that shows the numbers instead of the
420
+ * numbers themselves. Then `reveal_url` is set, `pan` and `cvv` are empty,
421
+ * and the client opens the page in a frame; see the README for the frame.
348
422
  */
349
423
  interface RevealedCard {
424
+ /** The card number; empty when `reveal_url` is set. */
350
425
  pan: string;
426
+ /** The security code; empty when `reveal_url` is set. */
351
427
  cvv: string;
352
428
  expiry_month: number;
353
429
  expiry_year: number;
354
430
  holder_name: string;
431
+ /**
432
+ * A page at the card issuer that shows the details to the holder. Present
433
+ * only for issuers that give a page instead of the numbers. Short-lived,
434
+ * often single use: open it at once in an `<iframe>` and never store it.
435
+ */
436
+ reveal_url?: string;
437
+ /**
438
+ * The person the card is registered to at its issuer: what a checkout
439
+ * asks for. Absent for cards issued before holders were kept.
440
+ */
441
+ cardholder?: Cardholder;
355
442
  /**
356
443
  * The address the card is registered at — what a merchant's checkout asks
357
444
  * for, and the postal code some of them decline a payment over. Absent
@@ -370,6 +457,33 @@ interface BillingAddress {
370
457
  postal_code?: string;
371
458
  country?: string;
372
459
  }
460
+ /**
461
+ * The cardholder the issuer knows: the details to type into a checkout
462
+ * that asks for the name, phone or address on the card. `source` says
463
+ * whether the platform made them up (`generated`), the user supplied them
464
+ * (`provided`) or both (`mixed`).
465
+ */
466
+ interface Cardholder {
467
+ id: string;
468
+ first_name: string;
469
+ last_name: string;
470
+ /** `YYYY-MM-DD`. */
471
+ birth_date: string;
472
+ /** E.164. */
473
+ phone: string;
474
+ /** A mailbox the platform owns; mail the issuer sends there reaches the user. */
475
+ email: string;
476
+ address: BillingAddress;
477
+ source: "generated" | "provided" | "mixed";
478
+ }
479
+ /** The new PIN for a physical card. */
480
+ interface SetPinInput {
481
+ /**
482
+ * Four to six digits, as the user typed them. Sent once to the issuer and
483
+ * kept nowhere: not by the SDK, not by the API. Never log it.
484
+ */
485
+ pin: string;
486
+ }
373
487
  /** What to move, and the key that makes a retry safe. */
374
488
  interface TransferInput {
375
489
  /** The card the money lands on. Must be the caller's, and of the same kind and currency. */
@@ -482,9 +596,11 @@ declare class CardsResource {
482
596
  */
483
597
  transfer(fromCardId: string, input: TransferInput): Promise<TransferResult>;
484
598
  /**
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.
599
+ * Freeze the caller's own card. Reversible via {@link unfreeze} while
600
+ * `status_source` is `holder` or `operator`. The optional `reason` is
601
+ * recorded on the audit trail. Resolves to the updated card. 404 if the
602
+ * card isn't the caller's; 409 `card_locked` when support holds it; 501 if
603
+ * the issuer can't freeze.
488
604
  */
489
605
  freeze(id: string, reason?: string): Promise<Card>;
490
606
  /**
@@ -497,12 +613,30 @@ declare class CardsResource {
497
613
  * keep the result in volatile memory only, never write it to
498
614
  * localStorage / logs, and clear it within `expires_in_seconds`.
499
615
  *
500
- * 401 bad re-auth · 403 not your card · 429 rate-limited · 501 connector
501
- * has no sensitive-data endpoint · 503 provider error.
616
+ * The result is the numbers, or `reveal_url` with empty `pan` and `cvv`
617
+ * when the issuer shows them on a page of its own: open that page in a
618
+ * frame right away, it is short-lived.
619
+ *
620
+ * 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
621
+ * has no sensitive-data endpoint · 503 `provider_unavailable`.
502
622
  */
503
623
  reveal(id: string, _input?: RevealCardInput): Promise<RevealedCard>;
504
- /** Unfreeze a previously-frozen card. Idempotent on an already-active card. */
624
+ /**
625
+ * Unfreeze a previously-frozen card. Idempotent on an already-active card.
626
+ * A card the issuer froze (`status_source: "provider"`) is not the
627
+ * holder's to unfreeze: the API answers 409 `card_locked`, so hide the
628
+ * button and say the freeze is lifted through the issuer's support.
629
+ */
505
630
  unfreeze(id: string): Promise<Card>;
631
+ /**
632
+ * Set the PIN of the caller's own physical card. The session is enough; the
633
+ * call is rate-limited like {@link reveal} and the PIN is kept nowhere.
634
+ * Resolves to the card; the user also gets a notification that the PIN
635
+ * was set. 400 not four to six digits or the card is not active · 403 not
636
+ * your card · 409 `card_locked`, or `provider_refused` when the issuer did
637
+ * not take it · 429 too many attempts · 501 a virtual card has no PIN.
638
+ */
639
+ setPin(id: string, input: SetPinInput): Promise<Card>;
506
640
  /**
507
641
  * Terminate the caller's own card. **One-way** — a terminated card cannot be
508
642
  * reactivated. The optional `reason` is audited. Idempotent on an
@@ -511,4 +645,4 @@ declare class CardsResource {
511
645
  terminate(id: string, reason?: string): Promise<Card>;
512
646
  }
513
647
 
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 };
648
+ 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 };
@@ -1,5 +1,5 @@
1
1
  import { H as HttpClient } from './http-DeANAoTs.cjs';
2
- import { k as CustomerInfo, j as CreateCardInput } from './cards-B_aNY35J.cjs';
2
+ import { p as CustomerInfo, o as CreateCardInput } from './cards-DU2DdhYO.cjs';
3
3
 
4
4
  /**
5
5
  * Funding options resource — `client.fundingOptions.*`.
@@ -19,6 +19,27 @@ import { k as CustomerInfo, j as CreateCardInput } from './cards-B_aNY35J.cjs';
19
19
  type FunderMode = "wallet" | "spool" | "mixed";
20
20
  /** Where one top-up goes: the wallet, or one of the user's cards. */
21
21
  type DepositTarget = "wallet" | "card";
22
+ /**
23
+ * What one way of paying through a funding connector costs and allows.
24
+ * Draw the top-up form from it: the currency to ask for, the fee to show
25
+ * (or not, for a markup), the floor, the cap and the day's limit.
26
+ */
27
+ interface MethodTerms {
28
+ method: DepositMethod;
29
+ /** ISO 4217 code the user pays in this way; `null` when any the quote accepts. */
30
+ source_currency: string | null;
31
+ fee_kind: FeeKind;
32
+ /** The fee in basis points (2000 = 20 %). */
33
+ fee_bps: number;
34
+ /** How long a quote through this method stays executable, and the deposit waits for its payment. */
35
+ quote_ttl_seconds: number;
36
+ /** Smallest single top-up in the source currency; `null` for no floor. */
37
+ min_amount: string | null;
38
+ /** Largest single top-up in the source currency; `null` for no cap. */
39
+ max_amount: string | null;
40
+ /** What one user may top up this way over 24 hours; `null` for no limit. */
41
+ daily_limit_per_user: string | null;
42
+ }
22
43
  /** One way to top up. */
23
44
  interface FundingOption {
24
45
  /** Pass it as `funder_slug` to `deposits.initiate`. */
@@ -33,6 +54,8 @@ interface FundingOption {
33
54
  * (`issue_card` on `deposits.initiate`).
34
55
  */
35
56
  issue_card: boolean;
57
+ /** The terms of each method in `methods`. */
58
+ method_terms: MethodTerms[];
36
59
  }
37
60
  declare class FundingOptionsResource {
38
61
  private readonly http;
@@ -60,10 +83,18 @@ declare class FundingOptionsResource {
60
83
  * a connector → Takeal API inbound event. Poll `get(id)` or watch the user's
61
84
  * webhook stream for the `deposit.confirmed` / `deposit.failed` outcome.
62
85
  */
63
- /** Lifecycle of a deposit. `redirect_required` carries `redirect_url`. */
64
- type DepositStatus = "pending" | "redirect_required" | "confirmed" | "failed";
65
- /** Top-up rail. The chosen funder decides which it supports. */
66
- type DepositMethod = "card" | "crypto" | "bank_transfer";
86
+ /**
87
+ * Lifecycle of a deposit. `redirect_required` carries `redirect_url`.
88
+ * `expired`: nobody paid before `expires_at`; the user starts over with a
89
+ * new quote. A payment that still arrives is credited at the stored rate
90
+ * and the deposit turns `confirmed` after all.
91
+ */
92
+ type DepositStatus = "pending" | "redirect_required" | "confirmed" | "failed" | "expired";
93
+ /**
94
+ * Top-up rail. The chosen funder decides which it supports; `sbp` is
95
+ * Russia's instant payments through a payment page, paid in roubles.
96
+ */
97
+ type DepositMethod = "card" | "crypto" | "bank_transfer" | "sbp";
67
98
  /**
68
99
  * A deposit record as the Takeal API returns it. Mirrors the `deposits` table; the
69
100
  * server-side `id` is the stable handle the SDK polls against. `idempotency_key`
@@ -85,7 +116,23 @@ interface CreateQuoteInput {
85
116
  * card issued with the top-up (`issue_card`). Ignored with `card_id`.
86
117
  */
87
118
  target_currency?: string;
119
+ /**
120
+ * The funding connector the deposit will go through (`funder_slug` of
121
+ * `initiate()`). With `method`, the quote is priced on that method's own
122
+ * terms from `fundingOptions.list()`: its fee and kind, its rate source,
123
+ * its lifetime, its limits. Sent as `connector_slug`.
124
+ */
125
+ connectorSlug?: string;
126
+ /** The way the user pays. Pass the same method to `initiate()`. */
127
+ method?: DepositMethod;
88
128
  }
129
+ /**
130
+ * How a method's fee reads. `spread`: taken off the credited amount at the
131
+ * deployment's rate. `markup`: in the rate the user sees, so show the rate
132
+ * and nothing else. `commission`: the rate is the provider's and the fee is
133
+ * a line of its own on the credited amount.
134
+ */
135
+ type FeeKind = "spread" | "markup" | "commission";
89
136
  /** How far a top-up meant for a card has got. */
90
137
  type CardLoadStatus = "pending" | "succeeded" | "failed";
91
138
  /**
@@ -110,10 +157,22 @@ interface FundingQuote {
110
157
  source_currency: string;
111
158
  credited_amount: string;
112
159
  credited_currency: string;
113
- /** Provider rate before spread (credited units per 1 source unit). */
160
+ /**
161
+ * Provider rate before the fee, credited units per 1 source unit. The
162
+ * rate to show the user is `credited_amount / source_amount`, which has
163
+ * the fee in it; see the README for the rouble-per-dollar form.
164
+ */
114
165
  rate: string;
166
+ /** The fee in basis points; the same figure as `fee_bps`, under its old name. */
115
167
  spread_bps: number;
168
+ /** The fee in basis points (2000 = 20 %). */
169
+ fee_bps: number;
170
+ fee_kind: FeeKind;
116
171
  provider: string;
172
+ /** The pair the quote was priced for, when the request named one. */
173
+ connector_slug?: string;
174
+ method?: DepositMethod;
175
+ /** The rate is locked until then; the deposit made with it waits for its payment as long. */
117
176
  expires_at: string;
118
177
  }
119
178
  interface Deposit {
@@ -139,6 +198,10 @@ interface Deposit {
139
198
  /** Locked provider rate (credited units per 1 source unit). */
140
199
  fx_rate?: string | null;
141
200
  fx_spread_bps?: number | null;
201
+ /** How `fx_spread_bps` was taken; see `FeeKind`. */
202
+ fx_fee_kind?: FeeKind | null;
203
+ /** When the deposit stops waiting for its payment; `null` for one without a term. */
204
+ expires_at?: string | null;
142
205
  /** The wallet's local currency the deposit converted into. */
143
206
  credited_currency?: string | null;
144
207
  /** What the wallet was actually credited, net of spread. */
@@ -202,7 +265,7 @@ interface InitiateDepositInput {
202
265
  * test deployments with the mock funder `mock_scenario`, which picks the
203
266
  * outcome: `happy` (confirmed at once, the default), `pending` (confirmed
204
267
  * about 15 s later), `redirect` (a hosted page where the user approves or
205
- * declines) or `fail`.
268
+ * declines), `late` (paid after the term) or `fail`.
206
269
  */
207
270
  metadata?: Record<string, string>;
208
271
  /** Structured billing details — real PSPs require these for 3DS / compliance. */
@@ -307,4 +370,4 @@ declare class DepositsResource {
307
370
  refund(depositId: string, input: CreateDepositRefundInput): Promise<Refund>;
308
371
  }
309
372
 
310
- export { type CardLoadStatus as C, type Deposit as D, FundingOptionsResource as F, type InitiateDepositInput as I, type Refund as R, DepositsResource as a, type CreateDepositRefundInput as b, type CreateQuoteInput as c, type DepositMethod as d, type DepositStatus as e, type DepositTarget as f, type FunderMode as g, type FundingOption as h, type FundingQuote as i, type IssueCardInput as j };
373
+ export { type CardLoadStatus as C, type Deposit as D, FundingOptionsResource as F, type InitiateDepositInput as I, type MethodTerms as M, type Refund as R, DepositsResource as a, type CreateDepositRefundInput as b, type CreateQuoteInput as c, type DepositMethod as d, type DepositStatus as e, type DepositTarget as f, type FeeKind as g, type FunderMode as h, type FundingOption as i, type FundingQuote as j, type IssueCardInput as k };
@@ -1,5 +1,5 @@
1
1
  import { H as HttpClient } from './http-DeANAoTs.js';
2
- import { k as CustomerInfo, j as CreateCardInput } from './cards-Ba1wZttb.js';
2
+ import { p as CustomerInfo, o as CreateCardInput } from './cards-DzhPVA9N.js';
3
3
 
4
4
  /**
5
5
  * Funding options resource — `client.fundingOptions.*`.
@@ -19,6 +19,27 @@ import { k as CustomerInfo, j as CreateCardInput } from './cards-Ba1wZttb.js';
19
19
  type FunderMode = "wallet" | "spool" | "mixed";
20
20
  /** Where one top-up goes: the wallet, or one of the user's cards. */
21
21
  type DepositTarget = "wallet" | "card";
22
+ /**
23
+ * What one way of paying through a funding connector costs and allows.
24
+ * Draw the top-up form from it: the currency to ask for, the fee to show
25
+ * (or not, for a markup), the floor, the cap and the day's limit.
26
+ */
27
+ interface MethodTerms {
28
+ method: DepositMethod;
29
+ /** ISO 4217 code the user pays in this way; `null` when any the quote accepts. */
30
+ source_currency: string | null;
31
+ fee_kind: FeeKind;
32
+ /** The fee in basis points (2000 = 20 %). */
33
+ fee_bps: number;
34
+ /** How long a quote through this method stays executable, and the deposit waits for its payment. */
35
+ quote_ttl_seconds: number;
36
+ /** Smallest single top-up in the source currency; `null` for no floor. */
37
+ min_amount: string | null;
38
+ /** Largest single top-up in the source currency; `null` for no cap. */
39
+ max_amount: string | null;
40
+ /** What one user may top up this way over 24 hours; `null` for no limit. */
41
+ daily_limit_per_user: string | null;
42
+ }
22
43
  /** One way to top up. */
23
44
  interface FundingOption {
24
45
  /** Pass it as `funder_slug` to `deposits.initiate`. */
@@ -33,6 +54,8 @@ interface FundingOption {
33
54
  * (`issue_card` on `deposits.initiate`).
34
55
  */
35
56
  issue_card: boolean;
57
+ /** The terms of each method in `methods`. */
58
+ method_terms: MethodTerms[];
36
59
  }
37
60
  declare class FundingOptionsResource {
38
61
  private readonly http;
@@ -60,10 +83,18 @@ declare class FundingOptionsResource {
60
83
  * a connector → Takeal API inbound event. Poll `get(id)` or watch the user's
61
84
  * webhook stream for the `deposit.confirmed` / `deposit.failed` outcome.
62
85
  */
63
- /** Lifecycle of a deposit. `redirect_required` carries `redirect_url`. */
64
- type DepositStatus = "pending" | "redirect_required" | "confirmed" | "failed";
65
- /** Top-up rail. The chosen funder decides which it supports. */
66
- type DepositMethod = "card" | "crypto" | "bank_transfer";
86
+ /**
87
+ * Lifecycle of a deposit. `redirect_required` carries `redirect_url`.
88
+ * `expired`: nobody paid before `expires_at`; the user starts over with a
89
+ * new quote. A payment that still arrives is credited at the stored rate
90
+ * and the deposit turns `confirmed` after all.
91
+ */
92
+ type DepositStatus = "pending" | "redirect_required" | "confirmed" | "failed" | "expired";
93
+ /**
94
+ * Top-up rail. The chosen funder decides which it supports; `sbp` is
95
+ * Russia's instant payments through a payment page, paid in roubles.
96
+ */
97
+ type DepositMethod = "card" | "crypto" | "bank_transfer" | "sbp";
67
98
  /**
68
99
  * A deposit record as the Takeal API returns it. Mirrors the `deposits` table; the
69
100
  * server-side `id` is the stable handle the SDK polls against. `idempotency_key`
@@ -85,7 +116,23 @@ interface CreateQuoteInput {
85
116
  * card issued with the top-up (`issue_card`). Ignored with `card_id`.
86
117
  */
87
118
  target_currency?: string;
119
+ /**
120
+ * The funding connector the deposit will go through (`funder_slug` of
121
+ * `initiate()`). With `method`, the quote is priced on that method's own
122
+ * terms from `fundingOptions.list()`: its fee and kind, its rate source,
123
+ * its lifetime, its limits. Sent as `connector_slug`.
124
+ */
125
+ connectorSlug?: string;
126
+ /** The way the user pays. Pass the same method to `initiate()`. */
127
+ method?: DepositMethod;
88
128
  }
129
+ /**
130
+ * How a method's fee reads. `spread`: taken off the credited amount at the
131
+ * deployment's rate. `markup`: in the rate the user sees, so show the rate
132
+ * and nothing else. `commission`: the rate is the provider's and the fee is
133
+ * a line of its own on the credited amount.
134
+ */
135
+ type FeeKind = "spread" | "markup" | "commission";
89
136
  /** How far a top-up meant for a card has got. */
90
137
  type CardLoadStatus = "pending" | "succeeded" | "failed";
91
138
  /**
@@ -110,10 +157,22 @@ interface FundingQuote {
110
157
  source_currency: string;
111
158
  credited_amount: string;
112
159
  credited_currency: string;
113
- /** Provider rate before spread (credited units per 1 source unit). */
160
+ /**
161
+ * Provider rate before the fee, credited units per 1 source unit. The
162
+ * rate to show the user is `credited_amount / source_amount`, which has
163
+ * the fee in it; see the README for the rouble-per-dollar form.
164
+ */
114
165
  rate: string;
166
+ /** The fee in basis points; the same figure as `fee_bps`, under its old name. */
115
167
  spread_bps: number;
168
+ /** The fee in basis points (2000 = 20 %). */
169
+ fee_bps: number;
170
+ fee_kind: FeeKind;
116
171
  provider: string;
172
+ /** The pair the quote was priced for, when the request named one. */
173
+ connector_slug?: string;
174
+ method?: DepositMethod;
175
+ /** The rate is locked until then; the deposit made with it waits for its payment as long. */
117
176
  expires_at: string;
118
177
  }
119
178
  interface Deposit {
@@ -139,6 +198,10 @@ interface Deposit {
139
198
  /** Locked provider rate (credited units per 1 source unit). */
140
199
  fx_rate?: string | null;
141
200
  fx_spread_bps?: number | null;
201
+ /** How `fx_spread_bps` was taken; see `FeeKind`. */
202
+ fx_fee_kind?: FeeKind | null;
203
+ /** When the deposit stops waiting for its payment; `null` for one without a term. */
204
+ expires_at?: string | null;
142
205
  /** The wallet's local currency the deposit converted into. */
143
206
  credited_currency?: string | null;
144
207
  /** What the wallet was actually credited, net of spread. */
@@ -202,7 +265,7 @@ interface InitiateDepositInput {
202
265
  * test deployments with the mock funder `mock_scenario`, which picks the
203
266
  * outcome: `happy` (confirmed at once, the default), `pending` (confirmed
204
267
  * about 15 s later), `redirect` (a hosted page where the user approves or
205
- * declines) or `fail`.
268
+ * declines), `late` (paid after the term) or `fail`.
206
269
  */
207
270
  metadata?: Record<string, string>;
208
271
  /** Structured billing details — real PSPs require these for 3DS / compliance. */
@@ -307,4 +370,4 @@ declare class DepositsResource {
307
370
  refund(depositId: string, input: CreateDepositRefundInput): Promise<Refund>;
308
371
  }
309
372
 
310
- export { type CardLoadStatus as C, type Deposit as D, FundingOptionsResource as F, type InitiateDepositInput as I, type Refund as R, DepositsResource as a, type CreateDepositRefundInput as b, type CreateQuoteInput as c, type DepositMethod as d, type DepositStatus as e, type DepositTarget as f, type FunderMode as g, type FundingOption as h, type FundingQuote as i, type IssueCardInput as j };
373
+ export { type CardLoadStatus as C, type Deposit as D, FundingOptionsResource as F, type InitiateDepositInput as I, type MethodTerms as M, type Refund as R, DepositsResource as a, type CreateDepositRefundInput as b, type CreateQuoteInput as c, type DepositMethod as d, type DepositStatus as e, type DepositTarget as f, type FeeKind as g, type FunderMode as h, type FundingOption as i, type FundingQuote as j, type IssueCardInput as k };