InvoiceValidator constructor
InvoiceValidator()
Implementation
InvoiceValidator() {
ruleFor((invoice) => invoice.client, key: 'client').notEmpty().notNull();
ruleFor((invoice) => invoice.clientEmail, key: 'client_email')
.notNull()
.isValidEmailAddress()
.notEmpty();
ruleFor((invoice) => invoice.amount, key: 'amount')
.greaterThanOrEqual(75)
.notNull();
ruleFor((invoice) => invoice.discount, key: 'discount')
.lessThan(100)
.greaterThanOrEqual(0)
.notNull();
ruleFor((invoice) => invoice.webhookUrl, key: 'webhook_url')
.notEmpty()
.notNull();
ruleFor((invoice) => invoice.webhookUrl, key: 'back_url')
.notEmpty()
.notNull();
ruleFor((invoice) => invoice.invoiceNumber, key: 'invoice_number')
.notEmpty()
.notNull();
ruleFor((invoice) => invoice.mode, key: 'mode')
.must((dyn) => isEnum(dyn), 'Not a valid PaymentMethod')
.notNull();
}