Skip to content

Add amount validation helpers #92

Description

@therealjhay

Description: Amount validation (numeric string, positive, within range) is repeated across CreatePaymentBody, CreateSettlementBody, and FX quote schemas. A reusable amount validator would reduce duplication.

Requirements:

  • Define AmountString schema: numeric string (regex), transform to parse, validate positive
  • Define PositiveAmountString for amounts that must be > 0
  • Use across all amount-related schemas

Suggested execution steps:

  1. Create AmountString = z.string().regex(/^\d+(\.\d+)?$/, 'must be a numeric string')
  2. Create PositiveAmountString = AmountString.refine((s) => parseFloat(s) > 0, 'must be greater than 0')
  3. Replace inline regex usage in existing schemas
  4. Export both schemas and their inferred types

Example commit message:

refactor(validation): extract reusable amount string validation schemas

Shared AmountString and PositiveAmountString schemas replace duplicated
numeric string regex validation across payment and settlement schemas.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions