remove all trailing spaces in Java files (FINERACT-821)

find . -type f -name "*.java" -exec sed -i 's/ *$//' '{}' ';'
This commit is contained in:
Michael Vorburger
2020-01-19 19:58:21 +01:00
committed by Michael Vorburger ⛑️
parent b0196049f1
commit dd7503f296
862 changed files with 4984 additions and 4984 deletions
@@ -86,7 +86,7 @@ public class AccountNumberPreferencesTest {
private Integer groupID;
private Integer centerId;
private String groupAccountNo;
@Before
public void setup() {
Utils.initializeRESTAssured();
@@ -191,17 +191,17 @@ public class AccountNumberPreferencesTest {
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createSavingsAccountNumberPreference(
this.responseSpec, "resourceId");
System.out.println("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);
this.centerAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createCenterAccountNumberPreference(
this.responseSpec, "resourceId");
System.out.println("Successfully created account number preferences for Center (ID: " + this.centerAccountNumberPreferenceId);
this.accountNumberPreferencesHelper.verifyCreationOfAccountNumberPreferences(this.clientAccountNumberPreferenceId,
this.loanAccountNumberPreferenceId, this.savingsAccountNumberPreferenceId, this.groupsAccountNumberPreferenceId,
this.loanAccountNumberPreferenceId, this.savingsAccountNumberPreferenceId, this.groupsAccountNumberPreferenceId,
this.centerAccountNumberPreferenceId, this.responseSpec, this.requestSpec);
this.createAccountNumberPreferenceInvalidData("1000", "1001");
@@ -278,7 +278,7 @@ public class AccountNumberPreferencesTest {
this.createAndValidateClientWithoutAccountPreference();
}
}
private void createAndValidateGroup(Boolean isAccountPreferenceSetUp) {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec);
@@ -286,25 +286,25 @@ public class AccountNumberPreferencesTest {
this.groupID = GroupHelper.activateGroup(this.requestSpec, this.responseSpec, groupID.toString());
GroupHelper.verifyGroupActivatedOnServer(this.requestSpec, this.responseSpec, groupID, true);
final String GROUP_URL = "/fineract-provider/api/v1/groups/" + this.groupID + "?" + Utils.TENANT_IDENTIFIER;
this.groupAccountNo = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "accountNo");
if (isAccountPreferenceSetUp) {
String groupsPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.groupsAccountNumberPreferenceId, "prefixType.value");
if (groupsPrefixName.equals(this.officeName)) {
final String groupOfficeName = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "officeName");
this.validateAccountNumberLengthAndStartsWithPrefix(this.groupAccountNo, groupOfficeName);
}
} else {
validateAccountNumberLengthAndStartsWithPrefix(this.groupAccountNo, null);
}
}
private void createAndValidateCenter(Boolean isAccountPreferenceSetUp) {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
Integer officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
@@ -314,21 +314,21 @@ public class AccountNumberPreferencesTest {
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
Assert.assertNotNull(center);
Assert.assertTrue(center.getName().equals(name));
if (isAccountPreferenceSetUp) {
String centerPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
this.centerAccountNumberPreferenceId, "prefixType.value");
final String CENTER_URL = "/fineract-provider/api/v1/centers/" + this.centerId + "?" + Utils.TENANT_IDENTIFIER;
if (centerPrefixName.equals(this.officeName)) {
final String centerOfficeName = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "officeName");
final String centerOfficeName = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "officeName");
this.validateAccountNumberLengthAndStartsWithPrefix(center.getAccountNo(), centerOfficeName);
}
} else {
} else {
validateAccountNumberLengthAndStartsWithPrefix(center.getAccountNo(), null);
}
}
private void createAndValidateClientWithoutAccountPreference() {
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -49,9 +49,9 @@ import com.jayway.restassured.specification.ResponseSpecification;
* {@link org.apache.fineract.batch.command.CommandStrategyProvider}. This tests
* the response provided by commandStrategy by injecting it with a
* {@code BatchRequest}.
*
*
* @author RishabhShukla
*
*
* @see org.apache.fineract.integrationtests.common.BatchHelper
* @see org.apache.fineract.batch.domain.BatchRequest
*/
@@ -81,7 +81,7 @@ public class BatchApiTest {
* Tests for the unimplemented command Strategies by returning 501 status
* code. For a unknownRequest a statusCode 501 is returned back with
* response.
*
*
* @see org.apache.fineract.batch.command.internal.UnknownCommandStrategy
*/
@Test
@@ -104,7 +104,7 @@ public class BatchApiTest {
* Tests for the successful response for a createClient request from
* createClientCommand. A successful response with statusCode '200' is
* returned back.
*
*
* @see org.apache.fineract.batch.command.internal.CreateClientCommandStrategy
*/
@Test
@@ -125,7 +125,7 @@ public class BatchApiTest {
* fails. If Query Parameter 'enclosingTransaction' is set to 'true' and if
* one of the request in BatchRequest fails then all transactions are rolled
* back.
*
*
* @see org.apache.fineract.batch.command.internal.CreateClientCommandStrategy
* @see org.apache.fineract.batch.api.BatchApiResource
* @see org.apache.fineract.batch.service.BatchApiService
@@ -167,7 +167,7 @@ public class BatchApiTest {
* Tests that a client information was successfully updated through
* updateClientCommand. A 'changes' parameter is returned in the response
* after successful update of client information.
*
*
* @see org.apache.fineract.batch.command.internal.UpdateClientCommandStrategy
*/
@Test
@@ -202,7 +202,7 @@ public class BatchApiTest {
* 200(OK) status. It creates a new client and apply a loan to that client.
* This also verifies the successful resolution of dependencies among two
* requests.
*
*
* @see org.apache.fineract.batch.command.internal.ApplyLoanCommandStrategy
*/
@Test
@@ -251,7 +251,7 @@ public class BatchApiTest {
* Tests that a new savings accounts was applied to an existing client and a
* 200(OK) status was returned. It first creates a new client and a savings
* product, then uses the cliendId and ProductId to apply a savings account.
*
*
* @see org.apache.fineract.batch.command.internal.ApplySavingsCommandStrategy
*/
@Test
@@ -294,7 +294,7 @@ public class BatchApiTest {
* Collected properly 200(OK) status was returned for successful responses.
* It first creates a new client and apply a loan, then creates a new charge
* for the create loan and then fetches all the applied charges
*
*
* @see org.apache.fineract.batch.command.internal.CollectChargesCommandStrategy
* @see org.apache.fineract.batch.command.internal.CreateChargeCommandStrategy
*/
@@ -409,7 +409,7 @@ public class BatchApiTest {
* Test for the successful activation of a pending client using
* 'ActivateClientCommandStrategy'. A '200' status code is expected on
* successful activation.
*
*
* @see org.apache.fineract.batch.command.internal.ActivateClientCommandStrategy
*/
@Test
@@ -439,7 +439,7 @@ public class BatchApiTest {
* Test for the successful approval and disbursal of a loan using
* 'ApproveLoanCommandStrategy' and 'DisburseLoanCommandStrategy'. A '200'
* status code is expected on successful activation.
*
*
* @see org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy
* @see org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy
*/
@@ -43,7 +43,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
* Test class for testing the integration of Batch API with custom batch
* requests and various user defined workflow. Like in the case of mifos
* community-app
*
*
* @author Rishabh Shukla
*/
public class BatchRequestsIntegrationTest {
@@ -70,12 +70,12 @@ public class BatchRequestsIntegrationTest {
@Test
/**
* Tests that a loan is successfully applied to client members of a group.
* Tests that a loan is successfully applied to client members of a group.
* Firstly, it'll create a few new clients and then will add those clients
* to the group. Then a few loans will be created and one of those loans
* will be chosen at random and similarily a few of the created clients will
* be chosen on random. Now, the selected loan will be applied to these
* clients through Batch - API ApplyLoanCommandStrategy.
* clients through Batch - API ApplyLoanCommandStrategy.
*/
public void shouldReturnOkStatusForLoansAppliedToSelectedClients() {
@@ -239,7 +239,7 @@ public class CenterIntegrationTest {
final Integer groupID = CenterHelper.createCenter(this.requestSpec, this.responseSpec);
CenterHelper.verifyCenterCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
final HashMap assignStaffToCenterResponseMap = (HashMap) CenterHelper.assignStaff(this.requestSpec,
this.responseSpec, groupID.toString(),
staffId.longValue());
@@ -248,7 +248,7 @@ public class CenterIntegrationTest {
Assert.assertNotNull(centerWithStaffAssigned);
Assert.assertTrue(centerWithStaffAssigned.getId().intValue() == groupID);
Assert.assertTrue(centerWithStaffAssigned.getStaffId().intValue() == staffId);
final HashMap unassignStaffToCenterResponseMap = (HashMap) CenterHelper.unassignStaff(this.requestSpec,
this.responseSpec, groupID.toString(),
staffId.longValue());
@@ -257,7 +257,7 @@ public class CenterIntegrationTest {
Assert.assertNotNull(centerWithStaffUnssigned);
Assert.assertTrue(centerWithStaffUnssigned.getId().intValue() == groupID);
Assert.assertTrue(centerWithStaffUnssigned.getStaffId() == null);
}
}
@@ -108,11 +108,11 @@ public class ClientSavingsIntegrationTest {
this.savingsAccountHelper.postInterestForSavings(savingsId);
summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
Assert.assertFalse(summaryBefore.equals(summary));
final Object savingsInterest = this.savingsAccountHelper.getSavingsInterest(savingsId);
// verifySavingsInterest(savingsInterest);
}
@Test
public void testSavingsAccountWithMinBalanceForInterestCalculation() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
@@ -703,7 +703,7 @@ public class ClientSavingsIntegrationTest {
/***
* Activate the application and verify account status
*
*
* @param activationDate
* this value is every time first day of previous month
*/
@@ -735,7 +735,7 @@ public class ClientSavingsIntegrationTest {
/***
* Perform Deposit transaction on last day of month and verify account
* balance.
*
*
* @param transactionDate
* this value is every time last day of previous month
*/
@@ -785,7 +785,7 @@ public class ClientSavingsIntegrationTest {
assertEquals("validation.msg.savingsaccount.close.results.in.balance.not.zero",
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccountPostInterestOnLastDayWithOverdraft() {
@@ -845,7 +845,7 @@ public class ClientSavingsIntegrationTest {
/***
* Activate the application and verify account status
*
*
* @param activationDate
* this value is every time first day of previous month
*/
@@ -876,7 +876,7 @@ public class ClientSavingsIntegrationTest {
/***
* Perform Deposit transaction on last day of month and verify account
* balance.
*
*
* @param transactionDate
* this value is every time last day of previous month
*/
@@ -1120,7 +1120,7 @@ public class ClientSavingsIntegrationTest {
.println("-----Post Interest As on Successfully Worked----------");
}
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccountPostInterestOnLastDayWithdrawalWithOverdraft() {
@@ -1180,7 +1180,7 @@ public class ClientSavingsIntegrationTest {
/***
* Activate the application and verify account status
*
*
* @param activationDate
* this value is every time first day of previous month
*/
@@ -1219,11 +1219,11 @@ public class ClientSavingsIntegrationTest {
balance -= new Float(WITHDRAW_AMOUNT);
assertEquals("Verifying Withdrawal Amount", new Float(WITHDRAW_AMOUNT), withdrawTransaction.get("amount"));
assertEquals("Verifying Balance after Withdrawal", balance, withdrawTransaction.get("runningBalance"));
/***
* Perform Deposit transaction on last day of month and verify account
* balance.
*
*
* @param transactionDate
* this value is every time last day of previous month
*/
@@ -1462,7 +1462,7 @@ public class ClientSavingsIntegrationTest {
System.out
.println("-----Post Interest As on Successfully Worked----------");
}
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccountPostInterestWithOverdraft() {
@@ -1523,7 +1523,7 @@ public class ClientSavingsIntegrationTest {
/***
* Activate the application and verify account status
*
*
* @param activationDate
* this value is every time first day of previous month
*/
@@ -1555,7 +1555,7 @@ public class ClientSavingsIntegrationTest {
/***
* Perform Deposit transaction on last day of month and verify account
* balance.
*
*
* @param transactionDate
* this value is every time last day of previous month
*/
@@ -1619,7 +1619,7 @@ public class ClientSavingsIntegrationTest {
final String INTEREST_POSTING_DATE = dateFormat.format(interestPostingDate.getTime());
final String TODYS_POSTING_DATE = dateFormat.format(todysDate.getTime());
String withdrawBalance = "true";
if (TODYS_POSTING_DATE.equalsIgnoreCase(INTEREST_POSTING_DATE)) {
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, responseSpec);
@@ -1687,11 +1687,11 @@ public class ClientSavingsIntegrationTest {
final Integer lastDayOfMonth = todaysDate.getActualMaximum(Calendar.DAY_OF_MONTH);
todaysDate.set(Calendar.DAY_OF_MONTH, lastDayOfMonth);
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
Calendar postedDate = Calendar.getInstance();
postedDate.set(Calendar.DAY_OF_MONTH, 1);
final String POSTED_TRANSACTION_DATE = dateFormat.format(postedDate.getTime());
final String POSTED_TRANSACTION_DATE = dateFormat.format(postedDate.getTime());
Calendar postedLastDate = Calendar.getInstance();
int countOfDate=postedDate.getActualMaximum(Calendar.DAY_OF_MONTH);
System.out.println("count Of Date---> "+countOfDate);
@@ -1700,7 +1700,7 @@ public class ClientSavingsIntegrationTest {
/***
* Activate the application and verify account status
*
*
* @param activationDate
* this value is every time first day of previous month
*/
@@ -1732,7 +1732,7 @@ public class ClientSavingsIntegrationTest {
/***
* Perform Deposit transaction on last day of month and verify account
* balance.
*
*
* @param transactionDate
* this value is every time last day of previous month
*/
@@ -1750,8 +1750,8 @@ public class ClientSavingsIntegrationTest {
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountDetails.get("summary");
Float actualInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString());
/***
* Calculate expected interest to be posted, interest should be posted
* for one day only because deposit transaction happened on last day of
@@ -1773,14 +1773,14 @@ public class ClientSavingsIntegrationTest {
decimalFormat.applyPattern("#.###");
interestPosted = new Float(decimalFormat.format(interestPosted));
actualInterestPosted = new Float(decimalFormat.format(actualInterestPosted));
assertEquals("Verifying interest posted", interestPosted, actualInterestPosted);
assertEquals("Verifying interest posted", interestPosted, actualInterestPosted);
System.out.println("------Post Interest As On Successful Worked--------");
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, POSTED_LAST_TRANSACTION_DATE);
HashMap accountLastDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
summary = (HashMap) accountLastDetails.get("summary");
Float actualLastInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString());
final Float nominalLastAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
final HashMap interestLastCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
final Integer daysLastInYear = Integer.valueOf(interestCalculationDaysInYearType.get("id").toString());
@@ -1788,18 +1788,18 @@ public class ClientSavingsIntegrationTest {
double perLastDay = (double) 1 / (daysInYear);
double interestLastPerDay = interestLastRateInFraction * perLastDay;
Float interestLastPosted = (float) (interestLastPerDay * balance * 1);
DecimalFormat decimalLastFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalLastFormat.applyPattern("#.###");
interestLastPosted = new Float(decimalLastFormat.format(interestLastPosted));
actualInterestPosted = new Float(decimalFormat.format(actualInterestPosted));
assertEquals("Verifying interest posted", interestLastPosted, actualInterestPosted);
assertEquals("Verifying interest posted", interestLastPosted, actualInterestPosted);
System.out.println("------Post Interest As On Successful Worked--------");
}
@Test
public void testSavingsAccount_WITH_WITHHOLD_TAX() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
@@ -1897,7 +1897,7 @@ public class ClientSavingsIntegrationTest {
Assert.assertEquals(expected, actual, 1);
}
@Test
public void testSavingsAccount_DormancyTracking() {
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
@@ -1913,7 +1913,7 @@ public class ClientSavingsIntegrationTest {
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft, String.valueOf(taxGroupId), true);
Assert.assertNotNull(savingsProductID);
final Integer savingsChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
ChargesHelper.getSavingsNoActivityFeeJSON());
Assert.assertNotNull(savingsChargeId);
@@ -1961,14 +1961,14 @@ public class ClientSavingsIntegrationTest {
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
transactionDate = transactionDate.minusDays(30);
}
SchedulerJobHelper jobHelper = new SchedulerJobHelper(this.requestSpec, this.responseSpec);
try {
jobHelper.executeJob("Update Savings Dormant Accounts");
} catch (InterruptedException e) {
e.printStackTrace();
}
//VERIFY WITHIN PROVIDED RANGE DOESN'T INACTIVATE
savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(0));
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
@@ -2010,7 +2010,7 @@ public class ClientSavingsIntegrationTest {
chargeAmt = 100f;
balance -= chargeAmt;
assertEquals("Verifying account Balance", balance, summary.get("accountBalance"));
TRANSACTION_DATE = formatter.print(new LocalDate());
depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsList.get(2), DEPOSIT_AMOUNT,
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -2018,7 +2018,7 @@ public class ClientSavingsIntegrationTest {
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(2));
SavingsStatusChecker.verifySavingsSubStatusNone(savingsStatusHashMap);
//VERIFY ESCHEAT DUE TO OLD TRANSACTION
savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(3));
SavingsStatusChecker.verifySavingsAccountIsClosed(savingsStatusHashMap);
@@ -2026,7 +2026,7 @@ public class ClientSavingsIntegrationTest {
SavingsStatusChecker.verifySavingsSubStatusEscheat(savingsStatusHashMap);
summary = this.savingsAccountHelper.getSavingsSummary(savingsList.get(3));
assertEquals("Verifying account Balance", 2900f, summary.get("accountBalance"));
//VERIFY ESCHEAT DUE NO TRANSACTION FROM ACTIVATION
savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(4));
SavingsStatusChecker.verifySavingsAccountIsClosed(savingsStatusHashMap);
@@ -2034,17 +2034,17 @@ public class ClientSavingsIntegrationTest {
SavingsStatusChecker.verifySavingsSubStatusEscheat(savingsStatusHashMap);
summary = this.savingsAccountHelper.getSavingsSummary(savingsList.get(4));
assertEquals("Verifying account Balance", 900f, summary.get("accountBalance"));
//VERIFY NON ACTIVE ACCOUNTS ARE NOT AFFECTED
savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(5));
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
savingsStatusHashMap = SavingsStatusChecker.getSubStatusOfSavings(this.requestSpec, this.responseSpec, savingsList.get(5));
SavingsStatusChecker.verifySavingsSubStatusNone(savingsStatusHashMap);
}
private HashMap activateSavingsAccount(final Integer savingsId, final String activationDate) {
final HashMap status = this.savingsAccountHelper.activateSavingsAccount(savingsId, activationDate);
return status;
@@ -2057,7 +2057,7 @@ public class ClientSavingsIntegrationTest {
return createSavingsProduct(requestSpec, responseSpec, minOpenningBalance, minBalanceForInterestCalculation, minRequiredBalance,
enforceMinRequiredBalance, allowOverdraft, taxGroupId, false);
}
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String minOpenningBalance, String minBalanceForInterestCalculation, String minRequiredBalance,
String enforceMinRequiredBalance, final boolean allowOverdraft, final String taxGroupId, boolean withDormancy) {
@@ -2085,7 +2085,7 @@ public class ClientSavingsIntegrationTest {
.withMinimumOpenningBalance(minOpenningBalance).withWithHoldTax(taxGroupId).build();
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
}
private Integer createTaxGroup(final String percentage){
final Integer liabilityAccountId = null;
final Integer taxComponentId = TaxComponentHelper.createTaxComponent(this.requestSpec, this.responseSpec, percentage, liabilityAccountId);
@@ -2098,11 +2098,11 @@ public class ClientSavingsIntegrationTest {
* System.out.println(
* "--------------------VERIFYING THE BALANCE, INTEREST --------------------------"
* );
*
*
* assertEquals("Verifying Interest Calculation", new Float("238.3399"),
* savingsInterest); }
*/
@SuppressWarnings("unchecked")
@Test
public void testSavingsAccountBlockStatus() {
@@ -2162,7 +2162,7 @@ public class ClientSavingsIntegrationTest {
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.savings.account.debit.transaction.not.allowed",
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, DEPOSIT_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
depositTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, depositTransactionId);
@@ -2183,7 +2183,7 @@ public class ClientSavingsIntegrationTest {
CommonConstants.RESPONSE_ERROR);
assertEquals("error.msg.savings.account.credit.transaction.not.allowed",
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
withdrawTransaction = this.savingsAccountHelper.getSavingsTransaction(savingsId, withdrawTransactionId);
@@ -78,10 +78,10 @@ public class ClientTest {
ClientStatusChecker.verifyClientWithdrawn(clientStatusHashMap);
}
@Test
public void testClientAsPersonStatus() {
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
final Integer clientId = ClientHelper.createClientAsPerson(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientId);
@@ -111,10 +111,10 @@ public class ClientTest {
ClientStatusChecker.verifyClientWithdrawn(clientStatusHashMap);
}
@Test
public void testClientAsEntityStatus() {
this.clientHelper = new ClientHelper(this.requestSpec, this.responseSpec);
final Integer clientId = ClientHelper.createClientAsEntity(this.requestSpec, this.responseSpec);
Assert.assertNotNull(clientId);
@@ -244,7 +244,7 @@ public class FixedDepositTest {
this.responseSpec, fixedDepositAccountId.toString());
FixedDepositAccountStatusChecker.verifyFixedDepositAccountIsPrematureClosed(fixedDepositAccountStatusHashMap);
/***
* Verify journal entry transactions for preclosure transaction
*/
@@ -257,8 +257,8 @@ public class FixedDepositTest {
JournalEntry.TransactionType.DEBIT));
}
@Test
public void testFixedDepositAccountWithPrematureClosureTypeWithdrawal_WITH_HOLD_TAX() {
this.fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
@@ -391,11 +391,11 @@ public class FixedDepositTest {
HashMap accountDetails = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
Float maturityAmount = Float.valueOf(accountDetails.get("maturityAmount").toString());
HashMap summary = (HashMap) accountDetails.get("summary");
Assert.assertNotNull(summary.get("totalWithholdTax"));
Float withHoldTax = (Float) summary.get("totalWithholdTax");
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
JournalEntry.TransactionType.CREDIT));
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE, new JournalEntry(maturityAmount,
@@ -404,8 +404,8 @@ public class FixedDepositTest {
JournalEntry.TransactionType.CREDIT));
}
@Test
public void testFixedDepositAccountClosureTypeWithdrawal_WITH_HOLD_TAX() throws InterruptedException {
this.fixedDepositProductHelper = new FixedDepositProductHelper(this.requestSpec, this.responseSpec);
@@ -514,20 +514,20 @@ public class FixedDepositTest {
/***
* FD account verify whether account is matured
*/
SchedulerJobHelper schedulerJobHelper = new SchedulerJobHelper(requestSpec, responseSpec);
String JobName = "Update Deposit Accounts Maturity details";
schedulerJobHelper.executeJob(JobName);
HashMap accountDetails = this.fixedDepositAccountHelper.getFixedDepositAccountById(this.requestSpec, this.responseSpec,
fixedDepositAccountId);
HashMap summary = (HashMap) accountDetails.get("summary");
Assert.assertNotNull(summary.get("totalWithholdTax"));
Float withHoldTax = (Float) summary.get("totalWithholdTax");
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE, new JournalEntry(withHoldTax,
JournalEntry.TransactionType.CREDIT));
fixedDepositAccountStatusHashMap = FixedDepositAccountStatusChecker.getStatusOfFixedDepositAccount(this.requestSpec,
this.responseSpec, fixedDepositAccountId.toString());
@@ -535,7 +535,7 @@ public class FixedDepositTest {
}
@Test
public void testFixedDepositAccountWithPeriodInterestRateChart() {
final String chartToUse = "period";
@@ -544,7 +544,7 @@ public class FixedDepositTest {
final Float interestRate = new Float(6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testFixedDepositAccountWithPeriodInterestRateChart_AMOUNT_VARIATION() {
final String chartToUse = "period";
@@ -553,7 +553,7 @@ public class FixedDepositTest {
final Float interestRate = new Float(6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testFixedDepositAccountWithPeriodInterestRateChart_PERIOD_VARIATION() {
final String chartToUse = "period";
@@ -562,7 +562,7 @@ public class FixedDepositTest {
final Float interestRate = new Float(7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testFixedDepositAccountWithAmountInterestRateChart() {
final String chartToUse = "amount";
@@ -571,7 +571,7 @@ public class FixedDepositTest {
final Float interestRate = new Float(7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testFixedDepositAccountWithAmountInterestRateChart_AMOUNT_VARIATION() {
final String chartToUse = "amount";
@@ -580,7 +580,7 @@ public class FixedDepositTest {
final Float interestRate = new Float(5.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testFixedDepositAccountWithAmountInterestRateChart_PERIOD_VARIATION() {
final String chartToUse = "amount";
@@ -598,7 +598,7 @@ public class FixedDepositTest {
final Float interestRate = new Float(7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testFixedDepositAccountWithPeriodAndAmountInterestRateChart_AMOUNT_VARIATION() {
final String chartToUse = "period_amount";
@@ -607,7 +607,7 @@ public class FixedDepositTest {
final Float interestRate = new Float(6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testFixedDepositAccountWithPeriodAndAmountInterestRateChart_PERIOD_VARIATION() {
final String chartToUse = "period_amount";
@@ -616,7 +616,7 @@ public class FixedDepositTest {
final Float interestRate = new Float(9.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testFixedDepositAccountWithAmountAndPeriodInterestRateChart() {
final String chartToUse = "amount_period";
@@ -625,7 +625,7 @@ public class FixedDepositTest {
final Float interestRate = new Float(8.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testFixedDepositAccountWithAmountAndPeriodInterestRateChart_AMOUNT_VARIATION() {
final String chartToUse = "amount_period";
@@ -634,7 +634,7 @@ public class FixedDepositTest {
final Float interestRate = new Float(6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testFixedDepositAccountWithAmountAndPeriodInterestRateChart_PERIOD_VARIATION() {
final String chartToUse = "amount_period";
@@ -2422,7 +2422,7 @@ public class FixedDepositTest {
return FixedDepositProductHelper.createFixedDepositProduct(fixedDepositProductJSON, requestSpec, responseSpec);
}
private Integer createFixedDepositProductWithWithHoldTax(final String validFrom, final String validTo, final String taxGroupId,
final String accountingRule, Account... accounts) {
System.out.println("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
@@ -2437,7 +2437,7 @@ public class FixedDepositTest {
.build(validFrom, validTo);
return FixedDepositProductHelper.createFixedDepositProduct(fixedDepositProductJSON, requestSpec, responseSpec);
}
private Integer createFixedDepositProduct(final String validFrom, final String validTo, final String accountingRule,
final String chartToBePicked, Account... accounts) {
System.out.println("------------------------------CREATING NEW FIXED DEPOSIT PRODUCT ---------------------------------------");
@@ -2561,7 +2561,7 @@ public class FixedDepositTest {
Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
}
private Integer createTaxGroup(final String percentage, final Account liabilityAccountForTax){
final Integer liabilityAccountId = liabilityAccountForTax.getAccountID();
final Integer taxComponentId = TaxComponentHelper.createTaxComponent(this.requestSpec, this.responseSpec, percentage, liabilityAccountId);
@@ -36,11 +36,11 @@ import com.jayway.restassured.specification.ResponseSpecification;
public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
private ResponseSpecification responseSpec;
private RequestSpecification requestSpec;
private GlobalConfigurationHelper globalConfigurationHelper;
@Before
public void setup() {
Utils.initializeRESTAssured();
@@ -54,20 +54,20 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
GlobalConfigurationHelper.resetAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
GlobalConfigurationHelper.verifyAllDefaultGlobalConfigurations(this.requestSpec, this.responseSpec);
}
@SuppressWarnings( {"static-access", "rawtypes", "unchecked"})
@Test
public void testInterestChargedFromDateSameAsDisbursalDate(){
this.globalConfigurationHelper = new GlobalConfigurationHelper(this.requestSpec, this.responseSpec);
// Retrieving All Global Configuration details
final ArrayList<HashMap> globalConfig = this.globalConfigurationHelper
.getAllGlobalConfigurations(this.requestSpec, this.responseSpec);
Assert.assertNotNull(globalConfig);
String configName = "interest-charged-from-date-same-as-disbursal-date";
boolean newBooleanValue = true;
for (Integer configIndex = 0; configIndex < (globalConfig.size()); configIndex++) {
if (globalConfig.get(configIndex).get("name")
.equals(configName)) {
@@ -80,7 +80,7 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
break;
}
}
}
}
@@ -144,7 +144,7 @@ public class GlobalConfigurationTest {
Assert.assertEquals("Verifying Is Cache Enabled Global Config after Updation", cacheTypeId, changes.get("cacheType"));
}
}
@Test
public void testGlobalConfigForcePasswordResetDays() {
@@ -500,10 +500,10 @@ public class GroupSavingsIntegrationTest {
BigDecimal totalWaiveAmount = BigDecimal.valueOf(Double.valueOf((Float) savingsChargeForWaive.get("amount")));
totalWaiveAmount = totalWaiveAmount.add(totalWaiveAmount);
assertEquals(totalWaiveAmount.floatValue(), waiveCharge.get("amountWaived"));
final Integer weeklyFeeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, ChargesHelper.getSavingsWeeklyFeeJSON());
Assert.assertNotNull(weeklyFeeId);
this.savingsAccountHelper.addChargesForSavings(savingsId, weeklyFeeId, true);
charges = this.savingsAccountHelper.getSavingsCharges(savingsId);
Assert.assertEquals(3, charges.size());
@@ -530,9 +530,9 @@ public class GroupSavingsIntegrationTest {
.plusWeeks((Integer) paidCharge.get("feeInterval"));
assertEquals(expectedNextDueDate, nextDueDate);
cal = Calendar.getInstance();
this.savingsAccountHelper.closeSavingsAccountAndGetBackRequiredField(savingsId, "true", null, sdf.format(cal.getTime()));
}
public static Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
@@ -96,7 +96,7 @@ public class HookIntegrationTest {
}
}
@Test
public void createUpdateAndDeleteHook(){
final String payloadURL = "http://echo-webhook.herokuapp.com:80/Z7RXoCBdLSFMDrpn?";
@@ -74,7 +74,7 @@ public class LoanDisbursalDateValidationTest {
System.out.println("----------------------------------LOAN PRODUCT CREATED WITH ID-------------------------------------------"
+ loanProductID);
// APPLY FOR LOAN
// APPLY FOR LOAN
final Integer loanID = applyForLoanApplication(clientID, loanProductID, proposedAmount);
System.out.println("-----------------------------------LOAN CREATED WITH LOANID-------------------------------------------------"
+ loanID);
@@ -93,10 +93,10 @@ public class LoanDisbursalDateValidationTest {
// DISBURSE A LOAN
@SuppressWarnings("unchecked")
List<HashMap> disbursalError = (List<HashMap>) this.loanTransactionHelper.disburseLoan(disbursalDate, loanID, this.responseForbiddenError);
Assert.assertEquals("error.msg.actual.disbursement.date.does.not.match.with.expected.disbursal.date",
disbursalError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
disbursalError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
}
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID, final String proposedAmount) {
@@ -112,6 +112,6 @@ public class LoanDisbursalDateValidationTest {
return this.loanTransactionHelper.getLoanId(loanApplication);
}
}
@@ -239,63 +239,63 @@ public class LoanDisbursementDetailsIntegrationTest {
* periods){ LoanDisbursementTestBuilder expectedRepaymentSchedule0 = new
* LoanDisbursementTestBuilder( "[2015, 6, 1]", 0.0f, 0.0f, null, null,
* 5000.0f, null, null, null);
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule1 = new
* LoanDisbursementTestBuilder( "[2015, 7, 1]", 800.0f, 800.0f, 50.0f,
* 750.0f, 4250.0f, 750.0f, 750.0f, "[2015, 6, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule2 = new
* LoanDisbursementTestBuilder( "[2015, 8, 1]", 800.0f, 800.0f, 42.5f,
* 757.5f, 3492.5f, 757.5f, 757.5f, "[2015, 7, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule3 = new
* LoanDisbursementTestBuilder( "[2015, 9, 1]", 0.0f, 0.0f, null, null,
* 5000.0f, null, null, null);
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule4 = new
* LoanDisbursementTestBuilder( "[2015, 9, 1]", 800.0f, 800.0f, 34.92f,
* 765.08f, 7727.42f, 765.08f, 765.08f, "[2015, 8, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule5 = new
* LoanDisbursementTestBuilder( "[2015, 10, 1]", 800.0f, 800.0f, 77.27f,
* 722.73f, 7004.69f, 722.73f, 722.73f, "[2015, 9, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule6 = new
* LoanDisbursementTestBuilder( "[2015, 11, 1]", 800.0f, 800.0f, 70.05f,
* 729.95f, 6274.74f, 729.95f, 729.95f, "[2015, 10, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule7 = new
* LoanDisbursementTestBuilder( "[2015, 12, 1]", 800.0f, 800.0f, 62.75f,
* 737.25f, 5537.49f, 737.25f, 737.25f, "[2015, 11, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule8 = new
* LoanDisbursementTestBuilder( "[2016, 1, 1]", 800.0f, 800.0f, 55.37f,
* 744.63f, 4792.86f, 744.63f, 744.63f, "[2015, 12, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule9 = new
* LoanDisbursementTestBuilder( "[2016, 2, 1]", 800.0f, 800.0f, 47.93f,
* 752.07f, 4040.79f, 752.07f, 752.07f, "[2016, 1, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule10 = new
* LoanDisbursementTestBuilder( "[2016, 3, 1]", 800.0f, 800.0f, 40.41f,
* 759.59f, 3281.2f, 759.59f, 759.59f, "[2016, 2, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule11 = new
* LoanDisbursementTestBuilder( "[2016, 4, 1]", 800.0f, 800.0f, 32.81f,
* 767.19f, 2514.01f, 767.19f, 767.19f, "[2016, 3, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule12 = new
* LoanDisbursementTestBuilder( "[2016, 5, 1]", 800.0f, 800.0f, 25.14f,
* 774.86f, 1739.15f, 774.86f, 774.86f, "[2016, 4, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule13 = new
* LoanDisbursementTestBuilder( "[2016, 6, 1]", 800.0f, 800.0f, 17.39f,
* 782.61f, 956.54f, 782.61f, 782.61f, "[2016, 5, 1]");
*
*
* LoanDisbursementTestBuilder expectedRepaymentSchedule14 = new
* LoanDisbursementTestBuilder( "[2016, 7, 1]", 966.11f, 966.11f, 9.57f,
* 956.54f, 0.0f, 956.54f, 956.54f, "[2016, 6, 1]");
*
*
* ArrayList<LoanDisbursementTestBuilder> list = new
* ArrayList<LoanDisbursementTestBuilder>();
* list.add(expectedRepaymentSchedule0);
@@ -313,14 +313,14 @@ public class LoanDisbursementDetailsIntegrationTest {
* list.add(expectedRepaymentSchedule12);
* list.add(expectedRepaymentSchedule13);
* list.add(expectedRepaymentSchedule14);
*
*
* for (int i = 0; i < list.size(); i++) {
* this.assertRepaymentScheduleValuesWithoutEMI(periods.get(i), list.get(i),
* i); } }
*
*
* private void assertRepaymentScheduleValuesWithoutEMI(HashMap period,
* LoanDisbursementTestBuilder expectedRepaymentSchedule, int position) {
*
*
* assertEquals(period.get("dueDate").toString(),
* expectedRepaymentSchedule.getDueDate());
* assertEquals(period.get("principalLoanBalanceOutstanding"),
@@ -329,9 +329,9 @@ public class LoanDisbursementDetailsIntegrationTest {
* expectedRepaymentSchedule.getTotalOriginalDueForPeriod());
* assertEquals(period.get("totalOutstandingForPeriod"),
* expectedRepaymentSchedule.getTotalOutstandingForPeriod());
*
*
* if (position != 0 && position != 3) {
*
*
* assertEquals(period.get("interestOutstanding"),
* expectedRepaymentSchedule.getInterestOutstanding());
* assertEquals(period.get("principalOutstanding"),
@@ -51,7 +51,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
private LoanTransactionHelper loanTransactionHelper;
private LoanApplicationApprovalTest loanApplicationApprovalTest;
private ResponseSpecification generalResponseSpec;
@Before
public void setup() {
Utils.initializeRESTAssured();
@@ -62,60 +62,60 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
this.loanApplicationApprovalTest = new LoanApplicationApprovalTest();
this.generalResponseSpec = new ResponseSpecBuilder().build();
}
@SuppressWarnings("unchecked")
@Test
public void testLoanRepaymentRescheduleAtDisbursement(){
final String approvalAmount = "10000";
final String approveDate = "01 March 2015";
final String expectedDisbursementDate = "01 March 2015";
final String disbursementDate = "01 March 2015";
final String adjustRepaymentDate = "16 March 2015";
// CREATE CLIENT
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2014");
System.out.println("---------------------------------CLIENT CREATED WITH ID---------------------------------------------------"
+ clientID);
// CREATE LOAN MULTIDISBURSAL PRODUCT WITH INTEREST RECALCULATION
// CREATE LOAN MULTIDISBURSAL PRODUCT WITH INTEREST RECALCULATION
final Integer loanProductID = createLoanProductWithInterestRecalculation(LoanProductTestBuilder.RBI_INDIA_STRATEGY,
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0",
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null);
// CREATE TRANCHES
List<HashMap> createTranches = new ArrayList<>();
createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("01 March 2015", "5000"));
createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("01 May 2015", "5000"));
// APPROVE TRANCHES
List<HashMap> approveTranches = new ArrayList<>();
approveTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("01 March 2015", "5000"));
approveTranches.add(this.loanApplicationApprovalTest.createTrancheDetail("01 May 2015", "5000"));
// APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION
// APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION
final Integer loanID = applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, disbursementDate,
LoanApplicationTestBuilder.RBI_INDIA_STRATEGY, new ArrayList<HashMap>(0), createTranches);
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
// VALIDATE THE LOAN STATUS
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
System.out.println("-----------------------------------APPROVE LOAN-----------------------------------------------------------");
loanStatusHashMap = this.loanTransactionHelper.approveLoanWithApproveAmount(approveDate, expectedDisbursementDate, approvalAmount,
loanID, approveTranches);
// VALIDATE THE LOAN IS APPROVED
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
// DISBURSE A FIRST TRANCHE
this.loanTransactionHelper.disburseLoanWithRepaymentReschedule(disbursementDate, loanID, adjustRepaymentDate);
loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
ArrayList<HashMap> loanRepaymnetSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(requestSpec, generalResponseSpec, loanID);
HashMap firstInstallement = loanRepaymnetSchedule.get(1);
Map<String, Object> expectedvalues = new HashMap<>(3);
@@ -127,14 +127,14 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
expectedvalues.put("feeChargesDue", "0");
expectedvalues.put("penaltyChargesDue", "0");
expectedvalues.put("totalDueForPeriod", "884.03");
// VALIDATE REPAYMENT SCHEDULE
verifyLoanRepaymentSchedule(firstInstallement, expectedvalues);
}
private void verifyLoanRepaymentSchedule(final HashMap firstInstallement, final Map<String, Object> expectedvalues) {
assertEquals(expectedvalues.get("dueDate"), firstInstallement.get("dueDate"));
assertEquals(String.valueOf(expectedvalues.get("principalDue")), String.valueOf(firstInstallement.get("principalDue")));
assertEquals(String.valueOf(expectedvalues.get("interestDue")), String.valueOf(firstInstallement.get("interestDue")));
@@ -143,7 +143,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
assertEquals(String.valueOf(expectedvalues.get("totalDueForPeriod")), String.valueOf(firstInstallement.get("totalDueForPeriod")));
}
private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy,
final String interestRecalculationCompoundingMethod, final String rescheduleStrategyMethod,
final String recalculationRestFrequencyType, final String recalculationRestFrequencyInterval,
@@ -160,7 +160,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
accounts, null, false, recalculationCompoundingFrequencyOnDayType, recalculationCompoundingFrequencyDayOfWeekType,
recalculationRestFrequencyOnDayType, recalculationRestFrequencyDayOfWeekType);
}
private Integer createLoanProductWithInterestRecalculation(final String repaymentStrategy,
final String interestRecalculationCompoundingMethod, final String rescheduleStrategyMethod,
final String recalculationRestFrequencyType, final String recalculationRestFrequencyInterval,
@@ -197,7 +197,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
final String loanProductJSON = builder.build(chargeId);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, final Integer loanProductID,
final String disbursementDate, final String repaymentStrategy, final List<HashMap> charges, List<HashMap> tranches) {
final String graceOnInterestPayment = null;
@@ -205,7 +205,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
return applyForLoanApplicationForInterestRecalculation(clientID, loanProductID, disbursementDate, repaymentStrategy, charges,
graceOnInterestPayment, graceOnPrincipalPayment, tranches);
}
private Integer applyForLoanApplicationForInterestRecalculation(final Integer clientID, final Integer loanProductID,
final String disbursementDate, final String repaymentStrategy, final List<HashMap> charges, final String graceOnInterestPayment,
final String graceOnPrincipalPayment, List<HashMap> tranches) {
@@ -231,7 +231,7 @@ public class LoanRepaymentRescheduleAtDisbursementTest {
.build(clientID.toString(), loanProductID.toString(), null);
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
}
private List getDateAsArray(Calendar date, int addPeriod) {
return getDateAsArray(date, addPeriod, Calendar.DAY_OF_MONTH);
}
@@ -39,8 +39,8 @@ import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
/**
* Test the creation, approval and rejection of a loan reschedule request
/**
* Test the creation, approval and rejection of a loan reschedule request
**/
@SuppressWarnings({ "rawtypes" })
public class LoanRescheduleRequestTest {
@@ -57,7 +57,7 @@ public class LoanRescheduleRequestTest {
private String numberOfRepayments = "12";
private String interestRatePerPeriod = "18";
private String dateString = "4 September 2014";
@Before
public void initialize() {
Utils.initializeRESTAssured();
@@ -68,52 +68,52 @@ public class LoanRescheduleRequestTest {
this.loanRescheduleRequestHelper = new LoanRescheduleRequestHelper(this.requestSpec, this.responseSpec);
this.generalResponseSpec = new ResponseSpecBuilder().build();
// create all required entities
this.createRequiredEntities();
}
/**
* Creates the client, loan product, and loan entities
/**
* Creates the client, loan product, and loan entities
**/
private void createRequiredEntities() {
this.createClientEntity();
this.createLoanProductEntity();
this.createLoanEntity();
}
/**
* create a new client
**/
/**
* create a new client
**/
private void createClientEntity() {
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, this.clientId);
}
/**
* create a new loan product
/**
* create a new loan product
**/
private void createLoanProductEntity() {
System.out.println("---------------------------------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 + ")");
}
/**
* submit a new loan application, approve and disburse the loan
/**
* submit a new loan application, approve and disburse the loan
**/
private void createLoanEntity() {
System.out.println("---------------------------------NEW LOAN APPLICATION------------------------------------------");
final String loanApplicationJSON = new LoanApplicationTestBuilder()
.withPrincipal(loanPrincipalAmount)
.withLoanTermFrequency(numberOfRepayments)
@@ -130,90 +130,90 @@ public class LoanRescheduleRequestTest {
.withPrincipalGrace("2")
.withInterestGrace("2")
.build(this.clientId.toString(), this.loanProductId.toString(), null);
this.loanId = this.loanTransactionHelper.getLoanId(loanApplicationJSON);
System.out.println("Sucessfully created loan (ID: " + this.loanId + ")");
this.approveLoanApplication();
this.disburseLoan();
}
/**
* approve the loan application
/**
* approve the loan application
**/
private void approveLoanApplication() {
if(this.loanId != null) {
this.loanTransactionHelper.approveLoan(this.dateString, this.loanId);
System.out.println("Successfully approved loan (ID: " + this.loanId + ")");
}
}
/**
* disburse the newly created loan
/**
* disburse the newly created loan
**/
private void disburseLoan() {
if(this.loanId != null) {
this.loanTransactionHelper.disburseLoan(this.dateString, this.loanId);
System.out.println("Successfully disbursed loan (ID: " + this.loanId + ")");
}
}
/**
* create new loan reschedule request
/**
* create new loan reschedule request
**/
private void createLoanRescheduleRequest() {
System.out.println("---------------------------------CREATING LOAN RESCHEDULE REQUEST------------------------------------------");
final String requestJSON = new LoanRescheduleRequestTestBuilder().build(this.loanId.toString());
this.loanRescheduleRequestId = this.loanRescheduleRequestHelper.createLoanRescheduleRequest(requestJSON);
this.loanRescheduleRequestHelper.verifyCreationOfLoanRescheduleRequest(this.loanRescheduleRequestId);
System.out.println("Successfully created loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
}
@Test
public void testCreateLoanRescheduleRequest() {
this.createLoanRescheduleRequest();
}
@Test
public void testRejectLoanRescheduleRequest() {
this.createLoanRescheduleRequest();
System.out.println("-----------------------------REJECTING LOAN RESCHEDULE REQUEST--------------------------");
final String requestJSON = new LoanRescheduleRequestTestBuilder().getRejectLoanRescheduleRequestJSON();
this.loanRescheduleRequestHelper.rejectLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
assertTrue((Boolean)response.get("rejected"));
System.out.println("Successfully rejected loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
}
@Test
public void testApproveLoanRescheduleRequest() {
this.createLoanRescheduleRequest();
System.out.println("-----------------------------APPROVING LOAN RESCHEDULE REQUEST--------------------------");
final String requestJSON = new LoanRescheduleRequestTestBuilder().getApproveLoanRescheduleRequestJSON();
this.loanRescheduleRequestHelper.approveLoanRescheduleRequest(this.loanRescheduleRequestId, requestJSON);
final HashMap response = (HashMap) this.loanRescheduleRequestHelper.getLoanRescheduleRequest(loanRescheduleRequestId, "statusEnum");
assertTrue((Boolean)response.get("approved"));
final Integer numberOfRepayments = (Integer) this.loanTransactionHelper.getLoanDetail(requestSpec, generalResponseSpec, loanId, "numberOfRepayments");
final HashMap loanSummary = this.loanTransactionHelper.getLoanSummary(requestSpec, generalResponseSpec, loanId);
final Float totalExpectedRepayment = (Float) loanSummary.get("totalExpectedRepayment");
assertEquals("NUMBER OF REPAYMENTS SHOULD BE 16, NOT 12", "12", numberOfRepayments.toString());
assertEquals("TOTAL EXPECTED REPAYMENT MUST BE EQUAL TO 118000.0", "118000.0", totalExpectedRepayment.toString());
System.out.println("Successfully approved loan reschedule request (ID: " + this.loanRescheduleRequestId + ")");
}
}
@@ -99,7 +99,7 @@ public class LoanReschedulingWithinCenterTest {
Integer clientId = createClient(officeId);
associateClientsToGroup(groupId, clientId);
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
dateFormat.setTimeZone(Utils.getTimeZoneOfTenant());
Calendar today = Calendar.getInstance(Utils.getTimeZoneOfTenant());
@@ -114,7 +114,7 @@ public class LoanReschedulingWithinCenterTest {
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate,
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan,
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan,
null, null);
// APPLY FOR TRANCHE LOAN WITH INTEREST RECALCULATION
@@ -153,7 +153,7 @@ public class LoanReschedulingWithinCenterTest {
Float interestDue = (Float) ((HashMap) loanRepaymnetSchedule.get(2)).get("interestDue");
assertEquals("90.82", String.valueOf(interestDue));
}
private void associateClientsToGroup(Integer groupId, Integer clientId) {
// Associate client to the group
GroupHelper.associateClient(this.requestSpec, this.responseSpec, groupId.toString(), clientId.toString());
@@ -225,13 +225,13 @@ public class LoanReschedulingWithinCenterTest {
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE,
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS,
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY, "0", recalculationRestFrequencyDate,
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan,
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE, null, isMultiTrancheLoan,
null, null);
Calendar seondTrancheDate = Calendar.getInstance(Utils.getTimeZoneOfTenant());
seondTrancheDate.add(Calendar.MONTH, 1);
String secondDisbursement = dateFormat.format(seondTrancheDate.getTime()) ;
// CREATE TRANCHES
List<HashMap> createTranches = new ArrayList<>();
createTranches.add(this.loanApplicationApprovalTest.createTrancheDetail(disbursementDate, "5000"));
@@ -295,8 +295,8 @@ public class LoanReschedulingWithinCenterTest {
return createLoanProductWithInterestRecalculation(repaymentStrategy, interestRecalculationCompoundingMethod,
rescheduleStrategyMethod, recalculationRestFrequencyType, recalculationRestFrequencyInterval,
recalculationRestFrequencyDate, recalculationCompoundingFrequencyType, recalculationCompoundingFrequencyInterval,
recalculationCompoundingFrequencyDate, preCloseInterestCalculationStrategy, accounts, null, false, isMultiTrancheLoan,
recalculationCompoundingFrequencyOnDayType, recalculationCompoundingFrequencyDayOfWeekType, recalculationRestFrequencyOnDayType,
recalculationCompoundingFrequencyDate, preCloseInterestCalculationStrategy, accounts, null, false, isMultiTrancheLoan,
recalculationCompoundingFrequencyOnDayType, recalculationCompoundingFrequencyDayOfWeekType, recalculationRestFrequencyOnDayType,
recalculationRestFrequencyDayOfWeekType);
}
@@ -306,7 +306,7 @@ public class LoanReschedulingWithinCenterTest {
final String recalculationRestFrequencyDate, final String recalculationCompoundingFrequencyType,
final String recalculationCompoundingFrequencyInterval, final String recalculationCompoundingFrequencyDate,
final String preCloseInterestCalculationStrategy, final Account[] accounts, final String chargeId,
boolean isArrearsBasedOnOriginalSchedule, final boolean isMultiTrancheLoan,
boolean isArrearsBasedOnOriginalSchedule, final boolean isMultiTrancheLoan,
final Integer recalculationCompoundingFrequencyOnDayType,
final Integer recalculationCompoundingFrequencyDayOfWeekType, final Integer recalculationRestFrequencyOnDayType,
final Integer recalculationRestFrequencyDayOfWeekType) {
@@ -65,11 +65,11 @@ public class PasswordPreferencesIntegrationTest {
System.out.println("---------------------------------PASSWORD PREFERENCE VALIDATED SUCCESSFULLY-----------------------------------------");
}
@Test
public void updateWithInvalidPolicyId() {
String invalidValidationPolicyId = "2000";
final List<HashMap> error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec, invalidValidationPolicyId,
final List<HashMap> error = (List) PasswordPreferencesHelper.updateWithInvalidValidationPolicyId(requestSpec, generalResponseSpec, invalidValidationPolicyId,
CommonConstants.RESPONSE_ERROR);
assertEquals("Password Validation Policy with identifier 2000 does not exist", "error.msg.password.validation.policy.id.invalid",
error.get(0).get("userMessageGlobalisationCode"));
@@ -478,7 +478,7 @@ public class RecurringDepositTest {
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.recurringDepositAccountHelper = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec);
/***
* Create GL Accounts for product account mapping
@@ -611,7 +611,7 @@ public class RecurringDepositTest {
Integer transactionIdForPostInterest = this.recurringDepositAccountHelper
.postInterestForRecurringDeposit(recurringDepositAccountId);
Assert.assertNotNull(transactionIdForPostInterest);
HashMap accountSummary = this.recurringDepositAccountHelper.getRecurringDepositSummary(recurringDepositAccountId);
Float totalInterestPosted = (Float) accountSummary.get("totalInterestPosted");
@@ -694,7 +694,7 @@ public class RecurringDepositTest {
this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec);
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
this.recurringDepositAccountHelper = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec);
/***
* Create GL Accounts for product account mapping
@@ -810,7 +810,7 @@ public class RecurringDepositTest {
*/
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.MONTH, -20);
for (int i = 0; i < 14; i++) {
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
depositAmount, dateFormat.format(todaysDate.getTime()));
@@ -826,20 +826,20 @@ public class RecurringDepositTest {
/***
* FD account verify whether account is matured
*/
SchedulerJobHelper schedulerJobHelper = new SchedulerJobHelper(requestSpec, responseSpec);
String JobName = "Update Deposit Accounts Maturity details";
schedulerJobHelper.executeJob(JobName);
HashMap accountDetails = this.recurringDepositAccountHelper.getRecurringDepositAccountById(this.requestSpec, this.responseSpec,
recurringDepositAccountId);
HashMap summary = (HashMap) accountDetails.get("summary");
Assert.assertNotNull(summary.get("totalWithholdTax"));
Float withHoldTax = (Float) summary.get("totalWithholdTax");
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccountForTax, CLOSED_ON_DATE, new JournalEntry(withHoldTax,
JournalEntry.TransactionType.CREDIT));
recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(this.requestSpec,
this.responseSpec, recurringDepositAccountId.toString());
@@ -849,7 +849,7 @@ public class RecurringDepositTest {
}
/***
* Test case for Recurring Deposit Account premature closure with
* transaction type ReInvest and Cash Based accounting enabled
@@ -2882,7 +2882,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithPeriodInterestRateChart_AMOUNT_VARIATION() {
final String chartToUse = "period";
@@ -2891,7 +2891,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithPeriodInterestRateChart_PERIOD_VARIATION() {
final String chartToUse = "period";
@@ -2900,7 +2900,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithAmountInterestRateChart() {
final String chartToUse = "amount";
@@ -2909,7 +2909,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(8.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithAmountInterestRateChart_AMOUNT_VARIATION() {
final String chartToUse = "amount";
@@ -2918,7 +2918,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithAmountInterestRateChart_PERIOD_VARIATION() {
final String chartToUse = "amount";
@@ -2927,7 +2927,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(5.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithPeriodAndAmountInterestRateChart() {
final String chartToUse = "period_amount";
@@ -2936,7 +2936,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(7.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithPeriodAndAmountInterestRateChart_AMOUNT_VARIATION() {
final String chartToUse = "period_amount";
@@ -2945,7 +2945,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithPeriodAndAmountInterestRateChart_PERIOD_VARIATION() {
final String chartToUse = "period_amount";
@@ -2954,7 +2954,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(8.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithAmountAndPeriodInterestRateChart() {
final String chartToUse = "amount_period";
@@ -2963,7 +2963,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(8.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithAmountAndPeriodInterestRateChart_AMOUNT_VARIATION() {
final String chartToUse = "amount_period";
@@ -2972,7 +2972,7 @@ public class RecurringDepositTest {
final Float interestRate = new Float(6.0);
testFixedDepositAccountForInterestRate(chartToUse, depositAmount, depositPeriod, interestRate);
}
@Test
public void testRecurringDepositAccountWithAmountAndPeriodInterestRateChart_PERIOD_VARIATION() {
final String chartToUse = "amount_period";
@@ -3049,7 +3049,7 @@ public class RecurringDepositTest {
final String recurringDepositProductJSON = recurringDepositProductHelper.withPeriodRangeChart().build(validFrom, validTo);
return RecurringDepositProductHelper.createRecurringDepositProduct(recurringDepositProductJSON, requestSpec, responseSpec);
}
private Integer createRecurringDepositProductWithWithHoldTax(final String validFrom, final String validTo,final String taxGroupId, final String accountingRule,
Account... accounts) {
System.out.println("------------------------------CREATING NEW RECURRING DEPOSIT PRODUCT ---------------------------------------");
@@ -3186,7 +3186,7 @@ public class RecurringDepositTest {
Assert.assertEquals(financialActivityId, ((HashMap) mappingDetails.get("financialActivityData")).get("id"));
Assert.assertEquals(glAccount.getAccountID(), ((HashMap) mappingDetails.get("glAccountData")).get("id"));
}
private Integer createTaxGroup(final String percentage, final Account liabilityAccountForTax){
final Integer liabilityAccountId = liabilityAccountForTax.getAccountID();
final Integer taxComponentId = TaxComponentHelper.createTaxComponent(this.requestSpec, this.responseSpec, percentage, liabilityAccountId);
@@ -159,15 +159,15 @@ public class SkipRepaymentOnMonthFirstTest {
assertEquals("Checking for Repayment Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 15)),
loanSchedule.get(1).get("dueDate"));
System.out.println("Repayment Date for 1st Month--" + loanSchedule.get(1).get("dueDate"));
assertEquals("Checking for Repayment Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 15)),
loanSchedule.get(2).get("dueDate"));
System.out.println("Repayment Date for 2nd Month--" + loanSchedule.get(2).get("dueDate"));
assertEquals("Checking for Repayment Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 15)),
loanSchedule.get(3).get("dueDate"));
System.out.println("Repayment Date for 3rd Month--" + loanSchedule.get(3).get("dueDate"));
assertEquals("Checking for Repayment Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 15)),
loanSchedule.get(4).get("dueDate"));
System.out.println("Repayment Date for 4th Month--" + loanSchedule.get(4).get("dueDate"));
@@ -41,7 +41,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
/**
* Test for creating, updating, deleting codes and code values
*
*
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public class SystemCodeTest {
@@ -35,9 +35,9 @@ import com.jayway.restassured.specification.ResponseSpecification;
* Helper class for {@link org.apache.fineract.integrationtests.BatchApiTest}. It
* takes care of creation of {@code BatchRequest} list and posting this list to
* the server.
*
*
* @author Rishabh Shukla
*
*
* @see org.apache.fineract.integrationtests.BatchApiTest
*/
public class BatchHelper {
@@ -51,7 +51,7 @@ public class BatchHelper {
/**
* Returns a JSON String for a list of {@code BatchRequest}s
*
*
* @param batchRequests
* @return JSON String of BatchRequest
*/
@@ -71,7 +71,7 @@ public class BatchHelper {
/**
* Returns the converted string response into JSON.
*
*
* @param json
* @return List<BatchResponse>
*/
@@ -83,7 +83,7 @@ public class BatchHelper {
* Returns a list of BatchResponse with query parameter enclosing
* transaction set to false by posting the jsonified BatchRequest to the
* server.
*
*
* @param requestSpec
* @param responseSpec
* @param jsonifiedBatchRequests
@@ -99,7 +99,7 @@ public class BatchHelper {
* Returns a list of BatchResponse with query parameter enclosing
* transaction set to true by posting the jsonified BatchRequest to the
* server.
*
*
* @param requestSpec
* @param responseSpec
* @param jsonifiedBatchRequests
@@ -114,7 +114,7 @@ public class BatchHelper {
/**
* Returns a BatchResponse based on the given BatchRequest, by posting the
* request to the server.
*
*
* @param BatchRequest
* @return List<BatchResponse>
*/
@@ -139,7 +139,7 @@ public class BatchHelper {
* Creates and returns a
* {@link org.apache.fineract.batch.command.internal.CreateClientCommandStrategy}
* Request as one of the request in Batch.
*
*
* @param reqId
* @param externalId
* @return BatchRequest
@@ -202,7 +202,7 @@ public class BatchHelper {
* Creates and returns a
* {@link org.apache.fineract.batch.command.internal.UpdateClientCommandStrategy}
* Request with given requestId and reference.
*
*
* @param reqId
* @param clientId
* @return BatchRequest
@@ -224,7 +224,7 @@ public class BatchHelper {
* Creates and returns a
* {@link org.apache.fineract.batch.command.internal.ApplyLoanCommandStrategy}
* Request with given requestId and reference.
*
*
* @param requestId
* @param reference
* @param productId
@@ -255,7 +255,7 @@ public class BatchHelper {
* Creates and returns a
* {@link org.apache.fineract.batch.command.internal.ApplySavingsCommandStrategy}
* Request with given requestId and reference.
*
*
* @param requestId
* @param reference
* @param productId
@@ -281,7 +281,7 @@ public class BatchHelper {
* Creates and returns a
* {@link org.apache.fineract.batch.command.internal.CreateChargeCommandStrategy}
* Request with given requestId and reference
*
*
* @param requestId
* @param reference
* @return BatchRequest
@@ -305,7 +305,7 @@ public class BatchHelper {
* Creates and returns a
* {@link org.apache.fineract.batch.command.internal.CollectChargesCommandStrategy}
* Request with given requestId and reference.
*
*
* @param requestId
* @param reference
* @return BatchRequest
@@ -327,8 +327,8 @@ public class BatchHelper {
* Creates and returns a
* {@link org.apache.fineract.batch.command.internal.ActivateClientCommandStrategy}
* Request with given requestId and reference.
*
*
*
*
* @param requestId
* @param reference
* @return BatchRequest
@@ -345,13 +345,13 @@ public class BatchHelper {
return br;
}
/**
* Creates and returns a
* {@link org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy}
* Request with given requestId and reference.
*
*
*
*
* @param requestId
* @param reference
* @return BatchRequest
@@ -363,7 +363,7 @@ public class BatchHelper {
br.setRelativeUrl("loans/$.loanId?command=approve");
br.setReference(reference);
br.setMethod("POST");
br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"approvedOnDate\": \"12 September 2013\","
br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"approvedOnDate\": \"12 September 2013\","
+ "\"note\": \"Loan approval note\"}");
return br;
@@ -373,8 +373,8 @@ public class BatchHelper {
* Creates and returns a
* {@link org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy}
* Request with given requestId and reference.
*
*
*
*
* @param requestId
* @param reference
* @return BatchRequest
@@ -413,11 +413,11 @@ public class BatchHelper {
return br;
}
/**
* Checks that the client with given externalId is not created on the
* server.
*
*
* @param requestSpec
* @param responseSpec
* @param externalId
@@ -88,7 +88,7 @@ public class CalendarHelper {
final Integer responseCalendarId = from(responseCalendarDetailsinJSON).get("id");
assertEquals("ERROR IN CREATING THE CALENDAR", generatedCalendarId, responseCalendarId);
}
public static Integer createMeetingForGroup(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final Integer groupId, final String startDate, final String frequency, final String interval, final String repeatsOnDay) {
@@ -195,7 +195,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
public String getHierarchy() {
return this.hierarchy;
}
public String getAccountNo(){
return this.accountNo;
}
@@ -97,7 +97,7 @@ public class CenterHelper {
hm.put("dateFormat", "dd MMM yyyy");
hm.put("activationDate", activationDate);
}
System.out.println("------------------------CREATING CENTER-------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CENTER_URL, new Gson().toJson(hm), "resourceId");
}
@@ -183,7 +183,7 @@ public class CenterHelper {
}
public static String getTestCenterWithStaffAsJSON(final boolean active, final String activationDate, final Integer staffId) {
Integer id = null;
Integer statusid = null;
String statuscode = null;
@@ -201,7 +201,7 @@ public class CenterHelper {
}
public static String getTestCenterAsJSON(final boolean active, final String activationDate) {
Integer id = null;
Integer statusid = null;
String statuscode = null;
@@ -217,7 +217,7 @@ public class CenterHelper {
return CenterDomain.jsonRequestToCreateCenter(id, statusid, statuscode, statusvalue, active, activationDate,submittedDate,name,
externalId, staffId, officeID, officeName, hierarchy, groupMembers);
}
public static String assignStaffAsJSON(final Long staffId) {
@@ -34,13 +34,13 @@ import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
/**
*
*
* IntegrationTest for ClientCharges.
*
*
*/
/**
* @author lenovo
*
*
*/
public class ClientChargesTest {
@@ -71,7 +71,7 @@ public class ClientChargesTest {
* create a charge for loan and try to associate to client created in
* the above lines.it will be an invalid scenario the reason is client
* is not allowed to have only client charge.
*
*
*/
final Integer loanChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
ChargesHelper.getLoanSpecifiedDueDateJSON());
@@ -159,7 +159,7 @@ public class ClientChargesTest {
/**
* It checks whether the client charge transaction is reversed or not.
*
*
* @param clientId
* @param transactionId
*/
@@ -172,7 +172,7 @@ public class ClientChargesTest {
/**
* Check whether the outStandingAmount is equal to expected Amount or not
* after paying or after waiving off the client charge.
*
*
* @param outStandingAmount
* @param expectedAmount
*/
@@ -85,9 +85,9 @@ public class ClientHelper {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL, getTestClientAsJSON(activationDate, officeId),
"clientId");
}
public static Integer createClientPending(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return createClientPending(requestSpec, responseSpec, "04 March 2014");
}
@@ -128,12 +128,12 @@ public class ClientHelper {
public static Integer createClientAsPerson(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String activationDate, final String officeId) {
System.out.println("---------------------------------CREATING A CLIENT NON PERSON(ORGANISATION)---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL, getTestPersonClientAsJSON(activationDate, officeId),
"clientId");
}
public static Integer createClientAsEntity(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return createClientAsEntity(requestSpec, responseSpec, "04 March 2011");
}
@@ -145,10 +145,10 @@ public class ClientHelper {
public static Integer createClientAsEntity(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String activationDate, final String officeId) {
Integer constitutionCodeId = (Integer) CodeHelper.getCodeByName(requestSpec, responseSpec, "Constitution").get("id");
Integer soleProprietorCodeValueId = (Integer) CodeHelper.retrieveOrCreateCodeValue(constitutionCodeId, requestSpec, responseSpec).get("id");
System.out.println("---------------------------------CREATING A CLIENT NON PERSON(ORGANISATION)---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CLIENT_URL, getTestEntityClientAsJSON(activationDate, officeId, soleProprietorCodeValueId),
"clientId");
@@ -191,7 +191,7 @@ public class ClientHelper {
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static String getTestClientAsJSONPending(final String submittedOnDate, final String officeId) {
final HashMap<String, String> map = new HashMap<>();
map.put("officeId", officeId);
@@ -248,11 +248,11 @@ public class ClientHelper {
map.put("active", "true");
map.put("activationDate", dateOfJoining);
map.put("legalFormId", 1);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static String getTestEntityClientAsJSON(final String dateOfJoining, final String officeId, final Integer soleProprietorCodeValueId) {
final HashMap<String, Object> map = new HashMap<>();
map.put("officeId", officeId);
@@ -263,11 +263,11 @@ public class ClientHelper {
map.put("active", "true");
map.put("activationDate", dateOfJoining);
map.put("legalFormId", 2);
final HashMap<String, Object> clientNonPersonMap = new HashMap<>();
clientNonPersonMap.put("constitutionId", soleProprietorCodeValueId);
map.put("clientNonPersonDetails", clientNonPersonMap);
System.out.println("map : " + map);
return new Gson().toJson(map);
}
@@ -408,8 +408,8 @@ public class ClientHelper {
System.out.println(clientJson);
return clientJson;
}
private String getWithdrawClientAsJSON() {
final HashMap<String, String> map = new HashMap<>();
@@ -539,7 +539,7 @@ public class ClientHelper {
return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent,
jsonAttributeToGetBack);
}
private HashMap<String, Object> performClientActions(final String postURLForClient, final String jsonToBeSent, final Integer clientId) {
Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForClient, jsonToBeSent, CommonConstants.RESPONSE_STATUS);
HashMap<String, Object> response = ClientHelper.getClientStatus(requestSpec, responseSpec, String.valueOf(clientId));
@@ -362,7 +362,7 @@ public class GlobalConfigurationHelper {
return Utils.performServerPut(requestSpec, responseSpec, IS_CACHE_GLOBAL_CONFIG_UPDATE_URL,
updateIsCacheEnabledGlobalConfigUpdateAsJSON(cacheType), "changes");
}
public static Object updatePasswordResetDaysForGlobalConfiguration(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec, final Integer configId, final String value, final String enabled, final String jsonAttributeToGetBack) {
final String UPDATE_URL = "/fineract-provider/api/v1/configurations/" + configId + "?" + Utils.TENANT_IDENTIFIER;
@@ -377,7 +377,7 @@ public class GlobalConfigurationHelper {
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public static String updatePasswordResetDaysGlobalConfigAsJSON(final String value, final String enabled) {
final HashMap<String, String> map = new HashMap<>();
if(value != null){
@@ -64,7 +64,7 @@ public class HolidayHelper {
System.out.println(HolidayCreateJson);
return HolidayCreateJson;
}
public static String getActivateHolidayDataAsJSON() {
final HashMap<String, String> map = new HashMap<>();
String activateHoliday = new Gson().toJson(map);
@@ -75,12 +75,12 @@ public class HolidayHelper {
public static Integer createHolidays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_HOLIDAY_URL, getCreateHolidayDataAsJSON(), "resourceId");
}
public static Integer activateHolidays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final String holidayID) {
final String ACTIVATE_HOLIDAY_URL = HOLIDAYS_URL + "/" + holidayID + "?command=activate&" + Utils.TENANT_IDENTIFIER;
final String ACTIVATE_HOLIDAY_URL = HOLIDAYS_URL + "/" + holidayID + "?command=activate&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(requestSpec, responseSpec, ACTIVATE_HOLIDAY_URL, getActivateHolidayDataAsJSON(), "resourceId");
}
public static HashMap getHolidayById(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String holidayID) {
final String GET_HOLIDAY_BY_ID_URL = HOLIDAYS_URL + "/" + holidayID + "?" + Utils.TENANT_IDENTIFIER;
@@ -29,23 +29,23 @@ import com.jayway.restassured.specification.RequestSpecification;
import com.jayway.restassured.specification.ResponseSpecification;
public class HookHelper {
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
private static final String CREATE_HOOK_URL = "/fineract-provider/api/v1/hooks?" + Utils.TENANT_IDENTIFIER;
public HookHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public Integer createHook(final String payloadURL) {
System.out.println("---------------------------------CREATING A HOOK---------------------------------------------");
return Utils.performServerPost(requestSpec, responseSpec, CREATE_HOOK_URL, getTestHookAsJson(payloadURL),
"resourceId");
}
public String getTestHookAsJson(final String payloadURL) {
final HashMap<String, Object> map = new HashMap<>();
map.put("name", "Web");
@@ -64,7 +64,7 @@ public class HookHelper {
System.out.println("map : " + map);
return new Gson().toJson(map);
}
public Integer updateHook(final String payloadURL, final Long hookId) {
System.out.println("---------------------------------UPDATING HOOK---------------------------------------------");
final String UPDATE_HOOK_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
@@ -76,14 +76,14 @@ public class HookHelper {
final String DELETE_HOOK_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerDelete(this.requestSpec, this.responseSpec, DELETE_HOOK_URL, "resourceId");
}
public void verifyHookCreatedOnServer(final Long hookId) {
System.out.println("------------------------------CHECK CREATE HOOK DETAILS------------------------------------\n");
final String GET_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
final Integer responseHookId = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_URL, "id");
assertEquals(hookId.toString(), responseHookId.toString());
}
public void verifyUpdateHook(final String updateURL, final Long hookId) {
System.out.println("------------------------------CHECK UPDATE HOOK DETAILS------------------------------------\n");
final String GET_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
@@ -91,7 +91,7 @@ public class HookHelper {
HashMap<String, String> hash = (HashMap<String, String>) map.get(1);
assertEquals(updateURL, hash.get("fieldValue"));
}
public void verifyDeleteHook(final Long hookId) {
System.out.println("------------------------------CHECK DELETE HOOK DETAILS------------------------------------\n");
final String GET_URL = "/fineract-provider/api/v1/hooks/" + hookId + "?" + Utils.TENANT_IDENTIFIER;
@@ -26,40 +26,40 @@ import com.jayway.restassured.specification.ResponseSpecification;
public class LoanRescheduleRequestHelper {
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
private static final String LOAN_RESCHEDULE_REQUEST_URL = "/fineract-provider/api/v1/rescheduleloans";
public LoanRescheduleRequestHelper(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec;
this.responseSpec = responseSpec;
}
public Integer createLoanRescheduleRequest(final String requestJSON) {
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "?" + Utils.TENANT_IDENTIFIER;
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, this.responseSpec, URL, requestJSON, "resourceId");
}
public Integer rejectLoanRescheduleRequest(final Integer requestId, final String requestJSON) {
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "/" + requestId + "?" + Utils.TENANT_IDENTIFIER + "&command=reject";
return Utils.performServerPost(this.requestSpec, this.responseSpec, URL, requestJSON, "resourceId");
}
public Integer approveLoanRescheduleRequest(final Integer requestId, final String requestJSON) {
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "/" + requestId + "?" + Utils.TENANT_IDENTIFIER + "&command=approve";
return Utils.performServerPost(this.requestSpec, this.responseSpec, URL, requestJSON, "resourceId");
}
public Object getLoanRescheduleRequest(final Integer requestId, final String param) {
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "/" + requestId + "?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, URL, param);
}
public void verifyCreationOfLoanRescheduleRequest(final Integer requestId) {
final String URL = LOAN_RESCHEDULE_REQUEST_URL + "/" + requestId + "?" + Utils.TENANT_IDENTIFIER;
final Integer id = Utils.performServerGet(requestSpec, responseSpec, URL, "id");
assertEquals("ERROR IN CREATING LOAN RESCHEDULE REQUEST", requestId, id);
}
@@ -28,7 +28,7 @@ public class PasswordPreferencesHelper {
private static final String PASSWORD_PREFERENCES_URL = "/fineract-provider/api/v1/passwordpreferences";
public static Object updatePasswordPreferences(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
public static Object updatePasswordPreferences(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
String validationPolicyId) {
final String UPDATE_PASSWORD_PREFERENCES_URL = PASSWORD_PREFERENCES_URL + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------UPDATE PASSWORD PREFERENCE---------------------------------------------");
@@ -64,7 +64,7 @@ public class PaymentTypeHelper {
final Integer paymentTypeId) {
final String GET_PAYMENTTYPE_URL = PAYMENTTYPE_URL + "/" + paymentTypeId + "?" + Utils.TENANT_IDENTIFIER;
System.out.println("---------------------------------GET PAYMENT TYPE---------------------------------------------");
Object get = Utils.performServerGet(requestSpec, responseSpec, GET_PAYMENTTYPE_URL, "");
Object get = Utils.performServerGet(requestSpec, responseSpec, GET_PAYMENTTYPE_URL, "");
final String jsonData = new Gson().toJson(get);
return new Gson().fromJson(jsonData, new TypeToken<PaymentTypeDomain>() {}.getType());
@@ -104,7 +104,7 @@ public class ProvisioningIntegrationTest {
Map newCriteria = transactionHelper.retrieveProvisioningCriteria(criteriaId) ;
validateProvisioningCriteria(requestCriteria, newCriteria) ;
ArrayList definitions = (ArrayList)newCriteria.get("definitions") ;
for(int i = 0 ; i < definitions.size(); i++) {
Map criteriadefinition = (Map) definitions.get(i) ;
@@ -115,9 +115,9 @@ public class ProvisioningIntegrationTest {
Integer criteriaId1 = transactionHelper.updateProvisioningCriteria(criteriaId, updateCriteriaString) ;
Map updatedCriteria = transactionHelper.retrieveProvisioningCriteria(criteriaId1) ;
validateProvisioningCriteria(newCriteria, updatedCriteria) ;
transactionHelper.deleteProvisioningCriteria(criteriaId1) ;
categories = transactionHelper.retrieveAllProvisioningCategories();
liability = accountHelper.createLiabilityAccount() ;
expense = accountHelper.createExpenseAccount() ;
@@ -129,7 +129,7 @@ public class ProvisioningIntegrationTest {
String provisioningEntryJson = ProvisioningHelper.createProvisioningEntryJson();
Integer provisioningEntryId = transactionHelper.createProvisioningEntries(provisioningEntryJson);
Assert.assertNotNull(provisioningEntryId);
transactionHelper.updateProvisioningEntry("recreateprovisioningentry", provisioningEntryId, "") ;
transactionHelper.updateProvisioningEntry("createjournalentry", provisioningEntryId, "") ;
Map entry = transactionHelper.retrieveProvisioningEntry(provisioningEntryId) ;
@@ -139,24 +139,24 @@ public class ProvisioningIntegrationTest {
}
private void validateProvisioningCriteria(Map requestCriteria, Map newCriteria) {
//criteria name validation
String requestCriteriaName = (String)requestCriteria.get("criteriaName") ;
String criteriaName = (String)newCriteria.get("criteriaName") ;
Assert.assertEquals(criteriaName, requestCriteriaName) ;
//loan products validation
ArrayList requestProducts = (ArrayList)requestCriteria.get("loanProducts") ;
ArrayList products = (ArrayList)newCriteria.get("loanProducts") ;
Assert.assertEquals(products.size(), requestProducts.size()) ;
ArrayList requestedDefinitions = (ArrayList)requestCriteria.get("definitions") ;
ArrayList newdefintions = (ArrayList) newCriteria.get("definitions") ;
Assert.assertEquals(newdefintions.size(), requestedDefinitions.size()) ;
for(int i = 0 ; i < newdefintions.size() ; i++) {
Map requestedMap = (Map)requestedDefinitions.get(i) ;
Object requestedCategoryId = requestedMap.get("categoryId") ;
boolean found = false ;
boolean found = false ;
for(int j = 0 ; j < newdefintions.size(); j++) {
Map newMap = (Map)newdefintions.get(j) ;
Object newCategoryId = newMap.get("categoryId") ;
@@ -175,13 +175,13 @@ public class ProvisioningIntegrationTest {
if(!found) Assert.fail("No Category found with Id:"+requestedCategoryId);
}
}
private void checkProperty(String propertyName, Map requestMap, Map newMap) {
Object requested = requestMap.get(propertyName) ;
Object modified = newMap.get(propertyName) ;
Assert.assertEquals(requested, modified) ;
}
private Integer createLoanProduct(final boolean multiDisburseLoan, final String accountingRule, final Account... accounts) {
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
LoanProductTestBuilder builder = new LoanProductTestBuilder() //
@@ -199,7 +199,7 @@ public class ProvisioningIntegrationTest {
builder = builder.withInterestCalculationPeriodTypeAsRepaymentPeriod(true);
}
final String loanProductJSON = builder.build(null);
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
}
@@ -222,7 +222,7 @@ public class ProvisioningIntegrationTest {
.withCharges(charges).build(clientID.toString(), loanProductID.toString(), savingsId);
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
}
private boolean isAlreadyProvisioningEntriesCreated() {
ProvisioningTransactionHelper transactionHelper = new ProvisioningTransactionHelper(requestSpec, responseSpec);
Map entries = transactionHelper.retrieveAllProvisioningEntries() ;
@@ -67,13 +67,13 @@ public class AccountHelper {
liabilityAccountJSON, this.GL_ACCOUNT_ID_RESPONSE);
return new Account(accountID, Account.AccountType.LIABILITY);
}
public ArrayList getAccountingWithRunningBalances() {
final String GET_RUNNING_BALANCE_URL = "/fineract-provider/api/v1/glaccounts?fetchRunningBalance=true";
final ArrayList<HashMap> accountRunningBalance = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_RUNNING_BALANCE_URL, "");
return accountRunningBalance;
}
public HashMap getAccountingWithRunningBalanceById(final String accountId) {
final String GET_RUNNING_BALANCE_URL = "/fineract-provider/api/v1/glaccounts/" + accountId + "?fetchRunningBalance=true";
final HashMap accountRunningBalance = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_RUNNING_BALANCE_URL, "");
@@ -61,7 +61,7 @@ public class GLAccountBuilder {
accountType = ASSET_ACCOUNT;
glCode = Utils.randomStringGenerator("ASSET_", 2);
// Add unique timestamp to avoid random collisions
glCode += Calendar.getInstance().getTimeInMillis() + "";
glCode += Calendar.getInstance().getTimeInMillis() + "";
return this;
}
@@ -39,7 +39,7 @@ public class ChargesHelper {
private static final Integer CHARGE_APPLIES_TO_SAVINGS = 2;
private static final Integer CHARGE_APPLIES_TO_CLIENT = 3;
private static final Integer CHARGE_APPLIES_TO_SHARES = 4;
private static final Integer CHARGE_DISBURSEMENT_FEE = 1;
private static final Integer CHARGE_SPECIFIED_DUE_DATE = 2;
private static final Integer CHARGE_SAVINGS_ACTIVATION_FEE = 3;
@@ -53,9 +53,9 @@ public class ChargesHelper {
private static final Integer SHAREACCOUNT_ACTIVATION = 13 ;
private static final Integer SHARE_PURCHASE = 14 ;
private static final Integer SHARE_REDEEM = 15 ;
private static final Integer CHARGE_SAVINGS_NO_ACTIVITY_FEE = 16;
private static final Integer CHARGE_CLIENT_SPECIFIED_DUE_DATE = 1;
public static final Integer CHARGE_CALCULATION_TYPE_FLAT = 1;
@@ -125,7 +125,7 @@ public class ChargesHelper {
System.out.println(chargesCreateJson);
return chargesCreateJson;
}
public static String getSavingsWeeklyFeeJSON() {
final HashMap<String, Object> map = populateDefaultsForSavings();
map.put("chargeTimeType", WEEKLY_FEE);
@@ -247,21 +247,21 @@ public class ChargesHelper {
System.out.println(chargesCreateJson);
return chargesCreateJson;
}
public static String getShareAccountPurchaseChargeJson() {
HashMap<String, Object> map = populateDefaultsSharePurchaseFlatCharge() ;
String chargesCreateJson = new Gson().toJson(map);
System.out.println(chargesCreateJson);
return chargesCreateJson;
}
public static String getShareAccountRedeemChargeJson() {
HashMap<String, Object> map = populateDefaultsShareRedeemFlatCharge() ;
String chargesCreateJson = new Gson().toJson(map);
System.out.println(chargesCreateJson);
return chargesCreateJson;
}
public static String getLoanOverdueFeeJSON() {
final HashMap<String, Object> map = populateDefaultsForLoan();
map.put("penalty", ChargesHelper.penalty);
@@ -274,7 +274,7 @@ public class ChargesHelper {
System.out.println(chargesCreateJson);
return chargesCreateJson;
}
public static String getLoanOverdueFeeJSONWithCalculattionTypePercentage(String penaltyPercentageAmount) {
final HashMap<String, Object> map = populateDefaultsForLoan();
map.put("penalty", ChargesHelper.penalty);
@@ -299,7 +299,7 @@ public class ChargesHelper {
map.put("name", Utils.randomNameGenerator("Charge_Loans_", 6));
return map;
}
public static HashMap<String, Object> populateDefaultsClientCharge() {
final HashMap<String, Object> map = new HashMap<>();
map.put("active", ChargesHelper.active);
@@ -326,7 +326,7 @@ public class ChargesHelper {
map.put("name", Utils.randomNameGenerator("Charge_Share_Activation_", 8));
return map;
}
public static HashMap<String, Object> populateDefaultsSharePurchaseFlatCharge() {
final HashMap<String, Object> map = new HashMap<>();
map.put("active", ChargesHelper.active);
@@ -339,7 +339,7 @@ public class ChargesHelper {
map.put("name", Utils.randomNameGenerator("Charge_Share_Purchase_", 8));
return map;
}
public static HashMap<String, Object> populateDefaultsShareRedeemFlatCharge() {
final HashMap<String, Object> map = new HashMap<>();
map.put("active", ChargesHelper.active);
@@ -352,7 +352,7 @@ public class ChargesHelper {
map.put("name", Utils.randomNameGenerator("Charge_Share_Redeem_", 8));
return map;
}
public static Integer createCharges(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String request) {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_CHARGES_URL, request, "resourceId");
@@ -472,7 +472,7 @@ public class ChargesHelper {
System.out.println(json);
return json;
}
public static String getChargeSpecifiedDueDateJSON() {
final HashMap<String, Object> map = populateDefaultsClientCharge();
String chargesCreateJson = new Gson().toJson(map);
@@ -482,6 +482,6 @@ public class ChargesHelper {
public static String applyCharge(RequestSpecification requestSpec,ResponseSpecification responseSpec, String chargeId,String json) {
return Utils.performServerPost(requestSpec, responseSpec, CHARGES_URL + "/" + chargeId + "?" + Utils.TENANT_IDENTIFIER, json,"status");
}
}
@@ -87,7 +87,7 @@ public class FixedDepositAccountStatusChecker {
assertTrue("ERROR IN PREMATURELY CLOSING THE FIXED DEPOSIT ACCOUNT", getStatus(fixedDepositStatusHashMap, "prematureClosed"));
System.out.println(fixedDepositStatusHashMap);
}
public static void verifyFixedDepositAccountIsMatured(HashMap fixedDepositStatusHashMap) {
System.out.println("--------------------- VERIFYING FIXED DEPOSIT APPLICATION IS MATURED ---------------------");
assertTrue("ERROR IN MATURITY JOB OF THE FIXED DEPOSIT ACCOUNT", getStatus(fixedDepositStatusHashMap, "matured"));
@@ -74,7 +74,7 @@ public class FixedDepositProductHelper {
private static final String ACCRUAL_UPFRONT = "4";
private static final String WHOLE_TERM = "1";
private static final String TILL_PREMATURE_WITHDRAWAL = "2";
private String name = Utils.randomNameGenerator("FIXED_DEPOSIT_PRODUCT_", 6);
private String shortName = Utils.randomNameGenerator("", 4);
@@ -147,7 +147,7 @@ public class FixedDepositProductHelper {
map.put("taxGroupId", taxGroupId);
}
if (this.accountingRule.equals(CASH_BASED)) {
map.putAll(getAccountMappingForCashBased());
@@ -389,7 +389,7 @@ public class FixedDepositProductHelper {
this.chartSlabs = constructChartSlabWithAmountAndPeriodRange();
return this;
}
public FixedDepositProductHelper withWithHoldTax(final String taxGroupId) {
if (taxGroupId != null) {
this.withHoldTax = true;
@@ -303,7 +303,7 @@ public class LoanApplicationTestBuilder {
* disbursement with the group meetings (it seems that if we do use this
* parameter we should also use calendarID to sync repayment with group
* meetings)
*
*
* @return
*/
public LoanApplicationTestBuilder withSyncDisbursementWithMeetin() {
@@ -23,7 +23,7 @@ import static org.junit.Assert.assertEquals;
import java.util.HashMap;
public class LoanDisbursementTestBuilder {
String dueDate = null;
Float totalOriginalDueForPeriod = null;
Float totalOutstandingForPeriod = null;
@@ -32,8 +32,8 @@ public class LoanDisbursementTestBuilder {
Float principalLoanBalanceOutstanding = null;
Float principalDue = null;
Float principalOriginalDue = null;
String fromDate = null;
String fromDate = null;
public LoanDisbursementTestBuilder(String dueDate,Float totalOriginalDueForPeriod,Float totalOutstandingForPeriod,
Float interestOutstanding, Float principalOutstanding, Float principalLoanBalanceOutstanding, Float principalDue,
Float principalOriginalDue, String fromDate) {
@@ -45,7 +45,7 @@ public class LoanDisbursementTestBuilder {
this.principalLoanBalanceOutstanding = principalLoanBalanceOutstanding;
this.principalDue = principalDue;
this.principalOriginalDue = principalOriginalDue;
this.fromDate = fromDate;
this.fromDate = fromDate;
}
public String getDueDate() {
@@ -83,7 +83,7 @@ public class LoanDisbursementTestBuilder {
public String getFromDate() {
return this.fromDate;
}
/*public HashMap<String, String> build(String dueDate,String totalOriginalDueForPeriod,String totalOutstandingForPeriod,
String interestOutstanding, String principalOutstanding, String principalLoanBalanceOutstanding, String principalDue,
String principalOriginalDue, String fromDate) {
@@ -102,7 +102,7 @@ public class LoanDisbursementTestBuilder {
expectedRepaymentSchedule.put("principalOriginalDue",
principalOriginalDue);
expectedRepaymentSchedule.put("fromDate", fromDate);
return expectedRepaymentSchedule;
}*/
}
@@ -116,7 +116,7 @@ public class LoanProductTestBuilder {
private String graceOnInterestPayment = "1";
private JsonObject allowAttributeOverrides = null;
private Boolean allowPartialPeriodInterestCalcualtion = false;
private Boolean allowVariableInstallments = Boolean.FALSE;
private Integer minimumGap;
private Integer maximumGap;
@@ -212,7 +212,7 @@ public class LoanProductTestBuilder {
map.put("minimumGap", minimumGap) ;
map.put("maximumGap", maximumGap) ;
}
map.put("syncExpectedWithDisbursementDate",
map.put("syncExpectedWithDisbursementDate",
this.syncExpectedWithDisbursementDate);
return new Gson().toJson(map);
}
@@ -494,16 +494,16 @@ public class LoanProductTestBuilder {
this.allowAttributeOverrides = loanProductConfigurableAttributes;
return this;
}
public LoanProductTestBuilder withVariableInstallmentsConfig(Boolean allowVariableInstallments, Integer minimumGap, Integer maximumGap) {
this.allowVariableInstallments = allowVariableInstallments ;
this.minimumGap = minimumGap;
this.maximumGap = maximumGap;
return this ;
}
public LoanProductTestBuilder withSyncExpectedWithDisbursementDate(Boolean syncExpectedWithDisbursementDate) {
this.syncExpectedWithDisbursementDate =
this.syncExpectedWithDisbursementDate =
syncExpectedWithDisbursementDate ;
return this ;
}
@@ -190,7 +190,7 @@ public class LoanTransactionHelper {
public HashMap disburseLoan(final String date, final Integer loanID) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID), getDisburseLoanAsJSON(date, null));
}
public HashMap disburseLoanWithRepaymentReschedule(final String date, final Integer loanID, String adjustRepaymentDate) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID), getDisburseLoanWithRepaymentRescheduleAsJSON(date,
null, adjustRepaymentDate));
@@ -203,7 +203,7 @@ public class LoanTransactionHelper {
public Object disburseLoan(final String date, final Integer loanID, ResponseSpecification responseValidationError) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_COMMAND, loanID), getDisburseLoanAsJSON(date, null), responseValidationError);
}
public HashMap disburseLoanToSavings(final String date, final Integer loanID) {
return performLoanTransaction(createLoanOperationURL(DISBURSE_LOAN_TO_SAVINGS_COMMAND, loanID), getDisburseLoanAsJSON(date, null));
}
@@ -215,7 +215,7 @@ public class LoanTransactionHelper {
System.out.println("IN DISBURSE LOAN URL " + url);
return performLoanTransaction(createLoanOperationURL(UNDO_DISBURSE_LOAN_COMMAND, loanID), undoDisburseJson);
}
public Float undoLastDisbursal(final Integer loanID) {
final String undoLastDisburseJson = "{'note' : 'UNDO LAST DISBURSAL'}";
final String url = createLoanOperationURL(UNDO_LAST_DISBURSE_LOAN_COMMAND, loanID);
@@ -267,7 +267,7 @@ public class LoanTransactionHelper {
final String ADD_CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(this.requestSpec, responseSpecification, ADD_CHARGES_URL, request, "");
}
public Integer updateChargesForLoan(final Integer loanId, final Integer loanchargeId, final String request) {
System.out.println("--------------------------------- ADD CHARGES FOR LOAN --------------------------------");
final String UPDATE_CHARGES_URL = "/fineract-provider/api/v1/loans/" + loanId + "/charges/" + loanchargeId + "?"
@@ -312,7 +312,7 @@ public class LoanTransactionHelper {
System.out.println("Loan Application disburse request : " + map);
return new Gson().toJson(map);
}
private String getDisburseLoanWithRepaymentRescheduleAsJSON(final String actualDisbursementDate, final String transactionAmount, final String adjustRepaymentDate) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
@@ -509,7 +509,7 @@ public class LoanTransactionHelper {
"changes");
return (HashMap) response.get("status");
}
private Float performUndoLastLoanDisbursementTransaction(final String postURLForLoanTransaction, final String jsonToBeSent) {
final HashMap response = Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForLoanTransaction, jsonToBeSent,
@@ -520,10 +520,10 @@ public class LoanTransactionHelper {
private Object performLoanTransaction(final String postURLForLoanTransaction, final String jsonToBeSent, final String responseAttribute) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, postURLForLoanTransaction, jsonToBeSent, responseAttribute);
}
private Object performLoanTransaction(final String postURLForLoanTransaction, final String jsonToBeSent, ResponseSpecification responseValidationError) {
return Utils.performServerPost(this.requestSpec, responseValidationError, postURLForLoanTransaction, jsonToBeSent, CommonConstants.RESPONSE_ERROR);
return Utils.performServerPost(this.requestSpec, responseValidationError, postURLForLoanTransaction, jsonToBeSent, CommonConstants.RESPONSE_ERROR);
}
public Object adjustLoanTransaction(final Integer loanId, final Integer transactionId, final String date,
@@ -635,7 +635,7 @@ public class LoanTransactionHelper {
map.put("locale", "en");
return new Gson().toJson(map);
}
public HashMap createTrancheDetail(final String id, final String date, final String amount) {
HashMap<String, Object> detail = new HashMap<>();
if(id != null){
@@ -646,30 +646,30 @@ public class LoanTransactionHelper {
return detail;
}
public Object editDisbursementDetail(final Integer loanID, final Integer disbursementId, final String approvalAmount, final String expectedDisbursementDate,
public Object editDisbursementDetail(final Integer loanID, final Integer disbursementId, final String approvalAmount, final String expectedDisbursementDate,
final String updatedExpectedDisbursementDate, final String updatedPrincipal, final String jsonAttributeToGetBack) {
return Utils.performServerPut(this.requestSpec, this.responseSpec, createEditDisbursementURL(loanID, disbursementId), getEditDisbursementsAsJSON(approvalAmount, expectedDisbursementDate,
return Utils.performServerPut(this.requestSpec, this.responseSpec, createEditDisbursementURL(loanID, disbursementId), getEditDisbursementsAsJSON(approvalAmount, expectedDisbursementDate,
updatedExpectedDisbursementDate, updatedPrincipal), jsonAttributeToGetBack);
}
public Object addAndDeleteDisbursementDetail(final Integer loanID, final String approvalAmount, final String expectedDisbursementDate
, List<HashMap> disbursementData, final String jsonAttributeToGetBack) {
return Utils.performServerPut(this.requestSpec, this.responseSpec, createAddAndDeleteDisbursementURL(loanID),
return Utils.performServerPut(this.requestSpec, this.responseSpec, createAddAndDeleteDisbursementURL(loanID),
getAddAndDeleteDisbursementsAsJSON(approvalAmount, expectedDisbursementDate, disbursementData), jsonAttributeToGetBack);
}
private String createEditDisbursementURL(Integer loanID, Integer disbursementId) {
return "/fineract-provider/api/v1/loans/" + loanID + "/disbursements/" + disbursementId + "?" + Utils.TENANT_IDENTIFIER;
}
private String createAddAndDeleteDisbursementURL(Integer loanID) {
return "/fineract-provider/api/v1/loans/" + loanID + "/disbursements/editDisbursements?" + Utils.TENANT_IDENTIFIER;
}
public static String getEditDisbursementsAsJSON(final String approvalAmount, final String expectedDisbursementDate,
public static String getEditDisbursementsAsJSON(final String approvalAmount, final String expectedDisbursementDate,
final String updatedExpectedDisbursementDate, final String updatedPrincipal) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", "en");
@@ -682,8 +682,8 @@ public class LoanTransactionHelper {
System.out.println(json);
return json;
}
public static String getAddAndDeleteDisbursementsAsJSON(final String approvalAmount, final String expectedDisbursementDate,
public static String getAddAndDeleteDisbursementsAsJSON(final String approvalAmount, final String expectedDisbursementDate,
final List<HashMap> disbursementData) {
final HashMap map = new HashMap<>();
map.put("locale", "en");
@@ -56,7 +56,7 @@ public class ProvisioningHelper {
String provisioningEntryCreateJson = new Gson().toJson(map);
return provisioningEntryCreateJson;
}
public final static String createProvisioningEntryJsonWithJournalsEnabled() {
final HashMap<String, Object> map = new HashMap<>();
map.put("createjournalentries", Boolean.TRUE);
@@ -30,63 +30,63 @@ import com.jayway.restassured.specification.ResponseSpecification;
public class ProvisioningTransactionHelper {
private static final String PROVISIONING_CATEGORY_URL = "/fineract-provider/api/v1/provisioningcategory?" + Utils.TENANT_IDENTIFIER ;
private static final String CREATE_PROVISIONING_CRITERIA_URL = "/fineract-provider/api/v1/provisioningcriteria?" + Utils.TENANT_IDENTIFIER;
private static final String CREATE_PROVISIONING_ENTRY_URL = "/fineract-provider/api/v1/provisioningentries?" + Utils.TENANT_IDENTIFIER;
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
public ProvisioningTransactionHelper(RequestSpecification requestSpec, ResponseSpecification responeSpec) {
this.requestSpec = requestSpec ;
this.responseSpec = responeSpec ;
}
public ArrayList retrieveAllProvisioningCategories() {
return Utils.performServerGet(requestSpec, responseSpec, PROVISIONING_CATEGORY_URL, "");
}
public Integer createProvisioningCriteria(final String provsioningCriteriaJson) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, CREATE_PROVISIONING_CRITERIA_URL, provsioningCriteriaJson, "resourceId");
}
public Map retrieveProvisioningCriteria(final Integer criteriaId) {
String url = "/fineract-provider/api/v1/provisioningcriteria/"+criteriaId+"?"+Utils.TENANT_IDENTIFIER ;
return Utils.performServerGet(requestSpec, responseSpec, url, "");
}
public Integer updateProvisioningCriteria(final Integer criteriaId, final String provsioningCriteriaJson) {
String url = "/fineract-provider/api/v1/provisioningcriteria/"+criteriaId+"?"+Utils.TENANT_IDENTIFIER ;
return Utils.performServerPut(this.requestSpec, this.responseSpec, url, provsioningCriteriaJson, "resourceId");
}
public Integer deleteProvisioningCriteria(final Integer criteriaId) {
String url = "/fineract-provider/api/v1/provisioningcriteria/"+criteriaId+"?"+Utils.TENANT_IDENTIFIER;
return Utils.performServerDelete(this.requestSpec, this.responseSpec, url, "resourceId");
}
public Integer createProvisioningEntries(final String provsioningCriteriaJson) {
return Utils.performServerPost(this.requestSpec, this.responseSpec, CREATE_PROVISIONING_ENTRY_URL, provsioningCriteriaJson, "resourceId");
}
public Integer updateProvisioningEntry(final String command, final Integer entryId, String jsonBody) {
String url = "/fineract-provider/api/v1/provisioningentries/" + entryId + "?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPost(requestSpec, responseSpec, url, jsonBody, "resourceId") ;
}
public Map retrieveProvisioningEntry(final Integer provisioningEntry) {
String url = "/fineract-provider/api/v1/provisioningentries/"+provisioningEntry+"?"+Utils.TENANT_IDENTIFIER; ;
return Utils.performServerGet(requestSpec, responseSpec, url, "") ;
}
public Map retrieveProvisioningEntries(final Integer provisioningEntry) {
String url = "/fineract-provider/api/v1/provisioningentries/entries?entryId="+provisioningEntry+"&"+Utils.TENANT_IDENTIFIER; ;
return Utils.performServerGet(requestSpec, responseSpec, url, "") ;
}
public Map retrieveAllProvisioningEntries() {
String url = "/fineract-provider/api/v1/provisioningentries?dateFormat=dd MMMM yyyy"+"&"+"locale=en"+"&"+Utils.TENANT_IDENTIFIER; ;
return Utils.performServerGet(requestSpec, responseSpec, url, "") ;
}
}
@@ -504,7 +504,7 @@ public class RecurringDepositAccountHelper {
this.interestPostingPeriodType = interestPostingPeriodTypeId;
return this;
}
public RecurringDepositAccountHelper withDepositPeriod(final String depositPeriod) {
this.depositPeriod = depositPeriod;
return this;
@@ -89,7 +89,7 @@ public class RecurringDepositAccountStatusChecker {
getStatus(recurringDepositStatusHashMap, "prematureClosed"));
System.out.println(recurringDepositStatusHashMap);
}
public static void verifyRecurringDepositAccountIsMatured(HashMap recurringDepositStatusHashMap) {
System.out.println("--------------------- VERIFYING RECURRING DEPOSIT APPLICATION IS MATURED ---------------------");
assertTrue("ERROR IN MATURITY JOB OF THE RECURRING DEPOSIT ACCOUNT", getStatus(recurringDepositStatusHashMap, "matured"));
@@ -190,7 +190,7 @@ public class RecurringDepositProductHelper {
this.chartSlabs = constructChartSlabWithAmountAndPeriodRange();
return this;
}
public RecurringDepositProductHelper withWithHoldTax(final String taxGroupId) {
if (taxGroupId != null) {
this.withHoldTax = true;
@@ -84,7 +84,7 @@ public class AccountTransferHelper {
return Utils.performServerPost(this.requestSpec, this.responseSpec, ACCOUNT_TRANSFER_URL + "?" + Utils.TENANT_IDENTIFIER,
accountTransferJSON, "savingsId");
}
public Integer refundLoanByTransfer(final String date, final Integer fromClientId, final Integer fromAccountId, final Integer toClientId,
final Integer toAccountId, final String fromAccountType, final String toAccountType, final String transferAmount) {
System.out.println("--------------------------------ACCOUNT TRANSFER--------------------------------");
@@ -59,7 +59,7 @@ public class SavingsAccountHelper {
private static final String WITHDRAW_SAVINGS_COMMAND = "withdrawal";
private static final String MODIFY_TRASACTION_COMMAND = "modify";
private static final String UNDO_TRASACTION_COMMAND = "undo";
private static final String BLOCK_SAVINGS_COMMAND = "block";
private static final String UNBLOCK_SAVINGS_COMMAND = "unblock";
private static final String BLOCK_DEBITS_SAVINGS_COMMAND = "blockDebit";
@@ -246,7 +246,7 @@ public class SavingsAccountHelper {
performSavingActions(createSavingsCalculateInterestURL(POST_INTEREST_SAVINGS_COMMAND, savingsId),
getCalculatedInterestForSavingsApplicationAsJSON(), "");
}
public void postInterestAsOnSavings(final Integer savingsId, final String today) {
System.out.println("--------------------------------- POST INTEREST AS ON FOR SAVINGS --------------------------------");
performSavingActions(createSavingsPostInterestAsOnURL(POST_INTEREST_AS_ON_SAVINGS_COMMAND, savingsId),
@@ -287,7 +287,7 @@ public class SavingsAccountHelper {
return Utils.performServerDelete(this.requestSpec, this.responseSpec, SAVINGS_ACCOUNT_URL + "/" + savingsId + "/charges/"
+ chargeId + "?" + Utils.TENANT_IDENTIFIER, CommonConstants.RESPONSE_RESOURCE_ID);
}
public HashMap blockSavings(final Integer savingsID) {
System.out.println("---------------------------------- BLOCKING SAVINGS ACCOUNT ----------------------------------");
Boolean isBlock = true;
@@ -406,7 +406,7 @@ public class SavingsAccountHelper {
System.out.println(savingsAccountCalculatedInterestJson);
return savingsAccountCalculatedInterestJson;
}
private String getCalculatedInterestForSavingsApplicationAsJSON(final String today) {
final HashMap<String, String> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
@@ -451,11 +451,11 @@ public class SavingsAccountHelper {
map.put("closedOnDate", closedOnDate);
map.put("withdrawBalance", withdrawBalance);
map.put("note", "Close Test");
String josn = new Gson().toJson(map);
return josn;
}
private String getCloseAccountPostInterestJSON(String withdrawBalance, String closedOnDate) {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", CommonConstants.locale);
@@ -464,7 +464,7 @@ public class SavingsAccountHelper {
map.put("withdrawBalance", withdrawBalance);
map.put("note", "Close Test");
map.put("postInterestValidationOnClosure", "true");
String josn = new Gson().toJson(map);
return josn;
}
@@ -485,7 +485,7 @@ public class SavingsAccountHelper {
private String createSavingsCalculateInterestURL(final String command, final Integer savingsID) {
return SAVINGS_ACCOUNT_URL + "/" + savingsID + "?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
}
private String createSavingsPostInterestAsOnURL(final String command, final Integer savingsID) {
return SAVINGS_ACCOUNT_URL + "/" + savingsID + "/transactions/" + "?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
}
@@ -569,7 +569,7 @@ public class SavingsAccountHelper {
return performSavingActions(createSavingsOperationURL(CLOSE_SAVINGS_COMMAND, savingsID),
getCloseAccountJSON(withdrawBalance, closedOnDate), jsonAttributeToGetBack);
}
public Object closeSavingsAccountPostInterestAndGetBackRequiredField(final Integer savingsID, String withdrawBalance,
final String jsonAttributeToGetBack, final String closedOnDate) {
System.out.println("---------------------------------- CLOSE SAVINGS APPLICATION ----------------------------------");
@@ -29,7 +29,7 @@ import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings("rawtypes")
public class SavingsStatusChecker {
private static final String SAVINGS_ACCOUNT_URL = "/fineract-provider/api/v1/savingsaccounts";
public static void verifySavingsIsApproved(final HashMap savingsStatusHashMap) {
@@ -49,19 +49,19 @@ public class SavingsStatusChecker {
assertTrue("ERROR IN ACTIVATING THE SAVINGS APPLICATION", getStatus(savingsStatusHashMap, "active"));
System.out.println("Savings Application Status:" + savingsStatusHashMap + "\n");
}
public static void verifySavingsIsRejected(final HashMap savingsStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS REJECTED ------------------------------------");
assertTrue("ERROR IN REJECTING THE SAVINGS APPLICATION", getStatus(savingsStatusHashMap, "rejected"));
System.out.println("Savings Application Status:" + savingsStatusHashMap + "\n");
}
public static void verifySavingsIsWithdrawn(final HashMap savingsStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS WITHDRAWN ------------------------------------");
assertTrue("ERROR IN WITHDRAW THE SAVINGS APPLICATION", getStatus(savingsStatusHashMap, "withdrawnByApplicant"));
System.out.println("Savings Application Status:" + savingsStatusHashMap + "\n");
}
public static void verifySavingsAccountIsClosed(final HashMap savingsStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS CLOSED ------------------------------------");
assertTrue("ERROR IN CLOSING THE SAVINGS APPLICATION", getStatus(savingsStatusHashMap, "closed"));
@@ -95,13 +95,13 @@ public class SavingsStatusChecker {
assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "inactive"));
System.out.println("Savings Application Sub Status:" + savingsStatusHashMap + "\n");
}
public static void verifySavingsSubStatusDormant(HashMap savingsStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------");
assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "dormant"));
System.out.println("Savings Application Sub Status:" + savingsStatusHashMap + "\n");
}
public static void verifySavingsSubStatusEscheat(HashMap savingsStatusHashMap) {
System.out.println("\n-------------------------------------- VERIFYING SAVINGS APPLICATION IS ACTIVE ------------------------------------");
assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "escheat"));
@@ -113,7 +113,7 @@ public class SavingsStatusChecker {
assertTrue("UNEXPECTED SAVINGS ACCOUNT SUB STATUS", getStatus(savingsStatusHashMap, "none"));
System.out.println("Savings Application Sub Status:" + savingsStatusHashMap + "\n");
}
public static void verifySavingsSubStatusblock(HashMap savingsStatusHashMap) {
System.out.println(
"\n-------------------------------------- VERIFYING SAVINGS ACCOUNT IS BLOCKED ------------------------------------");
@@ -46,7 +46,7 @@ public class DividendsIntegrationTests {
private final String[] dates = {"01 Jan 2015", "01 Apr 2015", "01 Oct 2015", "01 Dec 2015", "01 Mar 2016"} ;
private final String[] shares = {"100", "200", "300", "100", "500"} ;
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
@@ -57,7 +57,7 @@ public class DividendsIntegrationTests {
this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
}
@SuppressWarnings("unchecked")
@Test
public void testCreateDividends() {
@@ -78,7 +78,7 @@ public class DividendsIntegrationTests {
Assert.assertNotNull(shareAccountId);
Map<String, Object> shareAccountData = ShareAccountTransactionHelper
.retrieveShareAccount(shareAccountId, requestSpec, responseSpec);
Assert.assertNotNull(shareAccountData);
Assert.assertNotNull(shareAccountData);
// Approve share Account
Map<String, Object> approveMap = new HashMap<>();
approveMap.put("note", "Share Account Approval Note");
@@ -95,7 +95,7 @@ public class DividendsIntegrationTests {
String activateJson = new Gson().toJson(activateMap);
ShareAccountTransactionHelper.postCommand("activate", shareAccountId, activateJson, requestSpec, responseSpec);
}
Map<String, Object> dividendsMap = new HashMap<>() ;
dividendsMap.put("dividendPeriodStartDate", "01 Jan 2015") ;
dividendsMap.put("dividendPeriodEndDate", "01 Apr 2016") ;
@@ -104,7 +104,7 @@ public class DividendsIntegrationTests {
dividendsMap.put("locale", "en");
String createDividendsJson = new Gson().toJson(dividendsMap);
final Integer dividendId = ShareDividendsTransactionHelper.createShareProductDividends(productId, createDividendsJson, requestSpec, responseSpec) ;
Map<String, Object> productdividends = ShareDividendsTransactionHelper.retrieveAllDividends(productId, requestSpec, responseSpec);
Assert.assertEquals("1", String.valueOf(productdividends.get("totalFilteredRecords")));
Map<String,Object> dividend = ((List<Map<String,Object>>)productdividends.get("pageItems")).get(0) ;
@@ -121,14 +121,14 @@ public class DividendsIntegrationTests {
cal.set(enddateList.get(0), enddateList.get(1) - 1, enddateList.get(2));
Date endDate = cal.getTime();
Assert.assertEquals("01 Apr 2016", simple.format(endDate));
Map<String, Object> dividenddetails = ShareDividendsTransactionHelper.retrieveDividendDetails(productId, dividendId, requestSpec, responseSpec) ;
Assert.assertEquals("5", String.valueOf(dividenddetails.get("totalFilteredRecords")));
List<Map<String, Object>> pageItems = (List<Map<String, Object>>)dividenddetails.get("pageItems") ;
for(Map<String, Object> dividendData: pageItems) {
Map<String, Object> accountData = (Map<String, Object>) dividendData.get("accountData") ;
Map<String, Object> accountData = (Map<String, Object>) dividendData.get("accountData") ;
String accountId = String.valueOf(accountData.get("id")) ;
if(String.valueOf(shareAccounts.get(0)).equals(accountId)) {
Assert.assertEquals("11320.755", String.valueOf(dividendData.get("amount")));
@@ -144,10 +144,10 @@ public class DividendsIntegrationTests {
Map<String, Object> statusMap = (Map<String, Object>) dividendData.get("status") ;
Assert.assertEquals("shareAccountDividendStatusType.initiated", String.valueOf(statusMap.get("code"))) ;
}
String jsonString = "" ;
ShareDividendsTransactionHelper.postCommand("approve", productId, dividendId, jsonString, requestSpec, responseSpec) ;
productdividends = ShareDividendsTransactionHelper.retrieveAllDividends(productId, requestSpec, responseSpec);
Assert.assertEquals("1", String.valueOf(productdividends.get("totalFilteredRecords")));
dividend = ((List<Map<String,Object>>)productdividends.get("pageItems")).get(0) ;
@@ -164,12 +164,12 @@ public class DividendsIntegrationTests {
cal.set(enddateList.get(0), enddateList.get(1) - 1, enddateList.get(2));
endDate = cal.getTime();
Assert.assertEquals("01 Apr 2016", simple.format(endDate));
dividenddetails = ShareDividendsTransactionHelper.retrieveDividendDetails(productId, dividendId, requestSpec, responseSpec) ;
Assert.assertEquals("5", String.valueOf(dividenddetails.get("totalFilteredRecords")));
pageItems = (List<Map<String, Object>>)dividenddetails.get("pageItems") ;
for(Map<String, Object> dividendData: pageItems) {
Map<String, Object> accountData = (Map<String, Object>) dividendData.get("accountData") ;
Map<String, Object> accountData = (Map<String, Object>) dividendData.get("accountData") ;
String accountId = String.valueOf(accountData.get("id")) ;
if(String.valueOf(shareAccounts.get(0)).equals(accountId)) {
Assert.assertEquals("11320.755", String.valueOf(dividendData.get("amount")));
@@ -185,14 +185,14 @@ public class DividendsIntegrationTests {
Map<String, Object> statusMap = (Map<String, Object>) dividendData.get("status") ;
Assert.assertEquals("shareAccountDividendStatusType.initiated", String.valueOf(statusMap.get("code"))) ;
}
}
private Integer createShareProduct() {
String shareProductJson = new ShareProductHelper().build();
return ShareProductTransactionHelper.createShareProduct(shareProductJson, requestSpec, responseSpec);
}
private Integer createShareAccount(final Integer clientId, final Integer productId, final Integer savingsAccountId,
String applicationDate, String requestedShares) {
String josn = new ShareAccountHelper().withClientId(String.valueOf(clientId)).withProductId(String.valueOf(productId))
@@ -29,113 +29,113 @@ import com.google.gson.Gson;
public class ShareAccountHelper {
private static final String LOCALE = "en_GB";
private String clientId ;
private String productId ;
private String submittedDate ;
private String externalId ;
private String savingsAccountId ;
private String requestedShares ;
private String applicationDate ;
private String allowDividendCalculationForInactiveClients ;
private String minimumActivePeriod ;
private String minimumActivePeriodFrequencyType ;
private String lockinPeriodFrequency ;
private String lockinPeriodFrequencyType ;
private List<Map<String, Object>> charges = null ;
//chargeId , amount
public String build() {
final HashMap<String, Object> map = new HashMap<>();
map.put("locale", LOCALE);
if(this.clientId != null) {
map.put("clientId", this.clientId) ;
map.put("clientId", this.clientId) ;
}
if(this.productId != null) {
map.put("productId", this.productId) ;
}
map.put("dateFormat", "dd MMMM yyyy");
if(this.savingsAccountId != null) {
map.put("savingsAccountId", savingsAccountId) ;
}
if(externalId != null) {
map.put("externalId", this.externalId) ;
}
if(submittedDate != null) {
map.put("submittedDate", this.submittedDate) ;
}
if(applicationDate != null) {
map.put("applicationDate", this.applicationDate) ;
}
if(this.requestedShares != null) {
map.put("requestedShares", this.requestedShares) ;
}
if(this.allowDividendCalculationForInactiveClients != null) {
map.put("allowDividendCalculationForInactiveClients", this.allowDividendCalculationForInactiveClients) ;
}
if(this.charges != null) {
map.put("charges", this.charges) ;
}
String shareAccountCreateJson = new Gson().toJson(map);
System.out.println(shareAccountCreateJson);
return shareAccountCreateJson;
}
public ShareAccountHelper withClientId(final String clientId) {
this.clientId = clientId ;
return this ;
}
public ShareAccountHelper withProductId(final String productId) {
this.productId = productId ;
return this ;
}
public ShareAccountHelper withSavingsAccountId(final String savingsAccountId) {
this.savingsAccountId = savingsAccountId ;
return this ;
}
public ShareAccountHelper withSubmittedDate(final String submittedDate) {
this.submittedDate = submittedDate ;
return this ;
}
public ShareAccountHelper withRequestedShares(final String requestedShares) {
this.requestedShares = requestedShares ;
return this ;
}
public ShareAccountHelper withApplicationDate(final String applicationDate) {
this.applicationDate = applicationDate ;
return this ;
}
public ShareAccountHelper withExternalId(final String externalId) {
this.externalId = externalId ;
return this ;
}
public ShareAccountHelper withCharges(final List<Map<String,Object>> charges) {
this.charges = new ArrayList<>() ;
this.charges.addAll(charges) ;
@@ -156,7 +156,7 @@ public class ShareAccountIntegrationTests {
Map<String, Object> shareAccountData = ShareAccountTransactionHelper
.retrieveShareAccount(shareAccountId, requestSpec, responseSpec);
Assert.assertNotNull(shareAccountData);
// Approve share Account
Map<String, Object> approveMap = new HashMap<>();
approveMap.put("note", "Share Account Approval Note");
@@ -205,7 +205,7 @@ public class ShareAccountIntegrationTests {
Assert.assertEquals("25", String.valueOf(summaryMap.get("totalApprovedShares")));
Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares")));
}
@Test
@SuppressWarnings("unchecked")
public void rejectShareAccount() {
@@ -231,7 +231,7 @@ public class ShareAccountIntegrationTests {
Map<String, Object> shareAccountData = ShareAccountTransactionHelper
.retrieveShareAccount(shareAccountId, requestSpec, responseSpec);
Assert.assertNotNull(shareAccountData);
// Reject share Account
Map<String, Object> rejectMap = new HashMap<>();
rejectMap.put("note", "Share Account Rejection Note");
@@ -249,7 +249,7 @@ public class ShareAccountIntegrationTests {
Date rejectedDate = cal.getTime();
Date currentTenantDate = DateUtils.getDateOfTenant() ;
Assert.assertEquals(simple.format(currentTenantDate), simple.format(rejectedDate));
List<Map<String, Object>> transactions = (List<Map<String, Object>>) shareAccountData.get("purchasedShares");
Assert.assertNotNull(transactions);
Assert.assertEquals(2, transactions.size());
@@ -280,7 +280,7 @@ public class ShareAccountIntegrationTests {
Assert.assertEquals("0", String.valueOf(summaryMap.get("totalApprovedShares")));
Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares")));
}
@Test
@SuppressWarnings("unchecked")
public void testShareAccountUndoApproval() {
@@ -307,7 +307,7 @@ public class ShareAccountIntegrationTests {
Map<String, Object> shareAccountData = ShareAccountTransactionHelper
.retrieveShareAccount(shareAccountId, requestSpec, responseSpec);
Assert.assertNotNull(shareAccountData);
// Approve share Account
Map<String, Object> approveMap = new HashMap<>();
approveMap.put("note", "Share Account Approval Note");
@@ -326,18 +326,18 @@ public class ShareAccountIntegrationTests {
cal.set(dateList.get(0), dateList.get(1) - 1, dateList.get(2));
Date approvedDate = cal.getTime();
Assert.assertEquals("01 Jan 2016", simple.format(approvedDate));
// Undo Approval share Account
Map<String, Object> undoApprovalMap = new HashMap<>();
String undoApprovalJson = new Gson().toJson(undoApprovalMap);
ShareAccountTransactionHelper.postCommand("undoapproval", shareAccountId, undoApprovalJson, requestSpec, responseSpec);
shareAccountData = ShareAccountTransactionHelper
.retrieveShareAccount(shareAccountId, requestSpec, responseSpec);
statusMap = (Map<String, Object>) shareAccountData.get("status");
Assert.assertEquals("shareAccountStatusType.submitted.and.pending.approval", String.valueOf(statusMap.get("code")));
List<Map<String, Object>> transactions = (List<Map<String, Object>>) shareAccountData.get("purchasedShares");
Assert.assertNotNull(transactions);
Assert.assertEquals(2, transactions.size());
@@ -368,7 +368,7 @@ public class ShareAccountIntegrationTests {
Assert.assertEquals("0", String.valueOf(summaryMap.get("totalApprovedShares")));
Assert.assertEquals("25", String.valueOf(summaryMap.get("totalPendingForApprovalShares")));
}
@SuppressWarnings("unchecked")
@Test
public void testCreateShareAccountWithCharges() {
@@ -453,7 +453,7 @@ public class ShareAccountIntegrationTests {
Assert.fail("Other Charge defintion found");
}
}
// Approve share Account
Map<String, Object> approveMap = new HashMap<>();
approveMap.put("note", "Share Account Approval Note");
@@ -495,7 +495,7 @@ public class ShareAccountIntegrationTests {
Assert.fail("Other Charge defintion found");
}
}
Map<String, Object> activateMap = new HashMap<>();
activateMap.put("dateFormat", "dd MMMM yyyy");
activateMap.put("activatedDate", "01 Jan 2016");
@@ -560,7 +560,7 @@ public class ShareAccountIntegrationTests {
Assert.fail("Other Charge defintion found");
}
}
Map<String, Object> summaryMap = (Map<String, Object>) shareAccountData.get("summary");
Assert.assertEquals("30", String.valueOf(summaryMap.get("totalApprovedShares")));
Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares")));
@@ -634,7 +634,7 @@ public class ShareAccountIntegrationTests {
Assert.fail("Other Charge defintion found");
}
}
summaryMap = (Map<String, Object>) shareAccountData.get("summary");
Assert.assertEquals("30", String.valueOf(summaryMap.get("totalApprovedShares")));
Assert.assertEquals("15", String.valueOf(summaryMap.get("totalPendingForApprovalShares")));
@@ -708,7 +708,7 @@ public class ShareAccountIntegrationTests {
Assert.fail("Other Charge defintion found");
}
}
summaryMap = (Map<String, Object>) shareAccountData.get("summary");
Assert.assertEquals("45", String.valueOf(summaryMap.get("totalApprovedShares")));
Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares")));
@@ -770,7 +770,7 @@ public class ShareAccountIntegrationTests {
Assert.fail("Other Charge defintion found");
}
}
summaryMap = (Map<String, Object>) shareAccountData.get("summary");
Assert.assertEquals("45", String.valueOf(summaryMap.get("totalApprovedShares")));
Assert.assertEquals("20", String.valueOf(summaryMap.get("totalPendingForApprovalShares")));
@@ -832,7 +832,7 @@ public class ShareAccountIntegrationTests {
Assert.fail("Other Charge defintion found");
}
}
summaryMap = (Map<String, Object>) shareAccountData.get("summary");
Assert.assertEquals("45", String.valueOf(summaryMap.get("totalApprovedShares")));
Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares")));
@@ -912,7 +912,7 @@ public class ShareAccountIntegrationTests {
summaryMap = (Map<String, Object>) shareAccountData.get("summary");
Assert.assertEquals("30", String.valueOf(summaryMap.get("totalApprovedShares")));
Assert.assertEquals("0", String.valueOf(summaryMap.get("totalPendingForApprovalShares")));
//Close Share Account
Map<String, Object> closeAccountMap = new HashMap<>();
closeAccountMap.put("note", "Share Account Close Note");
@@ -31,25 +31,25 @@ public class ShareDividendsTransactionHelper {
private static final String SHARE_PRODUCT_URL = "/fineract-provider/api/v1/shareproduct";
private static final String DIVIDEND = "dividend" ;
public static Integer createShareProductDividends(final Integer productId, final String dividendJson, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
String url = SHARE_PRODUCT_URL + "/" + productId + "/" + DIVIDEND + "?" + Utils.TENANT_IDENTIFIER ;
return Utils.performServerPost(requestSpec, responseSpec, url, dividendJson, "subResourceId");
}
public static Integer postCommand(final String command, final Integer productId, final Integer dividendId, String jsonBody, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
String url = SHARE_PRODUCT_URL + "/" + productId + "/"+DIVIDEND + "/"+ dividendId + "?command=" + command + "&" + Utils.TENANT_IDENTIFIER;
return Utils.performServerPut(requestSpec, responseSpec, url, jsonBody, "resourceId");
}
public static Map<String, Object> retrieveDividendDetails(final Integer productId, final Integer dividendId, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
String url = SHARE_PRODUCT_URL + "/" + productId + "/"+DIVIDEND + "/"+ dividendId +"?" + Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, url, "");
}
public static Map<String, Object> retrieveAllDividends(final Integer productId, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
String url = SHARE_PRODUCT_URL + "/" + productId + "/"+DIVIDEND +"?" + Utils.TENANT_IDENTIFIER;
@@ -34,14 +34,14 @@ import java.util.Map;
public class ShareProductHelper {
private static final String NONE = "1";
private static final String CASH_BASED = "2";
private static final String LOCALE = "en_GB";
private static final String DIGITS_AFTER_DECIMAL = "4";
private static final String IN_MULTIPLES_OF = "0";
private static final String USD = "USD";
private String productName = Utils.randomNameGenerator("SHARE_PRODUCT_", 6);
private String shortName = Utils.randomNameGenerator("", 4);
private String description = Utils.randomNameGenerator("", 20);
@@ -56,14 +56,14 @@ public class ShareProductHelper {
private String lockinPeriodFrequency = "1";
private String lockinPeriodFrequencyType = "0";
private String accountingRule = NONE;
String minimumActivePeriodForDividends = "1";
String minimumactiveperiodFrequencyType = "0";
private List<Map<String, String>> charges = null ;
private List<Map<String, String>> marketPrices = null ;
public String build() {
final HashMap<String, Object> map = new HashMap<>();
map.put("name", this.productName);
@@ -85,25 +85,25 @@ public class ShareProductHelper {
map.put("minimumactiveperiodFrequencyType", this.minimumactiveperiodFrequencyType) ;
map.put("lockinPeriodFrequency", this.lockinPeriodFrequency) ;
map.put("lockinPeriodFrequencyType", this.lockinPeriodFrequencyType) ;
if(charges != null) {
map.put("chargesSelected", charges) ;
}
if(marketPrices != null) {
map.put("marketPricePeriods", marketPrices) ;
}
String shareProductCreateJson = new Gson().toJson(map);
System.out.println(shareProductCreateJson);
return shareProductCreateJson;
}
public ShareProductHelper withCashBasedAccounting() {
this.accountingRule = CASH_BASED ;
return this ;
}
public ShareProductHelper withMarketPrice() {
this.marketPrices = new ArrayList<>() ;
LocalDate currentDate = DateUtils.getLocalDateOfTenant() ;
@@ -118,7 +118,7 @@ public class ShareProductHelper {
}
return this ;
}
public ShareProductHelper withCharges(final ArrayList<Long> charges) {
if(charges != null && !charges.isEmpty()) {
this.charges = new ArrayList<>() ;
@@ -137,62 +137,62 @@ public class ShareProductHelper {
Assert.assertEquals(this.productName, productName);
String shortName = (String)shareProductData.get("shortName") ;
Assert.assertEquals(this.shortName, shortName);
String description = (String)shareProductData.get("description") ;
Assert.assertEquals(this.description, description);
Map<String, String> currency = (Map<String,String>)shareProductData.get("currency") ;
String currencyCode = currency.get("code") ;
Assert.assertEquals(this.currencyCode, currencyCode);
String digitsAfterDecimal = String.valueOf(currency.get("decimalPlaces")) ;
Assert.assertEquals(DIGITS_AFTER_DECIMAL, digitsAfterDecimal);
String inMultiplesOf = String.valueOf(currency.get("inMultiplesOf")) ;
Assert.assertEquals(IN_MULTIPLES_OF, inMultiplesOf);
String totalShares = String.valueOf(shareProductData.get("totalShares")) ;
Assert.assertEquals(this.totalShares, totalShares);
String sharesIssued = String.valueOf(shareProductData.get("totalSharesIssued")) ;
Assert.assertEquals(this.sharesIssued, sharesIssued);
String unitPrice = String.valueOf(shareProductData.get("unitPrice")) ;
Assert.assertEquals(this.unitPrice, unitPrice);
String minimumShares = String.valueOf(shareProductData.get("minimumShares")) ;
Assert.assertEquals(this.minimumShares, minimumShares);
String nominalShares = String.valueOf(shareProductData.get("nominalShares")) ;
Assert.assertEquals(this.nominalShares, nominalShares);
String maximumShares = String.valueOf(shareProductData.get("maximumShares")) ;
Assert.assertEquals(this.maximumShares, maximumShares);
String allowDividendCalculationForInactiveClients = String.valueOf(shareProductData.get("allowDividendCalculationForInactiveClients")) ;
Assert.assertEquals(this.allowDividendCalculationForInactiveClients, allowDividendCalculationForInactiveClients);
Map<String, Object> accountingRuleMap = (Map<String, Object>) shareProductData.get("accountingRule") ;
String accountingRule = String.valueOf(accountingRuleMap.get("id")) ;
Assert.assertEquals(this.accountingRule, accountingRule);
String minimumActivePeriodForDividends = String.valueOf(shareProductData.get("minimumActivePeriod")) ;
Assert.assertEquals(this.minimumActivePeriodForDividends, minimumActivePeriodForDividends);
Map<String, Object> minimumActivePeriodType = (Map<String, Object>) shareProductData.get("minimumActivePeriodForDividendsTypeEnum") ;
String minimumactiveperiodFrequencyType = String.valueOf(minimumActivePeriodType.get("id")) ;
Assert.assertEquals(this.minimumactiveperiodFrequencyType, minimumactiveperiodFrequencyType);
String lockinPeriodFrequency = String.valueOf(shareProductData.get("lockinPeriod")) ;
Assert.assertEquals(this.lockinPeriodFrequency, lockinPeriodFrequency);
Map<String, Object> lockinPeriodType = (Map<String, Object>) shareProductData.get("lockPeriodTypeEnum") ;
String lockinPeriodFrequencyType = String.valueOf(lockinPeriodType.get("id")) ;
Assert.assertEquals(this.lockinPeriodFrequencyType, lockinPeriodFrequencyType);
//ArrayList<Map<String, String>> charges = (ArrayList<Map<String, String>>)shareProductData.get("chargesSelected") ;
// ArrayList<Map<String, String>> marketPrices = (ArrayList<Map<String, String>>)shareProductData.get("marketPricePeriods") ;
}
}
@@ -30,18 +30,18 @@ public class ShareProductTransactionHelper {
private static final String SHARE_PRODUCT_URL = "/fineract-provider/api/v1/products/share";
private static final String CREATE_SHARE_PRODUCT_URL = SHARE_PRODUCT_URL + "?" + Utils.TENANT_IDENTIFIER;
public static Integer createShareProduct(final String savingsProductJSON, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
return Utils.performServerPost(requestSpec, responseSpec, CREATE_SHARE_PRODUCT_URL, savingsProductJSON, "resourceId");
}
public static Map<String, Object> retrieveShareProduct(final Integer shareProductId, final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
String url = SHARE_PRODUCT_URL+"/"+shareProductId+"?"+Utils.TENANT_IDENTIFIER ;
return Utils.performServerGet(requestSpec, responseSpec, url, "");
}
public static Integer updateShareProduct(final Integer shareProductId, final String provsioningCriteriaJson,
final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
@@ -84,7 +84,7 @@ public class AccountNumberPreferencesHelper {
requestJSON, jsonAttributeToGetBack);
}
public Object createGroupsAccountNumberPreference(
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
System.out
@@ -99,7 +99,7 @@ public class AccountNumberPreferencesHelper {
requestJSON, jsonAttributeToGetBack);
}
public Object createCenterAccountNumberPreference(
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
System.out
@@ -200,13 +200,13 @@ public class AccountNumberPreferencesHelper {
+ Utils.TENANT_IDENTIFIER;
Utils.performServerGet(requestSpec, responseSpec, savingsURL, "id");
final String groupsURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ groupsAccountNumberPreferenceId + "?"
+ Utils.TENANT_IDENTIFIER;
Utils.performServerGet(requestSpec, responseSpec, groupsURL, "id");
final String centerURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
+ centerAccountNumberPreferenceId + "?"
+ Utils.TENANT_IDENTIFIER;
@@ -57,7 +57,7 @@ public class AccountNumberPreferencesTestBuilder {
return new Gson().toJson(map);
}
public String groupsBuild() {
final HashMap<String, Object> map = new HashMap<>();
map.put("accountType", groupsAccountType);
@@ -73,7 +73,7 @@ public class AccountNumberPreferencesTestBuilder {
return new Gson().toJson(map);
}
public String invalidDataBuild(String accountType, String prefixType) {
final HashMap<String, Object> map = new HashMap<>();
map.put("accountType", accountType);
@@ -107,7 +107,7 @@ public class CodeHelper {
codeValueId = (Integer) CodeHelper.createCodeValue(requestSpec,
responseSpec, codeId, codeValue, codeValuePosition,
"subResourceId");
} else {
return codeValuesList.get(0);
}
@@ -115,7 +115,7 @@ public class CodeHelper {
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "/"
+ codeValueId.toString() + "?"
+ Utils.TENANT_IDENTIFIER, "");
}
public static ArrayList<HashMap<String, Object>> getAllCodes(
@@ -201,7 +201,7 @@ public class CodeHelper {
return Utils.performServerGet(requestSpec, responseSpec,
CODE_VALUE_URL.replace("[codeId]", codeId.toString()) + "?"
+ Utils.TENANT_IDENTIFIER, jsonAttributeToGetback);
}
public static Object getCodeValueById(
@@ -504,7 +504,7 @@ public class GuarantorTest {
Float externalBalance = new Float(10000);
Float selfguarantee = new Float(6000);
Float externalguarantee = new Float(7000);
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
String.valueOf(selfBalance));
final Integer externalSavigsId_1 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
@@ -562,7 +562,7 @@ public class GuarantorTest {
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testGuarantor_WRITE_OFF_LOAN() {
@@ -79,7 +79,7 @@ public class GuarantorTestBuilder {
this.guarantorTypeId = GUARANTOR_TYPE_CUSTOMER;
return this;
}
public GuarantorTestBuilder externalCustomer() {
this.guarantorTypeId = GUARANTOR_TYPE_EXTERNAL;
return this;
@@ -51,7 +51,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
.withAccounting(accountingRule, accounts).build(null);
return loanProductJSON ;
}
public static String createLoanProductWithVaribleConfig(final boolean multiDisburseLoan, final String accountingRule, final Account... accounts) {
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder() //
@@ -69,7 +69,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
.withAccounting(accountingRule, accounts).build(null);
return loanProductJSON ;
}
public static String createLoanProductWithVaribleConfigwithEqualPrincipal(final boolean multiDisburseLoan, final String accountingRule, final Account... accounts) {
System.out.println("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
final String loanProductJSON = new LoanProductTestBuilder() //
@@ -87,7 +87,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
.withAccounting(accountingRule, accounts).build(null);
return loanProductJSON ;
}
public static String applyForLoanApplication(final Integer clientID, final Integer loanProductID, List<HashMap> charges,
final String savingsId, String principal) {
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
@@ -107,7 +107,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
.withCharges(charges).build(clientID.toString(), loanProductID.toString(), savingsId);
return loanApplicationJSON ;
}
public static String applyForLoanApplicationWithEqualPrincipal(final Integer clientID, final Integer loanProductID, List<HashMap> charges,
final String savingsId, String principal) {
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
@@ -127,7 +127,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
.withCharges(charges).build(clientID.toString(), loanProductID.toString(), savingsId);
return loanApplicationJSON ;
}
public static String createDeleteVariations(ArrayList<Map> deletedInstallments) {
Map<String, Object> toReturn = new HashMap<>();
toReturn.put("locale", "en");
@@ -180,7 +180,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
String json = new Gson().toJson(toReturn);
return json;
}
private static ArrayList createNewInstallments(String date) {
ArrayList toReturn = new ArrayList<>();
Map tosend = new HashMap();
@@ -189,7 +189,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
toReturn.add(tosend);
return toReturn;
}
private static ArrayList createModifyMap(Map firstSchedule) {
ArrayList toReturn = new ArrayList<>();
ArrayList dueDate = (ArrayList) firstSchedule.get("dueDate");
@@ -199,7 +199,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
toReturn.add(tosend);
return toReturn;
}
public static String createAllVariations() {
Map<String, Object> toReturn = new HashMap<>();
toReturn.put("locale", "en");
@@ -212,7 +212,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
String json = new Gson().toJson(toReturn);
return json;
}
public static String createAllVariationsWithEqualPrincipal() {
Map<String, Object> toReturn = new HashMap<>();
toReturn.put("locale", "en");
@@ -225,7 +225,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
String json = new Gson().toJson(toReturn);
return json;
}
private static ArrayList createNewInstallmentsWithPrincipal(String date) {
ArrayList toReturn = new ArrayList<>();
Map tosend = new HashMap();
@@ -234,7 +234,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
toReturn.add(tosend);
return toReturn;
}
private static ArrayList createModifyMapWithPrinciapl(String date) {
ArrayList toReturn = new ArrayList<>();
Map tosend = new HashMap();
@@ -250,7 +250,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
toReturn.add(tosend);
return toReturn;
}
private static ArrayList createModifyMap(String date) {
ArrayList toReturn = new ArrayList<>();
Map tosend = new HashMap();
@@ -259,7 +259,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
toReturn.add(tosend);
return toReturn;
}
public static String createModifiyDateVariations(String[] date, String[] newdate, String[] principal) {
Map<String, Object> toReturn = new HashMap<>();
toReturn.put("locale", "en");
@@ -270,7 +270,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
String json = new Gson().toJson(toReturn);
return json;
}
private static ArrayList createDateModifyMap(String[] date, String[] newdate, String[] installments) {
ArrayList toReturn = new ArrayList<>();
for(int i = 0 ; i < date.length; i++) {
@@ -280,7 +280,7 @@ public class VariableInstallmentsDecliningBalanceHelper {
if(i < installments.length) {
tosend.put("installmentAmount", installments[i]) ;
}
toReturn.add(tosend);
toReturn.add(tosend);
}
return toReturn;
}
@@ -44,7 +44,7 @@ public class VariableInstallmentsFlatHelper {
.withRepaymentAfterEvery("1") //
.withRepaymentTypeAsMonth() //
.withinterestRatePerPeriod("1") //
.withAmortizationTypeAsEqualPrincipalPayment()
.withAmortizationTypeAsEqualPrincipalPayment()
.withInterestTypeAsFlat() //
.withTranches(multiDisburseLoan) //
.withInterestCalculationPeriodTypeAsRepaymentPeriod(true)//
@@ -52,9 +52,9 @@ public class VariableInstallmentsFlatHelper {
.withAccounting(accountingRule, accounts).build(null);
return loanProductJSON ;
}
public static String applyForLoanApplication(final Integer clientID, final Integer loanProductID, List<HashMap> charges,
final String savingsId, String principal) {
System.out.println("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
@@ -74,7 +74,7 @@ public class VariableInstallmentsFlatHelper {
.withCharges(charges).build(clientID.toString(), loanProductID.toString(), savingsId);
return loanApplicationJSON ;
}
public static String createDeleteVariations(ArrayList<Map> deletedInstallments) {
Map<String, Object> toReturn = new HashMap<>();
toReturn.put("locale", "en");
@@ -127,7 +127,7 @@ public class VariableInstallmentsFlatHelper {
String json = new Gson().toJson(toReturn);
return json;
}
private static ArrayList createNewInstallments(String date) {
ArrayList toReturn = new ArrayList<>();
Map tosend = new HashMap();
@@ -136,7 +136,7 @@ public class VariableInstallmentsFlatHelper {
toReturn.add(tosend);
return toReturn;
}
public static String createModifiyDateVariations(String[] date, String[] newdate, String[] principal) {
Map<String, Object> toReturn = new HashMap<>();
toReturn.put("locale", "en");
@@ -147,7 +147,7 @@ public class VariableInstallmentsFlatHelper {
String json = new Gson().toJson(toReturn);
return json;
}
private static ArrayList createDateModifyMap(String[] date, String[] newdate, String[] principal) {
ArrayList toReturn = new ArrayList<>();
for(int i = 0 ; i < date.length; i++) {
@@ -157,12 +157,12 @@ public class VariableInstallmentsFlatHelper {
if(i < principal.length) {
tosend.put("principal", principal[i]) ;
}
toReturn.add(tosend);
toReturn.add(tosend);
}
return toReturn;
}
private static ArrayList createModifyMap(Map firstSchedule) {
ArrayList toReturn = new ArrayList<>();
ArrayList dueDate = (ArrayList) firstSchedule.get("dueDate");
@@ -172,7 +172,7 @@ public class VariableInstallmentsFlatHelper {
toReturn.add(tosend);
return toReturn;
}
public static String createAllVariations() {
Map<String, Object> toReturn = new HashMap<>();
toReturn.put("locale", "en");
@@ -185,7 +185,7 @@ public class VariableInstallmentsFlatHelper {
String json = new Gson().toJson(toReturn);
return json;
}
private static ArrayList createDeletedMap(String date) {
ArrayList toReturn = new ArrayList<>();
Map tosend = new HashMap();
@@ -193,7 +193,7 @@ public class VariableInstallmentsFlatHelper {
toReturn.add(tosend);
return toReturn;
}
private static ArrayList createModifyMap(String date) {
ArrayList toReturn = new ArrayList<>();
Map tosend = new HashMap();
@@ -202,7 +202,7 @@ public class VariableInstallmentsFlatHelper {
toReturn.add(tosend);
return toReturn;
}
public static String formatDate(ArrayList list) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, (int) list.get(0));
@@ -39,12 +39,12 @@ import com.jayway.restassured.specification.ResponseSpecification;
@SuppressWarnings({"rawtypes", "unchecked"})
public class VariableInstallmentsIntegrationTest {
private static final String NONE = "1";
private RequestSpecification requestSpec;
private ResponseSpecification responseSpec;
private LoanTransactionHelper loanTransactionHelper;
@Before
public void setup() {
Utils.initializeRESTAssured();
@@ -53,7 +53,7 @@ public class VariableInstallmentsIntegrationTest {
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
}
@Test
public void testVariableLoanProductCreation() {
final String json = VariableInstallmentsDecliningBalanceHelper.createLoanProductWithVaribleConfig(false, NONE);
@@ -64,8 +64,8 @@ public class VariableInstallmentsIntegrationTest {
Assert.assertEquals(new Integer(5), loanProduct.get("minimumGap")) ;
Assert.assertEquals(new Integer(90), loanProduct.get("maximumGap")) ;
}
@Test
public void testLoanProductCreation() {
final String josn = VariableInstallmentsDecliningBalanceHelper.createLoanProductWithoutVaribleConfig(false, NONE);
@@ -74,7 +74,7 @@ public class VariableInstallmentsIntegrationTest {
Map loanProduct = (Map)loanTransactionHelper.getLoanProductDetail(requestSpec, responseSpec, loanProductID, "") ;
Assert.assertTrue(!(Boolean)loanProduct.get("allowVariableInstallments")) ;
}
@Test
public void testDeleteInstallmentsWithDecliningBalanceEqualInstallments() {
VariableIntallmentsTransactionHelper transactionHelper = new VariableIntallmentsTransactionHelper(requestSpec, responseSpec) ;
@@ -95,7 +95,7 @@ public class VariableInstallmentsIntegrationTest {
String toDeletedata = VariableInstallmentsDecliningBalanceHelper.createDeleteVariations(toDelete) ;
HashMap modifiedReschdule = transactionHelper.validateVariations(toDeletedata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 November 2011", "20 December 2011", "20 January 2012"},
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 November 2011", "20 December 2011", "20 January 2012"},
new String[] {"34675.47", "34675.47", "36756.26"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(toDeletedata, loanID) ;
@@ -104,7 +104,7 @@ public class VariableInstallmentsIntegrationTest {
periods = (ArrayList)repaymentSchedule.get("periods") ;
periods.remove(0) ; //Repayments Schedule includes disbursement also. So remove this.
assertAfterSubmit(periods, toVerifyData) ;
}
private void assertAfterSubmit(ArrayList<Map> serverData, ArrayList<Map> expectedData) {
Assert.assertTrue(serverData.size() == expectedData.size()) ;
@@ -115,7 +115,7 @@ public class VariableInstallmentsIntegrationTest {
Assert.assertTrue(serverMap.get("totalOutstandingForPeriod").toString().equals(expectedMap.get("installmentAmount"))) ;
}
}
@Test
public void testAddInstallmentsWithDecliningBalanceEqualInstallments() {
//31 October 2011 - 5000
@@ -136,7 +136,7 @@ public class VariableInstallmentsIntegrationTest {
String addVariationsjsondata = VariableInstallmentsDecliningBalanceHelper.createAddVariations() ;
HashMap modifiedReschdule = transactionHelper.validateVariations(addVariationsjsondata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 October 2011", "31 October 2011", "20 November 2011", "20 December 2011", "20 January 2012"},
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 October 2011", "31 October 2011", "20 November 2011", "20 December 2011", "20 January 2012"},
new String[] {"21215.84", "5000.0", "26477.31", "26477.31", "25947.7"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(addVariationsjsondata, loanID) ;
@@ -146,7 +146,7 @@ public class VariableInstallmentsIntegrationTest {
periods.remove(0) ; //Repayments Schedule includes disbursement also. So remove this.
assertAfterSubmit(periods, toVerifyData) ;
}
@Test
public void testModifyInstallmentWithDecliningBalanceEqualInstallments() {
//20 October 2011 - 30000 modify
@@ -164,10 +164,10 @@ public class VariableInstallmentsIntegrationTest {
Map list = transactionHelper.retrieveSchedule(loanID) ;
Map repaymentSchedule = (Map)list.get("repaymentSchedule") ;
ArrayList periods = (ArrayList)repaymentSchedule.get("periods") ;
String addVariationsjsondata = VariableInstallmentsDecliningBalanceHelper.createModifiyVariations((Map)periods.get(1)) ; //0th position will have disbursement
String addVariationsjsondata = VariableInstallmentsDecliningBalanceHelper.createModifiyVariations((Map)periods.get(1)) ; //0th position will have disbursement
HashMap modifiedReschdule = transactionHelper.validateVariations(addVariationsjsondata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "20 December 2011", "20 January 2012"},
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "20 December 2011", "20 January 2012"},
new String[] {"30000.0", "24966.34", "24966.34", "24966.33"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(addVariationsjsondata, loanID) ;
@@ -176,13 +176,13 @@ public class VariableInstallmentsIntegrationTest {
periods = (ArrayList)repaymentSchedule.get("periods") ;
periods.remove(0) ; //Repayments Schedule includes disbursement also. So remove this.
assertAfterSubmit(periods, toVerifyData) ;
}
@Test
public void testAllVariationsDecliningBalancewithEqualInstallments() {
// Request: Delete 20 December 2011 26,262.38, Modify 20 November 2011 from 26,262.38 to 30000, Add 25 December 2011 5000
// Result: 20 October 2011 - 26262.38, 20 November 2011 - 30000, 25 December 2011 - 5000, 20 January 2012 - 44077
// Result: 20 October 2011 - 26262.38, 20 November 2011 - 30000, 25 December 2011 - 5000, 20 January 2012 - 44077
VariableIntallmentsTransactionHelper transactionHelper = new VariableIntallmentsTransactionHelper(requestSpec, responseSpec) ;
final String loanProductJson = VariableInstallmentsDecliningBalanceHelper.createLoanProductWithVaribleConfig(false, NONE);
Integer loanProductID = this.loanTransactionHelper.getLoanProductId(loanProductJson);
@@ -196,11 +196,11 @@ public class VariableInstallmentsIntegrationTest {
Map list = transactionHelper.retrieveSchedule(loanID) ;
Map repaymentSchedule = (Map)list.get("repaymentSchedule") ;
ArrayList periods = (ArrayList)repaymentSchedule.get("periods") ;
String addVariationsjsondata = VariableInstallmentsDecliningBalanceHelper.createAllVariations() ; //0th position will have disbursement
String addVariationsjsondata = VariableInstallmentsDecliningBalanceHelper.createAllVariations() ; //0th position will have disbursement
HashMap modifiedReschdule = transactionHelper.validateVariations(addVariationsjsondata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "25 December 2011", "20 January 2012"},
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "25 December 2011", "20 January 2012"},
new String[] {"26262.38", "30000.0", "5000.0", "44077.0"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(addVariationsjsondata, loanID) ;
@@ -210,11 +210,11 @@ public class VariableInstallmentsIntegrationTest {
periods.remove(0) ; //Repayments Schedule includes disbursement also. So remove this.
assertAfterSubmit(periods, toVerifyData) ;
}
@Test
public void testAllVariationsDecliningBalancewithEqualPrincipal() {
// Request: Delete 20 December 2011 26,262.38, Modify 20 November 2011 from 26,262.38 to 30000, Add 25 December 2011 5000
// Result: 20 October 2011 - 27000.0, 20 November 2011 - 31500.0, 25 December 2011 - 6045.16, 20 January 2012 - 40670.97
// Result: 20 October 2011 - 27000.0, 20 November 2011 - 31500.0, 25 December 2011 - 6045.16, 20 January 2012 - 40670.97
VariableIntallmentsTransactionHelper transactionHelper = new VariableIntallmentsTransactionHelper(requestSpec, responseSpec) ;
final String loanProductJson = VariableInstallmentsDecliningBalanceHelper.createLoanProductWithVaribleConfigwithEqualPrincipal(false, NONE);
Integer loanProductID = this.loanTransactionHelper.getLoanProductId(loanProductJson);
@@ -228,11 +228,11 @@ public class VariableInstallmentsIntegrationTest {
Map list = transactionHelper.retrieveSchedule(loanID) ;
Map repaymentSchedule = (Map)list.get("repaymentSchedule") ;
ArrayList periods = (ArrayList)repaymentSchedule.get("periods") ;
String addVariationsjsondata = VariableInstallmentsDecliningBalanceHelper.createAllVariationsWithEqualPrincipal() ; //0th position will have disbursement
String addVariationsjsondata = VariableInstallmentsDecliningBalanceHelper.createAllVariationsWithEqualPrincipal() ; //0th position will have disbursement
HashMap modifiedReschdule = transactionHelper.validateVariations(addVariationsjsondata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "25 December 2011", "20 January 2012"},
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "25 December 2011", "20 January 2012"},
new String[] {"27000.0", "31500.0", "6045.16", "40670.97"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(addVariationsjsondata, loanID) ;
@@ -242,7 +242,7 @@ public class VariableInstallmentsIntegrationTest {
periods.remove(0) ; //Repayments Schedule includes disbursement also. So remove this.
assertAfterSubmit(periods, toVerifyData) ;
}
@Test
public void testModifyDatesWithDecliningBalanceEqualInstallments() {
//Modify 20 December 2011:25000 -> 04 January 2012:20000
@@ -258,18 +258,18 @@ public class VariableInstallmentsIntegrationTest {
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
//Integer loanID = 57 ;
Map list = transactionHelper.retrieveSchedule(loanID) ;
Map repaymentSchedule = (Map)list.get("repaymentSchedule") ;
ArrayList periods = (ArrayList)repaymentSchedule.get("periods") ;
//
//
String addVariationsjsondata = VariableInstallmentsDecliningBalanceHelper.createModifiyDateVariations(new String[]{"20 December 2011", "20 January 2012"}, new String[]{"04 January 2012", "08 February 2012"}, new String[]{"20000"}) ; //0th position will have disbursement
String addVariationsjsondata = VariableInstallmentsDecliningBalanceHelper.createModifiyDateVariations(new String[]{"20 December 2011", "20 January 2012"}, new String[]{"04 January 2012", "08 February 2012"}, new String[]{"20000"}) ; //0th position will have disbursement
HashMap modifiedReschdule = transactionHelper.validateVariations(addVariationsjsondata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "04 January 2012", "08 February 2012"},
ArrayList toVerifyData = VariableInstallmentsDecliningBalanceHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "04 January 2012", "08 February 2012"},
new String[] {"26262.38", "26262.38", "20000.0", "33242.97"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(addVariationsjsondata, loanID) ;
list = transactionHelper.retrieveSchedule(loanID) ;
repaymentSchedule = (Map)list.get("repaymentSchedule") ;
@@ -277,7 +277,7 @@ public class VariableInstallmentsIntegrationTest {
periods.remove(0) ; //Repayments Schedule includes disbursement also. So remove this.
assertAfterSubmit(periods, toVerifyData) ;
}
// Interest Type is FLAT
@Test
public void testDeleteInstallmentsWithInterestTypeFlat() {
@@ -298,7 +298,7 @@ public class VariableInstallmentsIntegrationTest {
String toDeletedata = VariableInstallmentsFlatHelper.createDeleteVariations(toDelete) ;
HashMap modifiedReschdule = transactionHelper.validateVariations(toDeletedata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsFlatHelper.constructVerifyData(new String[] {"20 November 2011", "20 December 2011", "20 January 2012"},
ArrayList toVerifyData = VariableInstallmentsFlatHelper.constructVerifyData(new String[] {"20 November 2011", "20 December 2011", "20 January 2012"},
new String[] {"36000.0", "36000.0", "36000.0"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(toDeletedata, loanID) ;
@@ -308,7 +308,7 @@ public class VariableInstallmentsIntegrationTest {
periods.remove(0) ; //Repayments Schedule includes disbursement also. So remove this.
assertAfterSubmit(periods, toVerifyData) ;
}
@Test
public void testAddInstallmentsWithInterestTypeFlat() {
//31 October 2011 - 5000
@@ -329,7 +329,7 @@ public class VariableInstallmentsIntegrationTest {
String addVariationsjsondata = VariableInstallmentsFlatHelper.createAddVariations() ;
HashMap modifiedReschdule = transactionHelper.validateVariations(addVariationsjsondata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsFlatHelper.constructVerifyData(new String[] {"20 October 2011", "31 October 2011", "20 November 2011", "20 December 2011", "20 January 2012"},
ArrayList toVerifyData = VariableInstallmentsFlatHelper.constructVerifyData(new String[] {"20 October 2011", "31 October 2011", "20 November 2011", "20 December 2011", "20 January 2012"},
new String[] {"21600.0", "6600.0", "26600.0", "26600.0", "26600.0"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(addVariationsjsondata, loanID) ;
@@ -339,7 +339,7 @@ public class VariableInstallmentsIntegrationTest {
periods.remove(0) ; //Repayments Schedule includes disbursement also. So remove this.
assertAfterSubmit(periods, toVerifyData) ;
}
@Test
public void testModifyInstallmentsWithInterestTypeisFlat() {
//20 October 2011 - 30000 modify
@@ -357,10 +357,10 @@ public class VariableInstallmentsIntegrationTest {
Map list = transactionHelper.retrieveSchedule(loanID) ;
Map repaymentSchedule = (Map)list.get("repaymentSchedule") ;
ArrayList periods = (ArrayList)repaymentSchedule.get("periods") ;
String addVariationsjsondata = VariableInstallmentsFlatHelper.createModifiyVariations((Map)periods.get(1)) ; //0th position will have disbursement
String addVariationsjsondata = VariableInstallmentsFlatHelper.createModifiyVariations((Map)periods.get(1)) ; //0th position will have disbursement
HashMap modifiedReschdule = transactionHelper.validateVariations(addVariationsjsondata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsFlatHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "20 December 2011", "20 January 2012"},
ArrayList toVerifyData = VariableInstallmentsFlatHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "20 December 2011", "20 January 2012"},
new String[] {"32000.0", "25333.33", "25333.33", "25333.34"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(addVariationsjsondata, loanID) ;
@@ -370,11 +370,11 @@ public class VariableInstallmentsIntegrationTest {
periods.remove(0) ; //Repayments Schedule includes disbursement also. So remove this.
assertAfterSubmit(periods, toVerifyData) ;
}
@Test
public void testAllVariationsWithInterestTypeFlat() {
// Request: Delete 20 December 2011 25000.0, Modify 20 November 2011 from 25,000 to 30000, Add 25 December 2011 5000
// Result: 20 October 2011 - 27000.0, 20 November 2011 - 32000.0, 25 December 2011 - 7000.0, 20 January 2012 - 42000.0
// Result: 20 October 2011 - 27000.0, 20 November 2011 - 32000.0, 25 December 2011 - 7000.0, 20 January 2012 - 42000.0
VariableIntallmentsTransactionHelper transactionHelper = new VariableIntallmentsTransactionHelper(requestSpec, responseSpec) ;
final String loanProductJson = VariableInstallmentsFlatHelper.createLoanProductWithVaribleConfig(false, NONE);
Integer loanProductID = this.loanTransactionHelper.getLoanProductId(loanProductJson);
@@ -388,11 +388,11 @@ public class VariableInstallmentsIntegrationTest {
Map list = transactionHelper.retrieveSchedule(loanID) ;
Map repaymentSchedule = (Map)list.get("repaymentSchedule") ;
ArrayList periods = (ArrayList)repaymentSchedule.get("periods") ;
String addVariationsjsondata = VariableInstallmentsFlatHelper.createAllVariations() ; //0th position will have disbursement
String addVariationsjsondata = VariableInstallmentsFlatHelper.createAllVariations() ; //0th position will have disbursement
HashMap modifiedReschdule = transactionHelper.validateVariations(addVariationsjsondata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsFlatHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "25 December 2011", "20 January 2012"},
ArrayList toVerifyData = VariableInstallmentsFlatHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "25 December 2011", "20 January 2012"},
new String[] {"27000.0", "32000.0", "7000.0", "42000.0"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(addVariationsjsondata, loanID) ;
@@ -402,7 +402,7 @@ public class VariableInstallmentsIntegrationTest {
periods.remove(0) ; //Repayments Schedule includes disbursement also. So remove this.
assertAfterSubmit(periods, toVerifyData) ;
}
@Test
public void testModifyDatesWithInterestTypeFlat() {
//Modify 20 December 2011:25000 -> 04 January 2012:20000
@@ -418,18 +418,18 @@ public class VariableInstallmentsIntegrationTest {
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
//Integer loanID = 67 ;
Map list = transactionHelper.retrieveSchedule(loanID) ;
Map repaymentSchedule = (Map)list.get("repaymentSchedule") ;
ArrayList periods = (ArrayList)repaymentSchedule.get("periods") ;
//
//
String addVariationsjsondata = VariableInstallmentsFlatHelper.createModifiyDateVariations(new String[]{"20 December 2011", "20 January 2012"}, new String[]{"04 January 2012", "08 February 2012"}, new String[]{"20000"}) ; //0th position will have disbursement
String addVariationsjsondata = VariableInstallmentsFlatHelper.createModifiyDateVariations(new String[]{"20 December 2011", "20 January 2012"}, new String[]{"04 January 2012", "08 February 2012"}, new String[]{"20000"}) ; //0th position will have disbursement
HashMap modifiedReschdule = transactionHelper.validateVariations(addVariationsjsondata, loanID) ;
ArrayList newperiods = (ArrayList) modifiedReschdule.get("periods") ;
ArrayList toVerifyData = VariableInstallmentsFlatHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "04 January 2012", "08 February 2012"},
ArrayList toVerifyData = VariableInstallmentsFlatHelper.constructVerifyData(new String[] {"20 October 2011", "20 November 2011", "04 January 2012", "08 February 2012"},
new String[] {"27306.45", "27306.45", "22306.45", "32306.46"}) ;
assertAfterSubmit(newperiods, toVerifyData) ;
assertAfterSubmit(newperiods, toVerifyData) ;
transactionHelper.submitVariations(addVariationsjsondata, loanID) ;
list = transactionHelper.retrieveSchedule(loanID) ;
repaymentSchedule = (Map)list.get("repaymentSchedule") ;
@@ -31,27 +31,27 @@ import com.jayway.restassured.specification.ResponseSpecification;
public class VariableIntallmentsTransactionHelper {
private final String URL = "https://localhost:8443/fineract-provider/api/v1/loans/" ;
private final RequestSpecification requestSpec;
private final ResponseSpecification responseSpec;
public VariableIntallmentsTransactionHelper(final RequestSpecification requestSpec,
public VariableIntallmentsTransactionHelper(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
this.requestSpec = requestSpec ;
this.responseSpec = responseSpec ;
}
public Map retrieveSchedule(Integer loanId) {
String url = URL+loanId+"?associations=repaymentSchedule&exclude=guarantors&"+Utils.TENANT_IDENTIFIER ;
return Utils.performServerGet(requestSpec, responseSpec, url, "");
}
public HashMap validateVariations(final String exceptions, Integer loanId) {
String url = URL+loanId+"/schedule?command=calculateLoanSchedule&"+Utils.TENANT_IDENTIFIER ;
return Utils.performServerPost(this.requestSpec, this.responseSpec, url, exceptions, "");
}
public HashMap submitVariations(final String exceptions, Integer loanId) {
String url = URL+loanId+"/schedule?command=addVariations&"+Utils.TENANT_IDENTIFIER ;
return Utils.performServerPost(this.requestSpec, this.responseSpec, url, exceptions, "");
@@ -82,14 +82,14 @@ public class ServerWithMariaDB4jApplication {
if (distResource.exists()) {
openWebBrowser(distURI);
} else if (devResource.exists()) {
openWebBrowser(devURI);
openWebBrowser(devURI);
} else {
logger.error("Cannot open Fineract UI in browser; not found: " + distResource.toString());
}
}
// TODO Tray Icon stuff; dig out my very own old @see https://github.com/mifos/head/tree/hudsonBuild-MIFOS-5157_Launch4j-EXE_NewDist-squash1/server-jetty/src/main/java/org/mifos/server/tray
ApplicationExitUtil.waitForKeyPressToCleanlyExit(ctx);
}
@@ -27,7 +27,7 @@ public class AccrualAccountingConstants {
public static final String accrueTillParamName = "tillDate";
public static final String localeParamName = "locale";
public static final String dateFormatParamName = "dateFormat";
public static final String PERIODIC_ACCRUAL_ACCOUNTING_RESOURCE_NAME = "periodicaccrual";
public static final String PERIODIC_ACCRUAL_ACCOUNTING_EXECUTION_ERROR_CODE = "execution.failed";
}
@@ -26,7 +26,7 @@ import org.joda.time.LocalDate;
/**
* Immutable object representing a General Ledger Account
*
*
* Note: no getter/setters required as google-gson will produce json from fields
* of object.
*/
@@ -41,7 +41,7 @@ public interface AccountingDropdownReadPlatformService {
public Map<String, List<GLAccountData>> retrieveAccountMappingOptionsForCharges();
public Map<String, List<GLAccountData>> retrieveAccountMappingOptions();
public Map<String, List<GLAccountData>> retrieveAccountMappingOptionsForShareProducts();
}
@@ -30,7 +30,7 @@ import java.util.List;
/**
* Immutable object representing a General Ledger Account
*
*
* Note: no getter/setters required as google-gson will produce json from fields
* of object.
*/
@@ -21,7 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
*
*
* when gl account is attached with any product(loan/saving) then we can not
* disable the gl account
*/
@@ -28,7 +28,7 @@ import org.joda.time.LocalDate;
/**
* Class for parsing dates sent as query parameters
*
*
* TODO: Vishwas Should move this class to a more generic package
*/
public class DateParam {
@@ -221,7 +221,7 @@ public class JournalEntriesApiResource {
return this.apiJsonSerializerService.serialize(settings, entries, RESPONSE_DATA_PARAMETERS);
}
@GET
@Path("openingbalance")
@Consumes({ MediaType.APPLICATION_JSON })
@@ -29,7 +29,7 @@ import org.joda.time.LocalDate;
/**
* Immutable object representing a General Ledger Account
*
*
* Note: no getter/setters required as google will produce json from fields of
* object.
*/
@@ -220,7 +220,7 @@ public class JournalEntry extends AbstractAuditableCustom<AppUser, Long> {
return this.entityType;
}
public Long getShareTransactionId() {
return this.shareTransactionId;
}
@@ -37,8 +37,8 @@ public interface JournalEntryRepository extends JpaRepository<JournalEntry, Long
@Query("select DISTINCT j.transactionId from JournalEntry j where j.office.id = :officeId and j.glAccount.id = :contraId and j.reversed=false and j.transactionId not in (select DISTINCT je.reversalJournalEntry.transactionId from JournalEntry je where je.reversed=true)")
List<String> findNonReversedContraTansactionIds(@Param("contraId") Long contraId, @Param("officeId") Long officeId);
@Query("select journalEntry from JournalEntry journalEntry where journalEntry.entityId= :entityId and journalEntry.entityType = :entityType")
@Query("select journalEntry from JournalEntry journalEntry where journalEntry.entityId= :entityId and journalEntry.entityType = :entityType")
List<JournalEntry> findProvisioningJournalEntriesByEntityId(@Param("entityId") Long entityId, @Param("entityType") Integer entityType) ;
@Query("select journalEntry from JournalEntry journalEntry where journalEntry.transactionId= :transactionId and journalEntry.reversed=false and journalEntry.entityType = :entityType")
@@ -29,7 +29,7 @@ import org.springframework.stereotype.Service;
@Service
@CommandType(entity = "JOURNALENTRY", action = "DEFINEOPENINGBALANCE")
public class DefineOpeningBalanceCommandHandler implements NewCommandSourceHandler {
private final JournalEntryWritePlatformService writePlatformService;
@Autowired
@@ -340,10 +340,10 @@ public class AccountingProcessorHelper {
/**
* Convenience method that creates a pair of related Debits and Credits for
* Accrual Based accounting.
*
*
* The target accounts for debits and credits are switched in case of a
* reversal
*
*
* @param office
* @param accountTypeToBeDebited
* Enum of the placeholder GLAccount to be debited
@@ -375,10 +375,10 @@ public class AccountingProcessorHelper {
/**
* Convenience method that creates a pair of related Debits and Credits for
* Accrual Based accounting.
*
*
* The target accounts for debits and credits are switched in case of a
* reversal
*
*
* @param office office
* @param currencyCode currencyCode
* @param accountTypeToBeDebited Enum of the placeholder GLAccount to be debited
@@ -435,10 +435,10 @@ public class AccountingProcessorHelper {
/**
* Convenience method that creates a pair of related Debits and Credits for
* Cash Based accounting.
*
*
* The target accounts for debits and credits are switched in case of a
* reversal
*
*
* @param office
* @param accountTypeToBeDebited
* Enum of the placeholder GLAccount to be debited
@@ -470,10 +470,10 @@ public class AccountingProcessorHelper {
/**
* Convenience method that creates a pair of related Debits and Credits for
* Cash Based accounting.
*
*
* The target accounts for debits and credits are switched in case of a
* reversal
*
*
* @param office
* @param accountTypeToBeDebited
* Enum of the placeholder GLAccount to be debited
@@ -562,10 +562,10 @@ public class AccountingProcessorHelper {
/**
* Convenience method that creates a pair of related Debits and Credits for
* Cash Based accounting.
*
*
* The target accounts for debits and credits are switched in case of a
* reversal
*
*
* @param office
* @param currencyCode
* @param accountTypeToBeDebited Enum of the placeholder GLAccount to be debited
@@ -721,10 +721,10 @@ public class AccountingProcessorHelper {
/**
* Convenience method that creates a pair of related Debits and Credits for
* Cash Based accounting.
*
*
* The target accounts for debits and credits are switched in case of a
* reversal
*
*
* @param office office
* @param currencyCode currencyCode
* @param accountTypeToBeDebited Enum of the placeholder GLAccount to be debited
@@ -1041,7 +1041,7 @@ public class AccountingProcessorHelper {
"Recent Portfolio changes w.r.t Charges for shares have Broken the accounting code",
"Recent Portfolio changes w.r.t Charges for shares have Broken the accounting code"); }
}
private void createDebitJournalEntryForShares(final Office office, final String currencyCode, final GLAccount account,
final Long shareAccountId, final String transactionId, final Date transactionDate, final BigDecimal amount) {
final boolean manualEntry = false;
@@ -102,7 +102,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
/**
* Debit loan Portfolio and credit Fund source for Disbursement.
*
*
* @param loanDTO
* @param loanTransactionDTO
* @param office
@@ -141,20 +141,20 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
}
/**
*
*
* Handles repayments using the following posting rules <br/>
* <br/>
* <br/>
*
*
* <b>Principal Repayment</b>: Debits "Fund Source" and Credits
* "Loan Portfolio"<br/>
*
*
* <b>Interest Repayment</b>:Debits "Fund Source" and and Credits
* "Receivable Interest" <br/>
*
*
* <b>Fee Repayment</b>:Debits "Fund Source" (or "Interest on Loans" in case
* of repayment at disbursement) and and Credits "Receivable Fees" <br/>
*
*
* <b>Penalty Repayment</b>: Debits "Fund Source" and and Credits
* "Receivable Penalties" <br/>
* <br/>
@@ -162,24 +162,24 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
* <br/>
* <b>Principal Write off</b>: Debits "Losses Written Off" and Credits
* "Loan Portfolio"<br/>
*
*
* <b>Interest Write off</b>:Debits "Losses Written off" and and Credits
* "Receivable Interest" <br/>
*
*
* <b>Fee Write off</b>:Debits "Losses Written off" and and Credits
* "Receivable Fees" <br/>
*
*
* <b>Penalty Write off</b>: Debits "Losses Written off" and and Credits
* "Receivable Penalties" <br/>
* <br/>
* <br/>
* In case the loan transaction has been reversed, all debits are turned
* into credits and vice versa
*
*
* @param loanTransactionDTO
* @param loanDTO
* @param office
*
*
*/
private void createJournalEntriesForRepaymentsAndWriteOffs(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO,
final Office office, final boolean writeOff, final boolean isIncomeFromFee) {
@@ -320,7 +320,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
/**
* Create a single Debit to fund source and a single credit to
* "Income from Recovery"
*
*
* In case the loan transaction is a reversal, all debits are turned into
* credits and vice versa
*/
@@ -347,15 +347,15 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
/**
* Recognize the receivable interest <br/>
* Debit "Interest Receivable" and Credit "Income from Interest"
*
*
* <b>Fees:</b> Debit <i>Fees Receivable</i> and credit <i>Income from
* Fees</i> <br/>
*
*
* <b>Penalties:</b> Debit <i>Penalties Receivable</i> and credit <i>Income
* from Penalties</i>
*
*
* Also handles reversals for both fees and payment applications
*
*
* @param loanDTO
* @param loanTransactionDTO
* @param office
@@ -55,7 +55,7 @@ public class CashBasedAccountingProcessorForClientTransactions implements Accoun
/**
* Create a single debit to fund source and multiple credits for the income
* account mapped with each charge this payment pays off
*
*
* In case the loan transaction is a reversal, all debits are turned into
* credits and vice versa
*/
@@ -110,11 +110,11 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
/**
* Debit loan Portfolio and credit Fund source for a Disbursement <br/>
*
*
* All debits are turned into credits and vice versa in case of disbursement
* reversals
*
*
*
*
* @param loanDTO
* @param loanTransactionDTO
* @param office
@@ -150,11 +150,11 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
/**
* Debit loan Portfolio and credit Fund source for a Disbursement <br/>
*
*
* All debits are turned into credits and vice versa in case of disbursement
* reversals
*
*
*
*
* @param loanDTO
* @param loanTransactionDTO
* @param office
@@ -188,7 +188,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
* (loan portfolio for principal repayments, Interest on loans for interest
* repayments, Income from fees for fees payment and Income from penalties
* for penalty payment)
*
*
* In case the loan transaction is a reversal, all debits are turned into
* credits and vice versa
*/
@@ -259,7 +259,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
/**
* Create a single Debit to fund source and a single credit to
* "Income from Recovery"
*
*
* In case the loan transaction is a reversal, all debits are turned into
* credits and vice versa
*/
@@ -287,11 +287,11 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
* Credit loan Portfolio and Debit Suspense Account for a Transfer
* Initiation. A Transfer acceptance would be treated the opposite i.e Debit
* Loan Portfolio and Credit Suspense Account <br/>
*
*
* All debits are turned into credits and vice versa in case of Transfer
* Initiation disbursals
*
*
*
*
* @param loanDTO
* @param loanTransactionDTO
* @param office
@@ -320,7 +320,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
null, loanId, transactionId, transactionDate, principalAmount, isReversal);
}
}
private void createJournalEntriesForRefundForActiveLoan(LoanDTO loanDTO, LoanTransactionDTO loanTransactionDTO, Office office) {
// loan properties
final Long loanProductId = loanDTO.getLoanProductId();
@@ -354,11 +354,11 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
if (feesAmount != null && !(feesAmount.compareTo(BigDecimal.ZERO) == 0)) {
totalDebitAmount = totalDebitAmount.add(feesAmount);
List<ChargePaymentDTO> chargePaymentDTOs = new ArrayList<>();
for(ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getFeePayments()) {
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1)):chargePaymentDTO.getAmount() ));
}
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
@@ -369,12 +369,12 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
if (penaltiesAmount != null && !(penaltiesAmount.compareTo(BigDecimal.ZERO) == 0)) {
totalDebitAmount = totalDebitAmount.add(penaltiesAmount);
List<ChargePaymentDTO> chargePaymentDTOs = new ArrayList<>();
for(ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getPenaltyPayments()) {
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1)):chargePaymentDTO.getAmount() ));
}
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES.getValue(), loanProductId, loanId, transactionId, transactionDate,
penaltiesAmount, !isReversal, chargePaymentDTOs);
@@ -389,6 +389,6 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
/*** create a single debit entry (or reversal) for the entire amount **/
this.helper.createDebitJournalEntryOrReversalForLoan(office, currencyCode, CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE.getValue(), loanProductId,
paymentTypeId, loanId, transactionId, transactionDate, totalDebitAmount, !isReversal);
}
}
@@ -123,13 +123,13 @@ public class CashBasedAccountingProcessorForShares implements AccountingProcesso
transactionId, transactionDate, amount.subtract(chargeAmount));
this.helper.createCreditJournalEntryForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId,
transactionId, transactionDate, amount);
}else{
this.helper.createJournalEntriesForShares(office, currencyCode, CASH_ACCOUNTS_FOR_SHARES.SHARES_SUSPENSE.getValue(),
CASH_ACCOUNTS_FOR_SHARES.SHARES_REFERENCE.getValue(), shareProductId, paymentTypeId, shareAccountId, transactionId,
transactionDate, amount);
}
}
}
@@ -362,7 +362,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
if (searchParameters.isOrderByRequested()) {
sqlBuilder.append(" order by ").append(searchParameters.getOrderBy());
this.columnValidator.validateSqlInjection(sqlBuilder.toString(), searchParameters.getOrderBy());
if (searchParameters.isSortOrderProvided()) {
sqlBuilder.append(' ').append(searchParameters.getSortOrder());
this.columnValidator.validateSqlInjection(sqlBuilder.toString(), searchParameters.getOrderBy());
@@ -65,11 +65,11 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
private final FromJsonHelper fromApiJsonHelper;
private final GLJournalEntryMapper entryMapper = new GLJournalEntryMapper();
// if a limit is not added to the running balance select statements below and the resultset is more than 400,000,
// if a limit is not added to the running balance select statements below and the resultset is more than 400,000,
// the script will eat up all of the server memory
private final String selectRunningBalanceSqlLimit = "limit 0, 10000";
private final String officeRunningBalanceSql = "select je.office_running_balance as runningBalance,je.account_id as accountId from acc_gl_journal_entry je "
+ "inner join (select max(id) as id from acc_gl_journal_entry where office_id=? and entry_date < ? group by account_id,entry_date) je2 "
+ "inner join (select max(entry_date) as date from acc_gl_journal_entry where office_id=? and entry_date < ? group by account_id) je3 "
@@ -39,12 +39,12 @@ public interface JournalEntryWritePlatformService {
void createJournalEntriesForClientTransactions(Map<String, Object> accountingBridgeData);
CommandProcessingResult defineOpeningBalance(JsonCommand command);
public String revertProvisioningJournalEntries(final Date reversalTransactionDate, final Long entityId, final Integer entityType) ;
public String createProvisioningJournalEntries(ProvisioningEntry entry) ;
void createJournalEntriesForShares(Map<String, Object> accountingBridgeData);
void revertShareAccountJournalEntries(final ArrayList<Long> transactionId, final Date transactionDate);
}
@@ -323,7 +323,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
final boolean useDefaultComment = StringUtils.isBlank(reversalComment);
validateCommentForReversal(reversalComment);
//Before reversal validate accounting closure is done for that branch or not.
final Date journalEntriesTransactionDate = journalEntries.get(0).getTransactionDate();
final GLClosure latestGLClosureByBranch = this.glClosureRepository.getLatestGLClosureByBranch(officeId);
@@ -563,7 +563,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
}
}
}
private void validateBusinessRulesForJournalEntries(final JournalEntryCommand command) {
/** check if date of Journal entry is valid ***/
final LocalDate entryLocalDate = command.getTransactionDate();
@@ -48,27 +48,27 @@ import com.google.gson.JsonElement;
/**
* TODO Vishwas find a better approach for validation
*
*
* Currently, validation of the passed in JSON is done before calling save or
* update method on the target resource (in our case the loan Product)
*
*
* However, in the case of a loan product it would be difficult to validate the
* passed in JSON for valid {@link LoanProduct} to {@link GLAccount} mappings
* during update because of the following scenario
*
*
* The accounting rule type may be changed in the update command, so we would
* have to validate if all required account heads for a particular account type
* have been passed in (would be different for CASH and Accrual based). However,
* till we have access to the domain object it would not be possible to detect
* if an accounting rule has actually been changed
*
*
* Hence, method {@link #validateForLoanProductCreate(String)} from this class
* is called separately for validation only if an accounting rule change is
* detected by {@link ProductToGLAccountMappingWritePlatformService}
*
*
* Also, the class is probably named wrong (*FromApiJsonDeserializer) should
* probably be named as (*Validator) instead
*
*
*/
@Component
public final class ProductToGLAccountMappingFromApiJsonDeserializer {
@@ -207,7 +207,7 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), element);
baseDataValidator.reset().parameter(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue())
.value(incomeFromPenaltyId).notNull().integerGreaterThanZero();
final Boolean isDormancyTrackingActive = this.fromApiJsonHelper.extractBooleanNamed(isDormancyTrackingActiveParamName, element);
if(null != isDormancyTrackingActive && isDormancyTrackingActive){
final Long escheatLiabilityId = this.fromApiJsonHelper.extractLongNamed(
@@ -258,17 +258,17 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue(), element);
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_REFERENCE.getValue())
.value(shareReferenceId).notNull().integerGreaterThanZero();
final Long shareSuspenseId = this.fromApiJsonHelper.extractLongNamed(
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue(), element);
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_SUSPENSE.getValue())
.value(shareSuspenseId).notNull().integerGreaterThanZero();
final Long incomeFromFeeAccountId = this.fromApiJsonHelper.extractLongNamed(
SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), element);
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue())
.value(incomeFromFeeAccountId).notNull().integerGreaterThanZero();
final Long shareEquityId = this.fromApiJsonHelper.extractLongNamed(
SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue(), element);
baseDataValidator.reset().parameter(SHARES_PRODUCT_ACCOUNTING_PARAMS.SHARES_EQUITY.getValue())
@@ -212,7 +212,7 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
/**
* Examines and updates each account mapping for given loan product with
* changes passed in from the Json element
*
*
* @param loanProductId
* @param changes
* @param element
@@ -129,7 +129,7 @@ public class ProductToGLAccountMappingHelper {
/**
* Saves the payment type to Fund source mappings for a particular
* product/product type (also populates the changes array if passed in)
*
*
* @param command
* @param element
* @param productId
@@ -156,7 +156,7 @@ public class ProductToGLAccountMappingHelper {
/**
* Saves the Charge to Income / Liability account mappings for a particular
* product/product type (also populates the changes array if passed in)
*
*
* @param command
* @param element
* @param productId
@@ -242,7 +242,7 @@ public class ProductToGLAccountMappingHelper {
* as a part of Jsoncommand)<br/>
* Create new mappings for charges that are passed in as a part of
* the Jsoncommand but not already present
*
*
**/
else {
for (final ProductToGLAccountMapping chargeToIncomeAccountMapping : existingChargeToIncomeAccountMappings) {
@@ -328,7 +328,7 @@ public class ProductToGLAccountMappingHelper {
* as a part of Jsoncommand)<br/>
* Create new mappings for payment types that are passed in as a
* part of the Jsoncommand but not already present
*
*
**/
else {
for (final ProductToGLAccountMapping existingPaymentChannelToFundSourceMapping : existingPaymentChannelToFundSourceMappings) {
@@ -417,7 +417,7 @@ public class ProductToGLAccountMappingHelper {
/**
* Fetches account with a particular Id and throws and Exception it is not
* of the expected Account Category ('ASSET','liability' etc)
*
*
* @param paramName
* @param expectedAccountType
* @param accountId
@@ -41,7 +41,7 @@ public interface ProductToGLAccountMappingReadPlatformService {
public List<ChargeToGLAccountMapper> fetchFeeToIncomeAccountMappingsForSavingsProduct(final Long savingsProductId);
public List<ChargeToGLAccountMapper> fetchPenaltyToIncomeAccountMappingsForSavingsProduct(final Long savingsProductId);
public Map<String, Object> fetchAccountMappingDetailsForShareProduct(final Long productId, final Integer accountingType);
public List<PaymentTypeToGLAccountMapper> fetchPaymentTypeToFundSourceMappingsForShareProduct(final Long productId);
@@ -225,7 +225,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
this.savingsProductToGLAccountMappingHelper.saveSavingsToLiabilityAccountMapping(element,
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), savingProductId,
CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE.getValue());
final Boolean isDormancyTrackingActive = this.fromApiJsonHelper.extractBooleanNamed(isDormancyTrackingActiveParamName, element);
if(null != isDormancyTrackingActive && isDormancyTrackingActive){
this.savingsProductToGLAccountMappingHelper.saveSavingsToLiabilityAccountMapping(element,
@@ -103,7 +103,7 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
createOrmergeProductToAccountMappingChanges(element, paramName, productId, accountTypeId, changes,
GLAccountType.LIABILITY, PortfolioProductType.SAVING);
}
/*** Abstractions for payments channel related to savings products ***/
public void savePaymentChannelToFundSourceMappings(final JsonCommand command, final JsonElement element, final Long productId,
@@ -179,7 +179,7 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
/**
* Examines and updates each account mapping for given loan product with
* changes passed in from the Json element
*
*
* @param savingsProductId
* @param changes
* @param element
@@ -157,7 +157,7 @@ public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMapp
/**
* Examines and updates each account mapping for given loan product with
* changes passed in from the Json element
*
*
* @param sharesProductId
* @param changes
* @param element
@@ -25,11 +25,11 @@ import java.util.Set;
public interface ProvisioningEntriesApiConstants {
public final static String JSON_DATE_PARAM = "date" ;
public final static String JSON_DATEFORMAT_PARAM = "dateFormat" ;
public final static String JSON_LOCALE_PARAM = "locale" ;
public final static String JSON_CREATEJOURNALENTRIES_PARAM = "createjournalentries" ;
public final static String PROVISIONINGENTRY_PARAM = "provisioningentry";
@@ -27,17 +27,17 @@ public class LoanProductProvisioningEntryData {
private final Long officeId;
private final String officeName ;
private final String currencyCode;
private final Long productId;
private final String productName ;
private final Long categoryId;
private final String categoryName ;
private final Long overdueInDays;
private final BigDecimal percentage;
@@ -45,21 +45,21 @@ public class LoanProductProvisioningEntryData {
private final BigDecimal balance;
private final BigDecimal amountreserved ;
private final Long liablityAccount;
private final String liabilityAccountCode ;
private final String liabilityAccountName ;
private final Long expenseAccount;
private final String expenseAccountCode ;
private final String expenseAccountName ;
private final Long criteriaId ;
public LoanProductProvisioningEntryData(final Long historyId, final Long officeId, final String currencyCode, final Long productId,
final Long categoryId, final Long overdueInDays, final BigDecimal percentage, final BigDecimal balance, Long liablityAccount,
Long expenseAccount, final Long criteriaId) {
@@ -85,7 +85,7 @@ public class LoanProductProvisioningEntryData {
}
public LoanProductProvisioningEntryData(final Long historyId, final Long officeId, final String officeName, final String currencyCode, final Long productId,
final String productName, final Long categoryId, final String categoryName, final Long overdueInDays, final BigDecimal amountReserved,
final String productName, final Long categoryId, final String categoryName, final Long overdueInDays, final BigDecimal amountReserved,
Long liablityAccount, String liabilityAccountglCode, String liabilityAccountName, Long expenseAccount, String expenseAccountglCode, String expenseAccountName, final Long criteriaId) {
this.historyId = historyId;
this.officeId = officeId;
@@ -146,7 +146,7 @@ public class LoanProductProvisioningEntryData {
public String getCurrencyCode() {
return this.currencyCode;
}
public Long getCriteriaId() {
return this.criteriaId ;
}
@@ -26,23 +26,23 @@ import java.util.Date;
public class ProvisioningEntryData {
private Long id ;
private Boolean journalEntry ;
private Long createdById ;
private String createdUser ;
Date createdDate ;
Long modifiedById ;
private String modifiedUser ;
private BigDecimal reservedAmount ;
private Collection<LoanProductProvisioningEntryData> provisioningEntries ;
public ProvisioningEntryData(final Long id, final Collection<LoanProductProvisioningEntryData> provisioningEntries) {
this.provisioningEntries = provisioningEntries ;
this.id = id ;
@@ -59,7 +59,7 @@ public class ProvisioningEntryData {
this.createdDate = createdDate ;
this.reservedAmount = totalReservedAmount ;
}
public void setEntries(Collection<LoanProductProvisioningEntryData> provisioningEntries) {
this.provisioningEntries = provisioningEntries ;
}
@@ -67,7 +67,7 @@ public class ProvisioningEntryData {
public Long getId() {
return this.id ;
}
public Date getCreatedDate() {
return this.createdDate ;
}
@@ -100,7 +100,7 @@ public class LoanProductProvisioningEntry extends AbstractPersistableCustom<Long
public void addReservedAmount(BigDecimal value) {
this.reservedAmount = this.reservedAmount.add(value);
}
public Office getOffice() {
return this.office;
}
@@ -43,10 +43,10 @@ public class ProvisioningEntry extends AbstractPersistableCustom<Long> {
@Column(name = "journal_entry_created")
private Boolean isJournalEntryCreated;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "entry", orphanRemoval = true, fetch=FetchType.EAGER)
private Set<LoanProductProvisioningEntry> provisioningEntries = new HashSet<>();
@OneToOne
@JoinColumn(name = "createdby_id")
private AppUser createdBy;
@@ -64,9 +64,9 @@ public class ProvisioningEntry extends AbstractPersistableCustom<Long> {
private Date lastModifiedDate;
protected ProvisioningEntry() {
}
public ProvisioningEntry(AppUser createdBy, Date createdDate, AppUser lastModifiedBy, Date lastModifiedDate, Set<LoanProductProvisioningEntry> provisioningEntries ) {
this.provisioningEntries = provisioningEntries ;
this.createdBy = createdBy ;
@@ -74,22 +74,22 @@ public class ProvisioningEntry extends AbstractPersistableCustom<Long> {
this.lastModifiedBy = lastModifiedBy ;
this.lastModifiedDate = lastModifiedDate ;
}
public void setProvisioningEntries(Collection<LoanProductProvisioningEntry> provisioningEntries) {
if(this.provisioningEntries == null) this.provisioningEntries = new HashSet<>();
if(this.provisioningEntries == null) this.provisioningEntries = new HashSet<>();
this.provisioningEntries.addAll(provisioningEntries) ;
}
public Collection<LoanProductProvisioningEntry> getLoanProductProvisioningEntries() {
return this.provisioningEntries ;
}
public void setJournalEntryCreated(Boolean bool) {
this.isJournalEntryCreated = bool ;
}
public Date getCreatedDate() {
return this.createdDate ;
}
}
@@ -27,10 +27,10 @@ import org.springframework.data.repository.query.Param;
public interface ProvisioningEntryRepository extends JpaRepository<ProvisioningEntry, Long>, JpaSpecificationExecutor<ProvisioningEntry> {
//OPENJPA throws error if we use entry
//OPENJPA throws error if we use entry
@Query("select entry1 from ProvisioningEntry entry1 where entry1.createdDate = :createdDate")
ProvisioningEntry findByProvisioningEntryDate(@Param("createdDate") Date createdDate);
@Query("select entry1 from ProvisioningEntry entry1 where entry1.createdDate = (select max(entry2.createdDate) from ProvisioningEntry entry2 where entry2.isJournalEntryCreated=true)")
ProvisioningEntry findExistingProvisioningEntryWithJournalEntries() ;
}
@@ -32,7 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
public class ReCreateProvisioningEntryRequestCommandHandler implements NewCommandSourceHandler {
private final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService ;
@Autowired
public ReCreateProvisioningEntryRequestCommandHandler(
final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService) {

Some files were not shown because too many files have changed in this diff Show More