@strimz/shared-types 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +66 -36
  2. package/dist/agents.cjs.map +1 -1
  3. package/dist/agents.d.cts +1 -1
  4. package/dist/agents.d.ts +1 -1
  5. package/dist/agents.js.map +1 -1
  6. package/dist/api-keys.cjs +8 -3
  7. package/dist/api-keys.cjs.map +1 -1
  8. package/dist/api-keys.d.cts +15 -16
  9. package/dist/api-keys.d.ts +15 -16
  10. package/dist/api-keys.js +8 -3
  11. package/dist/api-keys.js.map +1 -1
  12. package/dist/common.cjs.map +1 -1
  13. package/dist/common.d.cts +2 -2
  14. package/dist/common.d.ts +2 -2
  15. package/dist/common.js.map +1 -1
  16. package/dist/compliance.cjs.map +1 -1
  17. package/dist/compliance.d.cts +1 -1
  18. package/dist/compliance.d.ts +1 -1
  19. package/dist/compliance.js.map +1 -1
  20. package/dist/customers.cjs.map +1 -1
  21. package/dist/customers.d.cts +1 -1
  22. package/dist/customers.d.ts +1 -1
  23. package/dist/customers.js.map +1 -1
  24. package/dist/events.cjs +24 -6
  25. package/dist/events.cjs.map +1 -1
  26. package/dist/events.d.cts +12 -12
  27. package/dist/events.d.ts +12 -12
  28. package/dist/events.js +24 -6
  29. package/dist/events.js.map +1 -1
  30. package/dist/index.cjs +188 -11
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +302 -17
  33. package/dist/index.d.ts +302 -17
  34. package/dist/index.js +167 -12
  35. package/dist/index.js.map +1 -1
  36. package/dist/invoices.cjs.map +1 -1
  37. package/dist/invoices.d.cts +1 -1
  38. package/dist/invoices.d.ts +1 -1
  39. package/dist/invoices.js.map +1 -1
  40. package/dist/merchants.cjs +59 -1
  41. package/dist/merchants.cjs.map +1 -1
  42. package/dist/merchants.d.cts +171 -1
  43. package/dist/merchants.d.ts +171 -1
  44. package/dist/merchants.js +55 -2
  45. package/dist/merchants.js.map +1 -1
  46. package/dist/payment-sessions.cjs +6 -2
  47. package/dist/payment-sessions.cjs.map +1 -1
  48. package/dist/payment-sessions.d.cts +20 -4
  49. package/dist/payment-sessions.d.ts +20 -4
  50. package/dist/payment-sessions.js +6 -3
  51. package/dist/payment-sessions.js.map +1 -1
  52. package/dist/refunds.cjs +12 -0
  53. package/dist/refunds.cjs.map +1 -1
  54. package/dist/refunds.d.cts +135 -2
  55. package/dist/refunds.d.ts +135 -2
  56. package/dist/refunds.js +11 -1
  57. package/dist/refunds.js.map +1 -1
  58. package/dist/storefronts.cjs +16 -2
  59. package/dist/storefronts.cjs.map +1 -1
  60. package/dist/storefronts.d.cts +38 -2
  61. package/dist/storefronts.d.ts +38 -2
  62. package/dist/storefronts.js +15 -3
  63. package/dist/storefronts.js.map +1 -1
  64. package/dist/subscriptions.cjs +2 -2
  65. package/dist/subscriptions.cjs.map +1 -1
  66. package/dist/subscriptions.d.cts +3 -3
  67. package/dist/subscriptions.d.ts +3 -3
  68. package/dist/subscriptions.js +2 -2
  69. package/dist/subscriptions.js.map +1 -1
  70. package/dist/transactions.cjs.map +1 -1
  71. package/dist/transactions.d.cts +2 -2
  72. package/dist/transactions.d.ts +2 -2
  73. package/dist/transactions.js.map +1 -1
  74. package/dist/webhooks.cjs +7 -1
  75. package/dist/webhooks.cjs.map +1 -1
  76. package/dist/webhooks.d.cts +63 -4
  77. package/dist/webhooks.d.ts +63 -4
  78. package/dist/webhooks.js +7 -2
  79. package/dist/webhooks.js.map +1 -1
  80. package/package.json +2 -2
  81. package/src/agents.ts +1 -1
  82. package/src/api-keys.ts +9 -5
  83. package/src/common.ts +2 -2
  84. package/src/compliance.ts +1 -1
  85. package/src/contact.ts +26 -0
  86. package/src/customers.ts +1 -1
  87. package/src/index.ts +2 -0
  88. package/src/invoices.ts +1 -1
  89. package/src/merchants.ts +84 -0
  90. package/src/notifications.ts +88 -0
  91. package/src/payment-sessions.ts +25 -3
  92. package/src/refunds.ts +20 -1
  93. package/src/storefronts.ts +25 -1
  94. package/src/subscriptions.ts +3 -3
  95. package/src/tokens.ts +7 -7
  96. package/src/transactions.ts +2 -2
  97. package/src/webhooks.ts +15 -3
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  /**
4
- * Payment session — a one-shot checkout intent.
4
+ * Payment session. A one-shot checkout intent.
5
5
  *
6
6
  * State machine:
7
7
  * created → awaiting_payment → submitted → confirmed
@@ -13,6 +13,22 @@ import { z } from 'zod';
13
13
 
14
14
  declare const paymentSessionStatusSchema: z.ZodEnum<["created", "awaiting_payment", "submitted", "confirmed", "failed", "expired", "cancelled"]>;
15
15
  type PaymentSessionStatus = z.infer<typeof paymentSessionStatusSchema>;
16
+ /**
17
+ * Merchant-supplied callback URL. The hosted checkout dispatches with
18
+ * `window.location.href = redirectUrl` on completion / cancellation,
19
+ * so we MUST reject anything other than `http://` and `https://`.
20
+ *
21
+ * Why this is a real risk: Zod's `.url()` validates RFC syntax, which
22
+ * accepts `javascript:`, `data:`, `vbscript:`, `file:`, blob:`, etc.
23
+ * A compromised merchant integration or an XSS upstream could ship a
24
+ * session whose redirect URL executes script (or exfiltrates session
25
+ * tokens) on every payer's browser. The damage is per-payer, but the
26
+ * blast radius is "every checkout the merchant runs."
27
+ *
28
+ * Mailto / tel and other handler protocols are also rejected — there
29
+ * is no legitimate flow on a payment checkout that would benefit.
30
+ */
31
+ declare const callbackUrlSchema: z.ZodEffects<z.ZodString, string, string>;
16
32
  declare const paymentSessionSchema: z.ZodObject<{
17
33
  id: z.ZodString;
18
34
  merchantId: z.ZodString;
@@ -42,8 +58,8 @@ declare const paymentSessionSchema: z.ZodObject<{
42
58
  description: z.ZodNullable<z.ZodString>;
43
59
  payerWalletAddress: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
44
60
  payerEmail: z.ZodNullable<z.ZodString>;
45
- successUrl: z.ZodNullable<z.ZodString>;
46
- cancelUrl: z.ZodNullable<z.ZodString>;
61
+ successUrl: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
62
+ cancelUrl: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
47
63
  sourceChain: z.ZodNullable<z.ZodEnum<["arc", "ethereum", "base", "polygon", "arbitrum", "optimism", "avalanche", "solana"]>>;
48
64
  bridgeTxHash: z.ZodNullable<z.ZodString>;
49
65
  onchainTxHash: z.ZodNullable<z.ZodString>;
@@ -177,4 +193,4 @@ declare const submitPaymentSessionInputSchema: z.ZodObject<{
177
193
  }>;
178
194
  type SubmitPaymentSessionInput = z.infer<typeof submitPaymentSessionInputSchema>;
179
195
 
180
- export { type CreatePaymentSessionInput, type PaymentSession, type PaymentSessionStatus, type SubmitPaymentSessionInput, createPaymentSessionInputSchema, paymentSessionSchema, paymentSessionStatusSchema, submitPaymentSessionInputSchema };
196
+ export { type CreatePaymentSessionInput, type PaymentSession, type PaymentSessionStatus, type SubmitPaymentSessionInput, callbackUrlSchema, createPaymentSessionInputSchema, paymentSessionSchema, paymentSessionStatusSchema, submitPaymentSessionInputSchema };
@@ -37,6 +37,9 @@ var paymentSessionStatusSchema = z.enum([
37
37
  "expired",
38
38
  "cancelled"
39
39
  ]);
40
+ var callbackUrlSchema = z.string().url().refine((v) => v.startsWith("https://") || v.startsWith("http://"), {
41
+ message: "must be an http:// or https:// URL"
42
+ });
40
43
  var paymentSessionSchema = z.object({
41
44
  id: idSchema,
42
45
  merchantId: idSchema,
@@ -66,8 +69,8 @@ var paymentSessionSchema = z.object({
66
69
  description: z.string().max(500).nullable(),
67
70
  payerWalletAddress: evmAddressSchema.nullable(),
68
71
  payerEmail: z.string().email().nullable(),
69
- successUrl: z.string().url().nullable(),
70
- cancelUrl: z.string().url().nullable(),
72
+ successUrl: callbackUrlSchema.nullable(),
73
+ cancelUrl: callbackUrlSchema.nullable(),
71
74
  sourceChain: z.enum(["arc", "ethereum", "base", "polygon", "arbitrum", "optimism", "avalanche", "solana"]).nullable(),
72
75
  bridgeTxHash: evmTxHashSchema.nullable(),
73
76
  onchainTxHash: evmTxHashSchema.nullable(),
@@ -115,6 +118,6 @@ var submitPaymentSessionInputSchema = z.object({
115
118
  payerWalletAddress: evmAddressSchema
116
119
  });
117
120
 
118
- export { createPaymentSessionInputSchema, paymentSessionSchema, paymentSessionStatusSchema, submitPaymentSessionInputSchema };
121
+ export { callbackUrlSchema, createPaymentSessionInputSchema, paymentSessionSchema, paymentSessionStatusSchema, submitPaymentSessionInputSchema };
119
122
  //# sourceMappingURL=payment-sessions.js.map
120
123
  //# sourceMappingURL=payment-sessions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common.ts","../src/payment-sessions.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5C,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0B,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoB,CAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA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KAAI,CACJ,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAA,GAAK,EAAE,CAAA,CACX,QAAQ,EAAE,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,uBAAuBA,CAAAA,CACpB,KAAA;AAAA,IACCA,CAAAA,CAAE,IAAA,CAAK,CAAC,KAAA,EAAO,UAAA,EAAY,MAAA,EAAQ,SAAA,EAAW,UAAA,EAAY,UAAA,EAAY,WAAA,EAAa,QAAQ,CAAC;AAAA,IAE7F,QAAA,EAAS;AAAA,EACZ,QAAA,EAAU,eAAe,QAAA;AAC3B,CAAC;AAGM,IAAM,+BAAA,GAAkCA,EAAE,MAAA,CAAO;AAAA,EACtD,WAAA,EAAaA,EAAE,IAAA,CAAK;AAAA,IAClB,KAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AAAA,EACD,aAAA,EAAe,eAAA;AAAA,EACf,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,kBAAA,EAAoB;AACtB,CAAC","file":"payment-sessions.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum — mirrors `@strimz/shared-config`. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum — mirrors `@strimz/shared-config`. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Payment session — a one-shot checkout intent.\n *\n * State machine:\n * created → awaiting_payment → submitted → confirmed\n * \\\n * → failed\n * → expired\n * → cancelled\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const paymentSessionStatusSchema = z.enum([\n 'created',\n 'awaiting_payment',\n 'submitted',\n 'confirmed',\n 'failed',\n 'expired',\n 'cancelled',\n])\nexport type PaymentSessionStatus = z.infer<typeof paymentSessionStatusSchema>\n\nexport const paymentSessionSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /**\n * On-chain StrimzRegistry merchant id (uint96) as a decimal string.\n * Set when the merchant has been registered on-chain; null when the\n * merchant exists in our DB but the registry transaction hasn't\n * been broadcast yet. Hosted checkout uses this to populate the\n * meta-tx calldata; if null, the checkout refuses to accept\n * payments.\n */\n chainMerchantId: z\n .string()\n .regex(/^[0-9]+$/u, 'must be a non-negative decimal integer string')\n .nullable(),\n /**\n * ERC-20 token contract address resolved from `currency` on the\n * active chain (Arc Testnet / Mainnet). Used as the `verifyingContract`\n * in the EIP-712 domain for both EIP-3009 and EIP-2612 signing.\n * Null on the (vanishingly unlikely) path where the API has no\n * configured address for the session's currency.\n */\n tokenAddress: evmAddressSchema.nullable(),\n customerId: idSchema.nullable(),\n status: paymentSessionStatusSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n feeAmount: tokenAmountSchema,\n netAmount: tokenAmountSchema,\n description: z.string().max(500).nullable(),\n payerWalletAddress: evmAddressSchema.nullable(),\n payerEmail: z.string().email().nullable(),\n successUrl: z.string().url().nullable(),\n cancelUrl: z.string().url().nullable(),\n sourceChain: z\n .enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana'])\n .nullable(),\n bridgeTxHash: evmTxHashSchema.nullable(),\n onchainTxHash: evmTxHashSchema.nullable(),\n checkoutUrl: z.string().url(),\n metadata: metadataSchema,\n expiresAt: isoTimestampSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type PaymentSession = z.infer<typeof paymentSessionSchema>\n\n// ---------- DTOs ----------\n\nexport const createPaymentSessionInputSchema = z.object({\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n description: z.string().max(500).optional(),\n customer: z\n .object({\n walletAddress: evmAddressSchema.optional(),\n email: z.string().email().optional(),\n externalRef: z.string().max(120).optional(),\n })\n .optional(),\n successUrl: z.string().url().optional(),\n cancelUrl: z.string().url().optional(),\n /** Minutes until the session expires. Default 30, max 60*24 (one day). */\n expiresInMinutes: z\n .number()\n .int()\n .min(1)\n .max(60 * 24)\n .default(30),\n /**\n * Allowed source chains a payer can bridge USDC from via CCTP. Omit to\n * accept every CCTP-supported chain.\n */\n supportedSourceChains: z\n .array(\n z.enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana']),\n )\n .optional(),\n metadata: metadataSchema.optional(),\n})\nexport type CreatePaymentSessionInput = z.infer<typeof createPaymentSessionInputSchema>\n\nexport const submitPaymentSessionInputSchema = z.object({\n sourceChain: z.enum([\n 'arc',\n 'ethereum',\n 'base',\n 'polygon',\n 'arbitrum',\n 'optimism',\n 'avalanche',\n 'solana',\n ]),\n onchainTxHash: evmTxHashSchema,\n bridgeTxHash: evmTxHashSchema.optional(),\n payerWalletAddress: evmAddressSchema,\n})\nexport type SubmitPaymentSessionInput = z.infer<typeof submitPaymentSessionInputSchema>\n"]}
1
+ {"version":3,"sources":["../src/common.ts","../src/payment-sessions.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5C,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0B,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoB,CAAA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AAS;AAAA,EACZ,YAAYA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA,EACtC,WAAWA,CAAAA,CAAE,MAAA,EAAO,CAAE,GAAA,GAAM,QAAA,EAAS;AAAA;AAAA,EAErC,gBAAA,EAAkBA,CAAAA,CACf,MAAA,EAAO,CACP,KAAI,CACJ,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAA,GAAK,EAAE,CAAA,CACX,QAAQ,EAAE,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKb,uBAAuBA,CAAAA,CACpB,KAAA;AAAA,IACCA,CAAAA,CAAE,IAAA,CAAK,CAAC,KAAA,EAAO,UAAA,EAAY,MAAA,EAAQ,SAAA,EAAW,UAAA,EAAY,UAAA,EAAY,WAAA,EAAa,QAAQ,CAAC;AAAA,IAE7F,QAAA,EAAS;AAAA,EACZ,QAAA,EAAU,eAAe,QAAA;AAC3B,CAAC;AAGM,IAAM,+BAAA,GAAkCA,EAAE,MAAA,CAAO;AAAA,EACtD,WAAA,EAAaA,EAAE,IAAA,CAAK;AAAA,IAClB,KAAA;AAAA,IACA,UAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACD,CAAA;AAAA,EACD,aAAA,EAAe,eAAA;AAAA,EACf,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,kBAAA,EAAoB;AACtB,CAAC","file":"payment-sessions.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Payment session. A one-shot checkout intent.\n *\n * State machine:\n * created → awaiting_payment → submitted → confirmed\n * \\\n * → failed\n * → expired\n * → cancelled\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n metadataSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const paymentSessionStatusSchema = z.enum([\n 'created',\n 'awaiting_payment',\n 'submitted',\n 'confirmed',\n 'failed',\n 'expired',\n 'cancelled',\n])\nexport type PaymentSessionStatus = z.infer<typeof paymentSessionStatusSchema>\n\n/**\n * Merchant-supplied callback URL. The hosted checkout dispatches with\n * `window.location.href = redirectUrl` on completion / cancellation,\n * so we MUST reject anything other than `http://` and `https://`.\n *\n * Why this is a real risk: Zod's `.url()` validates RFC syntax, which\n * accepts `javascript:`, `data:`, `vbscript:`, `file:`, blob:`, etc.\n * A compromised merchant integration or an XSS upstream could ship a\n * session whose redirect URL executes script (or exfiltrates session\n * tokens) on every payer's browser. The damage is per-payer, but the\n * blast radius is \"every checkout the merchant runs.\"\n *\n * Mailto / tel and other handler protocols are also rejected — there\n * is no legitimate flow on a payment checkout that would benefit.\n */\nexport const callbackUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://') || v.startsWith('http://'), {\n message: 'must be an http:// or https:// URL',\n })\n\nexport const paymentSessionSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n /**\n * On-chain StrimzRegistry merchant id (uint96) as a decimal string.\n * Set when the merchant has been registered on-chain; null when the\n * merchant exists in our DB but the registry transaction hasn't\n * been broadcast yet. Hosted checkout uses this to populate the\n * meta-tx calldata; if null, the checkout refuses to accept\n * payments.\n */\n chainMerchantId: z\n .string()\n .regex(/^[0-9]+$/u, 'must be a non-negative decimal integer string')\n .nullable(),\n /**\n * ERC-20 token contract address resolved from `currency` on the\n * active chain (Arc Testnet / Mainnet). Used as the `verifyingContract`\n * in the EIP-712 domain for both EIP-3009 and EIP-2612 signing.\n * Null on the (vanishingly unlikely) path where the API has no\n * configured address for the session's currency.\n */\n tokenAddress: evmAddressSchema.nullable(),\n customerId: idSchema.nullable(),\n status: paymentSessionStatusSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n feeAmount: tokenAmountSchema,\n netAmount: tokenAmountSchema,\n description: z.string().max(500).nullable(),\n payerWalletAddress: evmAddressSchema.nullable(),\n payerEmail: z.string().email().nullable(),\n successUrl: callbackUrlSchema.nullable(),\n cancelUrl: callbackUrlSchema.nullable(),\n sourceChain: z\n .enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana'])\n .nullable(),\n bridgeTxHash: evmTxHashSchema.nullable(),\n onchainTxHash: evmTxHashSchema.nullable(),\n checkoutUrl: z.string().url(),\n metadata: metadataSchema,\n expiresAt: isoTimestampSchema,\n createdAt: isoTimestampSchema,\n updatedAt: isoTimestampSchema,\n})\nexport type PaymentSession = z.infer<typeof paymentSessionSchema>\n\n// ---------- DTOs ----------\n\nexport const createPaymentSessionInputSchema = z.object({\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n description: z.string().max(500).optional(),\n customer: z\n .object({\n walletAddress: evmAddressSchema.optional(),\n email: z.string().email().optional(),\n externalRef: z.string().max(120).optional(),\n })\n .optional(),\n successUrl: z.string().url().optional(),\n cancelUrl: z.string().url().optional(),\n /** Minutes until the session expires. Default 30, max 60*24 (one day). */\n expiresInMinutes: z\n .number()\n .int()\n .min(1)\n .max(60 * 24)\n .default(30),\n /**\n * Allowed source chains a payer can bridge USDC from via CCTP. Omit to\n * accept every CCTP-supported chain.\n */\n supportedSourceChains: z\n .array(\n z.enum(['arc', 'ethereum', 'base', 'polygon', 'arbitrum', 'optimism', 'avalanche', 'solana']),\n )\n .optional(),\n metadata: metadataSchema.optional(),\n})\nexport type CreatePaymentSessionInput = z.infer<typeof createPaymentSessionInputSchema>\n\nexport const submitPaymentSessionInputSchema = z.object({\n sourceChain: z.enum([\n 'arc',\n 'ethereum',\n 'base',\n 'polygon',\n 'arbitrum',\n 'optimism',\n 'avalanche',\n 'solana',\n ]),\n onchainTxHash: evmTxHashSchema,\n bridgeTxHash: evmTxHashSchema.optional(),\n payerWalletAddress: evmAddressSchema,\n})\nexport type SubmitPaymentSessionInput = z.infer<typeof submitPaymentSessionInputSchema>\n"]}
package/dist/refunds.cjs CHANGED
@@ -71,10 +71,22 @@ var submitRefundSignatureInputSchema = zod.z.object({
71
71
  id: idSchema,
72
72
  refundTxHash: evmTxHashSchema
73
73
  });
74
+ var refundSigningInstructionsSchema = zod.z.object({
75
+ token: evmAddressSchema,
76
+ to: evmAddressSchema,
77
+ amount: tokenAmountSchema,
78
+ note: zod.z.string()
79
+ });
80
+ var refundCreateOutputSchema = zod.z.object({
81
+ refund: refundSchema,
82
+ signingInstructions: refundSigningInstructionsSchema
83
+ });
74
84
 
75
85
  exports.createRefundInputSchema = createRefundInputSchema;
86
+ exports.refundCreateOutputSchema = refundCreateOutputSchema;
76
87
  exports.refundReasonSchema = refundReasonSchema;
77
88
  exports.refundSchema = refundSchema;
89
+ exports.refundSigningInstructionsSchema = refundSigningInstructionsSchema;
78
90
  exports.refundStatusSchema = refundStatusSchema;
79
91
  exports.submitRefundSignatureInputSchema = submitRefundSignatureInputSchema;
80
92
  //# sourceMappingURL=refunds.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common.ts","../src/refunds.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5CA,KAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0BA,KAAA,CAAE,MA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AA,EACb,SAAA,EAAW,kBAAA;AAAA,EACX,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,uBAAA,GAA0BA,MAAE,MAAA,CAAO;AAAA,EAC9C,aAAA,EAAe,QAAA;AAAA,EACf,MAAA,EAAQ,iBAAA;AAAA,EACR,MAAA,EAAQ,kBAAA;AAAA,EACR,MAAMA,KAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAC5B,CAAC;AAGM,IAAM,gCAAA,GAAmCA,MAAE,MAAA,CAAO;AAAA,EACvD,EAAA,EAAI,QAAA;AAAA,EACJ,YAAA,EAAc;AAChB,CAAC","file":"refunds.cjs","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum — mirrors `@strimz/shared-config`. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum — mirrors `@strimz/shared-config`. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Refund — a merchant-initiated return of funds to a payer.\n *\n * Refunds are executed off-chain (from the merchant's wallet to the payer's\n * wallet). Strimz records the intent, validates constraints, and reconciles\n * via the merchant-signed on-chain transfer.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const refundReasonSchema = z.enum([\n 'customer_request',\n 'product_issue',\n 'duplicate_charge',\n 'fraudulent',\n 'other',\n])\nexport type RefundReason = z.infer<typeof refundReasonSchema>\n\nexport const refundStatusSchema = z.enum([\n 'pending',\n 'awaiting_signature',\n 'submitted',\n 'completed',\n 'failed',\n 'cancelled',\n])\nexport type RefundStatus = z.infer<typeof refundStatusSchema>\n\nexport const refundSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n transactionId: idSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n reason: refundReasonSchema,\n note: z.string().max(500).nullable(),\n status: refundStatusSchema,\n payerAddress: evmAddressSchema,\n refundTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n initiatedBy: idSchema,\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type Refund = z.infer<typeof refundSchema>\n\nexport const createRefundInputSchema = z.object({\n transactionId: idSchema,\n amount: tokenAmountSchema,\n reason: refundReasonSchema,\n note: z.string().max(500).optional(),\n})\nexport type CreateRefundInput = z.infer<typeof createRefundInputSchema>\n\nexport const submitRefundSignatureInputSchema = z.object({\n id: idSchema,\n refundTxHash: evmTxHashSchema,\n})\nexport type SubmitRefundSignatureInput = z.infer<typeof submitRefundSignatureInputSchema>\n"]}
1
+ {"version":3,"sources":["../src/common.ts","../src/refunds.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmBA,KAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkBA,KAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlEA,KAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5CA,KAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0BA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoBA,KAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,cAAc,CAAA;AAGtBA,KAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,CAAC,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GAAG,EAAE,QAAA;AAC5B,CAAC;AAGM,IAAM,gCAAA,GAAmCA,MAAE,MAAA,CAAO;AAAA,EACvD,EAAA,EAAI,QAAA;AAAA,EACJ,YAAA,EAAc;AAChB,CAAC;AAQM,IAAM,+BAAA,GAAkCA,MAAE,MAAA,CAAO;AAAA,EACtD,KAAA,EAAO,gBAAA;AAAA,EACP,EAAA,EAAI,gBAAA;AAAA,EACJ,MAAA,EAAQ,iBAAA;AAAA,EACR,IAAA,EAAMA,MAAE,MAAA;AACV,CAAC;AAGM,IAAM,wBAAA,GAA2BA,MAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA,EACR,mBAAA,EAAqB;AACvB,CAAC","file":"refunds.cjs","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Refund. A merchant-initiated return of funds to a payer.\n *\n * Refunds are executed off-chain (from the merchant's wallet to the payer's\n * wallet). Strimz records the intent, validates constraints, and reconciles\n * via the merchant-signed on-chain transfer.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const refundReasonSchema = z.enum([\n 'customer_request',\n 'product_issue',\n 'duplicate_charge',\n 'fraudulent',\n 'other',\n])\nexport type RefundReason = z.infer<typeof refundReasonSchema>\n\nexport const refundStatusSchema = z.enum([\n 'pending',\n 'awaiting_signature',\n 'submitted',\n 'completed',\n 'failed',\n 'cancelled',\n])\nexport type RefundStatus = z.infer<typeof refundStatusSchema>\n\nexport const refundSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n transactionId: idSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n reason: refundReasonSchema,\n note: z.string().max(500).nullable(),\n status: refundStatusSchema,\n payerAddress: evmAddressSchema,\n refundTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n initiatedBy: idSchema,\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type Refund = z.infer<typeof refundSchema>\n\nexport const createRefundInputSchema = z.object({\n transactionId: idSchema,\n amount: tokenAmountSchema,\n reason: refundReasonSchema,\n note: z.string().max(500).optional(),\n})\nexport type CreateRefundInput = z.infer<typeof createRefundInputSchema>\n\nexport const submitRefundSignatureInputSchema = z.object({\n id: idSchema,\n refundTxHash: evmTxHashSchema,\n})\nexport type SubmitRefundSignatureInput = z.infer<typeof submitRefundSignatureInputSchema>\n\n/**\n * Response envelope for `POST /v1/refunds`. The API returns the newly\n * created refund plus the concrete ERC-20 transfer the merchant now\n * has to sign from their payout wallet.\n */\nexport const refundSigningInstructionsSchema = z.object({\n token: evmAddressSchema,\n to: evmAddressSchema,\n amount: tokenAmountSchema,\n note: z.string(),\n})\nexport type RefundSigningInstructions = z.infer<typeof refundSigningInstructionsSchema>\n\nexport const refundCreateOutputSchema = z.object({\n refund: refundSchema,\n signingInstructions: refundSigningInstructionsSchema,\n})\nexport type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>\n"]}
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  /**
4
- * Refund — a merchant-initiated return of funds to a payer.
4
+ * Refund. A merchant-initiated return of funds to a payer.
5
5
  *
6
6
  * Refunds are executed off-chain (from the merchant's wallet to the payer's
7
7
  * wallet). Strimz records the intent, validates constraints, and reconciles
@@ -87,5 +87,138 @@ declare const submitRefundSignatureInputSchema: z.ZodObject<{
87
87
  refundTxHash: string;
88
88
  }>;
89
89
  type SubmitRefundSignatureInput = z.infer<typeof submitRefundSignatureInputSchema>;
90
+ /**
91
+ * Response envelope for `POST /v1/refunds`. The API returns the newly
92
+ * created refund plus the concrete ERC-20 transfer the merchant now
93
+ * has to sign from their payout wallet.
94
+ */
95
+ declare const refundSigningInstructionsSchema: z.ZodObject<{
96
+ token: z.ZodEffects<z.ZodString, string, string>;
97
+ to: z.ZodEffects<z.ZodString, string, string>;
98
+ amount: z.ZodEffects<z.ZodString, string, string>;
99
+ note: z.ZodString;
100
+ }, "strip", z.ZodTypeAny, {
101
+ amount: string;
102
+ note: string;
103
+ token: string;
104
+ to: string;
105
+ }, {
106
+ amount: string;
107
+ note: string;
108
+ token: string;
109
+ to: string;
110
+ }>;
111
+ type RefundSigningInstructions = z.infer<typeof refundSigningInstructionsSchema>;
112
+ declare const refundCreateOutputSchema: z.ZodObject<{
113
+ refund: z.ZodObject<{
114
+ id: z.ZodString;
115
+ merchantId: z.ZodString;
116
+ transactionId: z.ZodString;
117
+ amount: z.ZodEffects<z.ZodString, string, string>;
118
+ currency: z.ZodEnum<["USDC", "EURC"]>;
119
+ reason: z.ZodEnum<["customer_request", "product_issue", "duplicate_charge", "fraudulent", "other"]>;
120
+ note: z.ZodNullable<z.ZodString>;
121
+ status: z.ZodEnum<["pending", "awaiting_signature", "submitted", "completed", "failed", "cancelled"]>;
122
+ payerAddress: z.ZodEffects<z.ZodString, string, string>;
123
+ refundTxHash: z.ZodNullable<z.ZodString>;
124
+ failureReason: z.ZodNullable<z.ZodString>;
125
+ initiatedBy: z.ZodString;
126
+ createdAt: z.ZodString;
127
+ completedAt: z.ZodNullable<z.ZodString>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
130
+ id: string;
131
+ merchantId: string;
132
+ createdAt: string;
133
+ amount: string;
134
+ currency: "USDC" | "EURC";
135
+ payerAddress: string;
136
+ reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
137
+ failureReason: string | null;
138
+ transactionId: string;
139
+ note: string | null;
140
+ refundTxHash: string | null;
141
+ initiatedBy: string;
142
+ completedAt: string | null;
143
+ }, {
144
+ status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
145
+ id: string;
146
+ merchantId: string;
147
+ createdAt: string;
148
+ amount: string;
149
+ currency: "USDC" | "EURC";
150
+ payerAddress: string;
151
+ reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
152
+ failureReason: string | null;
153
+ transactionId: string;
154
+ note: string | null;
155
+ refundTxHash: string | null;
156
+ initiatedBy: string;
157
+ completedAt: string | null;
158
+ }>;
159
+ signingInstructions: z.ZodObject<{
160
+ token: z.ZodEffects<z.ZodString, string, string>;
161
+ to: z.ZodEffects<z.ZodString, string, string>;
162
+ amount: z.ZodEffects<z.ZodString, string, string>;
163
+ note: z.ZodString;
164
+ }, "strip", z.ZodTypeAny, {
165
+ amount: string;
166
+ note: string;
167
+ token: string;
168
+ to: string;
169
+ }, {
170
+ amount: string;
171
+ note: string;
172
+ token: string;
173
+ to: string;
174
+ }>;
175
+ }, "strip", z.ZodTypeAny, {
176
+ refund: {
177
+ status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
178
+ id: string;
179
+ merchantId: string;
180
+ createdAt: string;
181
+ amount: string;
182
+ currency: "USDC" | "EURC";
183
+ payerAddress: string;
184
+ reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
185
+ failureReason: string | null;
186
+ transactionId: string;
187
+ note: string | null;
188
+ refundTxHash: string | null;
189
+ initiatedBy: string;
190
+ completedAt: string | null;
191
+ };
192
+ signingInstructions: {
193
+ amount: string;
194
+ note: string;
195
+ token: string;
196
+ to: string;
197
+ };
198
+ }, {
199
+ refund: {
200
+ status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
201
+ id: string;
202
+ merchantId: string;
203
+ createdAt: string;
204
+ amount: string;
205
+ currency: "USDC" | "EURC";
206
+ payerAddress: string;
207
+ reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
208
+ failureReason: string | null;
209
+ transactionId: string;
210
+ note: string | null;
211
+ refundTxHash: string | null;
212
+ initiatedBy: string;
213
+ completedAt: string | null;
214
+ };
215
+ signingInstructions: {
216
+ amount: string;
217
+ note: string;
218
+ token: string;
219
+ to: string;
220
+ };
221
+ }>;
222
+ type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>;
90
223
 
91
- export { type CreateRefundInput, type Refund, type RefundReason, type RefundStatus, type SubmitRefundSignatureInput, createRefundInputSchema, refundReasonSchema, refundSchema, refundStatusSchema, submitRefundSignatureInputSchema };
224
+ export { type CreateRefundInput, type Refund, type RefundCreateOutput, type RefundReason, type RefundSigningInstructions, type RefundStatus, type SubmitRefundSignatureInput, createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
package/dist/refunds.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  /**
4
- * Refund — a merchant-initiated return of funds to a payer.
4
+ * Refund. A merchant-initiated return of funds to a payer.
5
5
  *
6
6
  * Refunds are executed off-chain (from the merchant's wallet to the payer's
7
7
  * wallet). Strimz records the intent, validates constraints, and reconciles
@@ -87,5 +87,138 @@ declare const submitRefundSignatureInputSchema: z.ZodObject<{
87
87
  refundTxHash: string;
88
88
  }>;
89
89
  type SubmitRefundSignatureInput = z.infer<typeof submitRefundSignatureInputSchema>;
90
+ /**
91
+ * Response envelope for `POST /v1/refunds`. The API returns the newly
92
+ * created refund plus the concrete ERC-20 transfer the merchant now
93
+ * has to sign from their payout wallet.
94
+ */
95
+ declare const refundSigningInstructionsSchema: z.ZodObject<{
96
+ token: z.ZodEffects<z.ZodString, string, string>;
97
+ to: z.ZodEffects<z.ZodString, string, string>;
98
+ amount: z.ZodEffects<z.ZodString, string, string>;
99
+ note: z.ZodString;
100
+ }, "strip", z.ZodTypeAny, {
101
+ amount: string;
102
+ note: string;
103
+ token: string;
104
+ to: string;
105
+ }, {
106
+ amount: string;
107
+ note: string;
108
+ token: string;
109
+ to: string;
110
+ }>;
111
+ type RefundSigningInstructions = z.infer<typeof refundSigningInstructionsSchema>;
112
+ declare const refundCreateOutputSchema: z.ZodObject<{
113
+ refund: z.ZodObject<{
114
+ id: z.ZodString;
115
+ merchantId: z.ZodString;
116
+ transactionId: z.ZodString;
117
+ amount: z.ZodEffects<z.ZodString, string, string>;
118
+ currency: z.ZodEnum<["USDC", "EURC"]>;
119
+ reason: z.ZodEnum<["customer_request", "product_issue", "duplicate_charge", "fraudulent", "other"]>;
120
+ note: z.ZodNullable<z.ZodString>;
121
+ status: z.ZodEnum<["pending", "awaiting_signature", "submitted", "completed", "failed", "cancelled"]>;
122
+ payerAddress: z.ZodEffects<z.ZodString, string, string>;
123
+ refundTxHash: z.ZodNullable<z.ZodString>;
124
+ failureReason: z.ZodNullable<z.ZodString>;
125
+ initiatedBy: z.ZodString;
126
+ createdAt: z.ZodString;
127
+ completedAt: z.ZodNullable<z.ZodString>;
128
+ }, "strip", z.ZodTypeAny, {
129
+ status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
130
+ id: string;
131
+ merchantId: string;
132
+ createdAt: string;
133
+ amount: string;
134
+ currency: "USDC" | "EURC";
135
+ payerAddress: string;
136
+ reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
137
+ failureReason: string | null;
138
+ transactionId: string;
139
+ note: string | null;
140
+ refundTxHash: string | null;
141
+ initiatedBy: string;
142
+ completedAt: string | null;
143
+ }, {
144
+ status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
145
+ id: string;
146
+ merchantId: string;
147
+ createdAt: string;
148
+ amount: string;
149
+ currency: "USDC" | "EURC";
150
+ payerAddress: string;
151
+ reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
152
+ failureReason: string | null;
153
+ transactionId: string;
154
+ note: string | null;
155
+ refundTxHash: string | null;
156
+ initiatedBy: string;
157
+ completedAt: string | null;
158
+ }>;
159
+ signingInstructions: z.ZodObject<{
160
+ token: z.ZodEffects<z.ZodString, string, string>;
161
+ to: z.ZodEffects<z.ZodString, string, string>;
162
+ amount: z.ZodEffects<z.ZodString, string, string>;
163
+ note: z.ZodString;
164
+ }, "strip", z.ZodTypeAny, {
165
+ amount: string;
166
+ note: string;
167
+ token: string;
168
+ to: string;
169
+ }, {
170
+ amount: string;
171
+ note: string;
172
+ token: string;
173
+ to: string;
174
+ }>;
175
+ }, "strip", z.ZodTypeAny, {
176
+ refund: {
177
+ status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
178
+ id: string;
179
+ merchantId: string;
180
+ createdAt: string;
181
+ amount: string;
182
+ currency: "USDC" | "EURC";
183
+ payerAddress: string;
184
+ reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
185
+ failureReason: string | null;
186
+ transactionId: string;
187
+ note: string | null;
188
+ refundTxHash: string | null;
189
+ initiatedBy: string;
190
+ completedAt: string | null;
191
+ };
192
+ signingInstructions: {
193
+ amount: string;
194
+ note: string;
195
+ token: string;
196
+ to: string;
197
+ };
198
+ }, {
199
+ refund: {
200
+ status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
201
+ id: string;
202
+ merchantId: string;
203
+ createdAt: string;
204
+ amount: string;
205
+ currency: "USDC" | "EURC";
206
+ payerAddress: string;
207
+ reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
208
+ failureReason: string | null;
209
+ transactionId: string;
210
+ note: string | null;
211
+ refundTxHash: string | null;
212
+ initiatedBy: string;
213
+ completedAt: string | null;
214
+ };
215
+ signingInstructions: {
216
+ amount: string;
217
+ note: string;
218
+ token: string;
219
+ to: string;
220
+ };
221
+ }>;
222
+ type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>;
90
223
 
91
- export { type CreateRefundInput, type Refund, type RefundReason, type RefundStatus, type SubmitRefundSignatureInput, createRefundInputSchema, refundReasonSchema, refundSchema, refundStatusSchema, submitRefundSignatureInputSchema };
224
+ export { type CreateRefundInput, type Refund, type RefundCreateOutput, type RefundReason, type RefundSigningInstructions, type RefundStatus, type SubmitRefundSignatureInput, createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
package/dist/refunds.js CHANGED
@@ -69,7 +69,17 @@ var submitRefundSignatureInputSchema = z.object({
69
69
  id: idSchema,
70
70
  refundTxHash: evmTxHashSchema
71
71
  });
72
+ var refundSigningInstructionsSchema = z.object({
73
+ token: evmAddressSchema,
74
+ to: evmAddressSchema,
75
+ amount: tokenAmountSchema,
76
+ note: z.string()
77
+ });
78
+ var refundCreateOutputSchema = z.object({
79
+ refund: refundSchema,
80
+ signingInstructions: refundSigningInstructionsSchema
81
+ });
72
82
 
73
- export { createRefundInputSchema, refundReasonSchema, refundSchema, refundStatusSchema, submitRefundSignatureInputSchema };
83
+ export { createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
74
84
  //# sourceMappingURL=refunds.js.map
75
85
  //# sourceMappingURL=refunds.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/common.ts","../src/refunds.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5C,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0B,CAAA,CAAE,MAAA,EAAO,CAAE,G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,WAAA,EAAa,mBAAmB,QAAA;AAClC,CAAC;AAGM,IAAM,uBAAA,GAA0BA,EAAE,MAAA,CAAO;AAAA,EAC9C,aAAA,EAAe,QAAA;AAAA,EACf,MAAA,EAAQ,iBAAA;AAAA,EACR,MAAA,EAAQ,kBAAA;AAAA,EACR,MAAMA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAC5B,CAAC;AAGM,IAAM,gCAAA,GAAmCA,EAAE,MAAA,CAAO;AAAA,EACvD,EAAA,EAAI,QAAA;AAAA,EACJ,YAAA,EAAc;AAChB,CAAC","file":"refunds.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum — mirrors `@strimz/shared-config`. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum — mirrors `@strimz/shared-config`. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Refund — a merchant-initiated return of funds to a payer.\n *\n * Refunds are executed off-chain (from the merchant's wallet to the payer's\n * wallet). Strimz records the intent, validates constraints, and reconciles\n * via the merchant-signed on-chain transfer.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const refundReasonSchema = z.enum([\n 'customer_request',\n 'product_issue',\n 'duplicate_charge',\n 'fraudulent',\n 'other',\n])\nexport type RefundReason = z.infer<typeof refundReasonSchema>\n\nexport const refundStatusSchema = z.enum([\n 'pending',\n 'awaiting_signature',\n 'submitted',\n 'completed',\n 'failed',\n 'cancelled',\n])\nexport type RefundStatus = z.infer<typeof refundStatusSchema>\n\nexport const refundSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n transactionId: idSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n reason: refundReasonSchema,\n note: z.string().max(500).nullable(),\n status: refundStatusSchema,\n payerAddress: evmAddressSchema,\n refundTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n initiatedBy: idSchema,\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type Refund = z.infer<typeof refundSchema>\n\nexport const createRefundInputSchema = z.object({\n transactionId: idSchema,\n amount: tokenAmountSchema,\n reason: refundReasonSchema,\n note: z.string().max(500).optional(),\n})\nexport type CreateRefundInput = z.infer<typeof createRefundInputSchema>\n\nexport const submitRefundSignatureInputSchema = z.object({\n id: idSchema,\n refundTxHash: evmTxHashSchema,\n})\nexport type SubmitRefundSignatureInput = z.infer<typeof submitRefundSignatureInputSchema>\n"]}
1
+ {"version":3,"sources":["../src/common.ts","../src/refunds.ts"],"names":["z"],"mappings":";;;AAQO,IAAM,QAAA,GAAW,CAAA,CACrB,MAAA,EAAO,CACP,GAAA,CAAI,CAAC,CAAA,CACL,GAAA,CAAI,EAAE,CAAA,CACN,KAAA,CAAM,kBAAA,EAAoB,qBAAqB,CAAA;AAG3C,IAAM,gBAAA,GAAmB,CAAA,CAC7B,MAAA,EAAO,CACP,KAAA,CAAM,qBAAA,EAAuB,oDAAoD,CAAA,CACjF,SAAA,CAAU,CAAC,CAAA,KAAM,CAAA,CAAE,aAAa,CAAA;AAG5B,IAAM,kBAAkB,CAAA,CAC5B,MAAA,EAAO,CACP,KAAA,CAAM,uBAAuB,6DAA6D,CAAA;AAGlE,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM,CAAE,IAAA,EAAK,CAAE,WAAA,EAAY,CAAE,GAAA,CAAI,GAAG;AAG5C,CAAA,CAC3B,MAAA,EAAO,CACP,GAAA,EAAI,CACJ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,UAAA,CAAW,UAAU,CAAA,EAAG;AAAA,EACvC,OAAA,EAAS;AACX,CAAC;AAG0B,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA;AAOjC,IAAM,iBAAA,GAAoB,CAAA,CAC9B,MAAA,EAAO,CACP,MAAM,UAAA,EAAY,iDAAiD,CAAA,CACnE,MAAA,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,IAAI,cAAc,CAAA;AAGtB,CAAA,CAAE,MAAA,EAAO,CAAE,GAAA,EAAI,CAAE,GAAA,CAAI,CAAC,CAAA,CAAE,GAAA,CAAI,MAAA,CAAO,gBAAgB;AAGtE,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,CAAO;AAAA,EACvD,EAAA,EAAI,QAAA;AAAA,EACJ,YAAA,EAAc;AAChB,CAAC;AAQM,IAAM,+BAAA,GAAkCA,EAAE,MAAA,CAAO;AAAA,EACtD,KAAA,EAAO,gBAAA;AAAA,EACP,EAAA,EAAI,gBAAA;AAAA,EACJ,MAAA,EAAQ,iBAAA;AAAA,EACR,IAAA,EAAMA,EAAE,MAAA;AACV,CAAC;AAGM,IAAM,wBAAA,GAA2BA,EAAE,MAAA,CAAO;AAAA,EAC/C,MAAA,EAAQ,YAAA;AAAA,EACR,mBAAA,EAAqB;AACvB,CAAC","file":"refunds.js","sourcesContent":["/**\n * Primitive schemas shared across every entity.\n * Every higher-level schema builds on these so validation is consistent.\n */\n\nimport { z } from 'zod'\n\n/** CUID2 or UUID-style opaque identifier. */\nexport const idSchema = z\n .string()\n .min(1)\n .max(64)\n .regex(/^[a-zA-Z0-9_-]+$/, 'id must be URL-safe')\n\n/** EVM address. Hex-encoded, 0x-prefixed, 20 bytes. Normalised to lowercase. */\nexport const evmAddressSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 0x-prefixed 40-character hex EVM address')\n .transform((v) => v.toLowerCase())\n\n/** EVM transaction hash. 32-byte hex. */\nexport const evmTxHashSchema = z\n .string()\n .regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 0x-prefixed 64-character hex EVM transaction hash')\n\n/** Email address, trimmed and lower-cased. */\nexport const emailSchema = z.string().email().trim().toLowerCase().max(320)\n\n/** HTTPS URL. No http:// allowed outside dev. */\nexport const httpsUrlSchema = z\n .string()\n .url()\n .refine((v) => v.startsWith('https://'), {\n message: 'must be an https:// URL',\n })\n\n/** URL permitting http and https (dev + prod). */\nexport const httpUrlSchema = z.string().url()\n\n/**\n * Amount expressed in the token's smallest unit, serialised as a string to\n * preserve precision beyond `Number.MAX_SAFE_INTEGER`. For USDC (6 decimals),\n * 1 USDC is the string \"1000000\".\n */\nexport const tokenAmountSchema = z\n .string()\n .regex(/^[0-9]+$/, 'must be a non-negative integer string (base-10)')\n .refine((v) => BigInt(v) >= 0n, 'must be >= 0')\n\n/** Unsigned integer up to 2^53 - 1; validated and returned as number. */\nexport const uintSchema = z.number().int().min(0).max(Number.MAX_SAFE_INTEGER)\n\n/** ISO-8601 timestamp string (`.toISOString()`-compatible). */\nexport const isoTimestampSchema = z\n .string()\n .datetime({ offset: true, message: 'must be an ISO-8601 timestamp' })\n\n/** Two-letter ISO-3166 country code. */\nexport const countryCodeSchema = z\n .string()\n .length(2)\n .regex(/^[A-Z]{2}$/, 'must be an ISO-3166 alpha-2 country code')\n\n/** Pagination inputs used by every list endpoint. */\nexport const paginationInputSchema = z.object({\n limit: z.number().int().min(1).max(100).default(25),\n cursor: z.string().min(1).max(200).nullish(),\n})\nexport type PaginationInput = z.infer<typeof paginationInputSchema>\n\n/** Pagination envelope used by every list response. */\nexport const makePaginatedSchema = <T extends z.ZodTypeAny>(item: T) =>\n z.object({\n data: z.array(item),\n nextCursor: z.string().nullable(),\n hasMore: z.boolean(),\n })\n\n/** Free-form metadata bag the API round-trips for merchants. */\nexport const metadataSchema = z\n .record(\n z.string().min(1).max(40),\n z.union([z.string().max(500), z.number(), z.boolean(), z.null()]),\n )\n .refine((m) => Object.keys(m).length <= 50, 'at most 50 metadata keys')\n .default({})\n\n/** Environment mode carried on every mode-scoped resource. */\nexport const modeSchema = z.enum(['test', 'live'])\nexport type Mode = z.infer<typeof modeSchema>\n\n/** Payment token enum. */\nexport const paymentCurrencySchema = z.enum(['USDC', 'EURC'])\nexport type PaymentCurrency = z.infer<typeof paymentCurrencySchema>\n\n/** Every display-level currency (payment + treasury). */\nexport const tokenSymbolSchema = z.enum(['USDC', 'EURC', 'USYC'])\nexport type TokenSymbol = z.infer<typeof tokenSymbolSchema>\n\n/** Merchant tier enum. */\nexport const merchantTierSchema = z.enum(['free', 'growth', 'business', 'enterprise'])\nexport type MerchantTier = z.infer<typeof merchantTierSchema>\n\n/** Arc environment enum. */\nexport const arcEnvironmentSchema = z.enum(['testnet', 'mainnet'])\nexport type ArcEnvironment = z.infer<typeof arcEnvironmentSchema>\n\nexport type Id = z.infer<typeof idSchema>\nexport type EvmAddress = z.infer<typeof evmAddressSchema>\nexport type EvmTxHash = z.infer<typeof evmTxHashSchema>\nexport type TokenAmount = z.infer<typeof tokenAmountSchema>\nexport type IsoTimestamp = z.infer<typeof isoTimestampSchema>\nexport type Metadata = z.infer<typeof metadataSchema>\n","/**\n * Refund. A merchant-initiated return of funds to a payer.\n *\n * Refunds are executed off-chain (from the merchant's wallet to the payer's\n * wallet). Strimz records the intent, validates constraints, and reconciles\n * via the merchant-signed on-chain transfer.\n */\n\nimport { z } from 'zod'\nimport {\n evmAddressSchema,\n evmTxHashSchema,\n idSchema,\n isoTimestampSchema,\n paymentCurrencySchema,\n tokenAmountSchema,\n} from './common.js'\n\nexport const refundReasonSchema = z.enum([\n 'customer_request',\n 'product_issue',\n 'duplicate_charge',\n 'fraudulent',\n 'other',\n])\nexport type RefundReason = z.infer<typeof refundReasonSchema>\n\nexport const refundStatusSchema = z.enum([\n 'pending',\n 'awaiting_signature',\n 'submitted',\n 'completed',\n 'failed',\n 'cancelled',\n])\nexport type RefundStatus = z.infer<typeof refundStatusSchema>\n\nexport const refundSchema = z.object({\n id: idSchema,\n merchantId: idSchema,\n transactionId: idSchema,\n amount: tokenAmountSchema,\n currency: paymentCurrencySchema,\n reason: refundReasonSchema,\n note: z.string().max(500).nullable(),\n status: refundStatusSchema,\n payerAddress: evmAddressSchema,\n refundTxHash: evmTxHashSchema.nullable(),\n failureReason: z.string().max(500).nullable(),\n initiatedBy: idSchema,\n createdAt: isoTimestampSchema,\n completedAt: isoTimestampSchema.nullable(),\n})\nexport type Refund = z.infer<typeof refundSchema>\n\nexport const createRefundInputSchema = z.object({\n transactionId: idSchema,\n amount: tokenAmountSchema,\n reason: refundReasonSchema,\n note: z.string().max(500).optional(),\n})\nexport type CreateRefundInput = z.infer<typeof createRefundInputSchema>\n\nexport const submitRefundSignatureInputSchema = z.object({\n id: idSchema,\n refundTxHash: evmTxHashSchema,\n})\nexport type SubmitRefundSignatureInput = z.infer<typeof submitRefundSignatureInputSchema>\n\n/**\n * Response envelope for `POST /v1/refunds`. The API returns the newly\n * created refund plus the concrete ERC-20 transfer the merchant now\n * has to sign from their payout wallet.\n */\nexport const refundSigningInstructionsSchema = z.object({\n token: evmAddressSchema,\n to: evmAddressSchema,\n amount: tokenAmountSchema,\n note: z.string(),\n})\nexport type RefundSigningInstructions = z.infer<typeof refundSigningInstructionsSchema>\n\nexport const refundCreateOutputSchema = z.object({\n refund: refundSchema,\n signingInstructions: refundSigningInstructionsSchema,\n})\nexport type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>\n"]}
@@ -42,12 +42,12 @@ zod.z.object({
42
42
  /**
43
43
  * On-chain StrimzRegistry merchant id (uint96) as a decimal string.
44
44
  * See `paymentSessionSchema.chainMerchantId`. Null when the merchant
45
- * hasn't been registered on-chain yet — the hosted enrolment page
45
+ * hasn't been registered on-chain yet. The hosted enrolment page
46
46
  * refuses to take signatures in that state.
47
47
  */
48
48
  chainMerchantId: zod.z.string().regex(/^[0-9]+$/u, "must be a non-negative decimal integer string").nullable(),
49
49
  /**
50
- * ERC-20 token contract address resolved from `currency` — the
50
+ * ERC-20 token contract address resolved from `currency`. This is the
51
51
  * EIP-2612 `verifyingContract` the wallet signs over.
52
52
  */
53
53
  tokenAddress: evmAddressSchema.nullable(),
@@ -212,9 +212,23 @@ var createStorefrontProductInputSchema = storefrontProductSchema.omit({
212
212
  }).extend({
213
213
  imageUrl: httpsUrlSchema.optional()
214
214
  });
215
+ var storefrontCheckoutInputSchema = zod.z.object({
216
+ customerEmail: zod.z.string().email().optional(),
217
+ returnPath: zod.z.string().max(200).optional()
218
+ });
219
+ var storefrontCheckoutResponseSchema = zod.z.object({
220
+ /** Fully-qualified checkout URL — payer redirects here to sign. */
221
+ checkoutUrl: zod.z.string().url(),
222
+ /** Payment-session id (one-time) or plan id (subscription). */
223
+ ref: idSchema,
224
+ /** Which downstream checkout the URL points at. */
225
+ kind: zod.z.enum(["payment_session", "subscription_plan"])
226
+ });
215
227
 
216
228
  exports.createStorefrontInputSchema = createStorefrontInputSchema;
217
229
  exports.createStorefrontProductInputSchema = createStorefrontProductInputSchema;
230
+ exports.storefrontCheckoutInputSchema = storefrontCheckoutInputSchema;
231
+ exports.storefrontCheckoutResponseSchema = storefrontCheckoutResponseSchema;
218
232
  exports.storefrontProductSchema = storefrontProductSchema;
219
233
  exports.storefrontProductTypeSchema = storefrontProductTypeSchema;
220
234
  exports.storefrontSchema = storefrontSchema;