MIFOSX-292: ensure correct decimal places value for currency is returned.
This commit is contained in:
+21
-14
@@ -37,8 +37,8 @@ public class LoanProductData {
|
|||||||
// terms
|
// terms
|
||||||
private final CurrencyData currency;
|
private final CurrencyData currency;
|
||||||
private final BigDecimal principal;
|
private final BigDecimal principal;
|
||||||
private BigDecimal minPrincipal;
|
private final BigDecimal minPrincipal;
|
||||||
private BigDecimal maxPrincipal;
|
private final BigDecimal maxPrincipal;
|
||||||
private final Integer numberOfRepayments;
|
private final Integer numberOfRepayments;
|
||||||
private final Integer minNumberOfRepayments;
|
private final Integer minNumberOfRepayments;
|
||||||
private final Integer maxNumberOfRepayments;
|
private final Integer maxNumberOfRepayments;
|
||||||
@@ -109,8 +109,9 @@ public class LoanProductData {
|
|||||||
final Collection<ChargeData> charges = null;
|
final Collection<ChargeData> charges = null;
|
||||||
final EnumOptionData accountingType = null;
|
final EnumOptionData accountingType = null;
|
||||||
|
|
||||||
return new LoanProductData(id, name, description, currency, principal, minPrincipal, maxPrincipal, tolerance, numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery,
|
return new LoanProductData(id, name, description, currency, principal, minPrincipal, maxPrincipal, tolerance, numberOfRepayments,
|
||||||
interestRatePerPeriod, minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType, interestRateFrequencyType, amortizationType,
|
minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod, minInterestRatePerPeriod,
|
||||||
|
maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType, interestRateFrequencyType, amortizationType,
|
||||||
interestType, interestCalculationPeriodType, fundId, fundName, transactionProcessingStrategyId,
|
interestType, interestCalculationPeriodType, fundId, fundName, transactionProcessingStrategyId,
|
||||||
transactionProcessingStrategyName, charges, accountingType);
|
transactionProcessingStrategyName, charges, accountingType);
|
||||||
}
|
}
|
||||||
@@ -141,8 +142,9 @@ public class LoanProductData {
|
|||||||
final Collection<ChargeData> charges = null;
|
final Collection<ChargeData> charges = null;
|
||||||
final EnumOptionData accountingType = null;
|
final EnumOptionData accountingType = null;
|
||||||
|
|
||||||
return new LoanProductData(id, name, description, currency, principal, minPrincipal, maxPrincipal, tolerance, numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery,
|
return new LoanProductData(id, name, description, currency, principal, minPrincipal, maxPrincipal, tolerance, numberOfRepayments,
|
||||||
interestRatePerPeriod, minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType, interestRateFrequencyType, amortizationType,
|
minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod, minInterestRatePerPeriod,
|
||||||
|
maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType, interestRateFrequencyType, amortizationType,
|
||||||
interestType, interestCalculationPeriodType, fundId, fundName, transactionProcessingStrategyId,
|
interestType, interestCalculationPeriodType, fundId, fundName, transactionProcessingStrategyId,
|
||||||
transactionProcessingStrategyName, charges, accountingType);
|
transactionProcessingStrategyName, charges, accountingType);
|
||||||
}
|
}
|
||||||
@@ -151,7 +153,7 @@ public class LoanProductData {
|
|||||||
final Long id = null;
|
final Long id = null;
|
||||||
final String name = null;
|
final String name = null;
|
||||||
final String description = null;
|
final String description = null;
|
||||||
final CurrencyData currency = CurrencyData.blank();
|
final CurrencyData currency = null;
|
||||||
final BigDecimal principal = null;
|
final BigDecimal principal = null;
|
||||||
final BigDecimal minPrincipal = null;
|
final BigDecimal minPrincipal = null;
|
||||||
final BigDecimal maxPrincipal = null;
|
final BigDecimal maxPrincipal = null;
|
||||||
@@ -206,7 +208,15 @@ public class LoanProductData {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.currency = currency;
|
if (currency == null) {
|
||||||
|
if (this.currencyOptions != null && this.currencyOptions.size() == 1) {
|
||||||
|
this.currency = new ArrayList<CurrencyData>(this.currencyOptions).get(0);
|
||||||
|
} else {
|
||||||
|
this.currency = CurrencyData.blank();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.currency = currency;
|
||||||
|
}
|
||||||
this.principal = principal;
|
this.principal = principal;
|
||||||
this.minPrincipal = minPrincipal;
|
this.minPrincipal = minPrincipal;
|
||||||
this.maxPrincipal = maxPrincipal;
|
this.maxPrincipal = maxPrincipal;
|
||||||
@@ -282,11 +292,7 @@ public class LoanProductData {
|
|||||||
|
|
||||||
this.chargeOptions = chargeOptions;
|
this.chargeOptions = chargeOptions;
|
||||||
this.currencyOptions = currencyOptions;
|
this.currencyOptions = currencyOptions;
|
||||||
if (this.currencyOptions != null && this.currencyOptions.size() == 1) {
|
this.currency = productData.currency;
|
||||||
this.currency = new ArrayList<CurrencyData>(this.currencyOptions).get(0);
|
|
||||||
} else {
|
|
||||||
this.currency = productData.currency;
|
|
||||||
}
|
|
||||||
this.fundOptions = fundOptions;
|
this.fundOptions = fundOptions;
|
||||||
this.transactionProcessingStrategyOptions = transactionStrategyOptions;
|
this.transactionProcessingStrategyOptions = transactionStrategyOptions;
|
||||||
if (this.transactionProcessingStrategyOptions != null && this.transactionProcessingStrategyOptions.size() == 1) {
|
if (this.transactionProcessingStrategyOptions != null && this.transactionProcessingStrategyOptions.size() == 1) {
|
||||||
@@ -451,8 +457,9 @@ public class LoanProductData {
|
|||||||
public Collection<ChargeData> getChargeOptions() {
|
public Collection<ChargeData> getChargeOptions() {
|
||||||
return chargeOptions;
|
return chargeOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
LoanProductData loanProductData = (LoanProductData) obj;
|
LoanProductData loanProductData = (LoanProductData) obj;
|
||||||
return loanProductData.id.equals(this.id);
|
return loanProductData.id.equals(this.id);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user