Skip to content

Add invoice bulk import validator with row-level errors #229

Description

@Kingsman-99

Label: complexity: high
Points: 200

Description

For creators bulk-creating invoices from a CSV/JSON import, validate every row up front and report all errors at once (not fail-fast on the first bad row), so the creator can fix everything in one pass.

Technical Context

New src/bulkImportValidator.ts. Validates an array of CreateInvoiceParams-like rows against the same constraints the contract enforces (positive amounts, recipients/amounts length match, valid deadline), independent of contract submission.

Acceptance Criteria

  • validateBulkImport(rows) returns { validRows: number[], errors: { row: number, field: string, message: string }[] }
  • Continues validating all rows even after finding errors in earlier ones
  • Mirrors the exact validation rules enforced in the contract's _create_invoice_inner (positive amounts, length match, future deadline)
  • Tests: all-valid set, all-invalid set, mixed set with multiple distinct error rows

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions