update loan creation and retrieval.
This commit is contained in:
+81
-80
@@ -626,7 +626,7 @@ Request Body:
|
|||||||
</code>
|
</code>
|
||||||
<code class="method-response">
|
<code class="method-response">
|
||||||
{
|
{
|
||||||
"entityId":23
|
"resourceId":23
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -644,7 +644,7 @@ Request Body:
|
|||||||
</code>
|
</code>
|
||||||
<code class="method-response">
|
<code class="method-response">
|
||||||
{
|
{
|
||||||
"entityId":26
|
"resourceId":26
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -666,7 +666,7 @@ Request Body:
|
|||||||
"joiningDate": "09 June 2006"
|
"joiningDate": "09 June 2006"
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{ "entityId": 23}</code>
|
<code class="method-response">{ "resourceId": 23}</code>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -794,7 +794,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 40
|
"resourceId": 40
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -848,7 +848,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 20
|
"resourceId": 20
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -1150,58 +1150,53 @@ Request Body:
|
|||||||
<div class="method-example">
|
<div class="method-example">
|
||||||
<code class="method-declaration">GET https://Domain Name/api/v1/loans/{loanId}</code>
|
<code class="method-declaration">GET https://Domain Name/api/v1/loans/{loanId}</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"externalId" : null,
|
"clientId": 1,
|
||||||
|
"clientName": "Willie O'Meara",
|
||||||
|
"loanProductId": 1,
|
||||||
"loanProductName": "Agricultural Loan",
|
"loanProductName": "Agricultural Loan",
|
||||||
"submittedOnDate" : [ 2009, 1, 5 ],
|
"loanProductDescription": "An agricultural loan given to farmers to help buy crop, stock and machinery. With an arrears tolerance setting of 1,000 CFA, loans are not marked as 'in arrears' or 'in bad standing' if the amount outstanding is less than this. Interest rate is described using monthly percentage rate (MPR) even though the loan typically lasts a year and requires one repayment (typically at time when farmer sells crop)",
|
||||||
"approvedOnDate" : [ 2009, 1, 8 ],
|
"status": {
|
||||||
"expectedDisbursementDate" : [ 2009, 1, 15 ],
|
"id": 100,
|
||||||
"actualDisbursementDate" : [ 2009, 1, 15 ],
|
"code": "loanStatusType.submitted.and.pending.approval",
|
||||||
"expectedFirstRepaymentOnDate" : null,
|
"value": "Submitted and pending approval"
|
||||||
"interestChargedFromDate" : null,
|
|
||||||
"closedOnDate" : [ 2009, 11, 13 ],
|
|
||||||
"expectedMaturityDate" : [ 2009, 11, 15 ],
|
|
||||||
"principal" : {
|
|
||||||
"currencyCode" : "XOF",
|
|
||||||
"digitsAfterDecimal" : 0,
|
|
||||||
"amount" : 100000,
|
|
||||||
"defaultName" : "CFA Franc BCEAO",
|
|
||||||
"nameCode" : "currency.XOF",
|
|
||||||
"displaySymbol" : "CFA",
|
|
||||||
"zero" : false,
|
|
||||||
"greaterThanZero" : true,
|
|
||||||
"displaySymbolValue" : "100000 CFA"
|
|
||||||
},
|
},
|
||||||
"inArrearsTolerance" : {
|
"currency": {
|
||||||
"currencyCode" : "XOF",
|
"code": "XOF",
|
||||||
"digitsAfterDecimal" : 0,
|
"name": "CFA Franc BCEAO",
|
||||||
"amount" : 1000,
|
"decimalPlaces": 0,
|
||||||
"defaultName" : "CFA Franc BCEAO",
|
|
||||||
"nameCode" : "currency.XOF",
|
|
||||||
"displaySymbol": "CFA",
|
"displaySymbol": "CFA",
|
||||||
"zero" : false,
|
"nameCode": "currency.XOF",
|
||||||
"greaterThanZero" : true,
|
"displayLabel": "CFA Franc BCEAO (CFA)"
|
||||||
"displaySymbolValue" : "1000 CFA"
|
|
||||||
},
|
},
|
||||||
"numberOfRepayments" : 1,
|
"principal": 100000,
|
||||||
"repaymentEvery" : 10,
|
"termFrequency": 12,
|
||||||
"interestRatePerPeriod" : 1.75,
|
"termPeriodFrequencyType": {
|
||||||
"annualInterestRate" : 21.0,
|
"id": 2,
|
||||||
|
"code": "termFrequency.periodFrequencyType.months",
|
||||||
|
"value": "Months"
|
||||||
|
},
|
||||||
|
"numberOfRepayments": 12,
|
||||||
|
"repaymentEvery": 1,
|
||||||
"repaymentFrequencyType": {
|
"repaymentFrequencyType": {
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"code": "repaymentFrequency.periodFrequencyType.months",
|
"code": "repaymentFrequency.periodFrequencyType.months",
|
||||||
"value": "Months"
|
"value": "Months"
|
||||||
},
|
},
|
||||||
"interestRateFrequencyType" : {
|
"transactionProcessingStrategyId": 1,
|
||||||
"id" : 2,
|
|
||||||
"code" : "interestRateFrequency.periodFrequencyType.months",
|
|
||||||
"value" : "Per month"
|
|
||||||
},
|
|
||||||
"amortizationType": {
|
"amortizationType": {
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"code": "amortizationType.equal.installments",
|
"code": "amortizationType.equal.installments",
|
||||||
"value": "Equal installments"
|
"value": "Equal installments"
|
||||||
},
|
},
|
||||||
|
"interestRatePerPeriod": 2,
|
||||||
|
"interestRateFrequencyType": {
|
||||||
|
"id": 2,
|
||||||
|
"code": "interestRateFrequency.periodFrequencyType.months",
|
||||||
|
"value": "Per month"
|
||||||
|
},
|
||||||
|
"annualInterestRate": 24,
|
||||||
"interestType": {
|
"interestType": {
|
||||||
"id": 0,
|
"id": 0,
|
||||||
"code": "interestType.declining.balance",
|
"code": "interestType.declining.balance",
|
||||||
@@ -1212,8 +1207,10 @@ Request Body:
|
|||||||
"code": "interestCalculationPeriodType.same.as.repayment.period",
|
"code": "interestCalculationPeriodType.same.as.repayment.period",
|
||||||
"value": "Same as repayment period"
|
"value": "Same as repayment period"
|
||||||
},
|
},
|
||||||
"lifeCycleStatusText" : "Closed",
|
"submittedOnDate": [2011,9,20],
|
||||||
"lifeCycleStatusDate" : [ 2009, 11, 13 ]
|
"expectedDisbursementDate": [2011,9,20],
|
||||||
|
"expectedMaturityDate": [2012,9,20],
|
||||||
|
"lifeCycleStatusDate": [2011,9,20]
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -1235,9 +1232,9 @@ Request Body:
|
|||||||
<br>
|
<br>
|
||||||
<table class=matrixHeading>
|
<table class=matrixHeading>
|
||||||
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Mandatory Fields</div></td></tr>
|
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Mandatory Fields</div></td></tr>
|
||||||
<tr class=alt><td>clientId, productId, inArrearsTolerance, submittedOnDate, principal,
|
<tr class=alt><td>clientId, productId, principal, loanTermFrequency, loanTermFrequencyType, numberOfRepayments,
|
||||||
repaymentFrequencyType, repaymentEvery, numberOfRepayments, interestRatePerPeriod, interestRateFrequencyType, amortizationType,
|
repaymentEvery, repaymentFrequencyType, interestRatePerPeriod, interestRateFrequencyType, amortizationType,
|
||||||
interestType, interestCalculationPeriodType, expectedDisbursementDate</td></tr>
|
interestType, interestCalculationPeriodType, expectedDisbursementDate, submittedOnDate, transactionProcessingStrategyId</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="method-example">
|
<div class="method-example">
|
||||||
@@ -1246,26 +1243,29 @@ Request Body:
|
|||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Request Body:
|
Request Body:
|
||||||
{
|
{
|
||||||
|
"dateFormat": "dd MMMM yyyy",
|
||||||
|
"locale": "en_GB",
|
||||||
"clientId": 1,
|
"clientId": 1,
|
||||||
"productId": 1,
|
"productId": 1,
|
||||||
"locale": "en_GB",
|
|
||||||
"principal": "100,000.00",
|
"principal": "100,000.00",
|
||||||
"inArrearsTolerance": "1,000.00",
|
"loanTermFrequency": 12,
|
||||||
|
"loanTermFrequencyType": 2,
|
||||||
|
"numberOfRepayments": 12,
|
||||||
|
"repaymentEvery": 1,
|
||||||
"repaymentFrequencyType": 2,
|
"repaymentFrequencyType": 2,
|
||||||
"repaymentEvery": "1",
|
"interestRatePerPeriod": 2,
|
||||||
"numberOfRepayments": "12",
|
|
||||||
"interestRatePerPeriod": "1.75",
|
|
||||||
"interestRateFrequencyType": 2,
|
"interestRateFrequencyType": 2,
|
||||||
"amortizationType": 1,
|
"amortizationType": 1,
|
||||||
"interestCalculationPeriodType": 1,
|
|
||||||
"interestType": 0,
|
"interestType": 0,
|
||||||
"dateFormat": "dd MMMM yyyy",
|
"interestCalculationPeriodType": 1,
|
||||||
"expectedDisbursementDate": "01 July 2007",
|
"expectedDisbursementDate": "20 September 2011",
|
||||||
"submittedOnDate": "25 June 2007"
|
"submittedOnDate": "20 September 2011",
|
||||||
|
"transactionProcessingStrategyId": 1
|
||||||
}
|
}
|
||||||
|
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 42
|
"resourceId": 42
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -1274,7 +1274,7 @@ Request Body:
|
|||||||
<a id="loans_approve_etc" name="loans_approve_etc" class="old-syle-anchor"> </a>
|
<a id="loans_approve_etc" name="loans_approve_etc" class="old-syle-anchor"> </a>
|
||||||
<div class="method-section">
|
<div class="method-section">
|
||||||
<div class="method-description">
|
<div class="method-description">
|
||||||
<h4>Approve, Undo Approval, Disburse, Undo Disbursal, Reject a Loan or Withdraw a Loan Application</h4>
|
<h4>Approve, Undo Approval, Disburse, Undo Disbursal, Reject or Withdraw a Loan Application</h4>
|
||||||
<h5>Arguments</h5>
|
<h5>Arguments</h5>
|
||||||
<dl class="argument-list">
|
<dl class="argument-list">
|
||||||
<dt>command</dt>
|
<dt>command</dt>
|
||||||
@@ -1302,8 +1302,9 @@ Request Body:
|
|||||||
"eventDate": "07 May 2012",
|
"eventDate": "07 May 2012",
|
||||||
"note": "and event note is added"
|
"note": "and event note is added"
|
||||||
} </code>
|
} </code>
|
||||||
<code class="method-response">{
|
<code class="method-response">
|
||||||
"entityId": 37
|
{
|
||||||
|
"resourceId": 37
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -1323,7 +1324,7 @@ Content-Type: application/json
|
|||||||
No Request Body:
|
No Request Body:
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 1
|
"resourceId": 1
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -1403,7 +1404,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 37
|
"resourceId": 37
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -1465,7 +1466,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 16
|
"resourceId": 16
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -1618,7 +1619,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 9
|
"resourceId": 9
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -1639,7 +1640,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 1
|
"resourceId": 1
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2105,7 +2106,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 9
|
"resourceId": 9
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2128,7 +2129,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 1
|
"resourceId": 1
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2299,7 +2300,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": null
|
"resourceId": null
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2323,7 +2324,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": null
|
"resourceId": null
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2361,7 +2362,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 1
|
"resourceId": 1
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2439,7 +2440,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 1
|
"resourceId": 1
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2469,7 +2470,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 1
|
"resourceId": 1
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2493,7 +2494,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 1
|
"resourceId": 1
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2516,7 +2517,7 @@ Request Body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 1
|
"resourceId": 1
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2992,7 +2993,7 @@ Request body:
|
|||||||
</code>
|
</code>
|
||||||
<code class="method-response">
|
<code class="method-response">
|
||||||
{
|
{
|
||||||
"entityId": 11
|
"resourceId": 11
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -3019,7 +3020,7 @@ Request body:
|
|||||||
</code>
|
</code>
|
||||||
<code class="method-response">
|
<code class="method-response">
|
||||||
{
|
{
|
||||||
"entityId": 3
|
"resourceId": 3
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -3038,7 +3039,7 @@ Content-Type: application/json
|
|||||||
No Request Body
|
No Request Body
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 20
|
"resourceId": 20
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -3131,7 +3132,7 @@ Request body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 8
|
"resourceId": 8
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -3152,7 +3153,7 @@ Request body:
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 8
|
"resourceId": 8
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -3218,7 +3219,7 @@ ALL_FUNCTIONS_READ: "true"
|
|||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"entityId": 8
|
"resourceId": 8
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+48
@@ -0,0 +1,48 @@
|
|||||||
|
package org.mifosplatform.infrastructure.security.data;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.time.StopWatch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Immutable data object representing platform API request used for
|
||||||
|
* logging/debugging.
|
||||||
|
*/
|
||||||
|
public class PlatformRequestLog {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private long startTime;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private long totalTime;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private final String method;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private String url;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private Map<String, String> parameters;
|
||||||
|
|
||||||
|
public static PlatformRequestLog from(final StopWatch task, final HttpServletRequest request) throws IOException {
|
||||||
|
|
||||||
|
final String requestUrl = request.getRequestURL().toString();
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<String, String> parameters = new HashMap<String, String>(request.getParameterMap());
|
||||||
|
parameters.remove("password");
|
||||||
|
parameters.remove("_");
|
||||||
|
|
||||||
|
return new PlatformRequestLog(task.getStartTime(), task.getTime(), request.getMethod(), requestUrl, parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PlatformRequestLog(final long startTime, final long time, final String method, final String requestUrl,
|
||||||
|
final Map<String, String> parameters) {
|
||||||
|
this.startTime = startTime;
|
||||||
|
this.totalTime = time;
|
||||||
|
this.method = method;
|
||||||
|
this.url = requestUrl;
|
||||||
|
this.parameters = parameters;
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
-1
@@ -9,10 +9,15 @@ import javax.servlet.ServletResponse;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.time.StopWatch;
|
||||||
import org.mifosplatform.infrastructure.core.domain.MifosPlatformTenant;
|
import org.mifosplatform.infrastructure.core.domain.MifosPlatformTenant;
|
||||||
|
import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
|
||||||
import org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil;
|
import org.mifosplatform.infrastructure.core.service.ThreadLocalContextUtil;
|
||||||
|
import org.mifosplatform.infrastructure.security.data.PlatformRequestLog;
|
||||||
import org.mifosplatform.infrastructure.security.exception.InvalidTenantIdentiferException;
|
import org.mifosplatform.infrastructure.security.exception.InvalidTenantIdentiferException;
|
||||||
import org.mifosplatform.infrastructure.security.service.TenantDetailsService;
|
import org.mifosplatform.infrastructure.security.service.TenantDetailsService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.authentication.AuthenticationManager;
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
@@ -36,9 +41,14 @@ import org.springframework.security.web.authentication.www.BasicAuthenticationFi
|
|||||||
*/
|
*/
|
||||||
public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFilter {
|
public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFilter {
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(TenantAwareBasicAuthenticationFilter.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TenantDetailsService tenantDetailsService;
|
private TenantDetailsService tenantDetailsService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ToApiJsonSerializer<PlatformRequestLog> toApiJsonSerializer;
|
||||||
|
|
||||||
private String tenantRequestHeader = "X-Mifos-Platform-TenantId";
|
private String tenantRequestHeader = "X-Mifos-Platform-TenantId";
|
||||||
private boolean exceptionIfHeaderMissing = true;
|
private boolean exceptionIfHeaderMissing = true;
|
||||||
|
|
||||||
@@ -53,6 +63,9 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
|
|||||||
HttpServletRequest request = (HttpServletRequest) req;
|
HttpServletRequest request = (HttpServletRequest) req;
|
||||||
HttpServletResponse response = (HttpServletResponse) res;
|
HttpServletResponse response = (HttpServletResponse) res;
|
||||||
|
|
||||||
|
StopWatch task = new StopWatch();
|
||||||
|
task.start();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
|
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
|
||||||
@@ -83,7 +96,9 @@ public class TenantAwareBasicAuthenticationFilter extends BasicAuthenticationFil
|
|||||||
response.addHeader("WWW-Authenticate", "Basic realm=\"" + "Mifos Platform API" + "\"");
|
response.addHeader("WWW-Authenticate", "Basic realm=\"" + "Mifos Platform API" + "\"");
|
||||||
response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
|
response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
|
task.stop();
|
||||||
|
final PlatformRequestLog log = PlatformRequestLog.from(task, request);
|
||||||
|
logger.info(toApiJsonSerializer.serialize(log));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
@@ -117,6 +117,12 @@ public class LoanApplicationCommand {
|
|||||||
.longGreaterThanZero();
|
.longGreaterThanZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.clientId == null && this.groupId == null) {
|
||||||
|
baseDataValidator.reset().parameter("clientId").value(this.clientId).notNull().integerGreaterThanZero();
|
||||||
|
}
|
||||||
|
|
||||||
|
baseDataValidator.reset().parameter("productId").value(this.productId).notNull().integerGreaterThanZero();
|
||||||
|
|
||||||
if (this.submittedOnDate == null) {
|
if (this.submittedOnDate == null) {
|
||||||
ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.submitted.on.date.cannot.be.blank",
|
ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.submitted.on.date.cannot.be.blank",
|
||||||
"The parameter submittedOnDate cannot be empty.", "submittedOnDate");
|
"The parameter submittedOnDate cannot be empty.", "submittedOnDate");
|
||||||
|
|||||||
+18
-37
@@ -44,7 +44,7 @@ public class LoanAccountData {
|
|||||||
private final Integer numberOfRepayments;
|
private final Integer numberOfRepayments;
|
||||||
private final Integer repaymentEvery;
|
private final Integer repaymentEvery;
|
||||||
private final EnumOptionData repaymentFrequencyType;
|
private final EnumOptionData repaymentFrequencyType;
|
||||||
private final Integer transactionStrategyId;
|
private final Integer transactionProcessingStrategyId;
|
||||||
private final EnumOptionData amortizationType;
|
private final EnumOptionData amortizationType;
|
||||||
private final BigDecimal interestRatePerPeriod;
|
private final BigDecimal interestRatePerPeriod;
|
||||||
private final EnumOptionData interestRateFrequencyType;
|
private final EnumOptionData interestRateFrequencyType;
|
||||||
@@ -84,26 +84,16 @@ public class LoanAccountData {
|
|||||||
private final Collection<ChargeData> chargeOptions;
|
private final Collection<ChargeData> chargeOptions;
|
||||||
private final ChargeData chargeTemplate;
|
private final ChargeData chargeTemplate;
|
||||||
|
|
||||||
public LoanAccountData(
|
public LoanAccountData(final LoanBasicDetailsData basicDetails, final boolean convenienceDataRequired,
|
||||||
final LoanBasicDetailsData basicDetails,
|
final LoanScheduleData repaymentSchedule, final Collection<LoanTransactionData> transactions,
|
||||||
final boolean convenienceDataRequired,
|
final LoanPermissionData permissions, final Collection<LoanChargeData> charges,
|
||||||
final LoanScheduleData repaymentSchedule,
|
final Collection<LoanProductData> productOptions, final Collection<EnumOptionData> termFrequencyTypeOptions,
|
||||||
final Collection<LoanTransactionData> transactions,
|
|
||||||
final LoanPermissionData permissions,
|
|
||||||
final Collection<LoanChargeData> charges,
|
|
||||||
final Collection<LoanProductData> productOptions,
|
|
||||||
final Collection<EnumOptionData> termFrequencyTypeOptions,
|
|
||||||
final Collection<EnumOptionData> repaymentFrequencyTypeOptions,
|
final Collection<EnumOptionData> repaymentFrequencyTypeOptions,
|
||||||
final Collection<TransactionProcessingStrategyData> repaymentStrategyOptions,
|
final Collection<TransactionProcessingStrategyData> repaymentStrategyOptions,
|
||||||
final Collection<EnumOptionData> interestRateFrequencyTypeOptions,
|
final Collection<EnumOptionData> interestRateFrequencyTypeOptions, final Collection<EnumOptionData> amortizationTypeOptions,
|
||||||
final Collection<EnumOptionData> amortizationTypeOptions,
|
final Collection<EnumOptionData> interestTypeOptions, final Collection<EnumOptionData> interestCalculationPeriodTypeOptions,
|
||||||
final Collection<EnumOptionData> interestTypeOptions,
|
final Collection<FundData> fundOptions, final Collection<ChargeData> chargeOptions, final ChargeData chargeTemplate,
|
||||||
final Collection<EnumOptionData> interestCalculationPeriodTypeOptions,
|
final Collection<StaffData> loanOfficerOptions, final GuarantorData guarantorData) {
|
||||||
final Collection<FundData> fundOptions,
|
|
||||||
final Collection<ChargeData> chargeOptions,
|
|
||||||
final ChargeData chargeTemplate,
|
|
||||||
final Collection<StaffData> loanOfficerOptions,
|
|
||||||
final GuarantorData guarantorData) {
|
|
||||||
this.repaymentSchedule = repaymentSchedule;
|
this.repaymentSchedule = repaymentSchedule;
|
||||||
this.transactions = transactions;
|
this.transactions = transactions;
|
||||||
this.permissions = permissions;
|
this.permissions = permissions;
|
||||||
@@ -123,21 +113,16 @@ public class LoanAccountData {
|
|||||||
this.guarantorData = guarantorData;
|
this.guarantorData = guarantorData;
|
||||||
|
|
||||||
if (convenienceDataRequired) {
|
if (convenienceDataRequired) {
|
||||||
int maxSubmittedOnOffsetFromToday = basicDetails
|
int maxSubmittedOnOffsetFromToday = basicDetails.getMaxSubmittedOnOffsetFromToday();
|
||||||
.getMaxSubmittedOnOffsetFromToday();
|
int maxApprovedOnOffsetFromToday = basicDetails.getMaxApprovedOnOffsetFromToday();
|
||||||
int maxApprovedOnOffsetFromToday = basicDetails
|
int maxDisbursedOnOffsetFromToday = basicDetails.getMaxDisbursedOnOffsetFromToday();
|
||||||
.getMaxApprovedOnOffsetFromToday();
|
|
||||||
int maxDisbursedOnOffsetFromToday = basicDetails
|
|
||||||
.getMaxDisbursedOnOffsetFromToday();
|
|
||||||
int expectedLoanTermInDays = basicDetails.getLoanTermInDays();
|
int expectedLoanTermInDays = basicDetails.getLoanTermInDays();
|
||||||
int expectedLoanTermInMonths = basicDetails.getLoanTermInMonths();
|
int expectedLoanTermInMonths = basicDetails.getLoanTermInMonths();
|
||||||
int actualLoanTermInDays = basicDetails.getActualLoanTermInDays();
|
int actualLoanTermInDays = basicDetails.getActualLoanTermInDays();
|
||||||
int actualLoanTermInMonths = basicDetails.getActualLoanTermInMonths();
|
int actualLoanTermInMonths = basicDetails.getActualLoanTermInMonths();
|
||||||
|
|
||||||
this.convenienceData = new LoanConvenienceData(
|
this.convenienceData = new LoanConvenienceData(maxSubmittedOnOffsetFromToday, maxApprovedOnOffsetFromToday,
|
||||||
maxSubmittedOnOffsetFromToday, maxApprovedOnOffsetFromToday,
|
maxDisbursedOnOffsetFromToday, expectedLoanTermInDays, actualLoanTermInDays, expectedLoanTermInMonths,
|
||||||
maxDisbursedOnOffsetFromToday, expectedLoanTermInDays,
|
|
||||||
actualLoanTermInDays, expectedLoanTermInMonths,
|
|
||||||
actualLoanTermInMonths);
|
actualLoanTermInMonths);
|
||||||
} else {
|
} else {
|
||||||
this.convenienceData = null;
|
this.convenienceData = null;
|
||||||
@@ -157,11 +142,9 @@ public class LoanAccountData {
|
|||||||
this.loanOfficerId = basicDetails.getLoanOfficerId();
|
this.loanOfficerId = basicDetails.getLoanOfficerId();
|
||||||
this.loanOfficerName = basicDetails.getLoanOfficerName();
|
this.loanOfficerName = basicDetails.getLoanOfficerName();
|
||||||
|
|
||||||
|
|
||||||
this.submittedOnDate = basicDetails.getSubmittedOnDate();
|
this.submittedOnDate = basicDetails.getSubmittedOnDate();
|
||||||
this.approvedOnDate = basicDetails.getApprovedOnDate();
|
this.approvedOnDate = basicDetails.getApprovedOnDate();
|
||||||
this.expectedDisbursementDate = basicDetails
|
this.expectedDisbursementDate = basicDetails.getExpectedDisbursementDate();
|
||||||
.getExpectedDisbursementDate();
|
|
||||||
this.actualDisbursementDate = basicDetails.getActualDisbursementDate();
|
this.actualDisbursementDate = basicDetails.getActualDisbursementDate();
|
||||||
this.closedOnDate = basicDetails.getClosedOnDate();
|
this.closedOnDate = basicDetails.getClosedOnDate();
|
||||||
this.expectedMaturityDate = basicDetails.getExpectedMaturityDate();
|
this.expectedMaturityDate = basicDetails.getExpectedMaturityDate();
|
||||||
@@ -176,16 +159,14 @@ public class LoanAccountData {
|
|||||||
this.termPeriodFrequencyType = basicDetails.getTermPeriodFrequencyType();
|
this.termPeriodFrequencyType = basicDetails.getTermPeriodFrequencyType();
|
||||||
this.numberOfRepayments = basicDetails.getNumberOfRepayments();
|
this.numberOfRepayments = basicDetails.getNumberOfRepayments();
|
||||||
this.repaymentEvery = basicDetails.getRepaymentEvery();
|
this.repaymentEvery = basicDetails.getRepaymentEvery();
|
||||||
this.transactionStrategyId = basicDetails.getTransactionStrategyId();
|
this.transactionProcessingStrategyId = basicDetails.getTransactionStrategyId();
|
||||||
this.interestRatePerPeriod = basicDetails.getInterestRatePerPeriod();
|
this.interestRatePerPeriod = basicDetails.getInterestRatePerPeriod();
|
||||||
this.annualInterestRate = basicDetails.getAnnualInterestRate();
|
this.annualInterestRate = basicDetails.getAnnualInterestRate();
|
||||||
this.repaymentFrequencyType = basicDetails.getRepaymentFrequencyType();
|
this.repaymentFrequencyType = basicDetails.getRepaymentFrequencyType();
|
||||||
this.interestRateFrequencyType = basicDetails
|
this.interestRateFrequencyType = basicDetails.getInterestRateFrequencyType();
|
||||||
.getInterestRateFrequencyType();
|
|
||||||
this.amortizationType = basicDetails.getAmortizationType();
|
this.amortizationType = basicDetails.getAmortizationType();
|
||||||
this.interestType = basicDetails.getInterestType();
|
this.interestType = basicDetails.getInterestType();
|
||||||
this.interestCalculationPeriodType = basicDetails
|
this.interestCalculationPeriodType = basicDetails.getInterestCalculationPeriodType();
|
||||||
.getInterestCalculationPeriodType();
|
|
||||||
|
|
||||||
this.status = basicDetails.getStatus();
|
this.status = basicDetails.getStatus();
|
||||||
this.lifeCycleStatusDate = basicDetails.getLifeCycleStatusDate();
|
this.lifeCycleStatusDate = basicDetails.getLifeCycleStatusDate();
|
||||||
|
|||||||
+53
-101
@@ -14,7 +14,8 @@ import org.mifosplatform.portfolio.charge.data.ChargeData;
|
|||||||
import org.mifosplatform.portfolio.loanproduct.data.LoanProductData;
|
import org.mifosplatform.portfolio.loanproduct.data.LoanProductData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Immutable data object for core details of loan to be combined with {@link LoanAccountData} usage.
|
* Immutable data object for core details of loan to be combined with
|
||||||
|
* {@link LoanAccountData} usage.
|
||||||
*/
|
*/
|
||||||
public class LoanBasicDetailsData {
|
public class LoanBasicDetailsData {
|
||||||
|
|
||||||
@@ -43,7 +44,7 @@ public class LoanBasicDetailsData {
|
|||||||
private final Integer numberOfRepayments;
|
private final Integer numberOfRepayments;
|
||||||
private final Integer repaymentEvery;
|
private final Integer repaymentEvery;
|
||||||
private final EnumOptionData repaymentFrequencyType;
|
private final EnumOptionData repaymentFrequencyType;
|
||||||
private final Integer transactionStrategyId;
|
private final Integer transactionProcessingStrategyId;
|
||||||
private final EnumOptionData amortizationType;
|
private final EnumOptionData amortizationType;
|
||||||
private final BigDecimal interestRatePerPeriod;
|
private final BigDecimal interestRatePerPeriod;
|
||||||
private final EnumOptionData interestRateFrequencyType;
|
private final EnumOptionData interestRateFrequencyType;
|
||||||
@@ -64,14 +65,13 @@ public class LoanBasicDetailsData {
|
|||||||
private final BigDecimal totalDisbursementCharges;
|
private final BigDecimal totalDisbursementCharges;
|
||||||
private final Collection<LoanChargeData> charges;
|
private final Collection<LoanChargeData> charges;
|
||||||
|
|
||||||
public static LoanBasicDetailsData populateForNewIndividualClientLoanCreation(final Long clientId, final String clientName, final LocalDate expectedDisbursementDate,
|
public static LoanBasicDetailsData populateForNewIndividualClientLoanCreation(final Long clientId, final String clientName,
|
||||||
final Long clientOfficeId) {
|
final LocalDate expectedDisbursementDate, final Long clientOfficeId) {
|
||||||
return new LoanBasicDetailsData(clientId, clientName, clientOfficeId, null, null, null, expectedDisbursementDate);
|
return new LoanBasicDetailsData(clientId, clientName, clientOfficeId, null, null, null, expectedDisbursementDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoanBasicDetailsData populateForNewGroupLoanCreation(final Long groupId, final String groupName,
|
public static LoanBasicDetailsData populateForNewGroupLoanCreation(final Long groupId, final String groupName,
|
||||||
final LocalDate expectedDisbursementDate,
|
final LocalDate expectedDisbursementDate, final Long groupOfficeId) {
|
||||||
final Long groupOfficeId){
|
|
||||||
return new LoanBasicDetailsData(null, null, null, groupId, groupName, groupOfficeId, expectedDisbursementDate);
|
return new LoanBasicDetailsData(null, null, null, groupId, groupName, groupOfficeId, expectedDisbursementDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,38 +82,28 @@ public class LoanBasicDetailsData {
|
|||||||
final Collection<LoanChargeData> charges = new ArrayList<LoanChargeData>();
|
final Collection<LoanChargeData> charges = new ArrayList<LoanChargeData>();
|
||||||
|
|
||||||
for (ChargeData charge : product.charges()) {
|
for (ChargeData charge : product.charges()) {
|
||||||
charges.add(LoanChargeData.newLoanChargeDetails(charge.getId(), charge.getName(), charge.getCurrency(),
|
charges.add(LoanChargeData.newLoanChargeDetails(charge.getId(), charge.getName(), charge.getCurrency(), charge.getAmount(),
|
||||||
charge.getAmount(), charge.getChargeTimeType(), charge.getChargeCalculationType(), charge.isPenalty()));
|
charge.getChargeTimeType(), charge.getChargeCalculationType(), charge.isPenalty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return new LoanBasicDetailsData(
|
return new LoanBasicDetailsData(loanAccount.clientId, loanAccount.clientName, loanAccount.clientOfficeId, loanAccount.groupId,
|
||||||
loanAccount.clientId, loanAccount.clientName, loanAccount.clientOfficeId,
|
loanAccount.groupName, loanAccount.groupOfficeId, product.getId(), product.getName(), product.getDescription(),
|
||||||
loanAccount.groupId, loanAccount.groupName, loanAccount.groupOfficeId,
|
product.getFundId(), product.getFundName(), product.getCurrency(), product.getPrincipal(), product.getInArrearsTolerance(),
|
||||||
product.getId(), product.getName(), product.getDescription(), product.getFundId(), product.getFundName(),
|
termFrequency, termPeriodFrequencyType, product.getNumberOfRepayments(), product.getRepaymentEvery(),
|
||||||
product.getCurrency(), product.getPrincipal(), product.getInArrearsTolerance(),
|
product.getRepaymentFrequencyType(), product.getTransactionProcessingStrategyId(), product.getAmortizationType(),
|
||||||
termFrequency, termPeriodFrequencyType, product.getNumberOfRepayments(), product.getRepaymentEvery(), product.getRepaymentFrequencyType(),
|
product.getInterestRatePerPeriod(), product.getInterestRateFrequencyType(), product.getInterestType(),
|
||||||
product.getTransactionProcessingStrategyId(), product.getAmortizationType(),
|
product.getInterestCalculationPeriodType(), loanAccount.expectedDisbursementDate, charges);
|
||||||
product.getInterestRatePerPeriod(), product.getInterestRateFrequencyType(), product.getInterestType(), product.getInterestCalculationPeriodType(),
|
|
||||||
loanAccount.expectedDisbursementDate, charges);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private LoanBasicDetailsData(
|
private LoanBasicDetailsData(final Long clientId, final String clientName, final Long clientOfficeId, final Long groupId,
|
||||||
final Long clientId, final String clientName, final Long clientOfficeId,
|
final String groupName, final Long groupOfficeId, final Long productId, final String productName,
|
||||||
final Long groupId, final String groupName, final Long groupOfficeId,
|
final String productDescription, final Long fundId, final String fundName, final CurrencyData currency,
|
||||||
final Long productId, final String productName, final String productDescription, final Long fundId, final String fundName,
|
final BigDecimal principal, final BigDecimal inArrearsTolerance, final Integer termFrequency,
|
||||||
final CurrencyData currency, final BigDecimal principal, final BigDecimal inArrearsTolerance,
|
final EnumOptionData termPeriodFrequencyType, final Integer numberOfRepayments, final Integer repaymentEvery,
|
||||||
final Integer termFrequency,
|
final EnumOptionData repaymentFrequencyType, final Long transactionStrategyId, final EnumOptionData amortizationType,
|
||||||
final EnumOptionData termPeriodFrequencyType,
|
final BigDecimal interestRatePerPeriod, final EnumOptionData interestRateFrequencyType, final EnumOptionData interestType,
|
||||||
final Integer numberOfRepayments,
|
final EnumOptionData interestCalculationPeriodType, final LocalDate expectedDisbursementDate,
|
||||||
final Integer repaymentEvery,
|
final Collection<LoanChargeData> charges) {
|
||||||
final EnumOptionData repaymentFrequencyType,
|
|
||||||
final Long transactionStrategyId,
|
|
||||||
final EnumOptionData amortizationType,
|
|
||||||
final BigDecimal interestRatePerPeriod,
|
|
||||||
final EnumOptionData interestRateFrequencyType,
|
|
||||||
final EnumOptionData interestType,
|
|
||||||
final EnumOptionData interestCalculationPeriodType,
|
|
||||||
final LocalDate expectedDisbursementDate, final Collection<LoanChargeData> charges) {
|
|
||||||
this.id = null;
|
this.id = null;
|
||||||
this.externalId = null;
|
this.externalId = null;
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
@@ -140,11 +130,12 @@ public class LoanBasicDetailsData {
|
|||||||
this.repaymentEvery = repaymentEvery;
|
this.repaymentEvery = repaymentEvery;
|
||||||
this.repaymentFrequencyType = repaymentFrequencyType;
|
this.repaymentFrequencyType = repaymentFrequencyType;
|
||||||
|
|
||||||
// FIXME - kw - settle on using either long or integer for this throughout product and account fields for loan.
|
// FIXME - kw - settle on using either long or integer for this
|
||||||
|
// throughout product and account fields for loan.
|
||||||
if (transactionStrategyId != null) {
|
if (transactionStrategyId != null) {
|
||||||
this.transactionStrategyId = transactionStrategyId.intValue();
|
this.transactionProcessingStrategyId = transactionStrategyId.intValue();
|
||||||
} else {
|
} else {
|
||||||
this.transactionStrategyId = null;
|
this.transactionProcessingStrategyId = null;
|
||||||
}
|
}
|
||||||
this.amortizationType = amortizationType;
|
this.amortizationType = amortizationType;
|
||||||
|
|
||||||
@@ -169,9 +160,8 @@ public class LoanBasicDetailsData {
|
|||||||
this.totalDisbursementCharges = BigDecimal.ZERO;
|
this.totalDisbursementCharges = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LoanBasicDetailsData(final Long clientId, final String clientName, final Long clientOfficeId,
|
private LoanBasicDetailsData(final Long clientId, final String clientName, final Long clientOfficeId, final Long groupId,
|
||||||
final Long groupId, final String groupName, final Long groupOfficeId,
|
final String groupName, final Long groupOfficeId, final LocalDate expectedDisbursementDate) {
|
||||||
final LocalDate expectedDisbursementDate) {
|
|
||||||
this.id = null;
|
this.id = null;
|
||||||
this.externalId = null;
|
this.externalId = null;
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
@@ -195,7 +185,7 @@ public class LoanBasicDetailsData {
|
|||||||
this.termPeriodFrequencyType = null;
|
this.termPeriodFrequencyType = null;
|
||||||
this.numberOfRepayments = null;
|
this.numberOfRepayments = null;
|
||||||
this.repaymentEvery = null;
|
this.repaymentEvery = null;
|
||||||
this.transactionStrategyId = null;
|
this.transactionProcessingStrategyId = null;
|
||||||
this.interestRatePerPeriod = null;
|
this.interestRatePerPeriod = null;
|
||||||
this.annualInterestRate = null;
|
this.annualInterestRate = null;
|
||||||
this.repaymentFrequencyType = null;
|
this.repaymentFrequencyType = null;
|
||||||
@@ -220,46 +210,19 @@ public class LoanBasicDetailsData {
|
|||||||
this.totalDisbursementCharges = BigDecimal.ZERO;
|
this.totalDisbursementCharges = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoanBasicDetailsData(
|
public LoanBasicDetailsData(final Long id, final String externalId, final Long clientId, final String clientName,
|
||||||
final Long id,
|
final Long clientOfficeId, final Long groupId, final String groupName, final Long groupOfficeId, final Long loanProductId,
|
||||||
final String externalId,
|
final String loanProductName, final String loanProductDescription, final Long fundId, String fundName,
|
||||||
final Long clientId, final String clientName,
|
final LocalDate closedOnDate, final LocalDate submittedOnDate, final LocalDate approvedOnDate,
|
||||||
final Long clientOfficeId,
|
final LocalDate expectedDisbursementDate, final LocalDate actualDisbursementDate, final LocalDate expectedMaturityDate,
|
||||||
final Long groupId,
|
final LocalDate repaymentsStartingFromDate, final LocalDate interestChargedFromDate, final CurrencyData currency,
|
||||||
final String groupName,
|
final BigDecimal principal, final BigDecimal inArrearsTolerance, final Integer numberOfRepayments,
|
||||||
final Long groupOfficeId,
|
final Integer repaymentEvery, final BigDecimal interestRatePerPeriod, final BigDecimal annualInterestRate,
|
||||||
final Long loanProductId,
|
final EnumOptionData repaymentFrequencyType, final EnumOptionData interestRateFrequencyType,
|
||||||
final String loanProductName,
|
final EnumOptionData amortizationType, final EnumOptionData interestType, final EnumOptionData interestCalculationPeriodType,
|
||||||
final String loanProductDescription,
|
final EnumOptionData status, final LocalDate lifeCycleStatusDate, final Integer termFrequency,
|
||||||
final Long fundId, String fundName,
|
final EnumOptionData termPeriodFrequencyType, final Integer transactionStrategyId, final Collection<LoanChargeData> charges,
|
||||||
final LocalDate closedOnDate,
|
final Long loanOfficerId, String loanOfficerName, final BigDecimal totalDisbursementCharges) {
|
||||||
final LocalDate submittedOnDate,
|
|
||||||
final LocalDate approvedOnDate,
|
|
||||||
final LocalDate expectedDisbursementDate,
|
|
||||||
final LocalDate actualDisbursementDate,
|
|
||||||
final LocalDate expectedMaturityDate,
|
|
||||||
final LocalDate repaymentsStartingFromDate,
|
|
||||||
final LocalDate interestChargedFromDate,
|
|
||||||
final CurrencyData currency,
|
|
||||||
final BigDecimal principal,
|
|
||||||
final BigDecimal inArrearsTolerance,
|
|
||||||
final Integer numberOfRepayments,
|
|
||||||
final Integer repaymentEvery,
|
|
||||||
final BigDecimal interestRatePerPeriod,
|
|
||||||
final BigDecimal annualInterestRate,
|
|
||||||
final EnumOptionData repaymentFrequencyType,
|
|
||||||
final EnumOptionData interestRateFrequencyType,
|
|
||||||
final EnumOptionData amortizationType,
|
|
||||||
final EnumOptionData interestType,
|
|
||||||
final EnumOptionData interestCalculationPeriodType,
|
|
||||||
final EnumOptionData status,
|
|
||||||
final LocalDate lifeCycleStatusDate,
|
|
||||||
final Integer termFrequency,
|
|
||||||
final EnumOptionData termPeriodFrequencyType,
|
|
||||||
final Integer transactionStrategyId,
|
|
||||||
final Collection<LoanChargeData> charges,
|
|
||||||
final Long loanOfficerId, String loanOfficerName,
|
|
||||||
final BigDecimal totalDisbursementCharges) {
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.externalId = externalId;
|
this.externalId = externalId;
|
||||||
this.clientId = clientId;
|
this.clientId = clientId;
|
||||||
@@ -299,24 +262,20 @@ public class LoanBasicDetailsData {
|
|||||||
this.lifeCycleStatusDate = lifeCycleStatusDate;
|
this.lifeCycleStatusDate = lifeCycleStatusDate;
|
||||||
this.termFrequency = termFrequency;
|
this.termFrequency = termFrequency;
|
||||||
this.termPeriodFrequencyType = termPeriodFrequencyType;
|
this.termPeriodFrequencyType = termPeriodFrequencyType;
|
||||||
this.transactionStrategyId = transactionStrategyId;
|
this.transactionProcessingStrategyId = transactionStrategyId;
|
||||||
this.charges = charges;
|
this.charges = charges;
|
||||||
this.totalDisbursementCharges = totalDisbursementCharges;
|
this.totalDisbursementCharges = totalDisbursementCharges;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxSubmittedOnOffsetFromToday() {
|
public int getMaxSubmittedOnOffsetFromToday() {
|
||||||
return Days.daysBetween(new DateTime(),
|
return Days.daysBetween(new DateTime(), this.getSubmittedOnDate().toDateMidnight().toDateTime()).getDays();
|
||||||
this.getSubmittedOnDate().toDateMidnight().toDateTime())
|
|
||||||
.getDays();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxApprovedOnOffsetFromToday() {
|
public int getMaxApprovedOnOffsetFromToday() {
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
if (this.getApprovedOnDate() != null) {
|
if (this.getApprovedOnDate() != null) {
|
||||||
offset = Days.daysBetween(new DateTime(),
|
offset = Days.daysBetween(new DateTime(), this.getApprovedOnDate().toDateMidnight().toDateTime()).getDays();
|
||||||
this.getApprovedOnDate().toDateMidnight().toDateTime())
|
|
||||||
.getDays();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
@@ -326,10 +285,7 @@ public class LoanBasicDetailsData {
|
|||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
if (this.getActualDisbursementDate() != null) {
|
if (this.getActualDisbursementDate() != null) {
|
||||||
offset = Days.daysBetween(
|
offset = Days.daysBetween(new DateTime(), this.getActualDisbursementDate().toDateMidnight().toDateTime()).getDays();
|
||||||
new DateTime(),
|
|
||||||
this.getActualDisbursementDate().toDateMidnight()
|
|
||||||
.toDateTime()).getDays();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
@@ -347,8 +303,7 @@ public class LoanBasicDetailsData {
|
|||||||
closingDateToUse = getClosedOnDate();
|
closingDateToUse = getClosedOnDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(),
|
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
||||||
closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getActualLoanTermInMonths() {
|
public int getActualLoanTermInMonths() {
|
||||||
@@ -363,8 +318,7 @@ public class LoanBasicDetailsData {
|
|||||||
closingDateToUse = getClosedOnDate();
|
closingDateToUse = getClosedOnDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(),
|
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
||||||
closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLoanTermInDays() {
|
public int getLoanTermInDays() {
|
||||||
@@ -376,8 +330,7 @@ public class LoanBasicDetailsData {
|
|||||||
|
|
||||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||||
|
|
||||||
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(),
|
return Days.daysBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
||||||
closingDateToUse.toDateMidnight().toDateTime()).getDays();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLoanTermInMonths() {
|
public int getLoanTermInMonths() {
|
||||||
@@ -389,8 +342,7 @@ public class LoanBasicDetailsData {
|
|||||||
|
|
||||||
LocalDate closingDateToUse = getExpectedMaturityDate();
|
LocalDate closingDateToUse = getExpectedMaturityDate();
|
||||||
|
|
||||||
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(),
|
return Months.monthsBetween(dateToUse.toDateMidnight().toDateTime(), closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
||||||
closingDateToUse.toDateMidnight().toDateTime()).getMonths();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
@@ -542,7 +494,7 @@ public class LoanBasicDetailsData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Integer getTransactionStrategyId() {
|
public Integer getTransactionStrategyId() {
|
||||||
return transactionStrategyId;
|
return this.transactionProcessingStrategyId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<LoanChargeData> getCharges() {
|
public Collection<LoanChargeData> getCharges() {
|
||||||
|
|||||||
Reference in New Issue
Block a user