Merge pull request #1097 from pramodn02/testcase
periodic accounting API changes
This commit is contained in:
@@ -31104,7 +31104,7 @@ Content-Type: application/json
|
||||
<td><div class="mifosXHeading2">Field Descriptions</div></td>
|
||||
</tr>
|
||||
<tr class=alt>
|
||||
<td>accrueTill</td>
|
||||
<td>tillDate</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class=fielddesc>which specifies periodic accruals should happen till the given Date
|
||||
@@ -31126,7 +31126,7 @@ Content-Type: application/json
|
||||
<td><div class="mifosXHeading2">Mandatory Fields</div></td>
|
||||
</tr>
|
||||
<tr class=alt>
|
||||
<td>accrueTill
|
||||
<td>tillDate
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -31136,7 +31136,7 @@ Content-Type: application/json
|
||||
</div>
|
||||
<div class="method-example">
|
||||
<code class="method-declaration">
|
||||
POST https://DomainName/api/v1/accrualaccounting
|
||||
POST https://DomainName/api/v1/runaccruals
|
||||
</code>
|
||||
<code class="method-request">
|
||||
POST financialactivityaccounts
|
||||
@@ -31145,7 +31145,7 @@ Request Body:
|
||||
{
|
||||
"locale": "en",
|
||||
"dateFormat": "dd MMMM yyyy",
|
||||
"accrueTill":"04 June 2014"
|
||||
"tillDate":"04 June 2014"
|
||||
}
|
||||
</code>
|
||||
<code class="method-response">
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
|
||||
|
||||
public class PeriodicAccrualAccountingHelper {
|
||||
|
||||
private static final String PERIODIC_ACCRUAL_URL = "/mifosng-provider/api/v1/accrualaccounting";
|
||||
private static final String PERIODIC_ACCRUAL_URL = "/mifosng-provider/api/v1/runaccruals";
|
||||
private final RequestSpecification requestSpec;
|
||||
private final ResponseSpecification responseSpec;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class PeriodicAccrualAccountingHelper {
|
||||
final HashMap<String, String> map = new HashMap<>();
|
||||
map.put("dateFormat", "dd MMMM yyyy");
|
||||
map.put("locale", "en_GB");
|
||||
map.put("accrueTill", date);
|
||||
map.put("tillDate", date);
|
||||
return new Gson().toJson(map);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Path("/accrualaccounting")
|
||||
@Path("/runaccruals")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
public class AccrualAccountingApiResource {
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import java.util.Set;
|
||||
|
||||
public class AccrualAccountingConstants {
|
||||
|
||||
public static final String accrueTillParamName = "accrueTill";
|
||||
public static final String accrueTillParamName = "tillDate";
|
||||
public static final String localeParamName = "locale";
|
||||
public static final String dateFormatParamName = "dateFormat";
|
||||
|
||||
|
||||
+6
-3
@@ -231,7 +231,9 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
||||
if (reducePrincipal.isGreaterThanZero()) {
|
||||
switch (loanApplicationTerms.getRescheduleStrategyMethod()) {
|
||||
case REDUCE_EMI_AMOUNT:
|
||||
loanApplicationTerms.setFixedEmiAmount(null);
|
||||
if (!loanApplicationTerms.isMultiDisburseLoan()) {
|
||||
loanApplicationTerms.setFixedEmiAmount(null);
|
||||
}
|
||||
fixedEmiAmount = fixedEmiAmount.zero();
|
||||
outstandingBalance = outstandingBalance.minus(reducePrincipal);
|
||||
balanceForcalculation = balanceForcalculation.minus(reducePrincipal);
|
||||
@@ -1659,13 +1661,14 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener
|
||||
.getId() != null && loanTransaction.getId().compareTo(precloseTransaction.getId()) == 1)))) {
|
||||
precloseTransaction = loanTransaction;
|
||||
}
|
||||
collectedPrincipal = collectedPrincipal.plus(loanTransaction.getPrincipalPortion());
|
||||
collectedPrincipal = collectedPrincipal.plus(loanTransaction.getPrincipalPortion());
|
||||
}
|
||||
if (precloseTransaction != null) {
|
||||
LoanRepaymentScheduleInstallment loanRepaymentScheduleInstallment = calculatePrepaymentAmount(installments, currency,
|
||||
precloseTransaction.getTransactionDate(), applicationTerms.getInterestChargedFromLocalDate(), applicationTerms, mc,
|
||||
loanCharges);
|
||||
Money pendingPrinciapl = applicationTerms.getPrincipal().minus(collectedPrincipal).plus(precloseTransaction.getPrincipalPortion());
|
||||
Money pendingPrinciapl = applicationTerms.getPrincipal().minus(collectedPrincipal)
|
||||
.plus(precloseTransaction.getPrincipalPortion());
|
||||
if (pendingPrinciapl.isGreaterThan(loanRepaymentScheduleInstallment.getPrincipal(currency))
|
||||
|| precloseTransaction.getAmount(currency).isLessThan(loanRepaymentScheduleInstallment.getTotalOutstanding(currency))) {
|
||||
precloseTransaction = null;
|
||||
|
||||
+5
@@ -61,6 +61,7 @@ import org.mifosplatform.portfolio.calendar.domain.CalendarInstance;
|
||||
import org.mifosplatform.portfolio.calendar.domain.CalendarInstanceRepository;
|
||||
import org.mifosplatform.portfolio.calendar.domain.CalendarRepository;
|
||||
import org.mifosplatform.portfolio.calendar.domain.CalendarType;
|
||||
import org.mifosplatform.portfolio.calendar.exception.CalendarParameterUpdateNotSupportedException;
|
||||
import org.mifosplatform.portfolio.charge.domain.Charge;
|
||||
import org.mifosplatform.portfolio.charge.domain.ChargePaymentMode;
|
||||
import org.mifosplatform.portfolio.charge.domain.ChargeRepositoryWrapper;
|
||||
@@ -1732,6 +1733,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
// loop through each loan to reschedule the repayment dates
|
||||
for (final Loan loan : loans) {
|
||||
if (loan != null) {
|
||||
if(loan.repaymentScheduleDetail().isInterestRecalculationEnabled()){
|
||||
final String defaultUserMessage = "Meeting calendar type update is not supported";
|
||||
throw new CalendarParameterUpdateNotSupportedException("jlg.loan.recalculation", defaultUserMessage);
|
||||
}
|
||||
holidays = this.holidayRepository.findByOfficeIdAndGreaterThanDate(loan.getOfficeId(), loan.getDisbursementDate().toDate());
|
||||
loan.updateLoanRepaymentScheduleDates(calendar.getStartDateLocalDate(), calendar.getRecurrence(), isHolidayEnabled,
|
||||
holidays, workingDays);
|
||||
|
||||
Reference in New Issue
Block a user