// Events and Posting Rules for payments
public MasterDegreeInsurancePaymentCode calculateMasterDegreeInsurancePaymentCode(final ExecutionYear executionYear) {
if (!hasMasterDegreeInsurancePaymentCodeFor(executionYear)) {
return createMasterDegreeInsurancePaymentCode(executionYear);
} else {
final MasterDegreeInsurancePaymentCode masterDegreeInsurancePaymentCode =
getMasterDegreeInsurancePaymentCodeFor(executionYear);
final Money insuranceAmount = new Money(executionYear.getInsuranceValue().getAnnualValueBigDecimal());
masterDegreeInsurancePaymentCode.update(new YearMonthDay(),
calculateMasterDegreeInsurancePaymentCodeEndDate(executionYear), insuranceAmount, insuranceAmount);
return masterDegreeInsurancePaymentCode;
}
}