@tagadapay/node-sdk 0.2.1 → 1.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 (92) hide show
  1. package/README.md +1 -1
  2. package/dist/HttpClient.d.ts +10 -0
  3. package/dist/HttpClient.d.ts.map +1 -1
  4. package/dist/HttpClient.js +21 -6
  5. package/dist/HttpClient.js.map +1 -1
  6. package/dist/Tagada.d.ts +73 -0
  7. package/dist/Tagada.d.ts.map +1 -1
  8. package/dist/Tagada.js +43 -0
  9. package/dist/Tagada.js.map +1 -1
  10. package/dist/cli/init.d.ts +38 -0
  11. package/dist/cli/init.d.ts.map +1 -0
  12. package/dist/cli/init.js +392 -0
  13. package/dist/cli/init.js.map +1 -0
  14. package/dist/dashboard/client.d.ts +147 -0
  15. package/dist/dashboard/client.d.ts.map +1 -0
  16. package/dist/dashboard/client.js +243 -0
  17. package/dist/dashboard/client.js.map +1 -0
  18. package/dist/dashboard/httpTransport.d.ts +28 -0
  19. package/dist/dashboard/httpTransport.d.ts.map +1 -0
  20. package/dist/dashboard/httpTransport.js +196 -0
  21. package/dist/dashboard/httpTransport.js.map +1 -0
  22. package/dist/dashboard/index.d.ts +22 -0
  23. package/dist/dashboard/index.d.ts.map +1 -0
  24. package/dist/dashboard/index.js +22 -0
  25. package/dist/dashboard/index.js.map +1 -0
  26. package/dist/dashboard/internalTransport.d.ts +29 -0
  27. package/dist/dashboard/internalTransport.d.ts.map +1 -0
  28. package/dist/dashboard/internalTransport.js +70 -0
  29. package/dist/dashboard/internalTransport.js.map +1 -0
  30. package/dist/dashboard/types.d.ts +389 -0
  31. package/dist/dashboard/types.d.ts.map +1 -0
  32. package/dist/dashboard/types.js +50 -0
  33. package/dist/dashboard/types.js.map +1 -0
  34. package/dist/index.d.ts +4 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +12 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/onboarding/OnboardingClient.d.ts +117 -0
  39. package/dist/onboarding/OnboardingClient.d.ts.map +1 -0
  40. package/dist/onboarding/OnboardingClient.js +154 -0
  41. package/dist/onboarding/OnboardingClient.js.map +1 -0
  42. package/dist/resources/Partners.d.ts +133 -0
  43. package/dist/resources/Partners.d.ts.map +1 -0
  44. package/dist/resources/Partners.js +151 -0
  45. package/dist/resources/Partners.js.map +1 -0
  46. package/dist/resources/PaymentSetup.d.ts +34 -0
  47. package/dist/resources/PaymentSetup.d.ts.map +1 -0
  48. package/dist/resources/PaymentSetup.js +34 -0
  49. package/dist/resources/PaymentSetup.js.map +1 -0
  50. package/dist/resources/Plugins.d.ts +1 -1
  51. package/dist/resources/Plugins.d.ts.map +1 -1
  52. package/dist/resources/Plugins.js +10 -3
  53. package/dist/resources/Plugins.js.map +1 -1
  54. package/dist/resources/Products.d.ts +5 -1
  55. package/dist/resources/Products.d.ts.map +1 -1
  56. package/dist/resources/Products.js +6 -0
  57. package/dist/resources/Products.js.map +1 -1
  58. package/dist/resources/ShippingRates.d.ts +91 -0
  59. package/dist/resources/ShippingRates.d.ts.map +1 -0
  60. package/dist/resources/ShippingRates.js +36 -0
  61. package/dist/resources/ShippingRates.js.map +1 -0
  62. package/dist/resources/Threeds.d.ts +30 -0
  63. package/dist/resources/Threeds.d.ts.map +1 -0
  64. package/dist/resources/Threeds.js +32 -0
  65. package/dist/resources/Threeds.js.map +1 -0
  66. package/dist/resources/index.d.ts +1 -0
  67. package/dist/resources/index.d.ts.map +1 -1
  68. package/dist/resources/index.js +1 -0
  69. package/dist/resources/index.js.map +1 -1
  70. package/dist/types/index.d.ts +3 -1
  71. package/dist/types/index.d.ts.map +1 -1
  72. package/dist/types/index.js +3 -1
  73. package/dist/types/index.js.map +1 -1
  74. package/dist/types/partners.d.ts +119 -0
  75. package/dist/types/partners.d.ts.map +1 -0
  76. package/dist/types/partners.js +9 -0
  77. package/dist/types/partners.js.map +1 -0
  78. package/dist/types/paymentSetup.d.ts +67 -0
  79. package/dist/types/paymentSetup.d.ts.map +1 -0
  80. package/dist/types/paymentSetup.js +9 -0
  81. package/dist/types/paymentSetup.js.map +1 -0
  82. package/dist/types/plugins.d.ts +2 -2
  83. package/dist/types/plugins.d.ts.map +1 -1
  84. package/dist/types/products.d.ts +12 -0
  85. package/dist/types/products.d.ts.map +1 -1
  86. package/dist/types/stores.d.ts +0 -1
  87. package/dist/types/stores.d.ts.map +1 -1
  88. package/dist/types/threeds.d.ts +27 -0
  89. package/dist/types/threeds.d.ts.map +1 -0
  90. package/dist/types/threeds.js +8 -0
  91. package/dist/types/threeds.js.map +1 -0
  92. package/package.json +15 -1
