@genesis-tech/genesispay-seller 0.13.0 → 0.13.1

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 (73) hide show
  1. package/package.json +1 -1
  2. package/dist/checkout-return.d.ts +0 -41
  3. package/dist/checkout-return.d.ts.map +0 -1
  4. package/dist/checkout-return.js +0 -67
  5. package/dist/checkout-return.js.map +0 -1
  6. package/dist/client.d.ts +0 -283
  7. package/dist/client.d.ts.map +0 -1
  8. package/dist/client.js +0 -629
  9. package/dist/client.js.map +0 -1
  10. package/dist/customers.d.ts +0 -41
  11. package/dist/customers.d.ts.map +0 -1
  12. package/dist/customers.js +0 -76
  13. package/dist/customers.js.map +0 -1
  14. package/dist/entitlements.d.ts +0 -19
  15. package/dist/entitlements.d.ts.map +0 -1
  16. package/dist/entitlements.js +0 -30
  17. package/dist/entitlements.js.map +0 -1
  18. package/dist/errors.d.ts +0 -63
  19. package/dist/errors.d.ts.map +0 -1
  20. package/dist/errors.js +0 -162
  21. package/dist/errors.js.map +0 -1
  22. package/dist/genesispay-settlement.d.ts +0 -30
  23. package/dist/genesispay-settlement.d.ts.map +0 -1
  24. package/dist/genesispay-settlement.js +0 -103
  25. package/dist/genesispay-settlement.js.map +0 -1
  26. package/dist/index.d.ts +0 -16
  27. package/dist/index.d.ts.map +0 -1
  28. package/dist/index.js +0 -18
  29. package/dist/index.js.map +0 -1
  30. package/dist/invoices.d.ts +0 -80
  31. package/dist/invoices.d.ts.map +0 -1
  32. package/dist/invoices.js +0 -133
  33. package/dist/invoices.js.map +0 -1
  34. package/dist/mandate-gate.d.ts +0 -49
  35. package/dist/mandate-gate.d.ts.map +0 -1
  36. package/dist/mandate-gate.js +0 -109
  37. package/dist/mandate-gate.js.map +0 -1
  38. package/dist/mandates.d.ts +0 -172
  39. package/dist/mandates.d.ts.map +0 -1
  40. package/dist/mandates.js +0 -213
  41. package/dist/mandates.js.map +0 -1
  42. package/dist/networks.d.ts +0 -10
  43. package/dist/networks.d.ts.map +0 -1
  44. package/dist/networks.js +0 -22
  45. package/dist/networks.js.map +0 -1
  46. package/dist/payment-gate.d.ts +0 -67
  47. package/dist/payment-gate.d.ts.map +0 -1
  48. package/dist/payment-gate.js +0 -106
  49. package/dist/payment-gate.js.map +0 -1
  50. package/dist/peerpay-settlement.d.ts +0 -27
  51. package/dist/peerpay-settlement.d.ts.map +0 -1
  52. package/dist/peerpay-settlement.js +0 -100
  53. package/dist/peerpay-settlement.js.map +0 -1
  54. package/dist/plans.d.ts +0 -68
  55. package/dist/plans.d.ts.map +0 -1
  56. package/dist/plans.js +0 -127
  57. package/dist/plans.js.map +0 -1
  58. package/dist/products.d.ts +0 -146
  59. package/dist/products.d.ts.map +0 -1
  60. package/dist/products.js +0 -295
  61. package/dist/products.js.map +0 -1
  62. package/dist/resource.d.ts +0 -47
  63. package/dist/resource.d.ts.map +0 -1
  64. package/dist/resource.js +0 -71
  65. package/dist/resource.js.map +0 -1
  66. package/dist/usdc-amount.d.ts +0 -7
  67. package/dist/usdc-amount.d.ts.map +0 -1
  68. package/dist/usdc-amount.js +0 -21
  69. package/dist/usdc-amount.js.map +0 -1
  70. package/dist/webhooks.d.ts +0 -277
  71. package/dist/webhooks.d.ts.map +0 -1
  72. package/dist/webhooks.js +0 -224
  73. package/dist/webhooks.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"products.js","sourceRoot":"","sources":["../src/products.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,EAAE;AACF,wEAAwE;AACxE,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAC9E,2EAA2E;AAC3E,sEAAsE;AAEtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EACd,KAAK,GAEN,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAA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,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnG,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,QAAkB;IAC5C,OAAO,IAAI,QAAQ,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;AAC7I,CAAC"}
