@genesis-tech/genesispay-seller 0.12.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 (67) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +89 -10
  3. package/package.json +1 -1
  4. package/dist/client.d.ts +0 -283
  5. package/dist/client.d.ts.map +0 -1
  6. package/dist/client.js +0 -575
  7. package/dist/client.js.map +0 -1
  8. package/dist/customers.d.ts +0 -41
  9. package/dist/customers.d.ts.map +0 -1
  10. package/dist/customers.js +0 -76
  11. package/dist/customers.js.map +0 -1
  12. package/dist/entitlements.d.ts +0 -19
  13. package/dist/entitlements.d.ts.map +0 -1
  14. package/dist/entitlements.js +0 -30
  15. package/dist/entitlements.js.map +0 -1
  16. package/dist/errors.d.ts +0 -63
  17. package/dist/errors.d.ts.map +0 -1
  18. package/dist/errors.js +0 -162
  19. package/dist/errors.js.map +0 -1
  20. package/dist/genesispay-settlement.d.ts +0 -30
  21. package/dist/genesispay-settlement.d.ts.map +0 -1
  22. package/dist/genesispay-settlement.js +0 -103
  23. package/dist/genesispay-settlement.js.map +0 -1
  24. package/dist/index.d.ts +0 -15
  25. package/dist/index.d.ts.map +0 -1
  26. package/dist/index.js +0 -13
  27. package/dist/index.js.map +0 -1
  28. package/dist/invoices.d.ts +0 -80
  29. package/dist/invoices.d.ts.map +0 -1
  30. package/dist/invoices.js +0 -133
  31. package/dist/invoices.js.map +0 -1
  32. package/dist/mandate-gate.d.ts +0 -49
  33. package/dist/mandate-gate.d.ts.map +0 -1
  34. package/dist/mandate-gate.js +0 -109
  35. package/dist/mandate-gate.js.map +0 -1
  36. package/dist/mandates.d.ts +0 -172
  37. package/dist/mandates.d.ts.map +0 -1
  38. package/dist/mandates.js +0 -213
  39. package/dist/mandates.js.map +0 -1
  40. package/dist/networks.d.ts +0 -10
  41. package/dist/networks.d.ts.map +0 -1
  42. package/dist/networks.js +0 -22
  43. package/dist/networks.js.map +0 -1
  44. package/dist/payment-gate.d.ts +0 -67
  45. package/dist/payment-gate.d.ts.map +0 -1
  46. package/dist/payment-gate.js +0 -106
  47. package/dist/payment-gate.js.map +0 -1
  48. package/dist/plans.d.ts +0 -68
  49. package/dist/plans.d.ts.map +0 -1
  50. package/dist/plans.js +0 -127
  51. package/dist/plans.js.map +0 -1
  52. package/dist/products.d.ts +0 -146
  53. package/dist/products.d.ts.map +0 -1
  54. package/dist/products.js +0 -295
  55. package/dist/products.js.map +0 -1
  56. package/dist/resource.d.ts +0 -47
  57. package/dist/resource.d.ts.map +0 -1
  58. package/dist/resource.js +0 -71
  59. package/dist/resource.js.map +0 -1
  60. package/dist/usdc-amount.d.ts +0 -7
  61. package/dist/usdc-amount.d.ts.map +0 -1
  62. package/dist/usdc-amount.js +0 -21
  63. package/dist/usdc-amount.js.map +0 -1
  64. package/dist/webhooks.d.ts +0 -277
  65. package/dist/webhooks.d.ts.map +0 -1
  66. package/dist/webhooks.js +0 -224
  67. package/dist/webhooks.js.map +0 -1
