add recurringPrice.validate(catalog, errors) to validate negative price
@@ -93,10 +93,15 @@ public class DefaultRecurring extends ValidatingConfig<StandaloneCatalog> implem
}
// Validation: if there is a recurring price there must be a billing period
- if ((recurringPrice != null) && (billingPeriod == null || billingPeriod == BillingPeriod.NO_BILLING_PERIOD)) {
+ if (recurringPrice != null) {
+ // Validation: check for negative price
+ recurringPrice.validate(catalog, errors);
+
+ if (billingPeriod == null || billingPeriod == BillingPeriod.NO_BILLING_PERIOD) {
errors.add(new ValidationError(String.format("Recurring section of Phase %s of plan %s has a recurring price but no billing period", phaseType.toString(), planName),
DefaultPlanPhase.class, phaseType.toString()));
}
+ }
// Validation: if there is no recurring price there should be no billing period
if ((recurringPrice == null) && billingPeriod != BillingPeriod.NO_BILLING_PERIOD) {
