fixed bugs from pull #32

This commit is contained in:
Madhukar
2012-09-06 19:22:14 +05:30
parent 1e8d4b8c9d
commit a06ed0d33b
4 changed files with 24 additions and 41 deletions
@@ -27,8 +27,7 @@ public class DepositAccountData {
private final Integer tenureInMonths;
private final LocalDate projectedCommencementDate;
private final LocalDate actualCommencementDate;
private final LocalDate projectedMaturityDate;
private final LocalDate actualMaturityDate;
private final LocalDate maturedOn;
private final LocalDate withdrawnonDate;
private final LocalDate rejectedonDate;
private final LocalDate closedonDate;
@@ -71,8 +70,7 @@ public class DepositAccountData {
this.tenureInMonths = null;
this.projectedCommencementDate = null;
this.actualCommencementDate = null;
this.projectedMaturityDate = null;
this.actualMaturityDate = null;
this.maturedOn = null;
this.projectedInterestAccrued = null;
this.actualInterestAccrued = null;
this.projectedMaturityAmount = null;
@@ -110,8 +108,7 @@ public class DepositAccountData {
this.tenureInMonths = account.getTenureInMonths();
this.projectedCommencementDate = account.getProjectedCommencementDate();
this.actualCommencementDate = account.getActualCommencementDate();
this.projectedMaturityDate = account.getProjectedMaturityDate();
this.actualMaturityDate = account.getActualMaturityDate();
this.maturedOn = account.getMaturedOn();
this.projectedInterestAccrued = account.getProjectedInterestAccrued();
this.actualInterestAccrued = account.getActualInterestAccrued();
this.projectedMaturityAmount = account.getProjectedMaturityAmount();
@@ -145,8 +142,7 @@ public class DepositAccountData {
final Integer tenureInMonths,
final LocalDate projectedCommencementDate,
final LocalDate actualCommencementDate,
final LocalDate projectedMaturityDate,
final LocalDate actualMaturityDate,
final LocalDate maturedOn,
final BigDecimal projectedInterestAccrued,
final BigDecimal actualInterestAccrued,
final BigDecimal projectedMaturityAmount,
@@ -172,8 +168,7 @@ public class DepositAccountData {
this.tenureInMonths = tenureInMonths;
this.projectedCommencementDate = projectedCommencementDate;
this.actualCommencementDate = actualCommencementDate;
this.projectedMaturityDate = projectedMaturityDate;
this.actualMaturityDate = actualMaturityDate;
this.maturedOn = maturedOn;
this.projectedInterestAccrued = projectedInterestAccrued;
this.actualInterestAccrued = actualInterestAccrued;
this.projectedMaturityAmount = projectedMaturityAmount;
@@ -220,8 +215,7 @@ public class DepositAccountData {
this.tenureInMonths = tenureInMonths;
this.projectedCommencementDate = null;
this.actualCommencementDate = null;
this.projectedMaturityDate = null;
this.actualMaturityDate = null;
this.maturedOn = null;
this.projectedInterestAccrued = null;
this.actualInterestAccrued = null;
this.projectedMaturityAmount = null;
@@ -294,12 +288,8 @@ public class DepositAccountData {
return actualCommencementDate;
}
public LocalDate getProjectedMaturityDate() {
return projectedMaturityDate;
}
public LocalDate getActualMaturityDate() {
return actualMaturityDate;
public LocalDate getMaturedOn() {
return maturedOn;
}
public BigDecimal getProjectedInterestAccrued() {
@@ -1016,7 +1016,7 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
// preClosureInterestRate
Set<String> supportedParams = new HashSet<String>(
Arrays.asList("clientId", "productId", "externalId", "depositAmount", "maturityInterestRate",
Arrays.asList("clientId", "productId", "externalId", "deposit", "maturityInterestRate",
"tenureInMonths", "interestCompoundedEvery", "interestCompoundedEveryPeriodType", "commencementDate",
"renewalAllowed", "preClosureAllowed",
"locale", "dateFormat")
@@ -1027,7 +1027,7 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
Long clientId = extractLongParameter("clientId", requestMap, modifiedParameters);
Long productId = extractLongParameter("productId", requestMap, modifiedParameters);
String externalId = extractStringParameter("externalId", requestMap,modifiedParameters);
BigDecimal depositAmount=extractBigDecimalParameter("depositAmount", requestMap, modifiedParameters);
BigDecimal deposit=extractBigDecimalParameter("deposit", requestMap, modifiedParameters);
BigDecimal interestRate = extractBigDecimalParameter("maturityInterestRate", requestMap, modifiedParameters);
Integer tenureInMonths = extractIntegerParameter("tenureInMonths", requestMap, modifiedParameters);
@@ -1039,7 +1039,7 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
boolean preClosureAllowed = extractBooleanParameter("preClosureAllowed", requestMap, modifiedParameters);
return new DepositAccountCommand(modifiedParameters, resourceIdentifier, clientId, productId,
externalId, depositAmount, interestRate, tenureInMonths,
externalId, deposit, interestRate, tenureInMonths,
interestCompoundedEvery, interestCompoundedEveryPeriodType, commencementDate, renewalAllowed, preClosureAllowed);
}
@@ -1122,19 +1122,19 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
Type typeOfMap = new TypeToken<Map<String, String>>(){}.getType();
Map<String, String> requestMap = gsonConverter.fromJson(json, typeOfMap);
Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale","eventDate", "dateFormat", "tenureInMonths", "depositAmount", "interestCompoundedEveryPeriodType", "productId","interestCompoundedEvery"));
Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale","commencementDate", "dateFormat", "tenureInMonths", "deposit", "interestCompoundedEveryPeriodType", "productId","interestCompoundedEvery"));
checkForUnsupportedParameters(requestMap, supportedParams);
Set<String> modifiedParameters = new HashSet<String>();
LocalDate eventDate = extractLocalDateParameter("eventDate", requestMap, modifiedParameters);
BigDecimal depositAmount=extractBigDecimalParameter("depositAmount", requestMap, modifiedParameters);
LocalDate commencementDate = extractLocalDateParameter("commencementDate", requestMap, modifiedParameters);
BigDecimal deposit=extractBigDecimalParameter("deposit", requestMap, modifiedParameters);
Integer tenureInMonths = extractIntegerParameter("tenureInMonths", requestMap, modifiedParameters);
Integer interestCompoundedEveryPeriodType = extractIntegerParameter("interestCompoundedEveryPeriodType", requestMap, modifiedParameters);
Integer interestCompoundedEvery = extractIntegerParameter("interestCompoundedEvery", requestMap, modifiedParameters);
Long productId = extractLongParameter("productId", requestMap, modifiedParameters);
return new DepositStateTransitionApprovalCommand(resourceIdentifier, productId, eventDate, tenureInMonths, depositAmount, interestCompoundedEveryPeriodType,interestCompoundedEvery);
return new DepositStateTransitionApprovalCommand(resourceIdentifier, productId, commencementDate, tenureInMonths, deposit, interestCompoundedEveryPeriodType,interestCompoundedEvery);
}
}
@@ -76,13 +76,8 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE)
@Column(name = "projected_maturity_date")
private Date projectedMaturityDate;
@SuppressWarnings("unused")
@Temporal(TemporalType.DATE)
@Column(name = "actual_maturity_date")
private Date actualMaturityDate;
@Column(name = "matured_on")
private Date maturedOn;
@SuppressWarnings("unused")
@Column(name = "projected_interest_accrued_on_maturity", scale = 6, precision = 19, nullable = false)
@@ -196,7 +191,7 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
this.interestCompoundedFrequencyType = interestCompoundedFrequencyPeriodType.getValue();
if (commencementDate != null) {
this.projectedCommencementDate = commencementDate.toDate();
this.projectedMaturityDate = commencementDate.plusMonths(this.tenureInMonths).toDate();
this.maturedOn = commencementDate.plusMonths(this.tenureInMonths).toDate();
}
this.renewalAllowed = renewalAllowed;
@@ -248,8 +243,7 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
this.actualCommencementDate = actualCommencementDate.toDate();
// TODO - KW - there was probably no need for 'projected' and 'actual' maturity dates - a single 'matures_on' attribute is sufficient
this.projectedMaturityDate = getActualCommencementDate().plusMonths(this.tenureInMonths).toDate();
this.actualMaturityDate = getActualCommencementDate().plusMonths(this.tenureInMonths).toDate();
this.maturedOn = getActualCommencementDate().plusMonths(this.tenureInMonths).toDate();
Money futureValueOnMaturity = calculator.calculateInterestOnMaturityFor(getDeposit(), this.tenureInMonths,
this.interestRate, this.interestCompoundedEvery, getInterestCompoundedFrequencyType());
@@ -257,7 +251,7 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
this.interestAccrued = futureValueOnMaturity.minus(getDeposit()).getAmount();
this.total = futureValueOnMaturity.getAmount();
DepositAccountTransaction depositaccountTransaction = DepositAccountTransaction.deposit(futureValueOnMaturity, getActualCommencementDate());
DepositAccountTransaction depositaccountTransaction = DepositAccountTransaction.deposit(getDeposit(), getActualCommencementDate());
depositaccountTransaction.updateAccount(this);
this.depositaccountTransactions.add(depositaccountTransaction);
@@ -355,7 +349,7 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
this.depositStatus = statusEnum.getValue();
this.actualCommencementDate = null;
this.actualMaturityDate = null;
this.maturedOn = getProjectedCommencementDate().plusMonths(this.tenureInMonths).toDate();
this.total=null;
this.interestAccrued=null;
this.depositaccountTransactions.clear();
@@ -152,7 +152,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
+ " da.currency_code as currencyCode, da.currency_digits as currencyDigits, "
+ " da.deposit_amount as depositAmount, da.status_enum as statusId, "
+ " da.maturity_nominal_interest_rate as interestRate, da.tenure_months as termInMonths, da.projected_commencement_date as projectedCommencementDate,"
+ " da.actual_commencement_date as actualCommencementDate, da.projected_maturity_date as projectedMaturityDate, da.actual_maturity_date as actualMaturityDate,"
+ " da.actual_commencement_date as actualCommencementDate, da.matured_on as maturedOn,"
+ " da.projected_interest_accrued_on_maturity as projectedInterestAccrued, da.actual_interest_accrued as actualInterestAccrued, "
+ " da.projected_total_maturity_amount as projectedMaturityAmount, da.actual_total_amount as actualMaturityAmount, "
+ " da.interest_compounded_every as interestCompoundedEvery, da.interest_compounded_every_period_enum as interestCompoundedEveryPeriodType, "
@@ -194,8 +194,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
LocalDate projectedCommencementDate = JdbcSupport.getLocalDate(rs, "projectedCommencementDate");
LocalDate actualCommencementDate = JdbcSupport.getLocalDate(rs, "actualCommencementDate");
LocalDate projectedMaturityDate = JdbcSupport.getLocalDate(rs, "projectedMaturityDate");
LocalDate actualMaturityDate = JdbcSupport.getLocalDate(rs, "actualMaturityDate");
LocalDate maturedOn = JdbcSupport.getLocalDate(rs, "maturedOn");
BigDecimal projectedInterestAccrued = rs.getBigDecimal("projectedInterestAccrued");
BigDecimal actualInterestAccrued = rs.getBigDecimal("actualInterestAccrued");
@@ -216,7 +215,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
LocalDate closedonDate = JdbcSupport.getLocalDate(rs, "closedonDate");
return new DepositAccountData(id, externalId, status, clientId, clientName, productId, productName, currencyData, depositAmount,
interestRate, termInMonths, projectedCommencementDate, actualCommencementDate, projectedMaturityDate, actualMaturityDate,
interestRate, termInMonths, projectedCommencementDate, actualCommencementDate, maturedOn,
projectedInterestAccrued, actualInterestAccrued, projectedMaturityAmount, actualMaturityAmount,
interestCompoundedEvery, interestCompoundedEveryPeriodType,
renewalAllowed, preClosureAllowed, preClosureInterestRate,