@venturekit/billing 0.0.50 → 0.0.52

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 (89) hide show
  1. package/README.md +30 -28
  2. package/dist/client.d.ts +7 -7
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +11 -9
  5. package/dist/client.js.map +1 -1
  6. package/dist/errors.d.ts +1 -1
  7. package/dist/errors.js +1 -1
  8. package/dist/events.d.ts +5 -5
  9. package/dist/events.d.ts.map +1 -1
  10. package/dist/events.js +3 -3
  11. package/dist/index.d.ts +9 -7
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +9 -7
  14. package/dist/index.js.map +1 -1
  15. package/dist/provider.d.ts +6 -6
  16. package/dist/provider.d.ts.map +1 -1
  17. package/dist/provider.js +1 -1
  18. package/dist/providers/index.d.ts +1 -1
  19. package/dist/providers/index.d.ts.map +1 -1
  20. package/dist/providers/index.js +1 -1
  21. package/dist/providers/index.js.map +1 -1
  22. package/dist/providers/{zazu → manza}/adapter.d.ts +15 -15
  23. package/dist/providers/manza/adapter.d.ts.map +1 -0
  24. package/dist/providers/{zazu → manza}/adapter.js +24 -24
  25. package/dist/providers/manza/adapter.js.map +1 -0
  26. package/dist/providers/manza/client.d.ts +76 -0
  27. package/dist/providers/manza/client.d.ts.map +1 -0
  28. package/dist/providers/{zazu → manza}/client.js +9 -9
  29. package/dist/providers/manza/client.js.map +1 -0
  30. package/dist/providers/{zazu → manza}/config.d.ts +21 -21
  31. package/dist/providers/manza/config.d.ts.map +1 -0
  32. package/dist/providers/manza/config.js +99 -0
  33. package/dist/providers/manza/config.js.map +1 -0
  34. package/dist/providers/{zazu → manza}/correlation.d.ts +7 -7
  35. package/dist/providers/manza/correlation.d.ts.map +1 -0
  36. package/dist/providers/{zazu → manza}/correlation.js +22 -22
  37. package/dist/providers/manza/correlation.js.map +1 -0
  38. package/dist/providers/manza/index.d.ts +19 -0
  39. package/dist/providers/manza/index.d.ts.map +1 -0
  40. package/dist/providers/manza/index.js +24 -0
  41. package/dist/providers/manza/index.js.map +1 -0
  42. package/dist/providers/manza/maps.d.ts +36 -0
  43. package/dist/providers/manza/maps.d.ts.map +1 -0
  44. package/dist/providers/{zazu → manza}/maps.js +4 -4
  45. package/dist/providers/manza/maps.js.map +1 -0
  46. package/dist/providers/{zazu → manza}/secrets.d.ts +15 -15
  47. package/dist/providers/manza/secrets.d.ts.map +1 -0
  48. package/dist/providers/{zazu → manza}/secrets.js +13 -13
  49. package/dist/providers/manza/secrets.js.map +1 -0
  50. package/dist/providers/{zazu → manza}/types.d.ts +65 -65
  51. package/dist/providers/manza/types.d.ts.map +1 -0
  52. package/dist/providers/{zazu → manza}/types.js +3 -3
  53. package/dist/providers/manza/types.js.map +1 -0
  54. package/dist/providers/{zazu → manza}/webhooks.d.ts +19 -19
  55. package/dist/providers/manza/webhooks.d.ts.map +1 -0
  56. package/dist/providers/{zazu → manza}/webhooks.js +57 -46
  57. package/dist/providers/manza/webhooks.js.map +1 -0
  58. package/dist/providers/mock.js +3 -3
  59. package/dist/providers/zazu.d.ts +9 -0
  60. package/dist/providers/zazu.d.ts.map +1 -0
  61. package/dist/providers/zazu.js +8 -0
  62. package/dist/providers/zazu.js.map +1 -0
  63. package/dist/types.d.ts +15 -15
  64. package/dist/types.d.ts.map +1 -1
  65. package/dist/types.js +2 -2
  66. package/package.json +11 -7
  67. package/dist/providers/zazu/adapter.d.ts.map +0 -1
  68. package/dist/providers/zazu/adapter.js.map +0 -1
  69. package/dist/providers/zazu/client.d.ts +0 -76
  70. package/dist/providers/zazu/client.d.ts.map +0 -1
  71. package/dist/providers/zazu/client.js.map +0 -1
  72. package/dist/providers/zazu/config.d.ts.map +0 -1
  73. package/dist/providers/zazu/config.js +0 -90
  74. package/dist/providers/zazu/config.js.map +0 -1
  75. package/dist/providers/zazu/correlation.d.ts.map +0 -1
  76. package/dist/providers/zazu/correlation.js.map +0 -1
  77. package/dist/providers/zazu/index.d.ts +0 -19
  78. package/dist/providers/zazu/index.d.ts.map +0 -1
  79. package/dist/providers/zazu/index.js +0 -22
  80. package/dist/providers/zazu/index.js.map +0 -1
  81. package/dist/providers/zazu/maps.d.ts +0 -36
  82. package/dist/providers/zazu/maps.d.ts.map +0 -1
  83. package/dist/providers/zazu/maps.js.map +0 -1
  84. package/dist/providers/zazu/secrets.d.ts.map +0 -1
  85. package/dist/providers/zazu/secrets.js.map +0 -1
  86. package/dist/providers/zazu/types.d.ts.map +0 -1
  87. package/dist/providers/zazu/types.js.map +0 -1
  88. package/dist/providers/zazu/webhooks.d.ts.map +0 -1
  89. package/dist/providers/zazu/webhooks.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @venturekit/billing — Zazu adapter
