@tagadapay/node-sdk 1.2.1 → 2.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 (43) hide show
  1. package/README.md +82 -0
  2. package/dist/HttpClient.d.ts +21 -7
  3. package/dist/HttpClient.d.ts.map +1 -1
  4. package/dist/HttpClient.js +38 -13
  5. package/dist/HttpClient.js.map +1 -1
  6. package/dist/Tagada.d.ts +24 -5
  7. package/dist/Tagada.d.ts.map +1 -1
  8. package/dist/Tagada.js +4 -0
  9. package/dist/Tagada.js.map +1 -1
  10. package/dist/cli/init.js +4 -2
  11. package/dist/cli/init.js.map +1 -1
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js.map +1 -1
  15. package/dist/resources/Partners.d.ts +62 -111
  16. package/dist/resources/Partners.d.ts.map +1 -1
  17. package/dist/resources/Partners.js +70 -121
  18. package/dist/resources/Partners.js.map +1 -1
  19. package/dist/resources/Processing.d.ts +129 -0
  20. package/dist/resources/Processing.d.ts.map +1 -0
  21. package/dist/resources/Processing.js +153 -0
  22. package/dist/resources/Processing.js.map +1 -0
  23. package/dist/resources/TaxExemptions.d.ts +23 -0
  24. package/dist/resources/TaxExemptions.d.ts.map +1 -0
  25. package/dist/resources/TaxExemptions.js +25 -0
  26. package/dist/resources/TaxExemptions.js.map +1 -0
  27. package/dist/resources/index.d.ts +1 -0
  28. package/dist/resources/index.d.ts.map +1 -1
  29. package/dist/resources/index.js +1 -0
  30. package/dist/resources/index.js.map +1 -1
  31. package/dist/types/index.d.ts +1 -0
  32. package/dist/types/index.d.ts.map +1 -1
  33. package/dist/types/index.js +1 -0
  34. package/dist/types/index.js.map +1 -1
  35. package/dist/types/partners.d.ts +127 -52
  36. package/dist/types/partners.d.ts.map +1 -1
  37. package/dist/types/partners.js +20 -4
  38. package/dist/types/partners.js.map +1 -1
  39. package/dist/types/taxExemptions.d.ts +25 -0
  40. package/dist/types/taxExemptions.d.ts.map +1 -0
  41. package/dist/types/taxExemptions.js +2 -0
  42. package/dist/types/taxExemptions.js.map +1 -0
  43. package/package.json +1 -1
@@ -1,133 +1,84 @@
1
- import { BaseResource } from './BaseResource.js';
1
+ import type { HttpClient } from '../HttpClient.js';
2
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';
3
+ import type { Merchant, MerchantCreateParams, MerchantListParams, CrmKey, CrmKeyCreated, CrmKeyCreateParams } from '../types/partners.js';
4
+ import { ProcessingTpas } from './Processing.js';
4
5
  /**
5
- * Partner Accounts resource (`tagada.partners.accounts.*`).
6
+ * `tagada.partners.*` — the partner ("on behalf of") namespace. A partner
7
+ * provisions and manages merchants and TPAs for its own sub-merchants.
6
8
  *
7
- * Wraps `/api/tagadapay/v1/accounts`. Used by partners (PSPs, marketplaces,
8
- * embedded-payments platforms) to provision and manage sub-merchants (TPAs).
9
+ * The namespace mirrors the platform's two domains:
10
+ * - `partners.crm.*` → CRM provisioning (merchants + CRM keys),
11
+ * served on `/api/public/v1/partner/*`.
12
+ * - `partners.processing.*` → TagadaPay provisioning (TPAs, KYB, keys),
13
+ * served on `/api/tagadapay/v1/partner/*`.
9
14
  *
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)
15
+ * All write operations require a partner key (`tp_sk_partner_*`).
14
16
  *
15
- * Idempotency: pass `externalRef` to make `create()` idempotent on retries.
16
- * A second call with the same `(partnerId, externalRef)` returns the existing TPA.
17
+ * @see https://docs.tagadapay.com/developer-tools/partners/introduction
17
18
  */
