@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.
- package/CHANGELOG.md +15 -0
- package/README.md +32 -0
- package/dist/{cards-DzhPVA9N.d.ts → cards-BrqeBqLV.d.ts} +432 -1
- package/dist/{cards-DU2DdhYO.d.cts → cards-ofoGRU9v.d.cts} +432 -1
- package/dist/index.cjs +241 -205
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -6
- package/dist/index.d.ts +4 -6
- package/dist/index.js +241 -205
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +1 -2
- package/dist/react/index.d.ts +1 -2
- package/dist/resources/auth.cjs +23 -1
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +13 -2
- package/dist/resources/auth.d.ts +13 -2
- package/dist/resources/auth.js +23 -1
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/cards.cjs +34 -0
- 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 +34 -1
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/deposits.cjs.map +1 -1
- package/dist/resources/deposits.d.cts +1 -2
- package/dist/resources/deposits.d.ts +1 -2
- package/dist/resources/deposits.js.map +1 -1
- package/dist/resources/funding-options.d.cts +1 -2
- package/dist/resources/funding-options.d.ts +1 -2
- package/dist/resources/me.d.cts +1 -0
- package/dist/resources/me.d.ts +1 -0
- package/dist/telegram.cjs +241 -205
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +1 -2
- package/dist/telegram.d.ts +1 -2
- package/dist/telegram.js +241 -205
- package/dist/telegram.js.map +1 -1
- package/package.json +1 -1
- package/dist/deposits-BEkNeE-v.d.cts +0 -373
- package/dist/deposits-Dt6A76MB.d.ts +0 -373
package/dist/index.cjs
CHANGED
|
@@ -137,6 +137,241 @@ async function parseResponse(resp) {
|
|
|
137
137
|
return body;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
// src/resources/cards.ts
|
|
141
|
+
function cardRequestBody(input) {
|
|
142
|
+
const {
|
|
143
|
+
productId,
|
|
144
|
+
name,
|
|
145
|
+
designId,
|
|
146
|
+
useBonus,
|
|
147
|
+
bonusAmount,
|
|
148
|
+
promoCode,
|
|
149
|
+
consentChannel,
|
|
150
|
+
initial_amount: _ignored,
|
|
151
|
+
...rest
|
|
152
|
+
} = input;
|
|
153
|
+
const body = { ...rest };
|
|
154
|
+
if (productId !== void 0) body["product_id"] = productId;
|
|
155
|
+
if (name !== void 0) body["name"] = name;
|
|
156
|
+
if (designId !== void 0) body["design_id"] = designId;
|
|
157
|
+
if (useBonus !== void 0) body["use_bonus"] = useBonus;
|
|
158
|
+
if (bonusAmount !== void 0) body["bonus_amount"] = bonusAmount;
|
|
159
|
+
if (promoCode !== void 0) body["promo_code"] = promoCode;
|
|
160
|
+
if (consentChannel !== void 0) body["consent_channel"] = consentChannel;
|
|
161
|
+
return body;
|
|
162
|
+
}
|
|
163
|
+
function cardOrderBody(input) {
|
|
164
|
+
const body = {
|
|
165
|
+
product_id: input.productId,
|
|
166
|
+
method: input.method
|
|
167
|
+
};
|
|
168
|
+
if (input.designId !== void 0) body["design_id"] = input.designId;
|
|
169
|
+
if (input.name !== void 0) body["name"] = input.name;
|
|
170
|
+
if (input.funderSlug !== void 0) body["funder_slug"] = input.funderSlug;
|
|
171
|
+
if (input.currency !== void 0) body["currency"] = input.currency;
|
|
172
|
+
if (input.extraLoad !== void 0) body["extra_load"] = input.extraLoad;
|
|
173
|
+
if (input.promoCode !== void 0) body["promo_code"] = input.promoCode;
|
|
174
|
+
if (input.useBonus !== void 0) body["use_bonus"] = input.useBonus;
|
|
175
|
+
if (input.consents !== void 0) body["consents"] = input.consents;
|
|
176
|
+
if (input.consentChannel !== void 0) body["consent_channel"] = input.consentChannel;
|
|
177
|
+
if (input.metadata !== void 0) body["metadata"] = input.metadata;
|
|
178
|
+
return body;
|
|
179
|
+
}
|
|
180
|
+
var CardsResource = class {
|
|
181
|
+
constructor(http) {
|
|
182
|
+
this.http = http;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Issue a card backed by the user's wallet balance. Resolves to the new
|
|
186
|
+
* `Card`. On a ledger failure after provider creation, the Takeal API rolls the row
|
|
187
|
+
* to `failed` (never an orphaned active card); inspect `status` /
|
|
188
|
+
* `failure_reason` on the result.
|
|
189
|
+
*/
|
|
190
|
+
async create(input) {
|
|
191
|
+
const { idempotencyKey, ...card } = input;
|
|
192
|
+
return this.http.post("/me/cards", {
|
|
193
|
+
body: cardRequestBody(card),
|
|
194
|
+
idempotencyKey
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Buy a card in one step: the API prices the product in the payment's
|
|
199
|
+
* currency, locks the rate and opens the top-up that issues the card.
|
|
200
|
+
* Send the user to `order.deposit.redirect_url`; the card shows as
|
|
201
|
+
* `pending_payment` until the payment is confirmed. The same
|
|
202
|
+
* `idempotencyKey` returns the same order.
|
|
203
|
+
* Errors: 400 `unknown_product` / `method_not_available` / a limit of the
|
|
204
|
+
* way of paying, 503 no funding connector or no exchange rate.
|
|
205
|
+
*/
|
|
206
|
+
async order(input) {
|
|
207
|
+
const { idempotencyKey, ...order } = input;
|
|
208
|
+
return this.http.post("/me/card-orders", {
|
|
209
|
+
body: cardOrderBody(order),
|
|
210
|
+
idempotencyKey
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The cards the caller can order, in the order the storefront shows them
|
|
215
|
+
* (`is_default` marks the one issued when none is chosen). Each item
|
|
216
|
+
* carries its product card (name, tagline, benefits, tile picture),
|
|
217
|
+
* artwork, and the issuance price after the caller's subscription
|
|
218
|
+
* discount, in the caller's wallet currency. Pass an item's `id` as
|
|
219
|
+
* `productId` to {@link create}.
|
|
220
|
+
*/
|
|
221
|
+
async listProducts() {
|
|
222
|
+
return this.http.get("/me/card-products");
|
|
223
|
+
}
|
|
224
|
+
/** One product from the catalog. 404 when unknown, disabled or hidden. */
|
|
225
|
+
async getProduct(id) {
|
|
226
|
+
return this.http.get(`/me/card-products/${encodeURIComponent(id)}`);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The public catalog: the same products, order and default as
|
|
230
|
+
* {@link listProducts}, but readable before sign-in, for a landing page or
|
|
231
|
+
* the cabinet's first screen. Prices are list prices (`discount_bps` is
|
|
232
|
+
* always 0); once the user is signed in, {@link listProducts} shows what
|
|
233
|
+
* they pay. The API lets caches keep this response for a minute.
|
|
234
|
+
*/
|
|
235
|
+
async catalog() {
|
|
236
|
+
return this.http.get("/card-products");
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Rename the caller's own card or change its design. Resolves to the
|
|
240
|
+
* updated card. 404 if the card isn't the caller's; 400 `invalid_name` /
|
|
241
|
+
* `design_not_allowed` on a bad value.
|
|
242
|
+
*/
|
|
243
|
+
async update(id, input) {
|
|
244
|
+
const body = {};
|
|
245
|
+
if (input.name !== void 0) body["name"] = input.name;
|
|
246
|
+
if (input.designId !== void 0) body["design_id"] = input.designId;
|
|
247
|
+
return this.http.patch(`/me/cards/${encodeURIComponent(id)}`, {
|
|
248
|
+
body
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/** Fetch one card by id. */
|
|
252
|
+
async get(id) {
|
|
253
|
+
return this.http.get(`/me/cards/${encodeURIComponent(id)}`);
|
|
254
|
+
}
|
|
255
|
+
/** List the caller's cards, most recent first. */
|
|
256
|
+
async list() {
|
|
257
|
+
return this.http.get("/me/cards");
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Remaining balance of a prepaid card. `currency` is required by the Takeal API and
|
|
261
|
+
* forwarded as a query param.
|
|
262
|
+
*/
|
|
263
|
+
async balance(id, currency) {
|
|
264
|
+
const q = new URLSearchParams({ currency }).toString();
|
|
265
|
+
return this.http.get(`/me/cards/${encodeURIComponent(id)}/balance?${q}`);
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* What a top-up of this card can be right now: whether it is possible, the
|
|
269
|
+
* currency, the wallet balance, and the product's floor and cap for one
|
|
270
|
+
* top-up. Read it before drawing the form. 404 if the card isn't the caller's.
|
|
271
|
+
*/
|
|
272
|
+
async topUpTerms(id) {
|
|
273
|
+
return this.http.get(`/me/cards/${encodeURIComponent(id)}/topup`);
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Move money from the wallet onto the caller's own card. The wallet is
|
|
277
|
+
* debited first, then the card's provider loads the card; if the provider
|
|
278
|
+
* refuses, the money is back on the wallet and the error says so. Resolves
|
|
279
|
+
* to the card, its new balance and the wallet balance, so no second call
|
|
280
|
+
* is needed. Errors carry a sentence the user can read: 400 outside the
|
|
281
|
+
* floor or cap · 402 not enough in the wallet · 404 not the caller's card ·
|
|
282
|
+
* 409 card frozen, closed or still being issued · 501 provider can't top
|
|
283
|
+
* up · 502/503 provider declined or unreachable (wallet untouched).
|
|
284
|
+
*/
|
|
285
|
+
async topUp(id, input) {
|
|
286
|
+
const { idempotencyKey, amount } = input;
|
|
287
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/topup`, {
|
|
288
|
+
body: { amount },
|
|
289
|
+
idempotencyKey
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Move money from one of the caller's cards to another. Both must be
|
|
294
|
+
* theirs, active, in the same currency and of the same kind. The money
|
|
295
|
+
* travels through the wallet one leg at a time: when the second leg does
|
|
296
|
+
* not go through, the call still resolves, `transfer.status` is
|
|
297
|
+
* `on_wallet` and the money is on the wallet — never between two cards.
|
|
298
|
+
* Errors carry a sentence the user can read: 400 the same card twice,
|
|
299
|
+
* different currencies or different kinds · 402 the card holds less than
|
|
300
|
+
* that · 404 one of the cards isn't theirs · 409 a card is frozen, closed
|
|
301
|
+
* or still being issued, or the key was reused with a different body ·
|
|
302
|
+
* 501/502/503 the provider cannot or will not move it.
|
|
303
|
+
*/
|
|
304
|
+
async transfer(fromCardId, input) {
|
|
305
|
+
const { toCardId, amount, idempotencyKey } = input;
|
|
306
|
+
return this.http.post(`/me/cards/${encodeURIComponent(fromCardId)}/transfer`, {
|
|
307
|
+
body: { to_card_id: toCardId, amount },
|
|
308
|
+
idempotencyKey
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Freeze the caller's own card. Reversible via {@link unfreeze} while
|
|
313
|
+
* `status_source` is `holder` or `operator`. The optional `reason` is
|
|
314
|
+
* recorded on the audit trail. Resolves to the updated card. 404 if the
|
|
315
|
+
* card isn't the caller's; 409 `card_locked` when support holds it; 501 if
|
|
316
|
+
* the issuer can't freeze.
|
|
317
|
+
*/
|
|
318
|
+
async freeze(id, reason) {
|
|
319
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/freeze`, { body: { reason } });
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Reveal the FULL PAN + CVV for the caller's own card. The signed-in
|
|
323
|
+
* session is all the API asks for; the call is rate-limited and audited
|
|
324
|
+
* server-side. The Takeal API never persists this data and marks the
|
|
325
|
+
* response no-store; the SDK returns it verbatim and holds nothing.
|
|
326
|
+
*
|
|
327
|
+
* **Consumer security duties** (the SDK can't enforce these for you):
|
|
328
|
+
* keep the result in volatile memory only, never write it to
|
|
329
|
+
* localStorage / logs, and clear it within `expires_in_seconds`.
|
|
330
|
+
*
|
|
331
|
+
* The result is the numbers, or `reveal_url` with empty `pan` and `cvv`
|
|
332
|
+
* when the issuer shows them on a page of its own: open that page in a
|
|
333
|
+
* frame right away, it is short-lived.
|
|
334
|
+
*
|
|
335
|
+
* 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
|
|
336
|
+
* has no sensitive-data endpoint · 503 `provider_unavailable`.
|
|
337
|
+
*/
|
|
338
|
+
async reveal(id, _input) {
|
|
339
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/reveal`);
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Unfreeze a previously-frozen card. Idempotent on an already-active card.
|
|
343
|
+
* A card the issuer froze (`status_source: "provider"`) is not the
|
|
344
|
+
* holder's to unfreeze: the API answers 409 `card_locked`, so hide the
|
|
345
|
+
* button and say the freeze is lifted through the issuer's support.
|
|
346
|
+
*/
|
|
347
|
+
async unfreeze(id) {
|
|
348
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/unfreeze`, { body: {} });
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Set the PIN of the caller's own physical card. The session is enough; the
|
|
352
|
+
* call is rate-limited like {@link reveal} and the PIN is kept nowhere.
|
|
353
|
+
* Resolves to the card; the user also gets a notification that the PIN
|
|
354
|
+
* was set. 400 not four to six digits or the card is not active · 403 not
|
|
355
|
+
* your card · 409 `card_locked`, or `provider_refused` when the issuer did
|
|
356
|
+
* not take it · 429 too many attempts · 501 a virtual card has no PIN.
|
|
357
|
+
*/
|
|
358
|
+
async setPin(id, input) {
|
|
359
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/pin`, {
|
|
360
|
+
body: { pin: input.pin }
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Terminate the caller's own card. **One-way** — a terminated card cannot be
|
|
365
|
+
* reactivated. The optional `reason` is audited. Idempotent on an
|
|
366
|
+
* already-terminated card.
|
|
367
|
+
*/
|
|
368
|
+
async terminate(id, reason) {
|
|
369
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/terminate`, {
|
|
370
|
+
body: { reason }
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
|
|
140
375
|
// src/resources/auth.ts
|
|
141
376
|
function withRemember(input) {
|
|
142
377
|
const { remember, ...rest } = input;
|
|
@@ -235,8 +470,11 @@ var AuthResource = class {
|
|
|
235
470
|
* Errors: 400 `validation` / `currency_not_allowed` / `consents_required`
|
|
236
471
|
* / `unknown_consent`, 409 email taken. */
|
|
237
472
|
async register(input) {
|
|
473
|
+
const { cardOrder, ...rest } = input;
|
|
474
|
+
const body = withRemember(rest);
|
|
475
|
+
if (cardOrder !== void 0) body["card_order"] = cardOrderBody(cardOrder);
|
|
238
476
|
const resp = await this.http.post("/auth/register", {
|
|
239
|
-
body
|
|
477
|
+
body,
|
|
240
478
|
skipAuth: true
|
|
241
479
|
});
|
|
242
480
|
await this.keep(resp);
|
|
@@ -360,208 +598,6 @@ var AuthResource = class {
|
|
|
360
598
|
}
|
|
361
599
|
};
|
|
362
600
|
|
|
363
|
-
// src/resources/cards.ts
|
|
364
|
-
function cardRequestBody(input) {
|
|
365
|
-
const {
|
|
366
|
-
productId,
|
|
367
|
-
name,
|
|
368
|
-
designId,
|
|
369
|
-
useBonus,
|
|
370
|
-
bonusAmount,
|
|
371
|
-
promoCode,
|
|
372
|
-
consentChannel,
|
|
373
|
-
initial_amount: _ignored,
|
|
374
|
-
...rest
|
|
375
|
-
} = input;
|
|
376
|
-
const body = { ...rest };
|
|
377
|
-
if (productId !== void 0) body["product_id"] = productId;
|
|
378
|
-
if (name !== void 0) body["name"] = name;
|
|
379
|
-
if (designId !== void 0) body["design_id"] = designId;
|
|
380
|
-
if (useBonus !== void 0) body["use_bonus"] = useBonus;
|
|
381
|
-
if (bonusAmount !== void 0) body["bonus_amount"] = bonusAmount;
|
|
382
|
-
if (promoCode !== void 0) body["promo_code"] = promoCode;
|
|
383
|
-
if (consentChannel !== void 0) body["consent_channel"] = consentChannel;
|
|
384
|
-
return body;
|
|
385
|
-
}
|
|
386
|
-
var CardsResource = class {
|
|
387
|
-
constructor(http) {
|
|
388
|
-
this.http = http;
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Issue a card backed by the user's wallet balance. Resolves to the new
|
|
392
|
-
* `Card`. On a ledger failure after provider creation, the Takeal API rolls the row
|
|
393
|
-
* to `failed` (never an orphaned active card); inspect `status` /
|
|
394
|
-
* `failure_reason` on the result.
|
|
395
|
-
*/
|
|
396
|
-
async create(input) {
|
|
397
|
-
const { idempotencyKey, ...card } = input;
|
|
398
|
-
return this.http.post("/me/cards", {
|
|
399
|
-
body: cardRequestBody(card),
|
|
400
|
-
idempotencyKey
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* The cards the caller can order, in the order the storefront shows them
|
|
405
|
-
* (`is_default` marks the one issued when none is chosen). Each item
|
|
406
|
-
* carries its product card (name, tagline, benefits, tile picture),
|
|
407
|
-
* artwork, and the issuance price after the caller's subscription
|
|
408
|
-
* discount, in the caller's wallet currency. Pass an item's `id` as
|
|
409
|
-
* `productId` to {@link create}.
|
|
410
|
-
*/
|
|
411
|
-
async listProducts() {
|
|
412
|
-
return this.http.get("/me/card-products");
|
|
413
|
-
}
|
|
414
|
-
/** One product from the catalog. 404 when unknown, disabled or hidden. */
|
|
415
|
-
async getProduct(id) {
|
|
416
|
-
return this.http.get(`/me/card-products/${encodeURIComponent(id)}`);
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
* The public catalog: the same products, order and default as
|
|
420
|
-
* {@link listProducts}, but readable before sign-in, for a landing page or
|
|
421
|
-
* the cabinet's first screen. Prices are list prices (`discount_bps` is
|
|
422
|
-
* always 0); once the user is signed in, {@link listProducts} shows what
|
|
423
|
-
* they pay. The API lets caches keep this response for a minute.
|
|
424
|
-
*/
|
|
425
|
-
async catalog() {
|
|
426
|
-
return this.http.get("/card-products");
|
|
427
|
-
}
|
|
428
|
-
/**
|
|
429
|
-
* Rename the caller's own card or change its design. Resolves to the
|
|
430
|
-
* updated card. 404 if the card isn't the caller's; 400 `invalid_name` /
|
|
431
|
-
* `design_not_allowed` on a bad value.
|
|
432
|
-
*/
|
|
433
|
-
async update(id, input) {
|
|
434
|
-
const body = {};
|
|
435
|
-
if (input.name !== void 0) body["name"] = input.name;
|
|
436
|
-
if (input.designId !== void 0) body["design_id"] = input.designId;
|
|
437
|
-
return this.http.patch(`/me/cards/${encodeURIComponent(id)}`, {
|
|
438
|
-
body
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
/** Fetch one card by id. */
|
|
442
|
-
async get(id) {
|
|
443
|
-
return this.http.get(`/me/cards/${encodeURIComponent(id)}`);
|
|
444
|
-
}
|
|
445
|
-
/** List the caller's cards, most recent first. */
|
|
446
|
-
async list() {
|
|
447
|
-
return this.http.get("/me/cards");
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Remaining balance of a prepaid card. `currency` is required by the Takeal API and
|
|
451
|
-
* forwarded as a query param.
|
|
452
|
-
*/
|
|
453
|
-
async balance(id, currency) {
|
|
454
|
-
const q = new URLSearchParams({ currency }).toString();
|
|
455
|
-
return this.http.get(`/me/cards/${encodeURIComponent(id)}/balance?${q}`);
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* What a top-up of this card can be right now: whether it is possible, the
|
|
459
|
-
* currency, the wallet balance, and the product's floor and cap for one
|
|
460
|
-
* top-up. Read it before drawing the form. 404 if the card isn't the caller's.
|
|
461
|
-
*/
|
|
462
|
-
async topUpTerms(id) {
|
|
463
|
-
return this.http.get(`/me/cards/${encodeURIComponent(id)}/topup`);
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Move money from the wallet onto the caller's own card. The wallet is
|
|
467
|
-
* debited first, then the card's provider loads the card; if the provider
|
|
468
|
-
* refuses, the money is back on the wallet and the error says so. Resolves
|
|
469
|
-
* to the card, its new balance and the wallet balance, so no second call
|
|
470
|
-
* is needed. Errors carry a sentence the user can read: 400 outside the
|
|
471
|
-
* floor or cap · 402 not enough in the wallet · 404 not the caller's card ·
|
|
472
|
-
* 409 card frozen, closed or still being issued · 501 provider can't top
|
|
473
|
-
* up · 502/503 provider declined or unreachable (wallet untouched).
|
|
474
|
-
*/
|
|
475
|
-
async topUp(id, input) {
|
|
476
|
-
const { idempotencyKey, amount } = input;
|
|
477
|
-
return this.http.post(`/me/cards/${encodeURIComponent(id)}/topup`, {
|
|
478
|
-
body: { amount },
|
|
479
|
-
idempotencyKey
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Move money from one of the caller's cards to another. Both must be
|
|
484
|
-
* theirs, active, in the same currency and of the same kind. The money
|
|
485
|
-
* travels through the wallet one leg at a time: when the second leg does
|
|
486
|
-
* not go through, the call still resolves, `transfer.status` is
|
|
487
|
-
* `on_wallet` and the money is on the wallet — never between two cards.
|
|
488
|
-
* Errors carry a sentence the user can read: 400 the same card twice,
|
|
489
|
-
* different currencies or different kinds · 402 the card holds less than
|
|
490
|
-
* that · 404 one of the cards isn't theirs · 409 a card is frozen, closed
|
|
491
|
-
* or still being issued, or the key was reused with a different body ·
|
|
492
|
-
* 501/502/503 the provider cannot or will not move it.
|
|
493
|
-
*/
|
|
494
|
-
async transfer(fromCardId, input) {
|
|
495
|
-
const { toCardId, amount, idempotencyKey } = input;
|
|
496
|
-
return this.http.post(`/me/cards/${encodeURIComponent(fromCardId)}/transfer`, {
|
|
497
|
-
body: { to_card_id: toCardId, amount },
|
|
498
|
-
idempotencyKey
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Freeze the caller's own card. Reversible via {@link unfreeze} while
|
|
503
|
-
* `status_source` is `holder` or `operator`. The optional `reason` is
|
|
504
|
-
* recorded on the audit trail. Resolves to the updated card. 404 if the
|
|
505
|
-
* card isn't the caller's; 409 `card_locked` when support holds it; 501 if
|
|
506
|
-
* the issuer can't freeze.
|
|
507
|
-
*/
|
|
508
|
-
async freeze(id, reason) {
|
|
509
|
-
return this.http.post(`/me/cards/${encodeURIComponent(id)}/freeze`, { body: { reason } });
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Reveal the FULL PAN + CVV for the caller's own card. The signed-in
|
|
513
|
-
* session is all the API asks for; the call is rate-limited and audited
|
|
514
|
-
* server-side. The Takeal API never persists this data and marks the
|
|
515
|
-
* response no-store; the SDK returns it verbatim and holds nothing.
|
|
516
|
-
*
|
|
517
|
-
* **Consumer security duties** (the SDK can't enforce these for you):
|
|
518
|
-
* keep the result in volatile memory only, never write it to
|
|
519
|
-
* localStorage / logs, and clear it within `expires_in_seconds`.
|
|
520
|
-
*
|
|
521
|
-
* The result is the numbers, or `reveal_url` with empty `pan` and `cvv`
|
|
522
|
-
* when the issuer shows them on a page of its own: open that page in a
|
|
523
|
-
* frame right away, it is short-lived.
|
|
524
|
-
*
|
|
525
|
-
* 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
|
|
526
|
-
* has no sensitive-data endpoint · 503 `provider_unavailable`.
|
|
527
|
-
*/
|
|
528
|
-
async reveal(id, _input) {
|
|
529
|
-
return this.http.post(`/me/cards/${encodeURIComponent(id)}/reveal`);
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* Unfreeze a previously-frozen card. Idempotent on an already-active card.
|
|
533
|
-
* A card the issuer froze (`status_source: "provider"`) is not the
|
|
534
|
-
* holder's to unfreeze: the API answers 409 `card_locked`, so hide the
|
|
535
|
-
* button and say the freeze is lifted through the issuer's support.
|
|
536
|
-
*/
|
|
537
|
-
async unfreeze(id) {
|
|
538
|
-
return this.http.post(`/me/cards/${encodeURIComponent(id)}/unfreeze`, { body: {} });
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Set the PIN of the caller's own physical card. The session is enough; the
|
|
542
|
-
* call is rate-limited like {@link reveal} and the PIN is kept nowhere.
|
|
543
|
-
* Resolves to the card; the user also gets a notification that the PIN
|
|
544
|
-
* was set. 400 not four to six digits or the card is not active · 403 not
|
|
545
|
-
* your card · 409 `card_locked`, or `provider_refused` when the issuer did
|
|
546
|
-
* not take it · 429 too many attempts · 501 a virtual card has no PIN.
|
|
547
|
-
*/
|
|
548
|
-
async setPin(id, input) {
|
|
549
|
-
return this.http.post(`/me/cards/${encodeURIComponent(id)}/pin`, {
|
|
550
|
-
body: { pin: input.pin }
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
/**
|
|
554
|
-
* Terminate the caller's own card. **One-way** — a terminated card cannot be
|
|
555
|
-
* reactivated. The optional `reason` is audited. Idempotent on an
|
|
556
|
-
* already-terminated card.
|
|
557
|
-
*/
|
|
558
|
-
async terminate(id, reason) {
|
|
559
|
-
return this.http.post(`/me/cards/${encodeURIComponent(id)}/terminate`, {
|
|
560
|
-
body: { reason }
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
};
|
|
564
|
-
|
|
565
601
|
// src/resources/deposits.ts
|
|
566
602
|
var DepositsResource = class {
|
|
567
603
|
constructor(http) {
|
|
@@ -1260,7 +1296,7 @@ var FundingOptionsResource = class {
|
|
|
1260
1296
|
};
|
|
1261
1297
|
|
|
1262
1298
|
// src/version.ts
|
|
1263
|
-
var SDK_VERSION = "0.6.
|
|
1299
|
+
var SDK_VERSION = "0.6.3";
|
|
1264
1300
|
|
|
1265
1301
|
// src/client-platform.ts
|
|
1266
1302
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1335,7 +1371,7 @@ function isAbsolute(url) {
|
|
|
1335
1371
|
}
|
|
1336
1372
|
|
|
1337
1373
|
// src/compat.ts
|
|
1338
|
-
var SUPPORTED_MEISTER = ">=0.6.
|
|
1374
|
+
var SUPPORTED_MEISTER = ">=0.6.8, <0.7.0";
|
|
1339
1375
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1340
1376
|
function parse(v) {
|
|
1341
1377
|
const m = SEMVER.exec(v.trim());
|