@takeal/cusfront-sdk 0.6.4 → 0.6.6
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 +46 -0
- package/README.md +182 -3
- package/dist/{cards-ofoGRU9v.d.cts → cards-BiXmrz7h.d.cts} +126 -11
- package/dist/{cards-BrqeBqLV.d.ts → cards-DwmzjKDC.d.ts} +126 -11
- package/dist/{devices-B_YveTl9.d.ts → devices-C88c38hm.d.ts} +1 -1
- package/dist/{devices-a5Z45Mx_.d.cts → devices-CiJrlXum.d.cts} +1 -1
- package/dist/{http-DeANAoTs.d.cts → http-CL97TjMO.d.cts} +4 -0
- package/dist/{http-DeANAoTs.d.ts → http-CL97TjMO.d.ts} +4 -0
- package/dist/index.cjs +200 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -10
- package/dist/index.d.ts +22 -10
- package/dist/index.js +199 -16
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +6 -3
- package/dist/react/index.d.ts +6 -3
- package/dist/resources/attribution.d.cts +1 -1
- package/dist/resources/attribution.d.ts +1 -1
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +2 -2
- package/dist/resources/auth.d.ts +2 -2
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/balance.d.cts +1 -1
- package/dist/resources/balance.d.ts +1 -1
- package/dist/resources/blog.d.cts +1 -1
- package/dist/resources/blog.d.ts +1 -1
- package/dist/resources/bonus.d.cts +1 -1
- package/dist/resources/bonus.d.ts +1 -1
- package/dist/resources/branding.d.cts +1 -1
- package/dist/resources/branding.d.ts +1 -1
- package/dist/resources/cards.cjs +9 -2
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/cards.d.cts +2 -2
- package/dist/resources/cards.d.ts +2 -2
- package/dist/resources/cards.js +9 -2
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/close-requests.cjs +54 -0
- package/dist/resources/close-requests.cjs.map +1 -0
- package/dist/resources/close-requests.d.cts +155 -0
- package/dist/resources/close-requests.d.ts +155 -0
- package/dist/resources/close-requests.js +52 -0
- package/dist/resources/close-requests.js.map +1 -0
- package/dist/resources/codes.d.cts +1 -1
- package/dist/resources/codes.d.ts +1 -1
- package/dist/resources/consents.cjs +42 -7
- package/dist/resources/consents.cjs.map +1 -1
- package/dist/resources/consents.d.cts +59 -9
- package/dist/resources/consents.d.ts +59 -9
- package/dist/resources/consents.js +41 -8
- package/dist/resources/consents.js.map +1 -1
- package/dist/resources/debt.cjs +22 -0
- package/dist/resources/debt.cjs.map +1 -0
- package/dist/resources/debt.d.cts +76 -0
- package/dist/resources/debt.d.ts +76 -0
- package/dist/resources/debt.js +20 -0
- package/dist/resources/debt.js.map +1 -0
- 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.map +1 -1
- package/dist/resources/devices.d.cts +2 -2
- package/dist/resources/devices.d.ts +2 -2
- package/dist/resources/documents.d.cts +1 -1
- package/dist/resources/documents.d.ts +1 -1
- package/dist/resources/funding-options.d.cts +2 -2
- package/dist/resources/funding-options.d.ts +2 -2
- package/dist/resources/history.cjs.map +1 -1
- package/dist/resources/history.d.cts +13 -2
- package/dist/resources/history.d.ts +13 -2
- package/dist/resources/history.js.map +1 -1
- package/dist/resources/me.d.cts +2 -2
- package/dist/resources/me.d.ts +2 -2
- package/dist/resources/notifications.d.cts +1 -1
- package/dist/resources/notifications.d.ts +1 -1
- package/dist/resources/push.d.cts +1 -1
- package/dist/resources/push.d.ts +1 -1
- package/dist/resources/receipts.d.cts +1 -1
- package/dist/resources/receipts.d.ts +1 -1
- package/dist/resources/referral.d.cts +1 -1
- package/dist/resources/referral.d.ts +1 -1
- package/dist/resources/sessions.d.cts +1 -1
- package/dist/resources/sessions.d.ts +1 -1
- package/dist/resources/subscription.d.cts +1 -1
- package/dist/resources/subscription.d.ts +1 -1
- package/dist/resources/subscriptions.d.cts +1 -1
- package/dist/resources/subscriptions.d.ts +1 -1
- package/dist/resources/support.cjs +69 -0
- package/dist/resources/support.cjs.map +1 -0
- package/dist/resources/support.d.cts +110 -0
- package/dist/resources/support.d.ts +110 -0
- package/dist/resources/support.js +67 -0
- package/dist/resources/support.js.map +1 -0
- package/dist/resources/wallet.d.cts +1 -1
- package/dist/resources/wallet.d.ts +1 -1
- package/dist/telegram.cjs +198 -15
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +6 -3
- package/dist/telegram.d.ts +6 -3
- package/dist/telegram.js +198 -15
- package/dist/telegram.js.map +1 -1
- package/package.json +16 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,52 @@ 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.6] — 2026-10-23
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `support`: the chat with support. `list()` reads the conversation (oldest
|
|
12
|
+
first, `before` for older pages) and its status, `send({ text, files })`
|
|
13
|
+
writes with up to 10 files (a `File`, bytes or base64), `attachment(id)`
|
|
14
|
+
downloads a file as a `Blob`. Answers come with ready, cleaned HTML in
|
|
15
|
+
`html`. Needs the platform's support chat (0.6.12).
|
|
16
|
+
- `support.rate(id, { rating, comment })` and `rating_request` on the
|
|
17
|
+
conversation: support asks how it went after closing a conversation it
|
|
18
|
+
answered.
|
|
19
|
+
|
|
20
|
+
## [0.6.5] — 2026-10-21
|
|
21
|
+
|
|
22
|
+
Needs platform (TKL) 0.6.11 or newer: `SUPPORTED_MEISTER` is `>=0.6.11, <0.7.0`.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- `closeRequests`: close a card that still has money on it
|
|
27
|
+
(`request(cardId)`), follow the refund (`list()`, `get(id)`, `forCard(cardId)`)
|
|
28
|
+
through its statuses, and give an account or a card in the holder's own name
|
|
29
|
+
when the money can't go back the way it was paid (`submitPayoutDetails`).
|
|
30
|
+
- `debt.get()` and `debt.owedIn(currency)`: what the person owes for card fees. Quotes, card orders and the card
|
|
31
|
+
top-up terms show the part of a payment that goes to the debt
|
|
32
|
+
(`debt_withheld`, `debt`).
|
|
33
|
+
- The card catalogue carries each product's `tariff` (fees per payment, per
|
|
34
|
+
declined payment and per cash withdrawal) and `holder_data_required`.
|
|
35
|
+
- `consents.allowHolderData()`, `consents.allowDisputeDocuments({ cardId })`
|
|
36
|
+
and `consents.stands(kind)`, with the `HOLDER_DATA_CONSENT` and
|
|
37
|
+
`DISPUTE_DOCUMENTS_CONSENT` constants. A product with
|
|
38
|
+
`holder_data_required` issues a card only with that consent; send it with
|
|
39
|
+
the order (`consents: ["holder_data_transfer"]`) or give it beforehand.
|
|
40
|
+
- Cards show `in_transit` (a closed card's balance on its way to the card that
|
|
41
|
+
replaced it), `reissued_from_card_id` and `reissued_to_card_id`.
|
|
42
|
+
- History kinds `closed_card_balance`, `card_fee` and `debt_payment`.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- `CardLoadStatus` has every status the platform sends: `waiting`, `stalled`,
|
|
47
|
+
`refunding` and `refunded` besides `pending`, `succeeded` and `failed`. A
|
|
48
|
+
top-up the card never got goes back to where it was paid from.
|
|
49
|
+
- `consents.set()` takes `{ channel, cardId }` as its third argument; a bare
|
|
50
|
+
channel string still works.
|
|
51
|
+
- `types.gen.ts` is regenerated from the platform's spec.
|
|
52
|
+
|
|
7
53
|
## [0.6.4] — 2026-10-20
|
|
8
54
|
|
|
9
55
|
Needs platform (TKL) 0.6.9 or newer: `SUPPORTED_MEISTER` is `>=0.6.9, <0.7.0`.
|
package/README.md
CHANGED
|
@@ -148,7 +148,8 @@ switch (card.status) {
|
|
|
148
148
|
}
|
|
149
149
|
break;
|
|
150
150
|
case "terminating":
|
|
151
|
-
// Closing. The balance comes back
|
|
151
|
+
// Closing. The balance comes back when the issuer is done: to the wallet,
|
|
152
|
+
// or to the new card when the card was reissued (`reissued_to_card_id`).
|
|
152
153
|
break;
|
|
153
154
|
}
|
|
154
155
|
|
|
@@ -166,8 +167,27 @@ if (card.topups_held) {
|
|
|
166
167
|
if (card.card_form === "physical") {
|
|
167
168
|
// Plastic: the numbers are on the card, and it takes a PIN (see below).
|
|
168
169
|
}
|
|
170
|
+
if (card.in_transit) {
|
|
171
|
+
// A reissued card: what was left on the old one is on its way here.
|
|
172
|
+
// stage "issuer": the old card's issuer hasn't returned it yet;
|
|
173
|
+
// stage "loading": it has, and the money is being put on this card.
|
|
174
|
+
// Show it next to the balance, not in it.
|
|
175
|
+
}
|
|
176
|
+
if (card.reissued_to_card_id) {
|
|
177
|
+
// This card was replaced; link to the new one.
|
|
178
|
+
}
|
|
169
179
|
```
|
|
170
180
|
|
|
181
|
+
A card that stopped working before its term (the issuer closed its BIN, froze
|
|
182
|
+
or closed the card, the card broke) is reissued for free by support. The user
|
|
183
|
+
gets a new card on the same product with `reissued_from_card_id` pointing at the
|
|
184
|
+
old one, and the old card gets `reissued_to_card_id`. The old card's balance
|
|
185
|
+
follows once its issuer returns it: until then the new card carries it in
|
|
186
|
+
`in_transit`, and the history has a `closed_card_balance` entry, `pending` until
|
|
187
|
+
the money is on the new card. The user is told at each step (`card_reissued`,
|
|
188
|
+
`card_reissue_delivered`; `card_reissue_on_wallet` when the new card could not
|
|
189
|
+
take the money and it went to the wallet instead).
|
|
190
|
+
|
|
171
191
|
`status_source` is `holder`, `operator` or `provider`, or `null` for a card
|
|
172
192
|
whose status never changed. Trying to unfreeze a card the issuer froze answers
|
|
173
193
|
409 `card_locked`.
|
|
@@ -616,6 +636,82 @@ const top = await client.deposits.initiate({ amount: "25", currency: "USD", meth
|
|
|
616
636
|
- In your copy, call bonuses a discount. Keep words like funds, withdraw or
|
|
617
637
|
exchange away from them.
|
|
618
638
|
|
|
639
|
+
## Card fees and debt
|
|
640
|
+
|
|
641
|
+
A card product has a tariff (`product.tariff`): a fee per payment (fixed
|
|
642
|
+
and percent), per decline that was the user's doing (not enough money, wrong
|
|
643
|
+
details, a frozen card, a subscription not cancelled with the merchant), and
|
|
644
|
+
per cash withdrawal. Show it on the product card. A fee comes off the card
|
|
645
|
+
and is a line of its own in the history (`kind: "card_fee"`).
|
|
646
|
+
|
|
647
|
+
What the card can't cover is owed by the user, and the next top-up of any of
|
|
648
|
+
their cards or of the wallet pays it first. Always show that amount before
|
|
649
|
+
the user pays:
|
|
650
|
+
|
|
651
|
+
```ts
|
|
652
|
+
const debt = await client.debt.get(); // { total: [{ amount, currency }], items }
|
|
653
|
+
const owed = await client.debt.owedIn("USD"); // "0.8", or "0"
|
|
654
|
+
|
|
655
|
+
const q = await client.deposits.quote({ amount: "1000", currency: "RUB", card_id });
|
|
656
|
+
// q.debt_withheld "0.8" comes off q.credited_amount; the card gets the rest
|
|
657
|
+
|
|
658
|
+
const order = await client.cards.order({ productId, method: "sbp", idempotencyKey });
|
|
659
|
+
// order.debt_withheld is already in order.card_amount and order.amount
|
|
660
|
+
|
|
661
|
+
const terms = await client.cards.topUpTerms(cardId);
|
|
662
|
+
// terms.debt: { amount, currency } or null; a top-up from the wallet pays it first
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
A deposit carries `debt_quoted` (what it will withhold at most) and, once
|
|
666
|
+
paid, `debt_withheld`. The user is notified when a debt arises and when it is
|
|
667
|
+
paid; a payment against the debt shows in the history as `debt_payment`.
|
|
668
|
+
|
|
669
|
+
## Closing a card with money on it
|
|
670
|
+
|
|
671
|
+
`cards.terminate()` refuses a card that still holds money (409
|
|
672
|
+
`move_balance_first` or `contact_support_to_close`). Offer a close with a
|
|
673
|
+
refund instead: the card is closed at its issuer right away, and once the
|
|
674
|
+
issuer returns what was left on it, the money goes back to the payments the
|
|
675
|
+
card was topped up with, in the currency they were paid in, newest payment
|
|
676
|
+
first. Unspent bonuses are not refunded, and a debt the user was told about
|
|
677
|
+
is withheld first.
|
|
678
|
+
|
|
679
|
+
```ts
|
|
680
|
+
const req = await client.closeRequests.request(cardId); // asking again returns the same request
|
|
681
|
+
// req.status: "accepted" → "awaiting_issuer" → "refunding" → "refunded"
|
|
682
|
+
// req.balance { amount, currency }: what the card held
|
|
683
|
+
// req.bonus_excluded, req.debt_withheld: kept back, in the card's currency
|
|
684
|
+
// req.refund_total { amount, currency }: what goes back in all, once known
|
|
685
|
+
// req.refunded, req.on_the_way, req.refunds[]: what went back so far
|
|
686
|
+
// req.deadline_at: when the refund is due by
|
|
687
|
+
|
|
688
|
+
const mine = await client.closeRequests.list(); // newest first
|
|
689
|
+
const one = await client.closeRequests.forCard(cardId); // or null
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
Show amounts only; the API never gives the exchange rate, and the UI should
|
|
693
|
+
not work one out either.
|
|
694
|
+
|
|
695
|
+
When the money can't go back the way it came, the request turns
|
|
696
|
+
`payout_details_required` and the user is notified. Ask for a bank account
|
|
697
|
+
or a card in their own name:
|
|
698
|
+
|
|
699
|
+
```ts
|
|
700
|
+
await client.closeRequests.submitPayoutDetails(req.id, {
|
|
701
|
+
kind: "account",
|
|
702
|
+
holder_name: "Ivan Petrov",
|
|
703
|
+
account_number: "40817810099910004312",
|
|
704
|
+
bank_code: "044525225",
|
|
705
|
+
});
|
|
706
|
+
// or { kind: "card", holder_name, card_number }
|
|
707
|
+
// → "identity_check" (details can still be corrected) → "manual_payout" → "refunded"
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
Only the last four digits come back (`payout_details.masked`). 409 codes of
|
|
711
|
+
`request()`: `card_locked`, `first_purchase_required`, `card_not_closable`,
|
|
712
|
+
`topup_in_progress`, `card_closing`, `no_balance` (the card holds nothing:
|
|
713
|
+
`cards.terminate()` it), `provider_refused`.
|
|
714
|
+
|
|
619
715
|
## Promo and referral codes
|
|
620
716
|
|
|
621
717
|
A code goes with the operation it is for. At sign-up an unknown or expired
|
|
@@ -752,8 +848,36 @@ await client.consents.setCookies({ analytics: false });
|
|
|
752
848
|
|
|
753
849
|
`terms` covers the offer, the tariffs and the privacy policy. A deployment
|
|
754
850
|
can refuse a sign-up without `terms` and `personal_data`
|
|
755
|
-
(400 `consents_required`). Only `marketing
|
|
756
|
-
|
|
851
|
+
(400 `consents_required`). Only `marketing`, `cookies_analytics`,
|
|
852
|
+
`holder_data_transfer` and `dispute_documents_transfer` can be withdrawn
|
|
853
|
+
later; the required ones go with the account.
|
|
854
|
+
|
|
855
|
+
#### What reaches the card issuer
|
|
856
|
+
|
|
857
|
+
By default the card issuer gets no real details of the user. A product with
|
|
858
|
+
`holder_data_required: true` is different: its cards go out with the user's
|
|
859
|
+
real details, so the cabinet shows a consent screen before the order and
|
|
860
|
+
sends `holder_data_transfer` with it. Without the consent the order fails
|
|
861
|
+
with 409 `holder_data_consent_required`. Once given, the consent stands for
|
|
862
|
+
later cards until the user withdraws it.
|
|
863
|
+
|
|
864
|
+
```ts
|
|
865
|
+
import { HOLDER_DATA_CONSENT, type ConsentKind } from "@takeal/cusfront-sdk";
|
|
866
|
+
|
|
867
|
+
const consents: ConsentKind[] = ["terms"];
|
|
868
|
+
if (product.holder_data_required) {
|
|
869
|
+
if (!(await askHolderDataConsent())) return; // your consent screen
|
|
870
|
+
consents.push(HOLDER_DATA_CONSENT);
|
|
871
|
+
}
|
|
872
|
+
await client.cards.order({ productId: product.id, method: "sbp", consents, idempotencyKey });
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
The user's documents go to the issuer in a dispute only after a consent of
|
|
876
|
+
its own, given for the disputed card:
|
|
877
|
+
|
|
878
|
+
```ts
|
|
879
|
+
await client.consents.allowDisputeDocuments({ cardId: card.id });
|
|
880
|
+
```
|
|
757
881
|
|
|
758
882
|
### From `client.blog`
|
|
759
883
|
|
|
@@ -916,6 +1040,58 @@ export default {
|
|
|
916
1040
|
|
|
917
1041
|
With Workbox, add `/^\/ingest\//` to `navigateFallbackDenylist` and give the path no runtime caching route.
|
|
918
1042
|
|
|
1043
|
+
## Support chat
|
|
1044
|
+
|
|
1045
|
+
`client.support` is the chat with support: one conversation per person, the
|
|
1046
|
+
same one the Telegram bot feeds. Support agents answer from their own inbox,
|
|
1047
|
+
and the answers come back here.
|
|
1048
|
+
|
|
1049
|
+
```ts
|
|
1050
|
+
// A message with a picture from a file input.
|
|
1051
|
+
const file = input.files![0];
|
|
1052
|
+
const sent = await client.support.send({
|
|
1053
|
+
text: "The card was declined at the shop",
|
|
1054
|
+
files: [{ fileName: file.name, contentType: file.type, data: file }],
|
|
1055
|
+
});
|
|
1056
|
+
// sent.status === "queued" at first; "delivered" once support has it.
|
|
1057
|
+
|
|
1058
|
+
const chat = await client.support.list();
|
|
1059
|
+
// chat.status: "none" | "open" | "resolved"; chat.items oldest first.
|
|
1060
|
+
for (const m of chat.items) {
|
|
1061
|
+
if (m.author === "support") {
|
|
1062
|
+
// Cleaned HTML, ready to show: paragraphs, line breaks, bold, italic,
|
|
1063
|
+
// strikethrough, code, links, lists and quotes. Nothing else gets through.
|
|
1064
|
+
bubble.innerHTML = m.html;
|
|
1065
|
+
caption.textContent = m.operator_name ?? "Support";
|
|
1066
|
+
} else {
|
|
1067
|
+
bubble.textContent = m.text;
|
|
1068
|
+
}
|
|
1069
|
+
for (const a of m.attachments) {
|
|
1070
|
+
const blob = await client.support.attachment(a.id); // the person's own or support's
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
// Older messages:
|
|
1075
|
+
if (chat.has_more) await client.support.list({ before: chat.items[0].created_at });
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
Show what the person sent right away, with its `status`: `queued` turns into
|
|
1079
|
+
`delivered` within seconds, and `failed` means the message could not be passed
|
|
1080
|
+
on (support sees those too and can send them again). Files are pictures and
|
|
1081
|
+
PDF up to 20 MB by default; the platform sets both, and a file it doesn't take
|
|
1082
|
+
comes back as a 400 with the reason. Up to 10 files per message.
|
|
1083
|
+
|
|
1084
|
+
When support closes the conversation after answering, `chat.rating_request`
|
|
1085
|
+
asks how it went (a `support_rating_requested` notification points there too).
|
|
1086
|
+
Show 1 to 5 and an optional comment, then
|
|
1087
|
+
`client.support.rate(chat.rating_request.id, { rating: 5, comment })`. The
|
|
1088
|
+
question goes away once answered; a person who wrote from Telegram is asked
|
|
1089
|
+
there instead, with buttons.
|
|
1090
|
+
|
|
1091
|
+
A new answer also arrives as a `support_reply` notification (see
|
|
1092
|
+
[Notifications](#notifications-inbox)) with `href: "/support"`. Writing to a
|
|
1093
|
+
conversation support has closed opens it again.
|
|
1094
|
+
|
|
919
1095
|
## Notifications (inbox)
|
|
920
1096
|
|
|
921
1097
|
Everything the API tells a user (a confirmed deposit, a card transaction, a
|
|
@@ -1163,6 +1339,7 @@ Available now:
|
|
|
1163
1339
|
- `@takeal/cusfront-sdk/cards` — `CardsResource` (cards backed by the wallet balance).
|
|
1164
1340
|
- `@takeal/cusfront-sdk/balance` — `BalanceResource` (per-currency wallet balance).
|
|
1165
1341
|
- `@takeal/cusfront-sdk/bonus` — `BonusResource` (bonuses and a price preview; see [Bonuses](#bonuses)).
|
|
1342
|
+
- `@takeal/cusfront-sdk/close-requests` — `CloseRequestsResource` (close a card with money on it; see [Closing a card with money on it](#closing-a-card-with-money-on-it)).
|
|
1166
1343
|
- `@takeal/cusfront-sdk/documents` — `DocumentsResource` (blog posts, the knowledge base, legal pages; see [Documents](#documents)).
|
|
1167
1344
|
- `@takeal/cusfront-sdk/blog` — `BlogResource` (deprecated: the blog is a category of Documents now).
|
|
1168
1345
|
- `@takeal/cusfront-sdk/subscriptions` — `SubscriptionsResource` (announcement channels; deprecated, see [Preferences](#preferences)).
|
|
@@ -1175,6 +1352,7 @@ Available now:
|
|
|
1175
1352
|
- `@takeal/cusfront-sdk/history` — `HistoryResource` (the user's money history).
|
|
1176
1353
|
- `@takeal/cusfront-sdk/consents` — `ConsentsResource` (what the user agreed to).
|
|
1177
1354
|
- `@takeal/cusfront-sdk/receipts` — `ReceiptsResource` (a numbered receipt for every payment).
|
|
1355
|
+
- `@takeal/cusfront-sdk/support` — `SupportResource` (the chat with support; see [Support chat](#support-chat)).
|
|
1178
1356
|
- `@takeal/cusfront-sdk/attribution` — `AttributionResource`, `anonymousKey`, `currentTouch` (where users come from).
|
|
1179
1357
|
- `@takeal/cusfront-sdk/webhooks` — HMAC-SHA256 signature verifier (no network, isomorphic).
|
|
1180
1358
|
- `@takeal/cusfront-sdk/react` — optional React hooks layer (`ClientProvider` + `useMe` / `useDeposits` / `useCards` / `useCardProducts` / `useBalance` / `useNotifications` / `useUnreadCount`). React is a `peerDependency`, never bundled.
|
|
@@ -1349,6 +1527,7 @@ Codes worth a wording of their own on the card screens:
|
|
|
1349
1527
|
| `provider_declined` (502) | The issuer refused the move. Nothing was moved. | The issuer would not do it; the wallet is untouched. |
|
|
1350
1528
|
| `provider_refused` (409) | The issuer did not take the PIN. | Try another PIN or later. |
|
|
1351
1529
|
| `card_locked` (409) | Support holds the card, or the issuer froze it. | Only support can change this card. |
|
|
1530
|
+
| `holder_data_consent_required` (409) | The card goes out with the user's real details and they have not agreed to that. | Show the consent screen, then order again with `holder_data_transfer`. |
|
|
1352
1531
|
| `not_supported` (501) | This issuer cannot do that (take money back off a card, reveal, PIN). | Hide the control. |
|
|
1353
1532
|
| `insufficient_funds` (402) | The wallet holds less than that. | Top up the wallet first. |
|
|
1354
1533
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConsentKind, ConsentChannel } from './resources/consents.cjs';
|
|
2
|
-
import { H as HttpClient } from './http-
|
|
2
|
+
import { H as HttpClient } from './http-CL97TjMO.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Structured customer billing details — shared by the deposits and cards
|
|
@@ -164,8 +164,13 @@ interface CreateQuoteInput {
|
|
|
164
164
|
* a line of its own on the credited amount.
|
|
165
165
|
*/
|
|
166
166
|
type FeeKind = "spread" | "markup" | "commission";
|
|
167
|
-
/**
|
|
168
|
-
|
|
167
|
+
/**
|
|
168
|
+
* How far a top-up meant for a card has got. `waiting`: the card's provider
|
|
169
|
+
* took the load and hasn't done it yet. `stalled`: it has taken longer than
|
|
170
|
+
* the platform waits. `refunding` / `refunded`: the card never got the money,
|
|
171
|
+
* and the payment is going back, or has gone back, to where it was paid from.
|
|
172
|
+
*/
|
|
173
|
+
type CardLoadStatus = "pending" | "waiting" | "stalled" | "succeeded" | "failed" | "refunding" | "refunded";
|
|
169
174
|
/**
|
|
170
175
|
* A card to issue with the top-up: the fields of `cards.create` without
|
|
171
176
|
* its idempotency key (the deposit's covers both). The card's price is
|
|
@@ -205,6 +210,13 @@ interface FundingQuote {
|
|
|
205
210
|
method?: DepositMethod;
|
|
206
211
|
/** The rate is locked until then; the deposit made with it waits for its payment as long. */
|
|
207
212
|
expires_at: string;
|
|
213
|
+
/**
|
|
214
|
+
* What the user owes in card fees, in `credited_currency`, that this
|
|
215
|
+
* top-up pays first: it comes off `credited_amount` and the rest is
|
|
216
|
+
* credited. `"0"` when nothing is owed. Show it before the payment. Older
|
|
217
|
+
* platforms leave it out.
|
|
218
|
+
*/
|
|
219
|
+
debt_withheld?: string;
|
|
208
220
|
}
|
|
209
221
|
interface Deposit {
|
|
210
222
|
id: string;
|
|
@@ -274,6 +286,17 @@ interface Deposit {
|
|
|
274
286
|
* wallet instead (funding connectors in `mixed` mode). The user is told.
|
|
275
287
|
*/
|
|
276
288
|
returned_to_wallet_at?: string | null;
|
|
289
|
+
/**
|
|
290
|
+
* The user's debt in card fees shown before the payment, in the credited
|
|
291
|
+
* currency: the most this top-up pays towards it before the rest is
|
|
292
|
+
* credited. Absent when nothing was owed.
|
|
293
|
+
*/
|
|
294
|
+
debt_quoted?: string | null;
|
|
295
|
+
/**
|
|
296
|
+
* What the top-up did pay towards the debt. For a top-up onto a card,
|
|
297
|
+
* `card_amount` is already net of it.
|
|
298
|
+
*/
|
|
299
|
+
debt_withheld?: string | null;
|
|
277
300
|
created_at: string;
|
|
278
301
|
updated_at: string;
|
|
279
302
|
}
|
|
@@ -368,6 +391,7 @@ interface Refund {
|
|
|
368
391
|
status: string;
|
|
369
392
|
provider_refund_reference?: string;
|
|
370
393
|
failure_reason?: string;
|
|
394
|
+
/** `user`, `operator`, or `system` when the platform refunded by itself. */
|
|
371
395
|
requestor_type: string;
|
|
372
396
|
requestor_id: string;
|
|
373
397
|
created_at: string;
|
|
@@ -543,6 +567,45 @@ interface CardProduct {
|
|
|
543
567
|
starting_balance: CardBalance | null;
|
|
544
568
|
/** True for the product the deployment issues when none is chosen. */
|
|
545
569
|
is_default: boolean;
|
|
570
|
+
/**
|
|
571
|
+
* Issuing this card sends the user's real personal details to the card
|
|
572
|
+
* issuer. Show the consent screen before the order and send
|
|
573
|
+
* `holder_data_transfer` in its `consents` (or give it once with
|
|
574
|
+
* `client.consents.allowHolderData()`); without it the order fails with
|
|
575
|
+
* 409 `holder_data_consent_required`. `false`: the issuer gets no real
|
|
576
|
+
* details and no extra consent is asked.
|
|
577
|
+
*/
|
|
578
|
+
holder_data_required: boolean;
|
|
579
|
+
/**
|
|
580
|
+
* What a card on this product costs to use, on top of the payments
|
|
581
|
+
* themselves. A fee the card can't cover is owed and paid from the next
|
|
582
|
+
* top-up (see `client.debt`). Every line is `"0"` when the product
|
|
583
|
+
* charges nothing for it.
|
|
584
|
+
*/
|
|
585
|
+
tariff: CardTariff;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* A card product's fees for using the card. Decimal strings: the fixed
|
|
589
|
+
* amounts are in `currency` (the card's), the shares in percent of the
|
|
590
|
+
* operation's amount.
|
|
591
|
+
*/
|
|
592
|
+
interface CardTariff {
|
|
593
|
+
/** `null` for a product held in several currencies: the card's own then. */
|
|
594
|
+
currency: string | null;
|
|
595
|
+
/** Per settled card payment, fixed. */
|
|
596
|
+
operation_fixed: string;
|
|
597
|
+
/** Per settled card payment, percent of its amount. */
|
|
598
|
+
operation_percent: string;
|
|
599
|
+
/**
|
|
600
|
+
* Per payment declined through the user's own doing: not enough money,
|
|
601
|
+
* wrong card details, a frozen card, a subscription not cancelled with the
|
|
602
|
+
* merchant. A decline caused by the issuer or the platform costs nothing.
|
|
603
|
+
*/
|
|
604
|
+
decline: string;
|
|
605
|
+
/** Per cash withdrawal, fixed; charged instead of the payment fee. */
|
|
606
|
+
cash_withdrawal_fixed: string;
|
|
607
|
+
/** Per cash withdrawal, percent of its amount. */
|
|
608
|
+
cash_withdrawal_percent: string;
|
|
546
609
|
}
|
|
547
610
|
/**
|
|
548
611
|
* A card record as the Takeal API returns it. Mirrors the `cards` table. Note the
|
|
@@ -583,6 +646,19 @@ interface Card {
|
|
|
583
646
|
* support to settle it; say so instead of offering a retry.
|
|
584
647
|
*/
|
|
585
648
|
topups_held: string | null;
|
|
649
|
+
/**
|
|
650
|
+
* The card this one replaced: support reissued it for free because that
|
|
651
|
+
* card stopped working before its term. `null` otherwise.
|
|
652
|
+
*/
|
|
653
|
+
reissued_from_card_id?: string | null;
|
|
654
|
+
/** The card support issued to replace this one, or `null`. */
|
|
655
|
+
reissued_to_card_id?: string | null;
|
|
656
|
+
/**
|
|
657
|
+
* What was left on the card this one replaced, on its way here. Show it as
|
|
658
|
+
* money in transit next to the balance, not as part of it. `null` when
|
|
659
|
+
* nothing is on its way.
|
|
660
|
+
*/
|
|
661
|
+
in_transit?: CardInTransit | null;
|
|
586
662
|
/** The name the user gave the card, or `null`. */
|
|
587
663
|
name: string | null;
|
|
588
664
|
/** The artwork the card is shown with. Always present. */
|
|
@@ -597,6 +673,21 @@ interface Card {
|
|
|
597
673
|
/** Only on the result of `create`, when bonuses paid part of the price. */
|
|
598
674
|
bonus?: IssuanceBonus;
|
|
599
675
|
}
|
|
676
|
+
/**
|
|
677
|
+
* The balance of a closed card on its way to the card that replaced it. It
|
|
678
|
+
* waits for the old card's issuer to return the money (`stage: "issuer"`),
|
|
679
|
+
* then it is loaded onto this card (`stage: "loading"`); once it is there,
|
|
680
|
+
* `in_transit` is `null` and the card's balance has it. The move is in the
|
|
681
|
+
* history as a `closed_card_balance` entry.
|
|
682
|
+
*/
|
|
683
|
+
interface CardInTransit {
|
|
684
|
+
/** Decimal string in `currency`. What the issuer returned once it did; before that, what the old card held. */
|
|
685
|
+
amount: string;
|
|
686
|
+
currency: string;
|
|
687
|
+
/** The closed card the money comes from. */
|
|
688
|
+
from_card_id: string;
|
|
689
|
+
stage: "issuer" | "loading" | (string & {});
|
|
690
|
+
}
|
|
600
691
|
/** How bonuses changed a new card's price ("was / now"). Decimal strings in `currency`. */
|
|
601
692
|
interface IssuanceBonus {
|
|
602
693
|
/** Bonuses used. */
|
|
@@ -666,9 +757,10 @@ interface CreateCardInput {
|
|
|
666
757
|
promoCode?: string;
|
|
667
758
|
/**
|
|
668
759
|
* Consents the user gave with the order (`terms`, `personal_data`,
|
|
669
|
-
* `marketing`). Recorded with the card, or with the
|
|
670
|
-
* `deposits.initiate({ issue_card })`, at the version of
|
|
671
|
-
* in force now.
|
|
760
|
+
* `marketing`, `holder_data_transfer`). Recorded with the card, or with the
|
|
761
|
+
* top-up inside `deposits.initiate({ issue_card })`, at the version of
|
|
762
|
+
* their documents in force now. A product with `holder_data_required`
|
|
763
|
+
* needs `holder_data_transfer` here unless it was given before.
|
|
672
764
|
*/
|
|
673
765
|
consents?: ConsentKind[];
|
|
674
766
|
/** Where they were given. Sent as `consent_channel`. */
|
|
@@ -712,7 +804,10 @@ interface CardOrderInput {
|
|
|
712
804
|
promoCode?: string;
|
|
713
805
|
/** Pay part of the price with bonuses; on by default. Sent as `use_bonus`. */
|
|
714
806
|
useBonus?: boolean;
|
|
715
|
-
/**
|
|
807
|
+
/**
|
|
808
|
+
* Consents given with the order. A product with `holder_data_required`
|
|
809
|
+
* needs `holder_data_transfer` here unless it was given before.
|
|
810
|
+
*/
|
|
716
811
|
consents?: ConsentKind[];
|
|
717
812
|
/** Where they were given. Sent as `consent_channel`. */
|
|
718
813
|
consentChannel?: ConsentChannel;
|
|
@@ -726,9 +821,15 @@ interface CardOrder {
|
|
|
726
821
|
/** What the user pays, decimal string, in `currency`. */
|
|
727
822
|
amount: string;
|
|
728
823
|
currency: string;
|
|
729
|
-
/** What
|
|
824
|
+
/** What the payment brings: the card's price, its starting balance and `debt_withheld`, in `card_currency`. */
|
|
730
825
|
card_amount: string;
|
|
731
826
|
card_currency: string;
|
|
827
|
+
/**
|
|
828
|
+
* What the user owes in card fees, in `card_currency`: included in
|
|
829
|
+
* `card_amount` and paid from it first. `"0"` when nothing is owed. Show
|
|
830
|
+
* it before the payment. Older platforms leave it out.
|
|
831
|
+
*/
|
|
832
|
+
debt_withheld?: string;
|
|
732
833
|
}
|
|
733
834
|
/** Why a card ordered with the sign-up was not placed. The account exists all the same. */
|
|
734
835
|
interface CardOrderError {
|
|
@@ -756,6 +857,13 @@ interface TopUpTerms {
|
|
|
756
857
|
min: CardBalance | null;
|
|
757
858
|
/** Largest single top-up the product allows, or `null` for no cap. */
|
|
758
859
|
max: CardBalance | null;
|
|
860
|
+
/**
|
|
861
|
+
* What the user owes in card fees, in the card's currency, or `null` when
|
|
862
|
+
* nothing is. A top-up from a wallet in the same currency pays it first
|
|
863
|
+
* and the card gets the rest: show it before the top-up. Older platforms
|
|
864
|
+
* leave it out.
|
|
865
|
+
*/
|
|
866
|
+
debt?: CardBalance | null;
|
|
759
867
|
}
|
|
760
868
|
interface TopUpInput {
|
|
761
869
|
/** Amount to add, decimal string, in the card's currency. */
|
|
@@ -948,6 +1056,8 @@ declare class CardsResource {
|
|
|
948
1056
|
* `Card`. On a ledger failure after provider creation, the Takeal API rolls the row
|
|
949
1057
|
* to `failed` (never an orphaned active card); inspect `status` /
|
|
950
1058
|
* `failure_reason` on the result.
|
|
1059
|
+
* Errors: 409 `holder_data_consent_required` when the product has
|
|
1060
|
+
* `holder_data_required` and the user has not agreed to it.
|
|
951
1061
|
*/
|
|
952
1062
|
create(input: CreateCardInput): Promise<Card>;
|
|
953
1063
|
/**
|
|
@@ -957,7 +1067,9 @@ declare class CardsResource {
|
|
|
957
1067
|
* `pending_payment` until the payment is confirmed. The same
|
|
958
1068
|
* `idempotencyKey` returns the same order.
|
|
959
1069
|
* Errors: 400 `unknown_product` / `method_not_available` / a limit of the
|
|
960
|
-
* way of paying,
|
|
1070
|
+
* way of paying, 409 `holder_data_consent_required` (the product has
|
|
1071
|
+
* `holder_data_required` and the user has not agreed to it), 503 no
|
|
1072
|
+
* funding connector or no exchange rate.
|
|
961
1073
|
*/
|
|
962
1074
|
order(input: CardOrderInput & {
|
|
963
1075
|
idempotencyKey: string;
|
|
@@ -1071,9 +1183,12 @@ declare class CardsResource {
|
|
|
1071
1183
|
/**
|
|
1072
1184
|
* Terminate the caller's own card. **One-way** — a terminated card cannot be
|
|
1073
1185
|
* reactivated. The optional `reason` is audited. Idempotent on an
|
|
1074
|
-
* already-terminated card.
|
|
1186
|
+
* already-terminated card. A card that still holds money is refused (409
|
|
1187
|
+
* `move_balance_first` or `contact_support_to_close`): close it with
|
|
1188
|
+
* `client.closeRequests.request(id)` instead, and the money goes back the
|
|
1189
|
+
* way it was paid.
|
|
1075
1190
|
*/
|
|
1076
1191
|
terminate(id: string, reason?: string): Promise<Card>;
|
|
1077
1192
|
}
|
|
1078
1193
|
|
|
1079
|
-
export { type Address as A, type BillingAddress as B, type CardProduct as C, type Deposit as D, type
|
|
1194
|
+
export { type Address as A, type BillingAddress as B, type CardProduct as C, type Deposit as D, type DepositStatus as E, FundingOptionsResource as F, type DepositTarget as G, type FeeKind as H, type FunderMode as I, type FundingOption as J, type FundingQuote as K, type InitiateDepositInput as L, type IssuanceBonus as M, type IssueCardInput as N, type MethodTerms as O, type RevealCardInput as P, type RevealedCard as Q, type Refund as R, type SetPinInput as S, type TopUpInput as T, type TopUpResult as U, type TopUpTerms as V, type TransferInput as W, type TransferResult as X, type UpdateCardInput as Y, cardOrderBody as Z, cardRequestBody as _, type Card as a, DepositsResource as b, CardsResource as c, type CardBalance as d, type CardDesignRef as e, type CardForm as f, type CardInTransit as g, type CardLoadStatus as h, type CardOrder as i, type CardOrderError as j, type CardOrderInput as k, type CardProductPrice as l, type CardStatus as m, type CardStatusSource as n, type CardTariff as o, type CardTopUp as p, type CardTopUpStatus as q, type CardTransfer as r, type CardType as s, type Cardholder as t, type CloseBlockedReason as u, type CreateCardInput as v, type CreateDepositRefundInput as w, type CreateQuoteInput as x, type CustomerInfo as y, type DepositMethod as z };
|