@takeal/cusfront-sdk 0.6.2 → 0.6.3

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 +15 -0
  2. package/README.md +32 -0
  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 +241 -205
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +4 -6
  8. package/dist/index.d.ts +4 -6
  9. package/dist/index.js +241 -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 +23 -1
  14. package/dist/resources/auth.cjs.map +1 -1
  15. package/dist/resources/auth.d.cts +13 -2
  16. package/dist/resources/auth.d.ts +13 -2
  17. package/dist/resources/auth.js +23 -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 +241 -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 +241 -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
@@ -1,373 +0,0 @@
1
- import { H as HttpClient } from './http-DeANAoTs.js';
2
- import { p as CustomerInfo, o as CreateCardInput } from './cards-DzhPVA9N.js';
3
-
4
- /**
5
- * Funding options resource — `client.fundingOptions.*`.
6
- *
7
- * The ways the user can top up on this deployment: each funding connector,
8
- * where its top-ups may land and which payment methods it takes. Build the
9
- * top-up screen from this list instead of fixed connector names: a
10
- * deployment may top up the wallet only, cards only (no wallet at all), or
11
- * let the user choose.
12
- *
13
- * Mirrors `GET /me/funding-options`.
14
- */
15
- /**
16
- * Where a funding connector's top-ups may land: `wallet` (the wallet
17
- * only), `spool` (straight onto cards only) or `mixed` (either).
18
- */
19
- type FunderMode = "wallet" | "spool" | "mixed";
20
- /** Where one top-up goes: the wallet, or one of the user's cards. */
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
- }
43
- /** One way to top up. */
44
- interface FundingOption {
45
- /** Pass it as `funder_slug` to `deposits.initiate`. */
46
- slug: string;
47
- mode: FunderMode;
48
- /** Where a top-up through it may land. */
49
- targets: DepositTarget[];
50
- /** Payment methods it takes. */
51
- methods: DepositMethod[];
52
- /**
53
- * Whether a new card can be issued with a top-up through it
54
- * (`issue_card` on `deposits.initiate`).
55
- */
56
- issue_card: boolean;
57
- /** The terms of each method in `methods`. */
58
- method_terms: MethodTerms[];
59
- }
60
- declare class FundingOptionsResource {
61
- private readonly http;
62
- constructor(http: HttpClient);
63
- /** The ways to top up, preferred first. Empty when none is configured. */
64
- list(): Promise<FundingOption[]>;
65
- }
66
-
67
- /**
68
- * Deposits resource — `client.deposits.*`.
69
- *
70
- * The "money IN" surface: an end user tops up their wallet balance via a
71
- * funder connector, or one of their cards straight away, past the wallet
72
- * (`card_id`, or `issue_card` for a new card). Which of the two a
73
- * deployment allows is in `client.fundingOptions.list()`. Mirrors the
74
- * Takeal API's `/me/deposits` routes:
75
- *
76
- * POST /me/deposits → initiate
77
- * GET /me/deposits → list (most recent first)
78
- * GET /me/deposits/{id} → get
79
- * POST /me/deposits/{id}/refunds → refund
80
- *
81
- * A deposit is rarely terminal on the initiate call: real PSPs return
82
- * `redirect_required` (3DS / APM redirect) and flip to `confirmed` later via
83
- * a connector → Takeal API inbound event. Poll `get(id)` or watch the user's
84
- * webhook stream for the `deposit.confirmed` / `deposit.failed` outcome.
85
- */
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";
98
- /**
99
- * A deposit record as the Takeal API returns it. Mirrors the `deposits` table; the
100
- * server-side `id` is the stable handle the SDK polls against. `idempotency_key`
101
- * and `request_fingerprint` are server-internal and never serialised.
102
- */
103
- /** Input for `quote()` — price a cross-currency deposit before paying. */
104
- interface CreateQuoteInput {
105
- /** Decimal string, e.g. `"5000.00"`. */
106
- amount: string;
107
- /** ISO 4217 source currency — must differ from the currency credited. */
108
- currency: string;
109
- /**
110
- * Quote a top-up of this card: credited in the card's currency. Pass the
111
- * same `card_id` to `initiate()`.
112
- */
113
- card_id?: string;
114
- /**
115
- * Quote into this currency instead of the wallet's: the currency of a
116
- * card issued with the top-up (`issue_card`). Ignored with `card_id`.
117
- */
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;
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";
136
- /** How far a top-up meant for a card has got. */
137
- type CardLoadStatus = "pending" | "succeeded" | "failed";
138
- /**
139
- * A card to issue with the top-up: the fields of `cards.create` without
140
- * its idempotency key (the deposit's covers both). The card's price is
141
- * paid from the top-up and the rest becomes its starting balance.
142
- */
143
- type IssueCardInput = Omit<CreateCardInput, "idempotencyKey" | "currency"> & {
144
- /** Optional with `productId`: the product names the currency. */
145
- currency?: string;
146
- };
147
- /**
148
- * A rate-locked funding quote: pay `source_amount source_currency`, the
149
- * wallet is credited `credited_amount credited_currency` (net of the
150
- * platform's conversion spread). Execute by passing `id` as `quote_id` to
151
- * `initiate()` before `expires_at`; after that the API returns 409 and a new
152
- * quote is needed.
153
- */
154
- interface FundingQuote {
155
- id: string;
156
- source_amount: string;
157
- source_currency: string;
158
- credited_amount: string;
159
- credited_currency: string;
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
- */
165
- rate: string;
166
- /** The fee in basis points; the same figure as `fee_bps`, under its old name. */
167
- spread_bps: number;
168
- /** The fee in basis points (2000 = 20 %). */
169
- fee_bps: number;
170
- fee_kind: FeeKind;
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. */
176
- expires_at: string;
177
- }
178
- interface Deposit {
179
- id: string;
180
- user_id: string;
181
- /** Slug of the funder that handled this deposit, as configured by the deployment. */
182
- connector_slug: string;
183
- /** The connector's own reference, populated once it responds. */
184
- provider_reference: string | null;
185
- status: DepositStatus;
186
- /** Decimal serialised as a string to avoid float drift. */
187
- amount: string;
188
- currency: string;
189
- method: DepositMethod;
190
- /** Present when `status === "redirect_required"` — send the user here. */
191
- redirect_url: string | null;
192
- failure_reason: string | null;
193
- /** Final settled amount once confirmed (may differ from `amount` on FX). */
194
- confirmed_amount: string | null;
195
- confirmed_at: string | null;
196
- /** Set on cross-currency deposits: the quote this deposit executed against. */
197
- quote_id?: string | null;
198
- /** Locked provider rate (credited units per 1 source unit). */
199
- fx_rate?: string | null;
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;
205
- /** The wallet's local currency the deposit converted into. */
206
- credited_currency?: string | null;
207
- /** What the wallet was actually credited, net of spread. */
208
- credited_amount?: string | null;
209
- /** Bonuses added on top of the top-up, when any were. */
210
- bonus_units?: string | null;
211
- /** What those bonuses added to the wallet, in the credited currency. */
212
- bonus_value?: string | null;
213
- /** The promo code the top-up was made with; its discount came off the commission. */
214
- promo_code?: string | null;
215
- /** Where the money goes. Older deployments leave it out: the wallet. */
216
- target?: DepositTarget;
217
- /** For a top-up onto a card: the card. */
218
- card_id?: string | null;
219
- /** The funding connector's mode when the top-up was made. */
220
- funder_mode?: FunderMode | null;
221
- /** True when the card was issued with this top-up. */
222
- issues_card?: boolean;
223
- /**
224
- * For a top-up onto a card: `pending` until the card provider has loaded
225
- * the card, then `succeeded` or `failed`. Show the top-up as done only
226
- * once it is `succeeded`, or once `returned_to_wallet_at` is set.
227
- */
228
- card_load_status?: CardLoadStatus | null;
229
- /** Why the card could not take it, when `card_load_status` is `failed`. */
230
- card_load_error?: string | null;
231
- /** What went towards the card, in its currency, bonuses included. */
232
- card_amount?: string | null;
233
- /** The commission taken from a top-up onto a card, in the card's currency. */
234
- card_commission?: string | null;
235
- /** The money part of the price of a card issued with the top-up. */
236
- issue_fee?: string | null;
237
- /** The bonus part of that price. */
238
- issue_bonus_units?: string | null;
239
- issue_bonus_value?: string | null;
240
- card_loaded_at?: string | null;
241
- /**
242
- * Set when the card could not take the top-up and the money went to the
243
- * wallet instead (funding connectors in `mixed` mode). The user is told.
244
- */
245
- returned_to_wallet_at?: string | null;
246
- created_at: string;
247
- updated_at: string;
248
- }
249
- interface InitiateDepositInput {
250
- /** Decimal as a string (`"100.00"`) — avoids float-precision loss on the wire. */
251
- amount: string;
252
- /** ISO 4217 code, e.g. `"USD"`. */
253
- currency: string;
254
- method: DepositMethod;
255
- /**
256
- * Optional. Slug of a specific funder to route through. Omit to
257
- * let the Takeal API pick the first active funder. Unknown slug → 400; empty
258
- * funder list → 503.
259
- */
260
- funder_slug?: string;
261
- /**
262
- * Passed to the funding connector and stored with the deposit. Two keys
263
- * work across connectors: `return_url`, where the provider sends the user
264
- * back after a 3-D Secure step (pair it with `redirect_required`), and on
265
- * test deployments with the mock funder `mock_scenario`, which picks the
266
- * outcome: `happy` (confirmed at once, the default), `pending` (confirmed
267
- * about 15 s later), `redirect` (a hosted page where the user approves or
268
- * declines), `late` (paid after the term) or `fail`.
269
- */
270
- metadata?: Record<string, string>;
271
- /** Structured billing details — real PSPs require these for 3DS / compliance. */
272
- customer?: CustomerInfo;
273
- /**
274
- * Required by the Takeal API on this write endpoint. Same key + body replays the
275
- * original deposit; same key + different body returns 409. Supply a stable
276
- * UUID per logical attempt so a retried network call is safe.
277
- */
278
- idempotencyKey: string;
279
- /**
280
- * Required when `currency` differs from the wallet's local currency: a
281
- * fresh quote id from `quote()`. Cross-currency deposits without one are
282
- * rejected with 400; expired quotes with 409.
283
- */
284
- quote_id?: string;
285
- /**
286
- * Add bonuses on top of the top-up: the user pays `amount`, the wallet
287
- * gets `amount` plus what the bonuses add. On by default whenever the
288
- * user has bonuses that can go to a top-up (only ones that came with a
289
- * payment can); `false` tops up without them.
290
- */
291
- use_bonus?: boolean;
292
- /** The most bonuses to add, decimal string. Omit to add as many as allowed. */
293
- bonus_amount?: string;
294
- /**
295
- * Top up this card instead of the wallet. It must be the user's, active
296
- * and prepaid. A funding connector that tops up the wallet only answers
297
- * 400 `target_not_allowed`; one that tops up cards only needs `card_id`
298
- * or `issue_card`. Paying in another currency than the card's needs a
299
- * quote made with the same `card_id`.
300
- */
301
- card_id?: string;
302
- /**
303
- * Issue a new card and put this top-up on it. The card shows up as
304
- * `pending_payment` and is issued once the top-up is confirmed; if the
305
- * top-up fails, so does the card. Too small to cover the price → 400
306
- * `amount_too_small`. Not together with `card_id`.
307
- */
308
- issue_card?: IssueCardInput;
309
- /**
310
- * A promo code for this top-up, to the wallet or to a card. Its discount
311
- * comes off the commission; bonuses or a gift that come with the code
312
- * arrive once the top-up is confirmed. A code that can't be used fails the
313
- * request with 400 `promo_code_*` and the reason. `client.codes.validate`
314
- * checks it first.
315
- */
316
- promo_code?: string;
317
- }
318
- interface CreateDepositRefundInput {
319
- /** Omit for a full refund of the original confirmed amount; same currency. */
320
- amount?: string;
321
- /** Human-readable reason, e.g. `"customer_request"`. */
322
- reason?: string;
323
- metadata?: Record<string, string>;
324
- /** Required. Replays are keyed on this. */
325
- idempotencyKey: string;
326
- }
327
- /** A refund row as the Takeal API returns it (`refunds` table, deposit-targeted). */
328
- interface Refund {
329
- id: string;
330
- target_type: string;
331
- deposit_id?: string;
332
- payment_id?: string;
333
- connector_slug: string;
334
- amount: string;
335
- currency: string;
336
- reason: string;
337
- status: string;
338
- provider_refund_reference?: string;
339
- failure_reason?: string;
340
- requestor_type: string;
341
- requestor_id: string;
342
- created_at: string;
343
- updated_at: string;
344
- }
345
- declare class DepositsResource {
346
- private readonly http;
347
- constructor(http: HttpClient);
348
- /**
349
- * Initiate a top-up. Resolves to the freshly-created `Deposit`, whose
350
- * `status` may already be `confirmed` (synchronous rails / mock) or
351
- * `redirect_required` (3DS / APM — forward the user to `redirect_url`).
352
- */
353
- /**
354
- * Price a cross-currency deposit BEFORE paying. The rate is locked
355
- * server-side until `expires_at`; deposits already in the currency they
356
- * credit (the wallet's, or the card's with `card_id`) need no quote (the
357
- * API answers 400 `no_quote_needed`).
358
- */
359
- quote(input: CreateQuoteInput): Promise<FundingQuote>;
360
- initiate(input: InitiateDepositInput): Promise<Deposit>;
361
- /** Fetch one deposit by id — the poll target while a redirect resolves. */
362
- get(id: string): Promise<Deposit>;
363
- /** List the caller's deposits, most recent first. */
364
- list(): Promise<Deposit[]>;
365
- /**
366
- * Refund a previously-confirmed deposit. Synchronous when the
367
- * connector settles inline; otherwise the row stays `pending` and flips
368
- * later via the inbound `deposit.refunded` event.
369
- */
370
- refund(depositId: string, input: CreateDepositRefundInput): Promise<Refund>;
371
- }
372
-
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 };