@@ -1,47 +0,0 @@
1
- export type GenesisPayRequestOptions = {
2
- /** Defaults to GET. */
3
- method?: "GET" | "POST" | "PATCH";
4
- /** Path starting with "/", already percent-encoded. */
5
- path: string;
6
- /** JSON request body. Omit entirely for a GET (no content-type is sent). */
7
- body?: unknown;
8
- /** Additional non-secret request headers, e.g. Idempotency-Key. */
9
- headers?: Record<string, string>;
10
- /** Label used in error messages, e.g. `POST /api/v1/plans`. */
11
- operation: string;
12
- /** Replaces the generic 404 text — a 404 usually needs case-specific wording. */
13
- notFoundMessage?: string;
14
- /**
15
- * Next step for the caller, appended to the message. A function receives the
16
- * HTTP status so one call site can give, say, a 403 its own guidance without
17
- * hand-rolling an error class next to the shared mapper.
18
- */
19
- hint?: string | ((status: number) => string | undefined);
20
- /**
21
- * Filled into "Failed to reach GenesisPay to <action>" when the transport itself
22
- * fails (DNS, connection refused, abort) — there is no response to map then.
23
- */
24
- action: string;
25
- };
26
- /** The client's bound request function, as a resource module sees it. */
27
- export type GenesisPayRequest = (options: GenesisPayRequestOptions) => Promise<unknown>;
28
- /** A non-null, non-array object, or null — the shape a mapper can read fields off. */
29
- export declare function asRecord(value: unknown): Record<string, unknown> | null;
30
- export declare function optionalString(value: unknown): string | null;
31
- export declare function requiredString(value: unknown): string;
32
- /** Flat `Record<string, string>`; anything else (array, nested object) → null. */
33
- export declare function optionalMetadata(value: unknown): Record<string, string> | null;
34
- export declare function oneOf<T extends string>(value: unknown, allowed: readonly T[], fallback: T): T;
35
- export declare function toCount(value: unknown): number;
36
- /** Like `toCount`, but a missing/unusable value stays `null` rather than 0. */
37
- export declare function optionalCount(value: unknown): number | null;
38
- /**
39
- * Money crosses the wire as a decimal or minor-unit *string* so no precision is
40
- * lost. A number is accepted and stringified anyway (a hand-rolled proxy or an
41
- * older serializer may send one); anything else becomes "" rather than a
42
- * plausible-looking wrong amount.
43
- */
44
- export declare function toAmountString(value: unknown): string;
45
- /** Same as `toAmountString`, but keeps "not set" distinguishable from "zero". */
46
- export declare function optionalAmountString(value: unknown): string | null;
47
- //# sourceMappingURL=resource.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,wBAAwB,GAAG;IACrC,uBAAuB;IACvB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,+DAA+D;IAC/D,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,CAAC;IACzD;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,wBAAwB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAExF,sFAAsF;AACtF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAGvE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAE5D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAErD;AAED,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAM9E;AAED,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EACpC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,QAAQ,EAAE,CAAC,GACV,CAAC,CAIH;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAG9C;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAI3D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAIrD;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAIlE"}
package/dist/resource.js DELETED
@@ -1,71 +0,0 @@
1
- // What every GenesisPay resource module (checkout, plans, mandates) is built on:
2
- // one HTTP seam and one set of tolerant wire mappers.
3
- //
4
- // The seam exists so a resource module never touches `fetch`, the API key or
5
- // the base URL — the client owns those and hands down a bound `GenesisPayRequest`.
6
- // That keeps the error mapping in exactly one place (`throwForErrorResponse`,
7
- // see ./errors.ts): a resource that built its own request could quietly grow a
8
- // second, divergent notion of what a 422 means.
9
- //
10
- // The mappers are deliberately forgiving. Every field arrives as `unknown`
11
- // because an older backend — one that predates a column this SDK version knows
12
- // about — must never be able to crash a caller's poll loop or webhook handler.
13
- // Missing or wrong-typed values degrade to null/0/"" or a named default; they
14
- // never throw.
15
- /** A non-null, non-array object, or null — the shape a mapper can read fields off. */
16
- export function asRecord(value) {
17
- if (!value || typeof value !== "object" || Array.isArray(value))
18
- return null;
19
- return value;
20
- }
21
- export function optionalString(value) {
22
- return typeof value === "string" && value.length > 0 ? value : null;
23
- }
24
- export function requiredString(value) {
25
- return typeof value === "string" ? value : "";
26
- }
27
- /** Flat `Record<string, string>`; anything else (array, nested object) → null. */
28
- export function optionalMetadata(value) {
29
- if (!value || typeof value !== "object" || Array.isArray(value))
30
- return null;
31
- const entries = Object.entries(value).filter((entry) => typeof entry[1] === "string");
32
- return entries.length > 0 ? Object.fromEntries(entries) : null;
33
- }
34
- export function oneOf(value, allowed, fallback) {
35
- return typeof value === "string" && allowed.includes(value)
36
- ? value
37
- : fallback;
38
- }
39
- export function toCount(value) {
40
- const parsed = typeof value === "number" ? value : Number(value);
41
- return Number.isFinite(parsed) ? parsed : 0;
42
- }
43
- /** Like `toCount`, but a missing/unusable value stays `null` rather than 0. */
44
- export function optionalCount(value) {
45
- if (value === null || value === undefined || value === "")
46
- return null;
47
- const parsed = typeof value === "number" ? value : Number(value);
48
- return Number.isFinite(parsed) ? parsed : null;
49
- }
50
- /**
51
- * Money crosses the wire as a decimal or minor-unit *string* so no precision is
52
- * lost. A number is accepted and stringified anyway (a hand-rolled proxy or an
53
- * older serializer may send one); anything else becomes "" rather than a
54
- * plausible-looking wrong amount.
55
- */
56
- export function toAmountString(value) {
57
- if (typeof value === "string")
58
- return value;
59
- if (typeof value === "number" && Number.isFinite(value))
60
- return String(value);
61
- return "";
62
- }
63
- /** Same as `toAmountString`, but keeps "not set" distinguishable from "zero". */
64
- export function optionalAmountString(value) {
65
- if (typeof value === "string")
66
- return value.length > 0 ? value : null;
67
- if (typeof value === "number" && Number.isFinite(value))
68
- return String(value);
69
- return null;
70
- }
71
- //# sourceMappingURL=resource.js.map
@@ -1 +0,0 @@
1
- {"version":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D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IACtE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9E,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,7 +0,0 @@
1
- /**
2
- * Parses a human-readable decimal USDC amount ("0.10") into integer minor
3
- * units (6 decimals) as a bigint. Rejects anything that is not a positive
4
- * amount with at most 6 decimal places.
5
- */
6
- export declare function parseUsdcAmountToMinorUnits(amount: string): bigint;
7
- //# sourceMappingURL=usdc-amount.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usdc-amount.d.ts","sourceRoot":"","sources":["../src/usdc-amount.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAmBlE"}
@@ -1,21 +0,0 @@
1
- const USDC_DECIMALS = 6;
2
- const USDC_AMOUNT_PATTERN = /^\d+(?:\.\d{1,6})?$/;
3
- /**
4
- * Parses a human-readable decimal USDC amount ("0.10") into integer minor
5
- * units (6 decimals) as a bigint. Rejects anything that is not a positive
6
- * amount with at most 6 decimal places.
7
- */
8
- export function parseUsdcAmountToMinorUnits(amount) {
9
- const normalizedAmount = amount.trim();
10
- if (!USDC_AMOUNT_PATTERN.test(normalizedAmount)) {
11
- throw new Error(`Invalid USDC amount "${amount}": use a positive decimal with up to 6 decimals, e.g. "0.10".`);
12
- }
13
- const [wholePart, fractionalPart = ""] = normalizedAmount.split(".");
14
- const minorUnits = BigInt(wholePart) * BigInt(10 ** USDC_DECIMALS) +
15
- BigInt(fractionalPart.padEnd(USDC_DECIMALS, "0"));
16
- if (minorUnits <= 0n) {
17
- throw new Error("USDC amount must be greater than zero.");
18
- }
19
- return minorUnits;
20
- }
21
- //# sourceMappingURL=usdc-amount.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usdc-amount.js","sourceRoot":"","sources":["../src/usdc-amount.ts"],"names":[],"mappings":"AAAA,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAElD;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAc;IACxD,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;IAEvC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CACb,wBAAwB,MAAM,+DAA+D,CAC9F,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,SAAS,EAAE,cAAc,GAAG,EAAE,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrE,MAAM,UAAU,GACd,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,EAAE,IAAI,aAAa,CAAC;QAC/C,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,CAAC;IAEpD,IAAI,UAAU,IAAI,EAAE,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -1,277 +0,0 @@
1
- /**
2
- * Every event type this SDK version knows. Mirrors the server's
3
- * `WebhookEventType` (`src/features/sellers/webhooks.ts`) — the drift alarm is
4
- * `src/features/sellers/webhook-signature-contract.test.ts`, which fails when
5
- * the server grows a type this list does not have.
6
- *
7
- * Exported as a runtime array (not only as a type) so a handler can ask
8
- * `isKnownGenesisPayEventType(event.type)` before it decides what to do.
9
- */
10
- export declare const GENESISPAY_EVENT_TYPES: readonly ["payment.confirmed", "link.paid", "product.purchased", "agent_payment.pending_approval", "agent_payment.settled", "mandate.active", "mandate.charged", "mandate.charge_failed", "mandate.revoked", "subscription.renewed", "subscription.past_due"];
11
- /** Union of the event types this SDK version knows. */
12
- export type GenesisPayEventType = (typeof GENESISPAY_EVENT_TYPES)[number];
13
- /** True when `type` is an event type this SDK version knows about. */
14
- export declare function isKnownGenesisPayEventType(type: string): type is GenesisPayEventType;
15
- /** Shared envelope; `type`/`data` are pinned per event by the union below. */
16
- type GenesisPayEventEnvelope<TType extends string, TData> = {
17
- /** Stable across delivery retries — the idempotency key to dedupe on. */
18
- id: string;
19
- type: TType;
20
- createdAt: string;
21
- data: TData;
22
- };
23
- /**
24
- * `data` of `payment.confirmed` / `link.paid`. Mirrors the server's
25
- * `PaymentWebhookEventPayload`; amounts stay strings (minor units are `bigint`
26
- * on the server and would lose precision as a JSON number).
27
- */
28
- export type GenesisPayPaymentEventData = {
29
- link: {
30
- publicId: string;
31
- title: string;
32
- /**
33
- * The currency `amount` is denominated in. Read it before you book the
34
- * money: a EURC link settles in euros, and nothing else in this payload
35
- * says so.
36
- *
37
- * **Optional on purpose, unlike every other field here.** The payload is
38
- * not re-validated at runtime — `constructEvent` checks the signature and
39
- * the envelope, then hands the body over — and a delivery enqueued before
40
- * this field existed is stored and *retried* verbatim, so it can still
41
- * arrive without one. There is no safe default to fill in: guessing
42
- * `"USDC"` on a euro payment is the exact confusion this field was added to
43
- * remove. Treat an absent asset as "cannot book this yet" — ack the
44
- * delivery, alert, resolve the link through `checkout.retrieve`.
45
- */
46
- asset?: "USDC" | "EURC";
47
- /**
48
- * Decimal amount in `asset` — euros on a EURC link, dollars on a USDC one.
49
- * A delivery that predates this field omits it, but unlike `asset` it has a
50
- * safe fallback: `amount ?? amountUsdc`, which always carried the identical
51
- * value. That is why this one is typed as present and `asset` is not.
52
- *
53
- * The two are emitted by the same code path, so a delivery missing one is
54
- * missing the other and the `asset` guard fires first — the fallback is
55
- * belt-and-braces, not the main line of defence. Keep them emitted together
56
- * if you ever change that path.
57
- */
58
- amount: string;
59
- amountUsdcMinor: string;
60
- /**
61
- * @deprecated Same value as `amount`. The name is wrong on a EURC link —
62
- * it carries euros there — which is why `amount` replaced it. Still sent on
63
- * every delivery; removed no earlier than 1.0.
64
- */
65
- amountUsdc: string;
66
- linkType: "single" | "reusable";
67
- /** Correlation data set at link creation, echoed verbatim. */
68
- metadata: Record<string, string> | null;
69
- clientReferenceId: string | null;
70
- };
71
- attempt: {
72
- id: string;
73
- /** `null` for simulated payments — there is no transaction to link to. */
74
- txHash: string | null;
75
- /**
76
- * The chain `txHash` is on. Today every settlement reports `8453`/`84532`
77
- * (Base mainnet/Sepolia) — but do **not** hard-code that as the whole set.
78
- * Match the chain you expect and treat anything else as unrecognized rather
79
- * than as test money; a bare `chainId !== 8453` test inverts on the first
80
- * chain that is added.
81
- *
82
- * Read it *with* the hash and never separately: the same hash string
83
- * resolves to nothing on the wrong chain, and a testnet settlement is
84
- * otherwise indistinguishable from a mainnet one.
85
- *
86
- * It sits here rather than on `link` because the two can differ: a
87
- * settlement broadcast by a provider lands on the chain that provider uses,
88
- * which is not necessarily the chain the link was created for.
89
- *
90
- * `null` when there is no hash to resolve, or the provider named no chain.
91
- * Optional — a delivery enqueued before this field existed is retried
92
- * verbatim and arrives without it. **Do not default it.** Note the polarity
93
- * trap: `undefined !== 8453` is true, so the natural `if (chainId !== 8453)`
94
- * check reads a *missing* chain as testnet, and the mirror check reads it as
95
- * mainnet. Branch on presence first.
96
- */
97
- chainId?: number | null;
98
- payerWallet: string | null;
99
- createdAt: string;
100
- confirmedAt: string | null;
101
- /**
102
- * `true` when no funds moved — a test-mode `simulate-payment` attempt.
103
- * `false` for a real settlement, including on testnet and in provider
104
- * sandboxes: this is the fabricated-payment axis, not the environment axis.
105
- */
106
- simulated: boolean;
107
- /**
108
- * The gross the link is priced at, in minor units of `link.asset` (=
109
- * `link.amountUsdcMinor`). Additive with the fee triplet below; older
110
- * deliveries enqueued before these fields existed arrive without them, so
111
- * treat them as optional and do not default `feeCollected` (MR-804).
112
- */
113
- amountMinor?: string;
114
- /** Platform fee snapshot in minor units of `link.asset`. */
115
- feeMinor?: string;
116
- /**
117
- * `amountMinor − feeMinor` — what the seller nets IF the fee is collected
118
- * on-chain. Do not book it unconditionally: the seller's actual on-chain
119
- * credit is `feeCollected ? netMinor : amountMinor`. A record-only leg
120
- * (`feeCollected: false`) credited the seller the full `amountMinor` — the
121
- * fee is a receivable that did not move at settlement.
122
- */
123
- netMinor?: string;
124
- /**
125
- * Whether the fee actually moved to the treasury on-chain. `false` on a
126
- * record-only leg (single-auth checkout, agent, EUR, or a pending
127
- * receivable) is correct, not a bug. Do not infer it from the presence of
128
- * `feeTxHash` alone; read this flag — it is the switch for what the seller
129
- * was credited: `feeCollected ? netMinor : amountMinor`.
130
- */
131
- feeCollected?: boolean;
132
- /** The fee leg's tx hash; `null` unless the fee was collected on-chain. */
133
- feeTxHash?: string | null;
134
- };
135
- occurredAt: string;
136
- };
137
- /** `data` of the mandate/subscription events; mirrors `buildMandateWebhookPayload`. */
138
- export type GenesisPayMandateEventData = {
139
- mandate: {
140
- id: string;
141
- kind: string;
142
- status: string;
143
- payerWallet: string;
144
- /**
145
- * Which plan the subscription belongs to — without it a `mandate.active`
146
- * handler knows *that* someone subscribed but not *to what*. `null` for
147
- * mandates proposed directly rather than through a plan checkout. Like
148
- * every field here it mirrors the current server payload and is not
149
- * re-validated at runtime, so read it as `?? null` if you also accept
150
- * deliveries from a deployment that predates the field.
151
- */
152
- subscriptionPlanId: string | null;
153
- asset: string;
154
- allowanceMinor: string;
155
- capPerChargeMinor: string;
156
- spentMinor: string;
157
- amountPerPeriodMinor: string | null;
158
- periodDays: number | null;
159
- nextChargeAt: string | null;
160
- };
161
- charge: {
162
- id: string;
163
- kind: string;
164
- amountMinor: string;
165
- status: string;
166
- txHash: string | null;
167
- /**
168
- * The platform fee in minor units of the mandate's `asset` (MR-104). The
169
- * seller receives `amountMinor − feeMinor` once the fee is collected.
170
- *
171
- * Optional like every field added after launch: `webhook_deliveries` rows
172
- * are replayed verbatim, so a delivery enqueued before this field existed
173
- * arrives without it. Read it as `?? null`.
174
- */
175
- feeMinor?: string;
176
- /**
177
- * Whether the fee was collected on-chain (MR-1008/MR-1009). `true` only
178
- * when the fee leg's transfer confirmed; `false` on every record-only leg
179
- * (a deployment not collecting on the mandate leg, or a still-pending
180
- * receivable) — and that `false` is the honest state, not an error. Do NOT
181
- * default a missing value to `false`: absent means the delivery predates the
182
- * field, not that nothing was collected.
183
- */
184
- feeCollected?: boolean;
185
- /** The fee leg's tx hash; `null` unless the fee was collected on-chain. */
186
- feeTxHash?: string | null;
187
- resourceUrl: string | null;
188
- failureReason: string | null;
189
- } | null;
190
- occurredAt: string;
191
- };
192
- export type GenesisPayPaymentEvent = GenesisPayEventEnvelope<"payment.confirmed" | "link.paid", GenesisPayPaymentEventData>;
193
- export type GenesisPayMandateEvent = GenesisPayEventEnvelope<"mandate.active" | "mandate.charged" | "mandate.charge_failed" | "mandate.revoked" | "subscription.renewed" | "subscription.past_due", GenesisPayMandateEventData>;
194
- /**
195
- * Agent-payment events are reserved on the server but have no emitter yet, so
196
- * their payload is deliberately left open rather than invented here.
197
- */
198
- export type GenesisPayAgentPaymentEvent = GenesisPayEventEnvelope<"agent_payment.pending_approval" | "agent_payment.settled", Record<string, unknown>>;
199
- /**
200
- * An event type this SDK version does not know — a newer server talking to an
201
- * older SDK. It is a *valid* event: `constructEvent` verifies and returns it
202
- * like any other (see `GenesisPayAnyEvent`), it never throws on the type.
203
- */
204
- export type GenesisPayUnknownEvent = GenesisPayEventEnvelope<string, Record<string, unknown>>;
205
- /**
206
- * Verified webhook delivery, discriminated on `type`:
207
- *
208
- * ```ts
209
- * if (event.type === "payment.confirmed") {
210
- * event.data.attempt.txHash; // typed, no cast
211
- * }
212
- * ```
213
- *
214
- * **Why this union has no `{ type: string & {} }` member.** TypeScript only
215
- * narrows on a discriminant whose type is a literal in *every* constituent: add
216
- * one member with a plain `string` type and `event.type === "payment.confirmed"`
217
- * stops narrowing `data` for all the others too — the exact regression R1 sets
218
- * out to fix. Forward compatibility therefore lives at runtime (an unknown type
219
- * is verified and returned, never rejected) plus in `GenesisPayAnyEvent` /
220
- * `GenesisPayUnknownEvent` for handlers that want to model the open world:
221
- *
222
- * ```ts
223
- * const any: GenesisPayAnyEvent = event; // widens, no cast needed
224
- * if (!isKnownGenesisPayEventType(any.type)) return new Response("ok"); // ack & ignore
225
- * ```
226
- */
227
- export type GenesisPayEvent = GenesisPayPaymentEvent | GenesisPayMandateEvent | GenesisPayAgentPaymentEvent;
228
- /**
229
- * Open-world view of a delivery: every known event widens to it, and it is the
230
- * honest type for an event whose `type` this SDK version does not know.
231
- */
232
- export type GenesisPayAnyEvent = GenesisPayEvent | GenesisPayUnknownEvent;
233
- /**
234
- * Thrown for every rejection path: malformed/missing header, missing `t`/`v1`,
235
- * timestamp outside the tolerance window, signature mismatch, non-JSON body.
236
- * Messages never contain the secret or the expected signature.
237
- */
238
- export declare class GenesisPaySignatureVerificationError extends Error {
239
- constructor(message: string);
240
- }
241
- export type ConstructEventOptions = {
242
- /** Replay window in seconds, applied in both directions. Default 300. */
243
- toleranceSeconds?: number;
244
- /** Injectable clock (epoch milliseconds); defaults to `Date.now()`. */
245
- nowMs?: number;
246
- };
247
- /**
248
- * Verifies a GenesisPay webhook delivery and returns the parsed event.
249
- *
250
- * Pass the **raw** request body exactly as received — never a re-serialized
251
- * `JSON.parse` + `JSON.stringify` round trip, which changes the bytes and
252
- * invalidates the signature. Parsing happens only after verification succeeds.
253
- *
254
- * An event type this SDK version does not know is **not** a failure: the
255
- * delivery is verified and returned unchanged, so a server that adds a new
256
- * event type can never turn a customer's webhook route into a 400. Only the
257
- * signature and the envelope (`id`, `type`, `createdAt`, object `data`) can
258
- * reject a delivery. Widen to `GenesisPayAnyEvent` and use
259
- * `isKnownGenesisPayEventType()` if you want to handle that case explicitly.
260
- *
261
- * @throws {GenesisPaySignatureVerificationError} on any verification failure.
262
- *
263
- * @example
264
- * ```ts
265
- * const event = await constructEvent(
266
- * await request.text(),
267
- * request.headers.get("genesispay-signature") ?? "",
268
- * process.env.GENESISPAY_WEBHOOK_SECRET!,
269
- * );
270
- * if (event.type === "payment.confirmed") {
271
- * fulfil(event.data.link.clientReferenceId, event.data.attempt.txHash);
272
- * }
273
- * ```
274
- */
275
- export declare function constructEvent(rawBody: string | Uint8Array, signatureHeader: string, secret: string, opts?: ConstructEventOptions): Promise<GenesisPayEvent>;
276
- export {};
277
- //# sourceMappingURL=webhooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,+PAYzB,CAAC;AAEX,uDAAuD;AACvD,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,sEAAsE;AACtE,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,mBAAmB,CAEpF;AAED,8EAA8E;AAC9E,KAAK,uBAAuB,CAAC,KAAK,SAAS,MAAM,EAAE,KAAK,IAAI;IAC1D,yEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,KAAK,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd;;;;;;;;;;;;;WAaG;QACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QACxB;;;;;;;;;;WAUG;QACH,MAAM,EAAE,MAAM,CAAC;QACf,eAAe,EAAE,MAAM,CAAC;QACxB;;;;WAIG;QACH,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE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