+142
-2
@@ -5882,6 +5882,7 @@ GET https://DomainName/api/v1/loans/{loanId}/transactions/template"
|
||||
"total": {
|
||||
"currencyCode": "XOF",
|
||||
"digitsAfterDecimal": 0,
|
||||
"inMulitplesOf": 0,
|
||||
"amount": 471,
|
||||
"defaultName": "CFA Franc BCEAO",
|
||||
"nameCode": "currency.XOF",
|
||||
@@ -7427,6 +7428,13 @@ Request Body:
|
||||
<tr>
|
||||
<td class=fielddesc>Override the currency default value for digitsAfterDecimal.</td>
|
||||
</tr>
|
||||
<tr class=alt>
|
||||
<td>inMulitplesOf</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class=fielddesc>Override the default value for rounding currency to multiples of value provided.</td>
|
||||
</tr>
|
||||
|
||||
<tr class=alt>
|
||||
<td>principal</td>
|
||||
</tr>
|
||||
@@ -8107,7 +8115,7 @@ GET https://DomainName/api/v1/loanproducts/{productId}
|
||||
<td><div class="mifosXHeading2">Mandatory Fields</div></td>
|
||||
</tr>
|
||||
<tr class=alt>
|
||||
<td>name, currencyCode, digitsAfterDecimal, principal,
|
||||
<td>name, currencyCode, digitsAfterDecimal, inMulitplesOf, principal,
|
||||
numberOfRepayments, repaymentEvery, repaymentFrequencyType,
|
||||
interestRatePerPeriod, interestRateFrequencyType, amortizationType, interestType,
|
||||
interestCalculationPeriodType, transactionProcessingStrategyId,
|
||||
@@ -8152,6 +8160,7 @@ Request Body:
|
||||
"currencyCode": "USD",
|
||||
"locale": "en_GB",
|
||||
"digitsAfterDecimal": "2",
|
||||
"inMulitplesOf": 0,
|
||||
"principal": "100,000.00",
|
||||
"numberOfRepayments": "12",
|
||||
"repaymentEvery": "1",
|
||||
@@ -8181,6 +8190,7 @@ Request Body:
|
||||
"currencyCode": "USD",
|
||||
"locale": "en_GB",
|
||||
"digitsAfterDecimal": "2",
|
||||
"inMulitplesOf": 0,
|
||||
"principal": "100,000.00",
|
||||
"numberOfRepayments": "12",
|
||||
"repaymentEvery": "1",
|
||||
@@ -8237,6 +8247,7 @@ Request Body:
|
||||
"currencyCode": "USD",
|
||||
"locale": "en_GB",
|
||||
"digitsAfterDecimal": "2",
|
||||
"inMulitplesOf": 0,
|
||||
"principal": "100,000.00",
|
||||
"numberOfRepayments": "12",
|
||||
"repaymentEvery": "1",
|
||||
@@ -11109,6 +11120,9 @@ Content-Type: application/json
|
||||
<tr class=alt><td>digitsAfterDecimal</td></tr>
|
||||
<tr><td class=fielddesc>Override the currency default value for digitsAfterDecimal.</td></tr>
|
||||
|
||||
<tr class=alt><td>inMulitplesOf</td></tr>
|
||||
<tr><td class=fielddesc>Override the default value for rounding currency to multiples of provided value.</td></tr>
|
||||
|
||||
<tr class=alt><td>nominalAnnualInterestRate</td></tr>
|
||||
<tr><td class=fielddesc>The default interest rate set when creating savings accounts of this type of product. e.g. <b>5</b>% Per year - It number here is always expressed as the Nominal APR.</td></tr>
|
||||
|
||||
@@ -11655,7 +11669,7 @@ Content-Type: application/json
|
||||
<table class=matrixHeading>
|
||||
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Mandatory Fields</div></td></tr>
|
||||
<tr class=alt>
|
||||
<td>name, description, currencyCode, digitsAfterDecimal, nominalAnnualInterestRate,
|
||||
<td>name, description, currencyCode, digitsAfterDecimal,inMulitplesOf, nominalAnnualInterestRate,
|
||||
interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType,accountingRule</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -11682,6 +11696,7 @@ Request Body:
|
||||
"description": "Daily compounding using Daily Balance, 5% per year, 365 days in year",
|
||||
"currencyCode": "USD",
|
||||
"digitsAfterDecimal": 2,
|
||||
"inMulitplesOf": 0,
|
||||
"locale": "en",
|
||||
"nominalAnnualInterestRate": "5.0",
|
||||
"interestCompoundingPeriodType": 1,
|
||||
@@ -11705,6 +11720,7 @@ Request Body:
|
||||
"description": "A savings product",
|
||||
"currencyCode": "USD",
|
||||
"digitsAfterDecimal": "2",
|
||||
"inMulitplesOf": 0,
|
||||
"nominalAnnualInterestRate": "15",
|
||||
"interestCompoundingPeriodType": "1",
|
||||
"interestPostingPeriodType": "4",
|
||||
@@ -12888,6 +12904,71 @@ No Request Body:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="savingsaccounts_transaction" name="savingsaccounts_transaction" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h2>Retrieve Savings Account Transaction:</h2>
|
||||
<p>This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:
|
||||
<ul>
|
||||
<li class=normalli>Field Defaults</li>
|
||||
<li class=normalli>Allowed Value Lists</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p>Example Requests: </p>
|
||||
<div class=apiClick>savingsaccounts/1/transactions/1</div>
|
||||
<br/>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">GET https://Domain Name/api/v1/savingsaccounts/{accountId}/transactions/{transactionId}
|
||||
</code>
|
||||
<code class="method-response">
|
||||
{
|
||||
"id": 1,
|
||||
"transactionType": {
|
||||
"id": 2,
|
||||
"code": "savingsAccountTransactionType.withdrawal",
|
||||
"value": "Withdrawal",
|
||||
"deposit": false,
|
||||
"withdrawal": true,
|
||||
"interestPosting": false,
|
||||
"feeDeduction": false
|
||||
},
|
||||
"accountId": 1,
|
||||
"accountNo": "000000001",
|
||||
"date": [
|
||||
2013,
|
||||
8,
|
||||
7
|
||||
],
|
||||
"currency": {
|
||||
"code": "USD",
|
||||
"name": "US Dollar",
|
||||
"decimalPlaces": 2,
|
||||
"inMulitplesOf": 0,
|
||||
"displaySymbol": "$",
|
||||
"nameCode": "currency.USD",
|
||||
"displayLabel": "US Dollar ($)"
|
||||
},
|
||||
"paymentDetailData": {
|
||||
"id": 62,
|
||||
"paymentType": {
|
||||
"id": 11,
|
||||
"name": "cash"
|
||||
},
|
||||
"accountNumber": "",
|
||||
"checkNumber": "",
|
||||
"routingCode": "",
|
||||
"receiptNumber": "",
|
||||
"bankNumber": ""
|
||||
},
|
||||
"amount": 5000,
|
||||
"runningBalance": 0,
|
||||
"reversed": true
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="savingsaccounts_deposit" name="savingsaccounts_deposit" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
@@ -12970,6 +13051,49 @@ No Request Body:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a id="savingsaccounts_adjusttransaction" name="savingsaccounts_adjusttransaction" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
<h2>Adjust Transaction</h2>
|
||||
<p>This command modifies the given transaction.</p>
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">POST https://Domain Name/api/v1/savingsaccounts/{accountsId}/transactions/{transactionId}?command=modify</code>
|
||||
<code class="method-request">POST savingsaccounts/1/transactions/1?command=modify
|
||||
Content-Type: application/json
|
||||
No Request Body:
|
||||
{
|
||||
"locale": "en",
|
||||
"dateFormat": "dd MMMM yyyy",
|
||||
"transactionDate": "27 May 2013",
|
||||
"transactionAmount": "500",
|
||||
"paymentTypeId": "14",
|
||||
"accountNumber": "acc123",
|
||||
"checkNumber": "che123",
|
||||
"routingCode": "rou123",
|
||||
"receiptNumber": "rec123",
|
||||
"bankNumber": "ban123"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">
|
||||
{
|
||||
"officeId": 1,
|
||||
"clientId": 2,
|
||||
"savingsId": 1,
|
||||
"resourceId": 48,
|
||||
"changes": {
|
||||
"accountNumber": "acc123",
|
||||
"checkNumber": "che123",
|
||||
"routingCode": "rou123",
|
||||
"receiptNumber": "rec123",
|
||||
"bankNumber": "ban123"
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<a id="savingsaccounts_undotransaction" name="savingsaccounts_undotransaction" class="old-syle-anchor"> </a>
|
||||
<div class="method-section">
|
||||
<div class="method-description">
|
||||
@@ -19699,6 +19823,14 @@ GET https://DomainName/api/v1/search?query=000000111
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<td></td>
|
||||
<td>savingsaccounts/{accountId}/transactions/{transactionId}?command=modify</td>
|
||||
<td><a href="#savingsaccounts_adjusttransaction">Adjust transaction</a></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>savingsaccounts/{accountId}/transactions/template</td>
|
||||
@@ -19707,6 +19839,14 @@ GET https://DomainName/api/v1/search?query=000000111
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>savingsaccounts/{accountId}/transactions/{transactionId}</td>
|
||||
<td></td>
|
||||
<td><a href="#savingsaccounts_transaction">Retrieve savings account transaction</a></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="alt">
|
||||
<td><a href="#accounttransfers">Account Transfers</a></td>
|
||||
<td>accounttransfers/</td>
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
ALTER TABLE `m_savings_account`
|
||||
ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `currency_digits`;
|
||||
ALTER TABLE `m_savings_product`
|
||||
ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `currency_digits`;
|
||||
ALTER TABLE `m_loan`
|
||||
ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `currency_digits`;
|
||||
ALTER TABLE `m_product_loan`
|
||||
ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `currency_digits`;
|
||||
ALTER TABLE `m_currency`
|
||||
ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `decimal_places`;
|
||||
ALTER TABLE `m_organisation_currency`
|
||||
ADD COLUMN `currency_multiplesof` SMALLINT(5) NULL AFTER `decimal_places`;
|
||||
+8
-2
@@ -13,6 +13,7 @@ public class CurrencyData {
|
||||
private final String code;
|
||||
private final String name;
|
||||
private final int decimalPlaces;
|
||||
private final Integer inMulitplesOf;
|
||||
private final String displaySymbol;
|
||||
@SuppressWarnings("unused")
|
||||
private final String nameCode;
|
||||
@@ -20,13 +21,14 @@ public class CurrencyData {
|
||||
private final String displayLabel;
|
||||
|
||||
public static CurrencyData blank() {
|
||||
return new CurrencyData("", "", 0, "", "");
|
||||
return new CurrencyData("", "", 0,0, "", "");
|
||||
}
|
||||
|
||||
public CurrencyData(final String code, final String name, final int decimalPlaces, final String displaySymbol, final String nameCode) {
|
||||
public CurrencyData(final String code, final String name, final int decimalPlaces,final Integer inMulitplesOf, final String displaySymbol, final String nameCode) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.decimalPlaces = decimalPlaces;
|
||||
this.inMulitplesOf = inMulitplesOf;
|
||||
this.displaySymbol = displaySymbol;
|
||||
this.nameCode = nameCode;
|
||||
this.displayLabel = generateDisplayLabel();
|
||||
@@ -40,6 +42,10 @@ public class CurrencyData {
|
||||
return this.decimalPlaces;
|
||||
}
|
||||
|
||||
public Integer currencyInMulitplesOf() {
|
||||
return this.inMulitplesOf;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
CurrencyData currencyData = (CurrencyData) obj;
|
||||
|
||||
+18
-8
@@ -23,6 +23,9 @@ public class ApplicationCurrency extends AbstractPersistable<Long> {
|
||||
@Column(name = "decimal_places", nullable = false)
|
||||
private final Integer decimalPlaces;
|
||||
|
||||
@Column(name = "currency_multiplesof")
|
||||
private final Integer inMulitplesOf;
|
||||
|
||||
@Column(name = "name", nullable = false, length = 50)
|
||||
private final String name;
|
||||
|
||||
@@ -36,19 +39,22 @@ public class ApplicationCurrency extends AbstractPersistable<Long> {
|
||||
this.code = null;
|
||||
this.name = null;
|
||||
this.decimalPlaces = null;
|
||||
this.inMulitplesOf = null;
|
||||
this.nameCode = null;
|
||||
this.displaySymbol = null;
|
||||
}
|
||||
|
||||
public static ApplicationCurrency from(final ApplicationCurrency currency, final int decimalPlaces) {
|
||||
return new ApplicationCurrency(currency.code, currency.name, decimalPlaces, currency.nameCode, currency.displaySymbol);
|
||||
public static ApplicationCurrency from(final ApplicationCurrency currency, final int decimalPlaces, final Integer inMulitplesOf) {
|
||||
return new ApplicationCurrency(currency.code, currency.name, decimalPlaces, inMulitplesOf, currency.nameCode,
|
||||
currency.displaySymbol);
|
||||
}
|
||||
|
||||
private ApplicationCurrency(final String code, final String name, final int decimalPlaces, final String nameCode,
|
||||
final String displaySymbol) {
|
||||
private ApplicationCurrency(final String code, final String name, final int decimalPlaces, final Integer inMulitplesOf,
|
||||
final String nameCode, final String displaySymbol) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.decimalPlaces = decimalPlaces;
|
||||
this.inMulitplesOf = inMulitplesOf;
|
||||
this.nameCode = nameCode;
|
||||
this.displaySymbol = displaySymbol;
|
||||
}
|
||||
@@ -65,6 +71,10 @@ public class ApplicationCurrency extends AbstractPersistable<Long> {
|
||||
return this.decimalPlaces;
|
||||
}
|
||||
|
||||
public Integer getCurrencyInMulitplesOf() {
|
||||
return this.inMulitplesOf;
|
||||
}
|
||||
|
||||
public String getNameCode() {
|
||||
return nameCode;
|
||||
}
|
||||
@@ -74,14 +84,14 @@ public class ApplicationCurrency extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
public CurrencyData toData() {
|
||||
return new CurrencyData(this.code, this.name, this.decimalPlaces, this.displaySymbol, this.nameCode);
|
||||
return new CurrencyData(this.code, this.name, this.decimalPlaces, this.inMulitplesOf, this.displaySymbol, this.nameCode);
|
||||
}
|
||||
|
||||
public CurrencyData toData(final int digitsAfterDecimalSupported) {
|
||||
return new CurrencyData(this.code, this.name, digitsAfterDecimalSupported, this.displaySymbol, this.nameCode);
|
||||
public CurrencyData toData(final int digitsAfterDecimalSupported, final Integer inMulitplesOf) {
|
||||
return new CurrencyData(this.code, this.name, digitsAfterDecimalSupported, inMulitplesOf, this.displaySymbol, this.nameCode);
|
||||
}
|
||||
|
||||
public OrganisationCurrency toOrganisationCurrency() {
|
||||
return new OrganisationCurrency(this.code, this.name, this.decimalPlaces, this.nameCode, this.displaySymbol);
|
||||
return new OrganisationCurrency(this.code, this.name, this.decimalPlaces,this.inMulitplesOf, this.nameCode, this.displaySymbol);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class ApplicationCurrencyRepositoryWrapper {
|
||||
if (defaultApplicationCurrency == null) { throw new CurrencyNotFoundException(currency.getCode()); }
|
||||
|
||||
final ApplicationCurrency applicationCurrency = ApplicationCurrency.from(defaultApplicationCurrency,
|
||||
currency.getDigitsAfterDecimal());
|
||||
currency.getDigitsAfterDecimal(),currency.getCurrencyInMulitplesOf());
|
||||
|
||||
return applicationCurrency;
|
||||
}
|
||||
|
||||
+11
-2
@@ -17,18 +17,23 @@ public class MonetaryCurrency {
|
||||
@Column(name = "currency_digits", nullable = false)
|
||||
private final int digitsAfterDecimal;
|
||||
|
||||
@Column(name = "currency_multiplesof")
|
||||
private final Integer inMulitplesOf;
|
||||
|
||||
protected MonetaryCurrency() {
|
||||
this.code = null;
|
||||
this.digitsAfterDecimal = 0;
|
||||
this.inMulitplesOf = 0;
|
||||
}
|
||||
|
||||
public MonetaryCurrency(final String code, final int digitsAfterDecimal) {
|
||||
public MonetaryCurrency(final String code, final int digitsAfterDecimal,final Integer inMulitplesOf) {
|
||||
this.code = code;
|
||||
this.digitsAfterDecimal = digitsAfterDecimal;
|
||||
this.inMulitplesOf = inMulitplesOf;
|
||||
}
|
||||
|
||||
public MonetaryCurrency copy() {
|
||||
return new MonetaryCurrency(this.code, this.digitsAfterDecimal);
|
||||
return new MonetaryCurrency(this.code, this.digitsAfterDecimal,this.inMulitplesOf);
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
@@ -38,4 +43,8 @@ public class MonetaryCurrency {
|
||||
public int getDigitsAfterDecimal() {
|
||||
return digitsAfterDecimal;
|
||||
}
|
||||
|
||||
public Integer getCurrencyInMulitplesOf() {
|
||||
return inMulitplesOf;
|
||||
}
|
||||
}
|
||||
+32
-24
@@ -21,6 +21,9 @@ public class Money implements Comparable<Money> {
|
||||
@Column(name = "currency_digits")
|
||||
private final int currencyDigitsAfterDecimal;
|
||||
|
||||
@Column(name = "currency_multiplesof")
|
||||
private final Integer inMulitplesOf;
|
||||
|
||||
@Column(name = "amount", scale = 6, precision = 19)
|
||||
private final BigDecimal amount;
|
||||
|
||||
@@ -44,46 +47,47 @@ public class Money implements Comparable<Money> {
|
||||
}
|
||||
|
||||
public static Money of(final MonetaryCurrency currency, final BigDecimal newAmount) {
|
||||
return new Money(currency.getCode(), currency.getDigitsAfterDecimal(), defaultToZeroIfNull(newAmount));
|
||||
return new Money(currency.getCode(), currency.getDigitsAfterDecimal(), defaultToZeroIfNull(newAmount),
|
||||
currency.getCurrencyInMulitplesOf());
|
||||
}
|
||||
|
||||
public static Money zero(final MonetaryCurrency currency) {
|
||||
return new Money(currency.getCode(), currency.getDigitsAfterDecimal(), BigDecimal.ZERO);
|
||||
return new Money(currency.getCode(), currency.getDigitsAfterDecimal(), BigDecimal.ZERO, currency.getCurrencyInMulitplesOf());
|
||||
}
|
||||
|
||||
protected Money() {
|
||||
this.currencyCode = null;
|
||||
this.currencyDigitsAfterDecimal = 0;
|
||||
this.inMulitplesOf = 0;
|
||||
this.amount = null;
|
||||
}
|
||||
|
||||
private Money(final String currencyCode, final int digitsAfterDecimal, final BigDecimal amount) {
|
||||
private Money(final String currencyCode, final int digitsAfterDecimal, final BigDecimal amount, final Integer inMulitplesOf) {
|
||||
this.currencyCode = currencyCode;
|
||||
this.currencyDigitsAfterDecimal = digitsAfterDecimal;
|
||||
this.inMulitplesOf = inMulitplesOf;
|
||||
|
||||
final BigDecimal amountZeroed = defaultToZeroIfNull(amount);
|
||||
final BigDecimal amountStripped = amountZeroed.stripTrailingZeros();
|
||||
final BigDecimal amountScaled = amountStripped.setScale(this.currencyDigitsAfterDecimal, RoundingMode.HALF_EVEN);
|
||||
this.amount = amountScaled;
|
||||
|
||||
// TODO - KW - below was test of using floor/ceil functions to support
|
||||
// round monetary amounts into multiples of say 20/50.
|
||||
// if (this.currencyDigitsAfterDecimal == 0) {
|
||||
// double existingVal = amountScaled.doubleValue();
|
||||
// double ceilingOfValue = ceiling(existingVal, Double.valueOf("20.0"));
|
||||
// double floorOfValue = floor(existingVal, Double.valueOf("20.0"));
|
||||
//
|
||||
// double floorDiff = existingVal - floorOfValue;
|
||||
// double ceilDiff = ceilingOfValue - existingVal;
|
||||
//
|
||||
// if (ceilDiff > floorDiff) {
|
||||
// this.amount = BigDecimal.valueOf(floorOfValue);
|
||||
// } else {
|
||||
// this.amount = BigDecimal.valueOf(ceilingOfValue);
|
||||
// }
|
||||
// } else {
|
||||
// this.amount = amountScaled;
|
||||
// }
|
||||
// round monetary amounts into multiplesof say 20/50.
|
||||
if (inMulitplesOf!= null && this.currencyDigitsAfterDecimal == 0 && inMulitplesOf>0 && amountScaled.doubleValue()>0) {
|
||||
double existingVal = amountScaled.doubleValue();
|
||||
double ceilingOfValue = ceiling(existingVal, inMulitplesOf);
|
||||
double floorOfValue = floor(existingVal, inMulitplesOf);
|
||||
|
||||
double floorDiff = existingVal - floorOfValue;
|
||||
double ceilDiff = ceilingOfValue - existingVal;
|
||||
|
||||
if (ceilDiff > floorDiff) {
|
||||
this.amount = BigDecimal.valueOf(floorOfValue);
|
||||
} else {
|
||||
this.amount = BigDecimal.valueOf(ceilingOfValue);
|
||||
}
|
||||
} else {
|
||||
this.amount = amountScaled;
|
||||
}
|
||||
}
|
||||
|
||||
public static double ceiling(final double n, final double s) {
|
||||
@@ -119,7 +123,7 @@ public class Money implements Comparable<Money> {
|
||||
}
|
||||
|
||||
public Money copy() {
|
||||
return new Money(this.currencyCode, this.currencyDigitsAfterDecimal, this.amount.stripTrailingZeros());
|
||||
return new Money(this.currencyCode, this.currencyDigitsAfterDecimal, this.amount.stripTrailingZeros(), this.inMulitplesOf);
|
||||
}
|
||||
|
||||
public Money plus(final Iterable<? extends Money> moniesToAdd) {
|
||||
@@ -263,6 +267,10 @@ public class Money implements Comparable<Money> {
|
||||
return this.currencyDigitsAfterDecimal;
|
||||
}
|
||||
|
||||
public int getCurrencyInMulitplesOf() {
|
||||
return this.inMulitplesOf;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
@@ -298,7 +306,7 @@ public class Money implements Comparable<Money> {
|
||||
}
|
||||
|
||||
private MonetaryCurrency monetaryCurrency() {
|
||||
return new MonetaryCurrency(this.currencyCode, this.currencyDigitsAfterDecimal);
|
||||
return new MonetaryCurrency(this.currencyCode, this.currencyDigitsAfterDecimal, this.inMulitplesOf);
|
||||
}
|
||||
|
||||
public Money zero() {
|
||||
|
||||
+3
-2
@@ -58,14 +58,15 @@ public class CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformServ
|
||||
final String code = rs.getString("code");
|
||||
final String name = rs.getString("name");
|
||||
final int decimalPlaces = JdbcSupport.getInteger(rs, "decimalPlaces");
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
final String displaySymbol = rs.getString("displaySymbol");
|
||||
final String nameCode = rs.getString("nameCode");
|
||||
|
||||
return new CurrencyData(code, name, decimalPlaces, displaySymbol, nameCode);
|
||||
return new CurrencyData(code, name, decimalPlaces, inMulitplesOf, displaySymbol, nameCode);
|
||||
}
|
||||
|
||||
public String schema() {
|
||||
return " c.code as code, c.name as name, c.decimal_places as decimalPlaces, c.display_symbol as displaySymbol, c.internationalized_name_code as nameCode ";
|
||||
return " c.code as code, c.name as name, c.decimal_places as decimalPlaces,c.currency_multiplesof as inMulitplesOf, c.display_symbol as displaySymbol, c.internationalized_name_code as nameCode ";
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -41,7 +41,7 @@ import org.springframework.stereotype.Component;
|
||||
public class OfficeTransactionsApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "transactionDate", "fromOfficeId",
|
||||
"fromOfficeName", "toOfficeId", "toOfficeIdName", "currencyCode", "digitsAfterDecimal", "transactionAmount", "description",
|
||||
"fromOfficeName", "toOfficeId", "toOfficeIdName", "currencyCode", "digitsAfterDecimal","inMulitplesOf", "transactionAmount", "description",
|
||||
"allowedOffices", "currencyOptions"));
|
||||
|
||||
private final String resourceNameForReadPermissions = "OFFICE";
|
||||
|
||||
+13
-2
@@ -18,18 +18,27 @@ import org.springframework.data.jpa.domain.AbstractPersistable;
|
||||
@Table(name = "m_organisation_currency")
|
||||
public class OrganisationCurrency extends AbstractPersistable<Long> {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "code", nullable = false, length = 3)
|
||||
private final String code;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "decimal_places", nullable = false)
|
||||
private final Integer decimalPlaces;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "currency_multiplesof")
|
||||
private final Integer inMulitplesOf;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "name", nullable = false, length = 50)
|
||||
private final String name;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "internationalized_name_code", nullable = false, length = 50)
|
||||
private final String nameCode;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Column(name = "display_symbol", nullable = true, length = 10)
|
||||
private final String displaySymbol;
|
||||
|
||||
@@ -37,15 +46,17 @@ public class OrganisationCurrency extends AbstractPersistable<Long> {
|
||||
this.code = null;
|
||||
this.name = null;
|
||||
this.decimalPlaces = null;
|
||||
this.inMulitplesOf = null;
|
||||
this.nameCode = null;
|
||||
this.displaySymbol = null;
|
||||
}
|
||||
|
||||
public OrganisationCurrency(final String code, final String name, final int decimalPlaces, final String nameCode,
|
||||
final String displaySymbol) {
|
||||
public OrganisationCurrency(final String code, final String name, final int decimalPlaces, final Integer inMulitplesOf,
|
||||
final String nameCode, final String displaySymbol) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
this.decimalPlaces = decimalPlaces;
|
||||
this.inMulitplesOf = inMulitplesOf;
|
||||
this.nameCode = nameCode;
|
||||
this.displaySymbol = displaySymbol;
|
||||
}
|
||||
|
||||
+4
-3
@@ -90,7 +90,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
public String schema() {
|
||||
return " ot.id as id, ot.transaction_date as transactionDate, ot.from_office_id as fromOfficeId, fromoff.name as fromOfficeName, "
|
||||
+ " ot.to_office_id as toOfficeId, tooff.name as toOfficeName, ot.transaction_amount as transactionAmount, ot.description as description, "
|
||||
+ " ot.currency_code as currencyCode, rc.decimal_places as currencyDigits, "
|
||||
+ " ot.currency_code as currencyCode, rc.decimal_places as currencyDigits, rc.currency_multiplesof as inMulitplesOf, "
|
||||
+ " rc.name as currencyName, rc.internationalized_name_code as currencyNameCode, rc.display_symbol as currencyDisplaySymbol "
|
||||
+ " from m_office_transaction ot "
|
||||
+ " left join m_office fromoff on fromoff.id = ot.from_office_id "
|
||||
@@ -112,9 +112,10 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
String currencyNameCode = rs.getString("currencyNameCode");
|
||||
String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
|
||||
CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
BigDecimal transactionAmount = rs.getBigDecimal("transactionAmount");
|
||||
String description = rs.getString("description");
|
||||
|
||||
+1
-1
@@ -159,7 +159,7 @@ public class OfficeWritePlatformServiceJpaRepositoryImpl implements OfficeWriteP
|
||||
final String currencyCode = command.stringValueOfParameterNamed("currencyCode");
|
||||
final ApplicationCurrency appCurrency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currencyCode);
|
||||
|
||||
final MonetaryCurrency currency = new MonetaryCurrency(appCurrency.getCode(), appCurrency.getDecimalPlaces());
|
||||
final MonetaryCurrency currency = new MonetaryCurrency(appCurrency.getCode(), appCurrency.getDecimalPlaces(),appCurrency.getCurrencyInMulitplesOf());
|
||||
final Money amount = Money.of(currency, command.bigDecimalValueOfParameterNamed("transactionAmount"));
|
||||
|
||||
final OfficeTransaction entity = OfficeTransaction.fromJson(fromOffice, toOffice, amount, command);
|
||||
|
||||
+5
-3
@@ -107,7 +107,8 @@ public class AccountDetailsReadPlatformServiceJpaRepositoryImpl implements Accou
|
||||
accountsSummary.append("sa.id as id, sa.account_no as accountNo, sa.external_id as externalId, sa.status_enum as statusEnum, ");
|
||||
accountsSummary.append("sa.account_type_enum as accountType, ");
|
||||
accountsSummary.append("sa.account_balance_derived as accountBalance, ");
|
||||
accountsSummary.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits, ");
|
||||
accountsSummary
|
||||
.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits, sa.currency_multiplesof as inMulitplesOf, ");
|
||||
accountsSummary.append("curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ");
|
||||
accountsSummary.append("curr.display_symbol as currencyDisplaySymbol, ");
|
||||
accountsSummary.append("sa.product_id as productId, p.name as productName ");
|
||||
@@ -141,8 +142,9 @@ public class AccountDetailsReadPlatformServiceJpaRepositoryImpl implements Accou
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
return new SavingsAccountSummaryData(id, accountNo, externalId, productId, productName, status, currency, accountBalance,
|
||||
accountTypeData);
|
||||
|
||||
+6
-4
@@ -206,12 +206,13 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
|
||||
|
||||
private final String schemaSql;
|
||||
|
||||
public AccountTransfersMapper() {
|
||||
public AccountTransfersMapper() {
|
||||
final StringBuilder sqlBuilder = new StringBuilder(400);
|
||||
sqlBuilder.append("sat.id as id, sat.is_reversed as isReversed,");
|
||||
sqlBuilder.append("sat.transaction_date as transferDate, sat.amount as transferAmount,");
|
||||
sqlBuilder.append("sat.description as transferDescription,");
|
||||
sqlBuilder.append("sat.currency_code as currencyCode, sat.currency_digits as currencyDigits,");
|
||||
sqlBuilder
|
||||
.append("sat.currency_code as currencyCode, sat.currency_digits as currencyDigits, sat.currency_multiplesof as inMulitplesOf, ");
|
||||
sqlBuilder.append("curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ");
|
||||
sqlBuilder.append("curr.display_symbol as currencyDisplaySymbol, ");
|
||||
sqlBuilder.append("fromoff.id as fromOfficeId, fromoff.name as fromOfficeName,");
|
||||
@@ -257,8 +258,9 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
final Long fromOfficeId = JdbcSupport.getLong(rs, "fromOfficeId");
|
||||
final String fromOfficeName = rs.getString("fromOfficeName");
|
||||
|
||||
+1
-1
@@ -229,7 +229,7 @@ public class Charge extends AbstractPersistable<Long> {
|
||||
EnumOptionData chargeAppliesTo = ChargeEnumerations.chargeAppliesTo(this.chargeAppliesTo);
|
||||
EnumOptionData chargeCalculationType = ChargeEnumerations.chargeCalculationType(this.chargeCalculation);
|
||||
|
||||
CurrencyData currency = new CurrencyData(this.currencyCode, null, 0, null, null);
|
||||
CurrencyData currency = new CurrencyData(this.currencyCode, null, 0, 0, null, null);
|
||||
return ChargeData.instance(this.getId(), this.name, this.amount, currency, chargeTimeType, chargeAppliesTo, chargeCalculationType,
|
||||
penalty, active);
|
||||
}
|
||||
|
||||
+5
-4
@@ -111,7 +111,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
|
||||
return this.jdbcTemplate.query(sql, rm, new Object[] { ChargeAppliesTo.LOAN.getValue() });
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<ChargeData> retrieveLoanApplicablePenalties() {
|
||||
this.context.authenticatedUser();
|
||||
@@ -129,7 +129,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
return "c.id as id, c.name as name, c.amount as amount, c.currency_code as currencyCode, "
|
||||
+ "c.charge_applies_to_enum as chargeAppliesTo, c.charge_time_enum as chargeTime, "
|
||||
+ "c.charge_calculation_enum as chargeCalculation, c.is_penalty as penalty, c.is_active as active, oc.name as currencyName, "
|
||||
+ "oc.decimal_places as currencyDecimalPlaces, oc.display_symbol as currencyDisplaySymbol, "
|
||||
+ "oc.decimal_places as currencyDecimalPlaces,oc.currency_multiplesof as inMulitplesOf, oc.display_symbol as currencyDisplaySymbol, "
|
||||
+ "oc.internationalized_name_code as currencyNameCode from m_charge c "
|
||||
+ "join m_organisation_currency oc on c.currency_code = oc.code";
|
||||
}
|
||||
@@ -149,9 +149,10 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDecimalPlaces = JdbcSupport.getInteger(rs, "currencyDecimalPlaces");
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDecimalPlaces, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDecimalPlaces, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
final int chargeAppliesTo = rs.getInt("chargeAppliesTo");
|
||||
final EnumOptionData chargeAppliesToType = ChargeEnumerations.chargeAppliesTo(chargeAppliesTo);
|
||||
|
||||
+4
-3
@@ -45,7 +45,7 @@ public class CollateralReadPlatformServiceImpl implements CollateralReadPlatform
|
||||
|
||||
private StringBuilder sqlBuilder = new StringBuilder(
|
||||
"lc.id as id, lc.description as description, lc.value as value, cv.id as typeId, cv.code_value as typeName, oc.code as currencyCode, ")
|
||||
.append(" oc.name as currencyName,oc.decimal_places as currencyDecimalPlaces, oc.display_symbol as currencyDisplaySymbol, oc.internationalized_name_code as currencyNameCode")
|
||||
.append(" oc.name as currencyName,oc.decimal_places as currencyDecimalPlaces, oc.currency_multiplesof as inMulitplesOf, oc.display_symbol as currencyDisplaySymbol, oc.internationalized_name_code as currencyNameCode")
|
||||
.append(" FROM m_loan_collateral lc") //
|
||||
.append(" JOIN m_code_value cv on lc.type_cv_id = cv.id")//
|
||||
.append(" JOIN m_loan loan on lc.loan_id = loan.id")//
|
||||
@@ -71,9 +71,10 @@ public class CollateralReadPlatformServiceImpl implements CollateralReadPlatform
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDecimalPlaces = JdbcSupport.getInteger(rs, "currencyDecimalPlaces");
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
|
||||
final CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDecimalPlaces, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDecimalPlaces, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
return CollateralData.instance(id, type, value, description, currencyData);
|
||||
}
|
||||
|
||||
+25
-19
@@ -52,7 +52,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
|
||||
@Autowired
|
||||
public CollectionSheetReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource,
|
||||
final CenterReadPlatformService centerReadPlatformService, final GroupReadPlatformService groupReadPlatformService, final CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer) {
|
||||
final CenterReadPlatformService centerReadPlatformService, final GroupReadPlatformService groupReadPlatformService,
|
||||
final CollectionSheetGenerateCommandFromApiJsonDeserializer collectionSheetGenerateCommandFromApiJsonDeserializer) {
|
||||
this.context = context;
|
||||
this.centerReadPlatformService = centerReadPlatformService;
|
||||
this.namedParameterjdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
|
||||
@@ -69,9 +70,10 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
|
||||
final CenterData center = this.centerReadPlatformService.retrieveOne(centerId);
|
||||
final String groupHierarchy = center.getHierarchy() + "%";
|
||||
|
||||
Collection<JLGCollectionSheetFlatData> collectionSheetFlatDatas = this.retriveJLGCollectionSheet(groupHierarchy, officeHierarchy, dueDate);
|
||||
|
||||
|
||||
Collection<JLGCollectionSheetFlatData> collectionSheetFlatDatas = this.retriveJLGCollectionSheet(groupHierarchy, officeHierarchy,
|
||||
dueDate);
|
||||
|
||||
final JLGCollectionSheetData jlgCollectionSheetData = buildJLGCollectionSheet(dueDate, collectionSheetFlatDatas);
|
||||
|
||||
return jlgCollectionSheetData;
|
||||
@@ -83,7 +85,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
* Groups >> Clients >> Loans.
|
||||
*/
|
||||
@SuppressWarnings("null")
|
||||
private JLGCollectionSheetData buildJLGCollectionSheet(final LocalDate dueDate, final Collection<JLGCollectionSheetFlatData> jlgCollectionSheetFlatData) {
|
||||
private JLGCollectionSheetData buildJLGCollectionSheet(final LocalDate dueDate,
|
||||
final Collection<JLGCollectionSheetFlatData> jlgCollectionSheetFlatData) {
|
||||
|
||||
boolean firstTime = true;
|
||||
Long prevGroupId = null;
|
||||
@@ -101,9 +104,9 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
|
||||
for (final JLGCollectionSheetFlatData collectionSheetFlatData : jlgCollectionSheetFlatData) {
|
||||
|
||||
if(collectionSheetFlatData.getProductId() !=null){
|
||||
if (collectionSheetFlatData.getProductId() != null) {
|
||||
loanProducts.add(LoanProductData.lookupWithCurrency(collectionSheetFlatData.getProductId(),
|
||||
collectionSheetFlatData.getProductShortName(), collectionSheetFlatData.getCurrency()));
|
||||
collectionSheetFlatData.getProductShortName(), collectionSheetFlatData.getCurrency()));
|
||||
}
|
||||
corrCollectioSheetFlatData = collectionSheetFlatData;
|
||||
|
||||
@@ -197,7 +200,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
+ "ln.loan_status_id As accountStatusId, "
|
||||
+ "pl.name As productShortName, "
|
||||
+ "ln.product_id As productId, "
|
||||
+ "ln.currency_code as currencyCode, ln.currency_digits as currencyDigits, rc.`name` as currencyName, rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode, "
|
||||
+ "ln.currency_code as currencyCode, ln.currency_digits as currencyDigits, ln.currency_multiplesof as inMulitplesOf, rc.`name` as currencyName, rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode, "
|
||||
+ "if(ln.loan_status_id = 200 , ln.principal_amount , null) As disbursementAmount, "
|
||||
+ "sum(ifnull(if(ln.loan_status_id = 300, ls.principal_amount, 0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.principal_completed_derived, 0.0), 0.0)) As principalDue, "
|
||||
+ "ln.principal_repaid_derived As principalPaid, "
|
||||
@@ -206,7 +209,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
+ "sum(if(ln.loan_status_id = 300, lc.amount_outstanding_derived, 0.0)) as chargesDue "
|
||||
+ "FROM m_group gp "
|
||||
+ "LEFT JOIN m_office of ON of.id = gp.office_id AND of.hierarchy like :officeHierarchy "
|
||||
//+ "LEFT JOIN m_office of ON of.id = gp.office_id "
|
||||
// + "LEFT JOIN m_office of ON of.id = gp.office_id "
|
||||
+ "JOIN m_group_level gl ON gl.id = gp.level_Id "
|
||||
+ "LEFT JOIN m_staff sf ON sf.id = gp.staff_id "
|
||||
+ "JOIN m_group_client gc ON gc.group_id = gp.id "
|
||||
@@ -216,7 +219,9 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
+ "JOIN m_currency rc on rc.`code` = ln.currency_code "
|
||||
+ "LEFT JOIN m_loan_repayment_schedule ls ON ls.loan_id = ln.id AND ls.completed_derived = 0 AND ls.duedate <= :dueDate "
|
||||
+ "LEFT JOIN m_loan_charge lc ON lc.loan_id = ln.id AND lc.is_paid_derived = 0 AND ( lc.due_for_collection_as_of_date <= :dueDate OR lc.charge_time_enum = 1) ";
|
||||
//+ "WHERE gp.hierarchy like :hierarchy " + "GROUP BY gp.id ,cl.id , ln.id " + "ORDER BY gp.id , cl.id , ln.id ";
|
||||
// + "WHERE gp.hierarchy like :hierarchy " +
|
||||
// "GROUP BY gp.id ,cl.id , ln.id " +
|
||||
// "ORDER BY gp.id , cl.id , ln.id ";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,9 +246,10 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
CurrencyData currencyData = null;
|
||||
if(currencyCode != null){
|
||||
currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
if (currencyCode != null) {
|
||||
currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
}
|
||||
|
||||
@@ -263,7 +269,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
|
||||
@Override
|
||||
public JLGCollectionSheetData generateGroupCollectionSheet(final Long groupId, final JsonQuery query) {
|
||||
|
||||
|
||||
this.collectionSheetGenerateCommandFromApiJsonDeserializer.validateForGenerateCollectionSheet(query.json());
|
||||
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
@@ -281,18 +287,18 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
String sql = mapper.collectionSheetSchema();
|
||||
sql += "WHERE gp.id = :groupId GROUP BY gp.id ,cl.id , ln.id ORDER BY gp.id , cl.id , ln.id";
|
||||
|
||||
final SqlParameterSource namedParameters = new MapSqlParameterSource().addValue("dueDate", dueDateStr).addValue("groupId", group.getId())
|
||||
.addValue("officeHierarchy", officeHierarchy);
|
||||
final SqlParameterSource namedParameters = new MapSqlParameterSource().addValue("dueDate", dueDateStr)
|
||||
.addValue("groupId", group.getId()).addValue("officeHierarchy", officeHierarchy);
|
||||
|
||||
final Collection<JLGCollectionSheetFlatData> collectionSheetFlatDatas = this.namedParameterjdbcTemplate.query(sql, namedParameters,
|
||||
mapper);
|
||||
|
||||
return buildJLGCollectionSheet(dueDate, collectionSheetFlatDatas);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JLGCollectionSheetData generateCenterCollectionSheet(final Long centerId, final JsonQuery query) {
|
||||
|
||||
|
||||
this.collectionSheetGenerateCommandFromApiJsonDeserializer.validateForGenerateCollectionSheet(query.json());
|
||||
|
||||
final AppUser currentUser = this.context.authenticatedUser();
|
||||
@@ -310,8 +316,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
|
||||
String sql = mapper.collectionSheetSchema();
|
||||
sql += "WHERE gp.parent_id = :centerId GROUP BY gp.id ,cl.id , ln.id ORDER BY gp.id , cl.id , ln.id";
|
||||
|
||||
final SqlParameterSource namedParameters = new MapSqlParameterSource().addValue("dueDate", dueDateStr).addValue("centerId", center.getId())
|
||||
.addValue("officeHierarchy", officeHierarchy);
|
||||
final SqlParameterSource namedParameters = new MapSqlParameterSource().addValue("dueDate", dueDateStr)
|
||||
.addValue("centerId", center.getId()).addValue("officeHierarchy", officeHierarchy);
|
||||
|
||||
final Collection<JLGCollectionSheetFlatData> collectionSheetFlatDatas = this.namedParameterjdbcTemplate.query(sql, namedParameters,
|
||||
mapper);
|
||||
|
||||
+26
-8
@@ -157,7 +157,7 @@ public final class LoanApplicationTerms {
|
||||
this.expectedDisbursementDate = expectedDisbursementDate;
|
||||
this.repaymentsStartingFromDate = repaymentsStartingFromDate;
|
||||
this.calculatedRepaymentsStartingFromDate = calculatedRepaymentsStartingFromDate;
|
||||
|
||||
|
||||
this.principalGrace = principalGrace;
|
||||
this.interestPaymentGrace = interestPaymentGrace;
|
||||
this.interestChargingGrace = interestChargingGrace;
|
||||
@@ -172,7 +172,15 @@ public final class LoanApplicationTerms {
|
||||
Money adjusted = principalForPeriod;
|
||||
|
||||
// adjust cumulative fields for principal & interest if needed
|
||||
if (isLastRepaymentPeriod(this.numberOfRepayments, periodNumber)) {
|
||||
if (this.principal.getAmount().subtract(totalCumulativePrincipalToDate.getAmount()).add(principalForPeriod.getAmount()).compareTo(principalForPeriod.getAmount()) == -1) {
|
||||
adjusted = adjusted.minus(adjusted);
|
||||
MonetaryCurrency monetaryCurrency = new MonetaryCurrency(adjusted.getCurrencyCode(), 0, principalForPeriod.getAmount().intValue());
|
||||
BigDecimal diff = this.principal.getAmount().subtract(totalCumulativePrincipalToDate.getAmount()).add(principalForPeriod.getAmount());
|
||||
if(diff.doubleValue()<0){
|
||||
diff = BigDecimal.ZERO;
|
||||
}
|
||||
adjusted = adjusted.plus(Money.of(monetaryCurrency,diff));
|
||||
} else if (isLastRepaymentPeriod(this.numberOfRepayments, periodNumber)) {
|
||||
|
||||
final Money difference = totalCumulativePrincipalToDate.minus(this.principal);
|
||||
if (difference.isLessThanZero()) {
|
||||
@@ -189,9 +197,16 @@ public final class LoanApplicationTerms {
|
||||
final Money totalInterestDueForLoan, final int periodNumber) {
|
||||
|
||||
Money adjusted = interestForThisPeriod;
|
||||
|
||||
if (isLastRepaymentPeriod(this.numberOfRepayments, periodNumber)) {
|
||||
|
||||
if (totalInterestDueForLoan.getAmount().subtract(totalCumulativeInterestToDate.getAmount()).add(interestForThisPeriod.getAmount())
|
||||
.compareTo(interestForThisPeriod.getAmount()) == -1) {
|
||||
adjusted = adjusted.minus(adjusted);
|
||||
MonetaryCurrency monetaryCurrency = new MonetaryCurrency(adjusted.getCurrencyCode(), 0, interestForThisPeriod.getAmount().intValue());
|
||||
BigDecimal diff = totalInterestDueForLoan.getAmount().subtract(totalCumulativeInterestToDate.getAmount()).add(interestForThisPeriod.getAmount());
|
||||
if(diff.doubleValue()<0){
|
||||
diff = BigDecimal.ZERO;
|
||||
}
|
||||
adjusted = adjusted.plus(Money.of(monetaryCurrency,diff));
|
||||
} else if (isLastRepaymentPeriod(this.numberOfRepayments, periodNumber)) {
|
||||
final Money interestDifference = totalCumulativeInterestToDate.minus(totalInterestDueForLoan);
|
||||
if (interestDifference.isLessThanZero()) {
|
||||
adjusted = interestForThisPeriod.plus(interestDifference.abs());
|
||||
@@ -199,7 +214,9 @@ public final class LoanApplicationTerms {
|
||||
adjusted = interestForThisPeriod.minus(interestDifference.abs());
|
||||
}
|
||||
}
|
||||
|
||||
if (adjusted.isLessThanZero()) {
|
||||
adjusted = adjusted.plus(adjusted);
|
||||
}
|
||||
return adjusted;
|
||||
}
|
||||
|
||||
@@ -618,7 +635,8 @@ public final class LoanApplicationTerms {
|
||||
}
|
||||
|
||||
public LoanProductRelatedDetail toLoanProductRelatedDetail() {
|
||||
final MonetaryCurrency currency = new MonetaryCurrency(this.currency.getCode(), this.currency.getDecimalPlaces());
|
||||
final MonetaryCurrency currency = new MonetaryCurrency(this.currency.getCode(), this.currency.getDecimalPlaces(),
|
||||
this.currency.getCurrencyInMulitplesOf());
|
||||
|
||||
return LoanProductRelatedDetail.createFrom(currency, this.principal.getAmount(), this.interestRatePerPeriod,
|
||||
this.interestRatePeriodFrequencyType, this.annualNominalInterestRate, this.interestMethod,
|
||||
@@ -690,7 +708,7 @@ public final class LoanApplicationTerms {
|
||||
public LocalDate getCalculatedRepaymentsStartingFromLocalDate() {
|
||||
return this.calculatedRepaymentsStartingFromDate;
|
||||
}
|
||||
|
||||
|
||||
public Money getPrincipal() {
|
||||
return this.principal;
|
||||
}
|
||||
|
||||
+2
-1
@@ -62,7 +62,8 @@ public final class LoanScheduleModel {
|
||||
public LoanScheduleData toData() {
|
||||
|
||||
final int decimalPlaces = this.totalPrincipalDisbursed.getCurrencyDigitsAfterDecimal();
|
||||
final CurrencyData currency = applicationCurrency.toData(decimalPlaces);
|
||||
final Integer inMulitplesOf = this.totalPrincipalDisbursed.getCurrencyInMulitplesOf();
|
||||
final CurrencyData currency = applicationCurrency.toData(decimalPlaces,inMulitplesOf);
|
||||
|
||||
final Collection<LoanSchedulePeriodData> periodsData = new ArrayList<LoanSchedulePeriodData>();
|
||||
for (LoanScheduleModelPeriod modelPeriod : this.periods) {
|
||||
|
||||
+14
-8
@@ -44,14 +44,19 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
|
||||
private static final class LoanChargeMapper implements RowMapper<LoanChargeData> {
|
||||
|
||||
public String schema() {
|
||||
return "lc.id as id, c.id as chargeId, c.name as name, " + "lc.amount as amountDue, "
|
||||
+ "lc.amount_paid_derived as amountPaid, " + "lc.amount_waived_derived as amountWaived, "
|
||||
+ "lc.amount_writtenoff_derived as amountWrittenOff, " + "lc.amount_outstanding_derived as amountOutstanding, "
|
||||
return "lc.id as id, c.id as chargeId, c.name as name, "
|
||||
+ "lc.amount as amountDue, "
|
||||
+ "lc.amount_paid_derived as amountPaid, "
|
||||
+ "lc.amount_waived_derived as amountWaived, "
|
||||
+ "lc.amount_writtenoff_derived as amountWrittenOff, "
|
||||
+ "lc.amount_outstanding_derived as amountOutstanding, "
|
||||
+ "lc.calculation_percentage as percentageOf, lc.calculation_on_amount as amountPercentageAppliedTo, "
|
||||
+ "lc.charge_time_enum as chargeTime, " + "lc.is_penalty as penalty, "
|
||||
+ "lc.due_for_collection_as_of_date as dueAsOfDate, " + "lc.charge_calculation_enum as chargeCalculation, "
|
||||
+ "lc.charge_time_enum as chargeTime, "
|
||||
+ "lc.is_penalty as penalty, "
|
||||
+ "lc.due_for_collection_as_of_date as dueAsOfDate, "
|
||||
+ "lc.charge_calculation_enum as chargeCalculation, "
|
||||
+ "c.currency_code as currencyCode, oc.name as currencyName, "
|
||||
+ "oc.decimal_places as currencyDecimalPlaces, oc.display_symbol as currencyDisplaySymbol, "
|
||||
+ "oc.decimal_places as currencyDecimalPlaces, oc.currency_multiplesof as inMulitplesOf, oc.display_symbol as currencyDisplaySymbol, "
|
||||
+ "oc.internationalized_name_code as currencyNameCode from m_charge c "
|
||||
+ "join m_organisation_currency oc on c.currency_code = oc.code " + "join m_loan_charge lc on lc.charge_id = c.id ";
|
||||
}
|
||||
@@ -76,9 +81,10 @@ public class LoanChargeReadPlatformServiceImpl implements LoanChargeReadPlatform
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDecimalPlaces = JdbcSupport.getInteger(rs, "currencyDecimalPlaces");
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDecimalPlaces, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDecimalPlaces, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
final int chargeTime = rs.getInt("chargeTime");
|
||||
final EnumOptionData chargeTimeType = ChargeEnumerations.chargeTimeType(chargeTime);
|
||||
|
||||
+21
-16
@@ -349,7 +349,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
context.authenticatedUser();
|
||||
|
||||
final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.WRITEOFF);
|
||||
return new LoanTransactionData(null, transactionType, null, null, DateUtils.getLocalDateOfTenant(), null, null, null, null, null, null);
|
||||
return new LoanTransactionData(null, transactionType, null, null, DateUtils.getLocalDateOfTenant(), null, null, null, null, null,
|
||||
null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -409,7 +410,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
+ " l.amortization_method_enum as amortizationType, l.interest_method_enum as interestType, l.interest_calculated_in_period_enum as interestCalculationPeriodType,"
|
||||
+ " l.loan_status_id as lifeCycleStatusId, l.loan_transaction_strategy_id as transactionStrategyId, "
|
||||
+ " lps.name as transactionStrategyName, "
|
||||
+ " l.currency_code as currencyCode, l.currency_digits as currencyDigits, rc.`name` as currencyName, rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode, "
|
||||
+ " l.currency_code as currencyCode, l.currency_digits as currencyDigits, l.currency_multiplesof as inMulitplesOf, rc.`name` as currencyName, rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode, "
|
||||
+ " l.loan_officer_id as loanOfficerId, s.display_name as loanOfficerName, "
|
||||
+ " l.principal_disbursed_derived as principalDisbursed,"
|
||||
+ " l.principal_repaid_derived as principalPaid,"
|
||||
@@ -473,8 +474,9 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
final CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
final CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
final Long id = rs.getLong("id");
|
||||
final String accountNo = rs.getString("accountNo");
|
||||
@@ -593,7 +595,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final LocalDate interestChargedFromDate = JdbcSupport.getLocalDate(rs, "interestChargedFromDate");
|
||||
|
||||
final Boolean syncDisbursementWithMeeting = rs.getBoolean("syncDisbursementWithMeeting");
|
||||
|
||||
|
||||
final BigDecimal feeChargesDueAtDisbursementCharged = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs,
|
||||
"feeChargesDueAtDisbursementCharged");
|
||||
LoanSummaryData loanSummary = null;
|
||||
@@ -655,18 +657,18 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
groupData = GroupGeneralData.instance(groupId, groupName, groupExternalId, groupStatus, activationDate, groupOfficeId,
|
||||
null, groupParentId, null, groupStaffId, null, groupHierarchy);
|
||||
}
|
||||
|
||||
|
||||
final Integer loanCounter = JdbcSupport.getInteger(rs, "loanCounter");
|
||||
final Integer loanProductCounter = JdbcSupport.getInteger(rs, "loanProductCounter");
|
||||
|
||||
return LoanAccountData.basicLoanDetails(id, accountNo, status, externalId, clientId, clientName, clientOfficeId, groupData,
|
||||
loanType, loanProductId, loanProductName, loanProductDescription, fundId, fundName, loanPurposeId, loanPurposeName,
|
||||
loanOfficerId, loanOfficerName, currencyData, principal, totalOverpaid, inArrearsTolerance, termFrequency,
|
||||
termPeriodFrequencyType, numberOfRepayments, repaymentEvery, repaymentFrequencyType, transactionStrategyId, transactionStrategyName ,
|
||||
amortizationType, interestRatePerPeriod, interestRateFrequencyType, annualInterestRate, interestType,
|
||||
interestCalculationPeriodType, expectedFirstRepaymentOnDate, graceOnPrincipalPayment, graceOnInterestPayment,
|
||||
graceOnInterestCharged, interestChargedFromDate, timeline, loanSummary, feeChargesDueAtDisbursementCharged,
|
||||
syncDisbursementWithMeeting, loanCounter, loanProductCounter);
|
||||
termPeriodFrequencyType, numberOfRepayments, repaymentEvery, repaymentFrequencyType, transactionStrategyId,
|
||||
transactionStrategyName, amortizationType, interestRatePerPeriod, interestRateFrequencyType, annualInterestRate,
|
||||
interestType, interestCalculationPeriodType, expectedFirstRepaymentOnDate, graceOnPrincipalPayment,
|
||||
graceOnInterestPayment, graceOnInterestCharged, interestChargedFromDate, timeline, loanSummary,
|
||||
feeChargesDueAtDisbursementCharged, syncDisbursementWithMeeting, loanCounter, loanProductCounter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,7 +709,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final Collection<LoanSchedulePeriodData> periods = new ArrayList<LoanSchedulePeriodData>();
|
||||
periods.add(disbursementPeriod);
|
||||
|
||||
final MonetaryCurrency monCurrency = new MonetaryCurrency(this.currency.code(), this.currency.decimalPlaces());
|
||||
final MonetaryCurrency monCurrency = new MonetaryCurrency(this.currency.code(), this.currency.decimalPlaces(),
|
||||
this.currency.currencyInMulitplesOf());
|
||||
final BigDecimal totalPrincipalDisbursed = Money.of(monCurrency, this.disbursement.amount()).getAmount();
|
||||
Money totalPrincipalExpected = Money.zero(monCurrency);
|
||||
Money totalPrincipalPaid = Money.zero(monCurrency);
|
||||
@@ -843,9 +846,10 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
+ " tr.fee_charges_portion_derived as fees, tr.penalty_charges_portion_derived as penalties, "
|
||||
+ " pd.payment_type_cv_id as paymentType,pd.account_number as accountNumber,pd.check_number as checkNumber, "
|
||||
+ " pd.receipt_number as receiptNumber, pd.bank_number as bankNumber,pd.routing_code as routingCode, "
|
||||
+ " l.currency_code as currencyCode, l.currency_digits as currencyDigits, rc.`name` as currencyName, "
|
||||
+ " l.currency_code as currencyCode, l.currency_digits as currencyDigits, l.currency_multiplesof as inMulitplesOf, rc.`name` as currencyName, "
|
||||
+ " rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode, "
|
||||
+ " cv.code_value as paymentTypeName, tr.external_id as externalId " + " from m_loan l join m_loan_transaction tr on tr.loan_id = l.id"
|
||||
+ " cv.code_value as paymentTypeName, tr.external_id as externalId "
|
||||
+ " from m_loan l join m_loan_transaction tr on tr.loan_id = l.id"
|
||||
+ " join m_currency rc on rc.`code` = l.currency_code "
|
||||
+ " left JOIN m_payment_detail pd ON tr.payment_detail_id = pd.id"
|
||||
+ " left join m_code_value cv on pd.payment_type_cv_id = cv.id";
|
||||
@@ -859,8 +863,9 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
final CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
final CurrencyData currencyData = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
final Long id = rs.getLong("id");
|
||||
final int transactionTypeInt = JdbcSupport.getInteger(rs, "transactionType");
|
||||
|
||||
+3
-2
@@ -99,8 +99,9 @@ public class LoanProduct extends AbstractPersistable<Long> {
|
||||
final String description = command.stringValueOfParameterNamed("description");
|
||||
final String currencyCode = command.stringValueOfParameterNamed("currencyCode");
|
||||
final Integer digitsAfterDecimal = command.integerValueOfParameterNamed("digitsAfterDecimal");
|
||||
|
||||
final MonetaryCurrency currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal);
|
||||
final Integer inMulitplesOf = command.integerValueOfParameterNamed("inMulitplesOf");
|
||||
|
||||
final MonetaryCurrency currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal,inMulitplesOf);
|
||||
final BigDecimal principal = command.bigDecimalValueOfParameterNamed("principal");
|
||||
final BigDecimal minPrincipal = command.bigDecimalValueOfParameterNamed("minPrincipal");
|
||||
final BigDecimal maxPrincipal = command.bigDecimalValueOfParameterNamed("maxPrincipal");
|
||||
|
||||
+12
-3
@@ -206,6 +206,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
|
||||
String currencyCode = this.currency.getCode();
|
||||
Integer digitsAfterDecimal = this.currency.getDigitsAfterDecimal();
|
||||
Integer inMulitplesOf = this.currency.getCurrencyInMulitplesOf();
|
||||
|
||||
final String digitsAfterDecimalParamName = "digitsAfterDecimal";
|
||||
if (command.isChangeInIntegerParameterNamed(digitsAfterDecimalParamName, digitsAfterDecimal)) {
|
||||
@@ -213,7 +214,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
actualChanges.put(digitsAfterDecimalParamName, newValue);
|
||||
actualChanges.put("locale", localeAsInput);
|
||||
digitsAfterDecimal = newValue;
|
||||
this.currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal);
|
||||
this.currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal,inMulitplesOf);
|
||||
}
|
||||
|
||||
final String currencyCodeParamName = "currencyCode";
|
||||
@@ -221,9 +222,17 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche
|
||||
final String newValue = command.stringValueOfParameterNamed(currencyCodeParamName);
|
||||
actualChanges.put(currencyCodeParamName, newValue);
|
||||
currencyCode = newValue;
|
||||
this.currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal);
|
||||
this.currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal,inMulitplesOf);
|
||||
}
|
||||
|
||||
|
||||
final String inMulitplesOfParamName = "inMulitplesOf";
|
||||
if (command.isChangeInStringParameterNamed(inMulitplesOfParamName, currencyCode)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(inMulitplesOfParamName);
|
||||
actualChanges.put(inMulitplesOfParamName, newValue);
|
||||
inMulitplesOf = newValue;
|
||||
this.currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal,inMulitplesOf);
|
||||
}
|
||||
|
||||
final Map<String, Object> loanApplicationAttributeChanges = updateLoanApplicationAttributes(command, aprCalculator);
|
||||
|
||||
actualChanges.putAll(loanApplicationAttributeChanges);
|
||||
|
||||
+9
-1
@@ -39,7 +39,7 @@ public final class LoanProductDataValidator {
|
||||
* The parameters supported for this command.
|
||||
*/
|
||||
private final Set<String> supportedParameters = new HashSet<String>(Arrays.asList("locale", "dateFormat", "name", "description", "fundId",
|
||||
"currencyCode", "digitsAfterDecimal", "principal", "minPrincipal", "maxPrincipal", "repaymentEvery", "numberOfRepayments",
|
||||
"currencyCode", "digitsAfterDecimal","inMulitplesOf", "principal", "minPrincipal", "maxPrincipal", "repaymentEvery", "numberOfRepayments",
|
||||
"minNumberOfRepayments", "maxNumberOfRepayments", "repaymentFrequencyType", "interestRatePerPeriod",
|
||||
"minInterestRatePerPeriod", "maxInterestRatePerPeriod", "interestRateFrequencyType", "amortizationType", "interestType",
|
||||
"interestCalculationPeriodType", "inArrearsTolerance", "transactionProcessingStrategyId", "graceOnPrincipalPayment",
|
||||
@@ -91,6 +91,9 @@ public final class LoanProductDataValidator {
|
||||
|
||||
final Integer digitsAfterDecimal = fromApiJsonHelper.extractIntegerNamed("digitsAfterDecimal", element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter("digitsAfterDecimal").value(digitsAfterDecimal).notNull().inMinMaxRange(0, 6);
|
||||
|
||||
final Integer inMulitplesOf = fromApiJsonHelper.extractIntegerNamed("inMulitplesOf", element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter("inMulitplesOf").value(inMulitplesOf).ignoreIfNull().integerZeroOrGreater();
|
||||
|
||||
final BigDecimal principal = fromApiJsonHelper.extractBigDecimalWithLocaleNamed("principal", element);
|
||||
baseDataValidator.reset().parameter("principal").value(principal).notNull().positiveAmount();
|
||||
@@ -334,6 +337,11 @@ public final class LoanProductDataValidator {
|
||||
final Integer digitsAfterDecimal = fromApiJsonHelper.extractIntegerNamed("digitsAfterDecimal", element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter("digitsAfterDecimal").value(digitsAfterDecimal).notNull().inMinMaxRange(0, 6);
|
||||
}
|
||||
|
||||
if (fromApiJsonHelper.parameterExists("inMulitplesOf", element)) {
|
||||
final Integer inMulitplesOf = fromApiJsonHelper.extractIntegerNamed("inMulitplesOf", element, Locale.getDefault());
|
||||
baseDataValidator.reset().parameter("inMulitplesOf").value(inMulitplesOf).ignoreIfNull().integerZeroOrGreater();
|
||||
}
|
||||
|
||||
String minPrincipalParameterName = "minPrincipal";
|
||||
BigDecimal minPrincipalAmount = null;
|
||||
|
||||
+10
-8
@@ -99,7 +99,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
|
||||
public String loanProductSchema() {
|
||||
return "lp.id as id, lp.fund_id as fundId, f.name as fundName, lp.loan_transaction_strategy_id as transactionStrategyId, ltps.name as transactionStrategyName, "
|
||||
+ "lp.name as name, lp.description as description, "
|
||||
+ "lp.principal_amount as principal, lp.min_principal_amount as minPrincipal, lp.max_principal_amount as maxPrincipal, lp.currency_code as currencyCode, lp.currency_digits as currencyDigits, "
|
||||
+ "lp.principal_amount as principal, lp.min_principal_amount as minPrincipal, lp.max_principal_amount as maxPrincipal, lp.currency_code as currencyCode, lp.currency_digits as currencyDigits, lp.currency_multiplesof as inMulitplesOf, "
|
||||
+ "lp.nominal_interest_rate_per_period as interestRatePerPeriod, lp.min_nominal_interest_rate_per_period as minInterestRatePerPeriod, lp.max_nominal_interest_rate_per_period as maxInterestRatePerPeriod, lp.interest_period_frequency_enum as interestRatePerPeriodFreq, "
|
||||
+ "lp.annual_nominal_interest_rate as annualInterestRate, lp.interest_method_enum as interestMethod, lp.interest_calculated_in_period_enum as interestCalculationInPeriodMethod,"
|
||||
+ "lp.repay_every as repaidEvery, lp.repayment_period_frequency_enum as repaymentPeriodFrequency, lp.number_of_repayments as numberOfRepayments, lp.min_number_of_repayments as minNumberOfRepayments, lp.max_number_of_repayments as maxNumberOfRepayments, "
|
||||
@@ -129,9 +129,10 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
final BigDecimal principal = rs.getBigDecimal("principal");
|
||||
final BigDecimal minPrincipal = rs.getBigDecimal("minPrincipal");
|
||||
@@ -170,7 +171,7 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
|
||||
final int interestCalculationPeriodTypeId = JdbcSupport.getInteger(rs, "interestCalculationInPeriodMethod");
|
||||
final EnumOptionData interestCalculationPeriodType = LoanEnumerations
|
||||
.interestCalculationPeriodType(interestCalculationPeriodTypeId);
|
||||
|
||||
|
||||
final boolean includeInBorrowerCycle = rs.getBoolean("includeInBorrowerCycle");
|
||||
final LocalDate startDate = JdbcSupport.getLocalDate(rs, "startDate");
|
||||
final LocalDate closeDate = JdbcSupport.getLocalDate(rs, "closeDate");
|
||||
@@ -181,13 +182,14 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
|
||||
status = "loanProduct.active";
|
||||
}
|
||||
final String externalId = rs.getString("externalId");
|
||||
|
||||
|
||||
return new LoanProductData(id, name, description, currency, principal, minPrincipal, maxPrincipal, tolerance,
|
||||
numberOfRepayments, minNumberOfRepayments, maxNumberOfRepayments, repaymentEvery, interestRatePerPeriod,
|
||||
minInterestRatePerPeriod, maxInterestRatePerPeriod, annualInterestRate, repaymentFrequencyType,
|
||||
interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId, fundName,
|
||||
transactionStrategyId, transactionStrategyName, graceOnPrincipalPayment, graceOnInterestPayment,
|
||||
graceOnInterestCharged, this.charges, accountingRuleType, includeInBorrowerCycle, startDate, closeDate, status, externalId);
|
||||
graceOnInterestCharged, this.charges, accountingRuleType, includeInBorrowerCycle, startDate, closeDate, status,
|
||||
externalId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -202,11 +204,11 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo
|
||||
return "lp.id as id, lp.name as name FROM m_product_loan lp left join m_product_mix pm on pm.product_id=lp.id where lp.id not IN("
|
||||
+ "select lp.id from m_product_loan lp inner join m_product_mix pm on pm.product_id=lp.id)";
|
||||
}
|
||||
|
||||
|
||||
public String restrictedProductsSchema() {
|
||||
return "pm.restricted_product_id as id, rp.name as name from m_product_mix pm join m_product_loan rp on rp.id = pm.restricted_product_id ";
|
||||
}
|
||||
|
||||
|
||||
public String derivedRestrictedProductsSchema() {
|
||||
return "pm.product_id as id, lp.name as name from m_product_mix pm join m_product_loan lp on lp.id=pm.product_id";
|
||||
}
|
||||
|
||||
+13
-12
@@ -63,6 +63,7 @@ public class SavingsApiConstants {
|
||||
public static final String descriptionParamName = "description";
|
||||
public static final String currencyCodeParamName = "currencyCode";
|
||||
public static final String digitsAfterDecimalParamName = "digitsAfterDecimal";
|
||||
public static final String inMulitplesOfParamName = "inMulitplesOf";
|
||||
public static final String nominalAnnualInterestRateParamName = "nominalAnnualInterestRate";
|
||||
public static final String interestCompoundingPeriodTypeParamName = "interestCompoundingPeriodType";
|
||||
public static final String interestPostingPeriodTypeParamName = "interestPostingPeriodType";
|
||||
@@ -93,11 +94,11 @@ public class SavingsApiConstants {
|
||||
|
||||
public static final Set<String> SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(localeParamName,
|
||||
monthDayFormatParamName, nameParamName, descriptionParamName, currencyCodeParamName, digitsAfterDecimalParamName,
|
||||
nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName,
|
||||
interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName,
|
||||
lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName, withdrawalFeeAmountParamName, withdrawalFeeTypeParamName,
|
||||
annualFeeAmountParamName, annualFeeOnMonthDayParamName, accountingRuleParamName,
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
inMulitplesOfParamName, nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName,
|
||||
interestPostingPeriodTypeParamName, interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName,
|
||||
minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
|
||||
withdrawalFeeAmountParamName, withdrawalFeeTypeParamName, annualFeeAmountParamName, annualFeeOnMonthDayParamName,
|
||||
accountingRuleParamName, SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
|
||||
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue()));
|
||||
@@ -108,13 +109,13 @@ public class SavingsApiConstants {
|
||||
* parameters to match those of request parameters.
|
||||
*/
|
||||
public static final Set<String> SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(idParamName,
|
||||
nameParamName, descriptionParamName, "currency", digitsAfterDecimalParamName, nominalAnnualInterestRateParamName,
|
||||
interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName,
|
||||
interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName,
|
||||
lockinPeriodFrequencyTypeParamName, withdrawalFeeAmountParamName, withdrawalFeeTypeParamName, annualFeeAmountParamName,
|
||||
annualFeeOnMonthDayParamName, "currencyOptions", "interestCompoundingPeriodTypeOptions", "interestPostingPeriodTypeOptions",
|
||||
"interestCalculationTypeOptions", "interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions",
|
||||
"withdrawalFeeTypeOptions"));
|
||||
nameParamName, descriptionParamName, "currency", digitsAfterDecimalParamName, inMulitplesOfParamName,
|
||||
nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName,
|
||||
interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName,
|
||||
lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName, withdrawalFeeAmountParamName, withdrawalFeeTypeParamName,
|
||||
annualFeeAmountParamName, annualFeeOnMonthDayParamName, "currencyOptions", "interestCompoundingPeriodTypeOptions",
|
||||
"interestPostingPeriodTypeOptions", "interestCalculationTypeOptions", "interestCalculationDaysInYearTypeOptions",
|
||||
"lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions"));
|
||||
|
||||
public static final Set<String> SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet<String>(Arrays.asList(localeParamName,
|
||||
dateFormatParamName, monthDayFormatParamName, accountNoParamName, externalIdParamName, clientIdParamName, groupIdParamName,
|
||||
|
||||
+9
@@ -12,6 +12,7 @@ import static org.mifosplatform.portfolio.savings.SavingsApiConstants.annualFeeO
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.currencyCodeParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.descriptionParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.digitsAfterDecimalParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.inMulitplesOfParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.interestCalculationDaysInYearTypeParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.interestCalculationTypeParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.interestCompoundingPeriodTypeParamName;
|
||||
@@ -87,6 +88,9 @@ public class SavingsProductDataValidator {
|
||||
final Integer digitsAfterDecimal = fromApiJsonHelper.extractIntegerSansLocaleNamed(digitsAfterDecimalParamName, element);
|
||||
baseDataValidator.reset().parameter(digitsAfterDecimalParamName).value(digitsAfterDecimal).notNull().inMinMaxRange(0, 6);
|
||||
|
||||
final Integer inMulitplesOf = fromApiJsonHelper.extractIntegerSansLocaleNamed(inMulitplesOfParamName, element);
|
||||
baseDataValidator.reset().parameter(inMulitplesOfParamName).value(inMulitplesOf).ignoreIfNull().integerZeroOrGreater();
|
||||
|
||||
final BigDecimal nominalAnnualInterestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed(nominalAnnualInterestRateParamName,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(nominalAnnualInterestRateParamName).value(nominalAnnualInterestRate).notNull()
|
||||
@@ -252,6 +256,11 @@ public class SavingsProductDataValidator {
|
||||
baseDataValidator.reset().parameter(digitsAfterDecimalParamName).value(digitsAfterDecimal).notNull().inMinMaxRange(0, 6);
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(inMulitplesOfParamName, element)) {
|
||||
final Integer inMulitplesOf = fromApiJsonHelper.extractIntegerSansLocaleNamed(inMulitplesOfParamName, element);
|
||||
baseDataValidator.reset().parameter(inMulitplesOfParamName).value(inMulitplesOf).ignoreIfNull().integerZeroOrGreater();
|
||||
}
|
||||
|
||||
if (this.fromApiJsonHelper.parameterExists(nominalAnnualInterestRateParamName, element)) {
|
||||
final BigDecimal interestRate = fromApiJsonHelper.extractBigDecimalWithLocaleNamed(nominalAnnualInterestRateParamName, element);
|
||||
baseDataValidator.reset().parameter(nominalAnnualInterestRateParamName).value(interestRate).notNull().zeroOrPositiveAmount();
|
||||
|
||||
+12
-2
@@ -12,6 +12,7 @@ import static org.mifosplatform.portfolio.savings.SavingsApiConstants.annualFeeO
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.currencyCodeParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.descriptionParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.digitsAfterDecimalParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.inMulitplesOfParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.interestCalculationDaysInYearTypeParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.interestCalculationTypeParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.interestCompoundingPeriodTypeParamName;
|
||||
@@ -279,7 +280,7 @@ public class SavingsProduct extends AbstractPersistable<Long> {
|
||||
actualChanges.put(digitsAfterDecimalParamName, newValue);
|
||||
actualChanges.put(localeParamName, localeAsInput);
|
||||
digitsAfterDecimal = newValue;
|
||||
this.currency = new MonetaryCurrency(this.currency.getCode(), digitsAfterDecimal);
|
||||
this.currency = new MonetaryCurrency(this.currency.getCode(), digitsAfterDecimal,this.currency.getCurrencyInMulitplesOf());
|
||||
}
|
||||
|
||||
String currencyCode = this.currency.getCode();
|
||||
@@ -287,7 +288,16 @@ public class SavingsProduct extends AbstractPersistable<Long> {
|
||||
final String newValue = command.stringValueOfParameterNamed(currencyCodeParamName);
|
||||
actualChanges.put(currencyCodeParamName, newValue);
|
||||
currencyCode = newValue;
|
||||
this.currency = new MonetaryCurrency(currencyCode, this.currency.getDigitsAfterDecimal());
|
||||
this.currency = new MonetaryCurrency(currencyCode, this.currency.getDigitsAfterDecimal(),this.currency.getCurrencyInMulitplesOf());
|
||||
}
|
||||
|
||||
Integer inMulitplesOf = this.currency.getCurrencyInMulitplesOf();
|
||||
if (command.isChangeInIntegerParameterNamed(inMulitplesOfParamName, inMulitplesOf)) {
|
||||
final Integer newValue = command.integerValueOfParameterNamed(inMulitplesOfParamName);
|
||||
actualChanges.put(inMulitplesOfParamName, newValue);
|
||||
actualChanges.put(localeParamName, localeAsInput);
|
||||
inMulitplesOf = newValue;
|
||||
this.currency = new MonetaryCurrency(this.currency.getCode(), this.currency.getDigitsAfterDecimal(),inMulitplesOf);
|
||||
}
|
||||
|
||||
if (command.isChangeInBigDecimalParameterNamed(nominalAnnualInterestRateParamName, this.nominalAnnualInterestRate)) {
|
||||
|
||||
+3
-1
@@ -10,6 +10,7 @@ import static org.mifosplatform.portfolio.savings.SavingsApiConstants.annualFeeO
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.currencyCodeParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.descriptionParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.digitsAfterDecimalParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.inMulitplesOfParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.interestCalculationDaysInYearTypeParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.interestCalculationTypeParamName;
|
||||
import static org.mifosplatform.portfolio.savings.SavingsApiConstants.interestCompoundingPeriodTypeParamName;
|
||||
@@ -46,7 +47,8 @@ public class SavingsProductAssembler {
|
||||
|
||||
final String currencyCode = command.stringValueOfParameterNamed(currencyCodeParamName);
|
||||
final Integer digitsAfterDecimal = command.integerValueOfParameterNamed(digitsAfterDecimalParamName);
|
||||
MonetaryCurrency currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal);
|
||||
final Integer inMulitplesOf = command.integerValueOfParameterNamed(inMulitplesOfParamName);
|
||||
MonetaryCurrency currency = new MonetaryCurrency(currencyCode, digitsAfterDecimal,inMulitplesOf);
|
||||
|
||||
final BigDecimal interestRate = command.bigDecimalValueOfParameterNamed(nominalAnnualInterestRateParamName);
|
||||
|
||||
|
||||
+20
-12
@@ -203,7 +203,8 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
|
||||
sqlBuilder.append("cbu.username as closedByUsername,");
|
||||
sqlBuilder.append("cbu.firstname as closedByFirstname, cbu.lastname as closedByLastname,");
|
||||
|
||||
sqlBuilder.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits, ");
|
||||
sqlBuilder
|
||||
.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits, sa.currency_multiplesof as inMulitplesOf, ");
|
||||
sqlBuilder.append("curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ");
|
||||
sqlBuilder.append("curr.display_symbol as currencyDisplaySymbol, ");
|
||||
|
||||
@@ -311,8 +312,9 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
final BigDecimal nominalAnnualInterestRate = rs.getBigDecimal("nominalAnnualInterestRate");
|
||||
|
||||
@@ -542,7 +544,8 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
|
||||
sqlBuilder.append("sa.id as savingsId, sa.account_no as accountNo,");
|
||||
sqlBuilder.append("pd.payment_type_cv_id as paymentType,pd.account_number as accountNumber,pd.check_number as checkNumber, ");
|
||||
sqlBuilder.append("pd.receipt_number as receiptNumber, pd.bank_number as bankNumber,pd.routing_code as routingCode, ");
|
||||
sqlBuilder.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits, ");
|
||||
sqlBuilder
|
||||
.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits, sa.currency_multiplesof as inMulitplesOf, ");
|
||||
sqlBuilder.append("curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ");
|
||||
sqlBuilder.append("curr.display_symbol as currencyDisplaySymbol, ");
|
||||
sqlBuilder.append("cv.code_value as paymentTypeName ");
|
||||
@@ -596,8 +599,9 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
AccountTransferData transfer = null;
|
||||
final Long fromTransferId = JdbcSupport.getLong(rs, "fromTransferId");
|
||||
@@ -632,7 +636,8 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
|
||||
public SavingsAccountTransactionTemplateMapper() {
|
||||
final StringBuilder sqlBuilder = new StringBuilder(400);
|
||||
sqlBuilder.append("sa.id as id, sa.account_no as accountNo, ");
|
||||
sqlBuilder.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits, ");
|
||||
sqlBuilder
|
||||
.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits, sa.currency_multiplesof as inMulitplesOf, ");
|
||||
sqlBuilder.append("curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ");
|
||||
sqlBuilder.append("curr.display_symbol as currencyDisplaySymbol, ");
|
||||
sqlBuilder.append("sa.min_required_opening_balance as minRequiredOpeningBalance ");
|
||||
@@ -657,8 +662,9 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
return SavingsAccountTransactionData.template(savingsId, accountNo, DateUtils.getLocalDateOfTenant(), currency);
|
||||
}
|
||||
@@ -677,7 +683,8 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
|
||||
|
||||
final StringBuilder sqlBuilder = new StringBuilder(400);
|
||||
sqlBuilder.append("sp.id as productId, sp.name as productName, ");
|
||||
sqlBuilder.append("sp.currency_code as currencyCode, sp.currency_digits as currencyDigits, ");
|
||||
sqlBuilder
|
||||
.append("sp.currency_code as currencyCode, sp.currency_digits as currencyDigits, sp.currency_multiplesof as inMulitplesOf, ");
|
||||
sqlBuilder.append("curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ");
|
||||
sqlBuilder.append("curr.display_symbol as currencyDisplaySymbol, ");
|
||||
sqlBuilder.append("sp.nominal_annual_interest_rate as nominalAnnualIterestRate, ");
|
||||
@@ -714,8 +721,9 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead
|
||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
|
||||
final BigDecimal nominalAnnualIterestRate = rs.getBigDecimal("nominalAnnualIterestRate");
|
||||
|
||||
|
||||
+5
-4
@@ -75,7 +75,8 @@ public class SavingsProductReadPlatformServiceImpl implements SavingsProductRead
|
||||
public SavingProductMapper() {
|
||||
final StringBuilder sqlBuilder = new StringBuilder(400);
|
||||
sqlBuilder.append("sp.id as id, sp.name as name, sp.description as description, ");
|
||||
sqlBuilder.append("sp.currency_code as currencyCode, sp.currency_digits as currencyDigits, ");
|
||||
sqlBuilder
|
||||
.append("sp.currency_code as currencyCode, sp.currency_digits as currencyDigits, sp.currency_multiplesof as inMulitplesOf, ");
|
||||
sqlBuilder.append("curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ");
|
||||
sqlBuilder.append("curr.display_symbol as currencyDisplaySymbol, ");
|
||||
sqlBuilder.append("sp.nominal_annual_interest_rate as nominalAnnualInterestRate, ");
|
||||
@@ -114,9 +115,9 @@ public class SavingsProductReadPlatformServiceImpl implements SavingsProductRead
|
||||
String currencyNameCode = rs.getString("currencyNameCode");
|
||||
String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
||||
Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
||||
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
final Integer inMulitplesOf = JdbcSupport.getInteger(rs, "inMulitplesOf");
|
||||
final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, inMulitplesOf,
|
||||
currencyDisplaySymbol, currencyNameCode);
|
||||
final BigDecimal nominalAnnualInterestRate = rs.getBigDecimal("nominalAnnualInterestRate");
|
||||
|
||||
final Integer compoundingInterestPeriodTypeValue = JdbcSupport.getInteger(rs, "compoundingInterestPeriodType");
|
||||
|
||||
+2
-1
@@ -6,9 +6,10 @@ public class MonetaryCurrencyBuilder {
|
||||
|
||||
private String code = "XOF";
|
||||
private int digitsAfterDecimal = 0;
|
||||
private Integer inMulitplesOf = null;
|
||||
|
||||
public MonetaryCurrency build() {
|
||||
return new MonetaryCurrency(code, digitsAfterDecimal);
|
||||
return new MonetaryCurrency(code, digitsAfterDecimal,inMulitplesOf);
|
||||
}
|
||||
|
||||
public MonetaryCurrencyBuilder withCode(final String withCode) {
|
||||
|
||||
Reference in New Issue
Block a user