18
- export declare class PartnerAccounts extends BaseResource {
19
+ /** CRM keys (`sk_crm_…`) for a merchant. `partners.crm.merchants.keys.*`. */
20
+ export declare class PartnerCrmKeys {
21
+ private readonly client;
22
+ constructor(client: HttpClient);
19
23
  /**
20
- * Provision a new sub-merchant. Atomically creates the `accounts` row,
21
- * the auto-provisioned store, and the TPA in a single round-trip.
24
+ * Mint a CRM Key for a merchant. The plaintext `token` is returned ONLY on
25
+ * creation. New tokens use the `sk_crm_…` format.
22
26
  *
23
27
  * @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', ... }
28
+ * const key = await tagada.partners.crm.merchants.keys.create('acc_xxx');
29
+ * // key.token = 'sk_crm_live_…'
31
30
  */
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;
31
+ create(accountId: string, params?: CrmKeyCreateParams, opts?: RequestOptions): Promise<CrmKeyCreated>;
32
+ list(accountId: string, opts?: RequestOptions): Promise<{
33
+ data: CrmKey[];
42
34
  }>;
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;
35
+ /** Revoke a CRM Key. Subsequent calls with that token get HTTP 401. */
36
+ revoke(keyId: string, opts?: RequestOptions): Promise<{
37
+ id: string;
38
+ status: 'revoked';
73
39
  }>;
74
40
  }
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 {
41
+ /** Merchants (`acc_xxx`) managed by a partner. `partners.crm.merchants.*`. */
42
+ export declare class PartnerCrmMerchants {
43
+ private readonly client;
44
+ readonly keys: PartnerCrmKeys;
45
+ constructor(client: HttpClient);
82
46
  /**
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.
47
+ * Create a CRM merchant. CRM-only is valid a merchant needs no TPA. Pass
48
+ * `externalRef` for idempotency.
49
+ *
50
+ * @example
51
+ * const merchant = await tagada.partners.crm.merchants.create({
52
+ * legalName: 'Acme SAS',
53
+ * externalRef: 'merchant_42',
54
+ * });
55
+ * // merchant.id = 'acc_xxx'
94
56
  */
95
- revoke(apiKeyId: string, opts?: RequestOptions): Promise<{
96
- id: string;
97
- status: 'revoked';
57
+ create(params: MerchantCreateParams, opts?: RequestOptions): Promise<Merchant>;
58
+ retrieve(accountId: string, opts?: RequestOptions): Promise<Merchant>;
59
+ /** Look up a merchant by your own external reference. Returns `null` if none match. */
60
+ retrieveByExternalRef(externalRef: string, opts?: RequestOptions): Promise<Merchant | null>;
61
+ list(params?: MerchantListParams, opts?: RequestOptions): Promise<{
62
+ data: Merchant[];
63
+ hasMore: boolean;
98
64
  }>;
99
65
  }
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>;
66
+ /** Aggregator for `tagada.partners.crm`. */
67
+ export declare class PartnerCrm {
68
+ readonly merchants: PartnerCrmMerchants;
69
+ constructor(client: HttpClient);
108
70
  }
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>;
71
+ /** Aggregator for `tagada.partners.processing`. */
72
+ export declare class PartnerProcessing {
73
+ /** TPAs (`tpa_xxx`) with nested `keys`, `requirements`, `documents`. */
74
+ readonly tpas: ProcessingTpas;
75
+ constructor(client: HttpClient);
121
76
  }
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
77
  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]);
78
+ /** CRM provisioning (merchants + CRM keys). */
79
+ readonly crm: PartnerCrm;
80
+ /** TagadaPay processing provisioning (TPAs, KYB, processing keys). */
81
+ readonly processing: PartnerProcessing;
82
+ constructor(client: HttpClient);
132
83
  }
133
84
  //# sourceMappingURL=Partners.d.ts.map
