@takeal/cusfront-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/LICENSE +21 -0
  3. package/README.md +283 -0
  4. package/dist/customer-CoxPwe5o.d.cts +32 -0
  5. package/dist/customer-CoxPwe5o.d.ts +32 -0
  6. package/dist/http-BkZZZI8K.d.cts +72 -0
  7. package/dist/http-BkZZZI8K.d.ts +72 -0
  8. package/dist/index.cjs +486 -0
  9. package/dist/index.cjs.map +1 -0
  10. package/dist/index.d.cts +149 -0
  11. package/dist/index.d.ts +149 -0
  12. package/dist/index.js +478 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/react/index.cjs +82 -0
  15. package/dist/react/index.cjs.map +1 -0
  16. package/dist/react/index.d.cts +93 -0
  17. package/dist/react/index.d.ts +93 -0
  18. package/dist/react/index.js +75 -0
  19. package/dist/react/index.js.map +1 -0
  20. package/dist/resources/auth.cjs +88 -0
  21. package/dist/resources/auth.cjs.map +1 -0
  22. package/dist/resources/auth.d.cts +132 -0
  23. package/dist/resources/auth.d.ts +132 -0
  24. package/dist/resources/auth.js +86 -0
  25. package/dist/resources/auth.js.map +1 -0
  26. package/dist/resources/balance.cjs +21 -0
  27. package/dist/resources/balance.cjs.map +1 -0
  28. package/dist/resources/balance.d.cts +27 -0
  29. package/dist/resources/balance.d.ts +27 -0
  30. package/dist/resources/balance.js +19 -0
  31. package/dist/resources/balance.js.map +1 -0
  32. package/dist/resources/blog.cjs +39 -0
  33. package/dist/resources/blog.cjs.map +1 -0
  34. package/dist/resources/blog.d.cts +112 -0
  35. package/dist/resources/blog.d.ts +112 -0
  36. package/dist/resources/blog.js +37 -0
  37. package/dist/resources/blog.js.map +1 -0
  38. package/dist/resources/branding.cjs +16 -0
  39. package/dist/resources/branding.cjs.map +1 -0
  40. package/dist/resources/branding.d.cts +35 -0
  41. package/dist/resources/branding.d.ts +35 -0
  42. package/dist/resources/branding.js +14 -0
  43. package/dist/resources/branding.js.map +1 -0
  44. package/dist/resources/cards.cjs +91 -0
  45. package/dist/resources/cards.cjs.map +1 -0
  46. package/dist/resources/cards.d.cts +166 -0
  47. package/dist/resources/cards.d.ts +166 -0
  48. package/dist/resources/cards.js +89 -0
  49. package/dist/resources/cards.js.map +1 -0
  50. package/dist/resources/deposits.cjs +52 -0
  51. package/dist/resources/deposits.cjs.map +1 -0
  52. package/dist/resources/deposits.d.cts +168 -0
  53. package/dist/resources/deposits.d.ts +168 -0
  54. package/dist/resources/deposits.js +50 -0
  55. package/dist/resources/deposits.js.map +1 -0
  56. package/dist/resources/subscriptions.cjs +24 -0
  57. package/dist/resources/subscriptions.cjs.map +1 -0
  58. package/dist/resources/subscriptions.d.cts +36 -0
  59. package/dist/resources/subscriptions.d.ts +36 -0
  60. package/dist/resources/subscriptions.js +22 -0
  61. package/dist/resources/subscriptions.js.map +1 -0
  62. package/dist/telegram.cjs +557 -0
  63. package/dist/telegram.cjs.map +1 -0
  64. package/dist/telegram.d.cts +105 -0
  65. package/dist/telegram.d.ts +105 -0
  66. package/dist/telegram.js +550 -0
  67. package/dist/telegram.js.map +1 -0
  68. package/dist/webhooks.cjs +78 -0
  69. package/dist/webhooks.cjs.map +1 -0
  70. package/dist/webhooks.d.cts +70 -0
  71. package/dist/webhooks.d.ts +70 -0
  72. package/dist/webhooks.js +72 -0
  73. package/dist/webhooks.js.map +1 -0
  74. package/package.json +123 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/resources/cards.ts"],"names":[],"mappings":";AAkIO,IAAM,gBAAN,MAAoB;AAAA,EACzB,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhD,MAAM,OAAO,KAAA,EAAuC;AAClD,IAAA,MAAM,EAAE,cAAA,EAAgB,GAAG,IAAA,EAAK,GAAI,KAAA;AACpC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,IAAA,CAAW,WAAA,EAAa;AAAA,MACvC,IAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,IAAI,EAAA,EAA2B;AACnC,IAAA,OAAO,KAAK,IAAA,CAAK,GAAA,CAAU,aAAa,kBAAA,CAAmB,EAAE,CAAC,CAAA,CAAE,CAAA;AAAA,EAClE;AAAA;AAAA,EAGA,MAAM,IAAA,GAAwB;AAC5B,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAY,WAAW,CAAA;AAAA,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,OAAA,CAAQ,EAAA,EAAY,QAAA,EAAwC;AAChE,IAAA,MAAM,IAAI,IAAI,eAAA,CAAgB,EAAE,QAAA,EAAU,EAAE,QAAA,EAAS;AACrD,IAAA,OAAO,KAAK,IAAA,CAAK,GAAA;AAAA,MACf,CAAA,UAAA,EAAa,kBAAA,CAAmB,EAAE,CAAC,YAAY,CAAC,CAAA;AAAA,KAClD;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,MAAA,CAAO,EAAA,EAAY,MAAA,EAAgC;AACvD,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA;AAAA,MACf,CAAA,UAAA,EAAa,kBAAA,CAAmB,EAAE,CAAC,CAAA,OAAA,CAAA;AAAA,MACnC,EAAE,IAAA,EAAM,EAAE,MAAA,EAAO;AAAE,KACrB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeA,MAAM,MAAA,CAAO,EAAA,EAAY,KAAA,EAA+C;AACtE,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA;AAAA,MACf,CAAA,UAAA,EAAa,kBAAA,CAAmB,EAAE,CAAC,CAAA,OAAA,CAAA;AAAA,MACnC,EAAE,MAAM,EAAE,QAAA,EAAU,MAAM,QAAA,EAAU,SAAA,EAAW,KAAA,CAAM,QAAA,EAAS;AAAE,KAClE;AAAA,EACF;AAAA;AAAA,EAGA,MAAM,SAAS,EAAA,EAA2B;AACxC,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA;AAAA,MACf,CAAA,UAAA,EAAa,kBAAA,CAAmB,EAAE,CAAC,CAAA,SAAA,CAAA;AAAA,MACnC,EAAE,IAAA,EAAM,EAAC;AAAE,KACb;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,SAAA,CAAU,EAAA,EAAY,MAAA,EAAgC;AAC1D,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA;AAAA,MACf,CAAA,UAAA,EAAa,kBAAA,CAAmB,EAAE,CAAC,CAAA,UAAA,CAAA;AAAA,MACnC,EAAE,IAAA,EAAM,EAAE,MAAA,EAAO;AAAE,KACrB;AAAA,EACF;AACF","file":"cards.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\nimport type { CustomerInfo } from \"../types/customer.js\";\n\n/**\n * Cards resource — `client.cards.*`.\n *\n * The end-user \"money OUT\" surface: a user issues themselves a card backed by\n * their wallet balance via an issuer connector. Mirrors the Takeal API's\n * `/me/cards` routes:\n *\n * POST /me/cards → create\n * GET /me/cards → list (most recent first)\n * GET /me/cards/{id} → get\n * GET /me/cards/{id}/balance → balance (prepaid remaining)\n * POST /me/cards/{id}/freeze → freeze\n * POST /me/cards/{id}/unfreeze → unfreeze\n * POST /me/cards/{id}/terminate → terminate (one-way)\n *\n * The lifecycle actions are ownership-gated server-side: a caller can only\n * freeze / unfreeze / terminate a card that belongs to them (else 404).\n *\n * ## What is intentionally NOT here\n *\n * Card-data reveal (PAN / CVV) is a separate, security-sensitive flow with its\n * own re-auth + rate-limit + audit contract and is intentionally\n * NOT part of this resource (tracked separately).\n *\n * Today only PREPAID is wired end-to-end; CREDIT and GIFT return 400 from\n * the Takeal API until their issuer flows land.\n */\n\n/** Card product. Only `prepaid` is fully implemented today. */\nexport type CardType = \"credit\" | \"prepaid\" | \"gift\";\n\n/**\n * Card lifecycle state.\n *\n * `pending_payment` is a transient state: the row exists but the\n * per-card issuance-fee debit has not yet succeeded; such cards have no\n * provider reference and no user-visible side effects.\n */\nexport type CardStatus =\n | \"pending_payment\"\n | \"active\"\n | \"frozen\"\n | \"terminated\"\n | \"redeemed\"\n | \"failed\";\n\n/**\n * A card record as the Takeal API returns it. Mirrors the `cards` table. Note the\n * SDK never receives the full PAN or CVV here — only `last4` + expiry. The\n * gift-card `redemption_code` is returned exactly once (on create) and\n * scrubbed from subsequent list/get responses.\n */\nexport interface Card {\n id: string;\n user_id: string;\n card_type: CardType;\n /** Slug of the issuer that minted this card, as configured by the deployment. */\n connector_slug: string;\n /** The connector's own reference, populated once it responds. */\n provider_reference: string | null;\n status: CardStatus;\n /** Last four digits of the PAN — safe to display. */\n last4: string | null;\n expiry_month: number | null;\n expiry_year: number | null;\n /** Gift cards only, present once on create then scrubbed. */\n redemption_code?: string;\n /** Decimal as a string. */\n initial_amount: string | null;\n currency: string;\n failure_reason: string | null;\n created_at: string;\n updated_at: string;\n}\n\nexport interface CreateCardInput {\n /** `prepaid` (the only fully-wired type today), `credit`, or `gift`. */\n type: CardType;\n /** Decimal as a string. The prepaid load amount drained from wallet balance. */\n initial_amount?: string;\n /** ISO 4217 code, e.g. `\"USD\"`. */\n currency: string;\n /**\n * Optional. Slug of a specific issuer to mint with. Omit to let\n * the Takeal API pick the first active issuer. Unknown slug → 400; empty issuer\n * list → 503.\n */\n issuer_slug?: string;\n metadata?: Record<string, string>;\n /** Structured billing details — real issuers require these for 3DS / KYC. */\n customer?: CustomerInfo;\n /**\n * Required by the Takeal API on this write endpoint. Same key + body replays the\n * original card; same key + different body returns 409.\n */\n idempotencyKey: string;\n}\n\n/** Remaining balance of a prepaid card. */\nexport interface CardBalance {\n amount: string;\n currency: string;\n}\n\n/** Re-auth gate for {@link CardsResource.reveal}. */\nexport interface RevealCardInput {\n /** The user's account password — mandatory re-auth. */\n password: string;\n /** TOTP code; required only when the user has TOTP enrolled. */\n totpCode?: string;\n}\n\n/**\n * Full card data from a successful reveal. **Security**: never persist this —\n * keep it in volatile memory only, clear it within `expires_in_seconds`, and\n * never write it to localStorage / logs (the API marks the response no-store).\n */\nexport interface RevealedCard {\n pan: string;\n cvv: string;\n expiry_month: number;\n expiry_year: number;\n holder_name: string;\n /** Display window before the client should auto-clear the data. */\n expires_in_seconds: number;\n}\n\nexport class CardsResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Issue a card backed by the user's wallet balance. Resolves to the new\n * `Card`. On a ledger failure after provider creation, the Takeal API rolls the row\n * to `failed` (never an orphaned active card); inspect `status` /\n * `failure_reason` on the result.\n */\n async create(input: CreateCardInput): Promise<Card> {\n const { idempotencyKey, ...body } = input;\n return this.http.post<Card>(\"/me/cards\", {\n body,\n idempotencyKey,\n });\n }\n\n /** Fetch one card by id. */\n async get(id: string): Promise<Card> {\n return this.http.get<Card>(`/me/cards/${encodeURIComponent(id)}`);\n }\n\n /** List the caller's cards, most recent first. */\n async list(): Promise<Card[]> {\n return this.http.get<Card[]>(\"/me/cards\");\n }\n\n /**\n * Remaining balance of a prepaid card. `currency` is required by the Takeal API and\n * forwarded as a query param.\n */\n async balance(id: string, currency: string): Promise<CardBalance> {\n const q = new URLSearchParams({ currency }).toString();\n return this.http.get<CardBalance>(\n `/me/cards/${encodeURIComponent(id)}/balance?${q}`,\n );\n }\n\n /**\n * Freeze the caller's own card. Reversible via {@link unfreeze}. The optional\n * `reason` is recorded on the audit trail. Resolves to the updated card.\n * 404 if the card isn't the caller's; 501 if the issuer can't freeze.\n */\n async freeze(id: string, reason?: string): Promise<Card> {\n return this.http.post<Card>(\n `/me/cards/${encodeURIComponent(id)}/freeze`,\n { body: { reason } },\n );\n }\n\n /**\n * Reveal the FULL PAN + CVV for the caller's own card. Re-auth gated\n * (password, + TOTP when the user has it enrolled) and rate-limited\n * server-side. The Takeal API never persists this data and marks the\n * response no-store; the SDK returns it verbatim and holds nothing.\n *\n * **Consumer security duties** (the SDK can't enforce these for you):\n * keep the result in volatile memory only, never write it to\n * localStorage / logs, and clear it within `expires_in_seconds`.\n *\n * 401 bad re-auth · 403 not your card · 429 rate-limited · 501 connector\n * has no sensitive-data endpoint · 503 provider error.\n */\n async reveal(id: string, input: RevealCardInput): Promise<RevealedCard> {\n return this.http.post<RevealedCard>(\n `/me/cards/${encodeURIComponent(id)}/reveal`,\n { body: { password: input.password, totp_code: input.totpCode } },\n );\n }\n\n /** Unfreeze a previously-frozen card. Idempotent on an already-active card. */\n async unfreeze(id: string): Promise<Card> {\n return this.http.post<Card>(\n `/me/cards/${encodeURIComponent(id)}/unfreeze`,\n { body: {} },\n );\n }\n\n /**\n * Terminate the caller's own card. **One-way** — a terminated card cannot be\n * reactivated. The optional `reason` is audited. Idempotent on an\n * already-terminated card.\n */\n async terminate(id: string, reason?: string): Promise<Card> {\n return this.http.post<Card>(\n `/me/cards/${encodeURIComponent(id)}/terminate`,\n { body: { reason } },\n );\n }\n}\n"]}
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ // src/resources/deposits.ts
4
+ var DepositsResource = class {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ /**
9
+ * Initiate a top-up. Resolves to the freshly-created `Deposit`, whose
10
+ * `status` may already be `confirmed` (synchronous rails / mock) or
11
+ * `redirect_required` (3DS / APM — forward the user to `redirect_url`).
12
+ */
13
+ /**
14
+ * Price a cross-currency deposit BEFORE paying. The rate is locked
15
+ * server-side until `expires_at`; deposits in the local currency need no
16
+ * quote (the API answers 400 `no_quote_needed`).
17
+ */
18
+ async quote(input) {
19
+ return this.http.post("/me/deposits/quotes", { body: input });
20
+ }
21
+ async initiate(input) {
22
+ const { idempotencyKey, ...body } = input;
23
+ return this.http.post("/me/deposits", {
24
+ body,
25
+ idempotencyKey
26
+ });
27
+ }
28
+ /** Fetch one deposit by id — the poll target while a redirect resolves. */
29
+ async get(id) {
30
+ return this.http.get(`/me/deposits/${encodeURIComponent(id)}`);
31
+ }
32
+ /** List the caller's deposits, most recent first. */
33
+ async list() {
34
+ return this.http.get("/me/deposits");
35
+ }
36
+ /**
37
+ * Refund a previously-confirmed deposit. Synchronous when the
38
+ * connector settles inline; otherwise the row stays `pending` and flips
39
+ * later via the inbound `deposit.refunded` event.
40
+ */
41
+ async refund(depositId, input) {
42
+ const { idempotencyKey, ...body } = input;
43
+ return this.http.post(
44
+ `/me/deposits/${encodeURIComponent(depositId)}/refunds`,
45
+ { body, idempotencyKey }
46
+ );
47
+ }
48
+ };
49
+
50
+ exports.DepositsResource = DepositsResource;
51
+ //# sourceMappingURL=deposits.cjs.map
52
+ //# sourceMappingURL=deposits.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/resources/deposits.ts"],"names":[],"mappings":";;;AAyJO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYhD,MAAM,MAAM,KAAA,EAAgD;AAC1D,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA,CAAmB,uBAAuB,EAAE,IAAA,EAAM,OAAO,CAAA;AAAA,EAC5E;AAAA,EAEA,MAAM,SAAS,KAAA,EAA+C;AAC5D,IAAA,MAAM,EAAE,cAAA,EAAgB,GAAG,IAAA,EAAK,GAAI,KAAA;AACpC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,IAAA,CAAc,cAAA,EAAgB;AAAA,MAC7C,IAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,IAAI,EAAA,EAA8B;AACtC,IAAA,OAAO,KAAK,IAAA,CAAK,GAAA,CAAa,gBAAgB,kBAAA,CAAmB,EAAE,CAAC,CAAA,CAAE,CAAA;AAAA,EACxE;AAAA;AAAA,EAGA,MAAM,IAAA,GAA2B;AAC/B,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAe,cAAc,CAAA;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,MAAA,CACJ,SAAA,EACA,KAAA,EACiB;AACjB,IAAA,MAAM,EAAE,cAAA,EAAgB,GAAG,IAAA,EAAK,GAAI,KAAA;AACpC,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA;AAAA,MACf,CAAA,aAAA,EAAgB,kBAAA,CAAmB,SAAS,CAAC,CAAA,QAAA,CAAA;AAAA,MAC7C,EAAE,MAAM,cAAA;AAAe,KACzB;AAAA,EACF;AACF","file":"deposits.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\nimport type { CustomerInfo } from \"../types/customer.js\";\n\n/**\n * Deposits resource — `client.deposits.*`.\n *\n * The \"money IN\" surface: an end user tops up their wallet balance via a\n * funder connector. Mirrors the Takeal API's `/me/deposits` routes:\n *\n * POST /me/deposits → initiate\n * GET /me/deposits → list (most recent first)\n * GET /me/deposits/{id} → get\n * POST /me/deposits/{id}/refunds → refund\n *\n * A deposit is rarely terminal on the initiate call: real PSPs return\n * `redirect_required` (3DS / APM redirect) and flip to `confirmed` later via\n * a connector → Takeal API inbound event. Poll `get(id)` or watch the user's\n * webhook stream for the `deposit.confirmed` / `deposit.failed` outcome.\n */\n\n/** Lifecycle of a deposit. `redirect_required` carries `redirect_url`. */\nexport type DepositStatus =\n | \"pending\"\n | \"redirect_required\"\n | \"confirmed\"\n | \"failed\";\n\n/** Top-up rail. The chosen funder decides which it supports. */\nexport type DepositMethod = \"card\" | \"crypto\" | \"bank_transfer\";\n\n/**\n * A deposit record as the Takeal API returns it. Mirrors the `deposits` table; the\n * server-side `id` is the stable handle the SDK polls against. `idempotency_key`\n * and `request_fingerprint` are server-internal and never serialised.\n */\n/** Input for `quote()` — price a cross-currency deposit before paying. */\nexport interface CreateQuoteInput {\n /** Decimal string, e.g. `\"5000.00\"`. */\n amount: string;\n /** ISO 4217 source currency — must differ from the wallet's local currency. */\n currency: string;\n}\n\n/**\n * A rate-locked funding quote: pay `source_amount source_currency`, the\n * wallet is credited `credited_amount credited_currency` (net of the\n * platform's conversion spread). Execute by passing `id` as `quote_id` to\n * `initiate()` before `expires_at`; after that the API returns 409 and a new\n * quote is needed.\n */\nexport interface FundingQuote {\n id: string;\n source_amount: string;\n source_currency: string;\n credited_amount: string;\n credited_currency: string;\n /** Provider rate before spread (credited units per 1 source unit). */\n rate: string;\n spread_bps: number;\n provider: string;\n expires_at: string;\n}\n\nexport interface Deposit {\n id: string;\n user_id: string;\n /** Slug of the funder that handled this deposit, as configured by the deployment. */\n connector_slug: string;\n /** The connector's own reference, populated once it responds. */\n provider_reference: string | null;\n status: DepositStatus;\n /** Decimal serialised as a string to avoid float drift. */\n amount: string;\n currency: string;\n method: DepositMethod;\n /** Present when `status === \"redirect_required\"` — send the user here. */\n redirect_url: string | null;\n failure_reason: string | null;\n /** Final settled amount once confirmed (may differ from `amount` on FX). */\n confirmed_amount: string | null;\n confirmed_at: string | null;\n /** Set on cross-currency deposits: the quote this deposit executed against. */\n quote_id?: string | null;\n /** Locked provider rate (credited units per 1 source unit). */\n fx_rate?: string | null;\n fx_spread_bps?: number | null;\n /** The wallet's local currency the deposit converted into. */\n credited_currency?: string | null;\n /** What the wallet was actually credited, net of spread. */\n credited_amount?: string | null;\n created_at: string;\n updated_at: string;\n}\n\nexport interface InitiateDepositInput {\n /** Decimal as a string (`\"100.00\"`) — avoids float-precision loss on the wire. */\n amount: string;\n /** ISO 4217 code, e.g. `\"USD\"`. */\n currency: string;\n method: DepositMethod;\n /**\n * Optional. Slug of a specific funder to route through. Omit to\n * let the Takeal API pick the first active funder. Unknown slug → 400; empty\n * funder list → 503.\n */\n funder_slug?: string;\n /** Provider-specific extras. The mock funder reads `mock_scenario`. */\n metadata?: Record<string, string>;\n /** Structured billing details — real PSPs require these for 3DS / compliance. */\n customer?: CustomerInfo;\n /**\n * Required by the Takeal API on this write endpoint. Same key + body replays the\n * original deposit; same key + different body returns 409. Supply a stable\n * UUID per logical attempt so a retried network call is safe.\n */\n idempotencyKey: string;\n /**\n * Required when `currency` differs from the wallet's local currency: a\n * fresh quote id from `quote()`. Cross-currency deposits without one are\n * rejected with 400; expired quotes with 409.\n */\n quote_id?: string;\n}\n\nexport interface CreateDepositRefundInput {\n /** Omit for a full refund of the original confirmed amount; same currency. */\n amount?: string;\n /** Human-readable reason, e.g. `\"customer_request\"`. */\n reason?: string;\n metadata?: Record<string, string>;\n /** Required. Replays are keyed on this. */\n idempotencyKey: string;\n}\n\n/** A refund row as the Takeal API returns it (`refunds` table, deposit-targeted). */\nexport interface Refund {\n id: string;\n target_type: string;\n deposit_id?: string;\n payment_id?: string;\n connector_slug: string;\n amount: string;\n currency: string;\n reason: string;\n status: string;\n provider_refund_reference?: string;\n failure_reason?: string;\n requestor_type: string;\n requestor_id: string;\n created_at: string;\n updated_at: string;\n}\n\nexport class DepositsResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Initiate a top-up. Resolves to the freshly-created `Deposit`, whose\n * `status` may already be `confirmed` (synchronous rails / mock) or\n * `redirect_required` (3DS / APM — forward the user to `redirect_url`).\n */\n /**\n * Price a cross-currency deposit BEFORE paying. The rate is locked\n * server-side until `expires_at`; deposits in the local currency need no\n * quote (the API answers 400 `no_quote_needed`).\n */\n async quote(input: CreateQuoteInput): Promise<FundingQuote> {\n return this.http.post<FundingQuote>(\"/me/deposits/quotes\", { body: input });\n }\n\n async initiate(input: InitiateDepositInput): Promise<Deposit> {\n const { idempotencyKey, ...body } = input;\n return this.http.post<Deposit>(\"/me/deposits\", {\n body,\n idempotencyKey,\n });\n }\n\n /** Fetch one deposit by id — the poll target while a redirect resolves. */\n async get(id: string): Promise<Deposit> {\n return this.http.get<Deposit>(`/me/deposits/${encodeURIComponent(id)}`);\n }\n\n /** List the caller's deposits, most recent first. */\n async list(): Promise<Deposit[]> {\n return this.http.get<Deposit[]>(\"/me/deposits\");\n }\n\n /**\n * Refund a previously-confirmed deposit. Synchronous when the\n * connector settles inline; otherwise the row stays `pending` and flips\n * later via the inbound `deposit.refunded` event.\n */\n async refund(\n depositId: string,\n input: CreateDepositRefundInput,\n ): Promise<Refund> {\n const { idempotencyKey, ...body } = input;\n return this.http.post<Refund>(\n `/me/deposits/${encodeURIComponent(depositId)}/refunds`,\n { body, idempotencyKey },\n );\n }\n}\n"]}
@@ -0,0 +1,168 @@
1
+ import { H as HttpClient } from '../http-BkZZZI8K.cjs';
2
+ import { C as CustomerInfo } from '../customer-CoxPwe5o.cjs';
3
+
4
+ /**
5
+ * Deposits resource — `client.deposits.*`.
6
+ *
7
+ * The "money IN" surface: an end user tops up their wallet balance via a
8
+ * funder connector. Mirrors the Takeal API's `/me/deposits` routes:
9
+ *
10
+ * POST /me/deposits → initiate
11
+ * GET /me/deposits → list (most recent first)
12
+ * GET /me/deposits/{id} → get
13
+ * POST /me/deposits/{id}/refunds → refund
14
+ *
15
+ * A deposit is rarely terminal on the initiate call: real PSPs return
16
+ * `redirect_required` (3DS / APM redirect) and flip to `confirmed` later via
17
+ * a connector → Takeal API inbound event. Poll `get(id)` or watch the user's
18
+ * webhook stream for the `deposit.confirmed` / `deposit.failed` outcome.
19
+ */
20
+ /** Lifecycle of a deposit. `redirect_required` carries `redirect_url`. */
21
+ type DepositStatus = "pending" | "redirect_required" | "confirmed" | "failed";
22
+ /** Top-up rail. The chosen funder decides which it supports. */
23
+ type DepositMethod = "card" | "crypto" | "bank_transfer";
24
+ /**
25
+ * A deposit record as the Takeal API returns it. Mirrors the `deposits` table; the
26
+ * server-side `id` is the stable handle the SDK polls against. `idempotency_key`
27
+ * and `request_fingerprint` are server-internal and never serialised.
28
+ */
29
+ /** Input for `quote()` — price a cross-currency deposit before paying. */
30
+ interface CreateQuoteInput {
31
+ /** Decimal string, e.g. `"5000.00"`. */
32
+ amount: string;
33
+ /** ISO 4217 source currency — must differ from the wallet's local currency. */
34
+ currency: string;
35
+ }
36
+ /**
37
+ * A rate-locked funding quote: pay `source_amount source_currency`, the
38
+ * wallet is credited `credited_amount credited_currency` (net of the
39
+ * platform's conversion spread). Execute by passing `id` as `quote_id` to
40
+ * `initiate()` before `expires_at`; after that the API returns 409 and a new
41
+ * quote is needed.
42
+ */
43
+ interface FundingQuote {
44
+ id: string;
45
+ source_amount: string;
46
+ source_currency: string;
47
+ credited_amount: string;
48
+ credited_currency: string;
49
+ /** Provider rate before spread (credited units per 1 source unit). */
50
+ rate: string;
51
+ spread_bps: number;
52
+ provider: string;
53
+ expires_at: string;
54
+ }
55
+ interface Deposit {
56
+ id: string;
57
+ user_id: string;
58
+ /** Slug of the funder that handled this deposit, as configured by the deployment. */
59
+ connector_slug: string;
60
+ /** The connector's own reference, populated once it responds. */
61
+ provider_reference: string | null;
62
+ status: DepositStatus;
63
+ /** Decimal serialised as a string to avoid float drift. */
64
+ amount: string;
65
+ currency: string;
66
+ method: DepositMethod;
67
+ /** Present when `status === "redirect_required"` — send the user here. */
68
+ redirect_url: string | null;
69
+ failure_reason: string | null;
70
+ /** Final settled amount once confirmed (may differ from `amount` on FX). */
71
+ confirmed_amount: string | null;
72
+ confirmed_at: string | null;
73
+ /** Set on cross-currency deposits: the quote this deposit executed against. */
74
+ quote_id?: string | null;
75
+ /** Locked provider rate (credited units per 1 source unit). */
76
+ fx_rate?: string | null;
77
+ fx_spread_bps?: number | null;
78
+ /** The wallet's local currency the deposit converted into. */
79
+ credited_currency?: string | null;
80
+ /** What the wallet was actually credited, net of spread. */
81
+ credited_amount?: string | null;
82
+ created_at: string;
83
+ updated_at: string;
84
+ }
85
+ interface InitiateDepositInput {
86
+ /** Decimal as a string (`"100.00"`) — avoids float-precision loss on the wire. */
87
+ amount: string;
88
+ /** ISO 4217 code, e.g. `"USD"`. */
89
+ currency: string;
90
+ method: DepositMethod;
91
+ /**
92
+ * Optional. Slug of a specific funder to route through. Omit to
93
+ * let the Takeal API pick the first active funder. Unknown slug → 400; empty
94
+ * funder list → 503.
95
+ */
96
+ funder_slug?: string;
97
+ /** Provider-specific extras. The mock funder reads `mock_scenario`. */
98
+ metadata?: Record<string, string>;
99
+ /** Structured billing details — real PSPs require these for 3DS / compliance. */
100
+ customer?: CustomerInfo;
101
+ /**
102
+ * Required by the Takeal API on this write endpoint. Same key + body replays the
103
+ * original deposit; same key + different body returns 409. Supply a stable
104
+ * UUID per logical attempt so a retried network call is safe.
105
+ */
106
+ idempotencyKey: string;
107
+ /**
108
+ * Required when `currency` differs from the wallet's local currency: a
109
+ * fresh quote id from `quote()`. Cross-currency deposits without one are
110
+ * rejected with 400; expired quotes with 409.
111
+ */
112
+ quote_id?: string;
113
+ }
114
+ interface CreateDepositRefundInput {
115
+ /** Omit for a full refund of the original confirmed amount; same currency. */
116
+ amount?: string;
117
+ /** Human-readable reason, e.g. `"customer_request"`. */
118
+ reason?: string;
119
+ metadata?: Record<string, string>;
120
+ /** Required. Replays are keyed on this. */
121
+ idempotencyKey: string;
122
+ }
123
+ /** A refund row as the Takeal API returns it (`refunds` table, deposit-targeted). */
124
+ interface Refund {
125
+ id: string;
126
+ target_type: string;
127
+ deposit_id?: string;
128
+ payment_id?: string;
129
+ connector_slug: string;
130
+ amount: string;
131
+ currency: string;
132
+ reason: string;
133
+ status: string;
134
+ provider_refund_reference?: string;
135
+ failure_reason?: string;
136
+ requestor_type: string;
137
+ requestor_id: string;
138
+ created_at: string;
139
+ updated_at: string;
140
+ }
141
+ declare class DepositsResource {
142
+ private readonly http;
143
+ constructor(http: HttpClient);
144
+ /**
145
+ * Initiate a top-up. Resolves to the freshly-created `Deposit`, whose
146
+ * `status` may already be `confirmed` (synchronous rails / mock) or
147
+ * `redirect_required` (3DS / APM — forward the user to `redirect_url`).
148
+ */
149
+ /**
150
+ * Price a cross-currency deposit BEFORE paying. The rate is locked
151
+ * server-side until `expires_at`; deposits in the local currency need no
152
+ * quote (the API answers 400 `no_quote_needed`).
153
+ */
154
+ quote(input: CreateQuoteInput): Promise<FundingQuote>;
155
+ initiate(input: InitiateDepositInput): Promise<Deposit>;
156
+ /** Fetch one deposit by id — the poll target while a redirect resolves. */
157
+ get(id: string): Promise<Deposit>;
158
+ /** List the caller's deposits, most recent first. */
159
+ list(): Promise<Deposit[]>;
160
+ /**
161
+ * Refund a previously-confirmed deposit. Synchronous when the
162
+ * connector settles inline; otherwise the row stays `pending` and flips
163
+ * later via the inbound `deposit.refunded` event.
164
+ */
165
+ refund(depositId: string, input: CreateDepositRefundInput): Promise<Refund>;
166
+ }
167
+
168
+ export { type CreateDepositRefundInput, type CreateQuoteInput, type Deposit, type DepositMethod, type DepositStatus, DepositsResource, type FundingQuote, type InitiateDepositInput, type Refund };
@@ -0,0 +1,168 @@
1
+ import { H as HttpClient } from '../http-BkZZZI8K.js';
2
+ import { C as CustomerInfo } from '../customer-CoxPwe5o.js';
3
+
4
+ /**
5
+ * Deposits resource — `client.deposits.*`.
6
+ *
7
+ * The "money IN" surface: an end user tops up their wallet balance via a
8
+ * funder connector. Mirrors the Takeal API's `/me/deposits` routes:
9
+ *
10
+ * POST /me/deposits → initiate
11
+ * GET /me/deposits → list (most recent first)
12
+ * GET /me/deposits/{id} → get
13
+ * POST /me/deposits/{id}/refunds → refund
14
+ *
15
+ * A deposit is rarely terminal on the initiate call: real PSPs return
16
+ * `redirect_required` (3DS / APM redirect) and flip to `confirmed` later via
17
+ * a connector → Takeal API inbound event. Poll `get(id)` or watch the user's
18
+ * webhook stream for the `deposit.confirmed` / `deposit.failed` outcome.
19
+ */
20
+ /** Lifecycle of a deposit. `redirect_required` carries `redirect_url`. */
21
+ type DepositStatus = "pending" | "redirect_required" | "confirmed" | "failed";
22
+ /** Top-up rail. The chosen funder decides which it supports. */
23
+ type DepositMethod = "card" | "crypto" | "bank_transfer";
24
+ /**
25
+ * A deposit record as the Takeal API returns it. Mirrors the `deposits` table; the
26
+ * server-side `id` is the stable handle the SDK polls against. `idempotency_key`
27
+ * and `request_fingerprint` are server-internal and never serialised.
28
+ */
29
+ /** Input for `quote()` — price a cross-currency deposit before paying. */
30
+ interface CreateQuoteInput {
31
+ /** Decimal string, e.g. `"5000.00"`. */
32
+ amount: string;
33
+ /** ISO 4217 source currency — must differ from the wallet's local currency. */
34
+ currency: string;
35
+ }
36
+ /**
37
+ * A rate-locked funding quote: pay `source_amount source_currency`, the
38
+ * wallet is credited `credited_amount credited_currency` (net of the
39
+ * platform's conversion spread). Execute by passing `id` as `quote_id` to
40
+ * `initiate()` before `expires_at`; after that the API returns 409 and a new
41
+ * quote is needed.
42
+ */
43
+ interface FundingQuote {
44
+ id: string;
45
+ source_amount: string;
46
+ source_currency: string;
47
+ credited_amount: string;
48
+ credited_currency: string;
49
+ /** Provider rate before spread (credited units per 1 source unit). */
50
+ rate: string;
51
+ spread_bps: number;
52
+ provider: string;
53
+ expires_at: string;
54
+ }
55
+ interface Deposit {
56
+ id: string;
57
+ user_id: string;
58
+ /** Slug of the funder that handled this deposit, as configured by the deployment. */
59
+ connector_slug: string;
60
+ /** The connector's own reference, populated once it responds. */
61
+ provider_reference: string | null;
62
+ status: DepositStatus;
63
+ /** Decimal serialised as a string to avoid float drift. */
64
+ amount: string;
65
+ currency: string;
66
+ method: DepositMethod;
67
+ /** Present when `status === "redirect_required"` — send the user here. */
68
+ redirect_url: string | null;
69
+ failure_reason: string | null;
70
+ /** Final settled amount once confirmed (may differ from `amount` on FX). */
71
+ confirmed_amount: string | null;
72
+ confirmed_at: string | null;
73
+ /** Set on cross-currency deposits: the quote this deposit executed against. */
74
+ quote_id?: string | null;
75
+ /** Locked provider rate (credited units per 1 source unit). */
76
+ fx_rate?: string | null;
77
+ fx_spread_bps?: number | null;
78
+ /** The wallet's local currency the deposit converted into. */
79
+ credited_currency?: string | null;
80
+ /** What the wallet was actually credited, net of spread. */
81
+ credited_amount?: string | null;
82
+ created_at: string;
83
+ updated_at: string;
84
+ }
85
+ interface InitiateDepositInput {
86
+ /** Decimal as a string (`"100.00"`) — avoids float-precision loss on the wire. */
87
+ amount: string;
88
+ /** ISO 4217 code, e.g. `"USD"`. */
89
+ currency: string;
90
+ method: DepositMethod;
91
+ /**
92
+ * Optional. Slug of a specific funder to route through. Omit to
93
+ * let the Takeal API pick the first active funder. Unknown slug → 400; empty
94
+ * funder list → 503.
95
+ */
96
+ funder_slug?: string;
97
+ /** Provider-specific extras. The mock funder reads `mock_scenario`. */
98
+ metadata?: Record<string, string>;
99
+ /** Structured billing details — real PSPs require these for 3DS / compliance. */
100
+ customer?: CustomerInfo;
101
+ /**
102
+ * Required by the Takeal API on this write endpoint. Same key + body replays the
103
+ * original deposit; same key + different body returns 409. Supply a stable
104
+ * UUID per logical attempt so a retried network call is safe.
105
+ */
106
+ idempotencyKey: string;
107
+ /**
108
+ * Required when `currency` differs from the wallet's local currency: a
109
+ * fresh quote id from `quote()`. Cross-currency deposits without one are
110
+ * rejected with 400; expired quotes with 409.
111
+ */
112
+ quote_id?: string;
113
+ }
114
+ interface CreateDepositRefundInput {
115
+ /** Omit for a full refund of the original confirmed amount; same currency. */
116
+ amount?: string;
117
+ /** Human-readable reason, e.g. `"customer_request"`. */
118
+ reason?: string;
119
+ metadata?: Record<string, string>;
120
+ /** Required. Replays are keyed on this. */
121
+ idempotencyKey: string;
122
+ }
123
+ /** A refund row as the Takeal API returns it (`refunds` table, deposit-targeted). */
124
+ interface Refund {
125
+ id: string;
126
+ target_type: string;
127
+ deposit_id?: string;
128
+ payment_id?: string;
129
+ connector_slug: string;
130
+ amount: string;
131
+ currency: string;
132
+ reason: string;
133
+ status: string;
134
+ provider_refund_reference?: string;
135
+ failure_reason?: string;
136
+ requestor_type: string;
137
+ requestor_id: string;
138
+ created_at: string;
139
+ updated_at: string;
140
+ }
141
+ declare class DepositsResource {
142
+ private readonly http;
143
+ constructor(http: HttpClient);
144
+ /**
145
+ * Initiate a top-up. Resolves to the freshly-created `Deposit`, whose
146
+ * `status` may already be `confirmed` (synchronous rails / mock) or
147
+ * `redirect_required` (3DS / APM — forward the user to `redirect_url`).
148
+ */
149
+ /**
150
+ * Price a cross-currency deposit BEFORE paying. The rate is locked
151
+ * server-side until `expires_at`; deposits in the local currency need no
152
+ * quote (the API answers 400 `no_quote_needed`).
153
+ */
154
+ quote(input: CreateQuoteInput): Promise<FundingQuote>;
155
+ initiate(input: InitiateDepositInput): Promise<Deposit>;
156
+ /** Fetch one deposit by id — the poll target while a redirect resolves. */
157
+ get(id: string): Promise<Deposit>;
158
+ /** List the caller's deposits, most recent first. */
159
+ list(): Promise<Deposit[]>;
160
+ /**
161
+ * Refund a previously-confirmed deposit. Synchronous when the
162
+ * connector settles inline; otherwise the row stays `pending` and flips
163
+ * later via the inbound `deposit.refunded` event.
164
+ */
165
+ refund(depositId: string, input: CreateDepositRefundInput): Promise<Refund>;
166
+ }
167
+
168
+ export { type CreateDepositRefundInput, type CreateQuoteInput, type Deposit, type DepositMethod, type DepositStatus, DepositsResource, type FundingQuote, type InitiateDepositInput, type Refund };
@@ -0,0 +1,50 @@
1
+ // src/resources/deposits.ts
2
+ var DepositsResource = class {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ /**
7
+ * Initiate a top-up. Resolves to the freshly-created `Deposit`, whose
8
+ * `status` may already be `confirmed` (synchronous rails / mock) or
9
+ * `redirect_required` (3DS / APM — forward the user to `redirect_url`).
10
+ */
11
+ /**
12
+ * Price a cross-currency deposit BEFORE paying. The rate is locked
13
+ * server-side until `expires_at`; deposits in the local currency need no
14
+ * quote (the API answers 400 `no_quote_needed`).
15
+ */
16
+ async quote(input) {
17
+ return this.http.post("/me/deposits/quotes", { body: input });
18
+ }
19
+ async initiate(input) {
20
+ const { idempotencyKey, ...body } = input;
21
+ return this.http.post("/me/deposits", {
22
+ body,
23
+ idempotencyKey
24
+ });
25
+ }
26
+ /** Fetch one deposit by id — the poll target while a redirect resolves. */
27
+ async get(id) {
28
+ return this.http.get(`/me/deposits/${encodeURIComponent(id)}`);
29
+ }
30
+ /** List the caller's deposits, most recent first. */
31
+ async list() {
32
+ return this.http.get("/me/deposits");
33
+ }
34
+ /**
35
+ * Refund a previously-confirmed deposit. Synchronous when the
36
+ * connector settles inline; otherwise the row stays `pending` and flips
37
+ * later via the inbound `deposit.refunded` event.
38
+ */
39
+ async refund(depositId, input) {
40
+ const { idempotencyKey, ...body } = input;
41
+ return this.http.post(
42
+ `/me/deposits/${encodeURIComponent(depositId)}/refunds`,
43
+ { body, idempotencyKey }
44
+ );
45
+ }
46
+ };
47
+
48
+ export { DepositsResource };
49
+ //# sourceMappingURL=deposits.js.map
50
+ //# sourceMappingURL=deposits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/resources/deposits.ts"],"names":[],"mappings":";AAyJO,IAAM,mBAAN,MAAuB;AAAA,EAC5B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYhD,MAAM,MAAM,KAAA,EAAgD;AAC1D,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA,CAAmB,uBAAuB,EAAE,IAAA,EAAM,OAAO,CAAA;AAAA,EAC5E;AAAA,EAEA,MAAM,SAAS,KAAA,EAA+C;AAC5D,IAAA,MAAM,EAAE,cAAA,EAAgB,GAAG,IAAA,EAAK,GAAI,KAAA;AACpC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,IAAA,CAAc,cAAA,EAAgB;AAAA,MAC7C,IAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,IAAI,EAAA,EAA8B;AACtC,IAAA,OAAO,KAAK,IAAA,CAAK,GAAA,CAAa,gBAAgB,kBAAA,CAAmB,EAAE,CAAC,CAAA,CAAE,CAAA;AAAA,EACxE;AAAA;AAAA,EAGA,MAAM,IAAA,GAA2B;AAC/B,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAe,cAAc,CAAA;AAAA,EAChD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,MAAA,CACJ,SAAA,EACA,KAAA,EACiB;AACjB,IAAA,MAAM,EAAE,cAAA,EAAgB,GAAG,IAAA,EAAK,GAAI,KAAA;AACpC,IAAA,OAAO,KAAK,IAAA,CAAK,IAAA;AAAA,MACf,CAAA,aAAA,EAAgB,kBAAA,CAAmB,SAAS,CAAC,CAAA,QAAA,CAAA;AAAA,MAC7C,EAAE,MAAM,cAAA;AAAe,KACzB;AAAA,EACF;AACF","file":"deposits.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\nimport type { CustomerInfo } from \"../types/customer.js\";\n\n/**\n * Deposits resource — `client.deposits.*`.\n *\n * The \"money IN\" surface: an end user tops up their wallet balance via a\n * funder connector. Mirrors the Takeal API's `/me/deposits` routes:\n *\n * POST /me/deposits → initiate\n * GET /me/deposits → list (most recent first)\n * GET /me/deposits/{id} → get\n * POST /me/deposits/{id}/refunds → refund\n *\n * A deposit is rarely terminal on the initiate call: real PSPs return\n * `redirect_required` (3DS / APM redirect) and flip to `confirmed` later via\n * a connector → Takeal API inbound event. Poll `get(id)` or watch the user's\n * webhook stream for the `deposit.confirmed` / `deposit.failed` outcome.\n */\n\n/** Lifecycle of a deposit. `redirect_required` carries `redirect_url`. */\nexport type DepositStatus =\n | \"pending\"\n | \"redirect_required\"\n | \"confirmed\"\n | \"failed\";\n\n/** Top-up rail. The chosen funder decides which it supports. */\nexport type DepositMethod = \"card\" | \"crypto\" | \"bank_transfer\";\n\n/**\n * A deposit record as the Takeal API returns it. Mirrors the `deposits` table; the\n * server-side `id` is the stable handle the SDK polls against. `idempotency_key`\n * and `request_fingerprint` are server-internal and never serialised.\n */\n/** Input for `quote()` — price a cross-currency deposit before paying. */\nexport interface CreateQuoteInput {\n /** Decimal string, e.g. `\"5000.00\"`. */\n amount: string;\n /** ISO 4217 source currency — must differ from the wallet's local currency. */\n currency: string;\n}\n\n/**\n * A rate-locked funding quote: pay `source_amount source_currency`, the\n * wallet is credited `credited_amount credited_currency` (net of the\n * platform's conversion spread). Execute by passing `id` as `quote_id` to\n * `initiate()` before `expires_at`; after that the API returns 409 and a new\n * quote is needed.\n */\nexport interface FundingQuote {\n id: string;\n source_amount: string;\n source_currency: string;\n credited_amount: string;\n credited_currency: string;\n /** Provider rate before spread (credited units per 1 source unit). */\n rate: string;\n spread_bps: number;\n provider: string;\n expires_at: string;\n}\n\nexport interface Deposit {\n id: string;\n user_id: string;\n /** Slug of the funder that handled this deposit, as configured by the deployment. */\n connector_slug: string;\n /** The connector's own reference, populated once it responds. */\n provider_reference: string | null;\n status: DepositStatus;\n /** Decimal serialised as a string to avoid float drift. */\n amount: string;\n currency: string;\n method: DepositMethod;\n /** Present when `status === \"redirect_required\"` — send the user here. */\n redirect_url: string | null;\n failure_reason: string | null;\n /** Final settled amount once confirmed (may differ from `amount` on FX). */\n confirmed_amount: string | null;\n confirmed_at: string | null;\n /** Set on cross-currency deposits: the quote this deposit executed against. */\n quote_id?: string | null;\n /** Locked provider rate (credited units per 1 source unit). */\n fx_rate?: string | null;\n fx_spread_bps?: number | null;\n /** The wallet's local currency the deposit converted into. */\n credited_currency?: string | null;\n /** What the wallet was actually credited, net of spread. */\n credited_amount?: string | null;\n created_at: string;\n updated_at: string;\n}\n\nexport interface InitiateDepositInput {\n /** Decimal as a string (`\"100.00\"`) — avoids float-precision loss on the wire. */\n amount: string;\n /** ISO 4217 code, e.g. `\"USD\"`. */\n currency: string;\n method: DepositMethod;\n /**\n * Optional. Slug of a specific funder to route through. Omit to\n * let the Takeal API pick the first active funder. Unknown slug → 400; empty\n * funder list → 503.\n */\n funder_slug?: string;\n /** Provider-specific extras. The mock funder reads `mock_scenario`. */\n metadata?: Record<string, string>;\n /** Structured billing details — real PSPs require these for 3DS / compliance. */\n customer?: CustomerInfo;\n /**\n * Required by the Takeal API on this write endpoint. Same key + body replays the\n * original deposit; same key + different body returns 409. Supply a stable\n * UUID per logical attempt so a retried network call is safe.\n */\n idempotencyKey: string;\n /**\n * Required when `currency` differs from the wallet's local currency: a\n * fresh quote id from `quote()`. Cross-currency deposits without one are\n * rejected with 400; expired quotes with 409.\n */\n quote_id?: string;\n}\n\nexport interface CreateDepositRefundInput {\n /** Omit for a full refund of the original confirmed amount; same currency. */\n amount?: string;\n /** Human-readable reason, e.g. `\"customer_request\"`. */\n reason?: string;\n metadata?: Record<string, string>;\n /** Required. Replays are keyed on this. */\n idempotencyKey: string;\n}\n\n/** A refund row as the Takeal API returns it (`refunds` table, deposit-targeted). */\nexport interface Refund {\n id: string;\n target_type: string;\n deposit_id?: string;\n payment_id?: string;\n connector_slug: string;\n amount: string;\n currency: string;\n reason: string;\n status: string;\n provider_refund_reference?: string;\n failure_reason?: string;\n requestor_type: string;\n requestor_id: string;\n created_at: string;\n updated_at: string;\n}\n\nexport class DepositsResource {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Initiate a top-up. Resolves to the freshly-created `Deposit`, whose\n * `status` may already be `confirmed` (synchronous rails / mock) or\n * `redirect_required` (3DS / APM — forward the user to `redirect_url`).\n */\n /**\n * Price a cross-currency deposit BEFORE paying. The rate is locked\n * server-side until `expires_at`; deposits in the local currency need no\n * quote (the API answers 400 `no_quote_needed`).\n */\n async quote(input: CreateQuoteInput): Promise<FundingQuote> {\n return this.http.post<FundingQuote>(\"/me/deposits/quotes\", { body: input });\n }\n\n async initiate(input: InitiateDepositInput): Promise<Deposit> {\n const { idempotencyKey, ...body } = input;\n return this.http.post<Deposit>(\"/me/deposits\", {\n body,\n idempotencyKey,\n });\n }\n\n /** Fetch one deposit by id — the poll target while a redirect resolves. */\n async get(id: string): Promise<Deposit> {\n return this.http.get<Deposit>(`/me/deposits/${encodeURIComponent(id)}`);\n }\n\n /** List the caller's deposits, most recent first. */\n async list(): Promise<Deposit[]> {\n return this.http.get<Deposit[]>(\"/me/deposits\");\n }\n\n /**\n * Refund a previously-confirmed deposit. Synchronous when the\n * connector settles inline; otherwise the row stays `pending` and flips\n * later via the inbound `deposit.refunded` event.\n */\n async refund(\n depositId: string,\n input: CreateDepositRefundInput,\n ): Promise<Refund> {\n const { idempotencyKey, ...body } = input;\n return this.http.post<Refund>(\n `/me/deposits/${encodeURIComponent(depositId)}/refunds`,\n { body, idempotencyKey },\n );\n }\n}\n"]}
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ // src/resources/subscriptions.ts
4
+ var SubscriptionsResource = class {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ async get() {
9
+ return this.http.get("/me/subscriptions");
10
+ }
11
+ /**
12
+ * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out
13
+ * of everything.
14
+ */
15
+ async set(channels) {
16
+ return this.http.put("/me/subscriptions", {
17
+ body: { channels }
18
+ });
19
+ }
20
+ };
21
+
22
+ exports.SubscriptionsResource = SubscriptionsResource;
23
+ //# sourceMappingURL=subscriptions.cjs.map
24
+ //# sourceMappingURL=subscriptions.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";;;AA2BO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA,EAEhD,MAAM,GAAA,GAA8B;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAmB,CAAA;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,IAAI,QAAA,EAAsD;AAC9D,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAA,EAAqB;AAAA,MACvD,IAAA,EAAM,EAAE,QAAA;AAAS,KAClB,CAAA;AAAA,EACH;AACF","file":"subscriptions.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Subscriptions resource — `client.subscriptions.*`.\n *\n * Which channels the signed-in user agreed to receive announcements on.\n * `available` tells you which toggles to render: a deployment with no\n * Telegram bot configured can't deliver there, so offering the switch would\n * be a lie.\n *\n * ```ts\n * const { channels, available } = await client.subscriptions.get();\n * await client.subscriptions.set([...channels, \"telegram\"]);\n * ```\n *\n * Unrelated to paid/VIP tiers — this is only about announcements.\n */\n\nexport type BroadcastChannel = \"email\" | \"telegram\" | (string & {});\n\nexport interface Subscriptions {\n /** Channels the user currently receives announcements on. */\n channels: BroadcastChannel[];\n /** Channels this deployment can actually deliver on. */\n available: BroadcastChannel[];\n}\n\nexport class SubscriptionsResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Subscriptions> {\n return this.http.get<Subscriptions>(\"/me/subscriptions\");\n }\n\n /**\n * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out\n * of everything.\n */\n async set(channels: BroadcastChannel[]): Promise<Subscriptions> {\n return this.http.put<Subscriptions>(\"/me/subscriptions\", {\n body: { channels },\n });\n }\n}\n"]}
@@ -0,0 +1,36 @@
1
+ import { H as HttpClient } from '../http-BkZZZI8K.cjs';
2
+
3
+ /**
4
+ * Subscriptions resource — `client.subscriptions.*`.
5
+ *
6
+ * Which channels the signed-in user agreed to receive announcements on.
7
+ * `available` tells you which toggles to render: a deployment with no
8
+ * Telegram bot configured can't deliver there, so offering the switch would
9
+ * be a lie.
10
+ *
11
+ * ```ts
12
+ * const { channels, available } = await client.subscriptions.get();
13
+ * await client.subscriptions.set([...channels, "telegram"]);
14
+ * ```
15
+ *
16
+ * Unrelated to paid/VIP tiers — this is only about announcements.
17
+ */
18
+ type BroadcastChannel = "email" | "telegram" | (string & {});
19
+ interface Subscriptions {
20
+ /** Channels the user currently receives announcements on. */
21
+ channels: BroadcastChannel[];
22
+ /** Channels this deployment can actually deliver on. */
23
+ available: BroadcastChannel[];
24
+ }
25
+ declare class SubscriptionsResource {
26
+ private readonly http;
27
+ constructor(http: HttpClient);
28
+ get(): Promise<Subscriptions>;
29
+ /**
30
+ * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out
31
+ * of everything.
32
+ */
33
+ set(channels: BroadcastChannel[]): Promise<Subscriptions>;
34
+ }
35
+
36
+ export { type BroadcastChannel, type Subscriptions, SubscriptionsResource };
@@ -0,0 +1,36 @@
1
+ import { H as HttpClient } from '../http-BkZZZI8K.js';
2
+
3
+ /**
4
+ * Subscriptions resource — `client.subscriptions.*`.
5
+ *
6
+ * Which channels the signed-in user agreed to receive announcements on.
7
+ * `available` tells you which toggles to render: a deployment with no
8
+ * Telegram bot configured can't deliver there, so offering the switch would
9
+ * be a lie.
10
+ *
11
+ * ```ts
12
+ * const { channels, available } = await client.subscriptions.get();
13
+ * await client.subscriptions.set([...channels, "telegram"]);
14
+ * ```
15
+ *
16
+ * Unrelated to paid/VIP tiers — this is only about announcements.
17
+ */
18
+ type BroadcastChannel = "email" | "telegram" | (string & {});
19
+ interface Subscriptions {
20
+ /** Channels the user currently receives announcements on. */
21
+ channels: BroadcastChannel[];
22
+ /** Channels this deployment can actually deliver on. */
23
+ available: BroadcastChannel[];
24
+ }
25
+ declare class SubscriptionsResource {
26
+ private readonly http;
27
+ constructor(http: HttpClient);
28
+ get(): Promise<Subscriptions>;
29
+ /**
30
+ * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out
31
+ * of everything.
32
+ */
33
+ set(channels: BroadcastChannel[]): Promise<Subscriptions>;
34
+ }
35
+
36
+ export { type BroadcastChannel, type Subscriptions, SubscriptionsResource };
@@ -0,0 +1,22 @@
1
+ // src/resources/subscriptions.ts
2
+ var SubscriptionsResource = class {
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ async get() {
7
+ return this.http.get("/me/subscriptions");
8
+ }
9
+ /**
10
+ * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out
11
+ * of everything.
12
+ */
13
+ async set(channels) {
14
+ return this.http.put("/me/subscriptions", {
15
+ body: { channels }
16
+ });
17
+ }
18
+ };
19
+
20
+ export { SubscriptionsResource };
21
+ //# sourceMappingURL=subscriptions.js.map
22
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";AA2BO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA,EAEhD,MAAM,GAAA,GAA8B;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAmB,CAAA;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,IAAI,QAAA,EAAsD;AAC9D,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAA,EAAqB;AAAA,MACvD,IAAA,EAAM,EAAE,QAAA;AAAS,KAClB,CAAA;AAAA,EACH;AACF","file":"subscriptions.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Subscriptions resource — `client.subscriptions.*`.\n *\n * Which channels the signed-in user agreed to receive announcements on.\n * `available` tells you which toggles to render: a deployment with no\n * Telegram bot configured can't deliver there, so offering the switch would\n * be a lie.\n *\n * ```ts\n * const { channels, available } = await client.subscriptions.get();\n * await client.subscriptions.set([...channels, \"telegram\"]);\n * ```\n *\n * Unrelated to paid/VIP tiers — this is only about announcements.\n */\n\nexport type BroadcastChannel = \"email\" | \"telegram\" | (string & {});\n\nexport interface Subscriptions {\n /** Channels the user currently receives announcements on. */\n channels: BroadcastChannel[];\n /** Channels this deployment can actually deliver on. */\n available: BroadcastChannel[];\n}\n\nexport class SubscriptionsResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Subscriptions> {\n return this.http.get<Subscriptions>(\"/me/subscriptions\");\n }\n\n /**\n * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out\n * of everything.\n */\n async set(channels: BroadcastChannel[]): Promise<Subscriptions> {\n return this.http.put<Subscriptions>(\"/me/subscriptions\", {\n body: { channels },\n });\n }\n}\n"]}