validate method
Implementation
@override
void validate() {
if (plans.isEmpty && amount == null) {
throw InvalidPaymentBodyException('Either plan or amount is required');
}
for (var plan in plans) {
plan.validate();
if (amount == null && plan.amount == null) {
throw InvalidPaymentBodyException(
'If no overall amount is provided every plan needs an amount');
}
}
unplanned?.validate();
}