@@ -1 +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,K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S3F,IAAI,CACR,MAAM,CAAC,EAAE,kBAAkB,EAC3B,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC;QAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAOnD;AAED,4CAA4C;AAC5C,qBAAa,UAAU;IACrB,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;gBAE5B,MAAM,EAAE,UAAU;CAG/B;AAMD,mDAAmD;AACnD,qBAAa,iBAAiB;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;gBAElB,MAAM,EAAE,UAAU;CAI/B;AAMD,qBAAa,QAAQ;IACnB,+CAA+C;IAC/C,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;gBAE3B,MAAM,EAAE,UAAU;CAI/B"}
@@ -1,151 +1,100 @@
1
- import { BaseResource } from './BaseResource.js';
1
+ import { ProcessingTpas } from './Processing.js';
2
2
  /**
3
- * Partner Accounts resource (`tagada.partners.accounts.*`).
3
+ * `tagada.partners.*` — the partner ("on behalf of") namespace. A partner
4
+ * provisions and manages merchants and TPAs for its own sub-merchants.
4
5
  *
5
- * Wraps `/api/tagadapay/v1/accounts`. Used by partners (PSPs, marketplaces,
6
- * embedded-payments platforms) to provision and manage sub-merchants (TPAs).
6
+ * The namespace mirrors the platform's two domains:
7
+ * - `partners.crm.*` → CRM provisioning (merchants + CRM keys),
8
+ * served on `/api/public/v1/partner/*`.
9
+ * - `partners.processing.*` → TagadaPay provisioning (TPAs, KYB, keys),
10
+ * served on `/api/tagadapay/v1/partner/*`.
7
11
  *
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
+ * All write operations require a partner key (`tp_sk_partner_*`).
12
13
  *
13
- * Idempotency: pass `externalRef` to make `create()` idempotent on retries.
14
- * A second call with the same `(partnerId, externalRef)` returns the existing TPA.
14
+ * @see https://docs.tagadapay.com/developer-tools/partners/introduction
15
15
  */