@@ -0,0 +1,117 @@
1
+ /**
2
+ * Public, **unauthenticated** client for the Tagada onboarding endpoints.
3
+ *
4
+ * This is intentionally *not* a `Resource` on the main `Tagada` class because
5
+ * `Tagada` requires an API key in its constructor — but the whole point of
6
+ * onboarding is to *get* an API key. So we ship this as a standalone client
7
+ * that bypasses {@link HttpClient} entirely and uses `fetch` directly.
8
+ *
9
+ * Hits:
10
+ * - `POST {baseUrl}/api/public/onboarding/start`
11
+ * - `POST {baseUrl}/api/public/onboarding/verify`
12
+ *
13
+ * For a turn-key interactive flow, prefer the bundled `tagada-init` CLI:
14
+ * `npx -p @tagadapay/node-sdk tagada-init you@example.com`
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import Tagada from '@tagadapay/node-sdk';
19
+ *
20
+ * const client = Tagada.public();
21
+ *
22
+ * await client.start({ email: 'you@example.com', source: 'cli' });
23
+ * // ...prompt the user for the 6-digit code from their inbox...
24
+ * const { apiKey, storeId } = await client.verify({
25
+ * email: 'you@example.com',
26
+ * code: '384921',
27
+ * source: 'cli',
28
+ * });
29
+ *
30
+ * // Now build a regular Tagada client with the new key:
31
+ * const tagada = new Tagada(apiKey);
32
+ * ```
33
+ */
34
+ export interface OnboardingClientOptions {
35
+ /**
36
+ * Base URL of the TagadaPay API (no path suffix). Default:
37
+ * `https://api.tagada.io`. Override for local development:
38
+ * `http://localhost:3000`.
39
+ */
40
+ baseUrl?: string;
41
+ /** Per-request timeout, default 30s. */
42
+ timeout?: number;
43
+ }
44
+ export interface OnboardingStartInput {
45
+ /** Email that will receive the 6-digit code. */
46
+ email: string;
47
+ /** Free-form source tag (e.g. `'cli'`, `'docs'`, `'partner_xyz'`). */
48
+ source?: string;
49
+ /** Optional acquisition payload. Kept opaque so we can add fields later. */
50
+ utm?: Record<string, string>;
51
+ }
52
+ export interface OnboardingStartResult {
53
+ ok: true;
54
+ /** ISO-8601 timestamp at which the issued code stops working. */
55
+ expiresAt: string;
56
+ }
57
+ export interface OnboardingVerifyInput extends OnboardingStartInput {
58
+ /** Exactly 6 digits. */
59
+ code: string;
60
+ }
61
+ export interface OnboardingVerifyResult {
62
+ ok: true;
63
+ /** Use this immediately as `new Tagada(apiKey)`. */
64
+ apiKey: string;
65
+ accountId: string;
66
+ storeId: string;
67
+ clerkUserId: string;
68
+ clerkOrgId: string;
69
+ /** Slug of the auto-created Clerk org (used by the CRM URL scheme). */
70
+ orgSlug: string | null;
71
+ /**
72
+ * Products / payment flow / funnel are seeded asynchronously via Inngest.
73
+ * Poll `tagada.stores.retrieve(storeId).config.demoSeeding` if you need
74
+ * to wait for it before running an end-to-end test.
75
+ */
76
+ demoSeeding: 'pending';
77
+ }
78
+ export type OnboardingErrorCode = 'invalid_request' | 'invalid_code' | 'expired' | 'no_pending_code' | 'too_many_attempts' | 'rate_limited' | 'email_send_failed' | 'provisioning_failed' | 'network_error' | 'unknown';
79
+ export declare class OnboardingError extends Error {
80
+ readonly code: OnboardingErrorCode;
81
+ readonly statusCode: number | null;
82
+ readonly resetAt: Date | null;
83
+ readonly raw: unknown;
84
+ constructor(opts: {
85
+ message: string;
86
+ code: OnboardingErrorCode;
87
+ statusCode?: number | null;
88
+ resetAt?: Date | null;
89
+ raw?: unknown;
90
+ });
91
+ }
92
+ export declare class OnboardingClient {
93
+ private readonly baseUrl;
94
+ private readonly timeout;
95
+ constructor(opts?: OnboardingClientOptions);
96
+ /**
97
+ * Issue a fresh 6-digit verification code to the supplied email. Returns
98
+ * once the code has been queued for delivery — typically lands in the
99
+ * inbox within a few seconds.
100
+ *
101
+ * @throws {OnboardingError} `rate_limited` (429), `email_send_failed`
102
+ * (502), `invalid_request` (400), `network_error`, or `unknown`.
103
+ */
104
+ start(input: OnboardingStartInput): Promise<OnboardingStartResult>;
105
+ /**
106
+ * Verify the code; on success provisions a fresh sandbox account and
107
+ * returns its API key + IDs.
108
+ *
109
+ * @throws {OnboardingError} `invalid_code` (401), `expired` (410),
110
+ * `no_pending_code` (410), `too_many_attempts` (429),
111
+ * `rate_limited` (429), `provisioning_failed` (5xx),
112
+ * `invalid_request` (400), `network_error`, or `unknown`.
113
+ */
114
+ verify(input: OnboardingVerifyInput): Promise<OnboardingVerifyResult>;
115
+ private post;
116
+ }
117
+ //# sourceMappingURL=OnboardingClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OnboardingClient.d.ts","sourceRoot":"","sources":["../../src/onboarding/OnboardingClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAKH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,IAAI,CAAC;IACT,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;CACd;A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AAG,OAAO,CAAC,sBAAsB,CAAC;YAI7D,IAAI;CAiEnB"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Public, **unauthenticated** client for the Tagada onboarding endpoints.
3
+ *
4
+ * This is intentionally *not* a `Resource` on the main `Tagada` class because
5
+ * `Tagada` requires an API key in its constructor — but the whole point of
6
+ * onboarding is to *get* an API key. So we ship this as a standalone client
7
+ * that bypasses {@link HttpClient} entirely and uses `fetch` directly.
8
+ *
9
+ * Hits:
10
+ * - `POST {baseUrl}/api/public/onboarding/start`
11
+ * - `POST {baseUrl}/api/public/onboarding/verify`
12
+ *
13
+ * For a turn-key interactive flow, prefer the bundled `tagada-init` CLI:
14
+ * `npx -p @tagadapay/node-sdk tagada-init you@example.com`
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * import Tagada from '@tagadapay/node-sdk';
19
+ *
20
+ * const client = Tagada.public();
21
+ *
22
+ * await client.start({ email: 'you@example.com', source: 'cli' });
23
+ * // ...prompt the user for the 6-digit code from their inbox...
24
+ * const { apiKey, storeId } = await client.verify({
25
+ * email: 'you@example.com',
26
+ * code: '384921',
27
+ * source: 'cli',
28
+ * });
29
+ *
30
+ * // Now build a regular Tagada client with the new key:
31
+ * const tagada = new Tagada(apiKey);
32
+ * ```
33
+ */
34
+ const DEFAULT_BASE_URL = 'https://api.tagada.io';
35
+ const DEFAULT_TIMEOUT_MS = 30000;
36
+ export class OnboardingError extends Error {
37
+ constructor(opts) {
38
+ super(opts.message);
39
+ this.name = 'OnboardingError';
40
+ this.code = opts.code;
41
+ this.statusCode = opts.statusCode ?? null;
42
+ this.resetAt = opts.resetAt ?? null;
43
+ this.raw = opts.raw;
44
+ }
45
+ }
46
+ export class OnboardingClient {
47
+ constructor(opts = {}) {
48
+ this.baseUrl = (opts.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, '');
49
+ this.timeout = opts.timeout ?? DEFAULT_TIMEOUT_MS;
50
+ }
51
+ /**
52
+ * Issue a fresh 6-digit verification code to the supplied email. Returns
53
+ * once the code has been queued for delivery — typically lands in the
54
+ * inbox within a few seconds.
55
+ *
56
+ * @throws {OnboardingError} `rate_limited` (429), `email_send_failed`
57
+ * (502), `invalid_request` (400), `network_error`, or `unknown`.
58
+ */
59
+ async start(input) {
60
+ return this.post('/api/public/onboarding/start', input);
61
+ }
62
+ /**
63
+ * Verify the code; on success provisions a fresh sandbox account and
64
+ * returns its API key + IDs.
65
+ *
66
+ * @throws {OnboardingError} `invalid_code` (401), `expired` (410),
67
+ * `no_pending_code` (410), `too_many_attempts` (429),
68
+ * `rate_limited` (429), `provisioning_failed` (5xx),
69
+ * `invalid_request` (400), `network_error`, or `unknown`.
70
+ */
71
+ async verify(input) {
72
+ return this.post('/api/public/onboarding/verify', input);
73
+ }
74
+ async post(path, body) {
75
+ const url = `${this.baseUrl}${path}`;
76
+ const controller = new AbortController();
77
+ const timer = setTimeout(() => controller.abort(), this.timeout);
78
+ let res;
79
+ try {
80
+ res = await fetch(url, {
81
+ method: 'POST',
82
+ headers: {
83
+ 'Content-Type': 'application/json',
84
+ Accept: 'application/json',
85
+ 'User-Agent': 'tagada-node-sdk/onboarding',
86
+ },
87
+ body: JSON.stringify(body),
88
+ signal: controller.signal,
89
+ });
90
+ }
91
+ catch (err) {
92
+ if (err.name === 'AbortError') {
93
+ throw new OnboardingError({
94
+ message: `Request to ${url} timed out after ${this.timeout}ms`,
95
+ code: 'network_error',
96
+ });
97
+ }
98
+ throw new OnboardingError({
99
+ message: `Failed to reach ${url}: ${err.message}`,
100
+ code: 'network_error',
101
+ raw: err,
102
+ });
103
+ }
104
+ finally {
105
+ clearTimeout(timer);
106
+ }
107
+ let parsed = null;
108
+ try {
109
+ parsed = await res.json();
110
+ }
111
+ catch {
112
+ // Empty / non-JSON body — fall through with parsed=null.
113
+ }
114
+ if (res.ok) {
115
+ return parsed;
116
+ }
117
+ const body_ = (parsed ?? {});
118
+ // Map the server's error.code / status pair to our discriminated codes.
119
+ const code = mapErrorCode(res.status, body_.code);
120
+ const message = body_.error ?? `Request failed with status ${res.status}`;
121
+ const resetAt = body_.resetAt ? new Date(body_.resetAt) : null;
122
+ throw new OnboardingError({
123
+ message,
124
+ code,
125
+ statusCode: res.status,
126
+ resetAt,
127
+ raw: parsed,
128
+ });
129
+ }
130
+ }
131
+ function mapErrorCode(status, serverCode) {
132
+ if (serverCode === 'invalid_code')
133
+ return 'invalid_code';
134
+ if (serverCode === 'expired')
135
+ return 'expired';
136
+ if (serverCode === 'no_pending_code')
137
+ return 'no_pending_code';
138
+ if (serverCode === 'too_many_attempts')
139
+ return 'too_many_attempts';
140
+ if (status === 429)
141
+ return 'rate_limited';
142
+ if (status === 502)
143
+ return 'email_send_failed';
144
+ if (status === 400)
145
+ return 'invalid_request';
146
+ if (status === 410)
147
+ return 'expired';
148
+ if (status === 401)
149
+ return 'invalid_code';
150
+ if (status >= 500)
151
+ return 'provisioning_failed';
152
+ return 'unknown';
153
+ }
154
+ //# sourceMappingURL=OnboardingClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OnboardingClient.js","sourceRoot":"","sources":["../../src/onboarding/OnboardingClient.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AACjD,MAAM,kBAAkB,GAAG,KAAM,CAAC;AA+DlC,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAMxC,YAAY,IAMX;QACC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC;QACpC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG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EACd,UAA8B;IAE9B,IAAI,UAAU,KAAK,cAAc;QAAE,OAAO,cAAc,CAAC;IACzD,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC/C,IAAI,UAAU,KAAK,iBAAiB;QAAE,OAAO,iBAAiB,CAAC;IAC/D,IAAI,UAAU,KAAK,mBAAmB;QAAE,OAAO,mBAAmB,CAAC;IACnE,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,cAAc,CAAC;IAC1C,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,mBAAmB,CAAC;IAC/C,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,iBAAiB,CAAC;IAC7C,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,SAAS,CAAC;IACrC,IAAI,MAAM,KAAK,GAAG;QAAE,OAAO,cAAc,CAAC;IAC1C,IAAI,MAAM,IAAI,GAAG;QAAE,OAAO,qBAAqB,CAAC;IAChD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,133 @@
1
+ import { BaseResource } from './BaseResource.js';
2
+ import type { RequestOptions } from '../types/common.js';
3
+ import type { PartnerAccount, PartnerAccountCreateParams, PartnerAccountListParams, PartnerAccountUpdateParams, PartnerAccountRepointStoreParams, PartnerApiKey, PartnerApiKeyCreated, PartnerApiKeyCreateParams, PartnerRequirement, PartnerRequirementUpdateParams, PartnerDocument, PartnerDocumentRecordParams } from '../types/partners.js';
4
+ /**
5
+ * Partner Accounts resource (`tagada.partners.accounts.*`).
6
+ *
7
+ * Wraps `/api/tagadapay/v1/accounts`. Used by partners (PSPs, marketplaces,
8
+ * embedded-payments platforms) to provision and manage sub-merchants (TPAs).
9
+ *
10
+ * Each `create()` call atomically creates:
11
+ * 1. an `accounts` row (private namespace, no Clerk user — never auto-invited)
12
+ * 2. a `stores` row (auto-provisioned, `1 TPA = 1 store` invariant)
13
+ * 3. a `tagadapay_accounts` row (the TPA itself)
14
+ *
15
+ * Idempotency: pass `externalRef` to make `create()` idempotent on retries.
16
+ * A second call with the same `(partnerId, externalRef)` returns the existing TPA.
17
+ */
18
+ export declare class PartnerAccounts extends BaseResource {
19
+ /**
20
+ * Provision a new sub-merchant. Atomically creates the `accounts` row,
21
+ * the auto-provisioned store, and the TPA in a single round-trip.
22
+ *
23
+ * @example
24
+ * const tpa = await tagada.partners.accounts.create({
25
+ * legalName: 'Acme SAS',
26
+ * country: 'FR',
27
+ * currency: 'EUR',
28
+ * externalRef: 'merchant_42', // your own id — used for idempotency
29
+ * });
30
+ * // → { id: 'tpa_xxx', storeId: 'store_xxx', accountId: 'acc_xxx', ... }
31
+ */
32
+ create(params: PartnerAccountCreateParams, opts?: RequestOptions): Promise<PartnerAccount>;
33
+ retrieve(tpaId: string, opts?: RequestOptions): Promise<PartnerAccount>;
34
+ /**
35
+ * Look up a TPA by your own external reference (e.g. your merchant id).
36
+ * Returns `null` if no TPA matches.
37
+ */
38
+ retrieveByExternalRef(externalRef: string, opts?: RequestOptions): Promise<PartnerAccount | null>;
39
+ list(params?: PartnerAccountListParams, opts?: RequestOptions): Promise<{
40
+ data: PartnerAccount[];
41
+ hasMore: boolean;
42
+ }>;
43
+ update(tpaId: string, params: PartnerAccountUpdateParams, opts?: RequestOptions): Promise<PartnerAccount>;
44
+ /**
45
+ * Move the TPA from its current store to `targetStoreId`. The target
46
+ * store MUST belong to the same `accounts` row — we never let a TPA
47
+ * cross merchant entities. The old store stays intact (orphaned from
48
+ * any active TPA) so historical data remains accessible.
49
+ *
50
+ * NOT YET IMPLEMENTED — the corresponding backend route
51
+ * (`POST /api/tagadapay/v1/accounts/:id/repoint_store`) ships in a
52
+ * later phase. This stub throws synchronously so partner code
53
+ * doesn&rsquo;t depend on a route that 404s in production. Track the
54
+ * upstream ticket before re-enabling.
55
+ *
56
+ * @internal
57
+ */
58
+ repointStore(_tpaId: string, _params: PartnerAccountRepointStoreParams, _opts?: RequestOptions): Promise<PartnerAccount>;
59
+ /**
60
+ * Send a TagadaPay portal invitation to the merchant. Only meaningful
61
+ * when the partner&rsquo;s `merchantPortalAccess` policy is `'on_request'`.
62
+ *
63
+ * NOT YET IMPLEMENTED — the corresponding backend route
64
+ * (`POST /api/tagadapay/v1/accounts/:id/onboarding_link`) ships
65
+ * alongside the merchant-portal access policy enforcement. Stub
66
+ * throws synchronously to prevent silent 404s in partner code.
67
+ *
68
+ * @internal
69
+ */
70
+ invite(_tpaId: string, _opts?: RequestOptions): Promise<{
71
+ url: string;
72
+ expiresAt: string;
73
+ }>;
74
+ }
75
+ /**
76
+ * Partner API keys resource (`tagada.partners.apiKeys.*`).
77
+ *
78
+ * Sub-keys are restricted to a single TPA. Use sub-keys (not the partner key)
79
+ * for charging — smaller blast radius if either leaks.
80
+ */
81
+ export declare class PartnerApiKeys extends BaseResource {
82
+ /**
83
+ * Mint a sub-key restricted to one TPA. The plaintext `secret` is
84
+ * returned ONLY on creation — store it immediately in your secret manager.
85
+ */
86
+ create(tpaId: string, params?: PartnerApiKeyCreateParams, opts?: RequestOptions): Promise<PartnerApiKeyCreated>;
87
+ list(tpaId: string, opts?: RequestOptions): Promise<{
88
+ data: PartnerApiKey[];
89
+ }>;
90
+ /**
91
+ * Revoke a sub-key. Subsequent calls with that secret get HTTP 401.
92
+ * In-flight calls complete normally. Irreversible &mdash; mint a new key
93
+ * and deploy it before revoking.
94
+ */
95
+ revoke(apiKeyId: string, opts?: RequestOptions): Promise<{
96
+ id: string;
97
+ status: 'revoked';
98
+ }>;
99
+ }
100
+ /**
101
+ * Partner KYB requirements resource (`tagada.partners.requirements.*`).
102
+ */
103
+ export declare class PartnerRequirements extends BaseResource {
104
+ list(tpaId: string, opts?: RequestOptions): Promise<{
105
+ data: PartnerRequirement[];
106
+ }>;
107
+ update(tpaId: string, code: string, params: PartnerRequirementUpdateParams, opts?: RequestOptions): Promise<PartnerRequirement>;
108
+ }
109
+ /**
110
+ * Partner KYB documents resource (`tagada.partners.documents.*`).
111
+ *
112
+ * v1 ships only the metadata-only path. Document bytes live in S3 — you
113
+ * upload directly via a presigned URL we issue (`getUploadUrl()`), then
114
+ * call `record()` with the resulting `storageUrl` to attach metadata.
115
+ */
116
+ export declare class PartnerDocuments extends BaseResource {
117
+ list(tpaId: string, opts?: RequestOptions): Promise<{
118
+ data: PartnerDocument[];
119
+ }>;
120
+ record(params: PartnerDocumentRecordParams, opts?: RequestOptions): Promise<PartnerDocument>;
121
+ }
122
+ /**
123
+ * Aggregator class exposed as `tagada.partners`. Holds the per-resource
124
+ * sub-clients so you can write `tagada.partners.accounts.create(...)`.
125
+ */
126
+ export declare class Partners {
127
+ readonly accounts: PartnerAccounts;
128
+ readonly apiKeys: PartnerApiKeys;
129
+ readonly requirements: PartnerRequirements;
130
+ readonly documents: PartnerDocuments;
131
+ constructor(client: ConstructorParameters<typeof PartnerAccounts>[0]);
132
+ }
133
+ //# sourceMappingURL=Partners.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Partners.d.ts","sourceRoot":"","sources":["../../src/resources/Partners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,cAAc,EACd,0BAA0B,EAC1B,wBAAwB,EACxB,0BAA0B,EAC1B,gCAAgC,EAChC,aAAa,EACb,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,8BAA8B,EAC9B,eAAe,EACf,2BAA2B,EAC5B,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C;;;;;;;;;;;;OAYG;IACG,MAAM,CACV,MAAM,EAAE,0BAA0B,EAClC,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,cAAc,CAAC;IAIpB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAI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AA;KAAE,CAAC;CAOlG;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;IAC7C,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,kBAAkB,EAAE,CAAA;KAAE,CAAC;IAQnF,MAAM,CACV,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,8BAA8B,EACtC,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,kBAAkB,CAAC;CAO/B;AAED;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAC1C,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;IAQhF,MAAM,CACV,MAAM,EAAE,2BAA2B,EACnC,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,eAAe,CAAC;CAO5B;AAED;;;GAGG;AACH,qBAAa,QAAQ;IACnB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAC3C,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;gBAEzB,MAAM,EAAE,qBAAqB,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC;CAMrE"}
@@ -0,0 +1,151 @@
1
+ import { BaseResource } from './BaseResource.js';
2
+ /**
3
+ * Partner Accounts resource (`tagada.partners.accounts.*`).
4
+ *
5
+ * Wraps `/api/tagadapay/v1/accounts`. Used by partners (PSPs, marketplaces,
6
+ * embedded-payments platforms) to provision and manage sub-merchants (TPAs).
7
+ *
8
+ * Each `create()` call atomically creates:
9
+ * 1. an `accounts` row (private namespace, no Clerk user — never auto-invited)
10
+ * 2. a `stores` row (auto-provisioned, `1 TPA = 1 store` invariant)
11
+ * 3. a `tagadapay_accounts` row (the TPA itself)
12
+ *
13
+ * Idempotency: pass `externalRef` to make `create()` idempotent on retries.
14
+ * A second call with the same `(partnerId, externalRef)` returns the existing TPA.
15
+ */
16
+ export class PartnerAccounts extends BaseResource {
17
+ /**
18
+ * Provision a new sub-merchant. Atomically creates the `accounts` row,
19
+ * the auto-provisioned store, and the TPA in a single round-trip.
20
+ *
21
+ * @example
22
+ * const tpa = await tagada.partners.accounts.create({
23
+ * legalName: 'Acme SAS',
24
+ * country: 'FR',
25
+ * currency: 'EUR',
26
+ * externalRef: 'merchant_42', // your own id — used for idempotency
27
+ * });
28
+ * // → { id: 'tpa_xxx', storeId: 'store_xxx', accountId: 'acc_xxx', ... }
29
+ */
30
+ async create(params, opts) {
31
+ return this.client.partnerPost('/v1/accounts', params, opts);
32
+ }
33
+ async retrieve(tpaId, opts) {
34
+ return this.client.partnerGet(`/v1/accounts/${tpaId}`, undefined, opts);
35
+ }
36
+ /**
37
+ * Look up a TPA by your own external reference (e.g. your merchant id).
38
+ * Returns `null` if no TPA matches.
39
+ */
40
+ async retrieveByExternalRef(externalRef, opts) {
41
+ const list = await this.client.partnerGet('/v1/accounts', { externalRef, limit: 1 }, opts);
42
+ return list.data?.[0] ?? null;
43
+ }
44
+ async list(params, opts) {
45
+ return this.client.partnerGet('/v1/accounts', params, opts);
46
+ }
47
+ async update(tpaId, params, opts) {
48
+ return this.client.partnerPut(`/v1/accounts/${tpaId}`, params, opts);
49
+ }
50
+ /**
51
+ * Move the TPA from its current store to `targetStoreId`. The target
52
+ * store MUST belong to the same `accounts` row — we never let a TPA
53
+ * cross merchant entities. The old store stays intact (orphaned from
54
+ * any active TPA) so historical data remains accessible.
55
+ *
56
+ * NOT YET IMPLEMENTED — the corresponding backend route
57
+ * (`POST /api/tagadapay/v1/accounts/:id/repoint_store`) ships in a
58
+ * later phase. This stub throws synchronously so partner code
59
+ * doesn&rsquo;t depend on a route that 404s in production. Track the
60
+ * upstream ticket before re-enabling.
61
+ *
62
+ * @internal
63
+ */
64
+ async repointStore(_tpaId, _params, _opts) {
65
+ throw new Error("[tagada.partners.accounts.repointStore] route_not_implemented — " +
66
+ "the backend route POST /v1/accounts/:id/repoint_store is not yet " +
67
+ "available. Contact the TagadaPay team if you need TPA re-pointing.");
68
+ }
69
+ /**
70
+ * Send a TagadaPay portal invitation to the merchant. Only meaningful
71
+ * when the partner&rsquo;s `merchantPortalAccess` policy is `'on_request'`.
72
+ *
73
+ * NOT YET IMPLEMENTED — the corresponding backend route
74
+ * (`POST /api/tagadapay/v1/accounts/:id/onboarding_link`) ships
75
+ * alongside the merchant-portal access policy enforcement. Stub
76
+ * throws synchronously to prevent silent 404s in partner code.
77
+ *
78
+ * @internal
79
+ */
80
+ async invite(_tpaId, _opts) {
81
+ throw new Error("[tagada.partners.accounts.invite] route_not_implemented — " +
82
+ "the backend route POST /v1/accounts/:id/onboarding_link is not " +
83
+ "yet available. Contact the TagadaPay team if you need merchant " +
84
+ "portal invitations.");
85
+ }
86
+ }
87
+ /**
88
+ * Partner API keys resource (`tagada.partners.apiKeys.*`).
89
+ *
90
+ * Sub-keys are restricted to a single TPA. Use sub-keys (not the partner key)
91
+ * for charging — smaller blast radius if either leaks.
92
+ */
93
+ export class PartnerApiKeys extends BaseResource {
94
+ /**
95
+ * Mint a sub-key restricted to one TPA. The plaintext `secret` is
96
+ * returned ONLY on creation — store it immediately in your secret manager.
97
+ */
98
+ async create(tpaId, params, opts) {
99
+ return this.client.partnerPost(`/v1/accounts/${tpaId}/api_keys`, params ?? {}, opts);
100
+ }
101
+ async list(tpaId, opts) {
102
+ return this.client.partnerGet(`/v1/accounts/${tpaId}/api_keys`, undefined, opts);
103
+ }
104
+ /**
105
+ * Revoke a sub-key. Subsequent calls with that secret get HTTP 401.
106
+ * In-flight calls complete normally. Irreversible &mdash; mint a new key
107
+ * and deploy it before revoking.
108
+ */
109
+ async revoke(apiKeyId, opts) {
110
+ return this.client.partnerDel(`/v1/api_keys/${apiKeyId}`, undefined, opts);
111
+ }
112
+ }
113
+ /**
114
+ * Partner KYB requirements resource (`tagada.partners.requirements.*`).
115
+ */
116
+ export class PartnerRequirements extends BaseResource {
117
+ async list(tpaId, opts) {
118
+ return this.client.partnerGet(`/v1/accounts/${tpaId}/requirements`, undefined, opts);
119
+ }
120
+ async update(tpaId, code, params, opts) {
121
+ return this.client.partnerPut(`/v1/accounts/${tpaId}/requirements/${code}`, params, opts);
122
+ }
123
+ }
124
+ /**
125
+ * Partner KYB documents resource (`tagada.partners.documents.*`).
126
+ *
127
+ * v1 ships only the metadata-only path. Document bytes live in S3 — you
128
+ * upload directly via a presigned URL we issue (`getUploadUrl()`), then
129
+ * call `record()` with the resulting `storageUrl` to attach metadata.
130
+ */
131
+ export class PartnerDocuments extends BaseResource {
132
+ async list(tpaId, opts) {
133
+ return this.client.partnerGet(`/v1/accounts/${tpaId}/documents`, undefined, opts);
134
+ }
135
+ async record(params, opts) {
136
+ return this.client.partnerPost(`/v1/accounts/${params.tagadapayAccountId}/documents`, params, opts);
137
+ }
138
+ }
139
+ /**
140
+ * Aggregator class exposed as `tagada.partners`. Holds the per-resource
141
+ * sub-clients so you can write `tagada.partners.accounts.create(...)`.
142
+ */
143
+ export class Partners {
144
+ constructor(client) {
145
+ this.accounts = new PartnerAccounts(client);
146
+ this.apiKeys = new PartnerApiKeys(client);
147
+ this.requirements = new PartnerRequirements(client);
148
+ this.documents = new PartnerDocuments(client);
149
+ }
150
+ }
151
+ //# sourceMappingURL=Partners.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Partners.js","sourceRoot":"","sources":["../../src/resources/Partners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAC/C;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,MAAM,CACV,MAAkC,EA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,EACjC,SAAS,EACT,IAAI,CACL,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CACV,MAAmC,EACnC,IAAqB;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAC5B,gBAAgB,MAAM,CAAC,kBAAkB,YAAY,EACrD,MAAM,EACN,IAAI,CACL,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAMnB,YAAY,MAAwD;QAClE,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,YAAY,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,SAAS,GAAG,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;CACF"}
@@ -0,0 +1,34 @@
1
+ import { BaseResource } from './BaseResource.js';
2
+ import type { RequestOptions } from '../types/common.js';
3
+ import type { PaymentSetupConfig, PaymentSetupGetParams } from '../types/paymentSetup.js';
4
+ /**
5
+ * Payment setup config resource (`tagada.paymentSetup.*`).
6
+ *
7
+ * Returns the runtime payment configuration for a store: which methods
8
+ * are enabled, which processors handle them, and the metadata each
9
+ * needs to render. The shape is `Record<"{method}" | "{method}:{provider}", PaymentMethodConfig>`.
10
+ *
11
+ * Used by partners to discover what each merchant has enabled before
12
+ * rendering the payment UI &mdash; without needing to create a checkout session.
13
+ *
14
+ * @example
15
+ * const setup = await tagada.paymentSetup.get('store_xxx');
16
+ * if (setup.apple_pay?.enabled && setup.apple_pay.provider === 'apple_pay') {
17
+ * renderNativeApplePayButton();
18
+ * } else if (setup['apple_pay:stripe']?.enabled) {
19
+ * renderStripeExpressButton();
20
+ * }
21
+ */
22
+ export declare class PaymentSetup extends BaseResource {
23
+ /**
24
+ * Get the paymentSetupConfig for a store.
25
+ *
26
+ * Backed by `GET /v1/stores/:id/payment-setup` — currently in the
27
+ * W4.B1 backend workstream. Until that endpoint ships, this method
28
+ * returns a 404 with `code: 'route_not_implemented'`. See the
29
+ * [implementation plan](https://docs.tagadapay.com/internal/decisions/2026-04-29-partner-s2s-architecture)
30
+ * for status.
31
+ */
32
+ get(storeId: string, params?: PaymentSetupGetParams, opts?: RequestOptions): Promise<PaymentSetupConfig>;
33
+ }
34
+ //# sourceMappingURL=PaymentSetup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentSetup.d.ts","sourceRoot":"","sources":["../../src/resources/PaymentSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,YAAa,SAAQ,YAAY;IAC5C;;;;;;;;OAQG;IACG,GAAG,CACP,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,qBAAqB,EAC9B,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC,kBAAkB,CAAC;CAO/B"}
@@ -0,0 +1,34 @@
1
+ import { BaseResource } from './BaseResource.js';
2
+ /**
3
+ * Payment setup config resource (`tagada.paymentSetup.*`).
4
+ *
5
+ * Returns the runtime payment configuration for a store: which methods
6
+ * are enabled, which processors handle them, and the metadata each
7
+ * needs to render. The shape is `Record<"{method}" | "{method}:{provider}", PaymentMethodConfig>`.
8
+ *
9
+ * Used by partners to discover what each merchant has enabled before
10
+ * rendering the payment UI &mdash; without needing to create a checkout session.
11
+ *
12
+ * @example
13
+ * const setup = await tagada.paymentSetup.get('store_xxx');
14
+ * if (setup.apple_pay?.enabled && setup.apple_pay.provider === 'apple_pay') {
15
+ * renderNativeApplePayButton();
16
+ * } else if (setup['apple_pay:stripe']?.enabled) {
17
+ * renderStripeExpressButton();
18
+ * }
19
+ */
20
+ export class PaymentSetup extends BaseResource {
21
+ /**
22
+ * Get the paymentSetupConfig for a store.
23
+ *
24
+ * Backed by `GET /v1/stores/:id/payment-setup` — currently in the
25
+ * W4.B1 backend workstream. Until that endpoint ships, this method
26
+ * returns a 404 with `code: 'route_not_implemented'`. See the
27
+ * [implementation plan](https://docs.tagadapay.com/internal/decisions/2026-04-29-partner-s2s-architecture)
28
+ * for status.
29
+ */
30
+ async get(storeId, params, opts) {
31
+ return this._get(`/stores/${storeId}/payment-setup`, params, opts);
32
+ }
33
+ }
34
+ //# sourceMappingURL=PaymentSetup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaymentSetup.js","sourceRoot":"","sources":["../../src/resources/PaymentSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,YAAa,SAAQ,YAAY;IAC5C;;;;;;;;OAQG;IACH,KAAK,CAAC,GAAG,CACP,OAAe,EACf,MAA8B,EAC9B,IAAqB;QAErB,OAAO,IAAI,CAAC,IAAI,CACd,WAAW,OAAO,gBAAgB,EAClC,MAA6C,EAC7C,IAAI,CACL,CAAC;IACJ,CAAC;CACF"}