Capture annual fee due date at charge creation time
This commit is contained in:
+5
-1
@@ -116,7 +116,7 @@ public class Charge extends AbstractPersistable<Long> {
|
|||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<ApiParameterError>();
|
||||||
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("charges");
|
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("charges");
|
||||||
|
|
||||||
if (isMonthlyFee()) {
|
if (isMonthlyFee() || isAnnualFee()) {
|
||||||
this.feeOnMonth = feeOnMonthDay.getMonthOfYear();
|
this.feeOnMonth = feeOnMonthDay.getMonthOfYear();
|
||||||
this.feeOnDay = feeOnMonthDay.getDayOfMonth();
|
this.feeOnDay = feeOnMonthDay.getDayOfMonth();
|
||||||
this.feeInterval = feeInterval;
|
this.feeInterval = feeInterval;
|
||||||
@@ -402,6 +402,10 @@ public class Charge extends AbstractPersistable<Long> {
|
|||||||
return ChargeTimeType.fromInt(this.chargeTime).isMonthlyFee();
|
return ChargeTimeType.fromInt(this.chargeTime).isMonthlyFee();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAnnualFee() {
|
||||||
|
return ChargeTimeType.fromInt(this.chargeTime).isAnnualFee();
|
||||||
|
}
|
||||||
|
|
||||||
public MonthDay getFeeOnMonthDay(){
|
public MonthDay getFeeOnMonthDay(){
|
||||||
MonthDay feeOnMonthDay = null;
|
MonthDay feeOnMonthDay = null;
|
||||||
if (feeOnDay != null && feeOnMonth != null) {
|
if (feeOnDay != null && feeOnMonth != null) {
|
||||||
|
|||||||
+7
-2
@@ -92,8 +92,8 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer {
|
|||||||
baseDataValidator.reset().parameter("active").value(active).notNull();
|
baseDataValidator.reset().parameter("active").value(active).notNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isMonthlyFee = ChargeTimeType.fromInt(chargeTimeType).isMonthlyFee();
|
final ChargeTimeType ctt = ChargeTimeType.fromInt(chargeTimeType);
|
||||||
if(isMonthlyFee){
|
if(ctt.isMonthlyFee()){
|
||||||
final MonthDay monthDay = this.fromApiJsonHelper.extractMonthDayNamed("feeOnMonthDay", element);
|
final MonthDay monthDay = this.fromApiJsonHelper.extractMonthDayNamed("feeOnMonthDay", element);
|
||||||
baseDataValidator.reset().parameter("feeOnMonthDay").value(monthDay).notNull();
|
baseDataValidator.reset().parameter("feeOnMonthDay").value(monthDay).notNull();
|
||||||
|
|
||||||
@@ -101,6 +101,11 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer {
|
|||||||
baseDataValidator.reset().parameter("feeInterval").value(feeInterval).notNull().inMinMaxRange(1, 12);
|
baseDataValidator.reset().parameter("feeInterval").value(feeInterval).notNull().inMinMaxRange(1, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(ctt.isAnnualFee()){
|
||||||
|
final MonthDay monthDay = this.fromApiJsonHelper.extractMonthDayNamed("feeOnMonthDay", element);
|
||||||
|
baseDataValidator.reset().parameter("feeOnMonthDay").value(monthDay).notNull();
|
||||||
|
}
|
||||||
|
|
||||||
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
throwExceptionIfValidationWarningsExist(dataValidationErrors);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user