tidy up deposit product usuage with deposit account.
This commit is contained in:
+114
-1
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
/**
|
||||
* Immutable data object for deposit accounts.
|
||||
@@ -23,6 +24,19 @@ public class DepositAccountData {
|
||||
private final BigDecimal deposit;
|
||||
private final BigDecimal maturityInterestRate;
|
||||
|
||||
private final Integer termInMonths;
|
||||
private final LocalDate projectedCommencementDate;
|
||||
private final LocalDate actualCommencementDate;
|
||||
private final LocalDate projectedMaturityDate;
|
||||
private final LocalDate actualMaturityDate;
|
||||
private final BigDecimal projectedInterestAccrued;
|
||||
private final BigDecimal actualInterestAccrued;
|
||||
private final BigDecimal projectedMaturityAmount;
|
||||
private final BigDecimal actualMaturityAmount;
|
||||
private final boolean renewalAllowed;
|
||||
private final boolean preClosureAllowed;
|
||||
private final BigDecimal preClosureInterestRate;
|
||||
|
||||
private final DateTime createdOn;
|
||||
private final DateTime lastModifedOn;
|
||||
|
||||
@@ -39,6 +53,19 @@ public class DepositAccountData {
|
||||
this.currency = null;
|
||||
this.deposit = null;
|
||||
this.maturityInterestRate = null;
|
||||
this.termInMonths = null;
|
||||
this.projectedCommencementDate = null;
|
||||
this.actualCommencementDate = null;
|
||||
this.projectedMaturityDate = null;
|
||||
this.actualMaturityDate = null;
|
||||
this.projectedInterestAccrued = null;
|
||||
this.actualInterestAccrued = null;
|
||||
this.projectedMaturityAmount = null;
|
||||
this.actualMaturityAmount = null;
|
||||
this.renewalAllowed = false;
|
||||
this.preClosureAllowed = false;
|
||||
this.preClosureInterestRate = null;
|
||||
|
||||
this.currencyOptions = new ArrayList<CurrencyData>();
|
||||
}
|
||||
|
||||
@@ -53,6 +80,19 @@ public class DepositAccountData {
|
||||
this.currency = account.getCurrency();
|
||||
this.deposit = account.getDeposit();
|
||||
this.maturityInterestRate = account.getMaturityInterestRate();
|
||||
this.termInMonths = account.getTermInMonths();
|
||||
this.projectedCommencementDate = account.getProjectedCommencementDate();
|
||||
this.actualCommencementDate = account.getActualCommencementDate();
|
||||
this.projectedMaturityDate = account.getProjectedMaturityDate();
|
||||
this.actualMaturityDate = account.getActualMaturityDate();
|
||||
this.projectedInterestAccrued = account.getProjectedInterestAccrued();
|
||||
this.actualInterestAccrued = account.getActualInterestAccrued();
|
||||
this.projectedMaturityAmount = account.getProjectedMaturityAmount();
|
||||
this.actualMaturityAmount = account.getActualMaturityAmount();
|
||||
this.renewalAllowed = account.isRenewalAllowed();
|
||||
this.preClosureAllowed = account.isPreClosureAllowed();
|
||||
this.preClosureInterestRate = account.getPreClosureInterestRate();
|
||||
|
||||
this.currencyOptions = currencies;
|
||||
}
|
||||
|
||||
@@ -65,7 +105,19 @@ public class DepositAccountData {
|
||||
final Long productId,
|
||||
final String productName,
|
||||
final CurrencyData currency,
|
||||
final BigDecimal deposit, BigDecimal interestRate) {
|
||||
final BigDecimal deposit, final BigDecimal interestRate,
|
||||
final Integer termInMonths,
|
||||
final LocalDate projectedCommencementDate,
|
||||
final LocalDate actualCommencementDate,
|
||||
final LocalDate projectedMaturityDate,
|
||||
final LocalDate actualMaturityDate,
|
||||
final BigDecimal projectedInterestAccrued,
|
||||
final BigDecimal actualInterestAccrued,
|
||||
final BigDecimal projectedMaturityAmount,
|
||||
final BigDecimal actualMaturityAmount,
|
||||
final boolean renewalAllowed,
|
||||
final boolean preClosureAllowed,
|
||||
final BigDecimal preClosureInterestRate) {
|
||||
this.createdOn=createdOn;
|
||||
this.lastModifedOn=lastModifedOn;
|
||||
this.id=id;
|
||||
@@ -76,6 +128,19 @@ public class DepositAccountData {
|
||||
this.currency = currency;
|
||||
this.deposit = deposit;
|
||||
this.maturityInterestRate=interestRate;
|
||||
this.termInMonths = termInMonths;
|
||||
this.projectedCommencementDate = projectedCommencementDate;
|
||||
this.actualCommencementDate = actualCommencementDate;
|
||||
this.projectedMaturityDate = projectedMaturityDate;
|
||||
this.actualMaturityDate = actualMaturityDate;
|
||||
this.projectedInterestAccrued = projectedInterestAccrued;
|
||||
this.actualInterestAccrued = actualInterestAccrued;
|
||||
this.projectedMaturityAmount = projectedMaturityAmount;
|
||||
this.actualMaturityAmount = actualMaturityAmount;
|
||||
this.renewalAllowed = renewalAllowed;
|
||||
this.preClosureAllowed = preClosureAllowed;
|
||||
this.preClosureInterestRate = preClosureInterestRate;
|
||||
|
||||
this.currencyOptions = new ArrayList<CurrencyData>();
|
||||
}
|
||||
|
||||
@@ -110,6 +175,54 @@ public class DepositAccountData {
|
||||
public BigDecimal getMaturityInterestRate() {
|
||||
return maturityInterestRate;
|
||||
}
|
||||
|
||||
public Integer getTermInMonths() {
|
||||
return termInMonths;
|
||||
}
|
||||
|
||||
public LocalDate getProjectedCommencementDate() {
|
||||
return projectedCommencementDate;
|
||||
}
|
||||
|
||||
public LocalDate getActualCommencementDate() {
|
||||
return actualCommencementDate;
|
||||
}
|
||||
|
||||
public LocalDate getProjectedMaturityDate() {
|
||||
return projectedMaturityDate;
|
||||
}
|
||||
|
||||
public LocalDate getActualMaturityDate() {
|
||||
return actualMaturityDate;
|
||||
}
|
||||
|
||||
public BigDecimal getProjectedInterestAccrued() {
|
||||
return projectedInterestAccrued;
|
||||
}
|
||||
|
||||
public BigDecimal getActualInterestAccrued() {
|
||||
return actualInterestAccrued;
|
||||
}
|
||||
|
||||
public BigDecimal getProjectedMaturityAmount() {
|
||||
return projectedMaturityAmount;
|
||||
}
|
||||
|
||||
public BigDecimal getActualMaturityAmount() {
|
||||
return actualMaturityAmount;
|
||||
}
|
||||
|
||||
public boolean isRenewalAllowed() {
|
||||
return renewalAllowed;
|
||||
}
|
||||
|
||||
public boolean isPreClosureAllowed() {
|
||||
return preClosureAllowed;
|
||||
}
|
||||
|
||||
public BigDecimal getPreClosureInterestRate() {
|
||||
return preClosureInterestRate;
|
||||
}
|
||||
|
||||
public DateTime getCreatedOn() {
|
||||
return createdOn;
|
||||
|
||||
+58
-50
@@ -27,66 +27,76 @@ public class DepositProduct extends AbstractAuditableCustom<AppUser, Long> {
|
||||
private boolean deleted = false;
|
||||
|
||||
@Embedded
|
||||
private DepositProductRelatedDetail depositProductRelatedDetail;
|
||||
|
||||
private MonetaryCurrency currency;
|
||||
|
||||
@Column(name = "minimum_balance", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal minimumBalance;
|
||||
|
||||
@Column(name = "maximum_balance", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal maximumBalance;
|
||||
|
||||
@Column(name = "tenure_months", nullable=false)
|
||||
private Integer tenureMonths;
|
||||
|
||||
@Column(name = "maturity_default_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal maturityDefaultInterestRate;
|
||||
|
||||
@Column(name = "maturity_min_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal maturityMinInterestRate;
|
||||
|
||||
@Column(name = "maturity_max_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal maturityMaxInterestRate;
|
||||
|
||||
@Column(name = "can_renew", nullable=false)
|
||||
private boolean renewalAllowed = false;
|
||||
|
||||
@Column(name = "can_pre_close", nullable=false)
|
||||
private boolean preClosureAllowed = false;
|
||||
|
||||
@Column(name = "pre_closure_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal preClosureInterestRate;
|
||||
|
||||
protected DepositProduct(){
|
||||
this.name = null;
|
||||
this.description = null;
|
||||
this.depositProductRelatedDetail=null;
|
||||
}
|
||||
|
||||
public DepositProduct(final String name, final String description, final MonetaryCurrency currency, final BigDecimal minimumBalance,final BigDecimal maximumBalance,
|
||||
final Integer tenureMonths,final BigDecimal maturityDefaultInterestRate, final BigDecimal maturityMinInterestRate, BigDecimal maturityMaxInterestRate,
|
||||
boolean canRenew,
|
||||
boolean canPreClose, BigDecimal preClosureInterestRate ){
|
||||
this.name = name.trim();
|
||||
public DepositProduct(final String name, final String description,
|
||||
final MonetaryCurrency currency, final BigDecimal minimumBalance,
|
||||
final BigDecimal maximumBalance, final Integer tenureMonths,
|
||||
final BigDecimal maturityDefaultInterestRate,
|
||||
final BigDecimal maturityMinInterestRate,
|
||||
BigDecimal maturityMaxInterestRate, boolean canRenew,
|
||||
boolean canPreClose, BigDecimal preClosureInterestRate) {
|
||||
this.name = name.trim();
|
||||
if (StringUtils.isNotBlank(description)) {
|
||||
this.description = description.trim();
|
||||
} else {
|
||||
this.description = null;
|
||||
}
|
||||
this.depositProductRelatedDetail= new DepositProductRelatedDetail(currency, minimumBalance, maximumBalance, tenureMonths,
|
||||
maturityDefaultInterestRate, maturityMinInterestRate, maturityMaxInterestRate, canRenew, canPreClose, preClosureInterestRate);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
this.currency = currency;
|
||||
this.minimumBalance = minimumBalance;
|
||||
this.maximumBalance = maximumBalance;
|
||||
this.tenureMonths = tenureMonths;
|
||||
this.maturityDefaultInterestRate = maturityDefaultInterestRate;
|
||||
this.maturityMinInterestRate = maturityMinInterestRate;
|
||||
this.maturityMaxInterestRate = maturityMaxInterestRate;
|
||||
this.renewalAllowed = canRenew;
|
||||
this.preClosureAllowed = canPreClose;
|
||||
this.preClosureInterestRate = preClosureInterestRate;
|
||||
}
|
||||
|
||||
public MonetaryCurrency getCurrency() {
|
||||
return this.depositProductRelatedDetail.getCurrency();
|
||||
}
|
||||
|
||||
public BigDecimal getMinimumBalance(){
|
||||
return this.depositProductRelatedDetail.getMinimumBalance();
|
||||
return currency;
|
||||
}
|
||||
|
||||
public BigDecimal getMaximumBalance(){
|
||||
return this.depositProductRelatedDetail.getMaximumBalance();
|
||||
|
||||
public boolean isRenewalAllowed() {
|
||||
return this.renewalAllowed;
|
||||
}
|
||||
|
||||
public Integer getTenureMonths(){
|
||||
return this.depositProductRelatedDetail.getTenureMonths();
|
||||
}
|
||||
|
||||
public BigDecimal getMaturityDefaultInterestRate() {
|
||||
return this.depositProductRelatedDetail.getMaturityDefaultInterestRate();
|
||||
}
|
||||
|
||||
public BigDecimal getMaturityMinInterestRate() {
|
||||
return this.depositProductRelatedDetail.getMaturityMinInterestRate();
|
||||
}
|
||||
|
||||
public BigDecimal getMaturityMaxInterestRate() {
|
||||
return this.depositProductRelatedDetail.getMaturityMaxInterestRate();
|
||||
}
|
||||
|
||||
public BigDecimal getPreClosureInterestRate() {
|
||||
return this.depositProductRelatedDetail.getPreClosureInterestRate();
|
||||
|
||||
public boolean isPreClosureAllowed() {
|
||||
return this.preClosureAllowed;
|
||||
}
|
||||
|
||||
public boolean isDeleted() {
|
||||
@@ -106,15 +116,13 @@ public class DepositProduct extends AbstractAuditableCustom<AppUser, Long> {
|
||||
if (command.isDescriptionChanged()) {
|
||||
this.description = command.getDescription();
|
||||
}
|
||||
|
||||
this.depositProductRelatedDetail.update(command);
|
||||
}
|
||||
|
||||
public void validateInterestRateInRange(final BigDecimal interestRate) {
|
||||
this.depositProductRelatedDetail.validateInterestRateInRange(interestRate);
|
||||
// this.depositProductRelatedDetail.validateInterestRateInRange(interestRate);
|
||||
}
|
||||
|
||||
public void validateDepositInRange(final BigDecimal depositAmount) {
|
||||
this.depositProductRelatedDetail.validateDepositInRange(depositAmount);
|
||||
// this.depositProductRelatedDetail.validateDepositInRange(depositAmount);
|
||||
}
|
||||
}
|
||||
|
||||
-196
@@ -1,196 +0,0 @@
|
||||
package org.mifosng.platform.deposit.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.Embedded;
|
||||
|
||||
import org.mifosng.platform.api.commands.DepositProductCommand;
|
||||
import org.mifosng.platform.currency.domain.MonetaryCurrency;
|
||||
import org.mifosng.platform.exceptions.ValueOutsideRangeException;
|
||||
|
||||
@Embeddable
|
||||
public class DepositProductRelatedDetail {
|
||||
|
||||
@Embedded
|
||||
private MonetaryCurrency currency;
|
||||
|
||||
@Column(name = "minimum_balance", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal minimumBalance;
|
||||
|
||||
@Column(name = "maximum_balance", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal maximumBalance;
|
||||
|
||||
@Column(name = "tenure_months", nullable=false)
|
||||
private Integer tenureMonths;
|
||||
|
||||
@Column(name = "maturity_default_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal maturityDefaultInterestRate;
|
||||
|
||||
@Column(name = "maturity_min_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal maturityMinInterestRate;
|
||||
|
||||
@Column(name = "maturity_max_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal maturityMaxInterestRate;
|
||||
|
||||
@Column(name = "can_renew", nullable=false)
|
||||
private boolean renewalAllowed = false;
|
||||
|
||||
@Column(name = "can_pre_close", nullable=false)
|
||||
private boolean preClosureAllowed = false;
|
||||
|
||||
@Column(name = "pre_closure_interest_rate", scale = 6, precision = 19, nullable = false)
|
||||
private BigDecimal preClosureInterestRate;
|
||||
|
||||
public DepositProductRelatedDetail() {
|
||||
this.maximumBalance = null;
|
||||
this.minimumBalance = null;
|
||||
this.tenureMonths = null;
|
||||
this.maturityDefaultInterestRate = null;
|
||||
this.maturityMinInterestRate = null;
|
||||
this.maturityMaxInterestRate = null;
|
||||
this.preClosureInterestRate = null;
|
||||
}
|
||||
|
||||
public DepositProductRelatedDetail(
|
||||
final MonetaryCurrency currency, final BigDecimal minimumBalance, final BigDecimal maximumBalance,
|
||||
final Integer tenureMonths,
|
||||
final BigDecimal maturityDefaultInterestRate, final BigDecimal maturityMinInterestRate, final BigDecimal maturityMaxInterestRate,
|
||||
final boolean renewalAllowed, final boolean preClosureAllowed, final BigDecimal preClosureInterestRate) {
|
||||
|
||||
this.currency=currency;
|
||||
this.minimumBalance=minimumBalance;
|
||||
this.maximumBalance=maximumBalance;
|
||||
|
||||
this.tenureMonths = tenureMonths;
|
||||
this.maturityDefaultInterestRate = maturityDefaultInterestRate;
|
||||
this.maturityMinInterestRate = maturityMinInterestRate;
|
||||
this.maturityMaxInterestRate = maturityMaxInterestRate;
|
||||
this.renewalAllowed = renewalAllowed;
|
||||
this.preClosureAllowed = preClosureAllowed;
|
||||
this.preClosureInterestRate = preClosureInterestRate;
|
||||
}
|
||||
|
||||
public MonetaryCurrency getCurrency() {
|
||||
return this.currency.copy();
|
||||
}
|
||||
|
||||
public BigDecimal getMinimumBalance(){
|
||||
return BigDecimal.valueOf(Double.valueOf(this.minimumBalance.stripTrailingZeros().toString()));
|
||||
}
|
||||
|
||||
public BigDecimal getMaximumBalance(){
|
||||
return BigDecimal.valueOf(Double.valueOf(this.maximumBalance.stripTrailingZeros().toString()));
|
||||
}
|
||||
|
||||
public Integer getTenureMonths() {
|
||||
return this.tenureMonths;
|
||||
}
|
||||
|
||||
public BigDecimal getMaturityDefaultInterestRate() {
|
||||
return BigDecimal.valueOf(Double.valueOf(this.maturityDefaultInterestRate.stripTrailingZeros().toString()));
|
||||
}
|
||||
|
||||
public BigDecimal getMaturityMinInterestRate() {
|
||||
return BigDecimal.valueOf(Double.valueOf(this.maturityMinInterestRate.stripTrailingZeros().toString()));
|
||||
}
|
||||
|
||||
public BigDecimal getMaturityMaxInterestRate() {
|
||||
return BigDecimal.valueOf(Double.valueOf(this.maturityMaxInterestRate.stripTrailingZeros().toString()));
|
||||
}
|
||||
|
||||
public BigDecimal getPreClosureInterestRate() {
|
||||
return BigDecimal.valueOf(Double.valueOf(this.preClosureInterestRate.stripTrailingZeros().toString()));
|
||||
}
|
||||
|
||||
public void update(DepositProductCommand command){
|
||||
|
||||
Integer digitsAfterDecimalChanged = this.currency.getDigitsAfterDecimal();
|
||||
if (command.isDigitsAfterDecimalChanged()) {
|
||||
digitsAfterDecimalChanged = command.getDigitsAfterDecimal();
|
||||
}
|
||||
|
||||
String currencyCodeChanged = this.currency.getCode();
|
||||
if (command.isCurrencyCodeChanged()) {
|
||||
currencyCodeChanged = command.getCurrencyCode();
|
||||
}
|
||||
|
||||
if (command.isDigitsAfterDecimalChanged() || command.isCurrencyCodeChanged()) {
|
||||
this.currency = new MonetaryCurrency(currencyCodeChanged, digitsAfterDecimalChanged);
|
||||
}
|
||||
|
||||
if(command.isMinimumBalanceChanged()){
|
||||
this.minimumBalance=command.getMinimumBalance();
|
||||
}
|
||||
|
||||
if(command.isMaximumBalanceChanged()){
|
||||
this.maximumBalance=command.getMaximumBalance();
|
||||
}
|
||||
|
||||
if(command.isTenureMonthsChanged()){
|
||||
this.tenureMonths=command.getTenureMonths();
|
||||
}
|
||||
|
||||
if (command.isMaturityDefaultInterestRateChanged()) {
|
||||
this.maturityDefaultInterestRate=command.getMaturityDefaultInterestRate();
|
||||
}
|
||||
|
||||
if(command.isMaturityMaxInterestRateChanged()){
|
||||
this.maturityMaxInterestRate=command.getMaturityMaxInterestRate();
|
||||
}
|
||||
|
||||
if (command.isMaturityMinInterestRateChanged()) {
|
||||
this.maturityMinInterestRate=command.getMaturityMinInterestRate();
|
||||
}
|
||||
|
||||
if (command.isCanRenewChanged()) {
|
||||
this.renewalAllowed=command.isRenewalAllowed();
|
||||
}
|
||||
|
||||
if (command.isCanPreCloseChanged()) {
|
||||
this.preClosureAllowed=command.isPreClosureAllowed();
|
||||
}
|
||||
|
||||
if (command.isPreClosureInterestRateChanged()) {
|
||||
this.preClosureInterestRate=command.getPreClosureInterestRate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void validateInterestRateInRange(final BigDecimal interestRate) {
|
||||
boolean inRange = true;
|
||||
if (interestRate.compareTo(this.maturityMinInterestRate) < 0) {
|
||||
inRange = false;
|
||||
}
|
||||
|
||||
if (this.maturityMaxInterestRate.compareTo(interestRate) < 0) {
|
||||
inRange = false;
|
||||
}
|
||||
|
||||
if (!inRange) {
|
||||
final String actualValue = interestRate.toPlainString();
|
||||
final String minValue = (this.maturityMinInterestRate == null) ? "" : this.maturityMinInterestRate.toPlainString();
|
||||
final String maxValue = (this.maturityMaxInterestRate == null) ? "" : this.maturityMaxInterestRate.toPlainString();
|
||||
throw new ValueOutsideRangeException(actualValue, minValue, maxValue, "deposit.account.maturityInterestRate");
|
||||
}
|
||||
}
|
||||
|
||||
public void validateDepositInRange(final BigDecimal depositAmount) {
|
||||
boolean inRange = true;
|
||||
if (depositAmount.compareTo(this.minimumBalance) < 0) {
|
||||
inRange = false;
|
||||
}
|
||||
|
||||
if (this.maximumBalance != null && this.maximumBalance.compareTo(depositAmount) < 0) {
|
||||
inRange = false;
|
||||
}
|
||||
|
||||
if (!inRange) {
|
||||
final String actualValue = depositAmount.toPlainString();
|
||||
final String minValue = (this.minimumBalance == null) ? "" : this.minimumBalance.toPlainString();
|
||||
final String maxValue = (this.minimumBalance == null) ? "" : this.minimumBalance.toPlainString();
|
||||
throw new ValueOutsideRangeException(actualValue, minValue, maxValue, "deposit.account.deposit.amount");
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-2
@@ -39,7 +39,6 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
|
||||
@JoinColumn(name = "product_id")
|
||||
private final DepositProduct product;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "external_id")
|
||||
private String externalId;
|
||||
|
||||
@@ -165,9 +164,15 @@ public class DepositAccount extends AbstractAuditableCustom<AppUser, Long> {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete is a <i>soft delete</i>. Updates flag on account so it wont appear in query/report results.
|
||||
*
|
||||
* Any fields with unique constraints and prepended with id of record.
|
||||
*/
|
||||
public void delete() {
|
||||
this.deleted = true;
|
||||
}
|
||||
this.externalId = this.getId() + "_" + this.externalId;
|
||||
}
|
||||
|
||||
public void update(final DepositAccountCommand command) {
|
||||
|
||||
|
||||
+2
-1
@@ -50,7 +50,8 @@ public class DepositAccountAssembler {
|
||||
}
|
||||
PeriodFrequencyType compoundingInterestFrequency = PeriodFrequencyType.fromInt(interestCompoundingPeriodType);
|
||||
|
||||
// boolean renewalAllowed = product.isr
|
||||
boolean renewalAllowed = product.isRenewalAllowed();
|
||||
// if (command.get)
|
||||
|
||||
DepositAccount account = DepositAccount.openNew(client, product, command.getExternalId(), deposit, command.getMaturityInterestRate(),
|
||||
command.getTermInMonths(), command.getInterestCompoundedEvery(), compoundingInterestFrequency, command.getCommencementDate());
|
||||
|
||||
+26
-2
@@ -6,6 +6,7 @@ import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.mifosng.platform.api.data.CurrencyData;
|
||||
import org.mifosng.platform.api.data.DepositAccountData;
|
||||
import org.mifosng.platform.exceptions.LoanProductNotFoundException;
|
||||
@@ -73,7 +74,11 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
|
||||
return "da.id as id, da.client_id as clientId, da.product_id as productId,"
|
||||
+ " da.currency_code as currencyCode, da.currency_digits as currencyDigits, "
|
||||
+ " da.deposit_amount as depositAmount, "
|
||||
+ " da.maturity_nominal_interest_rate as interestRate, "
|
||||
+ " 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.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.can_renew as renewalAllowed, da.can_pre_close as preClosureAllowed, da.pre_closure_interest_rate as preClosureInterestRate, "
|
||||
+ " da.created_date as createdon, da.lastmodified_date as modifiedon, "
|
||||
+ " c.firstname as firstname, c.lastname as lastname, pd.name as productName,"
|
||||
+ " curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, curr.display_symbol as currencyDisplaySymbol"
|
||||
@@ -103,10 +108,29 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
|
||||
BigDecimal depositAmount = rs.getBigDecimal("depositAmount");
|
||||
BigDecimal interestRate = rs.getBigDecimal("interestRate");
|
||||
|
||||
Integer termInMonths = JdbcSupport.getInteger(rs,"termInMonths");
|
||||
|
||||
LocalDate projectedCommencementDate = JdbcSupport.getLocalDate(rs, "projectedCommencementDate");
|
||||
LocalDate actualCommencementDate = JdbcSupport.getLocalDate(rs, "actualCommencementDate");
|
||||
LocalDate projectedMaturityDate = JdbcSupport.getLocalDate(rs, "projectedMaturityDate");
|
||||
LocalDate actualMaturityDate = JdbcSupport.getLocalDate(rs, "actualMaturityDate");
|
||||
BigDecimal projectedInterestAccrued = rs.getBigDecimal("projectedInterestAccrued");
|
||||
BigDecimal actualInterestAccrued = rs.getBigDecimal("actualInterestAccrued");
|
||||
|
||||
BigDecimal projectedMaturityAmount = rs.getBigDecimal("projectedMaturityAmount");
|
||||
BigDecimal actualMaturityAmount = rs.getBigDecimal("actualMaturityAmount");
|
||||
|
||||
boolean renewalAllowed = rs.getBoolean("renewalAllowed");
|
||||
boolean preClosureAllowed = rs.getBoolean("preClosureAllowed");
|
||||
|
||||
BigDecimal preClosureInterestRate = rs.getBigDecimal("preClosureInterestRate");
|
||||
|
||||
DateTime createdOn = JdbcSupport.getDateTime(rs, "createdon");
|
||||
DateTime lastModifedOn = JdbcSupport.getDateTime(rs, "modifiedon");
|
||||
|
||||
return new DepositAccountData(createdOn, lastModifedOn, id, clientId, clientName, productId, productName, currencyData, depositAmount, interestRate);
|
||||
return new DepositAccountData(createdOn, lastModifedOn, id, clientId, clientName, productId, productName, currencyData, depositAmount,
|
||||
interestRate, termInMonths, projectedCommencementDate, actualCommencementDate, projectedMaturityDate, actualMaturityDate,
|
||||
projectedInterestAccrued, actualInterestAccrued, projectedMaturityAmount, actualMaturityAmount, renewalAllowed, preClosureAllowed, preClosureInterestRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user