diff --git a/fineract-provider/config/checkstyle/checkstyle.xml b/fineract-provider/config/checkstyle/checkstyle.xml
index b628aa93a..7663dc1a0 100644
--- a/fineract-provider/config/checkstyle/checkstyle.xml
+++ b/fineract-provider/config/checkstyle/checkstyle.xml
@@ -47,7 +47,13 @@
-->
+
+
+
+
+
+
@@ -84,12 +90,6 @@
-
-
-
-
-
-
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
index bd9609bf5..4e28a5671 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountNumberPreferencesTest.java
@@ -43,9 +43,12 @@ import org.apache.fineract.integrationtests.common.system.CodeHelper;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AccountNumberPreferencesTest {
+ private final static Logger LOG = LoggerFactory.getLogger(AccountNumberPreferencesTest.class);
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
private ResponseSpecification responseValidationError;
@@ -149,10 +152,10 @@ public class AccountNumberPreferencesTest {
Integer id = (Integer) preferenceId.get("id");
HashMap delResponse = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(id, this.responseSpec,
"");
- System.out.println("Successfully deleted account number preference (ID: " + delResponse.get("resourceId") + ")");
+ LOG.info("Successfully deleted account number preference (ID: {} )",delResponse.get("resourceId"));
}
/* Deletion of invalid account preference ID should fail */
- System.out.println("---------------------------------DELETING ACCOUNT NUMBER PREFERENCE WITH INVALID ID------------------------------------------");
+ LOG.info("---------------------------------DELETING ACCOUNT NUMBER PREFERENCE WITH INVALID ID------------------------------------------");
HashMap deletionError = this.accountNumberPreferencesHelper.deleteAccountNumberPreference(10,
this.responseNotFoundError, "");
@@ -179,23 +182,23 @@ public class AccountNumberPreferencesTest {
private void createAccountNumberPreference() {
this.clientAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createClientAccountNumberPreference(
this.responseSpec, "resourceId");
- System.out.println("Successfully created account number preferences for Client (ID: " + this.clientAccountNumberPreferenceId);
+ LOG.info("Successfully created account number preferences for Client (ID: {})",this.clientAccountNumberPreferenceId);
this.loanAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createLoanAccountNumberPreference(
this.responseSpec, "resourceId");
- System.out.println("Successfully created account number preferences for Loan (ID: " + this.loanAccountNumberPreferenceId);
+ LOG.info("Successfully created account number preferences for Loan (ID: {} )", this.loanAccountNumberPreferenceId);
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createSavingsAccountNumberPreference(
this.responseSpec, "resourceId");
- System.out.println("Successfully created account number preferences for Savings (ID: " + this.savingsAccountNumberPreferenceId);
+ LOG.info("Successfully created account number preferences for Savings (ID: {})" , this.savingsAccountNumberPreferenceId);
this.groupsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createGroupsAccountNumberPreference(
this.responseSpec, "resourceId");
- System.out.println("Successfully created account number preferences for Groups (ID: " + this.groupsAccountNumberPreferenceId);
+ LOG.info("Successfully created account number preferences for Groups (ID: {})" , this.groupsAccountNumberPreferenceId);
this.centerAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createCenterAccountNumberPreference(
this.responseSpec, "resourceId");
- System.out.println("Successfully created account number preferences for Center (ID: " + this.centerAccountNumberPreferenceId);
+ LOG.info("Successfully created account number preferences for Center (ID: {})" ,this.centerAccountNumberPreferenceId);
this.accountNumberPreferencesHelper.verifyCreationOfAccountNumberPreferences(this.clientAccountNumberPreferenceId,
this.loanAccountNumberPreferenceId, this.savingsAccountNumberPreferenceId, this.groupsAccountNumberPreferenceId,
@@ -208,7 +211,7 @@ public class AccountNumberPreferencesTest {
private void createAccountNumberPreferenceDuplicateData(final String accountType, final String prefixType) {
/* Creating account Preference with duplicate data should fail */
- System.out.println("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH DUPLICATE DATA------------------------------------------");
+ LOG.info("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH DUPLICATE DATA------------------------------------------");
HashMap creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData(
this.responseForbiddenError, accountType, prefixType, "");
@@ -221,7 +224,7 @@ public class AccountNumberPreferencesTest {
private void createAccountNumberPreferenceInvalidData(final String accountType, final String prefixType) {
/* Creating account Preference with invalid data should fail */
- System.out.println("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
+ LOG.info("---------------------------------CREATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
HashMap creationError = this.accountNumberPreferencesHelper.createAccountNumberPreferenceWithInvalidData(
this.responseValidationError, accountType, prefixType, "");
@@ -241,14 +244,14 @@ public class AccountNumberPreferencesTest {
HashMap accountNumberPreferences = this.accountNumberPreferencesHelper.updateAccountNumberPreference(
this.clientAccountNumberPreferenceId, "101", this.responseSpec, "");
- System.out.println("--------------------------UPDATION SUCCESSFUL FOR ACCOUNT NUMBER PREFERENCE ID "
- + accountNumberPreferences.get("resourceId"));
+ LOG.info("--------------------------UPDATION SUCCESSFUL FOR ACCOUNT NUMBER PREFERENCE ID {}"
+ , accountNumberPreferences.get("resourceId"));
this.accountNumberPreferencesHelper.verifyUpdationOfAccountNumberPreferences((Integer) accountNumberPreferences.get("resourceId"),
this.responseSpec, this.requestSpec);
/* Update invalid account preference id should fail */
- System.out.println("---------------------------------UPDATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
+ LOG.info("---------------------------------UPDATING ACCOUNT NUMBER PREFERENCE WITH INVALID DATA------------------------------------------");
/* Invalid Account Type */
HashMap updationError = this.accountNumberPreferencesHelper.updateAccountNumberPreference(9999, "101",
@@ -380,20 +383,20 @@ public class AccountNumberPreferencesTest {
private void createLoanProduct() {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
- System.out.println("---------------------------------CREATING LOAN PRODUCT------------------------------------------");
+ LOG.info("---------------------------------CREATING LOAN PRODUCT------------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
.withInterestRateFrequencyTypeAsYear().build(null);
this.loanProductId = this.loanTransactionHelper.getLoanProductId(loanProductJSON);
- System.out.println("Successfully created loan product (ID: " + this.loanProductId + ")");
+ LOG.info("Successfully created loan product (ID: {} )" , this.loanProductId);
}
private void createAndValidateLoanEntity(Boolean isAccountPreferenceSetUp) {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
- System.out.println("---------------------------------NEW LOAN APPLICATION------------------------------------------");
+ LOG.info("---------------------------------NEW LOAN APPLICATION------------------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(loanPrincipalAmount)
.withLoanTermFrequency(numberOfRepayments).withLoanTermFrequencyAsMonths().withNumberOfRepayments(numberOfRepayments)
@@ -402,7 +405,7 @@ public class AccountNumberPreferencesTest {
.withSubmittedOnDate(dateString).withExpectedDisbursementDate(dateString).withPrincipalGrace("2").withInterestGrace("2")
.build(this.clientId.toString(), this.loanProductId.toString(), null);
- System.out.println("Loan Application :" + loanApplicationJSON);
+ LOG.info("Loan Application :{}" , loanApplicationJSON);
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
String loanAccountNo = (String) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, this.loanId,
@@ -419,17 +422,17 @@ public class AccountNumberPreferencesTest {
this.loanProductId, "shortName");
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, loanShortName);
}
- System.out.println("SUCCESSFULLY CREATED LOAN APPLICATION BASED ON ACCOUNT PREFERENCES (ID: " + this.loanId + ")");
+ LOG.info("SUCCESSFULLY CREATED LOAN APPLICATION BASED ON ACCOUNT PREFERENCES (ID: {} )",this.loanId );
} else {
this.validateAccountNumberLengthAndStartsWithPrefix(loanAccountNo, null);
- System.out.println("SUCCESSFULLY CREATED LOAN APPLICATION (ID: " + loanId + ")");
+ LOG.info("SUCCESSFULLY CREATED LOAN APPLICATION (ID: {} )",loanId);
}
}
private void createSavingsProduct() {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
- System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
+ LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
@@ -446,7 +449,7 @@ public class AccountNumberPreferencesTest {
.withMinRequiredBalance(minRequiredBalance).withEnforceMinRequiredBalance(enforceMinRequiredBalance)
.withMinimumOpenningBalance(this.MINIMUM_OPENING_BALANCE).build();
this.savingsProductId = SavingsProductHelper.createSavingsProduct(savingsProductJSON, this.requestSpec, this.responseSpec);
- System.out.println("Sucessfully created savings product (ID: " + this.savingsProductId + ")");
+ LOG.info("Sucessfully created savings product (ID: {} )",this.savingsProductId);
}
@@ -472,10 +475,10 @@ public class AccountNumberPreferencesTest {
String loanShortName = (String) this.savingsAccountHelper.getSavingsAccountDetail(this.savingsId, "shortName");
this.validateAccountNumberLengthAndStartsWithPrefix(savingsAccountNo, loanShortName);
}
- System.out.println("SUCCESSFULLY CREATED SAVINGS APPLICATION BASED ON ACCOUNT PREFERENCES (ID: " + this.loanId + ")");
+ LOG.info("SUCCESSFULLY CREATED SAVINGS APPLICATION BASED ON ACCOUNT PREFERENCES (ID: {} )",this.loanId);
} else {
this.validateAccountNumberLengthAndStartsWithPrefix(savingsAccountNo, null);
- System.out.println("SUCCESSFULLY CREATED SAVINGS APPLICATION (ID: " + this.savingsId + ")");
+ LOG.info("SUCCESSFULLY CREATED SAVINGS APPLICATION (ID:{} )",this.savingsId);
}
}
}
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountTransferTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountTransferTest.java
index 5b7678507..e274a38f6 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountTransferTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountTransferTest.java
@@ -49,6 +49,8 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* JUnit Test Cases for Account Transfer for.
@@ -56,6 +58,7 @@ import org.junit.Test;
@SuppressWarnings({ "rawtypes", "unused" })
public class AccountTransferTest {
+ private final static Logger LOG = LoggerFactory.getLogger(AccountTransferTest.class);
public static final String MINIMUM_OPENING_BALANCE = "30000.0";
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
public static final String ACCOUNT_TRANSFER_AMOUNT = "15000.0";
@@ -443,7 +446,7 @@ public class AccountTransferTest {
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String minOpenningBalance, final Account... accounts) {
- System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
+ LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
final String savingsProductJSON = savingsProductHelper //
.withInterestCompoundingPeriodTypeAsDaily() //
@@ -454,7 +457,7 @@ public class AccountTransferTest {
}
private Integer createLoanProduct(final Account... accounts) {
- System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
+ LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder() //
.withPrincipal("8,000.00") //
.withNumberOfRepayments("4") //
@@ -470,7 +473,7 @@ public class AccountTransferTest {
}
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
- System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
+ LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
.withPrincipal("8,000.00") //
.withLoanTermFrequency("4") //
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java
index 31d89abcf..3f56e8728 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/AccountingScenarioIntegrationTest.java
@@ -64,10 +64,12 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
@SuppressWarnings({ "unused", "rawtypes", "unchecked", "static-access" })
public class AccountingScenarioIntegrationTest {
-
+ private final static Logger LOG = LoggerFactory.getLogger(AccountingScenarioIntegrationTest.class);
private static RequestSpecification requestSpec;
private static ResponseSpecification responseSpec;
@@ -146,19 +148,19 @@ public class AccountingScenarioIntegrationTest {
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// CHECK ACCOUNT ENTRIES
- System.out.println("Entries ......");
+ LOG.info("Entries ......");
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
final float TOTAL_INTEREST = 1000.0f;
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(TOTAL_INTEREST, JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
- System.out.println("CHECKING INCOME: ******************************************");
+ LOG.info("CHECKING INCOME: ******************************************");
final JournalEntry incomeJournalEntry = new JournalEntry(TOTAL_INTEREST, JournalEntry.TransactionType.CREDIT);
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.EXPECTED_DISBURSAL_DATE, incomeJournalEntry);
// MAKE 1
- System.out.println("Repayment 1 ......");
+ LOG.info("Repayment 1 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
final float FIRST_INTEREST = 200.0f;
final float FIRST_PRINCIPAL = 2000.0f;
@@ -167,10 +169,10 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
new JournalEntry(FIRST_INTEREST + FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
- System.out.println("Repayment 1 Done......");
+ LOG.info("Repayment 1 Done......");
// REPAYMENT 2
- System.out.println("Repayment 2 ......");
+ LOG.info("Repayment 2 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
final float SECOND_AND_THIRD_INTEREST = 400.0f;
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
@@ -179,10 +181,10 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
new JournalEntry(SECOND_AND_THIRD_INTEREST + SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
- System.out.println("Repayment 2 Done ......");
+ LOG.info("Repayment 2 Done ......");
// WAIVE INTEREST
- System.out.println("Waive Interest ......");
+ LOG.info("Waive Interest ......");
this.loanTransactionHelper.waiveInterest(this.REPAYMENT_DATE[4], this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
final JournalEntry waivedEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.CREDIT);
@@ -190,41 +192,41 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry expenseJournalEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
- System.out.println("Waive Interest Done......");
+ LOG.info("Waive Interest Done......");
// REPAYMENT 3
- System.out.println("Repayment 3 ......");
+ LOG.info("Repayment 3 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
- System.out.println("Repayment 3 Done ......");
+ LOG.info("Repayment 3 Done ......");
// REPAYMENT 4
- System.out.println("Repayment 4 ......");
+ LOG.info("Repayment 4 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
- System.out.println("Repayment 4 Done ......");
+ LOG.info("Repayment 4 Done ......");
// Repayment 5
- System.out.println("Repayment 5 ......");
+ LOG.info("Repayment 5 ......");
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
- System.out.println("Repayment 5 Done ......");
+ LOG.info("Repayment 5 Done ......");
}
private Integer createLoanProductWithUpfrontAccrualAccountingEnabled(final Account... accounts) {
- System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
+ LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
@@ -234,7 +236,7 @@ public class AccountingScenarioIntegrationTest {
}
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
- System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
+ LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString())
.withLoanTermFrequency(this.LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths().withNumberOfRepayments(this.LP_REPAYMENTS)
.withRepaymentEveryAfter(this.LP_REPAYMENT_PERIOD).withRepaymentFrequencyTypeAsMonths()
@@ -283,7 +285,7 @@ public class AccountingScenarioIntegrationTest {
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsID);
assertEquals("Verifying Balance after Deposit", balance, summary.get("accountBalance"));
- System.out.println("----------------------Verifying Journal Entry after the Transaction Deposit----------------------------");
+ LOG.info("----------------------Verifying Journal Entry after the Transaction Deposit----------------------------");
final JournalEntry[] assetAccountFirstTransactionEntry = { new JournalEntry(this.SP_DEPOSIT_AMOUNT,
JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liabililityAccountFirstTransactionEntry = { new JournalEntry(this.SP_DEPOSIT_AMOUNT,
@@ -299,7 +301,7 @@ public class AccountingScenarioIntegrationTest {
summary = this.savingsAccountHelper.getSavingsSummary(savingsID);
assertEquals("Verifying Balance after Withdrawal", balance, summary.get("accountBalance"));
- System.out.println("-------------------Verifying Journal Entry after the Transaction Withdrawal----------------------");
+ LOG.info("-------------------Verifying Journal Entry after the Transaction Withdrawal----------------------");
final JournalEntry[] assetAccountSecondTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT,
JournalEntry.TransactionType.CREDIT) };
final JournalEntry[] liabililityAccountSecondTransactionEntry = { new JournalEntry(this.SP_WITHDRAWAL_AMOUNT,
@@ -506,7 +508,7 @@ public class AccountingScenarioIntegrationTest {
}
public static Integer createSavingsProduct(final String minOpenningBalance, final Account... accounts) {
- System.out.println("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
+ LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT ---------------------------------------");
final String savingsProductJSON = new SavingsProductHelper().withInterestCompoundingPeriodTypeAsDaily() //
.withInterestPostingPeriodTypeAsQuarterly() //
.withInterestCalculationPeriodTypeAsDailyBalance() //
@@ -515,7 +517,7 @@ public class AccountingScenarioIntegrationTest {
}
private Integer createFixedDepositProduct(final String validFrom, final String validTo, Account... accounts) {
- System.out.println("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
+ LOG.info("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
FixedDepositProductHelper fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
final String fixedDepositProductJSON = fixedDepositProductHelper //
.withPeriodRangeChart()//
@@ -525,7 +527,7 @@ public class AccountingScenarioIntegrationTest {
private Integer applyForFixedDepositApplication(final String clientID, final String productID, final String validFrom,
final String validTo, final String submittedOnDate, final String penalInterestType) {
- System.out.println("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
+ LOG.info("--------------------------------APPLYING FOR FIXED DEPOSIT ACCOUNT --------------------------------");
final String fixedDepositApplicationJSON = new FixedDepositAccountHelper(this.requestSpec, this.responseSpec) //
.withSubmittedOnDate(submittedOnDate).build(clientID, productID, penalInterestType);
return this.fixedDepositAccountHelper
@@ -533,7 +535,7 @@ public class AccountingScenarioIntegrationTest {
}
private Integer createRecurringDepositProduct(final String validFrom, final String validTo, Account... accounts) {
- System.out.println("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
+ LOG.info("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
RecurringDepositProductHelper recurringDepositProductHelper = new RecurringDepositProductHelper(this.requestSpec, this.responseSpec);
final String recurringDepositProductJSON = recurringDepositProductHelper //
.withPeriodRangeChart()//
@@ -543,7 +545,7 @@ public class AccountingScenarioIntegrationTest {
private Integer applyForRecurringDepositApplication(final String clientID, final String productID, final String validFrom,
final String validTo, final String submittedOnDate, final String penalInterestType, final String expectedFirstDepositOnDate) {
- System.out.println("--------------------------------APPLYING FOR RECURRING DEPOSIT ACCOUNT --------------------------------");
+ LOG.info("--------------------------------APPLYING FOR RECURRING DEPOSIT ACCOUNT --------------------------------");
final String recurringDepositApplicationJSON = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec)
//
.withSubmittedOnDate(submittedOnDate).withExpectedFirstDepositOnDate(expectedFirstDepositOnDate)
@@ -577,7 +579,7 @@ public class AccountingScenarioIntegrationTest {
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// CHECK ACCOUNT ENTRIES
- System.out.println("Entries ......");
+ LOG.info("Entries ......");
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
final float TOTAL_INTEREST = 1000.0f;
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
@@ -592,7 +594,7 @@ public class AccountingScenarioIntegrationTest {
}
// MAKE 1
- System.out.println("Repayment 1 ......");
+ LOG.info("Repayment 1 ......");
final float FIRST_INTEREST = 200.0f;
final float FIRST_PRINCIPAL = 2000.0f;
final float FEE_PORTION = 0.0f;
@@ -605,10 +607,10 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
new JournalEntry(FIRST_INTEREST + FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
- System.out.println("Repayment 1 Done......");
+ LOG.info("Repayment 1 Done......");
// REPAYMENT 2
- System.out.println("Repayment 2 ......");
+ LOG.info("Repayment 2 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
final float SECOND_AND_THIRD_INTEREST = 400.0f;
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
@@ -621,10 +623,10 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
new JournalEntry(SECOND_AND_THIRD_INTEREST + SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
- System.out.println("Repayment 2 Done ......");
+ LOG.info("Repayment 2 Done ......");
// WAIVE INTEREST
- System.out.println("Waive Interest ......");
+ LOG.info("Waive Interest ......");
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[4]), FIRST_INTEREST,
FEE_PORTION, PENALTY_PORTION, loanID);
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[5]), FIRST_INTEREST,
@@ -636,37 +638,37 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry expenseJournalEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
- System.out.println("Waive Interest Done......");
+ LOG.info("Waive Interest Done......");
// REPAYMENT 3
- System.out.println("Repayment 3 ......");
+ LOG.info("Repayment 3 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
- System.out.println("Repayment 3 Done ......");
+ LOG.info("Repayment 3 Done ......");
// REPAYMENT 4
- System.out.println("Repayment 4 ......");
+ LOG.info("Repayment 4 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
- System.out.println("Repayment 4 Done ......");
+ LOG.info("Repayment 4 Done ......");
// Repayment 5
- System.out.println("Repayment 5 ......");
+ LOG.info("Repayment 5 ......");
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
- System.out.println("Repayment 5 Done ......");
+ LOG.info("Repayment 5 Done ......");
}
@Test
@@ -694,7 +696,7 @@ public class AccountingScenarioIntegrationTest {
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// CHECK ACCOUNT ENTRIES
- System.out.println("Entries ......");
+ LOG.info("Entries ......");
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
final float TOTAL_INTEREST = 1000.0f;
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
@@ -709,7 +711,7 @@ public class AccountingScenarioIntegrationTest {
}
// MAKE 1
- System.out.println("Repayment 1 ......");
+ LOG.info("Repayment 1 ......");
final float FIRST_INTEREST = 200.0f;
final float FIRST_PRINCIPAL = 2000.0f;
final float FEE_PORTION = 0.0f;
@@ -724,7 +726,7 @@ public class AccountingScenarioIntegrationTest {
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountEntry);
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, this.REPAYMENT_DATE[1], new JournalEntry(4000f,
JournalEntry.TransactionType.CREDIT));
- System.out.println("Repayment Done......");
+ LOG.info("Repayment Done......");
}
@@ -783,7 +785,7 @@ public class AccountingScenarioIntegrationTest {
String.valueOf(flat), dateFormat.format(todayDate.getTime()), String.valueOf(FEE_PORTION)));
// CHECK ACCOUNT ENTRIES
- System.out.println("Entries ......");
+ LOG.info("Entries ......");
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
final float TOTAL_INTEREST = 1000.0f;
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
@@ -902,7 +904,7 @@ public class AccountingScenarioIntegrationTest {
dateFormat.format(todayDate.getTime()), String.valueOf(NEXT_FEE_PORTION)));
// CHECK ACCOUNT ENTRIES
- System.out.println("Entries ......");
+ LOG.info("Entries ......");
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
final float TOTAL_INTEREST = 1000.0f;
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
@@ -946,7 +948,7 @@ public class AccountingScenarioIntegrationTest {
}
private Integer createLoanProductWithPeriodicAccrualAccountingEnabled(final Account... accounts) {
- System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
+ LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
@@ -979,7 +981,7 @@ public class AccountingScenarioIntegrationTest {
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// CHECK ACCOUNT ENTRIES
- System.out.println("Entries ......");
+ LOG.info("Entries ......");
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
final float TOTAL_INTEREST = 1000.0f;
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
@@ -987,7 +989,7 @@ public class AccountingScenarioIntegrationTest {
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
// MAKE 1
- System.out.println("Repayment 1 ......");
+ LOG.info("Repayment 1 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
final float FIRST_INTEREST = 200.0f;
final float FIRST_PRINCIPAL = 2000.0f;
@@ -996,13 +998,13 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
new JournalEntry(FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
- System.out.println("CHECKING INCOME: ******************************************");
+ LOG.info("CHECKING INCOME: ******************************************");
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[1], new JournalEntry(FIRST_INTEREST,
JournalEntry.TransactionType.CREDIT));
- System.out.println("Repayment 1 Done......");
+ LOG.info("Repayment 1 Done......");
// REPAYMENT 2
- System.out.println("Repayment 2 ......");
+ LOG.info("Repayment 2 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
final float SECOND_AND_THIRD_INTEREST = 400.0f;
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
@@ -1011,13 +1013,13 @@ public class AccountingScenarioIntegrationTest {
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
new JournalEntry(SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT), };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
- System.out.println("CHECKING INCOME: ******************************************");
+ LOG.info("CHECKING INCOME: ******************************************");
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[2], new JournalEntry(
SECOND_AND_THIRD_INTEREST, JournalEntry.TransactionType.CREDIT));
- System.out.println("Repayment 2 Done ......");
+ LOG.info("Repayment 2 Done ......");
// WAIVE INTEREST
- System.out.println("Waive Interest ......");
+ LOG.info("Waive Interest ......");
Integer transactionId = this.loanTransactionHelper.waiveInterestAndReturnTransactionId(this.REPAYMENT_DATE[4],
this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
// waive of fees and interest are not considered in cash based
@@ -1025,38 +1027,38 @@ public class AccountingScenarioIntegrationTest {
this.journalEntryHelper.ensureNoAccountingTransactionsWithTransactionId("L" + transactionId);
// REPAYMENT 3
- System.out.println("Repayment 3 ......");
+ LOG.info("Repayment 3 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
- System.out.println("Repayment 3 Done ......");
+ LOG.info("Repayment 3 Done ......");
// REPAYMENT 4
- System.out.println("Repayment 4 ......");
+ LOG.info("Repayment 4 ......");
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
- System.out.println("Repayment 4 Done ......");
+ LOG.info("Repayment 4 Done ......");
// Repayment 5
- System.out.println("Repayment 5 ......");
+ LOG.info("Repayment 5 ......");
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
- System.out.println("Repayment 5 Done ......");
+ LOG.info("Repayment 5 Done ......");
}
private Integer createLoanProductWithCashBasedAccountingEnabled(final Account... accounts) {
- System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
+ LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java
index 09c4cf1fe..d812a5b80 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/BatchRequestsIntegrationTest.java
@@ -36,6 +36,8 @@ import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Test class for testing the integration of Batch API with custom batch
@@ -46,6 +48,7 @@ import org.junit.Test;
*/
public class BatchRequestsIntegrationTest {
+ private final static Logger LOG = LoggerFactory.getLogger(BatchRequestsIntegrationTest.class);
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
@@ -88,7 +91,7 @@ public class BatchRequestsIntegrationTest {
for (Integer i = 0; i < clientsCount; i++) {
clientIDs[i] = ClientHelper.createClient(this.requestSpec, this.responseSpec);
groupID = GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupID.toString(), clientIDs[i].toString());
- System.out.println("client " + clientIDs[i] + " has been added to the group " + groupID);
+ LOG.info("client {} has been added to the group {}",clientIDs[i] , groupID);
}
// Generate a random count of number of new loan products to be created
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java
index bae657e19..a1c914311 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/CenterIntegrationTest.java
@@ -38,9 +38,11 @@ import org.apache.fineract.integrationtests.common.organisation.StaffHelper;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class CenterIntegrationTest {
-
+ private final static Logger LOG = LoggerFactory.getLogger(CenterIntegrationTest.class);
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
@@ -198,7 +200,7 @@ public class CenterIntegrationTest {
public void testStaffAssignmentDuringCenterCreation() {
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
- System.out.println("--------------creating first staff with id-------------" + staffId);
+ LOG.info("--------------creating first staff with id------------- {}" , staffId);
Assert.assertNotNull(staffId);
final int centerWithStaffId = CenterHelper.createCenterWithStaffId(this.requestSpec, this.responseSpec, staffId);
@@ -212,7 +214,7 @@ public class CenterIntegrationTest {
@Test
public void testAssignStaffToCenter() {
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
- System.out.println("--------------creating first staff with id-------------" + staffId);
+ LOG.info("--------------creating first staff with id------------- {}" , staffId);
Assert.assertNotNull(staffId);
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
@@ -233,7 +235,7 @@ public class CenterIntegrationTest {
@Test
public void testUnassignStaffToCenter() {
final Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec);
- System.out.println("--------------creating first staff with id-------------" + staffId);
+ LOG.info("--------------creating first staff with id------------- {}" , staffId);
Assert.assertNotNull(staffId);
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
index ea9620ad2..c4a01ea08 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java
@@ -59,6 +59,9 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
* Client Loan Integration Test for checking Loan Application Repayments
@@ -67,7 +70,7 @@ import org.junit.Test;
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class ClientLoanIntegrationTest {
-
+ private final static Logger LOG = LoggerFactory.getLogger(ClientLoanIntegrationTest.class);
public static final String MINIMUM_OPENING_BALANCE = "1000.0";
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
@@ -90,7 +93,8 @@ public class ClientLoanIntegrationTest {
public void setup() {
Utils.initializeRESTAssured();
this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
- this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+ this.requestSpec.header("Authorization",
+ "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
@@ -104,8 +108,8 @@ public class ClientLoanIntegrationTest {
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer loanProductID = createLoanProduct(false, NONE);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, null, null, "12,000.00");
- final ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
- loanID);
+ final ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentSchedule(loanSchedule);
}
@@ -118,13 +122,14 @@ public class ClientLoanIntegrationTest {
final Integer loanProductID = createLoanProduct(false, NONE);
List charges = new ArrayList<>();
- Integer flatDisbursement = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanDisbursementJSON());
+ Integer flatDisbursement = ChargesHelper.createCharges(requestSpec, responseSpec,
+ ChargesHelper.getLoanDisbursementJSON());
Integer amountPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1"));
addCharges(charges, amountPercentage, "1", null);
- Integer amountPlusInterestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1"));
+ Integer amountPlusInterestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1"));
addCharges(charges, amountPlusInterestPercentage, "1", null);
Integer interestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST, "1"));
@@ -136,7 +141,8 @@ public class ClientLoanIntegrationTest {
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
HashMap disbursementDetail = loanSchedule.get(0);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -156,13 +162,17 @@ public class ClientLoanIntegrationTest {
validateCharge(flatDisbursement, loanCharges, "100.0", "100.0", "0.0", "0.0");
validateNumberForEqual("352.12", String.valueOf(disbursementDetail.get("feeChargesDue")));
- this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(amountPercentage, loanCharges).get("id"),
+ this.loanTransactionHelper.updateChargesForLoan(loanID,
+ (Integer) getloanCharge(amountPercentage, loanCharges).get("id"),
LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
- this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(interestPercentage, loanCharges).get("id"),
+ this.loanTransactionHelper.updateChargesForLoan(loanID,
+ (Integer) getloanCharge(interestPercentage, loanCharges).get("id"),
LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
- this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(amountPlusInterestPercentage, loanCharges)
- .get("id"), LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
- this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(flatDisbursement, loanCharges).get("id"),
+ this.loanTransactionHelper.updateChargesForLoan(loanID,
+ (Integer) getloanCharge(amountPlusInterestPercentage, loanCharges).get("id"),
+ LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
+ this.loanTransactionHelper.updateChargesForLoan(loanID,
+ (Integer) getloanCharge(flatDisbursement, loanCharges).get("id"),
LoanTransactionHelper.getUpdateChargesForLoanAsJSON("150"));
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -186,8 +196,8 @@ public class ClientLoanIntegrationTest {
validateCharge(flatDisbursement, loanCharges, "150.0", "150.0", "0.0", "0.0");
validateNumberForEqual("570.2", String.valueOf(disbursementDetail.get("feeChargesDue")));
- this.loanTransactionHelper.updateLoan(loanID,
- updateLoanJson(clientID, loanProductID, copyChargesForUpdate(loanCharges, flatDisbursement, "1"), null));
+ this.loanTransactionHelper.updateLoan(loanID, updateLoanJson(clientID, loanProductID,
+ copyChargesForUpdate(loanCharges, flatDisbursement, "1"), null));
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -207,7 +217,8 @@ public class ClientLoanIntegrationTest {
validateCharge(flatDisbursement, loanCharges, "100.0", "100.0", "0.0", "0.0");
validateNumberForEqual("100.0", String.valueOf(disbursementDetail.get("feeChargesDue")));
- this.loanTransactionHelper.deleteChargesForLoan(loanID, (Integer) getloanCharge(flatDisbursement, loanCharges).get("id"));
+ this.loanTransactionHelper.deleteChargesForLoan(loanID,
+ (Integer) getloanCharge(flatDisbursement, loanCharges).get("id"));
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
disbursementDetail = loanSchedule.get(0);
@@ -228,8 +239,8 @@ public class ClientLoanIntegrationTest {
Integer amountPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1"));
addCharges(charges, amountPercentage, "1", null);
- Integer amountPlusInterestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1"));
+ Integer amountPlusInterestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1"));
addCharges(charges, amountPlusInterestPercentage, "1", null);
Integer interestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST, "1"));
@@ -241,7 +252,8 @@ public class ClientLoanIntegrationTest {
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
HashMap disbursementDetail = loanSchedule.get(0);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -251,14 +263,14 @@ public class ClientLoanIntegrationTest {
validateCharge(amountPlusInterestPercentage, loanCharges, "1.0", "126.06", "0.0", "0.0");
validateNumberForEqual("252.12", String.valueOf(disbursementDetail.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
// DISBURSE
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID, "10000");
- System.out.println("DISBURSE " + loanStatusHashMap);
+ LOG.info("DISBURSE {}", loanStatusHashMap.toString());
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -284,17 +296,18 @@ public class ClientLoanIntegrationTest {
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "100", false));
Integer flatAccTransfer = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateWithAccountTransferJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "100", false));
+ ChargesHelper.getLoanSpecifiedDueDateWithAccountTransferJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT,
+ "100", false));
- Integer amountPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
+ Integer amountPercentage = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
addCharges(charges, amountPercentage, "1", "29 September 2011");
- Integer amountPlusInterestPercentage = ChargesHelper
- .createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
+ Integer amountPlusInterestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
+ ChargesHelper.getLoanSpecifiedDueDateJSON(
ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
addCharges(charges, amountPlusInterestPercentage, "1", "29 September 2011");
- Integer interestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST, "1", false));
+ Integer interestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST, "1", false));
addCharges(charges, interestPercentage, "1", "29 September 2011");
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
@@ -303,7 +316,8 @@ public class ClientLoanIntegrationTest {
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
HashMap firstInstallment = loanSchedule.get(1);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -314,8 +328,8 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("252.12", String.valueOf(firstInstallment.get("feeChargesDue")));
- this.loanTransactionHelper.addChargesForLoan(loanID,
- LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), "29 September 2011", "100"));
+ this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper
+ .getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flat), "29 September 2011", "100"));
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
firstInstallment = loanSchedule.get(1);
@@ -323,12 +337,15 @@ public class ClientLoanIntegrationTest {
validateCharge(flat, loanCharges, "100.0", "100.0", "0.0", "0.0");
validateNumberForEqual("352.12", String.valueOf(firstInstallment.get("feeChargesDue")));
- this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(amountPercentage, loanCharges).get("id"),
+ this.loanTransactionHelper.updateChargesForLoan(loanID,
+ (Integer) getloanCharge(amountPercentage, loanCharges).get("id"),
LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
- this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(interestPercentage, loanCharges).get("id"),
+ this.loanTransactionHelper.updateChargesForLoan(loanID,
+ (Integer) getloanCharge(interestPercentage, loanCharges).get("id"),
+ LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
+ this.loanTransactionHelper.updateChargesForLoan(loanID,
+ (Integer) getloanCharge(amountPlusInterestPercentage, loanCharges).get("id"),
LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
- this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(amountPlusInterestPercentage, loanCharges)
- .get("id"), LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(flat, loanCharges).get("id"),
LoanTransactionHelper.getUpdateChargesForLoanAsJSON("150"));
@@ -343,8 +360,8 @@ public class ClientLoanIntegrationTest {
final Integer savingsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
MINIMUM_OPENING_BALANCE);
- this.loanTransactionHelper.updateLoan(loanID,
- updateLoanJson(clientID, loanProductID, copyChargesForUpdate(loanCharges, null, null), String.valueOf(savingsId)));
+ this.loanTransactionHelper.updateLoan(loanID, updateLoanJson(clientID, loanProductID,
+ copyChargesForUpdate(loanCharges, null, null), String.valueOf(savingsId)));
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -383,13 +400,13 @@ public class ClientLoanIntegrationTest {
Assert.assertEquals(0, loanCharges.size());
validateNumberForEqual("0", String.valueOf(firstInstallment.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- this.loanTransactionHelper.addChargesForLoan(loanID,
- LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatAccTransfer), "29 September 2011", "100"));
+ this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper
+ .getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatAccTransfer), "29 September 2011", "100"));
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
firstInstallment = loanSchedule.get(1);
@@ -398,11 +415,11 @@ public class ClientLoanIntegrationTest {
// DISBURSE
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
- System.out.println("DISBURSE " + loanStatusHashMap);
+ LOG.info("DISBURSE {}", loanStatusHashMap.toString());
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- this.loanTransactionHelper.addChargesForLoan(loanID,
- LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(amountPercentage), "29 September 2011", "1"));
+ this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper
+ .getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(amountPercentage), "29 September 2011", "1"));
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
firstInstallment = loanSchedule.get(1);
@@ -410,7 +427,8 @@ public class ClientLoanIntegrationTest {
validateCharge(flatAccTransfer, loanCharges, "100.0", "100.0", "0.0", "0.0");
validateNumberForEqual("200.0", String.valueOf(firstInstallment.get("feeChargesDue")));
- this.loanTransactionHelper.waiveChargesForLoan(loanID, (Integer) getloanCharge(amountPercentage, loanCharges).get("id"), "");
+ this.loanTransactionHelper.waiveChargesForLoan(loanID,
+ (Integer) getloanCharge(amountPercentage, loanCharges).get("id"), "");
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
firstInstallment = loanSchedule.get(1);
@@ -420,7 +438,8 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("100.0", String.valueOf(firstInstallment.get("feeChargesOutstanding")));
validateNumberForEqual("100.0", String.valueOf(firstInstallment.get("feeChargesWaived")));
- this.loanTransactionHelper.payChargesForLoan(loanID, (Integer) getloanCharge(flatAccTransfer, loanCharges).get("id"),
+ this.loanTransactionHelper.payChargesForLoan(loanID,
+ (Integer) getloanCharge(flatAccTransfer, loanCharges).get("id"),
LoanTransactionHelper.getPayChargeJSON(SavingsAccountHelper.TRANSACTION_DATE, null));
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -443,17 +462,18 @@ public class ClientLoanIntegrationTest {
List charges = new ArrayList<>();
Integer flat = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "50", false));
- Integer flatAccTransfer = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanInstallmentWithAccountTransferJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "50", false));
+ Integer flatAccTransfer = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanInstallmentWithAccountTransferJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "50", false));
- Integer amountPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
+ Integer amountPercentage = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
addCharges(charges, amountPercentage, "1", "29 September 2011");
Integer amountPlusInterestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
+ ChargesHelper.getLoanInstallmentJSON(
+ ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
addCharges(charges, amountPlusInterestPercentage, "1", "29 September 2011");
- Integer interestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST, "1", false));
+ Integer interestPercentage = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST, "1", false));
addCharges(charges, interestPercentage, "1", "29 September 2011");
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
@@ -462,7 +482,8 @@ public class ClientLoanIntegrationTest {
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
loanSchedule.remove(0);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -475,16 +496,19 @@ public class ClientLoanIntegrationTest {
Float principalFee = principalDue / 100;
Float interestFee = interestDue / 100;
Float totalInstallmentFee = (principalFee * 2) + (interestFee * 2);
- validateNumberForEqualExcludePrecission(String.valueOf(totalInstallmentFee), String.valueOf(installment.get("feeChargesDue")));
+ validateNumberForEqualExcludePrecission(String.valueOf(totalInstallmentFee),
+ String.valueOf(installment.get("feeChargesDue")));
totalPerOfAmout = totalPerOfAmout + principalFee;
totalPerOfAmoutPlusInt = totalPerOfAmoutPlusInt + principalFee + interestFee;
totalPerOfint = totalPerOfint + interestFee;
}
- validateChargeExcludePrecission(amountPercentage, loanCharges, "1.0", String.valueOf(totalPerOfAmout), "0.0", "0.0");
- validateChargeExcludePrecission(interestPercentage, loanCharges, "1.0", String.valueOf(totalPerOfint), "0.0", "0.0");
- validateChargeExcludePrecission(amountPlusInterestPercentage, loanCharges, "1.0", String.valueOf(totalPerOfAmoutPlusInt), "0.0",
+ validateChargeExcludePrecission(amountPercentage, loanCharges, "1.0", String.valueOf(totalPerOfAmout), "0.0",
"0.0");
+ validateChargeExcludePrecission(interestPercentage, loanCharges, "1.0", String.valueOf(totalPerOfint), "0.0",
+ "0.0");
+ validateChargeExcludePrecission(amountPlusInterestPercentage, loanCharges, "1.0",
+ String.valueOf(totalPerOfAmoutPlusInt), "0.0", "0.0");
this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getInstallmentChargesForLoanAsJSON(String.valueOf(flat), "50"));
@@ -500,24 +524,30 @@ public class ClientLoanIntegrationTest {
Float principalFee = principalDue / 100;
Float interestFee = interestDue / 100;
Float totalInstallmentFee = (principalFee * 2) + (interestFee * 2) + 50;
- validateNumberForEqualExcludePrecission(String.valueOf(totalInstallmentFee), String.valueOf(installment.get("feeChargesDue")));
+ validateNumberForEqualExcludePrecission(String.valueOf(totalInstallmentFee),
+ String.valueOf(installment.get("feeChargesDue")));
totalPerOfAmout = totalPerOfAmout + principalFee;
totalPerOfAmoutPlusInt = totalPerOfAmoutPlusInt + principalFee + interestFee;
totalPerOfint = totalPerOfint + interestFee;
}
- validateChargeExcludePrecission(amountPercentage, loanCharges, "1.0", String.valueOf(totalPerOfAmout), "0.0", "0.0");
- validateChargeExcludePrecission(interestPercentage, loanCharges, "1.0", String.valueOf(totalPerOfint), "0.0", "0.0");
- validateChargeExcludePrecission(amountPlusInterestPercentage, loanCharges, "1.0", String.valueOf(totalPerOfAmoutPlusInt), "0.0",
+ validateChargeExcludePrecission(amountPercentage, loanCharges, "1.0", String.valueOf(totalPerOfAmout), "0.0",
"0.0");
+ validateChargeExcludePrecission(interestPercentage, loanCharges, "1.0", String.valueOf(totalPerOfint), "0.0",
+ "0.0");
+ validateChargeExcludePrecission(amountPlusInterestPercentage, loanCharges, "1.0",
+ String.valueOf(totalPerOfAmoutPlusInt), "0.0", "0.0");
validateChargeExcludePrecission(flat, loanCharges, "50.0", "200", "0.0", "0.0");
- this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(amountPercentage, loanCharges).get("id"),
+ this.loanTransactionHelper.updateChargesForLoan(loanID,
+ (Integer) getloanCharge(amountPercentage, loanCharges).get("id"),
LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
- this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(interestPercentage, loanCharges).get("id"),
+ this.loanTransactionHelper.updateChargesForLoan(loanID,
+ (Integer) getloanCharge(interestPercentage, loanCharges).get("id"),
+ LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
+ this.loanTransactionHelper.updateChargesForLoan(loanID,
+ (Integer) getloanCharge(amountPlusInterestPercentage, loanCharges).get("id"),
LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
- this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(amountPlusInterestPercentage, loanCharges)
- .get("id"), LoanTransactionHelper.getUpdateChargesForLoanAsJSON("2"));
this.loanTransactionHelper.updateChargesForLoan(loanID, (Integer) getloanCharge(flat, loanCharges).get("id"),
LoanTransactionHelper.getUpdateChargesForLoanAsJSON("100"));
@@ -533,22 +563,25 @@ public class ClientLoanIntegrationTest {
Float principalFee = principalDue * 2 / 100;
Float interestFee = interestDue * 2 / 100;
Float totalInstallmentFee = (principalFee * 2) + (interestFee * 2) + 100;
- validateNumberForEqualExcludePrecission(String.valueOf(totalInstallmentFee), String.valueOf(installment.get("feeChargesDue")));
+ validateNumberForEqualExcludePrecission(String.valueOf(totalInstallmentFee),
+ String.valueOf(installment.get("feeChargesDue")));
totalPerOfAmout = totalPerOfAmout + principalFee;
totalPerOfAmoutPlusInt = totalPerOfAmoutPlusInt + principalFee + interestFee;
totalPerOfint = totalPerOfint + interestFee;
}
- validateChargeExcludePrecission(amountPercentage, loanCharges, "2.0", String.valueOf(totalPerOfAmout), "0.0", "0.0");
- validateChargeExcludePrecission(interestPercentage, loanCharges, "2.0", String.valueOf(totalPerOfint), "0.0", "0.0");
- validateChargeExcludePrecission(amountPlusInterestPercentage, loanCharges, "2.0", String.valueOf(totalPerOfAmoutPlusInt), "0.0",
+ validateChargeExcludePrecission(amountPercentage, loanCharges, "2.0", String.valueOf(totalPerOfAmout), "0.0",
"0.0");
+ validateChargeExcludePrecission(interestPercentage, loanCharges, "2.0", String.valueOf(totalPerOfint), "0.0",
+ "0.0");
+ validateChargeExcludePrecission(amountPlusInterestPercentage, loanCharges, "2.0",
+ String.valueOf(totalPerOfAmoutPlusInt), "0.0", "0.0");
validateChargeExcludePrecission(flat, loanCharges, "100.0", "400", "0.0", "0.0");
final Integer savingsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
MINIMUM_OPENING_BALANCE);
- this.loanTransactionHelper.updateLoan(loanID,
- updateLoanJson(clientID, loanProductID, copyChargesForUpdate(loanCharges, null, null), String.valueOf(savingsId)));
+ this.loanTransactionHelper.updateLoan(loanID, updateLoanJson(clientID, loanProductID,
+ copyChargesForUpdate(loanCharges, null, null), String.valueOf(savingsId)));
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -562,16 +595,19 @@ public class ClientLoanIntegrationTest {
Float principalFee = principalDue * 2 / 100;
Float interestFee = interestDue * 2 / 100;
Float totalInstallmentFee = (principalFee * 2) + (interestFee * 2) + 100;
- validateNumberForEqualExcludePrecission(String.valueOf(totalInstallmentFee), String.valueOf(installment.get("feeChargesDue")));
+ validateNumberForEqualExcludePrecission(String.valueOf(totalInstallmentFee),
+ String.valueOf(installment.get("feeChargesDue")));
totalPerOfAmout = totalPerOfAmout + principalFee;
totalPerOfAmoutPlusInt = totalPerOfAmoutPlusInt + principalFee + interestFee;
totalPerOfint = totalPerOfint + interestFee;
}
- validateChargeExcludePrecission(amountPercentage, loanCharges, "2.0", String.valueOf(totalPerOfAmout), "0.0", "0.0");
- validateChargeExcludePrecission(interestPercentage, loanCharges, "2.0", String.valueOf(totalPerOfint), "0.0", "0.0");
- validateChargeExcludePrecission(amountPlusInterestPercentage, loanCharges, "2.0", String.valueOf(totalPerOfAmoutPlusInt), "0.0",
+ validateChargeExcludePrecission(amountPercentage, loanCharges, "2.0", String.valueOf(totalPerOfAmout), "0.0",
"0.0");
+ validateChargeExcludePrecission(interestPercentage, loanCharges, "2.0", String.valueOf(totalPerOfint), "0.0",
+ "0.0");
+ validateChargeExcludePrecission(amountPlusInterestPercentage, loanCharges, "2.0",
+ String.valueOf(totalPerOfAmoutPlusInt), "0.0", "0.0");
validateChargeExcludePrecission(flat, loanCharges, "100.0", "400", "0.0", "0.0");
this.loanTransactionHelper.updateLoan(loanID,
@@ -589,16 +625,19 @@ public class ClientLoanIntegrationTest {
Float principalFee = principalDue / 100;
Float interestFee = interestDue / 100;
Float totalInstallmentFee = (principalFee * 2) + (interestFee * 2);
- validateNumberForEqualExcludePrecission(String.valueOf(totalInstallmentFee), String.valueOf(installment.get("feeChargesDue")));
+ validateNumberForEqualExcludePrecission(String.valueOf(totalInstallmentFee),
+ String.valueOf(installment.get("feeChargesDue")));
totalPerOfAmout = totalPerOfAmout + principalFee;
totalPerOfAmoutPlusInt = totalPerOfAmoutPlusInt + principalFee + interestFee;
totalPerOfint = totalPerOfint + interestFee;
}
- validateChargeExcludePrecission(amountPercentage, loanCharges, "1.0", String.valueOf(totalPerOfAmout), "0.0", "0.0");
- validateChargeExcludePrecission(interestPercentage, loanCharges, "1.0", String.valueOf(totalPerOfint), "0.0", "0.0");
- validateChargeExcludePrecission(amountPlusInterestPercentage, loanCharges, "1.0", String.valueOf(totalPerOfAmoutPlusInt), "0.0",
+ validateChargeExcludePrecission(amountPercentage, loanCharges, "1.0", String.valueOf(totalPerOfAmout), "0.0",
"0.0");
+ validateChargeExcludePrecission(interestPercentage, loanCharges, "1.0", String.valueOf(totalPerOfint), "0.0",
+ "0.0");
+ validateChargeExcludePrecission(amountPlusInterestPercentage, loanCharges, "1.0",
+ String.valueOf(totalPerOfAmoutPlusInt), "0.0", "0.0");
charges.clear();
addCharges(charges, flat, "50", "29 September 2011");
@@ -620,7 +659,7 @@ public class ClientLoanIntegrationTest {
validateNumberForEqualExcludePrecission("0", String.valueOf(installment.get("feeChargesDue")));
}
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
@@ -637,7 +676,7 @@ public class ClientLoanIntegrationTest {
// DISBURSE
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
- System.out.println("DISBURSE " + loanStatusHashMap);
+ LOG.info("DISBURSE {}", loanStatusHashMap.toString());
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
this.loanTransactionHelper.addChargesForLoan(loanID,
@@ -661,10 +700,12 @@ public class ClientLoanIntegrationTest {
for (HashMap installment : loanSchedule) {
validateNumberForEqualExcludePrecission("150", String.valueOf(installment.get("feeChargesDue")));
if (waivePeriodnum == installment.get("period")) {
- validateNumberForEqualExcludePrecission("100.0", String.valueOf(installment.get("feeChargesOutstanding")));
+ validateNumberForEqualExcludePrecission("100.0",
+ String.valueOf(installment.get("feeChargesOutstanding")));
validateNumberForEqualExcludePrecission("50.0", String.valueOf(installment.get("feeChargesWaived")));
} else {
- validateNumberForEqualExcludePrecission("150.0", String.valueOf(installment.get("feeChargesOutstanding")));
+ validateNumberForEqualExcludePrecission("150.0",
+ String.valueOf(installment.get("feeChargesOutstanding")));
validateNumberForEqualExcludePrecission("0.0", String.valueOf(installment.get("feeChargesWaived")));
}
@@ -673,21 +714,25 @@ public class ClientLoanIntegrationTest {
validateChargeExcludePrecission(flat, loanCharges, "50.0", "150", "0.0", "50.0");
Integer payPeriodnum = 2;
- this.loanTransactionHelper.payChargesForLoan(loanID, (Integer) getloanCharge(flatAccTransfer, loanCharges).get("id"),
- LoanTransactionHelper.getPayChargeJSON(SavingsAccountHelper.TRANSACTION_DATE, String.valueOf(payPeriodnum)));
+ this.loanTransactionHelper.payChargesForLoan(loanID,
+ (Integer) getloanCharge(flatAccTransfer, loanCharges).get("id"), LoanTransactionHelper
+ .getPayChargeJSON(SavingsAccountHelper.TRANSACTION_DATE, String.valueOf(payPeriodnum)));
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
loanSchedule.remove(0);
for (HashMap installment : loanSchedule) {
validateNumberForEqualExcludePrecission("150", String.valueOf(installment.get("feeChargesDue")));
if (payPeriodnum == installment.get("period")) {
- validateNumberForEqualExcludePrecission("50.0", String.valueOf(installment.get("feeChargesOutstanding")));
+ validateNumberForEqualExcludePrecission("50.0",
+ String.valueOf(installment.get("feeChargesOutstanding")));
validateNumberForEqualExcludePrecission("100.0", String.valueOf(installment.get("feeChargesPaid")));
} else if (waivePeriodnum == installment.get("period")) {
- validateNumberForEqualExcludePrecission("100.0", String.valueOf(installment.get("feeChargesOutstanding")));
+ validateNumberForEqualExcludePrecission("100.0",
+ String.valueOf(installment.get("feeChargesOutstanding")));
validateNumberForEqualExcludePrecission("50.0", String.valueOf(installment.get("feeChargesWaived")));
} else {
- validateNumberForEqualExcludePrecission("150.0", String.valueOf(installment.get("feeChargesOutstanding")));
+ validateNumberForEqualExcludePrecission("150.0",
+ String.valueOf(installment.get("feeChargesOutstanding")));
validateNumberForEqualExcludePrecission("0.0", String.valueOf(installment.get("feeChargesPaid")));
}
@@ -709,13 +754,14 @@ public class ClientLoanIntegrationTest {
final Integer savingsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
MINIMUM_OPENING_BALANCE);
- final Integer loanID = applyForLoanApplication(clientID, loanProductID, null, savingsId.toString(), "12,000.00");
+ final Integer loanID = applyForLoanApplication(clientID, loanProductID, null, savingsId.toString(),
+ "12,000.00");
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
@@ -725,8 +771,9 @@ public class ClientLoanIntegrationTest {
assertEquals("Verifying opening Balance", balance, summary.get("accountBalance"));
// DISBURSE
- loanStatusHashMap = this.loanTransactionHelper.disburseLoanToSavings(SavingsAccountHelper.TRANSACTION_DATE, loanID);
- System.out.println("DISBURSE " + loanStatusHashMap);
+ loanStatusHashMap = this.loanTransactionHelper.disburseLoanToSavings(SavingsAccountHelper.TRANSACTION_DATE,
+ loanID);
+ LOG.info("DISBURSE {}", loanStatusHashMap.toString());
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
summary = savingsAccountHelper.getSavingsSummary(savingsId);
@@ -754,25 +801,26 @@ public class ClientLoanIntegrationTest {
tranches.add(createTrancheDetail("1 March 2014", "25000"));
tranches.add(createTrancheDetail("23 April 2014", "20000"));
- final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, null, null, "45,000.00", tranches);
+ final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, null, null, "45,000.00",
+ tranches);
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("1 March 2014", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
// DISBURSE first Tranche
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("1 March 2014", loanID);
- System.out.println("DISBURSE " + loanStatusHashMap);
+ LOG.info("DISBURSE {}", loanStatusHashMap);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
// DISBURSE Second Tranche
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("23 April 2014", loanID);
- System.out.println("DISBURSE " + loanStatusHashMap);
+ LOG.info("DISBURSE {}", loanStatusHashMap.toString());
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID);
@@ -797,14 +845,14 @@ public class ClientLoanIntegrationTest {
tranches.add(createTrancheDetail("1 March 2014", "25000"));
tranches.add(createTrancheDetail("23 April 2014", "20000"));
- final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, null, savingsId.toString(), "45,000.00",
- tranches);
+ final Integer loanID = applyForLoanApplicationWithTranches(clientID, loanProductID, null, savingsId.toString(),
+ "45,000.00", tranches);
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("1 March 2014", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
@@ -815,7 +863,7 @@ public class ClientLoanIntegrationTest {
// DISBURSE first Tranche
loanStatusHashMap = this.loanTransactionHelper.disburseLoanToSavings("1 March 2014", loanID);
- System.out.println("DISBURSE " + loanStatusHashMap);
+ LOG.info("DISBURSE {}", loanStatusHashMap.toString());
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
summary = savingsAccountHelper.getSavingsSummary(savingsId);
@@ -824,7 +872,7 @@ public class ClientLoanIntegrationTest {
// DISBURSE Second Tranche
loanStatusHashMap = this.loanTransactionHelper.disburseLoanToSavings("23 April 2014", loanID);
- System.out.println("DISBURSE " + loanStatusHashMap);
+ LOG.info("DISBURSE {}", loanStatusHashMap.toString());
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
summary = savingsAccountHelper.getSavingsSummary(savingsId);
@@ -841,27 +889,31 @@ public class ClientLoanIntegrationTest {
}
- private void validateCharge(Integer amountPercentage, final List loanCharges, final String amount, final String outstanding,
- String amountPaid, String amountWaived) {
+ private void validateCharge(Integer amountPercentage, final List loanCharges, final String amount,
+ final String outstanding, String amountPaid, String amountWaived) {
HashMap chargeDetail = getloanCharge(amountPercentage, loanCharges);
- Assert.assertTrue(Float.valueOf(amount).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountOrPercentage")))) == 0);
- Assert.assertTrue(Float.valueOf(outstanding).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountOutstanding")))) == 0);
- Assert.assertTrue(Float.valueOf(amountPaid).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountPaid")))) == 0);
- Assert.assertTrue(Float.valueOf(amountWaived).compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountWaived")))) == 0);
+ Assert.assertTrue(Float.valueOf(amount)
+ .compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountOrPercentage")))) == 0);
+ Assert.assertTrue(Float.valueOf(outstanding)
+ .compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountOutstanding")))) == 0);
+ Assert.assertTrue(Float.valueOf(amountPaid)
+ .compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountPaid")))) == 0);
+ Assert.assertTrue(Float.valueOf(amountWaived)
+ .compareTo(Float.valueOf(String.valueOf(chargeDetail.get("amountWaived")))) == 0);
}
- private void validateChargeExcludePrecission(Integer amountPercentage, final List loanCharges, final String amount,
- final String outstanding, String amountPaid, String amountWaived) {
+ private void validateChargeExcludePrecission(Integer amountPercentage, final List loanCharges,
+ final String amount, final String outstanding, String amountPaid, String amountWaived) {
DecimalFormat twoDForm = new DecimalFormat("#");
HashMap chargeDetail = getloanCharge(amountPercentage, loanCharges);
- Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amount))).compareTo(Float.valueOf(twoDForm.format(Float.valueOf(String
- .valueOf(chargeDetail.get("amountOrPercentage")))))) == 0);
- Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(outstanding))).compareTo(Float.valueOf(twoDForm.format(Float.valueOf(String
- .valueOf(chargeDetail.get("amountOutstanding")))))) == 0);
- Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amountPaid))).compareTo(Float.valueOf(twoDForm.format(Float.valueOf(String
- .valueOf(chargeDetail.get("amountPaid")))))) == 0);
- Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amountWaived))).compareTo(Float.valueOf(twoDForm.format(Float.valueOf(String
- .valueOf(chargeDetail.get("amountWaived")))))) == 0);
+ Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amount))).compareTo(Float
+ .valueOf(twoDForm.format(Float.valueOf(String.valueOf(chargeDetail.get("amountOrPercentage")))))) == 0);
+ Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(outstanding))).compareTo(Float
+ .valueOf(twoDForm.format(Float.valueOf(String.valueOf(chargeDetail.get("amountOutstanding")))))) == 0);
+ Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amountPaid))).compareTo(
+ Float.valueOf(twoDForm.format(Float.valueOf(String.valueOf(chargeDetail.get("amountPaid")))))) == 0);
+ Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(amountWaived))).compareTo(
+ Float.valueOf(twoDForm.format(Float.valueOf(String.valueOf(chargeDetail.get("amountWaived")))))) == 0);
}
public void validateNumberForEqual(String val, String val2) {
@@ -869,16 +921,19 @@ public class ClientLoanIntegrationTest {
}
public void validateNumberForEqualWithMsg(String msg, String val, String val2) {
- Assert.assertTrue(msg + "expected " + val + " but was " + val2, Float.valueOf(val).compareTo(Float.valueOf(val2)) == 0);
+ Assert.assertTrue(msg + "expected " + val + " but was " + val2,
+ Float.valueOf(val).compareTo(Float.valueOf(val2)) == 0);
}
public void validateNumberForEqualExcludePrecission(String val, String val2) {
DecimalFormat twoDForm = new DecimalFormat("#");
- Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(val))).compareTo(Float.valueOf(twoDForm.format(Float.valueOf(val2)))) == 0);
+ Assert.assertTrue(Float.valueOf(twoDForm.format(Float.valueOf(val)))
+ .compareTo(Float.valueOf(twoDForm.format(Float.valueOf(val2)))) == 0);
}
- private Integer createLoanProduct(final boolean multiDisburseLoan, final String accountingRule, final Account... accounts) {
- System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
+ private Integer createLoanProduct(final boolean multiDisburseLoan, final String accountingRule,
+ final Account... accounts) {
+ LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
LoanProductTestBuilder builder = new LoanProductTestBuilder() //
.withPrincipal("12,000.00") //
.withNumberOfRepayments("4") //
@@ -897,8 +952,9 @@ public class ClientLoanIntegrationTest {
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
- private Integer createLoanProduct(final String inMultiplesOf, final String digitsAfterDecimal, final String repaymentStrategy) {
- System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
+ private Integer createLoanProduct(final String inMultiplesOf, final String digitsAfterDecimal,
+ final String repaymentStrategy) {
+ LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder() //
.withPrincipal("10000000.00") //
.withNumberOfRepayments("24") //
@@ -913,9 +969,9 @@ public class ClientLoanIntegrationTest {
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
- private Integer createLoanProduct(final String inMultiplesOf, final String digitsAfterDecimal, final String repaymentStrategy,
- final String accountingRule, final Account... accounts) {
- System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
+ private Integer createLoanProduct(final String inMultiplesOf, final String digitsAfterDecimal,
+ final String repaymentStrategy, final String accountingRule, final Account... accounts) {
+ LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder() //
.withPrincipal("10000000.00") //
.withNumberOfRepayments("24") //
@@ -926,12 +982,14 @@ public class ClientLoanIntegrationTest {
.withRepaymentStrategy(repaymentStrategy) //
.withAmortizationTypeAsEqualPrincipalPayment() //
.withInterestTypeAsDecliningBalance() //
- .currencyDetails(digitsAfterDecimal, inMultiplesOf).withAccounting(accountingRule, accounts).build(null);
+ .currencyDetails(digitsAfterDecimal, inMultiplesOf).withAccounting(accountingRule, accounts)
+ .build(null);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
- private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, String graceOnPrincipalPayment) {
- System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
+ private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID,
+ String graceOnPrincipalPayment) {
+ LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
.withPrincipal("10000000.00") //
.withLoanTermFrequency("24") //
@@ -951,7 +1009,7 @@ public class ClientLoanIntegrationTest {
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, List charges,
final String savingsId, String principal) {
- System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
+ LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
.withPrincipal(principal) //
.withLoanTermFrequency("4") //
@@ -969,9 +1027,9 @@ public class ClientLoanIntegrationTest {
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
}
- private Integer applyForLoanApplicationWithTranches(final Integer clientID, final Integer loanProductID, List charges,
- final String savingsId, String principal, List tranches) {
- System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
+ private Integer applyForLoanApplicationWithTranches(final Integer clientID, final Integer loanProductID,
+ List charges, final String savingsId, String principal, List tranches) {
+ LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
.withPrincipal(principal) //
.withLoanTermFrequency("4") //
@@ -991,8 +1049,9 @@ public class ClientLoanIntegrationTest {
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
}
- private String updateLoanJson(final Integer clientID, final Integer loanProductID, List charges, String savingsId) {
- System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
+ private String updateLoanJson(final Integer clientID, final Integer loanProductID, List charges,
+ String savingsId) {
+ LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
.withPrincipal("10,000.00") //
.withLoanTermFrequency("4") //
@@ -1010,9 +1069,9 @@ public class ClientLoanIntegrationTest {
return loanApplicationJSON;
}
- private Integer applyForLoanApplicationWithPaymentStrategy(final Integer clientID, final Integer loanProductID, List charges,
- final String savingsId, String principal, final String repaymentStrategy) {
- System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
+ private Integer applyForLoanApplicationWithPaymentStrategy(final Integer clientID, final Integer loanProductID,
+ List charges, final String savingsId, String principal, final String repaymentStrategy) {
+ LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder() //
.withPrincipal(principal) //
.withLoanTermFrequency("4") //
@@ -1031,9 +1090,10 @@ public class ClientLoanIntegrationTest {
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
}
- private Integer applyForLoanApplicationWithPaymentStrategyAndPastMonth(final Integer clientID, final Integer loanProductID,
- List charges, final String savingsId, String principal, final String repaymentStrategy, final int month) {
- System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
+ private Integer applyForLoanApplicationWithPaymentStrategyAndPastMonth(final Integer clientID,
+ final Integer loanProductID, List charges, final String savingsId, String principal,
+ final String repaymentStrategy, final int month) {
+ LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
Calendar fourMonthsfromNowCalendar = Calendar.getInstance(Utils.getTimeZoneOfTenant());
fourMonthsfromNowCalendar.add(Calendar.MONTH, month);
@@ -1059,122 +1119,180 @@ public class ClientLoanIntegrationTest {
}
private void verifyLoanRepaymentSchedule(final ArrayList loanSchedule) {
- System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
+ LOG.info(
+ "--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
- assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)), loanSchedule.get(1)
- .get("dueDate"));
- assertEquals("Checking for Principal Due for 1st Month", Float.valueOf("2911.49"), loanSchedule.get(1).get("principalOriginalDue"));
- assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("240.00"), loanSchedule.get(1).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)),
+ loanSchedule.get(1).get("dueDate"));
+ assertEquals("Checking for Principal Due for 1st Month", Float.valueOf("2911.49"),
+ loanSchedule.get(1).get("principalOriginalDue"));
+ assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("240.00"),
+ loanSchedule.get(1).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)), loanSchedule.get(2)
- .get("dueDate"));
- assertEquals("Checking for Principal Due for 2nd Month", Float.valueOf("2969.72"), loanSchedule.get(2).get("principalDue"));
- assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("181.77"), loanSchedule.get(2).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)),
+ loanSchedule.get(2).get("dueDate"));
+ assertEquals("Checking for Principal Due for 2nd Month", Float.valueOf("2969.72"),
+ loanSchedule.get(2).get("principalDue"));
+ assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("181.77"),
+ loanSchedule.get(2).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)), loanSchedule.get(3)
- .get("dueDate"));
- assertEquals("Checking for Principal Due for 3rd Month", Float.valueOf("3029.11"), loanSchedule.get(3).get("principalDue"));
- assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("122.38"), loanSchedule.get(3).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)),
+ loanSchedule.get(3).get("dueDate"));
+ assertEquals("Checking for Principal Due for 3rd Month", Float.valueOf("3029.11"),
+ loanSchedule.get(3).get("principalDue"));
+ assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("122.38"),
+ loanSchedule.get(3).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 20)), loanSchedule.get(4).get("dueDate"));
- assertEquals("Checking for Principal Due for 4th Month", Float.valueOf("3089.68"), loanSchedule.get(4).get("principalDue"));
- assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("61.79"), loanSchedule.get(4).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 20)),
+ loanSchedule.get(4).get("dueDate"));
+ assertEquals("Checking for Principal Due for 4th Month", Float.valueOf("3089.68"),
+ loanSchedule.get(4).get("principalDue"));
+ assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("61.79"),
+ loanSchedule.get(4).get("interestOriginalDue"));
}
private void verifyLoanRepaymentScheduleForEqualPrincipal(final ArrayList loanSchedule) {
- System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
+ LOG.info(
+ "--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
- assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2014, 7, 2)), loanSchedule.get(1).get("dueDate"));
- assertEquals("Checking for Principal Due for 1st Month", Float.valueOf("416700"), loanSchedule.get(1).get("principalOriginalDue"));
- assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("200000"), loanSchedule.get(1).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2014, 7, 2)),
+ loanSchedule.get(1).get("dueDate"));
+ assertEquals("Checking for Principal Due for 1st Month", Float.valueOf("416700"),
+ loanSchedule.get(1).get("principalOriginalDue"));
+ assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("200000"),
+ loanSchedule.get(1).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2014, 8, 2)), loanSchedule.get(2).get("dueDate"));
- assertEquals("Checking for Principal Due for 2nd Month", Float.valueOf("416700"), loanSchedule.get(2).get("principalDue"));
- assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("191700"), loanSchedule.get(2).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2014, 8, 2)),
+ loanSchedule.get(2).get("dueDate"));
+ assertEquals("Checking for Principal Due for 2nd Month", Float.valueOf("416700"),
+ loanSchedule.get(2).get("principalDue"));
+ assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("191700"),
+ loanSchedule.get(2).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2014, 9, 2)), loanSchedule.get(3).get("dueDate"));
- assertEquals("Checking for Principal Due for 3rd Month", Float.valueOf("416700"), loanSchedule.get(3).get("principalDue"));
- assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("183300"), loanSchedule.get(3).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2014, 9, 2)),
+ loanSchedule.get(3).get("dueDate"));
+ assertEquals("Checking for Principal Due for 3rd Month", Float.valueOf("416700"),
+ loanSchedule.get(3).get("principalDue"));
+ assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("183300"),
+ loanSchedule.get(3).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2014, 10, 2)), loanSchedule.get(4).get("dueDate"));
- assertEquals("Checking for Principal Due for 4th Month", Float.valueOf("416700"), loanSchedule.get(4).get("principalDue"));
- assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("175000"), loanSchedule.get(4).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2014, 10, 2)),
+ loanSchedule.get(4).get("dueDate"));
+ assertEquals("Checking for Principal Due for 4th Month", Float.valueOf("416700"),
+ loanSchedule.get(4).get("principalDue"));
+ assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("175000"),
+ loanSchedule.get(4).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 5th Month", new ArrayList<>(Arrays.asList(2014, 11, 2)), loanSchedule.get(5).get("dueDate"));
- assertEquals("Checking for Principal Due for 5th Month", Float.valueOf("416700"), loanSchedule.get(5).get("principalDue"));
- assertEquals("Checking for Interest Due for 5th Month", Float.valueOf("166700"), loanSchedule.get(5).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 5th Month", new ArrayList<>(Arrays.asList(2014, 11, 2)),
+ loanSchedule.get(5).get("dueDate"));
+ assertEquals("Checking for Principal Due for 5th Month", Float.valueOf("416700"),
+ loanSchedule.get(5).get("principalDue"));
+ assertEquals("Checking for Interest Due for 5th Month", Float.valueOf("166700"),
+ loanSchedule.get(5).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 6th Month", new ArrayList<>(Arrays.asList(2014, 12, 2)), loanSchedule.get(6).get("dueDate"));
- assertEquals("Checking for Principal Due for 6th Month", Float.valueOf("416700"), loanSchedule.get(6).get("principalDue"));
- assertEquals("Checking for Interest Due for 6th Month", Float.valueOf("158300"), loanSchedule.get(6).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 6th Month", new ArrayList<>(Arrays.asList(2014, 12, 2)),
+ loanSchedule.get(6).get("dueDate"));
+ assertEquals("Checking for Principal Due for 6th Month", Float.valueOf("416700"),
+ loanSchedule.get(6).get("principalDue"));
+ assertEquals("Checking for Interest Due for 6th Month", Float.valueOf("158300"),
+ loanSchedule.get(6).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 10th Month", new ArrayList<>(Arrays.asList(2015, 4, 2)), loanSchedule.get(10)
- .get("dueDate"));
- assertEquals("Checking for Principal Due for 10th Month", Float.valueOf("416700"), loanSchedule.get(10).get("principalDue"));
- assertEquals("Checking for Interest Due for 10th Month", Float.valueOf("125000"), loanSchedule.get(10).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 10th Month", new ArrayList<>(Arrays.asList(2015, 4, 2)),
+ loanSchedule.get(10).get("dueDate"));
+ assertEquals("Checking for Principal Due for 10th Month", Float.valueOf("416700"),
+ loanSchedule.get(10).get("principalDue"));
+ assertEquals("Checking for Interest Due for 10th Month", Float.valueOf("125000"),
+ loanSchedule.get(10).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 20th Month", new ArrayList<>(Arrays.asList(2016, 2, 2)), loanSchedule.get(20)
- .get("dueDate"));
- assertEquals("Checking for Principal Due for 20th Month", Float.valueOf("416700"), loanSchedule.get(20).get("principalDue"));
- assertEquals("Checking for Interest Due for 20th Month", Float.valueOf("41700"), loanSchedule.get(20).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 20th Month", new ArrayList<>(Arrays.asList(2016, 2, 2)),
+ loanSchedule.get(20).get("dueDate"));
+ assertEquals("Checking for Principal Due for 20th Month", Float.valueOf("416700"),
+ loanSchedule.get(20).get("principalDue"));
+ assertEquals("Checking for Interest Due for 20th Month", Float.valueOf("41700"),
+ loanSchedule.get(20).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 24th Month", new ArrayList<>(Arrays.asList(2016, 6, 2)), loanSchedule.get(24)
- .get("dueDate"));
- assertEquals("Checking for Principal Due for 24th Month", Float.valueOf("415900"), loanSchedule.get(24).get("principalDue"));
- assertEquals("Checking for Interest Due for 24th Month", Float.valueOf("8300"), loanSchedule.get(24).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 24th Month", new ArrayList<>(Arrays.asList(2016, 6, 2)),
+ loanSchedule.get(24).get("dueDate"));
+ assertEquals("Checking for Principal Due for 24th Month", Float.valueOf("415900"),
+ loanSchedule.get(24).get("principalDue"));
+ assertEquals("Checking for Interest Due for 24th Month", Float.valueOf("8300"),
+ loanSchedule.get(24).get("interestOriginalDue"));
}
private void verifyLoanRepaymentScheduleForEqualPrincipalWithGrace(final ArrayList loanSchedule) {
- System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
+ LOG.info(
+ "--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------");
- assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2014, 7, 2)), loanSchedule.get(1).get("dueDate"));
+ assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2014, 7, 2)),
+ loanSchedule.get(1).get("dueDate"));
validateNumberForEqualWithMsg("Checking for Principal Due for 1st Month", "0.0",
String.valueOf(loanSchedule.get(1).get("principalOriginalDue")));
- assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("200000"), loanSchedule.get(1).get("interestOriginalDue"));
+ assertEquals("Checking for Interest Due for 1st Month", Float.valueOf("200000"),
+ loanSchedule.get(1).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2014, 8, 2)), loanSchedule.get(2).get("dueDate"));
+ assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2014, 8, 2)),
+ loanSchedule.get(2).get("dueDate"));
validateNumberForEqualWithMsg("Checking for Principal Due for 2nd Month", "0.0",
String.valueOf(loanSchedule.get(2).get("principalOriginalDue")));
- assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("200000"), loanSchedule.get(2).get("interestOriginalDue"));
+ assertEquals("Checking for Interest Due for 2nd Month", Float.valueOf("200000"),
+ loanSchedule.get(2).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2014, 9, 2)), loanSchedule.get(3).get("dueDate"));
+ assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2014, 9, 2)),
+ loanSchedule.get(3).get("dueDate"));
validateNumberForEqualWithMsg("Checking for Principal Due for 3rd Month", "0.0",
String.valueOf(loanSchedule.get(3).get("principalDue")));
- assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("200000"), loanSchedule.get(3).get("interestOriginalDue"));
+ assertEquals("Checking for Interest Due for 3rd Month", Float.valueOf("200000"),
+ loanSchedule.get(3).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2014, 10, 2)), loanSchedule.get(4).get("dueDate"));
+ assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2014, 10, 2)),
+ loanSchedule.get(4).get("dueDate"));
validateNumberForEqualWithMsg("Checking for Principal Due for 4th Month", "0",
String.valueOf(loanSchedule.get(4).get("principalDue")));
- assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("200000"), loanSchedule.get(4).get("interestOriginalDue"));
+ assertEquals("Checking for Interest Due for 4th Month", Float.valueOf("200000"),
+ loanSchedule.get(4).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 5th Month", new ArrayList<>(Arrays.asList(2014, 11, 2)), loanSchedule.get(5).get("dueDate"));
+ assertEquals("Checking for Due Date for 5th Month", new ArrayList<>(Arrays.asList(2014, 11, 2)),
+ loanSchedule.get(5).get("dueDate"));
validateNumberForEqualWithMsg("Checking for Principal Due for 5th Month", "0",
String.valueOf(loanSchedule.get(5).get("principalDue")));
- assertEquals("Checking for Interest Due for 5th Month", Float.valueOf("200000"), loanSchedule.get(5).get("interestOriginalDue"));
+ assertEquals("Checking for Interest Due for 5th Month", Float.valueOf("200000"),
+ loanSchedule.get(5).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 6th Month", new ArrayList<>(Arrays.asList(2014, 12, 2)), loanSchedule.get(6).get("dueDate"));
- assertEquals("Checking for Principal Due for 6th Month", Float.valueOf("526300"), loanSchedule.get(6).get("principalDue"));
- assertEquals("Checking for Interest Due for 6th Month", Float.valueOf("200000"), loanSchedule.get(6).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 6th Month", new ArrayList<>(Arrays.asList(2014, 12, 2)),
+ loanSchedule.get(6).get("dueDate"));
+ assertEquals("Checking for Principal Due for 6th Month", Float.valueOf("526300"),
+ loanSchedule.get(6).get("principalDue"));
+ assertEquals("Checking for Interest Due for 6th Month", Float.valueOf("200000"),
+ loanSchedule.get(6).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 7th Month", new ArrayList<>(Arrays.asList(2015, 1, 2)), loanSchedule.get(7).get("dueDate"));
- assertEquals("Checking for Principal Due for 7th Month", Float.valueOf("526300"), loanSchedule.get(7).get("principalDue"));
- assertEquals("Checking for Interest Due for 7th Month", Float.valueOf("189500"), loanSchedule.get(7).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 7th Month", new ArrayList<>(Arrays.asList(2015, 1, 2)),
+ loanSchedule.get(7).get("dueDate"));
+ assertEquals("Checking for Principal Due for 7th Month", Float.valueOf("526300"),
+ loanSchedule.get(7).get("principalDue"));
+ assertEquals("Checking for Interest Due for 7th Month", Float.valueOf("189500"),
+ loanSchedule.get(7).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 10th Month", new ArrayList<>(Arrays.asList(2015, 4, 2)), loanSchedule.get(10)
- .get("dueDate"));
- assertEquals("Checking for Principal Due for 10th Month", Float.valueOf("526300"), loanSchedule.get(10).get("principalDue"));
- assertEquals("Checking for Interest Due for 10th Month", Float.valueOf("157900"), loanSchedule.get(10).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 10th Month", new ArrayList<>(Arrays.asList(2015, 4, 2)),
+ loanSchedule.get(10).get("dueDate"));
+ assertEquals("Checking for Principal Due for 10th Month", Float.valueOf("526300"),
+ loanSchedule.get(10).get("principalDue"));
+ assertEquals("Checking for Interest Due for 10th Month", Float.valueOf("157900"),
+ loanSchedule.get(10).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 20th Month", new ArrayList<>(Arrays.asList(2016, 2, 2)), loanSchedule.get(20)
- .get("dueDate"));
- assertEquals("Checking for Principal Due for 20th Month", Float.valueOf("526300"), loanSchedule.get(20).get("principalDue"));
- assertEquals("Checking for Interest Due for 20th Month", Float.valueOf("52600"), loanSchedule.get(20).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 20th Month", new ArrayList<>(Arrays.asList(2016, 2, 2)),
+ loanSchedule.get(20).get("dueDate"));
+ assertEquals("Checking for Principal Due for 20th Month", Float.valueOf("526300"),
+ loanSchedule.get(20).get("principalDue"));
+ assertEquals("Checking for Interest Due for 20th Month", Float.valueOf("52600"),
+ loanSchedule.get(20).get("interestOriginalDue"));
- assertEquals("Checking for Due Date for 24th Month", new ArrayList<>(Arrays.asList(2016, 6, 2)), loanSchedule.get(24)
- .get("dueDate"));
- assertEquals("Checking for Principal Due for 24th Month", Float.valueOf("526600"), loanSchedule.get(24).get("principalDue"));
- assertEquals("Checking for Interest Due for 24th Month", Float.valueOf("10500"), loanSchedule.get(24).get("interestOriginalDue"));
+ assertEquals("Checking for Due Date for 24th Month", new ArrayList<>(Arrays.asList(2016, 6, 2)),
+ loanSchedule.get(24).get("dueDate"));
+ assertEquals("Checking for Principal Due for 24th Month", Float.valueOf("526600"),
+ loanSchedule.get(24).get("principalDue"));
+ assertEquals("Checking for Interest Due for 24th Month", Float.valueOf("10500"),
+ loanSchedule.get(24).get("interestOriginalDue"));
}
@@ -1236,8 +1354,8 @@ public class ClientLoanIntegrationTest {
}
/***
- * Test case for checking CashBasedAccounting functionality adding charges
- * with calculation type flat
+ * Test case for checking CashBasedAccounting functionality adding charges with
+ * calculation type flat
*/
@Test
public void loanWithFlatCahargesAndCashBasedAccountingEnabled() {
@@ -1248,7 +1366,8 @@ public class ClientLoanIntegrationTest {
// Add charges with payment mode regular
List charges = new ArrayList<>();
- Integer flatDisbursement = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanDisbursementJSON());
+ Integer flatDisbursement = ChargesHelper.createCharges(requestSpec, responseSpec,
+ ChargesHelper.getLoanDisbursementJSON());
addCharges(charges, flatDisbursement, "100", null);
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "100", false));
@@ -1262,13 +1381,15 @@ public class ClientLoanIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
- final Integer loanProductID = createLoanProduct(false, CASH_BASED, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);
+ final Integer loanProductID = createLoanProduct(false, CASH_BASED, assetAccount, incomeAccount, expenseAccount,
+ overpaymentAccount);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentSchedule(loanSchedule);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -1288,26 +1409,28 @@ public class ClientLoanIntegrationTest {
HashMap secondInstallment = loanSchedule.get(2);
validateNumberForEqual("50.00", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.DEBIT),
+ final JournalEntry[] assetAccountInitialEntry = {
+ new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.DEBIT) };
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011",
+ assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.CREDIT));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(flatDisbursement, loanCharges, "100", "0.00", "100.0", "0.0");
- System.out.println("-------------Make repayment 1-----------");
+ LOG.info("-------------Make repayment 1-----------");
this.loanTransactionHelper.makeRepayment("20 October 2011", Float.valueOf("3301.49"), loanID);
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -1315,39 +1438,41 @@ public class ClientLoanIntegrationTest {
validateCharge(flatSpecifiedDueDate, loanCharges, "100", "0.00", "100.0", "0.0");
validateCharge(flatInstallmentFee, loanCharges, "50", "150.00", "50.0", "0.0");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("2911.49"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("2911.49"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 October 2011",
- new JournalEntry(Float.valueOf("150.00"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("240.00"),
- JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(flatSpecifiedDueDate), "29 October 2011", "100"));
+ new JournalEntry(Float.valueOf("150.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("240.00"), JournalEntry.TransactionType.CREDIT));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
+ "29 October 2011", "100"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("150.00", String.valueOf(secondInstallment.get("feeChargesDue")));
- this.loanTransactionHelper.waiveChargesForLoan(loanID, (Integer) getloanCharge(flatInstallmentFee, loanCharges).get("id"),
+ this.loanTransactionHelper.waiveChargesForLoan(loanID,
+ (Integer) getloanCharge(flatInstallmentFee, loanCharges).get("id"),
LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2)));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(flatInstallmentFee, loanCharges, "50", "100.00", "50.0", "50.0");
- System.out.println("----------Make repayment 2------------");
+ LOG.info("----------Make repayment 2------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3251.49"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3251.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("2969.72"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3251.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("2969.72"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("181.77"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("181.77"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- System.out.println("--------------Waive interest---------------");
+ LOG.info("--------------Waive interest---------------");
this.loanTransactionHelper.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
@@ -1356,8 +1481,9 @@ public class ClientLoanIntegrationTest {
Integer flatPenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "100", true));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(flatPenaltySpecifiedDueDate), "29 September 2011", "100"));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(flatPenaltySpecifiedDueDate), "29 September 2011", "100"));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(flatPenaltySpecifiedDueDate, loanCharges, "100", "0.00", "100.0", "0.0");
@@ -1367,33 +1493,35 @@ public class ClientLoanIntegrationTest {
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("100", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("2811.49"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("2811.49"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 October 2011",
- new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("150.00"),
- JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("240"), JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("150.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("240"), JournalEntry.TransactionType.CREDIT));
- System.out.println("----------Make repayment 3 advance------------");
+ LOG.info("----------Make repayment 3 advance------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3301.49"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3129.11"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3129.11"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("50.00"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("122.38"),
- JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(flatPenaltySpecifiedDueDate), "10 January 2012", "100"));
+ new JournalEntry(Float.valueOf("50.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("122.38"), JournalEntry.TransactionType.CREDIT));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(flatPenaltySpecifiedDueDate), "10 January 2012", "100"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
HashMap fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("100", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3239.68", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Pay applied penalty ------------");
+ LOG.info("----------Pay applied penalty ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("100"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(Float.valueOf("100"),
- JournalEntry.TransactionType.DEBIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("100"), JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 January 2012",
new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
@@ -1402,18 +1530,18 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3139.68", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Make repayment 4 ------------");
+ LOG.info("----------Make repayment 4 ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3139.68"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("3139.68"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3089.68"),
- JournalEntry.TransactionType.CREDIT));
- this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("50.00"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("3139.68"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3089.68"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("50.00"), JournalEntry.TransactionType.CREDIT));
}
/***
- * Test case for checking CashBasedAccounting functionality adding charges
- * with calculation type percentage of amount
+ * Test case for checking CashBasedAccounting functionality adding charges with
+ * calculation type percentage of amount
*/
@Test
public void loanWithCahargesOfTypeAmountPercentageAndCashBasedAccountingEnabled() {
@@ -1428,12 +1556,12 @@ public class ClientLoanIntegrationTest {
ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1"));
addCharges(charges, percentageDisbursementCharge, "1", null);
- Integer percentageSpecifiedDueDateCharge = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
+ Integer percentageSpecifiedDueDateCharge = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
addCharges(charges, percentageSpecifiedDueDateCharge, "1", "29 September 2011");
- Integer percentageInstallmentFee = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
+ Integer percentageInstallmentFee = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
addCharges(charges, percentageInstallmentFee, "1", "29 September 2011");
final Account assetAccount = this.accountHelper.createAssetAccount();
@@ -1441,13 +1569,15 @@ public class ClientLoanIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
- final Integer loanProductID = createLoanProduct(false, CASH_BASED, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);
+ final Integer loanProductID = createLoanProduct(false, CASH_BASED, assetAccount, incomeAccount, expenseAccount,
+ overpaymentAccount);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentSchedule(loanSchedule);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -1467,26 +1597,28 @@ public class ClientLoanIntegrationTest {
HashMap secondInstallment = loanSchedule.get(2);
validateNumberForEqual("29.70", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.DEBIT),
+ final JournalEntry[] assetAccountInitialEntry = {
+ new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.DEBIT) };
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011",
+ assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(percentageDisbursementCharge, loanCharges, "1", "0.0", "120.00", "0.0");
- System.out.println("-------------Make repayment 1-----------");
+ LOG.info("-------------Make repayment 1-----------");
this.loanTransactionHelper.makeRepayment("20 October 2011", Float.valueOf("3300.60"), loanID);
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -1494,49 +1626,52 @@ public class ClientLoanIntegrationTest {
validateCharge(percentageSpecifiedDueDateCharge, loanCharges, "1", "0.00", "120.0", "0.0");
validateCharge(percentageInstallmentFee, loanCharges, "1", "90.89", "29.11", "0.0");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("2911.49"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("2911.49"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 October 2011",
- new JournalEntry(Float.valueOf("149.11"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("240.00"),
- JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(percentageSpecifiedDueDateCharge), "29 October 2011", "1"));
+ new JournalEntry(Float.valueOf("149.11"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("240.00"), JournalEntry.TransactionType.CREDIT));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(percentageSpecifiedDueDateCharge), "29 October 2011", "1"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("149.70", String.valueOf(secondInstallment.get("feeChargesDue")));
- this.loanTransactionHelper.waiveChargesForLoan(loanID, (Integer) getloanCharge(percentageInstallmentFee, loanCharges).get("id"),
+ this.loanTransactionHelper.waiveChargesForLoan(loanID,
+ (Integer) getloanCharge(percentageInstallmentFee, loanCharges).get("id"),
LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2)));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(percentageInstallmentFee, loanCharges, "1", "61.19", "29.11", "29.70");
- System.out.println("----------Make repayment 2------------");
+ LOG.info("----------Make repayment 2------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3271.49"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3271.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("2969.72"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3271.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("2969.72"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("181.77"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("181.77"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- System.out.println("--------------Waive interest---------------");
+ LOG.info("--------------Waive interest---------------");
this.loanTransactionHelper.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
HashMap thirdInstallment = loanSchedule.get(3);
validateNumberForEqual("60.59", String.valueOf(thirdInstallment.get("interestOutstanding")));
- Integer percentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(percentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
+ Integer percentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(percentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(percentagePenaltySpecifiedDueDate, loanCharges, "1", "0.00", "120.0", "0.0");
@@ -1546,33 +1681,35 @@ public class ClientLoanIntegrationTest {
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("120", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("2791.49"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("2791.49"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 October 2011",
- new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("149.11"),
- JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("240"), JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("149.11"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("240"), JournalEntry.TransactionType.CREDIT));
- System.out.println("----------Make repayment 3 advance------------");
+ LOG.info("----------Make repayment 3 advance------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3301.78"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3301.78"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3149.11"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3301.78"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3149.11"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("30.29"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("122.38"),
- JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(percentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
+ new JournalEntry(Float.valueOf("30.29"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("122.38"), JournalEntry.TransactionType.CREDIT));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(percentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
HashMap fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("120", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3240.58", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Pay applied penalty ------------");
+ LOG.info("----------Pay applied penalty ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("120"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(Float.valueOf("120"),
- JournalEntry.TransactionType.DEBIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 January 2012",
new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
@@ -1581,18 +1718,18 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3120.58", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Make repayment 4 ------------");
+ LOG.info("----------Make repayment 4 ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3120.58"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("3120.58"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3089.68"),
- JournalEntry.TransactionType.CREDIT));
- this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("30.90"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("3120.58"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3089.68"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("30.90"), JournalEntry.TransactionType.CREDIT));
}
/***
- * Test case for checking CashBasedAccounting functionality adding charges
- * with calculation type percentage of amount plus interest
+ * Test case for checking CashBasedAccounting functionality adding charges with
+ * calculation type percentage of amount plus interest
*/
@Test
public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndCashBasedAccountingEnabled() {
@@ -1604,16 +1741,18 @@ public class ClientLoanIntegrationTest {
// Add charges with payment mode regular
List charges = new ArrayList<>();
Integer amountPlusInterestPercentageDisbursementCharge = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1"));
+ ChargesHelper.getLoanDisbursementJSON(
+ ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1"));
addCharges(charges, amountPlusInterestPercentageDisbursementCharge, "1", null);
- Integer amountPlusInterestPercentageSpecifiedDueDateCharge = ChargesHelper
- .createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
+ Integer amountPlusInterestPercentageSpecifiedDueDateCharge = ChargesHelper.createCharges(requestSpec,
+ responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
addCharges(charges, amountPlusInterestPercentageSpecifiedDueDateCharge, "1", "29 September 2011");
Integer amountPlusInterestPercentageInstallmentFee = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
+ ChargesHelper.getLoanInstallmentJSON(
+ ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
addCharges(charges, amountPlusInterestPercentageInstallmentFee, "1", "29 September 2011");
final Account assetAccount = this.accountHelper.createAssetAccount();
@@ -1621,13 +1760,15 @@ public class ClientLoanIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
- final Integer loanProductID = createLoanProduct(false, CASH_BASED, assetAccount, incomeAccount, expenseAccount, overpaymentAccount);
+ final Integer loanProductID = createLoanProduct(false, CASH_BASED, assetAccount, incomeAccount, expenseAccount,
+ overpaymentAccount);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentSchedule(loanSchedule);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -1647,26 +1788,28 @@ public class ClientLoanIntegrationTest {
HashMap secondInstallment = loanSchedule.get(2);
validateNumberForEqual("31.51", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.DEBIT),
+ final JournalEntry[] assetAccountInitialEntry = {
+ new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.DEBIT) };
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011",
+ assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.CREDIT));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(amountPlusInterestPercentageDisbursementCharge, loanCharges, "1", "0.0", "126.06", "0.0");
- System.out.println("-------------Make repayment 1-----------");
+ LOG.info("-------------Make repayment 1-----------");
this.loanTransactionHelper.makeRepayment("20 October 2011", Float.valueOf("3309.06"), loanID);
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -1674,14 +1817,13 @@ public class ClientLoanIntegrationTest {
validateCharge(amountPlusInterestPercentageSpecifiedDueDateCharge, loanCharges, "1", "0.00", "126.06", "0.0");
validateCharge(amountPlusInterestPercentageInstallmentFee, loanCharges, "1", "94.53", "31.51", "0.0");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("2911.49"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("2911.49"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 October 2011",
- new JournalEntry(Float.valueOf("157.57"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("240.00"),
- JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(
- loanID,
+ new JournalEntry(Float.valueOf("157.57"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("240.00"), JournalEntry.TransactionType.CREDIT));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(amountPlusInterestPercentageSpecifiedDueDateCharge), "29 October 2011", "1"));
loanSchedule.clear();
@@ -1696,30 +1838,30 @@ public class ClientLoanIntegrationTest {
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(amountPlusInterestPercentageInstallmentFee, loanCharges, "1", "63.02", "31.51", "31.51");
- System.out.println("----------Make repayment 2------------");
+ LOG.info("----------Make repayment 2------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3277.55"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3277.55"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("2969.72"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3277.55"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("2969.72"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("181.77"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("181.77"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- System.out.println("--------------Waive interest---------------");
+ LOG.info("--------------Waive interest---------------");
this.loanTransactionHelper.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
HashMap thirdInstallment = loanSchedule.get(3);
validateNumberForEqual("60.59", String.valueOf(thirdInstallment.get("interestOutstanding")));
- Integer amountPlusInterestPercentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
- this.loanTransactionHelper.addChargesForLoan(
- loanID,
+ Integer amountPlusInterestPercentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec,
+ responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
+ ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(amountPlusInterestPercentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
loanCharges.clear();
@@ -1731,22 +1873,23 @@ public class ClientLoanIntegrationTest {
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("120", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("2791.49"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("2791.49"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 October 2011",
- new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("157.57"),
- JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("240"), JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("157.57"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("240"), JournalEntry.TransactionType.CREDIT));
- System.out.println("----------Make repayment 3 advance------------");
+ LOG.info("----------Make repayment 3 advance------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3303"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011", new JournalEntry(Float.valueOf("3303"),
- JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3149.11"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
+ new JournalEntry(Float.valueOf("3303"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3149.11"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("31.51"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("122.38"),
- JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(
- loanID,
+ new JournalEntry(Float.valueOf("31.51"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("122.38"), JournalEntry.TransactionType.CREDIT));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(amountPlusInterestPercentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
loanSchedule.clear();
@@ -1755,10 +1898,10 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("120", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3241.19", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Pay applied penalty ------------");
+ LOG.info("----------Pay applied penalty ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("120"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(Float.valueOf("120"),
- JournalEntry.TransactionType.DEBIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.DEBIT));
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 January 2012",
new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
@@ -1767,18 +1910,18 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3121.19", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Make repayment 4 ------------");
+ LOG.info("----------Make repayment 4 ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3121.19"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("3121.19"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3089.68"),
- JournalEntry.TransactionType.CREDIT));
- this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("31.51"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("3121.19"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3089.68"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("31.51"), JournalEntry.TransactionType.CREDIT));
}
/***
- * Test case for checking AccuralUpfrontAccounting functionality adding
- * charges with calculation type flat
+ * Test case for checking AccuralUpfrontAccounting functionality adding charges
+ * with calculation type flat
*/
@Test
public void loanWithFlatCahargesAndUpfrontAccrualAccountingEnabled() {
@@ -1789,7 +1932,8 @@ public class ClientLoanIntegrationTest {
// Add charges with payment mode regular
List charges = new ArrayList<>();
- Integer flatDisbursement = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanDisbursementJSON());
+ Integer flatDisbursement = ChargesHelper.createCharges(requestSpec, responseSpec,
+ ChargesHelper.getLoanDisbursementJSON());
addCharges(charges, flatDisbursement, "100", null);
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "100", false));
@@ -1803,14 +1947,15 @@ public class ClientLoanIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
- final Integer loanProductID = createLoanProduct(false, ACCRUAL_UPFRONT, assetAccount, incomeAccount, expenseAccount,
- overpaymentAccount);
+ final Integer loanProductID = createLoanProduct(false, ACCRUAL_UPFRONT, assetAccount, incomeAccount,
+ expenseAccount, overpaymentAccount);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentSchedule(loanSchedule);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -1829,28 +1974,31 @@ public class ClientLoanIntegrationTest {
HashMap secondInstallment = loanSchedule.get(2);
validateNumberForEqual("50.00", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.DEBIT),
+ final JournalEntry[] assetAccountInitialEntry = {
+ new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("200.00"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.DEBIT) };
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011",
+ assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
- new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("100.00"),
- JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("200.00"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(flatSpecifiedDueDate), "29 September 2011", "100"));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
+ "29 September 2011", "100"));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -1862,7 +2010,7 @@ public class ClientLoanIntegrationTest {
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "29 September 2011",
new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.CREDIT));
- System.out.println("-------------Make repayment 1-----------");
+ LOG.info("-------------Make repayment 1-----------");
this.loanTransactionHelper.makeRepayment("20 October 2011", Float.valueOf("3301.49"), loanID);
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -1870,41 +2018,43 @@ public class ClientLoanIntegrationTest {
validateCharge(flatSpecifiedDueDate, loanCharges, "100", "0.00", "100.0", "0.0");
validateCharge(flatInstallmentFee, loanCharges, "50", "150.00", "50.0", "0.0");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3301.49"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(flatSpecifiedDueDate), "29 October 2011", "100"));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
+ "29 October 2011", "100"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("150.00", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("----------- Waive installment charge for 2nd installment ---------");
- this.loanTransactionHelper.waiveChargesForLoan(loanID, (Integer) getloanCharge(flatInstallmentFee, loanCharges).get("id"),
+ LOG.info("----------- Waive installment charge for 2nd installment ---------");
+ this.loanTransactionHelper.waiveChargesForLoan(loanID,
+ (Integer) getloanCharge(flatInstallmentFee, loanCharges).get("id"),
LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2)));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(flatInstallmentFee, loanCharges, "50", "100.00", "50.0", "50.0");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011", new JournalEntry(Float.valueOf("50.0"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
+ new JournalEntry(Float.valueOf("50.0"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 November 2011",
new JournalEntry(Float.valueOf("50.0"), JournalEntry.TransactionType.DEBIT));
- System.out.println("----------Make repayment 2------------");
+ LOG.info("----------Make repayment 2------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3251.49"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3251.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3251.49"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3251.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3251.49"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- System.out.println("--------------Waive interest---------------");
+ LOG.info("--------------Waive interest---------------");
this.loanTransactionHelper.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
loanSchedule.clear();
@@ -1912,15 +2062,16 @@ public class ClientLoanIntegrationTest {
HashMap thirdInstallment = loanSchedule.get(3);
validateNumberForEqual("60.59", String.valueOf(thirdInstallment.get("interestOutstanding")));
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011", new JournalEntry(Float.valueOf("61.79"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011",
+ new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 December 2011",
new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.DEBIT));
Integer flatPenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "100", true));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(flatPenaltySpecifiedDueDate), "29 September 2011", "100"));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(flatPenaltySpecifiedDueDate), "29 September 2011", "100"));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(flatPenaltySpecifiedDueDate, loanCharges, "100", "0.00", "100.0", "0.0");
@@ -1931,47 +2082,50 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("100", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
// checking the journal entry as applied penalty has been collected
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3301.49"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.CREDIT));
- System.out.println("----------Make repayment 3 advance------------");
+ LOG.info("----------Make repayment 3 advance------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3301.49"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3301.49"),
- JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(flatPenaltySpecifiedDueDate), "10 January 2012", "100"));
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.CREDIT));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(flatPenaltySpecifiedDueDate), "10 January 2012", "100"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
HashMap fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("100", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3239.68", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Pay applied penalty ------------");
+ LOG.info("----------Pay applied penalty ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("100"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(Float.valueOf("100"),
- JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("100"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("100"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("100"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3139.68", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Make over payment for repayment 4 ------------");
+ LOG.info("----------Make over payment for repayment 4 ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3220.60"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("3220.60"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3139.68"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("3220.60"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3139.68"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, "20 January 2012",
new JournalEntry(Float.valueOf("80.92"), JournalEntry.TransactionType.CREDIT));
- loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, loanID, "status");
+ loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
+ loanID, "status");
LoanStatusChecker.verifyLoanAccountIsOverPaid(loanStatusHashMap);
}
/***
- * Test case for checking AccuralUpfrontAccounting functionality adding
- * charges with calculation type percentage of amount
+ * Test case for checking AccuralUpfrontAccounting functionality adding charges
+ * with calculation type percentage of amount
*/
@Test
public void loanWithCahargesAndUpfrontAccrualAccountingEnabled() {
@@ -1986,12 +2140,12 @@ public class ClientLoanIntegrationTest {
ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1"));
addCharges(charges, percentageDisbursementCharge, "1", null);
- Integer percentageSpecifiedDueDateCharge = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
+ Integer percentageSpecifiedDueDateCharge = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
addCharges(charges, percentageSpecifiedDueDateCharge, "1", "29 September 2011");
- Integer percentageInstallmentFee = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
+ Integer percentageInstallmentFee = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
addCharges(charges, percentageInstallmentFee, "1", "29 September 2011");
final Account assetAccount = this.accountHelper.createAssetAccount();
@@ -1999,14 +2153,15 @@ public class ClientLoanIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
- final Integer loanProductID = createLoanProduct(false, ACCRUAL_UPFRONT, assetAccount, incomeAccount, expenseAccount,
- overpaymentAccount);
+ final Integer loanProductID = createLoanProduct(false, ACCRUAL_UPFRONT, assetAccount, incomeAccount,
+ expenseAccount, overpaymentAccount);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentSchedule(loanSchedule);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2026,32 +2181,34 @@ public class ClientLoanIntegrationTest {
HashMap secondInstallment = loanSchedule.get(2);
validateNumberForEqual("29.70", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.DEBIT),
+ final JournalEntry[] assetAccountInitialEntry = {
+ new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.DEBIT) };
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011",
+ assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
- new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("120.00"),
- JournalEntry.TransactionType.CREDIT),
- new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("120.00"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(percentageDisbursementCharge, loanCharges, "1", "0.0", "120.00", "0.0");
- System.out.println("-------------Make repayment 1-----------");
+ LOG.info("-------------Make repayment 1-----------");
this.loanTransactionHelper.makeRepayment("20 October 2011", Float.valueOf("3300.60"), loanID);
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2059,41 +2216,43 @@ public class ClientLoanIntegrationTest {
validateCharge(percentageSpecifiedDueDateCharge, loanCharges, "1", "0.00", "120.0", "0.0");
validateCharge(percentageInstallmentFee, loanCharges, "1", "90.89", "29.11", "0.0");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3300.60"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3300.60"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(percentageSpecifiedDueDateCharge), "29 October 2011", "1"));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(percentageSpecifiedDueDateCharge), "29 October 2011", "1"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("149.70", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("----------- Waive installment charge for 2nd installment ---------");
- this.loanTransactionHelper.waiveChargesForLoan(loanID, (Integer) getloanCharge(percentageInstallmentFee, loanCharges).get("id"),
+ LOG.info("----------- Waive installment charge for 2nd installment ---------");
+ this.loanTransactionHelper.waiveChargesForLoan(loanID,
+ (Integer) getloanCharge(percentageInstallmentFee, loanCharges).get("id"),
LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2)));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(percentageInstallmentFee, loanCharges, "1", "61.19", "29.11", "29.70");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011", new JournalEntry(Float.valueOf("29.7"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
+ new JournalEntry(Float.valueOf("29.7"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 November 2011",
new JournalEntry(Float.valueOf("29.7"), JournalEntry.TransactionType.DEBIT));
- System.out.println("----------Make repayment 2------------");
+ LOG.info("----------Make repayment 2------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3271.49"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3271.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3271.49"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3271.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3271.49"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- System.out.println("--------------Waive interest---------------");
+ LOG.info("--------------Waive interest---------------");
this.loanTransactionHelper.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
loanSchedule.clear();
@@ -2101,15 +2260,16 @@ public class ClientLoanIntegrationTest {
HashMap thirdInstallment = loanSchedule.get(3);
validateNumberForEqual("60.59", String.valueOf(thirdInstallment.get("interestOutstanding")));
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011", new JournalEntry(Float.valueOf("61.79"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011",
+ new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 December 2011",
new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.DEBIT));
- Integer percentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(percentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
+ Integer percentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(percentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(percentagePenaltySpecifiedDueDate, loanCharges, "1", "0.00", "120.0", "0.0");
@@ -2120,47 +2280,50 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("120", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
// checking the journal entry as applied penalty has been collected
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3300.60"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3300.60"), JournalEntry.TransactionType.CREDIT));
- System.out.println("----------Make repayment 3 advance------------");
+ LOG.info("----------Make repayment 3 advance------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3301.78"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3301.78"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3301.78"),
- JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(percentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
+ new JournalEntry(Float.valueOf("3301.78"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3301.78"), JournalEntry.TransactionType.CREDIT));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(percentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
HashMap fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("120", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3240.58", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Pay applied penalty ------------");
+ LOG.info("----------Pay applied penalty ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("120"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(Float.valueOf("120"),
- JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3120.58", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Make over payment for repayment 4 ------------");
+ LOG.info("----------Make over payment for repayment 4 ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3220.58"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("3220.58"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3120.58"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("3220.58"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3120.58"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, "20 January 2012",
new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.CREDIT));
- loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, loanID, "status");
+ loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
+ loanID, "status");
LoanStatusChecker.verifyLoanAccountIsOverPaid(loanStatusHashMap);
}
/***
- * Test case for checking AccuralUpfrontAccounting functionality adding
- * charges with calculation type percentage of amount plus interest
+ * Test case for checking AccuralUpfrontAccounting functionality adding charges
+ * with calculation type percentage of amount plus interest
*/
@Test
public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndUpfrontAccrualAccountingEnabled() {
@@ -2172,15 +2335,17 @@ public class ClientLoanIntegrationTest {
// Add charges with payment mode regular
List charges = new ArrayList<>();
Integer amountPlusInterestPercentageDisbursementCharge = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1"));
+ ChargesHelper.getLoanDisbursementJSON(
+ ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1"));
addCharges(charges, amountPlusInterestPercentageDisbursementCharge, "1", null);
- Integer amountPlusInterestPercentageSpecifiedDueDateCharge = ChargesHelper
- .createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
+ Integer amountPlusInterestPercentageSpecifiedDueDateCharge = ChargesHelper.createCharges(requestSpec,
+ responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
Integer amountPlusInterestPercentageInstallmentFee = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
+ ChargesHelper.getLoanInstallmentJSON(
+ ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
addCharges(charges, amountPlusInterestPercentageInstallmentFee, "1", "29 September 2011");
final Account assetAccount = this.accountHelper.createAssetAccount();
@@ -2188,14 +2353,15 @@ public class ClientLoanIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
- final Integer loanProductID = createLoanProduct(false, ACCRUAL_UPFRONT, assetAccount, incomeAccount, expenseAccount,
- overpaymentAccount);
+ final Integer loanProductID = createLoanProduct(false, ACCRUAL_UPFRONT, assetAccount, incomeAccount,
+ expenseAccount, overpaymentAccount);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentSchedule(loanSchedule);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2214,28 +2380,29 @@ public class ClientLoanIntegrationTest {
HashMap secondInstallment = loanSchedule.get(2);
validateNumberForEqual("31.51", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.DEBIT),
+ final JournalEntry[] assetAccountInitialEntry = {
+ new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("126.04"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.DEBIT) };
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011",
+ assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
- new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.CREDIT), new JournalEntry(Float.valueOf("126.06"),
- JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("605.94"), JournalEntry.TransactionType.CREDIT),
+ new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("126.04"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(
- loanID,
+ this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(amountPlusInterestPercentageSpecifiedDueDateCharge), "29 September 2011", "1"));
@@ -2249,7 +2416,7 @@ public class ClientLoanIntegrationTest {
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "29 September 2011",
new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.CREDIT));
- System.out.println("-------------Make repayment 1-----------");
+ LOG.info("-------------Make repayment 1-----------");
this.loanTransactionHelper.makeRepayment("20 October 2011", Float.valueOf("3309.06"), loanID);
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2257,12 +2424,11 @@ public class ClientLoanIntegrationTest {
validateCharge(amountPlusInterestPercentageSpecifiedDueDateCharge, loanCharges, "1", "0.00", "126.06", "0.0");
validateCharge(amountPlusInterestPercentageInstallmentFee, loanCharges, "1", "94.53", "31.51", "0.0");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3309.06"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3309.06"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(
- loanID,
+ this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(amountPlusInterestPercentageSpecifiedDueDateCharge), "29 October 2011", "1"));
loanSchedule.clear();
@@ -2270,7 +2436,7 @@ public class ClientLoanIntegrationTest {
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("157.57", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("----------- Waive installment charge for 2nd installment ---------");
+ LOG.info("----------- Waive installment charge for 2nd installment ---------");
this.loanTransactionHelper.waiveChargesForLoan(loanID,
(Integer) getloanCharge(amountPlusInterestPercentageInstallmentFee, loanCharges).get("id"),
LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2)));
@@ -2278,23 +2444,23 @@ public class ClientLoanIntegrationTest {
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(amountPlusInterestPercentageInstallmentFee, loanCharges, "1", "63.02", "31.51", "31.51");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011", new JournalEntry(
- Float.valueOf("31.51"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
+ new JournalEntry(Float.valueOf("31.51"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 November 2011",
new JournalEntry(Float.valueOf("31.51"), JournalEntry.TransactionType.DEBIT));
- System.out.println("----------Make repayment 2------------");
+ LOG.info("----------Make repayment 2------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3277.55"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3277.55"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3277.55"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3277.55"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3277.55"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- System.out.println("--------------Waive interest---------------");
+ LOG.info("--------------Waive interest---------------");
this.loanTransactionHelper.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
loanSchedule.clear();
@@ -2302,15 +2468,15 @@ public class ClientLoanIntegrationTest {
HashMap thirdInstallment = loanSchedule.get(3);
validateNumberForEqual("60.59", String.valueOf(thirdInstallment.get("interestOutstanding")));
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011", new JournalEntry(Float.valueOf("61.79"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011",
+ new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 December 2011",
new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.DEBIT));
- Integer amountPlusInterestPercentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
- this.loanTransactionHelper.addChargesForLoan(
- loanID,
+ Integer amountPlusInterestPercentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec,
+ responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
+ ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(amountPlusInterestPercentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
loanCharges.clear();
@@ -2323,16 +2489,16 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("120", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
// checking the journal entry as applied penalty has been collected
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3309.06"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3309.06"), JournalEntry.TransactionType.CREDIT));
- System.out.println("----------Make repayment 3 advance------------");
+ LOG.info("----------Make repayment 3 advance------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3303"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011", new JournalEntry(Float.valueOf("3303"),
- JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3303"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(
- loanID,
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
+ new JournalEntry(Float.valueOf("3303"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3303"), JournalEntry.TransactionType.CREDIT));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(amountPlusInterestPercentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
loanSchedule.clear();
@@ -2341,30 +2507,32 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("120", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3241.19", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Pay applied penalty ------------");
+ LOG.info("----------Pay applied penalty ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("120"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(Float.valueOf("120"),
- JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3121.19", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Make over payment for repayment 4 ------------");
+ LOG.info("----------Make over payment for repayment 4 ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3221.61"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("3221.61"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3121.19"),
- JournalEntry.TransactionType.CREDIT));
- this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, "20 January 2012", new JournalEntry(Float.valueOf("100.42"),
- JournalEntry.TransactionType.CREDIT));
- loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, loanID, "status");
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("3221.61"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3121.19"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("100.42"), JournalEntry.TransactionType.CREDIT));
+ loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
+ loanID, "status");
LoanStatusChecker.verifyLoanAccountIsOverPaid(loanStatusHashMap);
}
/***
- * Test case for checking AccuralPeriodicAccounting functionality adding
- * charges with calculation type flat
+ * Test case for checking AccuralPeriodicAccounting functionality adding charges
+ * with calculation type flat
*/
@Test
@Ignore // TODO FINERACT-885
@@ -2377,7 +2545,8 @@ public class ClientLoanIntegrationTest {
// Add charges with payment mode regular
List charges = new ArrayList<>();
- Integer flatDisbursement = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper.getLoanDisbursementJSON());
+ Integer flatDisbursement = ChargesHelper.createCharges(requestSpec, responseSpec,
+ ChargesHelper.getLoanDisbursementJSON());
addCharges(charges, flatDisbursement, "100", null);
Integer flatSpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "100", false));
@@ -2391,14 +2560,15 @@ public class ClientLoanIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
- final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount, expenseAccount,
- overpaymentAccount);
+ final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount,
+ expenseAccount, overpaymentAccount);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentSchedule(loanSchedule);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2418,26 +2588,28 @@ public class ClientLoanIntegrationTest {
HashMap secondInstallment = loanSchedule.get(2);
validateNumberForEqual("50.00", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.DEBIT),
+ final JournalEntry[] assetAccountInitialEntry = {
+ new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.DEBIT) };
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011",
+ assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
new JournalEntry(Float.valueOf("100.00"), JournalEntry.TransactionType.CREDIT));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(flatDisbursement, loanCharges, "100", "0.00", "100.0", "0.0");
- System.out.println("-------------Make repayment 1-----------");
+ LOG.info("-------------Make repayment 1-----------");
this.loanTransactionHelper.makeRepayment("20 October 2011", Float.valueOf("3301.49"), loanID);
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2445,19 +2617,21 @@ public class ClientLoanIntegrationTest {
validateCharge(flatSpecifiedDueDate, loanCharges, "100", "0.00", "100.0", "0.0");
validateCharge(flatInstallmentFee, loanCharges, "50", "150.00", "50.0", "0.0");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3301.49"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(flatSpecifiedDueDate), "29 October 2011", "100"));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(flatSpecifiedDueDate),
+ "29 October 2011", "100"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("150.00", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("----------- Waive installment charge for 2nd installment ---------");
- this.loanTransactionHelper.waiveChargesForLoan(loanID, (Integer) getloanCharge(flatInstallmentFee, loanCharges).get("id"),
+ LOG.info("----------- Waive installment charge for 2nd installment ---------");
+ this.loanTransactionHelper.waiveChargesForLoan(loanID,
+ (Integer) getloanCharge(flatInstallmentFee, loanCharges).get("id"),
LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2)));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2467,9 +2641,8 @@ public class ClientLoanIntegrationTest {
* this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount,
* "20 September 2011", new JournalEntry(Float.valueOf("50.0"),
* JournalEntry.TransactionType.CREDIT));
- * this.journalEntryHelper.checkJournalEntryForExpenseAccount
- * (expenseAccount, "20 September 2011", new
- * JournalEntry(Float.valueOf("50.0"),
+ * this.journalEntryHelper.checkJournalEntryForExpenseAccount (expenseAccount,
+ * "20 September 2011", new JournalEntry(Float.valueOf("50.0"),
* JournalEntry.TransactionType.DEBIT));
*/
final String jobName = "Add Accrual Transactions";
@@ -2483,18 +2656,18 @@ public class ClientLoanIntegrationTest {
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
checkAccrualTransactions(loanSchedule, loanID);
- System.out.println("----------Make repayment 2------------");
+ LOG.info("----------Make repayment 2------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3251.49"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3251.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3251.49"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3251.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3251.49"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- System.out.println("--------------Waive interest---------------");
+ LOG.info("--------------Waive interest---------------");
this.loanTransactionHelper.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
loanSchedule.clear();
@@ -2502,15 +2675,16 @@ public class ClientLoanIntegrationTest {
HashMap thirdInstallment = loanSchedule.get(3);
validateNumberForEqual("60.59", String.valueOf(thirdInstallment.get("interestOutstanding")));
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011", new JournalEntry(Float.valueOf("61.79"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011",
+ new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 December 2011",
new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.DEBIT));
Integer flatPenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, "100", true));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(flatPenaltySpecifiedDueDate), "29 September 2011", "100"));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(flatPenaltySpecifiedDueDate), "29 September 2011", "100"));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(flatPenaltySpecifiedDueDate, loanCharges, "100", "0.00", "100.0", "0.0");
@@ -2521,46 +2695,49 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("100", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
// checking the journal entry as applied penalty has been collected
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3301.49"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.CREDIT));
- System.out.println("----------Make repayment 3 advance------------");
+ LOG.info("----------Make repayment 3 advance------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3301.49"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3301.49"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3301.49"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(flatPenaltySpecifiedDueDate), "10 January 2012", "100"));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(flatPenaltySpecifiedDueDate), "10 January 2012", "100"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
HashMap fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("100", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3239.68", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Pay applied penalty ------------");
+ LOG.info("----------Pay applied penalty ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("100"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(Float.valueOf("100"),
- JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("100"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("100"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("100"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3139.68", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Make repayment 4 ------------");
+ LOG.info("----------Make repayment 4 ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3139.68"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("3139.68"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3139.68"),
- JournalEntry.TransactionType.CREDIT));
- loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, loanID, "status");
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("3139.68"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3139.68"), JournalEntry.TransactionType.CREDIT));
+ loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
+ loanID, "status");
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
}
/**
- * Test case for checking AccuralPeriodicAccounting functionality adding
- * charges with calculation type percentage of amount
+ * Test case for checking AccuralPeriodicAccounting functionality adding charges
+ * with calculation type percentage of amount
*/
@Test
@Ignore // TODO FINERACT-885
@@ -2577,12 +2754,12 @@ public class ClientLoanIntegrationTest {
ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1"));
addCharges(charges, percentageDisbursementCharge, "1", null);
- Integer percentageSpecifiedDueDateCharge = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
+ Integer percentageSpecifiedDueDateCharge = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
addCharges(charges, percentageSpecifiedDueDateCharge, "1", "29 September 2011");
- Integer percentageInstallmentFee = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
+ Integer percentageInstallmentFee = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", false));
addCharges(charges, percentageInstallmentFee, "1", "29 September 2011");
final Account assetAccount = this.accountHelper.createAssetAccount();
@@ -2590,14 +2767,15 @@ public class ClientLoanIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
- final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount, expenseAccount,
- overpaymentAccount);
+ final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount,
+ expenseAccount, overpaymentAccount);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentSchedule(loanSchedule);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2617,26 +2795,28 @@ public class ClientLoanIntegrationTest {
HashMap secondInstallment = loanSchedule.get(2);
validateNumberForEqual("29.70", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.DEBIT),
+ final JournalEntry[] assetAccountInitialEntry = {
+ new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.DEBIT) };
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011",
+ assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
new JournalEntry(Float.valueOf("120.00"), JournalEntry.TransactionType.CREDIT));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(percentageDisbursementCharge, loanCharges, "1", "0.0", "120.00", "0.0");
- System.out.println("-------------Make repayment 1-----------");
+ LOG.info("-------------Make repayment 1-----------");
this.loanTransactionHelper.makeRepayment("20 October 2011", Float.valueOf("3300.60"), loanID);
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2644,19 +2824,21 @@ public class ClientLoanIntegrationTest {
validateCharge(percentageSpecifiedDueDateCharge, loanCharges, "1", "0.00", "120.0", "0.0");
validateCharge(percentageInstallmentFee, loanCharges, "1", "90.89", "29.11", "0.0");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3300.60"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3300.60"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(percentageSpecifiedDueDateCharge), "29 October 2011", "1"));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(percentageSpecifiedDueDateCharge), "29 October 2011", "1"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("149.70", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("----------- Waive installment charge for 2nd installment ---------");
- this.loanTransactionHelper.waiveChargesForLoan(loanID, (Integer) getloanCharge(percentageInstallmentFee, loanCharges).get("id"),
+ LOG.info("----------- Waive installment charge for 2nd installment ---------");
+ this.loanTransactionHelper.waiveChargesForLoan(loanID,
+ (Integer) getloanCharge(percentageInstallmentFee, loanCharges).get("id"),
LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2)));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2666,9 +2848,8 @@ public class ClientLoanIntegrationTest {
* this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount,
* "20 September 2011", new JournalEntry(Float.valueOf("29.7"),
* JournalEntry.TransactionType.CREDIT));
- * this.journalEntryHelper.checkJournalEntryForExpenseAccount
- * (expenseAccount, "20 September 2011", new
- * JournalEntry(Float.valueOf("29.7"),
+ * this.journalEntryHelper.checkJournalEntryForExpenseAccount (expenseAccount,
+ * "20 September 2011", new JournalEntry(Float.valueOf("29.7"),
* JournalEntry.TransactionType.DEBIT));
*/
@@ -2683,18 +2864,18 @@ public class ClientLoanIntegrationTest {
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
checkAccrualTransactions(loanSchedule, loanID);
- System.out.println("----------Make repayment 2------------");
+ LOG.info("----------Make repayment 2------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3271.49"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3271.49"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3271.49"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3271.49"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3271.49"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- System.out.println("--------------Waive interest---------------");
+ LOG.info("--------------Waive interest---------------");
this.loanTransactionHelper.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
loanSchedule.clear();
@@ -2702,15 +2883,16 @@ public class ClientLoanIntegrationTest {
HashMap thirdInstallment = loanSchedule.get(3);
validateNumberForEqual("60.59", String.valueOf(thirdInstallment.get("interestOutstanding")));
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011", new JournalEntry(Float.valueOf("61.79"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011",
+ new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 December 2011",
new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.DEBIT));
- Integer percentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(percentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
+ Integer percentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper
+ .getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(percentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(percentagePenaltySpecifiedDueDate, loanCharges, "1", "0.00", "120.0", "0.0");
@@ -2721,46 +2903,49 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("120", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
// checking the journal entry as applied penalty has been collected
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3300.60"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3300.60"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3300.60"), JournalEntry.TransactionType.CREDIT));
- System.out.println("----------Make repayment 3 advance------------");
+ LOG.info("----------Make repayment 3 advance------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3301.78"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3301.78"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3301.78"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3301.78"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3301.78"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(loanID, LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
- String.valueOf(percentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
+ LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
+ String.valueOf(percentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
HashMap fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("120", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3240.58", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Pay applied penalty ------------");
+ LOG.info("----------Pay applied penalty ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("120"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(Float.valueOf("120"),
- JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3120.58", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Make repayment 4 ------------");
+ LOG.info("----------Make repayment 4 ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3120.58"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("3120.58"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3120.58"),
- JournalEntry.TransactionType.CREDIT));
- loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, loanID, "status");
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("3120.58"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3120.58"), JournalEntry.TransactionType.CREDIT));
+ loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
+ loanID, "status");
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
}
/***
- * Test case for checking AccuralPeriodicAccounting functionality adding
- * charges with calculation type percentage of amount and interest
+ * Test case for checking AccuralPeriodicAccounting functionality adding charges
+ * with calculation type percentage of amount and interest
*/
@Test
@Ignore // TODO FINERACT-885
@@ -2774,16 +2959,18 @@ public class ClientLoanIntegrationTest {
// Add charges with payment mode regular
List charges = new ArrayList<>();
Integer amountPlusInterestPercentageDisbursementCharge = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanDisbursementJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1"));
+ ChargesHelper.getLoanDisbursementJSON(
+ ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1"));
addCharges(charges, amountPlusInterestPercentageDisbursementCharge, "1", null);
- Integer amountPlusInterestPercentageSpecifiedDueDateCharge = ChargesHelper
- .createCharges(requestSpec, responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
+ Integer amountPlusInterestPercentageSpecifiedDueDateCharge = ChargesHelper.createCharges(requestSpec,
+ responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
addCharges(charges, amountPlusInterestPercentageSpecifiedDueDateCharge, "1", "29 September 2011");
Integer amountPlusInterestPercentageInstallmentFee = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanInstallmentJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
+ ChargesHelper.getLoanInstallmentJSON(
+ ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST, "1", false));
addCharges(charges, amountPlusInterestPercentageInstallmentFee, "1", "29 September 2011");
final Account assetAccount = this.accountHelper.createAssetAccount();
@@ -2791,14 +2978,15 @@ public class ClientLoanIntegrationTest {
final Account expenseAccount = this.accountHelper.createExpenseAccount();
final Account overpaymentAccount = this.accountHelper.createLiabilityAccount();
- final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount, expenseAccount,
- overpaymentAccount);
+ final Integer loanProductID = createLoanProduct(false, ACCRUAL_PERIODIC, assetAccount, incomeAccount,
+ expenseAccount, overpaymentAccount);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, charges, null, "12,000.00");
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentSchedule(loanSchedule);
List loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2818,26 +3006,28 @@ public class ClientLoanIntegrationTest {
HashMap secondInstallment = loanSchedule.get(2);
validateNumberForEqual("31.51", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.DEBIT),
+ final JournalEntry[] assetAccountInitialEntry = {
+ new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.DEBIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.CREDIT),
new JournalEntry(Float.valueOf("12000.00"), JournalEntry.TransactionType.DEBIT) };
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011", assetAccountInitialEntry);
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 September 2011",
+ assetAccountInitialEntry);
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, "20 September 2011",
new JournalEntry(Float.valueOf("126.06"), JournalEntry.TransactionType.CREDIT));
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
validateCharge(amountPlusInterestPercentageDisbursementCharge, loanCharges, "1", "0.0", "126.06", "0.0");
- System.out.println("-------------Make repayment 1-----------");
+ LOG.info("-------------Make repayment 1-----------");
this.loanTransactionHelper.makeRepayment("20 October 2011", Float.valueOf("3309.06"), loanID);
loanCharges.clear();
loanCharges = this.loanTransactionHelper.getLoanCharges(loanID);
@@ -2845,12 +3035,11 @@ public class ClientLoanIntegrationTest {
validateCharge(amountPlusInterestPercentageSpecifiedDueDateCharge, loanCharges, "1", "0.00", "126.06", "0.0");
validateCharge(amountPlusInterestPercentageInstallmentFee, loanCharges, "1", "94.53", "31.51", "0.0");
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3309.06"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3309.06"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(
- loanID,
+ this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(amountPlusInterestPercentageSpecifiedDueDateCharge), "29 October 2011", "1"));
loanSchedule.clear();
@@ -2858,7 +3047,7 @@ public class ClientLoanIntegrationTest {
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("157.57", String.valueOf(secondInstallment.get("feeChargesDue")));
- System.out.println("----------- Waive installment charge for 2nd installment ---------");
+ LOG.info("----------- Waive installment charge for 2nd installment ---------");
this.loanTransactionHelper.waiveChargesForLoan(loanID,
(Integer) getloanCharge(amountPlusInterestPercentageInstallmentFee, loanCharges).get("id"),
LoanTransactionHelper.getWaiveChargeJSON(String.valueOf(2)));
@@ -2870,9 +3059,8 @@ public class ClientLoanIntegrationTest {
* this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount,
* "20 September 2011", new JournalEntry( Float.valueOf("31.51"),
* JournalEntry.TransactionType.CREDIT));
- * this.journalEntryHelper.checkJournalEntryForExpenseAccount
- * (expenseAccount, "20 September 2011", new
- * JournalEntry(Float.valueOf("31.51"),
+ * this.journalEntryHelper.checkJournalEntryForExpenseAccount (expenseAccount,
+ * "20 September 2011", new JournalEntry(Float.valueOf("31.51"),
* JournalEntry.TransactionType.DEBIT));
*/
@@ -2887,18 +3075,18 @@ public class ClientLoanIntegrationTest {
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
checkAccrualTransactions(loanSchedule, loanID);
- System.out.println("----------Make repayment 2------------");
+ LOG.info("----------Make repayment 2------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3277.55"), loanID);
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
- new JournalEntry(Float.valueOf("3277.55"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3277.55"),
- JournalEntry.TransactionType.CREDIT));
+ new JournalEntry(Float.valueOf("3277.55"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3277.55"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
- System.out.println("--------------Waive interest---------------");
+ LOG.info("--------------Waive interest---------------");
this.loanTransactionHelper.waiveInterest("20 December 2011", String.valueOf(61.79), loanID);
loanSchedule.clear();
@@ -2906,15 +3094,15 @@ public class ClientLoanIntegrationTest {
HashMap thirdInstallment = loanSchedule.get(3);
validateNumberForEqual("60.59", String.valueOf(thirdInstallment.get("interestOutstanding")));
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011", new JournalEntry(Float.valueOf("61.79"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 December 2011",
+ new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, "20 December 2011",
new JournalEntry(Float.valueOf("61.79"), JournalEntry.TransactionType.DEBIT));
- Integer amountPlusInterestPercentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec, responseSpec,
- ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
- this.loanTransactionHelper.addChargesForLoan(
- loanID,
+ Integer amountPlusInterestPercentagePenaltySpecifiedDueDate = ChargesHelper.createCharges(requestSpec,
+ responseSpec, ChargesHelper.getLoanSpecifiedDueDateJSON(
+ ChargesHelper.CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT, "1", true));
+ this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(amountPlusInterestPercentagePenaltySpecifiedDueDate), "29 September 2011", "1"));
loanCharges.clear();
@@ -2927,17 +3115,17 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("120", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
// checking the journal entry as applied penalty has been collected
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011", new JournalEntry(
- Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3309.06"),
- JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 October 2011",
+ new JournalEntry(Float.valueOf("3309.06"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3309.06"), JournalEntry.TransactionType.CREDIT));
- System.out.println("----------Make repayment 3 advance------------");
+ LOG.info("----------Make repayment 3 advance------------");
this.loanTransactionHelper.makeRepayment("20 November 2011", Float.valueOf("3303"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011", new JournalEntry(Float.valueOf("3303"),
- JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3303"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 November 2011",
+ new JournalEntry(Float.valueOf("3303"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3303"), JournalEntry.TransactionType.CREDIT));
- this.loanTransactionHelper.addChargesForLoan(
- loanID,
+ this.loanTransactionHelper.addChargesForLoan(loanID,
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(
String.valueOf(amountPlusInterestPercentagePenaltySpecifiedDueDate), "10 January 2012", "1"));
loanSchedule.clear();
@@ -2946,22 +3134,24 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("120", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3241.19", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Pay applied penalty ------------");
+ LOG.info("----------Pay applied penalty ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("120"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(Float.valueOf("120"),
- JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.CREDIT));
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("120"), JournalEntry.TransactionType.CREDIT));
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
fourthInstallment = loanSchedule.get(4);
validateNumberForEqual("0", String.valueOf(fourthInstallment.get("penaltyChargesOutstanding")));
validateNumberForEqual("3121.19", String.valueOf(fourthInstallment.get("totalOutstandingForPeriod")));
- System.out.println("----------Make repayment 4 ------------");
+ LOG.info("----------Make repayment 4 ------------");
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3121.19"), loanID);
- this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012", new JournalEntry(
- Float.valueOf("3121.19"), JournalEntry.TransactionType.DEBIT), new JournalEntry(Float.valueOf("3121.19"),
- JournalEntry.TransactionType.CREDIT));
- loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, loanID, "status");
+ this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, "20 January 2012",
+ new JournalEntry(Float.valueOf("3121.19"), JournalEntry.TransactionType.DEBIT),
+ new JournalEntry(Float.valueOf("3121.19"), JournalEntry.TransactionType.CREDIT));
+ loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
+ loanID, "status");
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
}
@@ -2973,8 +3163,8 @@ public class ClientLoanIntegrationTest {
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer loanProductID = createLoanProduct("100", "0", LoanProductTestBuilder.DEFAULT_STRATEGY);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, null);
- final ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
- loanID);
+ final ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentScheduleForEqualPrincipal(loanSchedule);
}
@@ -2987,8 +3177,8 @@ public class ClientLoanIntegrationTest {
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
final Integer loanProductID = createLoanProduct("100", "0", LoanProductTestBuilder.DEFAULT_STRATEGY);
final Integer loanID = applyForLoanApplication(clientID, loanProductID, "5");
- final ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec,
- loanID);
+ final ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
verifyLoanRepaymentScheduleForEqualPrincipalWithGrace(loanSchedule);
}
@@ -3014,22 +3204,23 @@ public class ClientLoanIntegrationTest {
*/
final String savingsId = null;
final String principal = "12,000.00";
- final Integer loanID = applyForLoanApplicationWithPaymentStrategy(clientID, loanProductID, null, savingsId, principal,
- LoanApplicationTestBuilder.RBI_INDIA_STRATEGY);
+ final Integer loanID = applyForLoanApplicationWithPaymentStrategy(clientID, loanProductID, null, savingsId,
+ principal, LoanApplicationTestBuilder.RBI_INDIA_STRATEGY);
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------");
+ LOG.info("-----------------------------------APPROVE LOAN-----------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
- System.out.println("-------------------------------DISBURSE LOAN-------------------------------------------");
+ LOG.info("-------------------------------DISBURSE LOAN-------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.disburseLoan("20 September 2011", loanID);
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
HashMap firstInstallment = loanSchedule.get(1);
validateNumberForEqual("3200", String.valueOf(firstInstallment.get("totalOutstandingForPeriod")));
@@ -3062,18 +3253,17 @@ public class ClientLoanIntegrationTest {
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
/***
- * Verify 2nd and 3rd repayments after making excess payment for
- * installment no 2
+ * Verify 2nd and 3rd repayments after making excess payment for installment no
+ * 2
*/
secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0.00", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
/***
- * According to RBI Excess payment should go to principal portion of
- * next installment, but as interest recalculation is not implemented,
- * it wont make any difference to schedule even though if we made excess
- * payment, so excess payments will behave the same as regular payment
- * with the excess amount
+ * According to RBI Excess payment should go to principal portion of next
+ * installment, but as interest recalculation is not implemented, it wont make
+ * any difference to schedule even though if we made excess payment, so excess
+ * payments will behave the same as regular payment with the excess amount
*/
thirdInstallment = loanSchedule.get(3);
validateNumberForEqual("3200", String.valueOf(thirdInstallment.get("totalOutstandingForPeriod")));
@@ -3083,16 +3273,15 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("100.00", String.valueOf(thirdInstallment.get("interestOutstanding")));
/***
- * Make payment with due amount of 3rd installment on 4th installment
- * date
+ * Make payment with due amount of 3rd installment on 4th installment date
*/
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3200"), loanID);
loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
/***
- * Verify overdue interests are deducted first and then remaining amount
- * for interest portion of due installment
+ * Verify overdue interests are deducted first and then remaining amount for
+ * interest portion of due installment
*/
thirdInstallment = loanSchedule.get(3);
HashMap fourthInstallment = loanSchedule.get(4);
@@ -3121,22 +3310,27 @@ public class ClientLoanIntegrationTest {
final HashMap repayment = loanSchedule.get(i);
final ArrayList dueDateAsArray = (ArrayList) repayment.get("dueDate");
- final LocalDate transactionDate = new LocalDate(dueDateAsArray.get(0), dueDateAsArray.get(1), dueDateAsArray.get(2));
+ final LocalDate transactionDate = new LocalDate(dueDateAsArray.get(0), dueDateAsArray.get(1),
+ dueDateAsArray.get(2));
final Float interestPortion = BigDecimal.valueOf(Double.valueOf(repayment.get("interestDue").toString()))
.subtract(BigDecimal.valueOf(Double.valueOf(repayment.get("interestWaived").toString())))
- .subtract(BigDecimal.valueOf(Double.valueOf(repayment.get("interestWrittenOff").toString()))).floatValue();
+ .subtract(BigDecimal.valueOf(Double.valueOf(repayment.get("interestWrittenOff").toString())))
+ .floatValue();
final Float feePortion = BigDecimal.valueOf(Double.valueOf(repayment.get("feeChargesDue").toString()))
.subtract(BigDecimal.valueOf(Double.valueOf(repayment.get("feeChargesWaived").toString())))
- .subtract(BigDecimal.valueOf(Double.valueOf(repayment.get("feeChargesWrittenOff").toString()))).floatValue();
+ .subtract(BigDecimal.valueOf(Double.valueOf(repayment.get("feeChargesWrittenOff").toString())))
+ .floatValue();
- final Float penaltyPortion = BigDecimal.valueOf(Double.valueOf(repayment.get("penaltyChargesDue").toString()))
+ final Float penaltyPortion = BigDecimal
+ .valueOf(Double.valueOf(repayment.get("penaltyChargesDue").toString()))
.subtract(BigDecimal.valueOf(Double.valueOf(repayment.get("penaltyChargesWaived").toString())))
- .subtract(BigDecimal.valueOf(Double.valueOf(repayment.get("penaltyChargesWrittenOff").toString()))).floatValue();
+ .subtract(BigDecimal.valueOf(Double.valueOf(repayment.get("penaltyChargesWrittenOff").toString())))
+ .floatValue();
- this.loanTransactionHelper.checkAccrualTransactionForRepayment(transactionDate, interestPortion, feePortion, penaltyPortion,
- loanID);
+ this.loanTransactionHelper.checkAccrualTransactionForRepayment(transactionDate, interestPortion, feePortion,
+ penaltyPortion, loanID);
}
}
@@ -3153,20 +3347,21 @@ public class ClientLoanIntegrationTest {
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
- final Integer loanProductID = createLoanProductWithInterestRecalculation(LoanProductTestBuilder.DEFAULT_STRATEGY,
- LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
+ final Integer loanProductID = createLoanProductWithInterestRecalculation(
+ LoanProductTestBuilder.DEFAULT_STRATEGY, LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_EMI_AMOUN,
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_SAME_AS_REPAYMENT_PERIOD, "0", null,
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, null, null);
- final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, LOAN_DISBURSEMENT_DATE, null,
- LoanApplicationTestBuilder.DEFAULT_STRATEGY, new ArrayList(0));
+ final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID,
+ LOAN_DISBURSEMENT_DATE, null, LoanApplicationTestBuilder.DEFAULT_STRATEGY, new ArrayList(0));
Assert.assertNotNull(loanID);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
- ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
+ ArrayList loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec,
+ this.responseSpec, loanID);
List