@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.
- package/CHANGELOG.md +39 -0
- package/README.md +166 -1
- package/dist/{cards-Ba1wZttb.d.ts → cards-CF3-He2x.d.ts} +144 -20
- package/dist/{cards-B_aNY35J.d.cts → cards-qfHz6xZY.d.cts} +144 -20
- package/dist/{deposits-DScyT_D9.d.ts → deposits-B2LBe2k1.d.ts} +71 -8
- package/dist/{deposits-BEc8U80M.d.cts → deposits-ZjT_btgi.d.cts} +71 -8
- package/dist/index.cjs +36 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +36 -9
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/resources/cards.cjs +30 -6
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/cards.d.cts +1 -1
- package/dist/resources/cards.d.ts +1 -1
- package/dist/resources/cards.js +30 -6
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/deposits.cjs +4 -1
- package/dist/resources/deposits.cjs.map +1 -1
- package/dist/resources/deposits.d.cts +2 -2
- package/dist/resources/deposits.d.ts +2 -2
- package/dist/resources/deposits.js +4 -1
- package/dist/resources/deposits.js.map +1 -1
- package/dist/resources/funding-options.cjs.map +1 -1
- package/dist/resources/funding-options.d.cts +2 -2
- package/dist/resources/funding-options.d.ts +2 -2
- package/dist/resources/funding-options.js.map +1 -1
- package/dist/telegram.cjs +36 -9
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +2 -2
- package/dist/telegram.d.ts +2 -2
- package/dist/telegram.js +36 -9
- package/dist/telegram.js.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
|
74
|
-
*
|
|
75
|
-
*
|
|
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
|
|
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:
|
|
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
|
-
/**
|
|
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}
|
|
486
|
-
* `
|
|
487
|
-
*
|
|
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
|
-
*
|
|
501
|
-
*
|
|
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
|
-
/**
|
|
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
|
|
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { H as HttpClient } from './http-DeANAoTs.js';
|
|
2
|
-
import {
|
|
2
|
+
import { p as CustomerInfo, o as CreateCardInput } from './cards-CF3-He2x.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
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
/**
|
|
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
|
|
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.cjs';
|
|
2
|
-
import {
|
|
2
|
+
import { p as CustomerInfo, o as CreateCardInput } from './cards-qfHz6xZY.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
|
-
/**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
/**
|
|
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
|
|
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 };
|
package/dist/index.cjs
CHANGED
|
@@ -476,9 +476,11 @@ var CardsResource = class {
|
|
|
476
476
|
});
|
|
477
477
|
}
|
|
478
478
|
/**
|
|
479
|
-
* Freeze the caller's own card. Reversible via {@link unfreeze}
|
|
480
|
-
* `
|
|
481
|
-
*
|
|
479
|
+
* Freeze the caller's own card. Reversible via {@link unfreeze} while
|
|
480
|
+
* `status_source` is `holder` or `operator`. The optional `reason` is
|
|
481
|
+
* recorded on the audit trail. Resolves to the updated card. 404 if the
|
|
482
|
+
* card isn't the caller's; 409 `card_locked` when support holds it; 501 if
|
|
483
|
+
* the issuer can't freeze.
|
|
482
484
|
*/
|
|
483
485
|
async freeze(id, reason) {
|
|
484
486
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/freeze`, { body: { reason } });
|
|
@@ -493,16 +495,38 @@ var CardsResource = class {
|
|
|
493
495
|
* keep the result in volatile memory only, never write it to
|
|
494
496
|
* localStorage / logs, and clear it within `expires_in_seconds`.
|
|
495
497
|
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
+
* The result is the numbers, or `reveal_url` with empty `pan` and `cvv`
|
|
499
|
+
* when the issuer shows them on a page of its own: open that page in a
|
|
500
|
+
* frame right away, it is short-lived.
|
|
501
|
+
*
|
|
502
|
+
* 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
|
|
503
|
+
* has no sensitive-data endpoint · 503 `provider_unavailable`.
|
|
498
504
|
*/
|
|
499
505
|
async reveal(id, _input) {
|
|
500
506
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/reveal`);
|
|
501
507
|
}
|
|
502
|
-
/**
|
|
508
|
+
/**
|
|
509
|
+
* Unfreeze a previously-frozen card. Idempotent on an already-active card.
|
|
510
|
+
* A card the issuer froze (`status_source: "provider"`) is not the
|
|
511
|
+
* holder's to unfreeze: the API answers 409 `card_locked`, so hide the
|
|
512
|
+
* button and say the freeze is lifted through the issuer's support.
|
|
513
|
+
*/
|
|
503
514
|
async unfreeze(id) {
|
|
504
515
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/unfreeze`, { body: {} });
|
|
505
516
|
}
|
|
517
|
+
/**
|
|
518
|
+
* Set the PIN of the caller's own physical card. The session is enough; the
|
|
519
|
+
* call is rate-limited like {@link reveal} and the PIN is kept nowhere.
|
|
520
|
+
* Resolves to the card; the user also gets a notification that the PIN
|
|
521
|
+
* was set. 400 not four to six digits or the card is not active · 403 not
|
|
522
|
+
* your card · 409 `card_locked`, or `provider_refused` when the issuer did
|
|
523
|
+
* not take it · 429 too many attempts · 501 a virtual card has no PIN.
|
|
524
|
+
*/
|
|
525
|
+
async setPin(id, input) {
|
|
526
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/pin`, {
|
|
527
|
+
body: { pin: input.pin }
|
|
528
|
+
});
|
|
529
|
+
}
|
|
506
530
|
/**
|
|
507
531
|
* Terminate the caller's own card. **One-way** — a terminated card cannot be
|
|
508
532
|
* reactivated. The optional `reason` is audited. Idempotent on an
|
|
@@ -532,7 +556,10 @@ var DepositsResource = class {
|
|
|
532
556
|
* API answers 400 `no_quote_needed`).
|
|
533
557
|
*/
|
|
534
558
|
async quote(input) {
|
|
535
|
-
|
|
559
|
+
const { connectorSlug, ...rest } = input;
|
|
560
|
+
const body = { ...rest };
|
|
561
|
+
if (connectorSlug !== void 0) body["connector_slug"] = connectorSlug;
|
|
562
|
+
return this.http.post("/me/deposits/quotes", { body });
|
|
536
563
|
}
|
|
537
564
|
async initiate(input) {
|
|
538
565
|
const { idempotencyKey, issue_card, ...rest } = input;
|
|
@@ -1147,7 +1174,7 @@ var FundingOptionsResource = class {
|
|
|
1147
1174
|
};
|
|
1148
1175
|
|
|
1149
1176
|
// src/version.ts
|
|
1150
|
-
var SDK_VERSION = "0.6.
|
|
1177
|
+
var SDK_VERSION = "0.6.1";
|
|
1151
1178
|
|
|
1152
1179
|
// src/client-platform.ts
|
|
1153
1180
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1222,7 +1249,7 @@ function isAbsolute(url) {
|
|
|
1222
1249
|
}
|
|
1223
1250
|
|
|
1224
1251
|
// src/compat.ts
|
|
1225
|
-
var SUPPORTED_MEISTER = ">=0.
|
|
1252
|
+
var SUPPORTED_MEISTER = ">=0.6.4, <0.7.0";
|
|
1226
1253
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1227
1254
|
function parse(v) {
|
|
1228
1255
|
const m = SEMVER.exec(v.trim());
|