23 lines
445 B
Go
23 lines
445 B
Go
package validator
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/yourorg/go-dw-platform/services/template-service/dto"
|
|
)
|
|
|
|
var ErrMissingOrderID = errors.New("order_id is required")
|
|
|
|
func ValidateIngestRequest(req *dto.IngestRequest) error {
|
|
if req.OrderID == "" {
|
|
return ErrMissingOrderID
|
|
}
|
|
if req.CustomerID == "" {
|
|
return errors.New("customer_id is required")
|
|
}
|
|
if req.Amount <= 0 {
|
|
return errors.New("amount must be positive")
|
|
}
|
|
return nil
|
|
}
|