@takeal/cusfront-sdk 0.6.2 → 0.6.4

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 (41) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +70 -1
  3. package/dist/{cards-DzhPVA9N.d.ts → cards-BrqeBqLV.d.ts} +432 -1
  4. package/dist/{cards-DU2DdhYO.d.cts → cards-ofoGRU9v.d.cts} +432 -1
  5. package/dist/index.cjs +280 -205
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +5 -7
  8. package/dist/index.d.ts +5 -7
  9. package/dist/index.js +280 -205
  10. package/dist/index.js.map +1 -1
  11. package/dist/react/index.d.cts +1 -2
  12. package/dist/react/index.d.ts +1 -2
  13. package/dist/resources/auth.cjs +62 -1
  14. package/dist/resources/auth.cjs.map +1 -1
  15. package/dist/resources/auth.d.cts +88 -4
  16. package/dist/resources/auth.d.ts +88 -4
  17. package/dist/resources/auth.js +62 -1
  18. package/dist/resources/auth.js.map +1 -1
  19. package/dist/resources/cards.cjs +34 -0
  20. package/dist/resources/cards.cjs.map +1 -1
  21. package/dist/resources/cards.d.cts +1 -1
  22. package/dist/resources/cards.d.ts +1 -1
  23. package/dist/resources/cards.js +34 -1
  24. package/dist/resources/cards.js.map +1 -1
  25. package/dist/resources/deposits.cjs.map +1 -1
  26. package/dist/resources/deposits.d.cts +1 -2
  27. package/dist/resources/deposits.d.ts +1 -2
  28. package/dist/resources/deposits.js.map +1 -1
  29. package/dist/resources/funding-options.d.cts +1 -2
  30. package/dist/resources/funding-options.d.ts +1 -2
  31. package/dist/resources/me.d.cts +1 -0
  32. package/dist/resources/me.d.ts +1 -0
  33. package/dist/telegram.cjs +280 -205
  34. package/dist/telegram.cjs.map +1 -1
  35. package/dist/telegram.d.cts +1 -2
  36. package/dist/telegram.d.ts +1 -2
  37. package/dist/telegram.js +280 -205
  38. package/dist/telegram.js.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/deposits-BEkNeE-v.d.cts +0 -373
  41. package/dist/deposits-Dt6A76MB.d.ts +0 -373
package/CHANGELOG.md CHANGED
@@ -4,6 +4,36 @@ 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.4] — 2026-10-20
8
+
9
+ Needs platform (TKL) 0.6.9 or newer: `SUPPORTED_MEISTER` is `>=0.6.9, <0.7.0`.
10
+
11
+ ### Added
12
+
13
+ - `auth.requestEmailCode({ email })` and `auth.verifyEmailCode({ challengeId,
14
+ code, … })`: signing in with a six-digit code sent to the e-mail, no
15
+ password. An address with no account gets one when the code comes back
16
+ (`account_created: true`); an account that has a password can use either
17
+ way. `verifyEmailCode` takes `cardOrder`, `consents` and `promoCode`, so a
18
+ card bought from the site needs only the address and the code before the
19
+ payment page. The session carries `card_order`, or `card_order_error` when
20
+ no payment was opened.
21
+
22
+ ## [0.6.3] — 2026-10-20
23
+
24
+ Needs platform (TKL) 0.6.8 or newer: `SUPPORTED_MEISTER` is `>=0.6.8, <0.7.0`.
25
+
26
+ ### Added
27
+
28
+ - `cards.order({ productId, method, … , idempotencyKey })`: a card bought in
29
+ one step. The API prices it in the payment's currency, locks the rate and
30
+ opens the top-up that issues the card; send the user to
31
+ `order.deposit.redirect_url`.
32
+ - `auth.register` takes `cardOrder`: the card is ordered right after the
33
+ sign-up, with its consents. The session then carries `card_order`, or
34
+ `card_order_error` when the order could not be placed (the account exists
35
+ either way).
36
+
7
37
  ## [0.6.2] — 2026-10-18