package/dist/plans.js DELETED
@@ -1,127 +0,0 @@
1
- // `genesispay.plans.*` — subscription plans over `/api/v1/plans`.
2
- //
3
- // A plan is the recurring sibling of a checkout link: it describes an amount
4
- // per period and exposes a hosted `checkoutUrl` the customer signs a mandate
5
- // on. Everything is scoped to the key's own account, so a plan owned by someone
6
- // else answers 404 (GenesisPayNotFoundError) rather than 403 — the API is no
7
- // plan-enumeration oracle, and the SDK does not paper over that.
8
- import { GenesisPayConfigError } from "./errors.js";
9
- import { asRecord, optionalString, requiredString, toAmountString, toCount, oneOf, } from "./resource.js";
10
- export function createPlansResource(request,
11
- /**
12
- * Applies the client's `expectedPayTo` pin to the wallet the server froze
13
- * onto the plan. A plan's destination is where every future renewal settles,
14
- * so it is exactly the value the pin exists to guard.
15
- */
16
- assertPinnedDestination = () => { }) {
17
- return {
18
- create: async (input) => {
19
- const body = await request({
20
- method: "POST",
21
- path: "/api/v1/plans",
22
- operation: "POST /api/v1/plans",
23
- action: "create a subscription plan",
24
- body: {
25
- title: input.title,
26
- amountPerPeriod: input.amountPerPeriod,
27
- periodDays: input.periodDays,
28
- ...(input.description ? { description: input.description } : {}),
29
- ...(input.prepaidCycles === undefined
30
- ? {}
31
- : { prepaidCycles: input.prepaidCycles }),
32
- ...(input.destinationWallet
33
- ? { destinationWallet: input.destinationWallet }
34
- : {}),
35
- ...(input.asset ? { asset: input.asset } : {}),
36
- },
37
- });
38
- const plan = requirePlan(body, "POST /api/v1/plans");
39
- assertPinnedDestination(plan.destinationWallet, "subscription plan");
40
- return plan;
41
- },
42
- list: async () => {
43
- const body = await request({
44
- path: "/api/v1/plans",
45
- operation: "GET /api/v1/plans",
46
- action: "list subscription plans",
47
- });
48
- const plans = asRecord(body)?.plans;
49
- if (!Array.isArray(plans)) {
50
- // A list endpoint that answers 200 without a list is a broken contract,
51
- // not an old backend. Returning [] here would hide it as "no plans yet".
52
- throw new GenesisPayConfigError(`GenesisPay GET /api/v1/plans returned no plans array: ${JSON.stringify(body)}`);
53
- }
54
- // Individual entries stay tolerant: one unusable row must not lose the rest.
55
- return plans
56
- .map(asRecord)
57
- .filter((raw) => raw !== null)
58
- .filter((raw) => typeof raw.publicId === "string" && raw.publicId.length > 0)
59
- .map(toSubscriptionPlan);
60
- },
61
- retrieve: async (publicId) => {
62
- const id = requirePublicId(publicId, "plans.retrieve");
63
- const body = await request({
64
- path: `/api/v1/plans/${encodeURIComponent(id)}`,
65
- operation: `GET /api/v1/plans/${id}`,
66
- action: `retrieve subscription plan "${id}"`,
67
- notFoundMessage: notFoundMessage(id),
68
- });
69
- return requirePlan(body, `GET /api/v1/plans/${id}`);
70
- },
71
- archive: async (publicId) => {
72
- const id = requirePublicId(publicId, "plans.archive");
73
- const body = await request({
74
- method: "POST",
75
- path: `/api/v1/plans/${encodeURIComponent(id)}/archive`,
76
- operation: `POST /api/v1/plans/${id}/archive`,
77
- action: `archive subscription plan "${id}"`,
78
- notFoundMessage: notFoundMessage(id),
79
- });
80
- return requirePlan(body, `POST /api/v1/plans/${id}/archive`);
81
- },
82
- };
83
- }
84
- function notFoundMessage(id) {
85
- return (`No GenesisPay subscription plan with publicId "${id}". Check the id and that ` +
86
- `it belongs to the account this API key authenticates.`);
87
- }
88
- function requirePublicId(publicId, method) {
89
- const id = publicId?.trim();
90
- if (!id) {
91
- throw new GenesisPayConfigError(`${method}(publicId) requires the publicId returned by plans.create().`);
92
- }
93
- return id;
94
- }
95
- function requirePlan(body, operation) {
96
- const raw = asRecord(asRecord(body)?.plan);
97
- if (!raw || typeof raw.publicId !== "string" || !raw.publicId) {
98
- throw new GenesisPayConfigError(`GenesisPay ${operation} returned no plan: ${JSON.stringify(body)}`);
99
- }
100
- return toSubscriptionPlan(raw);
101
- }
102
- export function toSubscriptionPlan(raw) {
103
- return {
104
- id: requiredString(raw.id),
105
- publicId: requiredString(raw.publicId),
106
- title: requiredString(raw.title),
107
- description: optionalString(raw.description),
108
- asset: oneOf(raw.asset, ["USDC", "EURC"], "USDC"),
109
- amountPerPeriod: toAmountString(raw.amountPerPeriod),
110
- amountPerPeriodMinor: toAmountString(raw.amountPerPeriodMinor),
111
- periodDays: toCount(raw.periodDays),
112
- prepaidCycles: toCount(raw.prepaidCycles),
113
- capPerChargeMinor: toAmountString(raw.capPerChargeMinor),
114
- allowanceMinor: toAmountString(raw.allowanceMinor),
115
- destinationWallet: requiredString(raw.destinationWallet),
116
- chainId: toCount(raw.chainId),
117
- // Degrade to "archived", not "active": a status this SDK version does not
118
- // know (a future "paused", "deleted", …) must not read as "keep sending
119
- // customers to this checkoutUrl". Mirrors mandate status degrading to the
120
- // inert `pending_permit`.
121
- status: oneOf(raw.status, ["active", "archived"], "archived"),
122
- checkoutUrl: requiredString(raw.checkoutUrl),
123
- createdAt: requiredString(raw.createdAt),
124
- archivedAt: optionalString(raw.archivedAt),
125
- };
126
- }
127
- //# sourceMappingURL=plans.js.map
package/dist/plans.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"plans.js","s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AAE,UAAU,CAAC;QACtE,WAAW,EAAE,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC;QAC5C,SAAS,EAAE,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC;QACxC,UAAU,EAAE,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC;KAC3C,CAAC;AACJ,CAAC"}
@@ -1,146 +0,0 @@
1
- import { type GenesisPayRequest } from "./resource.js";
2
- import type { CheckoutLink } from "./client.js";
3
- export type ProductDelivery = {
4
- type: "none";
5
- } | {
6
- type: "redirect";
7
- url: string;
8
- verifiedAt: string | null;
9
- } | {
10
- type: "gate";
11
- resourceUrl: string;
12
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
13
- };
14
- export type Product = {
15
- publicId: string;
16
- name: string;
17
- description: string | null;
18
- imageUrl: string | null;
19
- sku: string | null;
20
- asset: "USDC" | "EURC";
21
- /** Decimal price in `asset`, as the server normalized it (e.g. "2", "0.5"). */
22
- price: string;
23
- /** Same price in 6-decimal minor units, as a string (no precision loss). */
24
- priceMinor: string;
25
- /**
26
- * Only an explicit `true` counts — an older backend that omits the field
27
- * must not read as "archived", and a product this SDK cannot classify must
28
- * not silently vanish from a catalogue sync.
29
- */
30
- archived: boolean;
31
- /** Where a paying buyer's entitlement redirects; null until the seller sets it. */
32
- fulfilmentUrl: string | null;
33
- fulfilmentVerifiedAt: string | null;
34
- /** Additive delivery contract; flat fulfilment fields remain for compatibility. */
35
- delivery: ProductDelivery;
36
- createdAt: string;
37
- };
38
- export type ProductCreateInput = {
39
- name: string;
40
- /** Decimal price, e.g. "2" or "2.00" — never a float. */
41
- price: string;
42
- description?: string;
43
- imageUrl?: string;
44
- /** The merchant's own key; unique per account, a repeat answers 409. */
45
- sku?: string;
46
- /** Defaults to USDC (the only settlement asset during the beta). */
47
- asset?: "USDC";
48
- delivery?: ProductDelivery;
49
- };
50
- export type ProductPaymentLink = {
51
- /** The product's one canonical reusable link — mint again and you get the same one. */
52
- link: CheckoutLink;
53
- /** True only on the call that actually created the link. */
54
- created: boolean;
55
- };
56
- export type ProductGatePurchase = {
57
- product: {
58
- publicId: string;
59
- sku: string | null;
60
- quantity: 1;
61
- };
62
- payment: {
63
- attemptId: string;
64
- txHash: string;
65
- payer: string | null;
66
- asset: "USDC";
67
- amountMinor: string;
68
- chainId: number;
69
- simulated: false;
70
- idempotentReplay: boolean;
71
- };
72
- requestFingerprint: string;
73
- };
74
- export type ProductGate = {
75
- /** Fetches the product and idempotently ensures its canonical reusable link. */
76
- prime(): Promise<{
77
- product: Product;
78
- paymentLink: ProductPaymentLink;
79
- }>;
80
- /**
81
- * Protect a registered resource. The handler may run again after a confirmed
82
- * replay, so persist by `purchase.payment.attemptId` when effects are not
83
- * naturally idempotent.
84
- */
85
- protect(request: Request, handler: (request: Request, purchase: ProductGatePurchase) => Response | Promise<Response>): Promise<Response>;
86
- };
87
- export interface ProductsResource {
88
- create(input: ProductCreateInput): Promise<Product>;
89
- /** Active products; pass `includeArchived: true` for the whole catalogue. */
90
- list(opts?: {
91
- includeArchived?: boolean;
92
- }): Promise<Product[]>;
93
- retrieve(publicId: string): Promise<Product>;
94
- /**
95
- * Set or clear (`null`) the https fulfilment URL — where a paying buyer's
96
- * entitlement redirects. Changing it resets the server's verification stamp.
97
- */
98
- update(publicId: string, input: {
99
- fulfilmentUrl: string | null;
100
- } | {
101
- delivery: ProductDelivery;
102
- }): Promise<Product>;
103
- /**
104
- * Stops NEW payment-link mints; the existing canonical link stays payable
105
- * (a buyer mid-checkout is not punished for a catalogue edit). Archiving
106
- * twice is a no-op that returns the same product.
107
- */
108
- archive(publicId: string): Promise<Product>;
109
- /**
110
- * Mint the product's canonical reusable payment link, or return the existing
111
- * one with `created: false`. Idempotent by construction: the one-live-link
112
- * rule is a database unique index, so even concurrent mints converge on the
113
- * same link.
114
- */
115
- createPaymentLink(publicId: string): Promise<ProductPaymentLink>;
116
- /**
117
- * The product's payable URL — convenience for
118
- * `createPaymentLink(publicId)` → `link.payUrl`. The returned URL embeds the
119
- * link's `inv_` id, which changes when the link is archived and reminted
120
- * (e.g. a wallet migration): resolve it at render time, never hardcode it.
121
- * The mint is idempotent, but it is still a write — don't put it in a hot
122
- * render path uncached; prefer `permalink` where stability is what you need.
123
- */
124
- checkoutUrl(publicId: string): Promise<string>;
125
- /**
126
- * The product's PERMANENT checkout URL (`{baseUrl}/pay/p/{publicId}`) —
127
- * stable across every link remint, resolved server-side on every request.
128
- * Pure string builder: no network call, no mint. This is the URL to embed
129
- * in a shop's buy button.
130
- */
131
- permalink(publicId: string): string;
132
- gate(publicId: string): ProductGate;
133
- }
134
- export declare function createProductsResource(request: GenesisPayRequest,
135
- /**
136
- * Applies the client's `expectedPayTo` pin to the wallet the server froze
137
- * onto the minted link — the destination every sale of this product settles
138
- * to, which is exactly the value the pin exists to guard.
139
- */
140
- assertPinnedDestination: (wallet: unknown, what: string) => void,
141
- /** The client's raw-link mapper, so link shapes cannot drift between resources. */
142
- toLink: (raw: Record<string, unknown>) => CheckoutLink,
143
- /** The client's origin (no trailing slash) — the base of `permalink()`. */
144
- baseUrl: string, rawGateRequest?: (publicId: string, body: Record<string, unknown>) => Promise<Response>): ProductsResource;
145
- export declare function toProduct(raw: Record<string, unknown>): Product;
146
- //# sourceMappingURL=products.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"products.d.ts","sourceRoot":"","sources":["../src/products.ts"],"names":[],"mappings":"AAWA,OAAO,EAML,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC5D;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IA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eAAe,CAAA;KAAE,GACtE,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C;;;;;OAKG;IACH,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACjE;;;;;;;OAOG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC;CACrC;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,iBAAiB;AAC1B;;;;GAIG;AACH,uBAAuB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI;AAChE,mFAAmF;AACnF,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,YAAY;AACtD,2EAA2E;AAC3E,OAAO,EAAE,MAAM,EACf,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,GACtF,gBAAgB,CAkJlB;AA6BD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAgB/D"}
package/dist/products.js DELETED
@@ -1,295 +0,0 @@
1
- // `genesispay.products.*` — the merchant's catalogue over `/api/v1/products`.
2
- //
3
- // A product is what a shop sells; its payable instance is one CANONICAL
4
- // reusable checkout link, minted (idempotently) with `createPaymentLink`. The
5
- // price and asset are copied onto the link at mint and never re-read from the
6
- // catalogue, so editing or archiving a product cannot change what a buyer
7
- // already sees. Everything is scoped to the key's own account: someone else's
8
- // product answers 404 (GenesisPayNotFoundError), never 403 — the API is no
9
- // catalogue-enumeration oracle, and the SDK does not paper over that.
10
- import { GenesisPayConfigError } from "./errors.js";
11
- import { asRecord, optionalString, requiredString, toAmountString, oneOf, } from "./resource.js";
12
- import { PAYMENT_RESPONSE_HEADER, PAYMENT_SIGNATURE_HEADER } from "@genesis-tech/genesispay-protocol";
13
- export function createProductsResource(request,
14
- /**
15
- * Applies the client's `expectedPayTo` pin to the wallet the server froze
16
- * onto the minted link — the destination every sale of this product settles
17
- * to, which is exactly the value the pin exists to guard.
18
- */
19
- assertPinnedDestination,
20
- /** The client's raw-link mapper, so link shapes cannot drift between resources. */
21
- toLink,
22
- /** The client's origin (no trailing slash) — the base of `permalink()`. */
23
- baseUrl, rawGateRequest) {
24
- const resources = {
25
- create: async (input) => {
26
- const body = await request({
27
- method: "POST",
28
- path: "/api/v1/products",
29
- operation: "POST /api/v1/products",
30
- action: "create a product",
31
- body: {
32
- name: input.name,
33
- price: input.price,
34
- ...(input.description ? { description: input.description } : {}),
35
- ...(input.imageUrl ? { imageUrl: input.imageUrl } : {}),
36
- ...(input.sku ? { sku: input.sku } : {}),
37
- ...(input.asset ? { asset: input.asset } : {}),
38
- ...(input.delivery ? { delivery: input.delivery } : {}),
39
- },
40
- });
41
- return requireProduct(body, "POST /api/v1/products");
42
- },
43
- list: async (opts) => {
44
- const query = opts?.includeArchived ? "?includeArchived=true" : "";
45
- const body = await request({
46
- path: `/api/v1/products${query}`,
47
- operation: "GET /api/v1/products",
48
- action: "list products",
49
- });
50
- const products = asRecord(body)?.products;
51
- if (!Array.isArray(products)) {
52
- // A list endpoint that answers 200 without a list is a broken
53
- // contract, not an old backend. Returning [] would hide it as "no
54
- // products yet".
55
- throw new GenesisPayConfigError(`GenesisPay GET /api/v1/products returned no products array: ${JSON.stringify(body)}`);
56
- }
57
- // Individual entries stay tolerant: one unusable row must not lose the rest.
58
- return products
59
- .map(asRecord)
60
- .filter((raw) => raw !== null)
61
- .filter((raw) => typeof raw.publicId === "string" && raw.publicId.length > 0)
62
- .map(toProduct);
63
- },
64
- retrieve: async (publicId) => {
65
- const id = requirePublicId(publicId, "products.retrieve");
66
- const body = await request({
67
- path: `/api/v1/products/${encodeURIComponent(id)}`,
68
- operation: `GET /api/v1/products/${id}`,
69
- action: `retrieve product "${id}"`,
70
- notFoundMessage: notFoundMessage(id),
71
- });
72
- return requireProduct(body, `GET /api/v1/products/${id}`);
73
- },
74
- update: async (publicId, input) => {
75
- const id = requirePublicId(publicId, "products.update");
76
- const body = await request({
77
- method: "PATCH",
78
- path: `/api/v1/products/${encodeURIComponent(id)}`,
79
- operation: `PATCH /api/v1/products/${id}`,
80
- action: `update product "${id}"`,
81
- notFoundMessage: notFoundMessage(id),
82
- body: "delivery" in input ? { delivery: input.delivery } : { fulfilmentUrl: input.fulfilmentUrl },
83
- });
84
- return requireProduct(body, `PATCH /api/v1/products/${id}`);
85
- },
86
- archive: async (publicId) => {
87
- const id = requirePublicId(publicId, "products.archive");
88
- const body = await request({
89
- method: "POST",
90
- path: `/api/v1/products/${encodeURIComponent(id)}/archive`,
91
- operation: `POST /api/v1/products/${id}/archive`,
92
- action: `archive product "${id}"`,
93
- notFoundMessage: notFoundMessage(id),
94
- });
95
- return requireProduct(body, `POST /api/v1/products/${id}/archive`);
96
- },
97
- createPaymentLink: async (publicId) => {
98
- const id = requirePublicId(publicId, "products.createPaymentLink");
99
- const body = await request({
100
- method: "POST",
101
- path: `/api/v1/products/${encodeURIComponent(id)}/payment-link`,
102
- operation: `POST /api/v1/products/${id}/payment-link`,
103
- action: `mint the payment link for product "${id}"`,
104
- notFoundMessage: notFoundMessage(id),
105
- hint: (status) => status === 409
106
- ? "An archived product mints no new links, and selling needs a receiving wallet on the account."
107
- : undefined,
108
- });
109
- const record = asRecord(body);
110
- const rawLink = asRecord(record?.link);
111
- if (!rawLink || typeof rawLink.publicId !== "string" || !rawLink.publicId) {
112
- throw new GenesisPayConfigError(`GenesisPay POST /api/v1/products/${id}/payment-link returned no link: ${JSON.stringify(body)}`);
113
- }
114
- assertPinnedDestination(rawLink.destinationWallet, "product payment link");
115
- return {
116
- link: toLink(rawLink),
117
- // Only an explicit true: a proxy that drops the field must not report
118
- // every idempotent re-mint as a fresh link.
119
- created: record?.created === true,
120
- };
121
- },
122
- checkoutUrl: async (publicId) => {
123
- const { link } = await resources.createPaymentLink(publicId);
124
- return link.payUrl;
125
- },
126
- permalink: (publicId) => `${baseUrl}/pay/p/${encodeURIComponent(requirePublicId(publicId, "products.permalink"))}`,
127
- gate: (publicId) => createProductGate({
128
- publicId: requirePublicId(publicId, "products.gate"),
129
- retrieve: async () => {
130
- const body = await request({
131
- path: `/api/v1/products/${encodeURIComponent(publicId)}`,
132
- operation: `GET /api/v1/products/${publicId}`,
133
- action: `retrieve product "${publicId}"`,
134
- notFoundMessage: notFoundMessage(publicId),
135
- });
136
- return requireProduct(body, `GET /api/v1/products/${publicId}`);
137
- },
138
- createPaymentLink: async () => {
139
- const body = await request({
140
- method: "POST",
141
- path: `/api/v1/products/${encodeURIComponent(publicId)}/payment-link`,
142
- operation: `POST /api/v1/products/${publicId}/payment-link`, action: `mint the payment link for product "${publicId}"`,
143
- notFoundMessage: notFoundMessage(publicId),
144
- });
145
- const record = asRecord(body);
146
- const rawLink = asRecord(record?.link);
147
- if (!rawLink || typeof rawLink.publicId !== "string" || !rawLink.publicId)
148
- throw new GenesisPayConfigError("GenesisPay product gate returned no link.");
149
- assertPinnedDestination(rawLink.destinationWallet, "product payment link");
150
- return { link: toLink(rawLink), created: record?.created === true };
151
- },
152
- request: rawGateRequest,
153
- }),
154
- };
155
- return resources;
156
- }
157
- function notFoundMessage(id) {
158
- return (`No GenesisPay product with publicId "${id}". Check the id and that it ` +
159
- `belongs to the account this API key authenticates.`);
160
- }
161
- function requirePublicId(publicId, method) {
162
- const id = publicId?.trim();
163
- if (!id) {
164
- throw new GenesisPayConfigError(`${method}(publicId) requires the publicId returned by products.create().`);
165
- }
166
- return id;
167
- }
168
- function requireProduct(body, operation) {
169
- const raw = asRecord(asRecord(body)?.product);
170
- if (!raw || typeof raw.publicId !== "string" || !raw.publicId) {
171
- throw new GenesisPayConfigError(`GenesisPay ${operation} returned no product: ${JSON.stringify(body)}`);
172
- }
173
- return toProduct(raw);
174
- }
175
- export function toProduct(raw) {
176
- return {
177
- publicId: requiredString(raw.publicId),
178
- name: requiredString(raw.name),
179
- description: optionalString(raw.description),
180
- imageUrl: optionalString(raw.imageUrl),
181
- sku: optionalString(raw.sku),
182
- asset: oneOf(raw.asset, ["USDC", "EURC"], "USDC"),
183
- price: toAmountString(raw.price),
184
- priceMinor: toAmountString(raw.priceMinor),
185
- archived: raw.archived === true,
186
- fulfilmentUrl: optionalString(raw.fulfilmentUrl),
187
- fulfilmentVerifiedAt: optionalString(raw.fulfilmentVerifiedAt),
188
- delivery: toProductDelivery(raw),
189
- createdAt: requiredString(raw.createdAt),
190
- };
191
- }
192
- function toProductDelivery(raw) {
193
- const delivery = asRecord(raw.delivery);
194
- if (delivery?.type === "redirect" && typeof delivery.url === "string") {
195
- return { type: "redirect", url: delivery.url, verifiedAt: optionalString(delivery.verifiedAt) };
196
- }
197
- if (delivery?.type === "gate" && typeof delivery.resourceUrl === "string") {
198
- return { type: "gate", resourceUrl: delivery.resourceUrl, method: oneOf(delivery.method, ["GET", "POST", "PUT", "PATCH", "DELETE"], "POST") };
199
- }
200
- // Compatibility with servers older than the additive delivery field.
201
- const url = optionalString(raw.fulfilmentUrl);
202
- return url ? { type: "redirect", url, verifiedAt: optionalString(raw.fulfilmentVerifiedAt) } : { type: "none" };
203
- }
204
- function createProductGate(input) {
205
- return {
206
- async prime() {
207
- const product = await input.retrieve();
208
- if (product.delivery.type !== "gate")
209
- throw new GenesisPayConfigError(`Product "${input.publicId}" is not configured with gate delivery.`);
210
- return { product, paymentLink: await input.createPaymentLink() };
211
- },
212
- async protect(request, handler) {
213
- if (!input.request)
214
- throw new GenesisPayConfigError("This GenesisPay client cannot call product gates.");
215
- const signature = request.headers.get(PAYMENT_SIGNATURE_HEADER);
216
- const url = canonicalRequestUrl(request.url);
217
- const requestMethod = request.method.toUpperCase();
218
- let product = null;
219
- let gateResourceUrl;
220
- if (signature) {
221
- // A settled retry belongs to the immutable resource snapshot in its
222
- // gate intent. Do not reject it because the merchant edited the live
223
- // product URL after GenesisPay returned the original 402.
224
- gateResourceUrl = url;
225
- }
226
- else {
227
- const primed = await this.prime();
228
- product = primed.product;
229
- if (product.delivery.type !== "gate")
230
- throw new GenesisPayConfigError("Product is not a gate.");
231
- if (url !== canonicalRequestUrl(product.delivery.resourceUrl) || requestMethod !== product.delivery.method) {
232
- throw new GenesisPayConfigError("Incoming request does not match the product's registered gate resource.");
233
- }
234
- gateResourceUrl = product.delivery.resourceUrl;
235
- }
236
- const requestFingerprint = await fingerprintRequest(request);
237
- const response = await input.request(input.publicId, {
238
- action: signature ? "settle" : "challenge",
239
- resourceUrl: gateResourceUrl,
240
- method: requestMethod,
241
- requestFingerprint,
242
- ...(signature ? { paymentSignature: signature } : {}),
243
- });
244
- if (!response.ok)
245
- return copyResponse(response);
246
- const payment = await response.clone().json().catch(() => null);
247
- const attemptId = typeof payment?.paymentAttemptId === "string" ? payment.paymentAttemptId : null;
248
- if (!attemptId)
249
- return copyResponse(response);
250
- // Product data is presentation/context, never payment authority. Reading
251
- // it after a signed retry is safe even if delivery has changed; GenesisPay
252
- // already checked the intent's seller/product/link ownership.
253
- product ??= await input.retrieve();
254
- const extension = asRecord(payment?.extensions);
255
- const handlerResponse = await handler(request, {
256
- product: { publicId: product.publicId, sku: product.sku, quantity: 1 },
257
- payment: {
258
- attemptId,
259
- txHash: typeof payment?.transaction === "string" ? payment.transaction : "",
260
- payer: optionalString(payment?.payer), asset: "USDC", amountMinor: toAmountString(payment?.amount),
261
- chainId: payment && Number.isInteger(payment.chainId) ? payment.chainId : 8453,
262
- simulated: false, idempotentReplay: extension?.idempotentReplay === true,
263
- },
264
- requestFingerprint,
265
- });
266
- const out = new Headers(handlerResponse.headers);
267
- const paymentResponse = response.headers.get(PAYMENT_RESPONSE_HEADER);
268
- if (paymentResponse)
269
- out.set(PAYMENT_RESPONSE_HEADER, paymentResponse);
270
- return new Response(handlerResponse.body, { status: handlerResponse.status, statusText: handlerResponse.statusText, headers: out });
271
- },
272
- };
273
- }
274
- async function fingerprintRequest(request) {
275
- const body = new Uint8Array(await request.clone().arrayBuffer());
276
- const bodyHash = await sha256(body);
277
- return sha256(new TextEncoder().encode(`${request.method.toUpperCase()}\n${canonicalRequestUrl(request.url)}\n${bodyHash}`));
278
- }
279
- function canonicalRequestUrl(value) {
280
- const url = new URL(value);
281
- url.searchParams.delete("gp_attempt");
282
- url.hash = "";
283
- return url.toString();
284
- }
285
- async function sha256(value) {
286
- // Copy into an ArrayBuffer because TypeScript's DOM declarations reject a
287
- // potentially shared ArrayBuffer view even though Web Crypto accepts bytes.
288
- const bytes = Uint8Array.from(value);
289
- const digest = await crypto.subtle.digest("SHA-256", bytes.buffer);
290
- return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
291
- }
292
- async function copyResponse(response) {
293
- return new Response(await response.arrayBuffer(), { status: response.status, statusText: response.statusText, headers: response.headers });
294
- }
295
- //# sourceMappingURL=products.js.map
@@ -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,EAAE,MAAM,mCAAmC,CAAC;AAg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