16
- export class PartnerAccounts extends BaseResource {
16
+ // ═══════════════════════════════════════════════════════════════════
17
+ // CRM provisioning — partners.crm.*
18
+ // ═══════════════════════════════════════════════════════════════════
19
+ /** CRM keys (`sk_crm_…`) for a merchant. `partners.crm.merchants.keys.*`. */
20
+ export class PartnerCrmKeys {
21
+ constructor(client) {
22
+ this.client = client;
23
+ }
17
24
  /**
18
- * Provision a new sub-merchant. Atomically creates the `accounts` row,
19
- * the auto-provisioned store, and the TPA in a single round-trip.
25
+ * Mint a CRM Key for a merchant. The plaintext `token` is returned ONLY on
26
+ * creation. New tokens use the `sk_crm_…` format.
20
27
  *
21
28
  * @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
+ * const key = await tagada.partners.crm.merchants.keys.create('acc_xxx');
30
+ * // key.token = 'sk_crm_live_…'
29
31
  */
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);
32
+ async create(accountId, params, opts) {
33
+ return this.client.post(`/partner/merchants/${accountId}/keys`, params ?? {}, opts);
35
34
  }
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;
35
+ async list(accountId, opts) {
36
+ return this.client.get(`/partner/merchants/${accountId}/keys`, undefined, opts);
43
37
  }
44
- async list(params, opts) {
45
- return this.client.partnerGet('/v1/accounts', params, opts);
38
+ /** Revoke a CRM Key. Subsequent calls with that token get HTTP 401. */
39
+ async revoke(keyId, opts) {
40
+ return this.client.del(`/partner/keys/${keyId}`, undefined, opts);
46
41
  }
47
- async update(tpaId, params, opts) {
48
- return this.client.partnerPut(`/v1/accounts/${tpaId}`, params, opts);
42
+ }
43
+ /** Merchants (`acc_xxx`) managed by a partner. `partners.crm.merchants.*`. */
44
+ export class PartnerCrmMerchants {
45
+ constructor(client) {
46
+ this.client = client;
47
+ this.keys = new PartnerCrmKeys(client);
49
48
  }
50
49
  /**
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.
50
+ * Create a CRM merchant. CRM-only is valid a merchant needs no TPA. Pass
51
+ * `externalRef` for idempotency.
61
52
  *
62
- * @internal
53
+ * @example
54
+ * const merchant = await tagada.partners.crm.merchants.create({
55
+ * legalName: 'Acme SAS',
56
+ * externalRef: 'merchant_42',
57
+ * });
58
+ * // merchant.id = 'acc_xxx'
63
59
  */
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.");
60
+ async create(params, opts) {
61
+ return this.client.post('/partner/merchants', params, opts);
68
62
  }
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.");
63
+ async retrieve(accountId, opts) {
64
+ return this.client.get(`/partner/merchants/${accountId}`, undefined, opts);
85
65
  }
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);
66
+ /** Look up a merchant by your own external reference. Returns `null` if none match. */
67
+ async retrieveByExternalRef(externalRef, opts) {
68
+ const list = await this.client.get('/partner/merchants', { externalRef, limit: 1 }, opts);
69
+ return list.data?.[0] ?? null;
103
70
  }
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);
71
+ async list(params, opts) {
72
+ return this.client.get('/partner/merchants', params, opts);
111
73
  }
112
74
  }
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);
75
+ /** Aggregator for `tagada.partners.crm`. */
76
+ export class PartnerCrm {
77
+ constructor(client) {
78
+ this.merchants = new PartnerCrmMerchants(client);
122
79
  }
123
80
  }
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);
81
+ // ═══════════════════════════════════════════════════════════════════
82
+ // Processing provisioning partners.processing.*
83
+ // ═══════════════════════════════════════════════════════════════════
84
+ /** Aggregator for `tagada.partners.processing`. */
85
+ export class PartnerProcessing {
86
+ constructor(client) {
87
+ // Partner surface — `/partner` prefix on `/api/tagadapay/v1`.
88
+ this.tpas = new ProcessingTpas(client, '/partner');
137
89
  }
138
90
  }
139
- /**
140
- * Aggregator class exposed as `tagada.partners`. Holds the per-resource
141
- * sub-clients so you can write `tagada.partners.accounts.create(...)`.
142
- */
91
+ // ═══════════════════════════════════════════════════════════════════
92
+ // Root: tagada.partners
93
+ // ═══════════════════════════════════════════════════════════════════
143
94
  export class Partners {
144
95
  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);
96
+ this.crm = new PartnerCrm(client);
97
+ this.processing = new PartnerProcessing(client);
149
98
  }
150
99
  }
151
100
  //# sourceMappingURL=Partners.js.map