8
38
 
9
39
  Needs platform (TKL) 0.6.7 or newer: `SUPPORTED_MEISTER` is `>=0.6.7, <0.7.0`.
package/README.md CHANGED
@@ -49,7 +49,8 @@ if (result.stage === "jwt") {
49
49
  }
50
50
  ```
51
51
 
52
- New users sign up with `register`, which also signs them in:
52
+ New users sign up with `register`, which also signs them in (or with no
53
+ password at all, by a code from the e-mail; see below):
53
54
 
54
55
  ```ts
55
56
  await client.auth.register({
@@ -243,6 +244,74 @@ Paying in another currency than the card's needs a quote in the card's
243
244
  currency first: `deposits.quote({ amount, currency, card_id })`, or
244
245
  `target_currency` for a card that doesn't exist yet.
245
246
 
247
+ ## Signing in with a code from the e-mail
248
+
249
+ A user can sign in, or sign up, with nothing but their address: a six-digit
250
+ code goes there, and the code signs them in. An address with no account gets
251
+ one at that moment, with no password. The first call answers the same for
252
+ both, so the form doesn't tell anyone whose addresses the platform has.
253
+
254
+ ```ts
255
+ const { challenge_id, resend_at } = await client.auth.requestEmailCode({ email });
256
+ // show the code field; keep "send again" off until resend_at
257
+
258
+ const session = await client.auth.verifyEmailCode({
259
+ challengeId: challenge_id,
260
+ code, // the six digits the user typed
261
+ remember: true,
262
+ consents: ["terms", "personal_data"],
263
+ });
264
+ session.account_created; // true when the address was new
265
+ ```
266
+
267
+ The code works for 10 minutes and takes five tries; a new code replaces the
268
+ old one. One address gets a code at most once a minute and five an hour, so
269
+ handle 429 `resend_too_soon` and `too_many_requests` (the message says when
270
+ to try again). A wrong code is 401 `invalid_code`. An account that already
271
+ has a password signs in either way. Operator accounts can't use codes: they
272
+ get 403 `second_factor_required` and sign in with the password and the
273
+ authenticator.
274
+
275
+ ## Buying a card in one step
276
+
277
+ When the user picks a card before they have an account (a "Get the card"
278
+ button on the site), let the sign-in order it too. They see the payment page
279
+ right after the code, with nothing to pick twice and no password to make up:
280
+
281
+ ```ts
282
+ const { challenge_id } = await client.auth.requestEmailCode({ email });
283
+ // … the user types the code from the e-mail …
284
+ const session = await client.auth.verifyEmailCode({
285
+ challengeId: challenge_id,
286
+ code,
287
+ promoCode, // the form's promo code, if any
288
+ consents: ["terms", "personal_data"],
289
+ cardOrder: {
290
+ productId, // the card they clicked
291
+ method: "sbp",
292
+ metadata: { return_url: `${location.origin}/cabinet` },
293
+ },
294
+ });
295
+ if (session.card_order) {
296
+ location.href = session.card_order.deposit.redirect_url!;
297
+ } else {
298
+ // session.card_order_error says why no payment was opened (the product
299
+ // is off sale, SBP is down, there's no rate). The user is signed in, so
300
+ // show the reason and open the ordinary card screen.
301
+ }
302
+ ```
303
+
304
+ The same works for an address that already has an account: the card goes to
305
+ that account. `auth.register({ email, password, cardOrder })` does it with a
306
+ password instead.
307
+
308
+ The API prices the card in the payment's currency (`card_order.amount`, in
309
+ roubles for SBP) with the rate locked, and opens the top-up that issues it.
310
+ The consents ticked on the form go with the order. A user who is already
311
+ signed in gets the same with `client.cards.order({ productId, method,
312
+ idempotencyKey })`. The card shows as `pending_payment` until the payment is
313
+ confirmed and is issued after that.
314
+
246
315
  ## Topping up by SBP
247
316
 
248
317
  A rouble top-up through Russia's instant payments goes like this: the user
@@ -32,6 +32,375 @@ interface CustomerInfo {
32
32
  billing_address?: Address;
33
33
  }
34
34
 
35
+ /**
36
+ * Funding options resource — `client.fundingOptions.*`.
37
+ *
38
+ * The ways the user can top up on this deployment: each funding connector,
39
+ * where its top-ups may land and which payment methods it takes. Build the
40
+ * top-up screen from this list instead of fixed connector names: a
41
+ * deployment may top up the wallet only, cards only (no wallet at all), or
42
+ * let the user choose.
43
+ *
44
+ * Mirrors `GET /me/funding-options`.
45
+ */
46
+ /**
47
+ * Where a funding connector's top-ups may land: `wallet` (the wallet
48
+ * only), `spool` (straight onto cards only) or `mixed` (either).
49
+ */
50
+ type FunderMode = "wallet" | "spool" | "mixed";
51
+ /** Where one top-up goes: the wallet, or one of the user's cards. */
52
+ type DepositTarget = "wallet" | "card";
53
+ /**
54
+ * What one way of paying through a funding connector costs and allows.
55
+ * Draw the top-up form from it: the currency to ask for, the fee to show
56
+ * (or not, for a markup), the floor, the cap and the day's limit.
57
+ */
58
+ interface MethodTerms {
59
+ method: DepositMethod;
60
+ /** ISO 4217 code the user pays in this way; `null` when any the quote accepts. */
61
+ source_currency: string | null;
62
+ fee_kind: FeeKind;
63
+ /** The fee in basis points (2000 = 20 %). */
64
+ fee_bps: number;
65
+ /** How long a quote through this method stays executable, and the deposit waits for its payment. */
66
+ quote_ttl_seconds: number;
67
+ /** Smallest single top-up in the source currency; `null` for no floor. */
68
+ min_amount: string | null;
69
+ /** Largest single top-up in the source currency; `null` for no cap. */
70
+ max_amount: string | null;
71
+ /** What one user may top up this way over 24 hours; `null` for no limit. */
72
+ daily_limit_per_user: string | null;
73
+ }
74
+ /** One way to top up. */
75
+ interface FundingOption {
76
+ /** Pass it as `funder_slug` to `deposits.initiate`. */
77
+ slug: string;
78
+ mode: FunderMode;
79
+ /** Where a top-up through it may land. */
80
+ targets: DepositTarget[];
81
+ /** Payment methods it takes. */
82
+ methods: DepositMethod[];
83
+ /**
84
+ * Whether a new card can be issued with a top-up through it
85
+ * (`issue_card` on `deposits.initiate`).
86
+ */
87
+ issue_card: boolean;
88
+ /** The terms of each method in `methods`. */
89
+ method_terms: MethodTerms[];
90
+ }
91
+ declare class FundingOptionsResource {
92
+ private readonly http;
93
+ constructor(http: HttpClient);
94
+ /** The ways to top up, preferred first. Empty when none is configured. */
95
+ list(): Promise<FundingOption[]>;
96
+ }
97
+
98
+ /**
99
+ * Deposits resource — `client.deposits.*`.
100
+ *
101
+ * The "money IN" surface: an end user tops up their wallet balance via a
102
+ * funder connector, or one of their cards straight away, past the wallet
103
+ * (`card_id`, or `issue_card` for a new card). Which of the two a
104
+ * deployment allows is in `client.fundingOptions.list()`. Mirrors the
105
+ * Takeal API's `/me/deposits` routes:
106
+ *
107
+ * POST /me/deposits → initiate
108
+ * GET /me/deposits → list (most recent first)
109
+ * GET /me/deposits/{id} → get
110
+ * POST /me/deposits/{id}/refunds → refund
111
+ *
112
+ * A deposit is rarely terminal on the initiate call: real PSPs return
113
+ * `redirect_required` (3DS / APM redirect) and flip to `confirmed` later via
114
+ * a connector → Takeal API inbound event. Poll `get(id)` or watch the user's
115
+ * webhook stream for the `deposit.confirmed` / `deposit.failed` outcome.
116
+ */
117
+ /**
118
+ * Lifecycle of a deposit. `redirect_required` carries `redirect_url`.
119
+ * `expired`: nobody paid before `expires_at`; the user starts over with a
120
+ * new quote. A payment that still arrives is credited at the stored rate
121
+ * and the deposit turns `confirmed` after all.
122
+ */
123
+ type DepositStatus = "pending" | "redirect_required" | "confirmed" | "failed" | "expired";
124
+ /**
125
+ * Top-up rail. The chosen funder decides which it supports; `sbp` is
126
+ * Russia's instant payments through a payment page, paid in roubles.
127
+ */
128
+ type DepositMethod = "card" | "crypto" | "bank_transfer" | "sbp";
129
+ /**
130
+ * A deposit record as the Takeal API returns it. Mirrors the `deposits` table; the
131
+ * server-side `id` is the stable handle the SDK polls against. `idempotency_key`
132
+ * and `request_fingerprint` are server-internal and never serialised.
133
+ */
134
+ /** Input for `quote()` — price a cross-currency deposit before paying. */
135
+ interface CreateQuoteInput {
136
+ /** Decimal string, e.g. `"5000.00"`. */
137
+ amount: string;
138
+ /** ISO 4217 source currency — must differ from the currency credited. */
139
+ currency: string;
140
+ /**
141
+ * Quote a top-up of this card: credited in the card's currency. Pass the
142
+ * same `card_id` to `initiate()`.
143
+ */
144
+ card_id?: string;
145
+ /**
146
+ * Quote into this currency instead of the wallet's: the currency of a
147
+ * card issued with the top-up (`issue_card`). Ignored with `card_id`.
148
+ */
149
+ target_currency?: string;
150
+ /**
151
+ * The funding connector the deposit will go through (`funder_slug` of
152
+ * `initiate()`). With `method`, the quote is priced on that method's own
153
+ * terms from `fundingOptions.list()`: its fee and kind, its rate source,
154
+ * its lifetime, its limits. Sent as `connector_slug`.
155
+ */
156
+ connectorSlug?: string;
157
+ /** The way the user pays. Pass the same method to `initiate()`. */
158
+ method?: DepositMethod;
159
+ }
160
+ /**
161
+ * How a method's fee reads. `spread`: taken off the credited amount at the
162
+ * deployment's rate. `markup`: in the rate the user sees, so show the rate
163
+ * and nothing else. `commission`: the rate is the provider's and the fee is
164
+ * a line of its own on the credited amount.
165
+ */
166
+ type FeeKind = "spread" | "markup" | "commission";
167
+ /** How far a top-up meant for a card has got. */
168
+ type CardLoadStatus = "pending" | "succeeded" | "failed";
169
+ /**
170
+ * A card to issue with the top-up: the fields of `cards.create` without
171
+ * its idempotency key (the deposit's covers both). The card's price is
172
+ * paid from the top-up and the rest becomes its starting balance.
173
+ */
174
+ type IssueCardInput = Omit<CreateCardInput, "idempotencyKey" | "currency"> & {
175
+ /** Optional with `productId`: the product names the currency. */
176
+ currency?: string;
177
+ };
178
+ /**
179
+ * A rate-locked funding quote: pay `source_amount source_currency`, the
180
+ * wallet is credited `credited_amount credited_currency` (net of the
181
+ * platform's conversion spread). Execute by passing `id` as `quote_id` to
182
+ * `initiate()` before `expires_at`; after that the API returns 409 and a new
183
+ * quote is needed.
184
+ */
185
+ interface FundingQuote {
186
+ id: string;
187
+ source_amount: string;
188
+ source_currency: string;
189
+ credited_amount: string;
190
+ credited_currency: string;
191
+ /**
192
+ * Provider rate before the fee, credited units per 1 source unit. The
193
+ * rate to show the user is `credited_amount / source_amount`, which has
194
+ * the fee in it; see the README for the rouble-per-dollar form.
195
+ */
196
+ rate: string;
197
+ /** The fee in basis points; the same figure as `fee_bps`, under its old name. */
198
+ spread_bps: number;
199
+ /** The fee in basis points (2000 = 20 %). */
200
+ fee_bps: number;
201
+ fee_kind: FeeKind;
202
+ provider: string;
203
+ /** The pair the quote was priced for, when the request named one. */
204
+ connector_slug?: string;
205
+ method?: DepositMethod;
206
+ /** The rate is locked until then; the deposit made with it waits for its payment as long. */
207
+ expires_at: string;
208
+ }
209
+ interface Deposit {
210
+ id: string;
211
+ user_id: string;
212
+ /** Slug of the funder that handled this deposit, as configured by the deployment. */
213
+ connector_slug: string;
214
+ /** The connector's own reference, populated once it responds. */
215
+ provider_reference: string | null;
216
+ status: DepositStatus;
217
+ /** Decimal serialised as a string to avoid float drift. */
218
+ amount: string;
219
+ currency: string;
220
+ method: DepositMethod;
221
+ /** Present when `status === "redirect_required"` — send the user here. */
222
+ redirect_url: string | null;
223
+ failure_reason: string | null;
224
+ /** Final settled amount once confirmed (may differ from `amount` on FX). */
225
+ confirmed_amount: string | null;
226
+ confirmed_at: string | null;
227
+ /** Set on cross-currency deposits: the quote this deposit executed against. */
228
+ quote_id?: string | null;
229
+ /** Locked provider rate (credited units per 1 source unit). */
230
+ fx_rate?: string | null;
231
+ fx_spread_bps?: number | null;
232
+ /** How `fx_spread_bps` was taken; see `FeeKind`. */
233
+ fx_fee_kind?: FeeKind | null;
234
+ /** When the deposit stops waiting for its payment; `null` for one without a term. */
235
+ expires_at?: string | null;
236
+ /** The wallet's local currency the deposit converted into. */
237
+ credited_currency?: string | null;
238
+ /** What the wallet was actually credited, net of spread. */
239
+ credited_amount?: string | null;
240
+ /** Bonuses added on top of the top-up, when any were. */
241
+ bonus_units?: string | null;
242
+ /** What those bonuses added to the wallet, in the credited currency. */
243
+ bonus_value?: string | null;
244
+ /** The promo code the top-up was made with; its discount came off the commission. */
245
+ promo_code?: string | null;
246
+ /** Where the money goes. Older deployments leave it out: the wallet. */
247
+ target?: DepositTarget;
248
+ /** For a top-up onto a card: the card. */
249
+ card_id?: string | null;
250
+ /** The funding connector's mode when the top-up was made. */
251
+ funder_mode?: FunderMode | null;
252
+ /** True when the card was issued with this top-up. */
253
+ issues_card?: boolean;
254
+ /**
255
+ * For a top-up onto a card: `pending` until the card provider has loaded
256
+ * the card, then `succeeded` or `failed`. Show the top-up as done only
257
+ * once it is `succeeded`, or once `returned_to_wallet_at` is set.
258
+ */
259
+ card_load_status?: CardLoadStatus | null;
260
+ /** Why the card could not take it, when `card_load_status` is `failed`. */
261
+ card_load_error?: string | null;
262
+ /** What went towards the card, in its currency, bonuses included. */
263
+ card_amount?: string | null;
264
+ /** The commission taken from a top-up onto a card, in the card's currency. */
265
+ card_commission?: string | null;
266
+ /** The money part of the price of a card issued with the top-up. */
267
+ issue_fee?: string | null;
268
+ /** The bonus part of that price. */
269
+ issue_bonus_units?: string | null;
270
+ issue_bonus_value?: string | null;
271
+ card_loaded_at?: string | null;
272
+ /**
273
+ * Set when the card could not take the top-up and the money went to the
274
+ * wallet instead (funding connectors in `mixed` mode). The user is told.
275
+ */
276
+ returned_to_wallet_at?: string | null;
277
+ created_at: string;
278
+ updated_at: string;
279
+ }
280
+ interface InitiateDepositInput {
281
+ /** Decimal as a string (`"100.00"`) — avoids float-precision loss on the wire. */
282
+ amount: string;
283
+ /** ISO 4217 code, e.g. `"USD"`. */
284
+ currency: string;
285
+ method: DepositMethod;
286
+ /**
287
+ * Optional. Slug of a specific funder to route through. Omit to
288
+ * let the Takeal API pick the first active funder. Unknown slug → 400; empty
289
+ * funder list → 503.
290
+ */
291
+ funder_slug?: string;
292
+ /**
293
+ * Passed to the funding connector and stored with the deposit. Two keys
294
+ * work across connectors: `return_url`, where the provider sends the user
295
+ * back after a 3-D Secure step (pair it with `redirect_required`), and on
296
+ * test deployments with the mock funder `mock_scenario`, which picks the
297
+ * outcome: `happy` (confirmed at once, the default), `pending` (confirmed
298
+ * about 15 s later), `redirect` (a hosted page where the user approves or
299
+ * declines), `late` (paid after the term) or `fail`.
300
+ */
301
+ metadata?: Record<string, string>;
302
+ /** Structured billing details — real PSPs require these for 3DS / compliance. */
303
+ customer?: CustomerInfo;
304
+ /**
305
+ * Required by the Takeal API on this write endpoint. Same key + body replays the
306
+ * original deposit; same key + different body returns 409. Supply a stable
307
+ * UUID per logical attempt so a retried network call is safe.
308
+ */
309
+ idempotencyKey: string;
310
+ /**
311
+ * Required when `currency` differs from the wallet's local currency: a
312
+ * fresh quote id from `quote()`. Cross-currency deposits without one are
313
+ * rejected with 400; expired quotes with 409.
314
+ */
315
+ quote_id?: string;
316
+ /**
317
+ * Add bonuses on top of the top-up: the user pays `amount`, the wallet
318
+ * gets `amount` plus what the bonuses add. On by default whenever the
319
+ * user has bonuses that can go to a top-up (only ones that came with a
320
+ * payment can); `false` tops up without them.
321
+ */
322
+ use_bonus?: boolean;
323
+ /** The most bonuses to add, decimal string. Omit to add as many as allowed. */
324
+ bonus_amount?: string;
325
+ /**
326
+ * Top up this card instead of the wallet. It must be the user's, active
327
+ * and prepaid. A funding connector that tops up the wallet only answers
328
+ * 400 `target_not_allowed`; one that tops up cards only needs `card_id`
329
+ * or `issue_card`. Paying in another currency than the card's needs a
330
+ * quote made with the same `card_id`.
331
+ */
332
+ card_id?: string;
333
+ /**
334
+ * Issue a new card and put this top-up on it. The card shows up as
335
+ * `pending_payment` and is issued once the top-up is confirmed; if the
336
+ * top-up fails, so does the card. Too small to cover the price → 400
337
+ * `amount_too_small`. Not together with `card_id`.
338
+ */
339
+ issue_card?: IssueCardInput;
340
+ /**
341
+ * A promo code for this top-up, to the wallet or to a card. Its discount
342
+ * comes off the commission; bonuses or a gift that come with the code
343
+ * arrive once the top-up is confirmed. A code that can't be used fails the
344
+ * request with 400 `promo_code_*` and the reason. `client.codes.validate`
345
+ * checks it first.
346
+ */
347
+ promo_code?: string;
348
+ }
349
+ interface CreateDepositRefundInput {
350
+ /** Omit for a full refund of the original confirmed amount; same currency. */
351
+ amount?: string;
352
+ /** Human-readable reason, e.g. `"customer_request"`. */
353
+ reason?: string;
354
+ metadata?: Record<string, string>;
355
+ /** Required. Replays are keyed on this. */
356
+ idempotencyKey: string;
357
+ }
358
+ /** A refund row as the Takeal API returns it (`refunds` table, deposit-targeted). */
359
+ interface Refund {
360
+ id: string;
361
+ target_type: string;
362
+ deposit_id?: string;
363
+ payment_id?: string;
364
+ connector_slug: string;
365
+ amount: string;
366
+ currency: string;
367
+ reason: string;
368
+ status: string;
369
+ provider_refund_reference?: string;
370
+ failure_reason?: string;
371
+ requestor_type: string;
372
+ requestor_id: string;
373
+ created_at: string;
374
+ updated_at: string;
375
+ }
376
+ declare class DepositsResource {
377
+ private readonly http;
378
+ constructor(http: HttpClient);
379
+ /**
380
+ * Initiate a top-up. Resolves to the freshly-created `Deposit`, whose
381
+ * `status` may already be `confirmed` (synchronous rails / mock) or
382
+ * `redirect_required` (3DS / APM — forward the user to `redirect_url`).
383
+ */
384
+ /**
385
+ * Price a cross-currency deposit BEFORE paying. The rate is locked
386
+ * server-side until `expires_at`; deposits already in the currency they
387
+ * credit (the wallet's, or the card's with `card_id`) need no quote (the
388
+ * API answers 400 `no_quote_needed`).
389
+ */
390
+ quote(input: CreateQuoteInput): Promise<FundingQuote>;
391
+ initiate(input: InitiateDepositInput): Promise<Deposit>;
392
+ /** Fetch one deposit by id — the poll target while a redirect resolves. */
393
+ get(id: string): Promise<Deposit>;
394
+ /** List the caller's deposits, most recent first. */
395
+ list(): Promise<Deposit[]>;
396
+ /**
397
+ * Refund a previously-confirmed deposit. Synchronous when the
398
+ * connector settles inline; otherwise the row stays `pending` and flips
399
+ * later via the inbound `deposit.refunded` event.
400
+ */
401
+ refund(depositId: string, input: CreateDepositRefundInput): Promise<Refund>;
402
+ }
403
+
35
404
  /**
36
405
  * Cards resource — `client.cards.*`.
37
406
  *
@@ -318,6 +687,56 @@ interface CreateCardInput {
318
687
  declare function cardRequestBody(input: Omit<CreateCardInput, "idempotencyKey" | "currency"> & {
319
688
  currency?: string;
320
689
  }): Record<string, unknown>;
690
+ /**
691
+ * A card bought in one step with {@link CardsResource.order}: the product and
692
+ * how the user pays. The platform works out the amount to pay in the
693
+ * payment's currency, locks the rate and opens the top-up that issues the
694
+ * card.
695
+ */
696
+ interface CardOrderInput {
697
+ /** A product id from {@link CardsResource.listProducts}. Sent as `product_id`. */
698
+ productId: string;
699
+ /** One of the product's designs; omit for its default. Sent as `design_id`. */
700
+ designId?: string;
701
+ /** A name for the card, 1 to 40 characters; defaults to the product name. */
702
+ name?: string;
703
+ /** How the user pays, e.g. `"sbp"`. */
704
+ method: DepositMethod;
705
+ /** The funding connector to pay through; omit to let the API pick one that takes `method`. Sent as `funder_slug`. */
706
+ funderSlug?: string;
707
+ /** ISO 4217 code of the payment; defaults to the currency the method is priced in. */
708
+ currency?: string;
709
+ /** Money to put on the card on top of its price, decimal string in the card's currency. Sent as `extra_load`. */
710
+ extraLoad?: string;
711
+ /** A promo code for the payment. Sent as `promo_code`. */
712
+ promoCode?: string;
713
+ /** Pay part of the price with bonuses; on by default. Sent as `use_bonus`. */
714
+ useBonus?: boolean;
715
+ /** Consents given with the order. */
716
+ consents?: ConsentKind[];
717
+ /** Where they were given. Sent as `consent_channel`. */
718
+ consentChannel?: ConsentChannel;
719
+ /** Passed to the payment provider; `return_url` is where the payment page sends the user back. */
720
+ metadata?: Record<string, string>;
721
+ }
722
+ /** What {@link CardsResource.order} returns: the top-up to pay and its price. */
723
+ interface CardOrder {
724
+ /** Send the user to `deposit.redirect_url` when `deposit.status` is `redirect_required`. The card is issued once the payment is confirmed. */
725
+ deposit: Deposit;
726
+ /** What the user pays, decimal string, in `currency`. */
727
+ amount: string;
728
+ currency: string;
729
+ /** What reaches the card: its price plus its starting balance, in `card_currency`. */
730
+ card_amount: string;
731
+ card_currency: string;
732
+ }
733
+ /** Why a card ordered with the sign-up was not placed. The account exists all the same. */
734
+ interface CardOrderError {
735
+ code: string;
736
+ message: string;
737
+ }
738
+ /** Build the API body of a card order. */
739
+ declare function cardOrderBody(input: CardOrderInput): Record<string, unknown>;
321
740
  /** Remaining balance of a prepaid card. */
322
741
  interface CardBalance {
323
742
  amount: string;
@@ -531,6 +950,18 @@ declare class CardsResource {
531
950
  * `failure_reason` on the result.
532
951
  */
533
952
  create(input: CreateCardInput): Promise<Card>;
953
+ /**
954
+ * Buy a card in one step: the API prices the product in the payment's
955
+ * currency, locks the rate and opens the top-up that issues the card.
956
+ * Send the user to `order.deposit.redirect_url`; the card shows as
957
+ * `pending_payment` until the payment is confirmed. The same
958
+ * `idempotencyKey` returns the same order.
959
+ * Errors: 400 `unknown_product` / `method_not_available` / a limit of the
960
+ * way of paying, 503 no funding connector or no exchange rate.
961
+ */
962
+ order(input: CardOrderInput & {
963
+ idempotencyKey: string;
964
+ }): Promise<CardOrder>;
534
965
  /**
535
966
  * The cards the caller can order, in the order the storefront shows them
536
967
  * (`is_default` marks the one issued when none is chosen). Each item
@@ -645,4 +1076,4 @@ declare class CardsResource {
645
1076
  terminate(id: string, reason?: string): Promise<Card>;
646
1077
  }
647
1078
 
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 };
1079
+ export { type Address as A, type BillingAddress as B, type CardProduct as C, type Deposit as D, type FeeKind as E, FundingOptionsResource as F, type FunderMode as G, type FundingOption as H, type FundingQuote as I, type InitiateDepositInput as J, type IssuanceBonus as K, type IssueCardInput as L, type MethodTerms as M, type RevealCardInput as N, type RevealedCard as O, type TopUpResult as P, type TopUpTerms as Q, type Refund as R, type SetPinInput as S, type TopUpInput as T, type TransferInput as U, type TransferResult as V, type UpdateCardInput as W, cardOrderBody as X, cardRequestBody as Y, type Card as a, DepositsResource as b, CardsResource as c, type CardBalance as d, type CardDesignRef as e, type CardForm as f, type CardLoadStatus as g, type CardOrder as h, type CardOrderError as i, type CardOrderInput as j, type CardProductPrice as k, type CardStatus as l, type CardStatusSource as m, type CardTopUp as n, type CardTopUpStatus as o, type CardTransfer as p, type CardType as q, type Cardholder as r, type CloseBlockedReason as s, type CreateCardInput as t, type CreateDepositRefundInput as u, type CreateQuoteInput as v, type CustomerInfo as w, type DepositMethod as x, type DepositStatus as y, type DepositTarget as z };