@strimz/shared-types 0.6.0 → 0.8.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.
- package/README.md +7 -4
- package/dist/agents.cjs.map +1 -1
- package/dist/agents.d.cts +7 -5
- package/dist/agents.d.ts +7 -5
- package/dist/agents.js.map +1 -1
- package/dist/analytics.cjs +568 -0
- package/dist/analytics.cjs.map +1 -0
- package/dist/analytics.d.cts +1719 -0
- package/dist/analytics.d.ts +1719 -0
- package/dist/analytics.js +540 -0
- package/dist/analytics.js.map +1 -0
- package/dist/api-keys.cjs.map +1 -1
- package/dist/api-keys.d.cts +19 -17
- package/dist/api-keys.d.ts +19 -17
- package/dist/api-keys.js.map +1 -1
- package/dist/common.cjs.map +1 -1
- package/dist/common.d.cts +3 -2
- package/dist/common.d.ts +3 -2
- package/dist/common.js.map +1 -1
- package/dist/compliance.cjs.map +1 -1
- package/dist/compliance.d.cts +8 -8
- package/dist/compliance.d.ts +8 -8
- package/dist/compliance.js.map +1 -1
- package/dist/customers.cjs.map +1 -1
- package/dist/customers.d.cts +10 -9
- package/dist/customers.d.ts +10 -9
- package/dist/customers.js.map +1 -1
- package/dist/events.cjs.map +1 -1
- package/dist/events.d.cts +1936 -1936
- package/dist/events.d.ts +1936 -1936
- package/dist/events.js.map +1 -1
- package/dist/index.cjs +216 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -22
- package/dist/index.d.ts +25 -22
- package/dist/index.js +190 -1
- package/dist/index.js.map +1 -1
- package/dist/invoices.cjs.map +1 -1
- package/dist/invoices.d.cts +19 -18
- package/dist/invoices.d.ts +19 -18
- package/dist/invoices.js.map +1 -1
- package/dist/merchants.cjs.map +1 -1
- package/dist/merchants.d.cts +42 -36
- package/dist/merchants.d.ts +42 -36
- package/dist/merchants.js.map +1 -1
- package/dist/payment-sessions.cjs.map +1 -1
- package/dist/payment-sessions.d.cts +24 -22
- package/dist/payment-sessions.d.ts +24 -22
- package/dist/payment-sessions.js.map +1 -1
- package/dist/refunds.cjs.map +1 -1
- package/dist/refunds.d.cts +55 -53
- package/dist/refunds.d.ts +55 -53
- package/dist/refunds.js.map +1 -1
- package/dist/storefronts.cjs.map +1 -1
- package/dist/storefronts.d.cts +31 -28
- package/dist/storefronts.d.ts +31 -28
- package/dist/storefronts.js.map +1 -1
- package/dist/subscriptions.cjs.map +1 -1
- package/dist/subscriptions.d.cts +49 -46
- package/dist/subscriptions.d.ts +49 -46
- package/dist/subscriptions.js.map +1 -1
- package/dist/transactions.cjs.map +1 -1
- package/dist/transactions.d.cts +14 -14
- package/dist/transactions.d.ts +14 -14
- package/dist/transactions.js.map +1 -1
- package/dist/webhooks.cjs.map +1 -1
- package/dist/webhooks.d.cts +33 -31
- package/dist/webhooks.d.ts +33 -31
- package/dist/webhooks.js.map +1 -1
- package/package.json +6 -1
- package/src/agents.ts +4 -2
- package/src/analytics.ts +275 -0
- package/src/api-keys.ts +4 -2
- package/src/common.ts +2 -1
- package/src/contact.ts +2 -1
- package/src/customers.ts +2 -1
- package/src/index.ts +1 -0
- package/src/invoices.ts +2 -1
- package/src/merchants.ts +12 -6
- package/src/notifications.ts +2 -1
- package/src/payment-sessions.ts +4 -2
- package/src/refunds.ts +4 -2
- package/src/storefronts.ts +6 -3
- package/src/subscriptions.ts +6 -3
- package/src/webhooks.ts +4 -2
|
@@ -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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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"]}
|
|
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,CAAO,CAAC,CAAA,KAAM,MAAA,CAAO,CAAC,CAAA,IAAK,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,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;AAIM,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.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<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.input<typeof createPaymentSessionInputSchema>\nexport type CreatePaymentSessionParsed = z.output<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.input<typeof submitPaymentSessionInputSchema>\nexport type SubmitPaymentSessionParsed = z.output<typeof submitPaymentSessionInputSchema>\n"]}
|
package/dist/refunds.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/common.ts","../src/refunds.ts"],"names":["z"],"mappings":";;;;;AAQO,IAAM,QAAA,GAAWA,KAAA,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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
|
+
{"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,MAA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,EACR,MAAMA,KAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA;AAC5B,CAAC;AAIM,IAAM,gCAAA,GAAmCA,MAAE,MAAA,CAAO;AAAA,EACvD,EAAA,EAAI,QAAA;AAAA,EACJ,YAAA,EAAc;AAChB,CAAC;AASM,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.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<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.input<typeof createRefundInputSchema>\nexport type CreateRefundParsed = z.output<typeof createRefundInputSchema>\n\nexport const submitRefundSignatureInputSchema = z.object({\n id: idSchema,\n refundTxHash: evmTxHashSchema,\n})\nexport type SubmitRefundSignatureInput = z.input<typeof submitRefundSignatureInputSchema>\nexport type SubmitRefundSignatureParsed = z.output<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"]}
|
package/dist/refunds.d.cts
CHANGED
|
@@ -29,32 +29,32 @@ declare const refundSchema: z.ZodObject<{
|
|
|
29
29
|
completedAt: z.ZodNullable<z.ZodString>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
32
|
-
id: string;
|
|
33
|
-
merchantId: string;
|
|
34
|
-
createdAt: string;
|
|
35
32
|
amount: string;
|
|
36
33
|
currency: "USDC" | "EURC";
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
failureReason: string | null;
|
|
40
|
-
transactionId: string;
|
|
34
|
+
merchantId: string;
|
|
35
|
+
id: string;
|
|
41
36
|
note: string | null;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
transactionId: string;
|
|
39
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
40
|
+
payerAddress: string;
|
|
42
41
|
refundTxHash: string | null;
|
|
42
|
+
failureReason: string | null;
|
|
43
43
|
initiatedBy: string;
|
|
44
44
|
completedAt: string | null;
|
|
45
45
|
}, {
|
|
46
46
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
47
|
-
id: string;
|
|
48
|
-
merchantId: string;
|
|
49
|
-
createdAt: string;
|
|
50
47
|
amount: string;
|
|
51
48
|
currency: "USDC" | "EURC";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
failureReason: string | null;
|
|
55
|
-
transactionId: string;
|
|
49
|
+
merchantId: string;
|
|
50
|
+
id: string;
|
|
56
51
|
note: string | null;
|
|
52
|
+
createdAt: string;
|
|
53
|
+
transactionId: string;
|
|
54
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
55
|
+
payerAddress: string;
|
|
57
56
|
refundTxHash: string | null;
|
|
57
|
+
failureReason: string | null;
|
|
58
58
|
initiatedBy: string;
|
|
59
59
|
completedAt: string | null;
|
|
60
60
|
}>;
|
|
@@ -66,16 +66,17 @@ declare const createRefundInputSchema: z.ZodObject<{
|
|
|
66
66
|
note: z.ZodOptional<z.ZodString>;
|
|
67
67
|
}, "strip", z.ZodTypeAny, {
|
|
68
68
|
amount: string;
|
|
69
|
-
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
70
69
|
transactionId: string;
|
|
70
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
71
71
|
note?: string | undefined;
|
|
72
72
|
}, {
|
|
73
73
|
amount: string;
|
|
74
|
-
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
75
74
|
transactionId: string;
|
|
75
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
76
76
|
note?: string | undefined;
|
|
77
77
|
}>;
|
|
78
|
-
type CreateRefundInput = z.
|
|
78
|
+
type CreateRefundInput = z.input<typeof createRefundInputSchema>;
|
|
79
|
+
type CreateRefundParsed = z.output<typeof createRefundInputSchema>;
|
|
79
80
|
declare const submitRefundSignatureInputSchema: z.ZodObject<{
|
|
80
81
|
id: z.ZodString;
|
|
81
82
|
refundTxHash: z.ZodString;
|
|
@@ -86,7 +87,8 @@ declare const submitRefundSignatureInputSchema: z.ZodObject<{
|
|
|
86
87
|
id: string;
|
|
87
88
|
refundTxHash: string;
|
|
88
89
|
}>;
|
|
89
|
-
type SubmitRefundSignatureInput = z.
|
|
90
|
+
type SubmitRefundSignatureInput = z.input<typeof submitRefundSignatureInputSchema>;
|
|
91
|
+
type SubmitRefundSignatureParsed = z.output<typeof submitRefundSignatureInputSchema>;
|
|
90
92
|
/**
|
|
91
93
|
* Response envelope for `POST /v1/refunds`. The API returns the newly
|
|
92
94
|
* created refund plus the concrete ERC-20 transfer the merchant now
|
|
@@ -99,14 +101,14 @@ declare const refundSigningInstructionsSchema: z.ZodObject<{
|
|
|
99
101
|
note: z.ZodString;
|
|
100
102
|
}, "strip", z.ZodTypeAny, {
|
|
101
103
|
amount: string;
|
|
104
|
+
to: string;
|
|
102
105
|
note: string;
|
|
103
106
|
token: string;
|
|
104
|
-
to: string;
|
|
105
107
|
}, {
|
|
106
108
|
amount: string;
|
|
109
|
+
to: string;
|
|
107
110
|
note: string;
|
|
108
111
|
token: string;
|
|
109
|
-
to: string;
|
|
110
112
|
}>;
|
|
111
113
|
type RefundSigningInstructions = z.infer<typeof refundSigningInstructionsSchema>;
|
|
112
114
|
declare const refundCreateOutputSchema: z.ZodObject<{
|
|
@@ -127,32 +129,32 @@ declare const refundCreateOutputSchema: z.ZodObject<{
|
|
|
127
129
|
completedAt: z.ZodNullable<z.ZodString>;
|
|
128
130
|
}, "strip", z.ZodTypeAny, {
|
|
129
131
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
130
|
-
id: string;
|
|
131
|
-
merchantId: string;
|
|
132
|
-
createdAt: string;
|
|
133
132
|
amount: string;
|
|
134
133
|
currency: "USDC" | "EURC";
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
failureReason: string | null;
|
|
138
|
-
transactionId: string;
|
|
134
|
+
merchantId: string;
|
|
135
|
+
id: string;
|
|
139
136
|
note: string | null;
|
|
137
|
+
createdAt: string;
|
|
138
|
+
transactionId: string;
|
|
139
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
140
|
+
payerAddress: string;
|
|
140
141
|
refundTxHash: string | null;
|
|
142
|
+
failureReason: string | null;
|
|
141
143
|
initiatedBy: string;
|
|
142
144
|
completedAt: string | null;
|
|
143
145
|
}, {
|
|
144
146
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
145
|
-
id: string;
|
|
146
|
-
merchantId: string;
|
|
147
|
-
createdAt: string;
|
|
148
147
|
amount: string;
|
|
149
148
|
currency: "USDC" | "EURC";
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
failureReason: string | null;
|
|
153
|
-
transactionId: string;
|
|
149
|
+
merchantId: string;
|
|
150
|
+
id: string;
|
|
154
151
|
note: string | null;
|
|
152
|
+
createdAt: string;
|
|
153
|
+
transactionId: string;
|
|
154
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
155
|
+
payerAddress: string;
|
|
155
156
|
refundTxHash: string | null;
|
|
157
|
+
failureReason: string | null;
|
|
156
158
|
initiatedBy: string;
|
|
157
159
|
completedAt: string | null;
|
|
158
160
|
}>;
|
|
@@ -163,62 +165,62 @@ declare const refundCreateOutputSchema: z.ZodObject<{
|
|
|
163
165
|
note: z.ZodString;
|
|
164
166
|
}, "strip", z.ZodTypeAny, {
|
|
165
167
|
amount: string;
|
|
168
|
+
to: string;
|
|
166
169
|
note: string;
|
|
167
170
|
token: string;
|
|
168
|
-
to: string;
|
|
169
171
|
}, {
|
|
170
172
|
amount: string;
|
|
173
|
+
to: string;
|
|
171
174
|
note: string;
|
|
172
175
|
token: string;
|
|
173
|
-
to: string;
|
|
174
176
|
}>;
|
|
175
177
|
}, "strip", z.ZodTypeAny, {
|
|
176
178
|
refund: {
|
|
177
179
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
178
|
-
id: string;
|
|
179
|
-
merchantId: string;
|
|
180
|
-
createdAt: string;
|
|
181
180
|
amount: string;
|
|
182
181
|
currency: "USDC" | "EURC";
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
failureReason: string | null;
|
|
186
|
-
transactionId: string;
|
|
182
|
+
merchantId: string;
|
|
183
|
+
id: string;
|
|
187
184
|
note: string | null;
|
|
185
|
+
createdAt: string;
|
|
186
|
+
transactionId: string;
|
|
187
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
188
|
+
payerAddress: string;
|
|
188
189
|
refundTxHash: string | null;
|
|
190
|
+
failureReason: string | null;
|
|
189
191
|
initiatedBy: string;
|
|
190
192
|
completedAt: string | null;
|
|
191
193
|
};
|
|
192
194
|
signingInstructions: {
|
|
193
195
|
amount: string;
|
|
196
|
+
to: string;
|
|
194
197
|
note: string;
|
|
195
198
|
token: string;
|
|
196
|
-
to: string;
|
|
197
199
|
};
|
|
198
200
|
}, {
|
|
199
201
|
refund: {
|
|
200
202
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
201
|
-
id: string;
|
|
202
|
-
merchantId: string;
|
|
203
|
-
createdAt: string;
|
|
204
203
|
amount: string;
|
|
205
204
|
currency: "USDC" | "EURC";
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
failureReason: string | null;
|
|
209
|
-
transactionId: string;
|
|
205
|
+
merchantId: string;
|
|
206
|
+
id: string;
|
|
210
207
|
note: string | null;
|
|
208
|
+
createdAt: string;
|
|
209
|
+
transactionId: string;
|
|
210
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
211
|
+
payerAddress: string;
|
|
211
212
|
refundTxHash: string | null;
|
|
213
|
+
failureReason: string | null;
|
|
212
214
|
initiatedBy: string;
|
|
213
215
|
completedAt: string | null;
|
|
214
216
|
};
|
|
215
217
|
signingInstructions: {
|
|
216
218
|
amount: string;
|
|
219
|
+
to: string;
|
|
217
220
|
note: string;
|
|
218
221
|
token: string;
|
|
219
|
-
to: string;
|
|
220
222
|
};
|
|
221
223
|
}>;
|
|
222
224
|
type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>;
|
|
223
225
|
|
|
224
|
-
export { type CreateRefundInput, type Refund, type RefundCreateOutput, type RefundReason, type RefundSigningInstructions, type RefundStatus, type SubmitRefundSignatureInput, createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
|
|
226
|
+
export { type CreateRefundInput, type CreateRefundParsed, type Refund, type RefundCreateOutput, type RefundReason, type RefundSigningInstructions, type RefundStatus, type SubmitRefundSignatureInput, type SubmitRefundSignatureParsed, createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
|
package/dist/refunds.d.ts
CHANGED
|
@@ -29,32 +29,32 @@ declare const refundSchema: z.ZodObject<{
|
|
|
29
29
|
completedAt: z.ZodNullable<z.ZodString>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
31
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
32
|
-
id: string;
|
|
33
|
-
merchantId: string;
|
|
34
|
-
createdAt: string;
|
|
35
32
|
amount: string;
|
|
36
33
|
currency: "USDC" | "EURC";
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
failureReason: string | null;
|
|
40
|
-
transactionId: string;
|
|
34
|
+
merchantId: string;
|
|
35
|
+
id: string;
|
|
41
36
|
note: string | null;
|
|
37
|
+
createdAt: string;
|
|
38
|
+
transactionId: string;
|
|
39
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
40
|
+
payerAddress: string;
|
|
42
41
|
refundTxHash: string | null;
|
|
42
|
+
failureReason: string | null;
|
|
43
43
|
initiatedBy: string;
|
|
44
44
|
completedAt: string | null;
|
|
45
45
|
}, {
|
|
46
46
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
47
|
-
id: string;
|
|
48
|
-
merchantId: string;
|
|
49
|
-
createdAt: string;
|
|
50
47
|
amount: string;
|
|
51
48
|
currency: "USDC" | "EURC";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
failureReason: string | null;
|
|
55
|
-
transactionId: string;
|
|
49
|
+
merchantId: string;
|
|
50
|
+
id: string;
|
|
56
51
|
note: string | null;
|
|
52
|
+
createdAt: string;
|
|
53
|
+
transactionId: string;
|
|
54
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
55
|
+
payerAddress: string;
|
|
57
56
|
refundTxHash: string | null;
|
|
57
|
+
failureReason: string | null;
|
|
58
58
|
initiatedBy: string;
|
|
59
59
|
completedAt: string | null;
|
|
60
60
|
}>;
|
|
@@ -66,16 +66,17 @@ declare const createRefundInputSchema: z.ZodObject<{
|
|
|
66
66
|
note: z.ZodOptional<z.ZodString>;
|
|
67
67
|
}, "strip", z.ZodTypeAny, {
|
|
68
68
|
amount: string;
|
|
69
|
-
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
70
69
|
transactionId: string;
|
|
70
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
71
71
|
note?: string | undefined;
|
|
72
72
|
}, {
|
|
73
73
|
amount: string;
|
|
74
|
-
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
75
74
|
transactionId: string;
|
|
75
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
76
76
|
note?: string | undefined;
|
|
77
77
|
}>;
|
|
78
|
-
type CreateRefundInput = z.
|
|
78
|
+
type CreateRefundInput = z.input<typeof createRefundInputSchema>;
|
|
79
|
+
type CreateRefundParsed = z.output<typeof createRefundInputSchema>;
|
|
79
80
|
declare const submitRefundSignatureInputSchema: z.ZodObject<{
|
|
80
81
|
id: z.ZodString;
|
|
81
82
|
refundTxHash: z.ZodString;
|
|
@@ -86,7 +87,8 @@ declare const submitRefundSignatureInputSchema: z.ZodObject<{
|
|
|
86
87
|
id: string;
|
|
87
88
|
refundTxHash: string;
|
|
88
89
|
}>;
|
|
89
|
-
type SubmitRefundSignatureInput = z.
|
|
90
|
+
type SubmitRefundSignatureInput = z.input<typeof submitRefundSignatureInputSchema>;
|
|
91
|
+
type SubmitRefundSignatureParsed = z.output<typeof submitRefundSignatureInputSchema>;
|
|
90
92
|
/**
|
|
91
93
|
* Response envelope for `POST /v1/refunds`. The API returns the newly
|
|
92
94
|
* created refund plus the concrete ERC-20 transfer the merchant now
|
|
@@ -99,14 +101,14 @@ declare const refundSigningInstructionsSchema: z.ZodObject<{
|
|
|
99
101
|
note: z.ZodString;
|
|
100
102
|
}, "strip", z.ZodTypeAny, {
|
|
101
103
|
amount: string;
|
|
104
|
+
to: string;
|
|
102
105
|
note: string;
|
|
103
106
|
token: string;
|
|
104
|
-
to: string;
|
|
105
107
|
}, {
|
|
106
108
|
amount: string;
|
|
109
|
+
to: string;
|
|
107
110
|
note: string;
|
|
108
111
|
token: string;
|
|
109
|
-
to: string;
|
|
110
112
|
}>;
|
|
111
113
|
type RefundSigningInstructions = z.infer<typeof refundSigningInstructionsSchema>;
|
|
112
114
|
declare const refundCreateOutputSchema: z.ZodObject<{
|
|
@@ -127,32 +129,32 @@ declare const refundCreateOutputSchema: z.ZodObject<{
|
|
|
127
129
|
completedAt: z.ZodNullable<z.ZodString>;
|
|
128
130
|
}, "strip", z.ZodTypeAny, {
|
|
129
131
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
130
|
-
id: string;
|
|
131
|
-
merchantId: string;
|
|
132
|
-
createdAt: string;
|
|
133
132
|
amount: string;
|
|
134
133
|
currency: "USDC" | "EURC";
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
failureReason: string | null;
|
|
138
|
-
transactionId: string;
|
|
134
|
+
merchantId: string;
|
|
135
|
+
id: string;
|
|
139
136
|
note: string | null;
|
|
137
|
+
createdAt: string;
|
|
138
|
+
transactionId: string;
|
|
139
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
140
|
+
payerAddress: string;
|
|
140
141
|
refundTxHash: string | null;
|
|
142
|
+
failureReason: string | null;
|
|
141
143
|
initiatedBy: string;
|
|
142
144
|
completedAt: string | null;
|
|
143
145
|
}, {
|
|
144
146
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
145
|
-
id: string;
|
|
146
|
-
merchantId: string;
|
|
147
|
-
createdAt: string;
|
|
148
147
|
amount: string;
|
|
149
148
|
currency: "USDC" | "EURC";
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
failureReason: string | null;
|
|
153
|
-
transactionId: string;
|
|
149
|
+
merchantId: string;
|
|
150
|
+
id: string;
|
|
154
151
|
note: string | null;
|
|
152
|
+
createdAt: string;
|
|
153
|
+
transactionId: string;
|
|
154
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
155
|
+
payerAddress: string;
|
|
155
156
|
refundTxHash: string | null;
|
|
157
|
+
failureReason: string | null;
|
|
156
158
|
initiatedBy: string;
|
|
157
159
|
completedAt: string | null;
|
|
158
160
|
}>;
|
|
@@ -163,62 +165,62 @@ declare const refundCreateOutputSchema: z.ZodObject<{
|
|
|
163
165
|
note: z.ZodString;
|
|
164
166
|
}, "strip", z.ZodTypeAny, {
|
|
165
167
|
amount: string;
|
|
168
|
+
to: string;
|
|
166
169
|
note: string;
|
|
167
170
|
token: string;
|
|
168
|
-
to: string;
|
|
169
171
|
}, {
|
|
170
172
|
amount: string;
|
|
173
|
+
to: string;
|
|
171
174
|
note: string;
|
|
172
175
|
token: string;
|
|
173
|
-
to: string;
|
|
174
176
|
}>;
|
|
175
177
|
}, "strip", z.ZodTypeAny, {
|
|
176
178
|
refund: {
|
|
177
179
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
178
|
-
id: string;
|
|
179
|
-
merchantId: string;
|
|
180
|
-
createdAt: string;
|
|
181
180
|
amount: string;
|
|
182
181
|
currency: "USDC" | "EURC";
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
failureReason: string | null;
|
|
186
|
-
transactionId: string;
|
|
182
|
+
merchantId: string;
|
|
183
|
+
id: string;
|
|
187
184
|
note: string | null;
|
|
185
|
+
createdAt: string;
|
|
186
|
+
transactionId: string;
|
|
187
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
188
|
+
payerAddress: string;
|
|
188
189
|
refundTxHash: string | null;
|
|
190
|
+
failureReason: string | null;
|
|
189
191
|
initiatedBy: string;
|
|
190
192
|
completedAt: string | null;
|
|
191
193
|
};
|
|
192
194
|
signingInstructions: {
|
|
193
195
|
amount: string;
|
|
196
|
+
to: string;
|
|
194
197
|
note: string;
|
|
195
198
|
token: string;
|
|
196
|
-
to: string;
|
|
197
199
|
};
|
|
198
200
|
}, {
|
|
199
201
|
refund: {
|
|
200
202
|
status: "submitted" | "failed" | "cancelled" | "pending" | "awaiting_signature" | "completed";
|
|
201
|
-
id: string;
|
|
202
|
-
merchantId: string;
|
|
203
|
-
createdAt: string;
|
|
204
203
|
amount: string;
|
|
205
204
|
currency: "USDC" | "EURC";
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
failureReason: string | null;
|
|
209
|
-
transactionId: string;
|
|
205
|
+
merchantId: string;
|
|
206
|
+
id: string;
|
|
210
207
|
note: string | null;
|
|
208
|
+
createdAt: string;
|
|
209
|
+
transactionId: string;
|
|
210
|
+
reason: "customer_request" | "product_issue" | "duplicate_charge" | "fraudulent" | "other";
|
|
211
|
+
payerAddress: string;
|
|
211
212
|
refundTxHash: string | null;
|
|
213
|
+
failureReason: string | null;
|
|
212
214
|
initiatedBy: string;
|
|
213
215
|
completedAt: string | null;
|
|
214
216
|
};
|
|
215
217
|
signingInstructions: {
|
|
216
218
|
amount: string;
|
|
219
|
+
to: string;
|
|
217
220
|
note: string;
|
|
218
221
|
token: string;
|
|
219
|
-
to: string;
|
|
220
222
|
};
|
|
221
223
|
}>;
|
|
222
224
|
type RefundCreateOutput = z.infer<typeof refundCreateOutputSchema>;
|
|
223
225
|
|
|
224
|
-
export { type CreateRefundInput, type Refund, type RefundCreateOutput, type RefundReason, type RefundSigningInstructions, type RefundStatus, type SubmitRefundSignatureInput, createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
|
|
226
|
+
export { type CreateRefundInput, type CreateRefundParsed, type Refund, type RefundCreateOutput, type RefundReason, type RefundSigningInstructions, type RefundStatus, type SubmitRefundSignatureInput, type SubmitRefundSignatureParsed, createRefundInputSchema, refundCreateOutputSchema, refundReasonSchema, refundSchema, refundSigningInstructionsSchema, refundStatusSchema, submitRefundSignatureInputSchema };
|
package/dist/refunds.js.map
CHANGED
|
@@ -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,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AA,EACZ,aAAA,EAAe,QAAA;AAAA,EACf,MAAA,EAAQ,iBAAA;AAAA,EACR,QAAA,EAAU,qBAAA;AAAA,EACV,MAAA,EAAQ,kBAAA;AAAA,EACR,MAAMA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA,EAAS;AAAA,EACnC,MAAA,EAAQ,kBAAA;AAAA,EACR,YAAA,EAAc,gBAAA;AAAA,EACd,YAAA,EAAc,gBAAgB,QAAA,EAAS;AAAA,EACvC,eAAeA,CAAAA,CAAE,MAAA,GAAS,GAAA,CAAI,GAAG,EAAE,QAAA,EAAS;AAAA,EAC5C,WAAA,EAAa,QAAA;AAAA,EACb,SAAA,EAAW,kBAAA;AAAA,EACX,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;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"]}
|
|
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,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.input<typeof paginationInputSchema>\nexport type PaginationParsed = z.output<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.input<typeof createRefundInputSchema>\nexport type CreateRefundParsed = z.output<typeof createRefundInputSchema>\n\nexport const submitRefundSignatureInputSchema = z.object({\n id: idSchema,\n refundTxHash: evmTxHashSchema,\n})\nexport type SubmitRefundSignatureInput = z.input<typeof submitRefundSignatureInputSchema>\nexport type SubmitRefundSignatureParsed = z.output<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"]}
|