2
+ * @venturekit/billing — Manza adapter
3
3
  *
4
4
  * Implements the core {@link PaymentProvider} contract plus all four
5
5
  * optional capabilities (invoicing, transfers, accounts, webhook
@@ -7,33 +7,33 @@
7
7
  * mappers (`./maps.ts`), and delegating inbound webhook handling to
8
8
  * `./webhooks.ts`.
9
9
  *
10
- * Config resolves from the `ZAZU_*` environment variables by default
11
- * (see `./config.ts`), so `createZazuAdapter()` works with no arguments.
10
+ * Config resolves from the `MANZA_*` environment variables by default
11
+ * (see `./config.ts`), so `createManzaAdapter()` works with no arguments.
12
12
  * The adapter is stateless beyond holding the resolved config; create
13
13
  * one per provider config and reuse it.
14
14
  *
15
- * Note on feature flags: Zazu gates invoicing (`release_invoicing`),
15
+ * Note on feature flags: Manza gates invoicing (`release_invoicing`),
16
16
  * payment links (`release_payment_links`), API transfers
17
17
  * (`release_api_transfers`), and webhook endpoints (`release_webhooks`)
18
18
  * per entity. The adapter exposes all of them; calls fail with a
19
19
  * non-transient {@link ProviderError} (403) when a flag is off.
20
20
  */
21
21
  import type { FullPaymentProvider } from '../../provider.js';
22
- import { type ZazuHttpClient } from './client.js';
23
- import { type ZazuConfig } from './config.js';
24
- /** Zazu supports the full capability surface. */
25
- export interface ZazuAdapter extends FullPaymentProvider {
26
- readonly name: 'zazu';
22
+ import { type ManzaHttpClient } from './client.js';
23
+ import { type ManzaConfig } from './config.js';
24
+ /** Manza supports the full capability surface. */
25
+ export interface ManzaAdapter extends FullPaymentProvider {
26
+ readonly name: 'manza';
27
27
  }
28
28
  /**
29
- * Create a Zazu provider adapter.
29
+ * Create a Manza provider adapter.
30
30
  *
31
- * @param config - Partial Zazu config; missing values resolve from the
32
- * `ZAZU_API_KEY` / `ZAZU_BASE_URL` / `ZAZU_WEBHOOK_SECRET` env vars.
31
+ * @param config - Partial Manza config; missing values resolve from the
32
+ * `MANZA_API_KEY` / `MANZA_BASE_URL` / `MANZA_WEBHOOK_SECRET` env vars.
33
33
  * @param deps - Optional dependency injection (used by tests to pass a
34
34
  * mocked HTTP client without touching `fetch`).
35
35
  */
36
- export declare function createZazuAdapter(config?: Partial<ZazuConfig>, deps?: {
37
- httpClient?: ZazuHttpClient;
38
- }): ZazuAdapter;
36
+ export declare function createManzaAdapter(config?: Partial<ManzaConfig>, deps?: {
37
+ httpClient?: ManzaHttpClient;
38
+ }): ManzaAdapter;
39
39
  //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/providers/manza/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,mBAAmB,CAAC;AA+B7E,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AA0BnE,kDAAkD;AAClD,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACvD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AA4CD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,EAC7B,IAAI,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,eAAe,CAAA;CAAE,GACtC,YAAY,CAwOd"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @venturekit/billing — Zazu adapter
2
+ * @venturekit/billing — Manza adapter
3
3
  *
4
4
  * Implements the core {@link PaymentProvider} contract plus all four
5
5
  * optional capabilities (invoicing, transfers, accounts, webhook
@@ -7,28 +7,28 @@
7
7
  * mappers (`./maps.ts`), and delegating inbound webhook handling to
8
8
  * `./webhooks.ts`.
9
9
  *
10
- * Config resolves from the `ZAZU_*` environment variables by default
11
- * (see `./config.ts`), so `createZazuAdapter()` works with no arguments.
10
+ * Config resolves from the `MANZA_*` environment variables by default
11
+ * (see `./config.ts`), so `createManzaAdapter()` works with no arguments.
12
12
  * The adapter is stateless beyond holding the resolved config; create
13
13
  * one per provider config and reuse it.
14
14
  *
15
- * Note on feature flags: Zazu gates invoicing (`release_invoicing`),
15
+ * Note on feature flags: Manza gates invoicing (`release_invoicing`),
16
16
  * payment links (`release_payment_links`), API transfers
17
17
  * (`release_api_transfers`), and webhook endpoints (`release_webhooks`)
18
18
  * per entity. The adapter exposes all of them; calls fail with a
19
19
  * non-transient {@link ProviderError} (403) when a flag is off.
20
20
  */
21
21
  import { MissingConfigError } from '../../errors.js';
22
- import { createZazuHttpClient } from './client.js';
23
- import { resolveZazuConfig } from './config.js';
22
+ import { createManzaHttpClient } from './client.js';
23
+ import { resolveManzaConfig } from './config.js';
24
24
  import { resolveOptionalSecretValue } from './secrets.js';
25
25
  import { mapAccount, mapAccountTransaction, mapCheckoutSession, mapCreateCheckoutSessionBody, mapCreateCustomerBody, mapCreateInvoiceBody, mapCreatePaymentLinkBody, mapCreateTransferBody, mapCreateWebhookEndpointBody, mapCustomer, mapInvoice, mapPaymentLink, mapTransfer, mapUpdateWebhookEndpointBody, mapWebhookEndpoint, mapWebhookEndpointWithSecret, } from './maps.js';
26
- import { attachPaymentLinkCorrelation, zazuCorrelationSupport, } from './correlation.js';
27
- import { handleZazuWebhook } from './webhooks.js';
26
+ import { attachPaymentLinkCorrelation, manzaCorrelationSupport, } from './correlation.js';
27
+ import { handleManzaWebhook } from './webhooks.js';
28
28
  /**
29
- * Zazu requires an account on every money-movement call. Resolution
29
+ * Manza requires an account on every money-movement call. Resolution
30
30
  * order: the per-call override, then the adapter's configured default
31
- * (`ZAZU_ACCOUNT_ID`, or the `ZAZU_SECRET_ARN` entry).
31
+ * (`MANZA_ACCOUNT_ID`, or the `MANZA_SECRET_ARN` entry).
32
32
  *
33
33
  * The per-call argument exists for multi-account tenants; the config
34
34
  * default exists so single-account applications don't thread an id
@@ -41,14 +41,14 @@ import { handleZazuWebhook } from './webhooks.js';
41
41
  async function requireAccountId(perCall, configured) {
42
42
  const accountId = perCall ?? (await resolveOptionalSecretValue(configured));
43
43
  if (!accountId) {
44
- throw new MissingConfigError('accountId', 'Zazu requires an account. Set ZAZU_ACCOUNT_ID (or pass { accountId } to ' +
45
- 'createZazuAdapter) for the default, populate accountId in the ' +
46
- 'ZAZU_SECRET_ARN entry, or supply accountId on the call. ' +
44
+ throw new MissingConfigError('accountId', 'Manza requires an account. Set MANZA_ACCOUNT_ID (or pass { accountId } to ' +
45
+ 'createManzaAdapter) for the default, populate accountId in the ' +
46
+ 'MANZA_SECRET_ARN entry, or supply accountId on the call. ' +
47
47
  'Discover valid ids with listAccounts().');
48
48
  }
49
49
  return accountId;
50
50
  }
51
- /** Map a domain cursor page from a raw Zazu page. */
51
+ /** Map a domain cursor page from a raw Manza page. */
52
52
  function page(raw, map) {
53
53
  return {
54
54
  data: raw.data.map(map),
@@ -57,20 +57,20 @@ function page(raw, map) {
57
57
  };
58
58
  }
59
59
  /**
60
- * Create a Zazu provider adapter.
60
+ * Create a Manza provider adapter.
61
61
  *
62
- * @param config - Partial Zazu config; missing values resolve from the
63
- * `ZAZU_API_KEY` / `ZAZU_BASE_URL` / `ZAZU_WEBHOOK_SECRET` env vars.
62
+ * @param config - Partial Manza config; missing values resolve from the
63
+ * `MANZA_API_KEY` / `MANZA_BASE_URL` / `MANZA_WEBHOOK_SECRET` env vars.
64
64
  * @param deps - Optional dependency injection (used by tests to pass a
65
65
  * mocked HTTP client without touching `fetch`).
66
66
  */
67
- export function createZazuAdapter(config, deps) {
68
- const resolved = resolveZazuConfig(config);
69
- const http = deps?.httpClient ?? createZazuHttpClient(resolved);
67
+ export function createManzaAdapter(config, deps) {
68
+ const resolved = resolveManzaConfig(config);
69
+ const http = deps?.httpClient ?? createManzaHttpClient(resolved);
70
70
  return {
71
- name: 'zazu',
71
+ name: 'manza',
72
72
  correlationSupport(flow) {
73
- return zazuCorrelationSupport(flow);
73
+ return manzaCorrelationSupport(flow);
74
74
  },
75
75
  // -- Checkout sessions ------------------------------------------------
76
76
  async createCheckoutSession(input) {
@@ -86,7 +86,7 @@ export function createZazuAdapter(config, deps) {
86
86
  const accountId = await requireAccountId(input.accountId, resolved.accountId);
87
87
  const raw = await http.createPaymentLink(mapCreatePaymentLinkBody({ ...input, accountId }));
88
88
  const link = mapPaymentLink(raw);
89
- // Zazu carries payment-link correlation as a URL query parameter, so
89
+ // Manza carries payment-link correlation as a URL query parameter, so
90
90
  // the reference is attached to the hosted URL rather than the body.
91
91
  // The caller must share THIS url for the reference to come back.
92
92
  return {
@@ -234,7 +234,7 @@ export function createZazuAdapter(config, deps) {
234
234
  // before verifying. `handleWebhookEvent` is already async on the
235
235
  // provider interface, so the sync webhook helpers keep their shape.
236
236
  const webhookSecret = await resolveOptionalSecretValue(resolved.webhookSecret);
237
- return handleZazuWebhook(webhookSecret, request, {
237
+ return handleManzaWebhook(webhookSecret, request, {
238
238
  toleranceSeconds: resolved.webhookToleranceSeconds,
239
239
  });
240
240
  },
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/providers/manza/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAi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AAC,CAAC;QACvC,CAAC;QAED,KAAK,CAAC,qBAAqB,CAAC,EAAU;YACpC,OAAO,kBAAkB,CAAC,MAAM,IAAI,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,CAAC;QAClE,CAAC;QAED,KAAK,CAAC,sBAAsB,CAAC,EAAU;YACrC,OAAO,kBAAkB,CAAC,MAAM,IAAI,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC;QACnE,CAAC;QAED,KAAK,CAAC,mBAAmB,CAAC,EAAU;YAClC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;YAC/C,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;QAC7D,CAAC;QAED,KAAK,CAAC,+BAA+B,CAAC,EAAU;YAC9C,OAAO,4BAA4B,CAAC,MAAM,IAAI,CAAC,+BAA+B,CAAC,EAAE,CAAC,CAAC,CAAC;QACtF,CAAC;QAED,wEAAwE;QAExE,KAAK,CAAC,kBAAkB,CAAC,OAAuB;YAC9C,gEAAgE;YAChE,iEAAiE;YACjE,oEAAoE;YACpE,MAAM,aAAa,GAAG,MAAM,0BAA0B,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;YAC/E,OAAO,kBAAkB,CAAC,aAAa,EAAE,OAAO,EAAE;gBAChD,gBAAgB,EAAE,QAAQ,CAAC,uBAAuB;aACnD,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @venturekit/billing — Manza HTTP client
3
+ *
4
+ * Thin wrapper over `@venturekit/integrations` `apiClient` that injects
5
+ * Manza's Bearer auth and base URL. Returns the raw Manza shapes from
6
+ * `./types.ts`; mapping to domain objects is the adapter's job
7
+ * (`./adapter.ts`), not the client's.
8
+ *
9
+ * ## Retries are read-only
10
+ *
11
+ * `apiClient` retries on timeouts, network errors, and 408/429/5xx. That
12
+ * is safe for GETs and wrong for POSTs: a request the provider accepted
13
+ * but whose response was lost gets sent again, creating a second
14
+ * resource. Manza exposes no idempotency-key header (see
15
+ * https://staging.zazu.ma/docs/overview), so the only safe policy is to
16
+ * retry reads and never retry mutations — two clients, one policy each.
17
+ *
18
+ * Concretely: `POST /api/payments` creates a transfer *draft* awaiting
19
+ * human approval, so a duplicate lands in the approval queue rather than
20
+ * settling twice — but an approver can authorize both. `POST
21
+ * /api/invoices` is worse, since duplicates reach the customer.
22
+ *
23
+ * Errors from `apiClient` (`ApiError`) are converted to
24
+ * {@link ProviderError}. The `transient` flag marks what is worth
25
+ * retrying: 5xx, 429, timeouts, and network failures; everything else is
26
+ * hard. Callers that own an application-level idempotency key can safely
27
+ * retry a `transient` mutation themselves. Manza's error envelope
28
+ * (`{ error: { message, param } }`) is surfaced in the message, since
29
+ * `apiClient` only synthesises a generic status line.
30
+ */
31
+ import type { ManzaConfig } from './config.js';
32
+ import type { ManzaAccount, ManzaAccountTransaction, ManzaCheckoutSession, ManzaCreateCheckoutSessionBody, ManzaCreateCustomerBody, ManzaCreateInvoiceBody, ManzaCreatePaymentLinkBody, ManzaCreateTransferBody, ManzaCreateWebhookEndpointBody, ManzaCursorPage, ManzaCustomer, ManzaInvoice, ManzaPaymentLink, ManzaTestWebhookEndpointResponse, ManzaTransfer, ManzaUpdateWebhookEndpointBody, ManzaWebhookEndpoint, ManzaWebhookEndpointWithSecret } from './types.js';
33
+ /** Query params accepted by `apiClient`. */
34
+ type Params = Record<string, string | number | boolean | undefined> | undefined;
35
+ export interface ManzaHttpClient {
36
+ createCheckoutSession(body: ManzaCreateCheckoutSessionBody): Promise<ManzaCheckoutSession>;
37
+ getCheckoutSession(id: string): Promise<ManzaCheckoutSession>;
38
+ createPaymentLink(body: ManzaCreatePaymentLinkBody): Promise<ManzaPaymentLink>;
39
+ getPaymentLink(id: string): Promise<ManzaPaymentLink>;
40
+ listPaymentLinks(params?: Params): Promise<ManzaCursorPage<ManzaPaymentLink>>;
41
+ cancelPaymentLink(id: string): Promise<ManzaPaymentLink>;
42
+ createInvoice(body: ManzaCreateInvoiceBody): Promise<ManzaInvoice>;
43
+ getInvoice(id: string): Promise<ManzaInvoice>;
44
+ listInvoices(params?: Params): Promise<ManzaCursorPage<ManzaInvoice>>;
45
+ sendInvoice(id: string): Promise<ManzaInvoice>;
46
+ markInvoicePaid(id: string): Promise<ManzaInvoice>;
47
+ cancelInvoice(id: string): Promise<ManzaInvoice>;
48
+ createCustomer(body: ManzaCreateCustomerBody): Promise<ManzaCustomer>;
49
+ getCustomer(id: string): Promise<ManzaCustomer>;
50
+ listCustomers(params?: Params): Promise<ManzaCursorPage<ManzaCustomer>>;
51
+ updateCustomer(id: string, body: ManzaCreateCustomerBody): Promise<ManzaCustomer>;
52
+ deleteCustomer(id: string): Promise<void>;
53
+ createTransfer(body: ManzaCreateTransferBody): Promise<ManzaTransfer>;
54
+ getTransfer(id: string): Promise<ManzaTransfer>;
55
+ listTransfers(params?: Params): Promise<ManzaCursorPage<ManzaTransfer>>;
56
+ listAccounts(params?: Params): Promise<ManzaCursorPage<ManzaAccount>>;
57
+ getAccount(id: string): Promise<ManzaAccount>;
58
+ listAccountTransactions(accountId: string, params?: Params): Promise<ManzaCursorPage<ManzaAccountTransaction>>;
59
+ getAccountTransaction(accountId: string, id: string): Promise<ManzaAccountTransaction>;
60
+ listWebhookEndpoints(params?: Params): Promise<ManzaCursorPage<ManzaWebhookEndpoint>>;
61
+ createWebhookEndpoint(body: ManzaCreateWebhookEndpointBody): Promise<ManzaWebhookEndpointWithSecret>;
62
+ getWebhookEndpoint(id: string): Promise<ManzaWebhookEndpoint>;
63
+ updateWebhookEndpoint(id: string, body: ManzaUpdateWebhookEndpointBody): Promise<ManzaWebhookEndpoint>;
64
+ deleteWebhookEndpoint(id: string): Promise<void>;
65
+ enableWebhookEndpoint(id: string): Promise<ManzaWebhookEndpoint>;
66
+ disableWebhookEndpoint(id: string): Promise<ManzaWebhookEndpoint>;
67
+ testWebhookEndpoint(id: string): Promise<ManzaTestWebhookEndpointResponse>;
68
+ regenerateWebhookEndpointSecret(id: string): Promise<ManzaWebhookEndpointWithSecret>;
69
+ }
70
+ /**
71
+ * Create a Manza HTTP client. `config.maxRetries` applies to reads only —
72
+ * see the retry note at the top of this file.
73
+ */
74
+ export declare function createManzaHttpClient(config: ManzaConfig): ManzaHttpClient;
75
+ export {};
76
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/providers/manza/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,KAAK,EACV,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,8BAA8B,EAC9B,uBAAuB,EACvB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,8BAA8B,EAC9B,eAAe,EACf,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,gCAAgC,EAChC,aAAa,EACb,8BAA8B,EAC9B,oBAAoB,EACpB,8BAA8B,EAC/B,MAAM,YAAY,CAAC;AAoDpB,4CAA4C;AAC5C,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;AAMhF,MAAM,WAAW,eAAe;IAE9B,qBAAqB,CAAC,IAAI,EAAE,8BAA8B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC3F,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAG9D,iBAAiB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAC/E,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,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;CACtF;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,eAAe,CAsI1E"}
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @venturekit/billing — Zazu HTTP client
2
+ * @venturekit/billing — Manza HTTP client
3
3
  *
4
4
  * Thin wrapper over `@venturekit/integrations` `apiClient` that injects
5
- * Zazu's Bearer auth and base URL. Returns the raw Zazu shapes from
5
+ * Manza's Bearer auth and base URL. Returns the raw Manza shapes from
6
6
  * `./types.ts`; mapping to domain objects is the adapter's job
7
7
  * (`./adapter.ts`), not the client's.
8
8
  *
@@ -11,7 +11,7 @@
11
11
  * `apiClient` retries on timeouts, network errors, and 408/429/5xx. That
12
12
  * is safe for GETs and wrong for POSTs: a request the provider accepted
13
13
  * but whose response was lost gets sent again, creating a second
14
- * resource. Zazu exposes no idempotency-key header (see
14
+ * resource. Manza exposes no idempotency-key header (see
15
15
  * https://staging.zazu.ma/docs/overview), so the only safe policy is to
16
16
  * retry reads and never retry mutations — two clients, one policy each.
17
17
  *
@@ -24,7 +24,7 @@
24
24
  * {@link ProviderError}. The `transient` flag marks what is worth
25
25
  * retrying: 5xx, 429, timeouts, and network failures; everything else is
26
26
  * hard. Callers that own an application-level idempotency key can safely
27
- * retry a `transient` mutation themselves. Zazu's error envelope
27
+ * retry a `transient` mutation themselves. Manza's error envelope
28
28
  * (`{ error: { message, param } }`) is surfaced in the message, since
29
29
  * `apiClient` only synthesises a generic status line.
30
30
  */
@@ -36,14 +36,14 @@ import { ProviderError } from '../../errors.js';
36
36
  // ---------------------------------------------------------------------------
37
37
  const TRANSIENT_STATUSES = new Set([408, 425, 429, 500, 502, 503, 504]);
38
38
  /**
39
- * Pull the human-readable reason out of Zazu's error envelope,
39
+ * Pull the human-readable reason out of Manza's error envelope,
40
40
  * `{ "error": { "type", "message", "param" } }`. `apiClient` only
41
41
  * synthesises `"<METHOD> <url> failed with status <n>"`, so without this
42
42
  * the actual cause ("Customer not found", param `customer_id`) is
43
43
  * invisible unless the caller digs into `providerData`.
44
44
  * See https://staging.zazu.ma/docs/overview.
45
45
  */
46
- function zazuErrorMessage(data) {
46
+ function manzaErrorMessage(data) {
47
47
  if (typeof data !== 'object' || data === null)
48
48
  return undefined;
49
49
  const envelope = data.error;
@@ -62,7 +62,7 @@ function toProviderError(err) {
62
62
  // caller-initiated abort is the one status-0 case that is final.
63
63
  const aborted = err.aborted === true;
64
64
  const transient = err.status === 0 ? !aborted : TRANSIENT_STATUSES.has(err.status);
65
- const reason = zazuErrorMessage(err.data);
65
+ const reason = manzaErrorMessage(err.data);
66
66
  return new ProviderError({
67
67
  message: reason ? `${reason} [${err.message}]` : err.message,
68
68
  status: err.status,
@@ -81,10 +81,10 @@ function toProviderError(err) {
81
81
  });
82
82
  }
83
83
  /**
84
- * Create a Zazu HTTP client. `config.maxRetries` applies to reads only —
84
+ * Create a Manza HTTP client. `config.maxRetries` applies to reads only —
85
85
  * see the retry note at the top of this file.
86
86
  */
87
- export function createZazuHttpClient(config) {
87
+ export function createManzaHttpClient(config) {
88
88
  // The API key may be a resolver backed by Secrets Manager, so it cannot
89
89
  // be baked into a static header at construction time. An `onRequest`
90
90
  // interceptor is the right seam: `apiClient` awaits it once per request,
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/providers/manza/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAsBhD,8EAA8E;AAC9E,uBAAuB;AACvB,8EAA8E;AAE9E,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,E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,CAAC;QACrF,mBAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,CACzB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAmC,0BAA0B,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QAC9F,+BAA+B,EAAE,CAAC,CAAC,EAAE,EAAE,CACrC,MAAM,CACJ,KAAK,CAAC,IAAI,CACR,0BAA0B,EAAE,CAAC,CAAC,CAAC,oBAAoB,CACpD,CACF;KACJ,CAAC;AACJ,CAAC"}
@@ -1,27 +1,27 @@
1
1
  /**
2
- * @venturekit/billing — Zazu configuration
2
+ * @venturekit/billing — Manza configuration
3
3
  *
4
- * Zazu config is self-contained in the provider module (mirrors how
4
+ * Manza config is self-contained in the provider module (mirrors how
5
5
  * `@venturekit/notify` keeps `SesEmailProviderConfig` inside its
6
- * provider file). Values resolve from the `ZAZU_*` environment variables
6
+ * provider file). Values resolve from the `MANZA_*` environment variables
7
7
  * by default, with explicit overrides accepted — secrets never live in
8
8
  * source code.
9
9
  */
10
- import { type ZazuSecretValue } from './secrets.js';
11
- export interface ZazuConfig {
10
+ import { type ManzaSecretValue } from './secrets.js';
11
+ export interface ManzaConfig {
12
12
  /**
13
- * Zazu API key (Bearer token). Required.
13
+ * Manza API key (Bearer token). Required.
14
14
  *
15
15
  * May be a resolver function, in which case the key is fetched from
16
16
  * AWS Secrets Manager on first use and cached — see `./secrets.ts`.
17
17
  */
18
- apiKey: ZazuSecretValue;
19
- /** Base URL — production by default, staging via `ZAZU_BASE_URL`. */
18
+ apiKey: ManzaSecretValue;
19
+ /** Base URL — production by default, staging via `MANZA_BASE_URL`. */
20
20
  baseUrl: string;
21
21
  /**
22
- * Default funding/destination account id, from `ZAZU_ACCOUNT_ID`.
22
+ * Default funding/destination account id, from `MANZA_ACCOUNT_ID`.
23
23
  *
24
- * Zazu requires `account_id` to create a checkout session, a payment
24
+ * Manza requires `account_id` to create a checkout session, a payment
25
25
  * link, or a transfer, but for most applications it is a deployment
26
26
  * property rather than a per-payment one — so it lives here instead of
27
27
  * on every call. Individual calls may still override it, which is what
@@ -30,13 +30,13 @@ export interface ZazuConfig {
30
30
  *
31
31
  * May be a resolver function (see `apiKey`).
32
32
  */
33
- accountId?: ZazuSecretValue;
33
+ accountId?: ManzaSecretValue;
34
34
  /**
35
35
  * Webhook endpoint signing secret (for signature verification).
36
36
  *
37
37
  * May be a resolver function (see `apiKey`).
38
38
  */
39
- webhookSecret?: ZazuSecretValue;
39
+ webhookSecret?: ManzaSecretValue;
40
40
  /** Optional request timeout override (ms). */
41
41
  timeoutMs?: number;
42
42
  /**
@@ -51,20 +51,20 @@ export interface ZazuConfig {
51
51
  webhookToleranceSeconds?: number;
52
52
  /**
53
53
  * ARN of the AWS Secrets Manager entry holding
54
- * `{apiKey, accountId, webhookSecret}`, from `ZAZU_SECRET_ARN`.
54
+ * `{apiKey, accountId, webhookSecret}`, from `MANZA_SECRET_ARN`.
55
55
  *
56
56
  * VentureKit provisions this secret and injects the ARN when a project
57
- * declares a `billing` intent with `provider: 'zazu'`. It is the
58
- * lowest-precedence source: an explicit value or a `ZAZU_*` env var
57
+ * declares a `billing` intent with `provider: 'manza'`. It is the
58
+ * lowest-precedence source: an explicit value or a `MANZA_*` env var
59
59
  * always wins, which is what keeps local development free of any AWS
60
60
  * dependency. See `./secrets.ts`.
61
61
  */
62
62
  secretArn?: string;
63
63
  }
64
64
  /**
65
- * Resolve Zazu config from explicit values, falling back to the
66
- * `ZAZU_API_KEY` / `ZAZU_BASE_URL` / `ZAZU_ACCOUNT_ID` /
67
- * `ZAZU_WEBHOOK_SECRET` / `ZAZU_WEBHOOK_TOLERANCE_SECONDS` environment
65
+ * Resolve Manza config from explicit values, falling back to the
66
+ * `MANZA_API_KEY` / `MANZA_BASE_URL` / `MANZA_ACCOUNT_ID` /
67
+ * `MANZA_WEBHOOK_SECRET` / `MANZA_WEBHOOK_TOLERANCE_SECONDS` environment
68
68
  * variables. Throws {@link MissingConfigError} if the API key cannot be
69
69
  * determined.
70
70
  *
@@ -74,10 +74,10 @@ export interface ZazuConfig {
74
74
  * where a useful hint can name both remedies.
75
75
  *
76
76
  * Each of the three credentials resolves independently, in order:
77
- * explicit value → `ZAZU_*` env var → the Secrets Manager entry named by
78
- * `ZAZU_SECRET_ARN`. Nothing is fetched here: the Secrets Manager path
77
+ * explicit value → `MANZA_*` env var (or its deprecated `ZAZU_*` name) → the Secrets Manager entry named by
78
+ * `MANZA_SECRET_ARN`. Nothing is fetched here: the Secrets Manager path
79
79
  * installs a lazy resolver that runs on first use, so constructing an
80
80
  * adapter stays synchronous and free of I/O.
81
81
  */
82
- export declare function resolveZazuConfig(input?: Partial<ZazuConfig>): ZazuConfig;
82
+ export declare function resolveManzaConfig(input?: Partial<ManzaConfig>): ManzaConfig;
83
83
  //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/providers/manza/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAA8B,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEjF,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,MAAM,EAAE,gBAAgB,CAAC;IACzB,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B;;;;OAIG;IACH,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA6CD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAmC5E"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * @venturekit/billing — Manza configuration
3
+ *
4
+ * Manza config is self-contained in the provider module (mirrors how
5
+ * `@venturekit/notify` keeps `SesEmailProviderConfig` inside its
6
+ * provider file). Values resolve from the `MANZA_*` environment variables
7
+ * by default, with explicit overrides accepted — secrets never live in
8
+ * source code.
9
+ */
10
+ import { MissingConfigError } from '../../errors.js';
11
+ import { createManzaSecretsResolver } from './secrets.js';
12
+ /**
13
+ * Default API host: Morocco production.
14
+ *
15
+ * Zazu became Manza, and its API moved (Manza's notice to integrators):
16
+ *
17
+ * - production: `zazu.ma/api` → `ma.manza.finance/api`
18
+ * - staging: `staging.zazu.ma/api` → `ma.manza.dev/api`
19
+ *
20
+ * Defaulting to production means a deploy that forgets `MANZA_BASE_URL`
21
+ * fails loudly on a bad key rather than silently settling live traffic
22
+ * against staging. Staging (`https://ma.manza.dev`) is opt-in via
23
+ * `MANZA_BASE_URL` — test there first, as the notice asks.
24
+ *
25
+ * Two caveats worth knowing before overriding:
26
+ * - **South Africa** is a different host. The notice did not announce a
27
+ * new one, so it is still the Zazu host: set `MANZA_BASE_URL` to
28
+ * `https://zazu.africa`. There is no auto-detection.
29
+ * - This is the **API** host, not the checkout domain. Hosted payment
30
+ * links and checkout sessions come back in the response `url` (still
31
+ * `pay.zazu.ma` at the time of the rename); they are never built from
32
+ * this value.
33
+ */
34
+ const DEFAULT_BASE_URL = 'https://ma.manza.finance';
35
+ /**
36
+ * A `MANZA_*` setting, else its deprecated `ZAZU_*` name — so a deployment
37
+ * configured before the rename keeps working until its variables move.
38
+ */
39
+ function env(name) {
40
+ return process.env[`MANZA_${name}`] ?? process.env[`ZAZU_${name}`];
41
+ }
42
+ /**
43
+ * Parse a positive-integer env var, ignoring blank and non-numeric
44
+ * values so a typo falls back to the documented default rather than
45
+ * silently disabling a check.
46
+ */
47
+ function numberFromEnv(raw) {
48
+ if (raw === undefined || raw.trim() === '')
49
+ return undefined;
50
+ const value = Number(raw);
51
+ return Number.isFinite(value) && value >= 0 ? value : undefined;
52
+ }
53
+ /**
54
+ * Resolve Manza config from explicit values, falling back to the
55
+ * `MANZA_API_KEY` / `MANZA_BASE_URL` / `MANZA_ACCOUNT_ID` /
56
+ * `MANZA_WEBHOOK_SECRET` / `MANZA_WEBHOOK_TOLERANCE_SECONDS` environment
57
+ * variables. Throws {@link MissingConfigError} if the API key cannot be
58
+ * determined.
59
+ *
60
+ * `accountId` is deliberately NOT required here: an application that
61
+ * always passes an explicit account per call is valid, so the check
62
+ * happens at the call site (see `requireAccountId` in `./adapter.ts`)
63
+ * where a useful hint can name both remedies.
64
+ *
65
+ * Each of the three credentials resolves independently, in order:
66
+ * explicit value → `MANZA_*` env var (or its deprecated `ZAZU_*` name) → the Secrets Manager entry named by
67
+ * `MANZA_SECRET_ARN`. Nothing is fetched here: the Secrets Manager path
68
+ * installs a lazy resolver that runs on first use, so constructing an
69
+ * adapter stays synchronous and free of I/O.
70
+ */
71
+ export function resolveManzaConfig(input) {
72
+ const secretArn = input?.secretArn ?? env('SECRET_ARN');
73
+ // One resolver set per adapter, so all three fields share a single
74
+ // cached GetSecretValue call rather than one apiece.
75
+ const fromSecret = secretArn ? createManzaSecretsResolver({ secretArn }) : undefined;
76
+ const apiKey = input?.apiKey ?? env('API_KEY') ?? fromSecret?.apiKey;
77
+ const baseUrl = input?.baseUrl ?? env('BASE_URL') ?? DEFAULT_BASE_URL;
78
+ const accountId = input?.accountId ?? env('ACCOUNT_ID') ?? fromSecret?.accountId;
79
+ const webhookSecret = input?.webhookSecret ?? env('WEBHOOK_SECRET') ?? fromSecret?.webhookSecret;
80
+ const webhookToleranceSeconds = input?.webhookToleranceSeconds ??
81
+ numberFromEnv(env('WEBHOOK_TOLERANCE_SECONDS'));
82
+ if (!apiKey) {
83
+ throw new MissingConfigError('apiKey', 'Set MANZA_API_KEY, pass { apiKey } to createManzaAdapter, or set ' +
84
+ 'MANZA_SECRET_ARN to a Secrets Manager entry containing it. ' +
85
+ "VentureKit provisions that secret when a project declares a billing " +
86
+ "intent with provider: 'manza'.");
87
+ }
88
+ return {
89
+ apiKey,
90
+ baseUrl,
91
+ accountId,
92
+ webhookSecret,
93
+ timeoutMs: input?.timeoutMs,
94
+ maxRetries: input?.maxRetries,
95
+ webhookToleranceSeconds,
96
+ secretArn,
97
+ };
98
+ }
99
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/providers/manza/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,0BAA0B,EAAyB,MAAM,cAAc,CAAC;AAwDjF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAEpD;;;GAGG;AACH,SAAS,GAAG,CAAC,IAAY;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,GAAuB;IAC5C,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC7D,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA4B;IAC7D,MAAM,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC;IACxD,mEAAmE;IACnE,qDAAqD;IACrD,MAAM,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC,0BAA0B,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAErF,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,UAAU,EAAE,MAAM,CAAC;IACrE,MAAM,OAAO,GAAG,KAAK,EAAE,OAAO,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,gBAAgB,CAAC;IACtE,MAAM,SAAS,GAAG,KAAK,EAAE,SAAS,IAAI,GAAG,CAAC,YAAY,CAAC,IAAI,UAAU,EAAE,SAAS,CAAC;IACjF,MAAM,aAAa,GACjB,KAAK,EAAE,aAAa,IAAI,GAAG,CAAC,gBAAgB,CAAC,IAAI,UAAU,EAAE,aAAa,CAAC;IAC7E,MAAM,uBAAuB,GAC3B,KAAK,EAAE,uBAAuB;QAC9B,aAAa,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC,CAAC;IAElD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,kBAAkB,CAC1B,QAAQ,EACR,mEAAmE;YACjE,6DAA6D;YAC7D,sEAAsE;YACtE,gCAAgC,CACnC,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM;QACN,OAAO;QACP,SAAS;QACT,aAAa;QACb,SAAS,EAAE,KAAK,EAAE,SAAS;QAC3B,UAAU,EAAE,KAAK,EAAE,UAAU;QAC7B,uBAAuB;QACvB,SAAS;KACV,CAAC;AACJ,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @venturekit/billing — Zazu correlation transport
2
+ * @venturekit/billing — Manza correlation transport
3
3
  *
4
- * Zazu carries the caller's identifiers on three different channels, one
4
+ * Manza carries the caller's identifiers on three different channels, one
5
5
  * per flow. This module is the single place that knows which is which,
6
6
  * so the adapter and the webhook parser cannot disagree:
7
7
  *
@@ -11,7 +11,7 @@
11
11
  * | payment link | `client_reference_id` URL query param | no |
12
12
  * | transfer | `payment_reference` in the body | no |
13
13
  *
14
- * The asymmetry is Zazu's, not ours. Payment links accept only four
14
+ * The asymmetry is Manza's, not ours. Payment links accept only four
15
15
  * whitelisted query parameters (`client_reference_id`, `customer_email`,
16
16
  * `customer_id`, `customer_name`) and **silently ignore** everything
17
17
  * else, so passing metadata there would vanish without an error. We
@@ -24,8 +24,8 @@ import type { CorrelationFlow, CorrelationRef, CorrelationSupport } from '../../
24
24
  * collision is rejected rather than silently overwritten.
25
25
  */
26
26
  export declare const CORRELATION_REFERENCE_KEY = "vk_reference";
27
- export declare const ZAZU_CORRELATION_SUPPORT: Record<CorrelationFlow, CorrelationSupport>;
28
- export declare function zazuCorrelationSupport(flow: CorrelationFlow): CorrelationSupport;
27
+ export declare const MANZA_CORRELATION_SUPPORT: Record<CorrelationFlow, CorrelationSupport>;
28
+ export declare function manzaCorrelationSupport(flow: CorrelationFlow): CorrelationSupport;
29
29
  /**
30
30
  * Build the `metadata` map for `POST /api/checkout_sessions`, folding the
31
31
  * caller's reference in under {@link CORRELATION_REFERENCE_KEY}.
@@ -40,7 +40,7 @@ export declare function decodeCheckoutCorrelation(metadata: Record<string, strin
40
40
  /**
41
41
  * Attach the caller's reference to a payment link's hosted URL.
42
42
  *
43
- * Zazu stores whitelisted query parameters with the payment and echoes
43
+ * Manza stores whitelisted query parameters with the payment and echoes
44
44
  * them on `payment_link.paid`, so the correlation lives on the URL rather
45
45
  * than in the create body. The customer must therefore be sent to the
46
46
  * URL this returns.
@@ -55,7 +55,7 @@ export declare function decodePaymentLinkCorrelation(clientReferenceId: string |
55
55
  /**
56
56
  * Resolve the `payment_reference` to send for a transfer.
57
57
  *
58
- * Zazu echoes only `payment_reference` on `transfer.executed`, so
58
+ * Manza echoes only `payment_reference` on `transfer.executed`, so
59
59
  * correlation and the business reference compete for one field. Setting
60
60
  * both is rejected rather than silently preferring one.
61
61
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation.d.ts","sourceRoot":"","sources":["../../../src/providers/manza/correlation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,iBAAiB,CAAC;AAUxD,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAIjF,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,eAAe,GAAG,kBAAkB,CAIjF;AAmCD;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,cAAc,GAAG,SAAS,GACtC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAqBpC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,GAClD,cAAc,GAAG,IAAI,CAUvB;AAED;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,WAAW,EAAE,cAAc,GAAG,SAAS,GACtC,MAAM,GAAG,SAAS,CAqBpB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,iBAAiB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC3C,cAAc,GAAG,IAAI,CAGvB;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,gBAAgB,EAAE,MAAM,GAAG,SAAS,EACpC,WAAW,EAAE,cAAc,GAAG,SAAS,GACtC,MAAM,GAAG,SAAS,CAapB;AAED,8DAA8D;AAC9D,wBAAgB,yBAAyB,CACvC,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,cAAc,GAAG,IAAI,CAGvB"}