@@ -1 +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,EAClC,IAAqB;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAiB,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAC/E,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,KAAa,EAAE,IAAqB;QACjD,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAiB,gBAAgB,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC1F,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,qBAAqB,CACzB,WAAmB,EACnB,IAAqB;QAErB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CACvC,cAAc,EACd,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,EACzB,IAAI,CACL,CAAC;QACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,IAAI,CACR,MAAiC,EACjC,IAAqB;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAC3B,cAAc,EACd,MAA6C,EAC7C,IAAI,CACL,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,MAAM,CACV,KAAa,EACb,MAAkC,EAClC,IAAqB;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAiB,gBAAgB,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACvF,CAA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C,EAAE,EACzB,IAAI,CACL,CAAC;QACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,IAAI,CACR,MAA2B,EAC3B,IAAqB;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACpB,oBAAoB,EACpB,MAA6C,EAC7C,IAAI,CACL,CAAC;IACJ,CAAC;CACF;AAED,4CAA4C;AAC5C,MAAM,OAAO,UAAU;IAGrB,YAAY,MAAkB;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;CACF;AAED,sEAAsE;AACtE,kDAAkD;AAClD,sEAAsE;AAEtE,mDAAmD;AACnD,MAAM,OAAO,iBAAiB;IAI5B,YAAY,MAAkB;QAC5B,8DAA8D;QAC9D,IAAI,CAAC,IAAI,GAAG,IAAI,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC;CACF;AAED,sEAAsE;AACtE,wBAAwB;AACxB,sEAAsE;AAEtE,MAAM,OAAO,QAAQ;IAMnB,YAAY,MAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAClD,CAAC;CACF"}
@@ -0,0 +1,129 @@
1
+ import type { HttpClient } from '../HttpClient.js';
2
+ import type { RequestOptions } from '../types/common.js';
3
+ import type { Tpa, TpaCreateParams, TpaListParams, ProcessingKey, ProcessingKeyCreated, ProcessingKeyCreateParams, TpaRequirement, RequirementValue, TpaDocument, TpaDocumentRecordParams, TpaDocumentUploadParams } from '../types/partners.js';
4
+ /**
5
+ * Processing domain (TagadaPay payfac), served on `/api/tagadapay/v1`.
6
+ *
7
+ * The same resource classes back two SDK entry points, differing only by a
8
+ * URL prefix:
9
+ * - `tagada.processing.*` → direct merchant, prefix `''`
10
+ * - `tagada.partners.processing.*` → partner "on behalf of", prefix `/partner`
11
+ */
12
+ /** Processing keys (`tp_sk_…`), each scoped to one TPA. */
13
+ export declare class ProcessingKeys {
14
+ private readonly client;
15
+ private readonly prefix;
16
+ constructor(client: HttpClient, prefix: string);
17
+ /**
18
+ * Mint a processing key restricted to one TPA. The plaintext `secret` is
19
+ * returned ONLY on creation — store it immediately in your secret manager.
20
+ */
21
+ create(tpaId: string, params?: ProcessingKeyCreateParams, opts?: RequestOptions): Promise<ProcessingKeyCreated>;
22
+ list(tpaId: string, opts?: RequestOptions): Promise<{
23
+ data: ProcessingKey[];
24
+ }>;
25
+ /** Revoke a processing key. Subsequent calls with that secret get HTTP 401. */
26
+ revoke(keyId: string, opts?: RequestOptions): Promise<{
27
+ id: string;
28
+ status: 'revoked';
29
+ }>;
30
+ }
31
+ /** KYB requirements for a TPA. */
32
+ export declare class ProcessingRequirements {
33
+ private readonly client;
34
+ private readonly prefix;
35
+ constructor(client: HttpClient, prefix: string);
36
+ list(tpaId: string, opts?: RequestOptions): Promise<{
37
+ data: TpaRequirement[];
38
+ }>;
39
+ /**
40
+ * Submit a value for a non-document requirement (e.g. `business.vat_number`,
41
+ * `banking.iban`). The requirement flips to `pending_verification` — it is
42
+ * never set directly to `satisfied` (Tagada ops / a provider verify it).
43
+ * Document requirements are satisfied via `documents.record()` instead.
44
+ */
45
+ update(tpaId: string, code: string, value: RequirementValue, opts?: RequestOptions): Promise<TpaRequirement>;
46
+ }
47
+ /**
48
+ * KYB documents for a TPA. v1 ships only the metadata path: upload bytes to
49
+ * S3 via a presigned URL, then `record()` the resulting `storageUrl`.
50
+ */
51
+ export declare class ProcessingDocuments {
52
+ private readonly client;
53
+ private readonly prefix;
54
+ constructor(client: HttpClient, prefix: string);
55
+ list(tpaId: string, opts?: RequestOptions): Promise<{
56
+ data: TpaDocument[];
57
+ }>;
58
+ record(tpaId: string, params: TpaDocumentRecordParams, opts?: RequestOptions): Promise<TpaDocument>;
59
+ /**
60
+ * Upload a KYB document's raw bytes AND record it in one call — the
61
+ * programmatic equivalent of a merchant dropping a file on the onboarding
62
+ * form. Tagada stores the file and links it to the TPA (and, when
63
+ * `requirementCode` is given, flips that `documents.*` requirement to
64
+ * `pending_verification`).
65
+ *
66
+ * `file` is a `Blob` (Node 18+ exposes `Blob` and `FormData` globally; use
67
+ * `new Blob([buffer])` or a `File`). Allowed: PDF, JPG, PNG, WEBP, HEIC,
68
+ * up to 10MB.
69
+ *
70
+ * @example
71
+ * import { readFile } from 'node:fs/promises';
72
+ * const bytes = await readFile('./registration.pdf');
73
+ * await tagada.partners.processing.tpas.documents.upload(tpaId, {
74
+ * file: new Blob([bytes], { type: 'application/pdf' }),
75
+ * filename: 'registration.pdf',
76
+ * kind: 'company_registration',
77
+ * requirementCode: 'documents.company_registration',
78
+ * });
79
+ */
80
+ upload(tpaId: string, params: TpaDocumentUploadParams, opts?: RequestOptions): Promise<TpaDocument>;
81
+ }
82
+ /**
83
+ * TagadaPay Accounts (TPAs) — the processing provisioning surface.
84
+ * A merchant (`acc_xxx`) can own multiple TPAs (`tpa_xxx`).
85
+ */
86
+ export declare class ProcessingTpas {
87
+ private readonly client;
88
+ private readonly prefix;
89
+ readonly keys: ProcessingKeys;
90
+ readonly requirements: ProcessingRequirements;
91
+ readonly documents: ProcessingDocuments;
92
+ constructor(client: HttpClient, prefix: string);
93
+ /**
94
+ * Provision a new TPA. Pass `accountId` to attach it to an existing
95
+ * merchant (the multi-TPA case). Pass `externalRef` for idempotency.
96
+ *
97
+ * @example
98
+ * const tpa = await tagada.partners.processing.tpas.create({
99
+ * accountId: 'acc_xxx',
100
+ * country: 'FR', currency: 'EUR',
101
+ * externalRef: 'merchant_42_eu',
102
+ * });
103
+ */
104
+ create(params: TpaCreateParams, opts?: RequestOptions): Promise<Tpa>;
105
+ retrieve(tpaId: string, opts?: RequestOptions): Promise<Tpa>;
106
+ /** Look up a TPA by your own external reference. Returns `null` if none match. */
107
+ retrieveByExternalRef(externalRef: string, opts?: RequestOptions): Promise<Tpa | null>;
108
+ list(params?: TpaListParams, opts?: RequestOptions): Promise<{
109
+ data: Tpa[];
110
+ hasMore: boolean;
111
+ }>;
112
+ /**
113
+ * Re-point a TPA to a different store within the same merchant. This is the
114
+ * only mutation `PATCH /tpas/:id` exposes today — other fields (`status`,
115
+ * KYB outcomes) are operator-driven. The target store must belong to the
116
+ * same merchant (`acc_xxx`); crossing merchants is refused server-side.
117
+ */
118
+ repointStore(tpaId: string, storeId: string, opts?: RequestOptions): Promise<Tpa>;
119
+ }
120
+ /**
121
+ * Top-level processing namespace exposed as `tagada.processing`. For a direct
122
+ * merchant managing their own TPAs. Requires a key with processing access on
123
+ * the merchant (a partner key, or a merchant whose account has processing).
124
+ */
125
+ export declare class Processing {
126
+ readonly tpas: ProcessingTpas;
127
+ constructor(client: HttpClient);
128
+ }
129
+ //# sourceMappingURL=Processing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Processing.d.ts","sourceRoot":"","sources":["../../src/resources/Processing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EACV,GAAG,EACH,eAAe,EACf,aAAa,EACb,aAAa,EACb,oBAAoB,EACpB,yBAAyB,EACzB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;GAOG;AAEH,2DAA2D;AAC3D,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM;IAGjC;;;OAGG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,yBAAyB,EAClC,I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