validation

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package validation provides deep validation of OBIE request structs before they are sent to an ASPSP. Catching malformed requests client-side avoids unnecessary round-trips and gives callers richer error messages than a raw HTTP 400 would provide.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDomesticConsent

func ValidateDomesticConsent(req *models.OBWriteDomesticConsent5) error

ValidateDomesticConsent validates an OBWriteDomesticConsent5 and returns any validation errors, or nil.

func ValidateDomesticPayment

func ValidateDomesticPayment(req *models.OBWriteDomestic2) error

ValidateDomesticPayment validates an OBWriteDomestic2 submission request.

func ValidateFundsConfirmation

func ValidateFundsConfirmation(req *models.OBFundsConfirmation1) error

ValidateFundsConfirmation validates an OBFundsConfirmation1.

func ValidateInternationalConsent

func ValidateInternationalConsent(req *models.OBWriteInternationalConsent5) error

ValidateInternationalConsent validates an OBWriteInternationalConsent5.

func ValidateVRPConsent

func ValidateVRPConsent(req *models.OBDomesticVRPConsentRequest) error

ValidateVRPConsent validates an OBDomesticVRPConsentRequest.

Types

type FieldError

type FieldError struct {
	Field   string
	Message string
}

FieldError describes a single validation failure.

func (FieldError) Error

func (e FieldError) Error() string

type ValidationErrors

type ValidationErrors []FieldError

ValidationErrors is a slice of FieldErrors that implements the error interface.

func (ValidationErrors) Error

func (ve ValidationErrors) Error() string

func (ValidationErrors) HasErrors

func (ve ValidationErrors) HasErrors() bool

HasErrors returns true if the slice is non-empty.

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator collects validation errors while walking a request struct.

func New

func New() *Validator

New creates a fresh Validator.

func (*Validator) Errors

func (v *Validator) Errors() error

Errors returns all accumulated errors, or nil if none exist.

func (*Validator) ValidateAmount

func (v *Validator) ValidateAmount(field string, a models.OBActiveOrHistoricCurrencyAndAmount)

ValidateAmount validates a currency+amount pair.

func (*Validator) ValidateCashAccount

func (v *Validator) ValidateCashAccount(field string, acc models.OBCashAccount3)

ValidateCashAccount validates an OBCashAccount3 at the given field path.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL