increase auto formatting comment line length from 80 to 120

This commit is contained in:
Michael Vorburger
2020-06-23 10:01:12 +02:00
committed by Michael Vorburger ⛑️
parent 9542e35702
commit c529fdf58c
541 changed files with 1995 additions and 3177 deletions
+1 -1
View File
@@ -79,7 +79,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/> <setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/> <setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/> <setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_if_empty"/> <setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_if_empty"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
@@ -112,8 +112,7 @@ public class AccountNumberPreferencesTest {
this.deleteAllAccountNumberPreferences(); this.deleteAllAccountNumberPreferences();
/* /*
* Validate the default account number generation rules for clients, * Validate the default account number generation rules for clients, loans and savings accounts.
* loans and savings accounts.
*/ */
this.validateDefaultAccountNumberGeneration(); this.validateDefaultAccountNumberGeneration();
@@ -121,8 +120,7 @@ public class AccountNumberPreferencesTest {
this.createAccountNumberPreference(); this.createAccountNumberPreference();
/* /*
* Validate account number preference rules apply to Clients,Loans and * Validate account number preference rules apply to Clients,Loans and Saving Accounts
* Saving Accounts
*/ */
this.validateAccountNumberGenerationWithPreferences(); this.validateAccountNumberGenerationWithPreferences();
@@ -130,8 +128,7 @@ public class AccountNumberPreferencesTest {
this.updateAccountNumberPreference(); this.updateAccountNumberPreference();
/* /*
* Validate account number preference rules apply to Clients,Loans and * Validate account number preference rules apply to Clients,Loans and Saving Accounts after Updation
* Saving Accounts after Updation
*/ */
this.validateAccountNumberGenerationWithPreferences(); this.validateAccountNumberGenerationWithPreferences();
@@ -41,10 +41,8 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
/** /**
* Test class for * Test class for {@link org.apache.fineract.batch.command.CommandStrategyProvider}. This tests the response provided by
* {@link org.apache.fineract.batch.command.CommandStrategyProvider}. This tests * commandStrategy by injecting it with a {@code BatchRequest}.
* the response provided by commandStrategy by injecting it with a
* {@code BatchRequest}.
* *
* @author RishabhShukla * @author RishabhShukla
* *
@@ -57,9 +55,8 @@ public class BatchApiTest {
private RequestSpecification requestSpec; private RequestSpecification requestSpec;
/** /**
* Sets up the essential settings for the TEST like contentType, * Sets up the essential settings for the TEST like contentType, expectedStatusCode. It uses the '@BeforeEach'
* expectedStatusCode. It uses the '@BeforeEach' annotation provided by * annotation provided by jUnit.
* jUnit.
*/ */
@BeforeEach @BeforeEach
public void setup() { public void setup() {
@@ -70,9 +67,8 @@ public class BatchApiTest {
} }
/** /**
* Tests for the unimplemented command Strategies by returning 501 status * Tests for the unimplemented command Strategies by returning 501 status code. For a unknownRequest a statusCode
* code. For a unknownRequest a statusCode 501 is returned back with * 501 is returned back with response.
* response.
* *
* @see org.apache.fineract.batch.command.internal.UnknownCommandStrategy * @see org.apache.fineract.batch.command.internal.UnknownCommandStrategy
*/ */
@@ -93,9 +89,8 @@ public class BatchApiTest {
} }
/** /**
* Tests for the successful response for a createClient request from * Tests for the successful response for a createClient request from createClientCommand. A successful response with
* createClientCommand. A successful response with statusCode '200' is * statusCode '200' is returned back.
* returned back.
* *
* @see org.apache.fineract.batch.command.internal.CreateClientCommandStrategy * @see org.apache.fineract.batch.command.internal.CreateClientCommandStrategy
*/ */
@@ -113,10 +108,9 @@ public class BatchApiTest {
} }
/** /**
* Tests for an erroneous response with statusCode '501' if transaction * Tests for an erroneous response with statusCode '501' if transaction fails. If Query Parameter
* fails. If Query Parameter 'enclosingTransaction' is set to 'true' and if * 'enclosingTransaction' is set to 'true' and if one of the request in BatchRequest fails then all transactions are
* one of the request in BatchRequest fails then all transactions are rolled * rolled back.
* back.
* *
* @see org.apache.fineract.batch.command.internal.CreateClientCommandStrategy * @see org.apache.fineract.batch.command.internal.CreateClientCommandStrategy
* @see org.apache.fineract.batch.api.BatchApiResource * @see org.apache.fineract.batch.api.BatchApiResource
@@ -156,9 +150,8 @@ public class BatchApiTest {
} }
/** /**
* Tests that a client information was successfully updated through * Tests that a client information was successfully updated through updateClientCommand. A 'changes' parameter is
* updateClientCommand. A 'changes' parameter is returned in the response * returned in the response after successful update of client information.
* after successful update of client information.
* *
* @see org.apache.fineract.batch.command.internal.UpdateClientCommandStrategy * @see org.apache.fineract.batch.command.internal.UpdateClientCommandStrategy
*/ */
@@ -190,10 +183,8 @@ public class BatchApiTest {
} }
/** /**
* Tests that a ApplyLoanCommand was successfully executed and returned a * Tests that a ApplyLoanCommand was successfully executed and returned a 200(OK) status. It creates a new client
* 200(OK) status. It creates a new client and apply a loan to that client. * and apply a loan to that client. This also verifies the successful resolution of dependencies among two requests.
* This also verifies the successful resolution of dependencies among two
* requests.
* *
* @see org.apache.fineract.batch.command.internal.ApplyLoanCommandStrategy * @see org.apache.fineract.batch.command.internal.ApplyLoanCommandStrategy
*/ */
@@ -240,9 +231,8 @@ public class BatchApiTest {
} }
/** /**
* Tests that a new savings accounts was applied to an existing client and a * Tests that a new savings accounts was applied to an existing client and a 200(OK) status was returned. It first
* 200(OK) status was returned. It first creates a new client and a savings * creates a new client and a savings product, then uses the cliendId and ProductId to apply a savings account.
* product, then uses the cliendId and ProductId to apply a savings account.
* *
* @see org.apache.fineract.batch.command.internal.ApplySavingsCommandStrategy * @see org.apache.fineract.batch.command.internal.ApplySavingsCommandStrategy
*/ */
@@ -282,10 +272,9 @@ public class BatchApiTest {
} }
/** /**
* Tests that a new charge was added to a newly created loan and charges are * Tests that a new charge was added to a newly created loan and charges are Collected properly 200(OK) status was
* Collected properly 200(OK) status was returned for successful responses. * returned for successful responses. It first creates a new client and apply a loan, then creates a new charge for
* It first creates a new client and apply a loan, then creates a new charge * the create loan and then fetches all the applied charges
* 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.CollectChargesCommandStrategy
* @see org.apache.fineract.batch.command.internal.CreateChargeCommandStrategy * @see org.apache.fineract.batch.command.internal.CreateChargeCommandStrategy
@@ -334,10 +323,9 @@ public class BatchApiTest {
} }
/** /**
* Tests that batch repayment for loans is happening properly. Collected * Tests that batch repayment for loans is happening properly. Collected properly 200(OK) status was returned for
* properly 200(OK) status was returned for successful responses. It first * successful responses. It first creates a new loan and then makes two repayments for it and then verifies that
* creates a new loan and then makes two repayments for it and then verifies * 200(OK) is returned for the repayment requests.
* that 200(OK) is returned for the repayment requests.
* *
* @see org.apache.fineract.batch.command.internal.RepayLoanCommandStrategy * @see org.apache.fineract.batch.command.internal.RepayLoanCommandStrategy
*/ */
@@ -398,9 +386,8 @@ public class BatchApiTest {
} }
/** /**
* Test for the successful activation of a pending client using * Test for the successful activation of a pending client using 'ActivateClientCommandStrategy'. A '200' status code
* 'ActivateClientCommandStrategy'. A '200' status code is expected on * is expected on successful activation.
* successful activation.
* *
* @see org.apache.fineract.batch.command.internal.ActivateClientCommandStrategy * @see org.apache.fineract.batch.command.internal.ActivateClientCommandStrategy
*/ */
@@ -428,9 +415,8 @@ public class BatchApiTest {
} }
/** /**
* Test for the successful approval and disbursal of a loan using * Test for the successful approval and disbursal of a loan using 'ApproveLoanCommandStrategy' and
* 'ApproveLoanCommandStrategy' and 'DisburseLoanCommandStrategy'. A '200' * 'DisburseLoanCommandStrategy'. A '200' status code is expected on successful activation.
* status code is expected on successful activation.
* *
* @see org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy * @see org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy
* @see org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy * @see org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy
@@ -483,9 +469,8 @@ public class BatchApiTest {
} }
/** /**
* Test for the successful create client, apply loan,approval and disbursal * Test for the successful create client, apply loan,approval and disbursal of a loan using Batch API with
* of a loan using Batch API with enclosingTransaction. A '200' status code * enclosingTransaction. A '200' status code is expected on successful activation.
* is expected on successful activation.
* *
* @see org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy * @see org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy
* @see org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy * @see org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy
@@ -40,9 +40,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Test class for testing the integration of Batch API with custom batch * Test class for testing the integration of Batch API with custom batch requests and various user defined workflow.
* requests and various user defined workflow. Like in the case of mifos * Like in the case of mifos community-app
* community-app
* *
* @author Rishabh Shukla * @author Rishabh Shukla
*/ */
@@ -57,9 +56,8 @@ public class BatchRequestsIntegrationTest {
} }
/** /**
* Sets up the essential settings for the TEST like contentType, * Sets up the essential settings for the TEST like contentType, expectedStatusCode. It uses the '@BeforeEach'
* expectedStatusCode. It uses the '@BeforeEach' annotation provided by * annotation provided by jUnit.
* jUnit.
*/ */
@BeforeEach @BeforeEach
public void setup() { public void setup() {
@@ -72,12 +70,10 @@ public class BatchRequestsIntegrationTest {
@Test @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
* Firstly, it'll create a few new clients and then will add those clients * and then will add those clients to the group. Then a few loans will be created and one of those loans will be
* to the group. Then a few loans will be created and one of those loans * chosen at random and similarily a few of the created clients will be chosen on random. Now, the selected loan
* will be chosen at random and similarily a few of the created clients will * will be applied to these clients through Batch - API ApplyLoanCommandStrategy.
* be chosen on random. Now, the selected loan will be applied to these
* clients through Batch - API ApplyLoanCommandStrategy.
*/ */
public void shouldReturnOkStatusForLoansAppliedToSelectedClients() { public void shouldReturnOkStatusForLoansAppliedToSelectedClients() {
@@ -62,9 +62,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Client Loan Integration Test for checking Loan Application Repayments * Client Loan Integration Test for checking Loan Application Repayments Schedule, loan charges, penalties, loan
* Schedule, loan charges, penalties, loan repayments and verifying accounting * repayments and verifying accounting transactions
* transactions
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
public class ClientLoanIntegrationTest { public class ClientLoanIntegrationTest {
@@ -1249,8 +1248,7 @@ public class ClientLoanIntegrationTest {
} }
/*** /***
* Test case for checking CashBasedAccounting functionality adding charges * Test case for checking CashBasedAccounting functionality adding charges with calculation type flat
* with calculation type flat
*/ */
@Test @Test
public void loanWithFlatCahargesAndCashBasedAccountingEnabled() { public void loanWithFlatCahargesAndCashBasedAccountingEnabled() {
@@ -1426,8 +1424,8 @@ public class ClientLoanIntegrationTest {
} }
/*** /***
* Test case for checking CashBasedAccounting functionality adding charges * Test case for checking CashBasedAccounting functionality adding charges with calculation type percentage of
* with calculation type percentage of amount * amount
*/ */
@Test @Test
public void loanWithCahargesOfTypeAmountPercentageAndCashBasedAccountingEnabled() { public void loanWithCahargesOfTypeAmountPercentageAndCashBasedAccountingEnabled() {
@@ -1606,8 +1604,8 @@ public class ClientLoanIntegrationTest {
} }
/*** /***
* Test case for checking CashBasedAccounting functionality adding charges * Test case for checking CashBasedAccounting functionality adding charges with calculation type percentage of
* with calculation type percentage of amount plus interest * amount plus interest
*/ */
@Test @Test
public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndCashBasedAccountingEnabled() { public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndCashBasedAccountingEnabled() {
@@ -1787,8 +1785,7 @@ public class ClientLoanIntegrationTest {
} }
/*** /***
* Test case for checking AccuralUpfrontAccounting functionality adding * Test case for checking AccuralUpfrontAccounting functionality adding charges with calculation type flat
* charges with calculation type flat
*/ */
@Test @Test
public void loanWithFlatCahargesAndUpfrontAccrualAccountingEnabled() { public void loanWithFlatCahargesAndUpfrontAccrualAccountingEnabled() {
@@ -1981,8 +1978,8 @@ public class ClientLoanIntegrationTest {
} }
/*** /***
* Test case for checking AccuralUpfrontAccounting functionality adding * Test case for checking AccuralUpfrontAccounting functionality adding charges with calculation type percentage of
* charges with calculation type percentage of amount * amount
*/ */
@Test @Test
public void loanWithCahargesAndUpfrontAccrualAccountingEnabled() { public void loanWithCahargesAndUpfrontAccrualAccountingEnabled() {
@@ -2171,8 +2168,8 @@ public class ClientLoanIntegrationTest {
} }
/*** /***
* Test case for checking AccuralUpfrontAccounting functionality adding * Test case for checking AccuralUpfrontAccounting functionality adding charges with calculation type percentage of
* charges with calculation type percentage of amount plus interest * amount plus interest
*/ */
@Test @Test
public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndUpfrontAccrualAccountingEnabled() { public void loanWithCahargesOfTypeAmountPlusInterestPercentageAndUpfrontAccrualAccountingEnabled() {
@@ -2368,8 +2365,7 @@ public class ClientLoanIntegrationTest {
} }
/*** /***
* Test case for checking AccuralPeriodicAccounting functionality adding * Test case for checking AccuralPeriodicAccounting functionality adding charges with calculation type flat
* charges with calculation type flat
*/ */
@Test @Test
public void loanWithFlatChargesAndPeriodicAccrualAccountingEnabled() throws InterruptedException { public void loanWithFlatChargesAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
@@ -2467,14 +2463,10 @@ public class ClientLoanIntegrationTest {
validateCharge(flatInstallmentFee, loanCharges, "50", "100.00", "50.0", "50.0"); validateCharge(flatInstallmentFee, loanCharges, "50", "100.00", "50.0", "50.0");
/* /*
* this.journalEntryHelper.checkJournalEntryForAssetAccount( * this.journalEntryHelper.checkJournalEntryForAssetAccount( assetAccount, "20 September 2011", new
* assetAccount, "20 September 2011", new * JournalEntry(Float.valueOf("50.0"), JournalEntry.TransactionType.CREDIT));
* JournalEntry(Float.valueOf("50.0"), * this.journalEntryHelper.checkJournalEntryForExpenseAccount (expenseAccount, "20 September 2011", new
* JournalEntry.TransactionType.CREDIT)); * JournalEntry(Float.valueOf("50.0"), JournalEntry.TransactionType.DEBIT));
* this.journalEntryHelper.checkJournalEntryForExpenseAccount
* (expenseAccount, "20 September 2011", new
* JournalEntry(Float.valueOf("50.0"),
* JournalEntry.TransactionType.DEBIT));
*/ */
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
@@ -2561,8 +2553,8 @@ public class ClientLoanIntegrationTest {
} }
/** /**
* Test case for checking AccuralPeriodicAccounting functionality adding * Test case for checking AccuralPeriodicAccounting functionality adding charges with calculation type percentage of
* charges with calculation type percentage of amount * amount
*/ */
@Test @Test
public void loanWithChargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException { public void loanWithChargesOfTypeAmountPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
@@ -2663,14 +2655,10 @@ public class ClientLoanIntegrationTest {
validateCharge(percentageInstallmentFee, loanCharges, "1", "61.19", "29.11", "29.70"); validateCharge(percentageInstallmentFee, loanCharges, "1", "61.19", "29.11", "29.70");
/* /*
* this.journalEntryHelper.checkJournalEntryForAssetAccount( * this.journalEntryHelper.checkJournalEntryForAssetAccount( assetAccount, "20 September 2011", new
* assetAccount, "20 September 2011", new * JournalEntry(Float.valueOf("29.7"), JournalEntry.TransactionType.CREDIT));
* JournalEntry(Float.valueOf("29.7"), * this.journalEntryHelper.checkJournalEntryForExpenseAccount (expenseAccount, "20 September 2011", new
* JournalEntry.TransactionType.CREDIT)); * JournalEntry(Float.valueOf("29.7"), JournalEntry.TransactionType.DEBIT));
* this.journalEntryHelper.checkJournalEntryForExpenseAccount
* (expenseAccount, "20 September 2011", new
* JournalEntry(Float.valueOf("29.7"),
* JournalEntry.TransactionType.DEBIT));
*/ */
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
@@ -2758,8 +2746,8 @@ public class ClientLoanIntegrationTest {
} }
/*** /***
* Test case for checking AccuralPeriodicAccounting functionality adding * Test case for checking AccuralPeriodicAccounting functionality adding charges with calculation type percentage of
* charges with calculation type percentage of amount and interest * amount and interest
*/ */
@Test @Test
public void loanWithChargesOfTypeAmountPlusInterestPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException { public void loanWithChargesOfTypeAmountPlusInterestPercentageAndPeriodicAccrualAccountingEnabled() throws InterruptedException {
@@ -2861,13 +2849,10 @@ public class ClientLoanIntegrationTest {
validateCharge(amountPlusInterestPercentageInstallmentFee, loanCharges, "1", "63.02", "31.51", "31.51"); validateCharge(amountPlusInterestPercentageInstallmentFee, loanCharges, "1", "63.02", "31.51", "31.51");
/* /*
* this.journalEntryHelper.checkJournalEntryForAssetAccount( * this.journalEntryHelper.checkJournalEntryForAssetAccount( assetAccount, "20 September 2011", new
* assetAccount, "20 September 2011", new JournalEntry( * JournalEntry( Float.valueOf("31.51"), JournalEntry.TransactionType.CREDIT));
* Float.valueOf("31.51"), JournalEntry.TransactionType.CREDIT)); * this.journalEntryHelper.checkJournalEntryForExpenseAccount (expenseAccount, "20 September 2011", new
* this.journalEntryHelper.checkJournalEntryForExpenseAccount * JournalEntry(Float.valueOf("31.51"), JournalEntry.TransactionType.DEBIT));
* (expenseAccount, "20 September 2011", new
* JournalEntry(Float.valueOf("31.51"),
* JournalEntry.TransactionType.DEBIT));
*/ */
final String jobName = "Add Accrual Transactions"; final String jobName = "Add Accrual Transactions";
@@ -3032,8 +3017,7 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("0.00", String.valueOf(firstInstallment.get("totalOutstandingForPeriod"))); validateNumberForEqual("0.00", String.valueOf(firstInstallment.get("totalOutstandingForPeriod")));
/*** /***
* Verify 2nd and 3rd repayments dues before making excess payment for * Verify 2nd and 3rd repayments dues before making excess payment for installment no 2
* installment no 2
*/ */
HashMap secondInstallment = loanSchedule.get(2); HashMap secondInstallment = loanSchedule.get(2);
HashMap thirdInstallment = loanSchedule.get(3); HashMap thirdInstallment = loanSchedule.get(3);
@@ -3051,18 +3035,15 @@ public class ClientLoanIntegrationTest {
loanSchedule.clear(); loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
/*** /***
* Verify 2nd and 3rd repayments after making excess payment for * Verify 2nd and 3rd repayments after making excess payment for installment no 2
* installment no 2
*/ */
secondInstallment = loanSchedule.get(2); secondInstallment = loanSchedule.get(2);
validateNumberForEqual("0.00", String.valueOf(secondInstallment.get("totalOutstandingForPeriod"))); validateNumberForEqual("0.00", String.valueOf(secondInstallment.get("totalOutstandingForPeriod")));
/*** /***
* According to RBI Excess payment should go to principal portion of * According to RBI Excess payment should go to principal portion of next installment, but as interest
* next installment, but as interest recalculation is not implemented, * recalculation is not implemented, it wont make any difference to schedule even though if we made excess
* it wont make any difference to schedule even though if we made excess * payment, so excess payments will behave the same as regular payment with the excess amount
* payment, so excess payments will behave the same as regular payment
* with the excess amount
*/ */
thirdInstallment = loanSchedule.get(3); thirdInstallment = loanSchedule.get(3);
validateNumberForEqual("3200", String.valueOf(thirdInstallment.get("totalOutstandingForPeriod"))); validateNumberForEqual("3200", String.valueOf(thirdInstallment.get("totalOutstandingForPeriod")));
@@ -3072,16 +3053,14 @@ public class ClientLoanIntegrationTest {
validateNumberForEqual("100.00", String.valueOf(thirdInstallment.get("interestOutstanding"))); validateNumberForEqual("100.00", String.valueOf(thirdInstallment.get("interestOutstanding")));
/*** /***
* Make payment with due amount of 3rd installment on 4th installment * Make payment with due amount of 3rd installment on 4th installment date
* date
*/ */
this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3200"), loanID); this.loanTransactionHelper.makeRepayment("20 January 2012", Float.valueOf("3200"), loanID);
loanSchedule.clear(); loanSchedule.clear();
loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID); loanSchedule = this.loanTransactionHelper.getLoanRepaymentSchedule(this.requestSpec, this.responseSpec, loanID);
/*** /***
* Verify overdue interests are deducted first and then remaining amount * Verify overdue interests are deducted first and then remaining amount for interest portion of due installment
* for interest portion of due installment
*/ */
thirdInstallment = loanSchedule.get(3); thirdInstallment = loanSchedule.get(3);
HashMap fourthInstallment = loanSchedule.get(4); HashMap fourthInstallment = loanSchedule.get(4);
@@ -4948,8 +4927,8 @@ public class ClientLoanIntegrationTest {
.withMoratorium("2", "3").withLoanProductConfiguration(loanProductConfigurationAsFalse).build(null)); .withMoratorium("2", "3").withLoanProductConfiguration(loanProductConfigurationAsFalse).build(null));
LOG.info("-------------------LOAN PRODUCT CREATED WITH ATTRIBUTE CONFIGURATION AS FALSE---------------------- {}", loanProductID); LOG.info("-------------------LOAN PRODUCT CREATED WITH ATTRIBUTE CONFIGURATION AS FALSE---------------------- {}", loanProductID);
/* /*
* Try to override attribute values in loan account when attribute * Try to override attribute values in loan account when attribute configurations are set to false at product
* configurations are set to false at product level * level
*/ */
loanID = applyForLoanApplicationWithProductConfigurationAsFalse(clientID, loanProductID, proposedAmount); loanID = applyForLoanApplicationWithProductConfigurationAsFalse(clientID, loanProductID, proposedAmount);
LOG.info("--------------------------LOAN CREATED WITH ID------------------------- {}", loanID); LOG.info("--------------------------LOAN CREATED WITH ID------------------------- {}", loanID);
@@ -656,9 +656,8 @@ public class ClientSavingsIntegrationTest {
} }
/*** /***
* Test case for overdraft account functionality. Open account with zero * Test case for overdraft account functionality. Open account with zero balance, perform transactions then post
* balance, perform transactions then post interest and verify posted * interest and verify posted interest
* interest
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test @Test
@@ -675,8 +674,7 @@ public class ClientSavingsIntegrationTest {
final String minBalanceForInterestCalculation = null; final String minBalanceForInterestCalculation = null;
/*** /***
* Create savings product with zero opening balance and overdraft * Create savings product with zero opening balance and overdraft enabled
* enabled
*/ */
final String zeroOpeningBalance = "0.0"; final String zeroOpeningBalance = "0.0";
final String minRequiredBalance = null; final String minRequiredBalance = null;
@@ -734,9 +732,8 @@ public class ClientSavingsIntegrationTest {
Float balance = Float.valueOf(zeroOpeningBalance); Float balance = Float.valueOf(zeroOpeningBalance);
/*** /***
* Perform withdraw transaction, verify account balance(account balance * Perform withdraw transaction, verify account balance(account balance will go to negative as no deposits are
* will go to negative as no deposits are there prior to this * there prior to this transaction)
* transaction)
*/ */
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -746,8 +743,7 @@ public class ClientSavingsIntegrationTest {
assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal");
/*** /***
* Perform Deposit transaction on last day of month and verify account * Perform Deposit transaction on last day of month and verify account balance.
* balance.
* *
* @param transactionDate * @param transactionDate
* this value is every time last day of previous month * this value is every time last day of previous month
@@ -768,9 +764,8 @@ public class ClientSavingsIntegrationTest {
Float actualInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString()); Float actualInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString());
/*** /***
* Calculate expected interest to be posted, interest should be posted * Calculate expected interest to be posted, interest should be posted for one day only because deposit
* for one day only because deposit transaction happened on last day of * transaction happened on last day of month before this account balance is negative.
* month before this account balance is negative.
*/ */
final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString()); final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType"); final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
@@ -781,8 +776,7 @@ public class ClientSavingsIntegrationTest {
Float interestPosted = (float) (interestPerDay * balance * 1); Float interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -812,8 +806,7 @@ public class ClientSavingsIntegrationTest {
final String minBalanceForInterestCalculation = null; final String minBalanceForInterestCalculation = null;
/*** /***
* Create savings product with zero opening balance and overdraft * Create savings product with zero opening balance and overdraft enabled
* enabled
*/ */
final String zeroOpeningBalance = "0.0"; final String zeroOpeningBalance = "0.0";
final String minRequiredBalance = null; final String minRequiredBalance = null;
@@ -876,8 +869,7 @@ public class ClientSavingsIntegrationTest {
String TRANSACTION_DATE = dateFormat.format(transactionDate.getTime()); String TRANSACTION_DATE = dateFormat.format(transactionDate.getTime());
/*** /***
* Perform Deposit transaction on last day of month and verify account * Perform Deposit transaction on last day of month and verify account balance.
* balance.
* *
* @param transactionDate * @param transactionDate
* this value is every time last day of previous month * this value is every time last day of previous month
@@ -890,9 +882,8 @@ public class ClientSavingsIntegrationTest {
assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit"); assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit");
/*** /***
* Calculate expected interest to be posted, interest should be posted * Calculate expected interest to be posted, interest should be posted for one day only because deposit
* for one day only because deposit transaction happened on last day of * transaction happened on last day of month before this account balance is negative.
* month before this account balance is negative.
*/ */
this.savingsAccountHelper.postInterestForSavings(savingsId); this.savingsAccountHelper.postInterestForSavings(savingsId);
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId); HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
@@ -908,8 +899,7 @@ public class ClientSavingsIntegrationTest {
Float interestPosted = (float) (interestPerDay * balance * 1); Float interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -931,8 +921,7 @@ public class ClientSavingsIntegrationTest {
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -958,8 +947,7 @@ public class ClientSavingsIntegrationTest {
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -989,8 +977,7 @@ public class ClientSavingsIntegrationTest {
interestPosted = (float) (interestPerDay * balance * 19); interestPosted = (float) (interestPerDay * balance * 19);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1020,8 +1007,7 @@ public class ClientSavingsIntegrationTest {
interestPosted = (float) (interestPerDay * balance * 8); interestPosted = (float) (interestPerDay * balance * 8);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1047,8 +1033,7 @@ public class ClientSavingsIntegrationTest {
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1072,8 +1057,7 @@ public class ClientSavingsIntegrationTest {
final String minBalanceForInterestCalculation = null; final String minBalanceForInterestCalculation = null;
/*** /***
* Create savings product with zero opening balance and overdraft * Create savings product with zero opening balance and overdraft enabled
* enabled
*/ */
final String zeroOpeningBalance = "0.0"; final String zeroOpeningBalance = "0.0";
final String minRequiredBalance = null; final String minRequiredBalance = null;
@@ -1136,9 +1120,8 @@ public class ClientSavingsIntegrationTest {
String TRANSACTION_DATE = dateFormat.format(transactionDate.getTime()); String TRANSACTION_DATE = dateFormat.format(transactionDate.getTime());
/*** /***
* Perform withdraw transaction, verify account balance(account balance * Perform withdraw transaction, verify account balance(account balance will go to negative as no deposits are
* will go to negative as no deposits are there prior to this * there prior to this transaction)
* transaction)
*/ */
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -1148,8 +1131,7 @@ public class ClientSavingsIntegrationTest {
assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal");
/*** /***
* Perform Deposit transaction on last day of month and verify account * Perform Deposit transaction on last day of month and verify account balance.
* balance.
* *
* @param transactionDate * @param transactionDate
* this value is every time last day of previous month * this value is every time last day of previous month
@@ -1162,9 +1144,8 @@ public class ClientSavingsIntegrationTest {
assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit"); assertEquals(balance, depositTransaction.get("runningBalance"), "Verifying Balance after Deposit");
/*** /***
* Calculate expected interest to be posted, interest should be posted * Calculate expected interest to be posted, interest should be posted for one day only because deposit
* for one day only because deposit transaction happened on last day of * transaction happened on last day of month before this account balance is negative.
* month before this account balance is negative.
*/ */
this.savingsAccountHelper.postInterestForSavings(savingsId); this.savingsAccountHelper.postInterestForSavings(savingsId);
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId); HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
@@ -1180,8 +1161,7 @@ public class ClientSavingsIntegrationTest {
Float interestPosted = (float) (interestPerDay * balance * 1); Float interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1203,8 +1183,7 @@ public class ClientSavingsIntegrationTest {
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1230,8 +1209,7 @@ public class ClientSavingsIntegrationTest {
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1261,8 +1239,7 @@ public class ClientSavingsIntegrationTest {
interestPosted = (float) (interestPerDay * balance * 19); interestPosted = (float) (interestPerDay * balance * 19);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1292,8 +1269,7 @@ public class ClientSavingsIntegrationTest {
interestPosted = (float) (interestPerDay * balance * 8); interestPosted = (float) (interestPerDay * balance * 8);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1319,8 +1295,7 @@ public class ClientSavingsIntegrationTest {
interestPosted = (float) (interestPerDay * balance * 1); interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1344,8 +1319,7 @@ public class ClientSavingsIntegrationTest {
final String minBalanceForInterestCalculation = null; final String minBalanceForInterestCalculation = null;
/*** /***
* Create savings product with zero opening balance and overdraft * Create savings product with zero opening balance and overdraft enabled
* enabled
*/ */
final String zeroOpeningBalance = "0.0"; final String zeroOpeningBalance = "0.0";
final String minRequiredBalance = null; final String minRequiredBalance = null;
@@ -1408,9 +1382,8 @@ public class ClientSavingsIntegrationTest {
Float balance = Float.valueOf(zeroOpeningBalance); Float balance = Float.valueOf(zeroOpeningBalance);
/*** /***
* Perform withdraw transaction, verify account balance(account balance * Perform withdraw transaction, verify account balance(account balance will go to negative as no deposits are
* will go to negative as no deposits are there prior to this * there prior to this transaction)
* transaction)
*/ */
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -1420,8 +1393,7 @@ public class ClientSavingsIntegrationTest {
assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal");
/*** /***
* Perform Deposit transaction on last day of month and verify account * Perform Deposit transaction on last day of month and verify account balance.
* balance.
* *
* @param transactionDate * @param transactionDate
* this value is every time last day of previous month * this value is every time last day of previous month
@@ -1442,9 +1414,8 @@ public class ClientSavingsIntegrationTest {
Float actualInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString()); Float actualInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString());
/*** /***
* Calculate expected interest to be posted, interest should be posted * Calculate expected interest to be posted, interest should be posted for one day only because deposit
* for one day only because deposit transaction happened on last day of * transaction happened on last day of month before this account balance is negative.
* month before this account balance is negative.
*/ */
this.savingsAccountHelper.postInterestAsOnSavings(savingsId, POSTED_TRANSACTION_DATE); this.savingsAccountHelper.postInterestAsOnSavings(savingsId, POSTED_TRANSACTION_DATE);
HashMap accountDetailsPostInterest = this.savingsAccountHelper.getSavingsDetails(savingsId); HashMap accountDetailsPostInterest = this.savingsAccountHelper.getSavingsDetails(savingsId);
@@ -1453,9 +1424,8 @@ public class ClientSavingsIntegrationTest {
Float accountDetailsPostInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString()); Float accountDetailsPostInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString());
/*** /***
* Calculate expected interest to be posted, interest should be posted * Calculate expected interest to be posted, interest should be posted for one day only because deposit
* for one day only because deposit transaction happened on last day of * transaction happened on last day of month before this account balance is negative.
* month before this account balance is negative.
*/ */
final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString()); final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType"); final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
@@ -1466,8 +1436,7 @@ public class ClientSavingsIntegrationTest {
Float interestPosted = (float) (interestPerDay * balance * 1); Float interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1518,8 +1487,7 @@ public class ClientSavingsIntegrationTest {
final String minBalanceForInterestCalculation = null; final String minBalanceForInterestCalculation = null;
/*** /***
* Create savings product with zero opening balance and overdraft * Create savings product with zero opening balance and overdraft enabled
* enabled
*/ */
final String zeroOpeningBalance = "0.0"; final String zeroOpeningBalance = "0.0";
final String minRequiredBalance = null; final String minRequiredBalance = null;
@@ -1587,9 +1555,8 @@ public class ClientSavingsIntegrationTest {
Float balance = Float.valueOf(zeroOpeningBalance); Float balance = Float.valueOf(zeroOpeningBalance);
/*** /***
* Perform withdraw transaction, verify account balance(account balance * Perform withdraw transaction, verify account balance(account balance will go to negative as no deposits are
* will go to negative as no deposits are there prior to this * there prior to this transaction)
* transaction)
*/ */
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT, Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, WITHDRAW_AMOUNT,
ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID); ACTIVATION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
@@ -1599,8 +1566,7 @@ public class ClientSavingsIntegrationTest {
assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal"); assertEquals(balance, withdrawTransaction.get("runningBalance"), "Verifying Balance after Withdrawal");
/*** /***
* Perform Deposit transaction on last day of month and verify account * Perform Deposit transaction on last day of month and verify account balance.
* balance.
* *
* @param transactionDate * @param transactionDate
* this value is every time last day of previous month * this value is every time last day of previous month
@@ -1621,9 +1587,8 @@ public class ClientSavingsIntegrationTest {
Float actualInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString()); Float actualInterestPosted = Float.valueOf(summary.get("totalInterestPosted").toString());
/*** /***
* Calculate expected interest to be posted, interest should be posted * Calculate expected interest to be posted, interest should be posted for one day only because deposit
* for one day only because deposit transaction happened on last day of * transaction happened on last day of month before this account balance is negative.
* month before this account balance is negative.
*/ */
final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString()); final Float nominalAnnualInterest = Float.valueOf(accountDetails.get("nominalAnnualInterestRate").toString());
final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType"); final HashMap interestCalculationDaysInYearType = (HashMap) accountDetails.get("interestCalculationDaysInYearType");
@@ -1634,8 +1599,7 @@ public class ClientSavingsIntegrationTest {
Float interestPosted = (float) (interestPerDay * balance * 1); Float interestPosted = (float) (interestPerDay * balance * 1);
/*** /***
* Apply rounding on interestPosted, actualInterestPosted and verify * Apply rounding on interestPosted, actualInterestPosted and verify both are same
* both are same
*/ */
DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US)); DecimalFormat decimalFormat = new DecimalFormat("", new DecimalFormatSymbols(Locale.US));
decimalFormat.applyPattern("#.###"); decimalFormat.applyPattern("#.###");
@@ -1957,13 +1921,10 @@ public class ClientSavingsIntegrationTest {
} }
/* /*
* private void verifySavingsInterest(final Object savingsInterest) { * private void verifySavingsInterest(final Object savingsInterest) { LOG.info(
* LOG.info( * "--------------------VERIFYING THE BALANCE, INTEREST --------------------------" );
* "--------------------VERIFYING THE BALANCE, INTEREST --------------------------"
* );
* *
* assertEquals("Verifying Interest Calculation", Float.valueOf("238.3399"), * assertEquals("Verifying Interest Calculation", Float.valueOf("238.3399"), savingsInterest); }
* savingsInterest); }
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -2082,8 +2043,8 @@ public class ClientSavingsIntegrationTest {
} }
/** /**
* incorrect savings account balance when charge transaction is reversed * incorrect savings account balance when charge transaction is reversed during an overdraft recalculate Daily
* during an overdraft recalculate Daily Balances * Balances
*/ */
@Test @Test
@@ -46,8 +46,7 @@ import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
/** /**
* Tests loan schedule change based on group meeting changes and loan * Tests loan schedule change based on group meeting changes and loan rescheduling
* rescheduling
**/ **/
@SuppressWarnings({ "rawtypes" }) @SuppressWarnings({ "rawtypes" })
@Disabled @Disabled
@@ -83,15 +83,13 @@ public class FinancialActivityAccountsTest {
Assertions.assertNotNull(financialActivityAccountId); Assertions.assertNotNull(financialActivityAccountId);
/*** /***
* Fetch Created Financial Activity to Account Mapping and validate * Fetch Created Financial Activity to Account Mapping and validate created values
* created values
**/ **/
assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID, assertFinancialActivityAccountCreation(financialActivityAccountId, LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID,
liabilityTransferAccount); liabilityTransferAccount);
/** /**
* Update Existing Financial Activity to Account Mapping and assert * Update Existing Financial Activity to Account Mapping and assert changes
* changes
**/ **/
Account newLiabilityTransferAccount = accountHelper.createLiabilityAccount(); Account newLiabilityTransferAccount = accountHelper.createLiabilityAccount();
Assertions.assertNotNull(newLiabilityTransferAccount); Assertions.assertNotNull(newLiabilityTransferAccount);
@@ -120,8 +118,7 @@ public class FinancialActivityAccountsTest {
duplicateFinancialActivityAccountError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); duplicateFinancialActivityAccountError.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
/** /**
* Associating incorrect GL account types with a financial activity * Associating incorrect GL account types with a financial activity should fail
* should fail
**/ **/
List<HashMap> invalidFinancialActivityAccountError = (List<HashMap>) financialActivityAccountHelper.updateFinancialActivityAccount( List<HashMap> invalidFinancialActivityAccountError = (List<HashMap>) financialActivityAccountHelper.updateFinancialActivityAccount(
financialActivityAccountId, assetTransferFinancialActivityId, newLiabilityTransferAccount.getAccountID(), financialActivityAccountId, assetTransferFinancialActivityId, newLiabilityTransferAccount.getAccountID(),
@@ -121,8 +121,8 @@ public class FixedDepositTest {
} }
/*** /***
* Test case for Fixed Deposit Account premature closure with transaction * Test case for Fixed Deposit Account premature closure with transaction type withdrawal and Cash Based accounting
* type withdrawal and Cash Based accounting enabled * enabled
*/ */
@Test @Test
public void testFixedDepositAccountWithPrematureClosureTypeWithdrawal() { public void testFixedDepositAccountWithPrematureClosureTypeWithdrawal() {
@@ -202,8 +202,7 @@ public class FixedDepositTest {
Float depositAmount = (Float) accountSummary.get("totalDeposits"); Float depositAmount = (Float) accountSummary.get("totalDeposits");
/*** /***
* Verify journal entries posted for initial deposit transaction which * Verify journal entries posted for initial deposit transaction which happened at activation time
* happened at activation time
*/ */
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) }; final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) }; final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) };
@@ -336,8 +335,7 @@ public class FixedDepositTest {
Float depositAmount = (Float) accountSummary.get("totalDeposits"); Float depositAmount = (Float) accountSummary.get("totalDeposits");
/*** /***
* Verify journal entries posted for initial deposit transaction which * Verify journal entries posted for initial deposit transaction which happened at activation time
* happened at activation time
*/ */
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) }; final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) }; final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) };
@@ -479,8 +477,7 @@ public class FixedDepositTest {
Float depositAmount = (Float) accountSummary.get("totalDeposits"); Float depositAmount = (Float) accountSummary.get("totalDeposits");
/*** /***
* Verify journal entries posted for initial deposit transaction which * Verify journal entries posted for initial deposit transaction which happened at activation time
* happened at activation time
*/ */
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) }; final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) }; final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) };
@@ -686,8 +683,8 @@ public class FixedDepositTest {
} }
/*** /***
* Test case for FD Account premature closure with transaction transfers to * Test case for FD Account premature closure with transaction transfers to savings account and Cash Based
* savings account and Cash Based accounting enabled * accounting enabled
*/ */
@Test @Test
public void testFixedDepositAccountWithPrematureClosureTypeTransferToSavings() { public void testFixedDepositAccountWithPrematureClosureTypeTransferToSavings() {
@@ -777,8 +774,7 @@ public class FixedDepositTest {
Float depositAmount = (Float) accountSummary.get("totalDeposits"); Float depositAmount = (Float) accountSummary.get("totalDeposits");
/*** /***
* Verify journal entries posted for initial deposit transaction which * Verify journal entries posted for initial deposit transaction which happened at activation time
* happened at activation time
*/ */
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) }; final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) }; final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) };
@@ -834,9 +830,8 @@ public class FixedDepositTest {
Float prematurityAmount = (Float) fixedDepositData.get("maturityAmount"); Float prematurityAmount = (Float) fixedDepositData.get("maturityAmount");
/*** /***
* Verify journal entry transactions for preclosure transaction As this * Verify journal entry transactions for preclosure transaction As this transaction is an account transfer you
* transaction is an account transfer you should get financial account * should get financial account mapping details and verify amounts
* mapping details and verify amounts
*/ */
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE, this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE,
new JournalEntry(prematurityAmount, JournalEntry.TransactionType.CREDIT), new JournalEntry(prematurityAmount, JournalEntry.TransactionType.CREDIT),
@@ -855,8 +850,8 @@ public class FixedDepositTest {
} }
/*** /***
* Test case for Fixed Deposit Account premature closure with transaction * Test case for Fixed Deposit Account premature closure with transaction type ReInvest and Cash Based accounting
* type ReInvest and Cash Based accounting enabled * enabled
*/ */
@Test @Test
public void testFixedDepositAccountWithPrematureClosureTypeReinvest() { public void testFixedDepositAccountWithPrematureClosureTypeReinvest() {
@@ -930,8 +925,7 @@ public class FixedDepositTest {
Float depositAmount = (Float) accountSummary.get("totalDeposits"); Float depositAmount = (Float) accountSummary.get("totalDeposits");
/*** /***
* Verify journal entries posted for initial deposit transaction which * Verify journal entries posted for initial deposit transaction which happened at activation time
* happened at activation time
*/ */
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) }; final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.DEBIT) };
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) }; final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(depositAmount, JournalEntry.TransactionType.CREDIT) };
@@ -2376,8 +2370,8 @@ public class FixedDepositTest {
} }
/*** /***
* Test case for Fixed Deposit Account rollover with maturity instruction as * Test case for Fixed Deposit Account rollover with maturity instruction as re invest maturity
* re invest maturity amount(principal+interest) * amount(principal+interest)
*/ */
@Test @Test
public void testFixedDepositAccountWithRolloverMaturityAmount() { public void testFixedDepositAccountWithRolloverMaturityAmount() {
@@ -2457,8 +2451,7 @@ public class FixedDepositTest {
} }
/*** /***
* Test case for Fixed Deposit Account rollover with maturity instruction as * Test case for Fixed Deposit Account rollover with maturity instruction as re invest principal only
* re invest principal only
*/ */
@Test @Test
public void testFixedDepositAccountWithRolloverPrincipal() { public void testFixedDepositAccountWithRolloverPrincipal() {
@@ -2648,8 +2641,7 @@ public class FixedDepositTest {
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec); List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
final Account financialAccount; final Account financialAccount;
/*** /***
* if no financial activities are defined for account transfers, create * if no financial activities are defined for account transfers, create liability financial accounting mappings
* liability financial accounting mappings
*/ */
if (financialActivities.isEmpty()) { if (financialActivities.isEmpty()) {
financialAccount = createLiabilityFinancialAccountTransferType(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID); financialAccount = createLiabilityFinancialAccountTransferType(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID);
@@ -78,8 +78,7 @@ public class FlexibleSavingsInterestPostingIntegrationTest {
this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate, CommonConstants.RESPONSE_RESOURCE_ID); this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000", startDate, CommonConstants.RESPONSE_RESOURCE_ID);
/*** /***
* Perform Post interest transaction and verify the posted transaction * Perform Post interest transaction and verify the posted transaction date
* date
*/ */
this.savingsAccountHelper.postInterestForSavings(savingsId); this.savingsAccountHelper.postInterestForSavings(savingsId);
HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId); HashMap accountDetails = this.savingsAccountHelper.getSavingsDetails(savingsId);
@@ -160,8 +160,7 @@ public class GlobalConfigurationTest {
Assertions.assertNotNull(configId); Assertions.assertNotNull(configId);
/* /*
* Update force-password-reset-days with value as 0 and Enable * Update force-password-reset-days with value as 0 and Enable as true - failure case
* as true - failure case
*/ */
ArrayList error = (ArrayList) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(this.requestSpec, ArrayList error = (ArrayList) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(this.requestSpec,
this.httpStatusForidden, configId, newValue, newBooleanValue, CommonConstants.RESPONSE_ERROR); this.httpStatusForidden, configId, newValue, newBooleanValue, CommonConstants.RESPONSE_ERROR);
@@ -172,8 +171,7 @@ public class GlobalConfigurationTest {
"Force Password Reset days value must be greater than zero."); "Force Password Reset days value must be greater than zero.");
/* /*
* Update force-password-reset-days with value as 50 and Enable * Update force-password-reset-days with value as 50 and Enable as true - success case
* as true - success case
*/ */
final HashMap updateSuccess = (HashMap) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration( final HashMap updateSuccess = (HashMap) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(
this.requestSpec, this.responseSpec, configId, "50", newBooleanValue, "changes"); this.requestSpec, this.responseSpec, configId, "50", newBooleanValue, "changes");
@@ -185,8 +183,7 @@ public class GlobalConfigurationTest {
Assertions.assertNotNull(updateSuccess1); Assertions.assertNotNull(updateSuccess1);
/* /*
* Update without sending value and Enable as true - failure * Update without sending value and Enable as true - failure case
* case
*/ */
ArrayList failure = (ArrayList) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(this.requestSpec, ArrayList failure = (ArrayList) GlobalConfigurationHelper.updatePasswordResetDaysForGlobalConfiguration(this.requestSpec,
this.httpStatusForidden, configId, null, newBooleanValue, CommonConstants.RESPONSE_ERROR); this.httpStatusForidden, configId, null, newBooleanValue, CommonConstants.RESPONSE_ERROR);
@@ -41,8 +41,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Group Test for checking Group: Creation, Activation, Client Association, * Group Test for checking Group: Creation, Activation, Client Association, Updating & Deletion
* Updating & Deletion
*/ */
public class GroupTest { public class GroupTest {
@@ -70,8 +70,8 @@ public class HookIntegrationTest {
try { try {
/** /**
* sleep for a three seconds after each failure to increase the * sleep for a three seconds after each failure to increase the likelihood of the previous request for
* likelihood of the previous request for creating office completing * creating office completing
**/ **/
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
@@ -87,8 +87,7 @@ public class LoanApplicationApprovalTest {
} }
/* /*
* Negative test case: Approved amount non zero is greater than proposed * Negative test case: Approved amount non zero is greater than proposed amount
* amount
*/ */
@Test @Test
public void loanApplicationApprovedAmountGreaterThanProposedAmount() { public void loanApplicationApprovedAmountGreaterThanProposedAmount() {
@@ -236,10 +235,8 @@ public class LoanApplicationApprovalTest {
/* If tranches are not specified for a multi-disburse loan */ /* If tranches are not specified for a multi-disburse loan */
/** /**
* error = * error = this.loanTransactionHelper.approveLoanForTranches(approveDate, expectedDisbursementDate,
* this.loanTransactionHelper.approveLoanForTranches(approveDate, * approvalAmount5, loanID, approveTranche5, CommonConstants.RESPONSE_ERROR);
* expectedDisbursementDate, approvalAmount5, loanID, approveTranche5,
* CommonConstants.RESPONSE_ERROR);
* assertEquals("error.msg.disbursementData.required", * assertEquals("error.msg.disbursementData.required",
* error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE)); * error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
**/ **/
@@ -232,113 +232,79 @@ public class LoanDisbursementDetailsIntegrationTest {
/* Uncomment and modify test builder values once MIFOSX-2006 is closed. */ /* Uncomment and modify test builder values once MIFOSX-2006 is closed. */
/* /*
* private void validateRepaymentScheduleWithoutEMI(ArrayList<HashMap> * private void validateRepaymentScheduleWithoutEMI(ArrayList<HashMap> periods){ LoanDisbursementTestBuilder
* periods){ LoanDisbursementTestBuilder expectedRepaymentSchedule0 = new * expectedRepaymentSchedule0 = new LoanDisbursementTestBuilder( "[2015, 6, 1]", 0.0f, 0.0f, null, null, 5000.0f,
* LoanDisbursementTestBuilder( "[2015, 6, 1]", 0.0f, 0.0f, null, null, * null, null, null);
* 5000.0f, null, null, null);
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule1 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule1 = new LoanDisbursementTestBuilder( "[2015, 7, 1]", 800.0f,
* LoanDisbursementTestBuilder( "[2015, 7, 1]", 800.0f, 800.0f, 50.0f, * 800.0f, 50.0f, 750.0f, 4250.0f, 750.0f, 750.0f, "[2015, 6, 1]");
* 750.0f, 4250.0f, 750.0f, 750.0f, "[2015, 6, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule2 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule2 = new LoanDisbursementTestBuilder( "[2015, 8, 1]", 800.0f,
* LoanDisbursementTestBuilder( "[2015, 8, 1]", 800.0f, 800.0f, 42.5f, * 800.0f, 42.5f, 757.5f, 3492.5f, 757.5f, 757.5f, "[2015, 7, 1]");
* 757.5f, 3492.5f, 757.5f, 757.5f, "[2015, 7, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule3 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule3 = new LoanDisbursementTestBuilder( "[2015, 9, 1]", 0.0f,
* LoanDisbursementTestBuilder( "[2015, 9, 1]", 0.0f, 0.0f, null, null, * 0.0f, null, null, 5000.0f, null, null, null);
* 5000.0f, null, null, null);
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule4 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule4 = new LoanDisbursementTestBuilder( "[2015, 9, 1]", 800.0f,
* LoanDisbursementTestBuilder( "[2015, 9, 1]", 800.0f, 800.0f, 34.92f, * 800.0f, 34.92f, 765.08f, 7727.42f, 765.08f, 765.08f, "[2015, 8, 1]");
* 765.08f, 7727.42f, 765.08f, 765.08f, "[2015, 8, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule5 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule5 = new LoanDisbursementTestBuilder( "[2015, 10, 1]",
* LoanDisbursementTestBuilder( "[2015, 10, 1]", 800.0f, 800.0f, 77.27f, * 800.0f, 800.0f, 77.27f, 722.73f, 7004.69f, 722.73f, 722.73f, "[2015, 9, 1]");
* 722.73f, 7004.69f, 722.73f, 722.73f, "[2015, 9, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule6 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule6 = new LoanDisbursementTestBuilder( "[2015, 11, 1]",
* LoanDisbursementTestBuilder( "[2015, 11, 1]", 800.0f, 800.0f, 70.05f, * 800.0f, 800.0f, 70.05f, 729.95f, 6274.74f, 729.95f, 729.95f, "[2015, 10, 1]");
* 729.95f, 6274.74f, 729.95f, 729.95f, "[2015, 10, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule7 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule7 = new LoanDisbursementTestBuilder( "[2015, 12, 1]",
* LoanDisbursementTestBuilder( "[2015, 12, 1]", 800.0f, 800.0f, 62.75f, * 800.0f, 800.0f, 62.75f, 737.25f, 5537.49f, 737.25f, 737.25f, "[2015, 11, 1]");
* 737.25f, 5537.49f, 737.25f, 737.25f, "[2015, 11, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule8 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule8 = new LoanDisbursementTestBuilder( "[2016, 1, 1]", 800.0f,
* LoanDisbursementTestBuilder( "[2016, 1, 1]", 800.0f, 800.0f, 55.37f, * 800.0f, 55.37f, 744.63f, 4792.86f, 744.63f, 744.63f, "[2015, 12, 1]");
* 744.63f, 4792.86f, 744.63f, 744.63f, "[2015, 12, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule9 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule9 = new LoanDisbursementTestBuilder( "[2016, 2, 1]", 800.0f,
* LoanDisbursementTestBuilder( "[2016, 2, 1]", 800.0f, 800.0f, 47.93f, * 800.0f, 47.93f, 752.07f, 4040.79f, 752.07f, 752.07f, "[2016, 1, 1]");
* 752.07f, 4040.79f, 752.07f, 752.07f, "[2016, 1, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule10 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule10 = new LoanDisbursementTestBuilder( "[2016, 3, 1]",
* LoanDisbursementTestBuilder( "[2016, 3, 1]", 800.0f, 800.0f, 40.41f, * 800.0f, 800.0f, 40.41f, 759.59f, 3281.2f, 759.59f, 759.59f, "[2016, 2, 1]");
* 759.59f, 3281.2f, 759.59f, 759.59f, "[2016, 2, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule11 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule11 = new LoanDisbursementTestBuilder( "[2016, 4, 1]",
* LoanDisbursementTestBuilder( "[2016, 4, 1]", 800.0f, 800.0f, 32.81f, * 800.0f, 800.0f, 32.81f, 767.19f, 2514.01f, 767.19f, 767.19f, "[2016, 3, 1]");
* 767.19f, 2514.01f, 767.19f, 767.19f, "[2016, 3, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule12 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule12 = new LoanDisbursementTestBuilder( "[2016, 5, 1]",
* LoanDisbursementTestBuilder( "[2016, 5, 1]", 800.0f, 800.0f, 25.14f, * 800.0f, 800.0f, 25.14f, 774.86f, 1739.15f, 774.86f, 774.86f, "[2016, 4, 1]");
* 774.86f, 1739.15f, 774.86f, 774.86f, "[2016, 4, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule13 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule13 = new LoanDisbursementTestBuilder( "[2016, 6, 1]",
* LoanDisbursementTestBuilder( "[2016, 6, 1]", 800.0f, 800.0f, 17.39f, * 800.0f, 800.0f, 17.39f, 782.61f, 956.54f, 782.61f, 782.61f, "[2016, 5, 1]");
* 782.61f, 956.54f, 782.61f, 782.61f, "[2016, 5, 1]");
* *
* LoanDisbursementTestBuilder expectedRepaymentSchedule14 = new * LoanDisbursementTestBuilder expectedRepaymentSchedule14 = new LoanDisbursementTestBuilder( "[2016, 7, 1]",
* LoanDisbursementTestBuilder( "[2016, 7, 1]", 966.11f, 966.11f, 9.57f, * 966.11f, 966.11f, 9.57f, 956.54f, 0.0f, 956.54f, 956.54f, "[2016, 6, 1]");
* 956.54f, 0.0f, 956.54f, 956.54f, "[2016, 6, 1]");
* *
* ArrayList<LoanDisbursementTestBuilder> list = new * ArrayList<LoanDisbursementTestBuilder> list = new ArrayList<LoanDisbursementTestBuilder>();
* ArrayList<LoanDisbursementTestBuilder>(); * list.add(expectedRepaymentSchedule0); list.add(expectedRepaymentSchedule1); list.add(expectedRepaymentSchedule2);
* list.add(expectedRepaymentSchedule0); * list.add(expectedRepaymentSchedule3); list.add(expectedRepaymentSchedule4); list.add(expectedRepaymentSchedule5);
* list.add(expectedRepaymentSchedule1); * list.add(expectedRepaymentSchedule6); list.add(expectedRepaymentSchedule7); list.add(expectedRepaymentSchedule8);
* list.add(expectedRepaymentSchedule2); * list.add(expectedRepaymentSchedule9); list.add(expectedRepaymentSchedule10);
* list.add(expectedRepaymentSchedule3); * list.add(expectedRepaymentSchedule11); list.add(expectedRepaymentSchedule12);
* list.add(expectedRepaymentSchedule4); * list.add(expectedRepaymentSchedule13); list.add(expectedRepaymentSchedule14);
* list.add(expectedRepaymentSchedule5);
* list.add(expectedRepaymentSchedule6);
* list.add(expectedRepaymentSchedule7);
* list.add(expectedRepaymentSchedule8);
* list.add(expectedRepaymentSchedule9);
* list.add(expectedRepaymentSchedule10);
* list.add(expectedRepaymentSchedule11);
* list.add(expectedRepaymentSchedule12);
* list.add(expectedRepaymentSchedule13);
* list.add(expectedRepaymentSchedule14);
* *
* for (int i = 0; i < list.size(); i++) { * for (int i = 0; i < list.size(); i++) { this.assertRepaymentScheduleValuesWithoutEMI(periods.get(i), list.get(i),
* this.assertRepaymentScheduleValuesWithoutEMI(periods.get(i), list.get(i),
* i); } } * i); } }
* *
* private void assertRepaymentScheduleValuesWithoutEMI(HashMap period, * private void assertRepaymentScheduleValuesWithoutEMI(HashMap period, LoanDisbursementTestBuilder
* LoanDisbursementTestBuilder expectedRepaymentSchedule, int position) { * expectedRepaymentSchedule, int position) {
* *
* assertEquals(period.get("dueDate").toString(), * assertEquals(period.get("dueDate").toString(), expectedRepaymentSchedule.getDueDate());
* expectedRepaymentSchedule.getDueDate());
* assertEquals(period.get("principalLoanBalanceOutstanding"), * assertEquals(period.get("principalLoanBalanceOutstanding"),
* expectedRepaymentSchedule.getPrincipalLoanBalanceOutstanding()); * expectedRepaymentSchedule.getPrincipalLoanBalanceOutstanding());
* assertEquals(period.get("totalOriginalDueForPeriod"), * assertEquals(period.get("totalOriginalDueForPeriod"), expectedRepaymentSchedule.getTotalOriginalDueForPeriod());
* expectedRepaymentSchedule.getTotalOriginalDueForPeriod()); * assertEquals(period.get("totalOutstandingForPeriod"), expectedRepaymentSchedule.getTotalOutstandingForPeriod());
* assertEquals(period.get("totalOutstandingForPeriod"),
* expectedRepaymentSchedule.getTotalOutstandingForPeriod());
* *
* if (position != 0 && position != 3) { * if (position != 0 && position != 3) {
* *
* assertEquals(period.get("interestOutstanding"), * assertEquals(period.get("interestOutstanding"), expectedRepaymentSchedule.getInterestOutstanding());
* expectedRepaymentSchedule.getInterestOutstanding()); * assertEquals(period.get("principalOutstanding"), expectedRepaymentSchedule.getPrincipalOutstanding());
* assertEquals(period.get("principalOutstanding"), * assertEquals(period.get("principalDue"), expectedRepaymentSchedule.getPrincipalDue());
* expectedRepaymentSchedule.getPrincipalOutstanding()); * assertEquals(period.get("principalOriginalDue"), expectedRepaymentSchedule.getPrincipalOriginalDue());
* assertEquals(period.get("principalDue"), * assertEquals(period.get("fromDate").toString(), expectedRepaymentSchedule.getFromDate()); } }
* expectedRepaymentSchedule.getPrincipalDue());
* assertEquals(period.get("principalOriginalDue"),
* expectedRepaymentSchedule.getPrincipalOriginalDue());
* assertEquals(period.get("fromDate").toString(),
* expectedRepaymentSchedule.getFromDate()); } }
*/ */
private Integer applyForLoanApplicationWithEmiAmount(final Integer clientID, final Integer loanProductID, final String proposedAmount, private Integer applyForLoanApplicationWithEmiAmount(final Integer clientID, final Integer loanProductID, final String proposedAmount,
List<HashMap> tranches, final String installmentAmount) { List<HashMap> tranches, final String installmentAmount) {
@@ -37,8 +37,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Client Loan Integration Test for checking Loan Disbursement with Waive * Client Loan Integration Test for checking Loan Disbursement with Waive Interest and Write-Off.
* Interest and Write-Off.
*/ */
@SuppressWarnings({ "rawtypes" }) @SuppressWarnings({ "rawtypes" })
public class LoanWithWaiveInterestAndWriteOffIntegrationTest { public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
@@ -66,9 +66,8 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
} }
/* /*
* MinimumDaysBetweenDisbursalAndFirstRepayment is set to 7 days and days * MinimumDaysBetweenDisbursalAndFirstRepayment is set to 7 days and days between disbursal date and first repayment
* between disbursal date and first repayment is set as 7. system should * is set as 7. system should allow to create this loan and allow to disburse
* allow to create this loan and allow to disburse
*/ */
@Test @Test
public void createLoanEntity_WITH_DAY_BETWEEN_DISB_DATE_AND_REPAY_START_DATE_GREATER_THAN_MIN_DAY_CRITERIA() { public void createLoanEntity_WITH_DAY_BETWEEN_DISB_DATE_AND_REPAY_START_DATE_GREATER_THAN_MIN_DAY_CRITERIA() {
@@ -112,9 +111,8 @@ public class MinimumDaysBetweenDisbursalAndFirstRepaymentTest {
} }
/* /*
* MinimumDaysBetweenDisbursalAndFirstRepayment is set to 7 days and days * MinimumDaysBetweenDisbursalAndFirstRepayment is set to 7 days and days between disbursal date and first repayment
* between disbursal date and first repayment is set as 7. system should * is set as 7. system should allow to create this loan and allow to disburse
* allow to create this loan and allow to disburse
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test @Test
@@ -122,8 +122,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for Recurring Deposit Account premature closure with * Test case for Recurring Deposit Account premature closure with transaction type withdrawal and Cash Based
* transaction type withdrawal and Cash Based accounting enabled * accounting enabled
*/ */
@Test @Test
public void testRecurringDepositAccountWithPrematureClosureTypeWithdrawal() { public void testRecurringDepositAccountWithPrematureClosureTypeWithdrawal() {
@@ -208,8 +208,7 @@ public class RecurringDepositTest {
Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount"); Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount");
/*** /***
* Perform Deposit transaction and verify journal entries are posted for * Perform Deposit transaction and verify journal entries are posted for the transaction
* the transaction
*/ */
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE); depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
@@ -272,9 +271,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for Recurring Deposit Account premature closure with * Test case for Recurring Deposit Account premature closure with transaction transfers to savings account and Cash
* transaction transfers to savings account and Cash Based accounting * Based accounting enabled
* enabled
*/ */
@Test @Test
public void testRecurringDepositAccountWithPrematureClosureTypeTransferToSavings() { public void testRecurringDepositAccountWithPrematureClosureTypeTransferToSavings() {
@@ -388,8 +386,7 @@ public class RecurringDepositTest {
Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount"); Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount");
/*** /***
* Perform Deposit transaction and verify journal entries are posted for * Perform Deposit transaction and verify journal entries are posted for the transaction
* the transaction
*/ */
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE); depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
@@ -451,9 +448,8 @@ public class RecurringDepositTest {
recurringDepositAccountId); recurringDepositAccountId);
Float maturityAmount = Float.valueOf(recurringDepositAccountData.get("maturityAmount").toString()); Float maturityAmount = Float.valueOf(recurringDepositAccountData.get("maturityAmount").toString());
/*** /***
* Verify journal entry transactions for preclosure transaction As this * Verify journal entry transactions for preclosure transaction As this transaction is an account transfer you
* transaction is an account transfer you should get financial account * should get financial account mapping details and verify amounts
* mapping details and verify amounts
*/ */
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE, this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT), new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT),
@@ -592,8 +588,7 @@ public class RecurringDepositTest {
Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount"); Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount");
/*** /***
* Perform Deposit transaction and verify journal entries are posted for * Perform Deposit transaction and verify journal entries are posted for the transaction
* the transaction
*/ */
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE); depositAmount, EXPECTED_FIRST_DEPOSIT_ON_DATE);
@@ -656,9 +651,8 @@ public class RecurringDepositTest {
recurringDepositAccountId); recurringDepositAccountId);
Float maturityAmount = Float.valueOf(recurringDepositAccountData.get("maturityAmount").toString()); Float maturityAmount = Float.valueOf(recurringDepositAccountData.get("maturityAmount").toString());
/*** /***
* Verify journal entry transactions for preclosure transaction As this * Verify journal entry transactions for preclosure transaction As this transaction is an account transfer you
* transaction is an account transfer you should get financial account * should get financial account mapping details and verify amounts
* mapping details and verify amounts
*/ */
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE, this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, CLOSED_ON_DATE,
new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT), new JournalEntry(maturityAmount, JournalEntry.TransactionType.CREDIT),
@@ -804,8 +798,7 @@ public class RecurringDepositTest {
Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount"); Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount");
/*** /***
* Perform Deposit transaction and verify journal entries are posted for * Perform Deposit transaction and verify journal entries are posted for the transaction
* the transaction
*/ */
todaysDate = Calendar.getInstance(); todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.MONTH, -20); todaysDate.add(Calendar.MONTH, -20);
@@ -846,8 +839,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for Recurring Deposit Account premature closure with * Test case for Recurring Deposit Account premature closure with transaction type ReInvest and Cash Based
* transaction type ReInvest and Cash Based accounting enabled * accounting enabled
*/ */
@Test @Test
public void testRecurringDepositAccountWithPrematureClosureTypeReinvest() { public void testRecurringDepositAccountWithPrematureClosureTypeReinvest() {
@@ -941,8 +934,7 @@ public class RecurringDepositTest {
Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount"); Float depositAmount = (Float) recurringDepositAccountData.get("mandatoryRecommendedDepositAmount");
/*** /***
* Perform Deposit transaction and verify journal entries are posted for * Perform Deposit transaction and verify journal entries are posted for the transaction
* the transaction
*/ */
Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, Integer depositTransactionId = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE); DEPOSIT_AMOUNT, EXPECTED_FIRST_DEPOSIT_ON_DATE);
@@ -981,8 +973,7 @@ public class RecurringDepositTest {
.calculatePrematureAmountForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE); .calculatePrematureAmountForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE);
/*** /***
* Expected to get an error response from api because re-invest option * Expected to get an error response from api because re-invest option is not supported for account preClosure
* is not supported for account preClosure
*/ */
ArrayList<HashMap> errorResponse = (ArrayList<HashMap>) recurringDepositAccountHelperValidationError ArrayList<HashMap> errorResponse = (ArrayList<HashMap>) recurringDepositAccountHelperValidationError
.prematureCloseForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_REINVEST, null, .prematureCloseForRecurringDeposit(recurringDepositAccountId, CLOSED_ON_DATE, CLOSURE_TYPE_REINVEST, null,
@@ -1130,8 +1121,7 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for Closure of Recurring Deposit Account(Withdrawn by * Test case for Closure of Recurring Deposit Account(Withdrawn by applicant)
* applicant)
*/ */
@Test @Test
public void testRecurringDepositAccountWithdrawnByClientAndClosed() { public void testRecurringDepositAccountWithdrawnByClientAndClosed() {
@@ -1298,8 +1288,7 @@ public class RecurringDepositTest {
Float balanceBefore = (Float) recurringDepositSummaryBefore.get("accountBalance"); Float balanceBefore = (Float) recurringDepositSummaryBefore.get("accountBalance");
/*** /***
* Perform Deposit transaction and verify journal entries are posted for * Perform Deposit transaction and verify journal entries are posted for the transaction
* the transaction
*/ */
Integer transactionIdForDeposit = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId, Integer transactionIdForDeposit = this.recurringDepositAccountHelper.depositToRecurringDepositAccount(recurringDepositAccountId,
DEPOSIT_AMOUNT, DEPOSIT_DATE); DEPOSIT_AMOUNT, DEPOSIT_DATE);
@@ -1351,8 +1340,7 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify maturity amount with monthly compounding and monthly * Test case for verify maturity amount with monthly compounding and monthly posting with 365 days in year
* posting with 365 days in year
*/ */
@Test @Test
public void testMaturityAmountForMonthlyCompoundingAndMonthlyPosting_With_365_Days() { public void testMaturityAmountForMonthlyCompoundingAndMonthlyPosting_With_365_Days() {
@@ -1429,8 +1417,7 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify maturity amount with monthly compounding and monthly * Test case for verify maturity amount with monthly compounding and monthly posting with 360 days in year
* posting with 360 days in year
*/ */
@Test @Test
public void testMaturityAmountForMonthlyCompoundingAndMonthlyPosting_With_360_Days() { public void testMaturityAmountForMonthlyCompoundingAndMonthlyPosting_With_360_Days() {
@@ -1606,8 +1593,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify premature closure amount with penal interest for * Test case for verify premature closure amount with penal interest for whole term with closure transaction type
* whole term with closure transaction type withdrawal and 365 days in year * withdrawal and 365 days in year
*/ */
@Test @Test
public void testPrematureClosureAmountWithPenalInterestForWholeTerm_With_365_Days() { public void testPrematureClosureAmountWithPenalInterestForWholeTerm_With_365_Days() {
@@ -1731,8 +1718,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify premature closure amount with penal interest for * Test case for verify premature closure amount with penal interest for whole term with closure transaction type
* whole term with closure transaction type withdrawal and 360 days in year * withdrawal and 360 days in year
*/ */
@Test @Test
public void testPrematureClosureAmountWithPenalInterestForWholeTerm_With_360_Days() { public void testPrematureClosureAmountWithPenalInterestForWholeTerm_With_360_Days() {
@@ -1861,9 +1848,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify premature closure amount with penal interest till * Test case for verify premature closure amount with penal interest till maturity date with closure transaction
* maturity date with closure transaction type withdrawal and 365 days in * type withdrawal and 365 days in year
* year
*/ */
@Test @Test
public void testPrematureClosureAmountWithPenalInterestTillPrematureWithdrawal_With_365_Days() { public void testPrematureClosureAmountWithPenalInterestTillPrematureWithdrawal_With_365_Days() {
@@ -1999,9 +1985,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case verify premature closure amount with penal interest till * Test case verify premature closure amount with penal interest till maturity date with closure transaction type
* maturity date with closure transaction type withdrawal and 360 days in * withdrawal and 360 days in year
* year
*/ */
@Test @Test
public void testPrematureClosureAmountWithPenalInterestTillPrematureWithdrawal_With_360_Days() { public void testPrematureClosureAmountWithPenalInterestTillPrematureWithdrawal_With_360_Days() {
@@ -2142,8 +2127,7 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify maturity amount with daily compounding and monthly * Test case for verify maturity amount with daily compounding and monthly posting with 365 days in year
* posting with 365 days in year
*/ */
@Test @Test
public void testMaturityAmountForDailyCompoundingAndMonthlyPosting_With_365_Days() { public void testMaturityAmountForDailyCompoundingAndMonthlyPosting_With_365_Days() {
@@ -2224,8 +2208,7 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify maturity amount with daily compounding and monthly * Test case for verify maturity amount with daily compounding and monthly posting with 360 days in year
* posting with 360 days in year
*/ */
@Test @Test
public void testMaturityAmountForDailyCompoundingAndMonthlyPosting_With_360_Days() { public void testMaturityAmountForDailyCompoundingAndMonthlyPosting_With_360_Days() {
@@ -2307,8 +2290,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify premature closure amount with Bi-annual interest * Test case for verify premature closure amount with Bi-annual interest compounding and Bi-annual interest posting
* compounding and Bi-annual interest posting with 365 days in year * with 365 days in year
*/ */
@Test @Test
public void testRecurringDepositWithBi_AnnualCompoundingAndPosting_365_Days() { public void testRecurringDepositWithBi_AnnualCompoundingAndPosting_365_Days() {
@@ -2397,8 +2380,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify premature closure amount with Bi-annual interest * Test case for verify premature closure amount with Bi-annual interest compounding and Bi-annual interest posting
* compounding and Bi-annual interest posting with 360 days in year * with 360 days in year
*/ */
@Test @Test
public void testRecurringDepositWithBi_AnnualCompoundingAndPosting_360_Days() { public void testRecurringDepositWithBi_AnnualCompoundingAndPosting_360_Days() {
@@ -2487,8 +2470,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify maturity amount with Daily interest compounding and * Test case for verify maturity amount with Daily interest compounding and annual interest posting with 365 days in
* annual interest posting with 365 days in year * year
*/ */
@Test @Test
public void testMaturityAmountForDailyCompoundingAndAnnuallyPosting_With_365_Days() { public void testMaturityAmountForDailyCompoundingAndAnnuallyPosting_With_365_Days() {
@@ -2577,8 +2560,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify maturity amount with Daily interest compounding and * Test case for verify maturity amount with Daily interest compounding and annual interest posting with 360 days in
* annual interest posting with 360 days in year * year
*/ */
@Test @Test
public void testMaturityAmountForDailyCompoundingAndAnnuallyPosting_With_360_Days() { public void testMaturityAmountForDailyCompoundingAndAnnuallyPosting_With_360_Days() {
@@ -2667,8 +2650,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify premature closure amount with Quarterly interest * Test case for verify premature closure amount with Quarterly interest compounding and Quarterly interest posting
* compounding and Quarterly interest posting with 365 days in year * with 365 days in year
*/ */
@Test @Test
public void testRecurringDepositQuarterlyCompoundingAndQuarterlyPosting_365_Days() { public void testRecurringDepositQuarterlyCompoundingAndQuarterlyPosting_365_Days() {
@@ -2757,8 +2740,8 @@ public class RecurringDepositTest {
} }
/*** /***
* Test case for verify premature closure amount with Quarterly interest * Test case for verify premature closure amount with Quarterly interest compounding and Quarterly interest posting
* compounding and Quarterly interest posting with 360 days in year * with 360 days in year
*/ */
@Test @Test
public void testRecurringDepositQuarterlyCompoundingAndQuarterlyPosting_360_Days() { public void testRecurringDepositQuarterlyCompoundingAndQuarterlyPosting_360_Days() {
@@ -3112,8 +3095,7 @@ public class RecurringDepositTest {
List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec); List<HashMap> financialActivities = this.financialActivityAccountHelper.getAllFinancialActivityAccounts(this.responseSpec);
final Account financialAccount; final Account financialAccount;
/*** /***
* if no financial activities are defined for account transfers, create * if no financial activities are defined for account transfers, create liability financial accounting mappings
* liability financial accounting mappings
*/ */
if (financialActivities.isEmpty()) { if (financialActivities.isEmpty()) {
financialAccount = createLiabilityFinancialAccountTransferType(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID); financialAccount = createLiabilityFinancialAccountTransferType(LIABILITY_TRANSFER_FINANCIAL_ACTIVITY_ID);
@@ -28,8 +28,7 @@ import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
/** /**
* Client Loan Integration Test for checking Loan Application Repayment * Client Loan Integration Test for checking Loan Application Repayment Schedule.
* Schedule.
*/ */
@SuppressWarnings({ "rawtypes", "unchecked" }) @SuppressWarnings({ "rawtypes", "unchecked" })
public class SurveyIntegrationTest { public class SurveyIntegrationTest {
@@ -32,9 +32,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Helper class for {@link org.apache.fineract.integrationtests.BatchApiTest}. * Helper class for {@link org.apache.fineract.integrationtests.BatchApiTest}. It takes care of creation of
* It takes care of creation of {@code BatchRequest} list and posting this list * {@code BatchRequest} list and posting this list to the server.
* to the server.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -81,9 +80,8 @@ public final class BatchHelper {
} }
/** /**
* Returns a list of BatchResponse with query parameter enclosing * Returns a list of BatchResponse with query parameter enclosing transaction set to false by posting the jsonified
* transaction set to false by posting the jsonified BatchRequest to the * BatchRequest to the server.
* server.
* *
* @param requestSpec * @param requestSpec
* @param responseSpec * @param responseSpec
@@ -97,9 +95,8 @@ public final class BatchHelper {
} }
/** /**
* Returns a list of BatchResponse with query parameter enclosing * Returns a list of BatchResponse with query parameter enclosing transaction set to true by posting the jsonified
* transaction set to true by posting the jsonified BatchRequest to the * BatchRequest to the server.
* server.
* *
* @param requestSpec * @param requestSpec
* @param responseSpec * @param responseSpec
@@ -113,8 +110,7 @@ public final class BatchHelper {
} }
/** /**
* Returns a BatchResponse based on the given BatchRequest, by posting the * Returns a BatchResponse based on the given BatchRequest, by posting the request to the server.
* request to the server.
* *
* @param BatchRequest * @param BatchRequest
* @return List<BatchResponse> * @return List<BatchResponse>
@@ -137,9 +133,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.CreateClientCommandStrategy} Request as
* {@link org.apache.fineract.batch.command.internal.CreateClientCommandStrategy} * one of the request in Batch.
* Request as one of the request in Batch.
* *
* @param reqId * @param reqId
* @param externalId * @param externalId
@@ -168,9 +163,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.CreateClientCommandStrategy} Request as
* {@link org.apache.fineract.batch.command.internal.CreateClientCommandStrategy} * one of the request in Batch.
* Request as one of the request in Batch.
* *
* @param reqId * @param reqId
* @param externalId * @param externalId
@@ -200,9 +194,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.UpdateClientCommandStrategy} Request with
* {@link org.apache.fineract.batch.command.internal.UpdateClientCommandStrategy} * given requestId and reference.
* Request with given requestId and reference.
* *
* @param reqId * @param reqId
* @param clientId * @param clientId
@@ -222,9 +215,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.ApplyLoanCommandStrategy} Request with
* {@link org.apache.fineract.batch.command.internal.ApplyLoanCommandStrategy} * given requestId and reference.
* Request with given requestId and reference.
* *
* @param requestId * @param requestId
* @param reference * @param reference
@@ -253,9 +245,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.ApplySavingsCommandStrategy} Request with
* {@link org.apache.fineract.batch.command.internal.ApplySavingsCommandStrategy} * given requestId and reference.
* Request with given requestId and reference.
* *
* @param requestId * @param requestId
* @param reference * @param reference
@@ -279,9 +270,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.CreateChargeCommandStrategy} Request with
* {@link org.apache.fineract.batch.command.internal.CreateChargeCommandStrategy} * given requestId and reference
* Request with given requestId and reference
* *
* @param requestId * @param requestId
* @param reference * @param reference
@@ -303,9 +293,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.CollectChargesCommandStrategy} Request
* {@link org.apache.fineract.batch.command.internal.CollectChargesCommandStrategy} * with given requestId and reference.
* Request with given requestId and reference.
* *
* @param requestId * @param requestId
* @param reference * @param reference
@@ -325,9 +314,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.ActivateClientCommandStrategy} Request
* {@link org.apache.fineract.batch.command.internal.ActivateClientCommandStrategy} * with given requestId and reference.
* Request with given requestId and reference.
* *
* *
* @param requestId * @param requestId
@@ -348,9 +336,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy} Request with
* {@link org.apache.fineract.batch.command.internal.ApproveLoanCommandStrategy} * given requestId and reference.
* Request with given requestId and reference.
* *
* *
* @param requestId * @param requestId
@@ -371,9 +358,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy} Request with
* {@link org.apache.fineract.batch.command.internal.DisburseLoanCommandStrategy} * given requestId and reference.
* Request with given requestId and reference.
* *
* *
* @param requestId * @param requestId
@@ -393,9 +379,8 @@ public final class BatchHelper {
} }
/** /**
* Creates and returns a * Creates and returns a {@link org.apache.fineract.batch.command.internal.RepayLoanCommandStrategy} Request with
* {@link org.apache.fineract.batch.command.internal.RepayLoanCommandStrategy} * given requestId.
* Request with given requestId.
* *
* *
* @param requestId * @param requestId
@@ -416,8 +401,7 @@ public final class BatchHelper {
} }
/** /**
* Checks that the client with given externalId is not created on the * Checks that the client with given externalId is not created on the server.
* server.
* *
* @param requestSpec * @param requestSpec
* @param responseSpec * @param responseSpec
@@ -66,9 +66,8 @@ public class ClientChargesTest {
Assertions.assertNotNull(clientId); Assertions.assertNotNull(clientId);
/** /**
* create a charge for loan and try to associate to client created in * create a charge for loan and try to associate to client created in the above lines.it will be an invalid
* the above lines.it will be an invalid scenario the reason is client * scenario the reason is client is not allowed to have only client charge.
* is not allowed to have only client charge.
* *
*/ */
final Integer loanChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec, final Integer loanChargeId = ChargesHelper.createCharges(this.requestSpec, this.responseSpec,
@@ -80,8 +79,7 @@ public class ClientChargesTest {
Assertions.assertNull(clientLoanChargeId); Assertions.assertNull(clientLoanChargeId);
/** /**
* associates a clientCharge to a client and pay client charge for 10 * associates a clientCharge to a client and pay client charge for 10 USD--success scenario
* USD--success scenario
**/ **/
final Integer clientChargeId = ClientHelper.addChargesForClient(this.requestSpec, this.responseSpec, clientId, final Integer clientChargeId = ClientHelper.addChargesForClient(this.requestSpec, this.responseSpec, clientId,
ClientHelper.getSpecifiedDueDateChargesClientAsJSON(chargeId.toString(), "29 October 2011")); ClientHelper.getSpecifiedDueDateChargesClientAsJSON(chargeId.toString(), "29 October 2011"));
@@ -93,16 +91,15 @@ public class ClientChargesTest {
(float) 190.0); (float) 190.0);
/** /**
* Revert the paid client charge transaction by passing the * Revert the paid client charge transaction by passing the clientChargePaidTransactionId and ensure the same is
* clientChargePaidTransactionId and ensure the same is reverted. * reverted.
*/ */
final Integer undoTrxnId = ClientHelper.revertClientChargeTransaction(this.requestSpec, this.responseSpec, clientId.toString(), final Integer undoTrxnId = ClientHelper.revertClientChargeTransaction(this.requestSpec, this.responseSpec, clientId.toString(),
clientChargePaidTransactionId); clientChargePaidTransactionId);
Assertions.assertNotNull(undoTrxnId); Assertions.assertNotNull(undoTrxnId);
isReversedTransaction(clientId.toString(), undoTrxnId.toString()); isReversedTransaction(clientId.toString(), undoTrxnId.toString());
/** /**
* Now pay client charge for 20 USD and ensure the outstanding amount is * Now pay client charge for 20 USD and ensure the outstanding amount is updated properly
* updated properly
*/ */
ResponseSpecification responseSpecFailure = new ResponseSpecBuilder().expectStatusCode(400).build(); ResponseSpecification responseSpecFailure = new ResponseSpecBuilder().expectStatusCode(400).build();
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy"); DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
@@ -119,32 +116,28 @@ public class ClientChargesTest {
Assertions.assertNotNull(waiveOffClientChargeTransactionId); Assertions.assertNotNull(waiveOffClientChargeTransactionId);
/** /**
* Revert the waived off client charge transaction by passing the * Revert the waived off client charge transaction by passing the waiveOffClientChargeTransactionId and ensured
* waiveOffClientChargeTransactionId and ensured the transaction is * the transaction is reversed.
* reversed.
*/ */
final Integer undoWaiveTrxnId = ClientHelper.revertClientChargeTransaction(this.requestSpec, this.responseSpec, clientId.toString(), final Integer undoWaiveTrxnId = ClientHelper.revertClientChargeTransaction(this.requestSpec, this.responseSpec, clientId.toString(),
waiveOffClientChargeTransactionId); waiveOffClientChargeTransactionId);
Assertions.assertNotNull(undoWaiveTrxnId); Assertions.assertNotNull(undoWaiveTrxnId);
isReversedTransaction(clientId.toString(), undoWaiveTrxnId.toString()); isReversedTransaction(clientId.toString(), undoWaiveTrxnId.toString());
/** /**
* pay client charge before client activation date and ensured its a * pay client charge before client activation date and ensured its a failure test case
* failure test case
*/ */
final String responseId_activationDate_failure = ClientHelper.payChargesForClients(this.requestSpec, responseSpecFailure, clientId, final String responseId_activationDate_failure = ClientHelper.payChargesForClients(this.requestSpec, responseSpecFailure, clientId,
clientChargeId, ClientHelper.getPayChargeJSON("30 September 2011", "20")); clientChargeId, ClientHelper.getPayChargeJSON("30 September 2011", "20"));
Assertions.assertNull(responseId_activationDate_failure); Assertions.assertNull(responseId_activationDate_failure);
/** /**
* pay client charge more than outstanding amount amount and ensured its * pay client charge more than outstanding amount amount and ensured its a failure test case
* a failure test case
*/ */
final String responseId_moreAmount_failure = ClientHelper.payChargesForClients(this.requestSpec, responseSpecFailure, clientId, final String responseId_moreAmount_failure = ClientHelper.payChargesForClients(this.requestSpec, responseSpecFailure, clientId,
clientChargeId, ClientHelper.getPayChargeJSON("25 AUGUST 2015", "300")); clientChargeId, ClientHelper.getPayChargeJSON("25 AUGUST 2015", "300"));
Assertions.assertNull(responseId_moreAmount_failure); Assertions.assertNull(responseId_moreAmount_failure);
/** /**
* pay client charge for 10 USD and ensure outstanding amount is updated * pay client charge for 10 USD and ensure outstanding amount is updated properly
* properly
*/ */
final String chargePaid_responseId = ClientHelper.payChargesForClients(this.requestSpec, this.responseSpec, clientId, final String chargePaid_responseId = ClientHelper.payChargesForClients(this.requestSpec, this.responseSpec, clientId,
clientChargeId, ClientHelper.getPayChargeJSON("25 AUGUST 2015", "100")); clientChargeId, ClientHelper.getPayChargeJSON("25 AUGUST 2015", "100"));
@@ -168,8 +161,8 @@ public class ClientChargesTest {
} }
/** /**
* Check whether the outStandingAmount is equal to expected Amount or not * Check whether the outStandingAmount is equal to expected Amount or not after paying or after waiving off the
* after paying or after waiving off the client charge. * client charge.
* *
* @param outStandingAmount * @param outStandingAmount
* @param expectedAmount * @param expectedAmount
@@ -110,16 +110,13 @@ public class GlobalConfigurationHelper {
} }
/** /**
* Helper method to get the current default instance data of the * Helper method to get the current default instance data of the /configurations endpoint. Used to reset and verify
* /configurations endpoint. Used to reset and verify that no global * that no global configuration affects state between integration tests.
* configuration affects state between integration tests.
* *
* @see <a href= * @see <a href= "https://issues.apache.org/jira/browse/FINERACT-722">FINERACT-722</a> This is a quick, fail fast
* "https://issues.apache.org/jira/browse/FINERACT-722">FINERACT-722</a> * and early implementation to resolve this issue. TODO: A more robust future solution would be isolating all
* This is a quick, fail fast and early implementation to resolve this * integration test state using Spring Framework's integration test infrastructure for transaction commits and
* issue. TODO: A more robust future solution would be isolating all * rollbacks.
* integration test state using Spring Framework's integration test
* infrastructure for transaction commits and rollbacks.
*/ */
private static ArrayList<HashMap> getAllDefaultGlobalConfigurations() { private static ArrayList<HashMap> getAllDefaultGlobalConfigurations() {
@@ -142,9 +142,7 @@ public class SchedulerJobHelper {
* Launches a Job and awaits its completion. * Launches a Job and awaits its completion.
* *
* @param jobName * @param jobName
* displayName (see * displayName (see {@link org.apache.fineract.infrastructure.jobs.service.JobName}) of Scheduler Job
* {@link org.apache.fineract.infrastructure.jobs.service.JobName})
* of Scheduler Job
* *
* @author Michael Vorburger.ch * @author Michael Vorburger.ch
*/ */
@@ -45,8 +45,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Util for RestAssured tests. This class here in src/integrationTest is * Util for RestAssured tests. This class here in src/integrationTest is copy/pasted to src/test; please keep them in
* copy/pasted to src/test; please keep them in sync. * sync.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class Utils { public class Utils {
@@ -334,12 +334,10 @@ public class LoanApplicationTestBuilder {
} }
/** /**
* calendarID parameter is used to sync repayments with group meetings, * calendarID parameter is used to sync repayments with group meetings, especially when using jlg loans
* especially when using jlg loans
* *
* @param calendarId * @param calendarId
* the id of the calender record of the group meeting from * the id of the calender record of the group meeting from m_calendar table
* m_calendar table
* @return * @return
*/ */
public LoanApplicationTestBuilder withCalendarID(String calendarId) { public LoanApplicationTestBuilder withCalendarID(String calendarId) {
@@ -348,10 +346,8 @@ public class LoanApplicationTestBuilder {
} }
/** /**
* This indicator is used mainly for jlg loans when we want to sync * This indicator is used mainly for jlg loans when we want to sync disbursement with the group meetings (it seems
* disbursement with the group meetings (it seems that if we do use this * that if we do use this parameter we should also use calendarID to sync repayment with group meetings)
* parameter we should also use calendarID to sync repayment with group
* meetings)
* *
* @return * @return
*/ */
@@ -81,27 +81,18 @@ public class LoanDisbursementTestBuilder {
} }
/* /*
* public HashMap<String, String> build(String dueDate,String * public HashMap<String, String> build(String dueDate,String totalOriginalDueForPeriod,String
* totalOriginalDueForPeriod,String totalOutstandingForPeriod, String * totalOutstandingForPeriod, String interestOutstanding, String principalOutstanding, String
* interestOutstanding, String principalOutstanding, String * principalLoanBalanceOutstanding, String principalDue, String principalOriginalDue, String fromDate) {
* principalLoanBalanceOutstanding, String principalDue, String * HashMap<String, String> expectedRepaymentSchedule = new HashMap<String, String>();
* principalOriginalDue, String fromDate) { HashMap<String, String> * expectedRepaymentSchedule.put("dueDate", dueDate); expectedRepaymentSchedule.put("totalOriginalDueForPeriod",
* expectedRepaymentSchedule = new HashMap<String, String>(); * totalOriginalDueForPeriod); expectedRepaymentSchedule.put("totalOutstandingForPeriod",
* expectedRepaymentSchedule.put("dueDate", dueDate); * totalOutstandingForPeriod); expectedRepaymentSchedule.put("interestOutstanding", interestOutstanding);
* expectedRepaymentSchedule.put("totalOriginalDueForPeriod", * expectedRepaymentSchedule.put("principalOutstanding", principalOutstanding);
* totalOriginalDueForPeriod); * expectedRepaymentSchedule.put("principalLoanBalanceOutstanding", principalLoanBalanceOutstanding);
* expectedRepaymentSchedule.put("totalOutstandingForPeriod",
* totalOutstandingForPeriod);
* expectedRepaymentSchedule.put("interestOutstanding",
* interestOutstanding);
* expectedRepaymentSchedule.put("principalOutstanding",
* principalOutstanding);
* expectedRepaymentSchedule.put("principalLoanBalanceOutstanding",
* principalLoanBalanceOutstanding);
* expectedRepaymentSchedule.put("principalDue", principalDue); * expectedRepaymentSchedule.put("principalDue", principalDue);
* expectedRepaymentSchedule.put("principalOriginalDue", * expectedRepaymentSchedule.put("principalOriginalDue", principalOriginalDue);
* principalOriginalDue); expectedRepaymentSchedule.put("fromDate", * expectedRepaymentSchedule.put("fromDate", fromDate);
* fromDate);
* *
* return expectedRepaymentSchedule; } * return expectedRepaymentSchedule; }
*/ */
@@ -46,8 +46,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* Entity Datatable Checks Integration Test for checking Creation, Deletion and * Entity Datatable Checks Integration Test for checking Creation, Deletion and Retrieval of Entity-Datatable Check
* Retrieval of Entity-Datatable Check
*/ */
public class EntityDatatableChecksIntegrationTest { public class EntityDatatableChecksIntegrationTest {
@@ -29,16 +29,13 @@ import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource; import org.springframework.context.annotation.ImportResource;
/** /**
* Fineract main() application which launches Fineract in an embedded Tomcat * Fineract main() application which launches Fineract in an embedded Tomcat HTTP (using Spring Boot).
* HTTP (using Spring Boot).
* *
* The DataSource used is a to a "normal" external database (not use MariaDB4j). * The DataSource used is a to a "normal" external database (not use MariaDB4j). This DataSource can be configured with
* This DataSource can be configured with parameters, see * parameters, see {@link DataSourceProperties}.
* {@link DataSourceProperties}.
* *
* You can easily launch this via Debug as Java Application in your IDE - * You can easily launch this via Debug as Java Application in your IDE - without needing command line Gradle stuff, no
* without needing command line Gradle stuff, no need to build and deploy a WAR, * need to build and deploy a WAR, remote attachment etc.
* remote attachment etc.
* *
* It's the old/classic Mifos (non-X) Workspace 2.0 reborn for Fineract! ;-) * It's the old/classic Mifos (non-X) Workspace 2.0 reborn for Fineract! ;-)
* *
@@ -45,8 +45,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implementation of {@link FromApiJsonDeserializer} for * Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s.
* {@link GuarantorCommand}'s.
*/ */
@Component @Component
public final class AccrualAccountingDataValidator { public final class AccrualAccountingDataValidator {
@@ -29,8 +29,7 @@ final class GLClosuresApiResourceSwagger {
} }
/** /**
* TODO: describe where this belongs: {@link GLClosuresApiResource } * TODO: describe where this belongs: {@link GLClosuresApiResource } {@Link GLClosuresApiResource}
* {@Link GLClosuresApiResource}
*/ */
// Check !! // Check !!
@@ -26,8 +26,7 @@ import org.joda.time.LocalDate;
/** /**
* Immutable object representing a General Ledger Account * Immutable object representing a General Ledger Account
* *
* Note: no getter/setters required as google-gson will produce json from fields * Note: no getter/setters required as google-gson will produce json from fields of object.
* of object.
*/ */
public class GLClosureData { public class GLClosureData {
@@ -22,8 +22,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
/** /**
* A {@link RuntimeException} thrown when a GL Closure for a given date and * A {@link RuntimeException} thrown when a GL Closure for a given date and Office combination is already present
* Office combination is already present
*/ */
public class GLClosureDuplicateException extends AbstractPlatformDomainRuleException { public class GLClosureDuplicateException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.closure.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/** /**
* A {@link RuntimeException} thrown when GL account closure resources are not * A {@link RuntimeException} thrown when GL account closure resources are not found.
* found.
*/ */
public class GLClosureNotFoundException extends AbstractPlatformResourceNotFoundException { public class GLClosureNotFoundException extends AbstractPlatformResourceNotFoundException {
@@ -36,8 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implementation of {@link FromApiJsonDeserializer} for * Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s.
* {@link GuarantorCommand}'s.
*/ */
@Component @Component
public final class GLClosureCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<GLClosureCommand> { public final class GLClosureCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<GLClosureCommand> {
@@ -124,8 +124,7 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure
.orElseThrow(() -> new GLClosureNotFoundException(glClosureId)); .orElseThrow(() -> new GLClosureNotFoundException(glClosureId));
/** /**
* check if any closures are present for this branch at a later date * check if any closures are present for this branch at a later date than this closure date
* than this closure date
**/ **/
final Date closureDate = glClosure.getClosingDate(); final Date closureDate = glClosure.getClosingDate();
final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(glClosure.getOffice().getId()); final GLClosure latestGLClosure = this.glClosureRepository.getLatestGLClosureByBranch(glClosure.getOffice().getId());
@@ -102,8 +102,7 @@ public class AccountingConstants {
} }
/*** /***
* Enum of all accounting related input parameter names used while * Enum of all accounting related input parameter names used while creating/updating a loan product
* creating/updating a loan product
***/ ***/
public static enum LoanProductAccountingParams { public static enum LoanProductAccountingParams {
@@ -201,8 +200,7 @@ public class AccountingConstants {
} }
/*** /***
* Enum of all accounting related input parameter names used while * Enum of all accounting related input parameter names used while creating/updating a savings product
* creating/updating a savings product
***/ ***/
public static enum SavingProductAccountingParams { public static enum SavingProductAccountingParams {
@@ -374,8 +372,7 @@ public class AccountingConstants {
} }
/*** /***
* Enum of all accounting related input parameter names used while * Enum of all accounting related input parameter names used while creating/updating a savings product
* creating/updating a savings product
***/ ***/
public static enum SharesProductAccountingParams { public static enum SharesProductAccountingParams {
@@ -25,8 +25,7 @@ import org.springframework.stereotype.Service;
/** /**
* <p> * <p>
* Wrapper for {@link FinancialActivityAccountRepository} that adds NULL * Wrapper for {@link FinancialActivityAccountRepository} that adds NULL checking and Error handling capabilities
* checking and Error handling capabilities
* </p> * </p>
*/ */
@Service @Service
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.financialactivityaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/** /**
* A {@link RuntimeException} thrown when product to GL account mapping are not * A {@link RuntimeException} thrown when product to GL account mapping are not found.
* found.
*/ */
public class DuplicateFinancialActivityAccountFoundException extends AbstractPlatformDomainRuleException { public class DuplicateFinancialActivityAccountFoundException extends AbstractPlatformDomainRuleException {
@@ -23,8 +23,7 @@ import org.apache.fineract.accounting.glaccount.domain.GLAccount;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/** /**
* A {@link RuntimeException} thrown when product to GL account mapping are not * A {@link RuntimeException} thrown when product to GL account mapping are not found.
* found.
*/ */
public class FinancialActivityAccountInvalidException extends AbstractPlatformDomainRuleException { public class FinancialActivityAccountInvalidException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.financialactivityaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/** /**
* A {@link RuntimeException} thrown when product to GL account mapping are not * A {@link RuntimeException} thrown when product to GL account mapping are not found.
* found.
*/ */
public class FinancialActivityAccountNotFoundException extends AbstractPlatformResourceNotFoundException { public class FinancialActivityAccountNotFoundException extends AbstractPlatformResourceNotFoundException {
@@ -89,8 +89,7 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi
} }
/** /**
* Validate that the GL Account is appropriate for the particular Financial * Validate that the GL Account is appropriate for the particular Financial Activity Type
* Activity Type
**/ **/
private void validateFinancialActivityAndAccountMapping(FinancialActivityAccount financialActivityAccount) { private void validateFinancialActivityAndAccountMapping(FinancialActivityAccount financialActivityAccount) {
FinancialActivity financialActivity = FinancialActivity.fromInt(financialActivityAccount.getFinancialActivityType()); FinancialActivity financialActivity = FinancialActivity.fromInt(financialActivityAccount.getFinancialActivityType());
@@ -30,8 +30,7 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData;
/** /**
* Immutable object representing a General Ledger Account * Immutable object representing a General Ledger Account
* *
* Note: no getter/setters required as google-gson will produce json from fields * Note: no getter/setters required as google-gson will produce json from fields of object.
* of object.
*/ */
public class GLAccountData implements Serializable { public class GLAccountData implements Serializable {
@@ -22,8 +22,7 @@ import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainR
/** /**
* *
* when gl account is attached with any product(loan/saving) then we can not * when gl account is attached with any product(loan/saving) then we can not disable the gl account
* disable the gl account
*/ */
public class GLAccountDisableException extends AbstractPlatformDomainRuleException { public class GLAccountDisableException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/** /**
* A {@link RuntimeException} thrown when a GL Account with a given GL Code of * A {@link RuntimeException} thrown when a GL Account with a given GL Code of the particular type is already present
* the particular type is already present
*/ */
public class GLAccountDuplicateException extends AbstractPlatformDomainRuleException { public class GLAccountDuplicateException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/** /**
* A {@link RuntimeException} thrown when trying to fetch accounts belonging to * A {@link RuntimeException} thrown when trying to fetch accounts belonging to an Invalid Usage Type
* an Invalid Usage Type
*/ */
public class GLAccountInvalidClassificationException extends AbstractPlatformDomainRuleException { public class GLAccountInvalidClassificationException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/** /**
* A {@link RuntimeException} thrown when a GL Account with a given GL Code of * A {@link RuntimeException} thrown when a GL Account with a given GL Code of the particular type is already present
* the particular type is already present
*/ */
public class GLAccountInvalidDeleteException extends AbstractPlatformDomainRuleException { public class GLAccountInvalidDeleteException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/** /**
* A {@link RuntimeException} thrown when trying to map invalid parents to a GL * A {@link RuntimeException} thrown when trying to map invalid parents to a GL account
* account
*/ */
public class GLAccountInvalidParentException extends AbstractPlatformDomainRuleException { public class GLAccountInvalidParentException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/** /**
* A {@link RuntimeException} thrown when an error is encountered during * A {@link RuntimeException} thrown when an error is encountered during updating a GL Account
* updating a GL Account
*/ */
public class GLAccountInvalidUpdateException extends AbstractPlatformDomainRuleException { public class GLAccountInvalidUpdateException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.glaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/** /**
* A {@link RuntimeException} thrown when trying to fetch accounts belonging to * A {@link RuntimeException} thrown when trying to fetch accounts belonging to an Invalid Type
* an Invalid Type
*/ */
public class GLAccountInvalidUsageException extends AbstractPlatformDomainRuleException { public class GLAccountInvalidUsageException extends AbstractPlatformDomainRuleException {
@@ -35,8 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implementation of {@link FromApiJsonDeserializer} for * Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s.
* {@link GuarantorCommand}'s.
*/ */
@Component @Component
public final class GLAccountCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<GLAccountCommand> { public final class GLAccountCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<GLAccountCommand> {
@@ -151,8 +151,7 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount
} }
/** /**
* a detail account cannot be changed to a header account if * a detail account cannot be changed to a header account if transactions are already logged against it
* transactions are already logged against it
**/ **/
if (changesOnly.containsKey(GLAccountJsonInputParams.USAGE.getValue())) { if (changesOnly.containsKey(GLAccountJsonInputParams.USAGE.getValue())) {
if (glAccount.isHeaderAccount()) { if (glAccount.isHeaderAccount()) {
@@ -28,8 +28,7 @@ import org.joda.time.LocalDate;
/** /**
* Immutable object representing a General Ledger Account * Immutable object representing a General Ledger Account
* *
* Note: no getter/setters required as google will produce json from fields of * Note: no getter/setters required as google will produce json from fields of object.
* object.
*/ */
public class JournalEntryData { public class JournalEntryData {
@@ -46,13 +46,11 @@ public interface JournalEntryRepository
* @Query("select journalEntry from JournalEntry journalEntry where glAccount.id= :accountId and transactionId= :transactionId and transactionDate= :transactionDate" * @Query("select journalEntry from JournalEntry journalEntry where glAccount.id= :accountId and transactionId= :transactionId and transactionDate= :transactionDate"
* + * +
* " and type= :journalEntryType and entityType=1 and entityId= :loanId and loanTransaction.id= :loanTransactionId" * " and type= :journalEntryType and entityType=1 and entityId= :loanId and loanTransaction.id= :loanTransactionId"
* ) JournalEntry findLOANJournalEntryWith(@Param("accountId") Long * ) JournalEntry findLOANJournalEntryWith(@Param("accountId") Long accountId, @Param("transactionId") String
* accountId, @Param("transactionId") String transactionId, * transactionId,
* *
* @Param("transactionDate") Date * @Param("transactionDate") Date transactionDate, @Param("journalEntryType") Integer journalEntryType,
* transactionDate, @Param("journalEntryType") Integer journalEntryType,
* *
* @Param("loanId") Long loanId, @Param("loanTransactionId") Long * @Param("loanId") Long loanId, @Param("loanTransactionId") Long loanTransactionId);
* loanTransactionId);
*/ */
} }
@@ -41,8 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implementation of {@link FromApiJsonDeserializer} for * Implementation of {@link FromApiJsonDeserializer} for {@link JournalEntryCommand}'s.
* {@link JournalEntryCommand}'s.
*/ */
@Component @Component
public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<JournalEntryCommand> { public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<JournalEntryCommand> {
@@ -34,9 +34,8 @@ public class AccountingProcessorForSavingsFactory {
} }
/*** /***
* Looks like overkill for now, but wanted to keep the savings side of * Looks like overkill for now, but wanted to keep the savings side of accounting identical to that of Loans (would
* accounting identical to that of Loans (would we need an Accrual based * we need an Accrual based accounting in the future?)
* accounting in the future?)
***/ ***/
public AccountingProcessorForSavings determineProcessor(final SavingsDTO savingsDTO) { public AccountingProcessorForSavings determineProcessor(final SavingsDTO savingsDTO) {
@@ -338,11 +338,9 @@ public class AccountingProcessorHelper {
} }
/** /**
* Convenience method that creates a pair of related Debits and Credits for * Convenience method that creates a pair of related Debits and Credits for Accrual Based accounting.
* Accrual Based accounting.
* *
* The target accounts for debits and credits are switched in case of a * The target accounts for debits and credits are switched in case of a reversal
* reversal
* *
* @param office * @param office
* @param accountTypeToBeDebited * @param accountTypeToBeDebited
@@ -372,11 +370,9 @@ public class AccountingProcessorHelper {
} }
/** /**
* Convenience method that creates a pair of related Debits and Credits for * Convenience method that creates a pair of related Debits and Credits for Accrual Based accounting.
* Accrual Based accounting.
* *
* The target accounts for debits and credits are switched in case of a * The target accounts for debits and credits are switched in case of a reversal
* reversal
* *
* @param office * @param office
* office * office
@@ -445,11 +441,9 @@ public class AccountingProcessorHelper {
} }
/** /**
* Convenience method that creates a pair of related Debits and Credits for * Convenience method that creates a pair of related Debits and Credits for Cash Based accounting.
* Cash Based accounting.
* *
* The target accounts for debits and credits are switched in case of a * The target accounts for debits and credits are switched in case of a reversal
* reversal
* *
* @param office * @param office
* @param accountTypeToBeDebited * @param accountTypeToBeDebited
@@ -480,11 +474,9 @@ public class AccountingProcessorHelper {
} }
/** /**
* Convenience method that creates a pair of related Debits and Credits for * Convenience method that creates a pair of related Debits and Credits for Cash Based accounting.
* Cash Based accounting.
* *
* The target accounts for debits and credits are switched in case of a * The target accounts for debits and credits are switched in case of a reversal
* reversal
* *
* @param office * @param office
* @param accountTypeToBeDebited * @param accountTypeToBeDebited
@@ -535,8 +527,7 @@ public class AccountingProcessorHelper {
*/ */
public void checkForBranchClosures(final GLClosure latestGLClosure, final Date transactionDate) { public void checkForBranchClosures(final GLClosure latestGLClosure, final Date transactionDate) {
/** /**
* check if an accounting closure has happened for this branch after the * check if an accounting closure has happened for this branch after the transaction Date
* transaction Date
**/ **/
if (latestGLClosure != null) { if (latestGLClosure != null) {
if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().equals(transactionDate)) { if (latestGLClosure.getClosingDate().after(transactionDate) || latestGLClosure.getClosingDate().equals(transactionDate)) {
@@ -573,11 +564,9 @@ public class AccountingProcessorHelper {
} }
/** /**
* Convenience method that creates a pair of related Debits and Credits for * Convenience method that creates a pair of related Debits and Credits for Cash Based accounting.
* Cash Based accounting.
* *
* The target accounts for debits and credits are switched in case of a * The target accounts for debits and credits are switched in case of a reversal
* reversal
* *
* @param office * @param office
* @param currencyCode * @param currencyCode
@@ -695,8 +684,7 @@ public class AccountingProcessorHelper {
final Date transactionDate, final BigDecimal totalAmount, final Boolean isReversal, final Date transactionDate, final BigDecimal totalAmount, final Boolean isReversal,
final List<ChargePaymentDTO> chargePaymentDTOs) { final List<ChargePaymentDTO> chargePaymentDTOs) {
/*** /***
* Map to track each account and the net credit to be made for a * Map to track each account and the net credit to be made for a particular account
* particular account
***/ ***/
final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>(); final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>();
for (final ChargePaymentDTO chargePaymentDTO : chargePaymentDTOs) { for (final ChargePaymentDTO chargePaymentDTO : chargePaymentDTOs) {
@@ -736,11 +724,9 @@ public class AccountingProcessorHelper {
} }
/** /**
* Convenience method that creates a pair of related Debits and Credits for * Convenience method that creates a pair of related Debits and Credits for Cash Based accounting.
* Cash Based accounting.
* *
* The target accounts for debits and credits are switched in case of a * The target accounts for debits and credits are switched in case of a reversal
* reversal
* *
* @param office * @param office
* office * office
@@ -775,10 +761,9 @@ public class AccountingProcessorHelper {
// TODO Vishwas: Remove this validation, as and when appropriate Junit // TODO Vishwas: Remove this validation, as and when appropriate Junit
// tests are written for accounting // tests are written for accounting
/** /**
* Accounting module currently supports a single charge per transaction, * Accounting module currently supports a single charge per transaction, throw an error if this is not the case
* throw an error if this is not the case here so any developers * here so any developers changing the expected portfolio behavior would also take care of modifying the
* changing the expected portfolio behavior would also take care of * accounting code appropriately
* modifying the accounting code appropriately
**/ **/
if (chargePaymentDTOs.size() != 1) { if (chargePaymentDTOs.size() != 1) {
throw new PlatformDataIntegrityException("Recent Portfolio changes w.r.t Charges for Savings have Broken the accounting code", throw new PlatformDataIntegrityException("Recent Portfolio changes w.r.t Charges for Savings have Broken the accounting code",
@@ -1124,9 +1109,8 @@ public class AccountingProcessorHelper {
PortfolioProductType.LOAN.getValue(), accountMappingTypeId); PortfolioProductType.LOAN.getValue(), accountMappingTypeId);
/**** /****
* Get more specific mapping for FUND source accounts (based on * Get more specific mapping for FUND source accounts (based on payment channels). Note that fund source
* payment channels). Note that fund source placeholder ID would be * placeholder ID would be same for both cash and accrual accounts
* same for both cash and accrual accounts
***/ ***/
if (accountMappingTypeId == CashAccountsForLoan.FUND_SOURCE.getValue()) { if (accountMappingTypeId == CashAccountsForLoan.FUND_SOURCE.getValue()) {
final ProductToGLAccountMapping paymentChannelSpecificAccountMapping = this.accountMappingRepository final ProductToGLAccountMapping paymentChannelSpecificAccountMapping = this.accountMappingRepository
@@ -1150,10 +1134,9 @@ public class AccountingProcessorHelper {
ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(loanProductId, ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(loanProductId,
PortfolioProductType.LOAN.getValue(), accountMappingTypeId); PortfolioProductType.LOAN.getValue(), accountMappingTypeId);
/***** /*****
* Get more specific mappings for Charges and penalties (based on the * Get more specific mappings for Charges and penalties (based on the actual charge /penalty coupled with the
* actual charge /penalty coupled with the loan product). Note the * loan product). Note the income from fees and income from penalties placeholder ID would be the same for both
* income from fees and income from penalties placeholder ID would be * cash and accrual based accounts
* the same for both cash and accrual based accounts
*****/ *****/
// Vishwas TODO: remove this condition as it should always be true // Vishwas TODO: remove this condition as it should always be true
@@ -1174,10 +1157,9 @@ public class AccountingProcessorHelper {
ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(savingsProductId, ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(savingsProductId,
PortfolioProductType.SAVING.getValue(), accountMappingTypeId); PortfolioProductType.SAVING.getValue(), accountMappingTypeId);
/***** /*****
* Get more specific mappings for Charges and penalties (based on the * Get more specific mappings for Charges and penalties (based on the actual charge /penalty coupled with the
* actual charge /penalty coupled with the loan product). Note the * loan product). Note the income from fees and income from penalties placeholder ID would be the same for both
* income from fees and income from penalties placeholder ID would be * cash and accrual based accounts
* the same for both cash and accrual based accounts
*****/ *****/
// Vishwas TODO: remove this condition as it should always be true // Vishwas TODO: remove this condition as it should always be true
@@ -1204,9 +1186,8 @@ public class AccountingProcessorHelper {
ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(savingsProductId, ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(savingsProductId,
PortfolioProductType.SAVING.getValue(), accountMappingTypeId); PortfolioProductType.SAVING.getValue(), accountMappingTypeId);
/**** /****
* Get more specific mapping for FUND source accounts (based on * Get more specific mapping for FUND source accounts (based on payment channels). Note that fund source
* payment channels). Note that fund source placeholder ID would be * placeholder ID would be same for both cash and accrual accounts
* same for both cash and accrual accounts
***/ ***/
if (accountMappingTypeId == CashAccountsForSavings.SAVINGS_REFERENCE.getValue()) { if (accountMappingTypeId == CashAccountsForSavings.SAVINGS_REFERENCE.getValue()) {
final ProductToGLAccountMapping paymentChannelSpecificAccountMapping = this.accountMappingRepository final ProductToGLAccountMapping paymentChannelSpecificAccountMapping = this.accountMappingRepository
@@ -1249,10 +1230,9 @@ public class AccountingProcessorHelper {
ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(shareProductId, ProductToGLAccountMapping accountMapping = this.accountMappingRepository.findCoreProductToFinAccountMapping(shareProductId,
PortfolioProductType.SHARES.getValue(), accountMappingTypeId); PortfolioProductType.SHARES.getValue(), accountMappingTypeId);
/***** /*****
* Get more specific mappings for Charges and penalties (based on the * Get more specific mappings for Charges and penalties (based on the actual charge /penalty coupled with the
* actual charge /penalty coupled with the loan product). Note the * loan product). Note the income from fees and income from penalties placeholder ID would be the same for both
* income from fees and income from penalties placeholder ID would be * cash and accrual based accounts
* the same for both cash and accrual based accounts
*****/ *****/
final ProductToGLAccountMapping chargeSpecificIncomeAccountMapping = this.accountMappingRepository final ProductToGLAccountMapping chargeSpecificIncomeAccountMapping = this.accountMappingRepository
@@ -1276,8 +1256,7 @@ public class AccountingProcessorHelper {
final Long clientId, final Long transactionId, final Date transactionDate, final Boolean isReversal, final Long clientId, final Long transactionId, final Date transactionDate, final Boolean isReversal,
final List<ClientChargePaymentDTO> clientChargePaymentDTOs) { final List<ClientChargePaymentDTO> clientChargePaymentDTOs) {
/*** /***
* Map to track each account affected and the net credit to be made for * Map to track each account affected and the net credit to be made for a particular account
* a particular account
***/ ***/
final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>(); final Map<GLAccount, BigDecimal> creditDetailsMap = new LinkedHashMap<>();
for (final ClientChargePaymentDTO clientChargePaymentDTO : clientChargePaymentDTOs) { for (final ClientChargePaymentDTO clientChargePaymentDTO : clientChargePaymentDTOs) {
@@ -65,8 +65,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
} }
/*** /***
* Handle repayments, repayments at disbursement and reversal of * Handle repayments, repayments at disbursement and reversal of Repayments and Repayments at disbursement
* Repayments and Repayments at disbursement
***/ ***/
else if (loanTransactionDTO.getTransactionType().isRepayment() else if (loanTransactionDTO.getTransactionType().isRepayment()
|| loanTransactionDTO.getTransactionType().isRepaymentAtDisbursement() || loanTransactionDTO.getTransactionType().isRepaymentAtDisbursement()
@@ -144,35 +143,27 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
* <br/> * <br/>
* <br/> * <br/>
* *
* <b>Principal Repayment</b>: Debits "Fund Source" and Credits "Loan * <b>Principal Repayment</b>: Debits "Fund Source" and Credits "Loan Portfolio"<br/>
* Portfolio"<br/>
* *
* <b>Interest Repayment</b>:Debits "Fund Source" and and Credits * <b>Interest Repayment</b>:Debits "Fund Source" and and Credits "Receivable Interest" <br/>
* "Receivable Interest" <br/>
* *
* <b>Fee Repayment</b>:Debits "Fund Source" (or "Interest on Loans" in case * <b>Fee Repayment</b>:Debits "Fund Source" (or "Interest on Loans" in case of repayment at disbursement) and and
* of repayment at disbursement) and and Credits "Receivable Fees" <br/> * Credits "Receivable Fees" <br/>
* *
* <b>Penalty Repayment</b>: Debits "Fund Source" and and Credits * <b>Penalty Repayment</b>: Debits "Fund Source" and and Credits "Receivable Penalties" <br/>
* "Receivable Penalties" <br/>
* <br/> * <br/>
* Handles write offs using the following posting rules <br/> * Handles write offs using the following posting rules <br/>
* <br/> * <br/>
* <b>Principal Write off</b>: Debits "Losses Written Off" and Credits "Loan * <b>Principal Write off</b>: Debits "Losses Written Off" and Credits "Loan Portfolio"<br/>
* Portfolio"<br/>
* *
* <b>Interest Write off</b>:Debits "Losses Written off" and and Credits * <b>Interest Write off</b>:Debits "Losses Written off" and and Credits "Receivable Interest" <br/>
* "Receivable Interest" <br/>
* *
* <b>Fee Write off</b>:Debits "Losses Written off" and and Credits * <b>Fee Write off</b>:Debits "Losses Written off" and and Credits "Receivable Fees" <br/>
* "Receivable Fees" <br/>
* *
* <b>Penalty Write off</b>: Debits "Losses Written off" and and Credits * <b>Penalty Write off</b>: Debits "Losses Written off" and and Credits "Receivable Penalties" <br/>
* "Receivable Penalties" <br/>
* <br/> * <br/>
* <br/> * <br/>
* In case the loan transaction has been reversed, all debits are turned * In case the loan transaction has been reversed, all debits are turned into credits and vice versa
* into credits and vice versa
* *
* @param loanTransactionDTO * @param loanTransactionDTO
* @param loanDTO * @param loanDTO
@@ -289,8 +280,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
} }
/** /**
* Single DEBIT transaction for write-offs or Repayments (and their * Single DEBIT transaction for write-offs or Repayments (and their reversals)
* reversals)
***/ ***/
if (!(totalDebitAmount.compareTo(BigDecimal.ZERO) == 0)) { if (!(totalDebitAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (writeOff) { if (writeOff) {
@@ -315,11 +305,9 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
} }
/** /**
* Create a single Debit to fund source and a single credit to "Income from * Create a single Debit to fund source and a single credit to "Income from Recovery"
* Recovery"
* *
* In case the loan transaction is a reversal, all debits are turned into * In case the loan transaction is a reversal, all debits are turned into credits and vice versa
* credits and vice versa
*/ */
private void createJournalEntriesForRecoveryRepayments(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO, private void createJournalEntriesForRecoveryRepayments(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO,
final Office office) { final Office office) {
@@ -345,11 +333,9 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
* Recognize the receivable interest <br/> * Recognize the receivable interest <br/>
* Debit "Interest Receivable" and Credit "Income from Interest" * Debit "Interest Receivable" and Credit "Income from Interest"
* *
* <b>Fees:</b> Debit <i>Fees Receivable</i> and credit <i>Income from * <b>Fees:</b> Debit <i>Fees Receivable</i> and credit <i>Income from Fees</i> <br/>
* Fees</i> <br/>
* *
* <b>Penalties:</b> Debit <i>Penalties Receivable</i> and credit <i>Income * <b>Penalties:</b> Debit <i>Penalties Receivable</i> and credit <i>Income from Penalties</i>
* from Penalties</i>
* *
* Also handles reversals for both fees and payment applications * Also handles reversals for both fees and payment applications
* *
@@ -52,11 +52,10 @@ public class CashBasedAccountingProcessorForClientTransactions implements Accoun
} }
/** /**
* Create a single debit to fund source and multiple credits for the income * Create a single debit to fund source and multiple credits for the income account mapped with each charge this
* account mapped with each charge this payment pays off * payment pays off
* *
* In case the loan transaction is a reversal, all debits are turned into * In case the loan transaction is a reversal, all debits are turned into credits and vice versa
* credits and vice versa
*/ */
private void createJournalEntriesForChargePayments(final ClientTransactionDTO clientTransactionDTO, final Office office) { private void createJournalEntriesForChargePayments(final ClientTransactionDTO clientTransactionDTO, final Office office) {
// client properties // client properties
@@ -74,9 +73,8 @@ public class CashBasedAccountingProcessorForClientTransactions implements Accoun
transactionId, transactionDate, isReversal, clientTransactionDTO.getChargePayments()); transactionId, transactionDate, isReversal, clientTransactionDTO.getChargePayments());
/*** /***
* create a single Debit entry (or reversal) for the entire amount * create a single Debit entry (or reversal) for the entire amount that was credited (accounting is turned
* that was credited (accounting is turned on at the level of for * on at the level of for each charge that has been paid by this transaction)
* each charge that has been paid by this transaction)
**/ **/
this.helper.createDebitJournalEntryOrReversalForClientChargePayments(office, currencyCode, clientId, transactionId, this.helper.createDebitJournalEntryOrReversalForClientChargePayments(office, currencyCode, clientId, transactionId,
transactionDate, totalCreditedAmount, isReversal); transactionDate, totalCreditedAmount, isReversal);
@@ -63,8 +63,8 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
createJournalEntriesForDisbursements(loanDTO, loanTransactionDTO, office); createJournalEntriesForDisbursements(loanDTO, loanTransactionDTO, office);
} }
/*** /***
* Logic for repayments, repayments at disbursement and reversal of * Logic for repayments, repayments at disbursement and reversal of Repayments and Repayments at
* Repayments and Repayments at disbursement * disbursement
***/ ***/
else if (loanTransactionDTO.getTransactionType().isRepayment() else if (loanTransactionDTO.getTransactionType().isRepayment()
|| loanTransactionDTO.getTransactionType().isRepaymentAtDisbursement() || loanTransactionDTO.getTransactionType().isRepaymentAtDisbursement()
@@ -82,9 +82,8 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
createJournalEntriesForRefund(loanDTO, loanTransactionDTO, office); createJournalEntriesForRefund(loanDTO, loanTransactionDTO, office);
} }
/*** /***
* Only principal write off affects cash based accounting (interest * Only principal write off affects cash based accounting (interest and fee write off need not be
* and fee write off need not be considered). Debit losses written * considered). Debit losses written off and credit Loan Portfolio
* off and credit Loan Portfolio
**/ **/
else if (loanTransactionDTO.getTransactionType().isWriteOff()) { else if (loanTransactionDTO.getTransactionType().isWriteOff()) {
final BigDecimal principalAmount = loanTransactionDTO.getPrincipal(); final BigDecimal principalAmount = loanTransactionDTO.getPrincipal();
@@ -109,8 +108,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
/** /**
* Debit loan Portfolio and credit Fund source for a Disbursement <br/> * Debit loan Portfolio and credit Fund source for a Disbursement <br/>
* *
* All debits are turned into credits and vice versa in case of disbursement * All debits are turned into credits and vice versa in case of disbursement reversals
* reversals
* *
* *
* @param loanDTO * @param loanDTO
@@ -149,8 +147,7 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
/** /**
* Debit loan Portfolio and credit Fund source for a Disbursement <br/> * Debit loan Portfolio and credit Fund source for a Disbursement <br/>
* *
* All debits are turned into credits and vice versa in case of disbursement * All debits are turned into credits and vice versa in case of disbursement reversals
* reversals
* *
* *
* @param loanDTO * @param loanDTO
@@ -182,13 +179,11 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
} }
/** /**
* Create a single Debit to fund source and multiple credits if applicable * Create a single Debit to fund source and multiple credits if applicable (loan portfolio for principal repayments,
* (loan portfolio for principal repayments, Interest on loans for interest * Interest on loans for interest repayments, Income from fees for fees payment and Income from penalties for
* repayments, Income from fees for fees payment and Income from penalties * penalty payment)
* for penalty payment)
* *
* In case the loan transaction is a reversal, all debits are turned into * In case the loan transaction is a reversal, all debits are turned into credits and vice versa
* credits and vice versa
*/ */
private void createJournalEntriesForRepayments(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO, private void createJournalEntriesForRepayments(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO,
final Office office) { final Office office) {
@@ -256,11 +251,9 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
} }
/** /**
* Create a single Debit to fund source and a single credit to "Income from * Create a single Debit to fund source and a single credit to "Income from Recovery"
* Recovery"
* *
* In case the loan transaction is a reversal, all debits are turned into * In case the loan transaction is a reversal, all debits are turned into credits and vice versa
* credits and vice versa
*/ */
private void createJournalEntriesForRecoveryRepayments(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO, private void createJournalEntriesForRecoveryRepayments(final LoanDTO loanDTO, final LoanTransactionDTO loanTransactionDTO,
final Office office) { final Office office) {
@@ -283,12 +276,10 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
} }
/** /**
* Credit loan Portfolio and Debit Suspense Account for a Transfer * Credit loan Portfolio and Debit Suspense Account for a Transfer Initiation. A Transfer acceptance would be
* Initiation. A Transfer acceptance would be treated the opposite i.e Debit * treated the opposite i.e Debit Loan Portfolio and Credit Suspense Account <br/>
* Loan Portfolio and Credit Suspense Account <br/>
* *
* All debits are turned into credits and vice versa in case of Transfer * All debits are turned into credits and vice versa in case of Transfer Initiation disbursals
* Initiation disbursals
* *
* *
* @param loanDTO * @param loanDTO
@@ -146,8 +146,7 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal); savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
} }
/** /**
* Handle Interest Applications and reversals of Interest * Handle Interest Applications and reversals of Interest Applications
* Applications
**/ **/
else if (savingsTransactionDTO.getTransactionType().isInterestPosting() && savingsTransactionDTO.isOverdraftTransaction()) { else if (savingsTransactionDTO.getTransactionType().isInterestPosting() && savingsTransactionDTO.isOverdraftTransaction()) {
// Post journal entry if earned interest amount is greater than // Post journal entry if earned interest amount is greater than
@@ -226,8 +226,8 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
private void validateDebitOrCreditArrayForExistingGLAccount(final GLAccount glaccount, private void validateDebitOrCreditArrayForExistingGLAccount(final GLAccount glaccount,
final SingleDebitOrCreditEntryCommand[] creditOrDebits) { final SingleDebitOrCreditEntryCommand[] creditOrDebits) {
/** /**
* If a glaccount is assigned for a rule the credits or debits array * If a glaccount is assigned for a rule the credits or debits array should have only one entry and it must be
* should have only one entry and it must be same as existing account * same as existing account
*/ */
if (creditOrDebits.length != 1) { if (creditOrDebits.length != 1) {
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.INVALID_DEBIT_OR_CREDIT_ACCOUNTS, null, null, null); throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.INVALID_DEBIT_OR_CREDIT_ACCOUNTS, null, null, null);
@@ -305,8 +305,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
private void validateGLAccountForTransaction(final GLAccount creditOrDebitAccountHead) { private void validateGLAccountForTransaction(final GLAccount creditOrDebitAccountHead) {
/*** /***
* validate that the account allows manual adjustments and is not * validate that the account allows manual adjustments and is not disabled
* disabled
**/ **/
if (creditOrDebitAccountHead.isDisabled()) { if (creditOrDebitAccountHead.isDisabled()) {
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.GL_ACCOUNT_DISABLED, null, throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.GL_ACCOUNT_DISABLED, null,
@@ -644,8 +643,8 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
} }
/** /**
* TODO: Need a better implementation with guaranteed uniqueness (but not a * TODO: Need a better implementation with guaranteed uniqueness (but not a long UUID)...maybe something tied to
* long UUID)...maybe something tied to system clock.. * system clock..
*/ */
private String generateTransactionId(final Long officeId) { private String generateTransactionId(final Long officeId) {
final AppUser user = this.context.authenticatedUser(); final AppUser user = this.context.authenticatedUser();
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.producttoaccountmapping.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/** /**
* A {@link RuntimeException} thrown when product to GL account mapping are not * A {@link RuntimeException} thrown when product to GL account mapping are not found.
* found.
*/ */
public class ProductToGLAccountMappingInvalidException extends AbstractPlatformDomainRuleException { public class ProductToGLAccountMappingInvalidException extends AbstractPlatformDomainRuleException {
@@ -22,8 +22,7 @@ import org.apache.fineract.accounting.producttoaccountmapping.domain.PortfolioPr
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/** /**
* A {@link RuntimeException} thrown when product to GL account mapping are not * A {@link RuntimeException} thrown when product to GL account mapping are not found.
* found.
*/ */
public class ProductToGLAccountMappingNotFoundException extends AbstractPlatformResourceNotFoundException { public class ProductToGLAccountMappingNotFoundException extends AbstractPlatformResourceNotFoundException {
@@ -47,25 +47,21 @@ import org.springframework.stereotype.Component;
/** /**
* TODO Vishwas find a better approach for validation * TODO Vishwas find a better approach for validation
* *
* Currently, validation of the passed in JSON is done before calling save or * Currently, validation of the passed in JSON is done before calling save or update method on the target resource (in
* update method on the target resource (in our case the loan Product) * our case the loan Product)
* *
* However, in the case of a loan product it would be difficult to validate the * However, in the case of a loan product it would be difficult to validate the passed in JSON for valid
* passed in JSON for valid {@link LoanProduct} to {@link GLAccount} mappings * {@link LoanProduct} to {@link GLAccount} mappings during update because of the following scenario
* during update because of the following scenario
* *
* The accounting rule type may be changed in the update command, so we would * The accounting rule type may be changed in the update command, so we would have to validate if all required account
* have to validate if all required account heads for a particular account type * heads for a particular account type have been passed in (would be different for CASH and Accrual based). However,
* 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
* till we have access to the domain object it would not be possible to detect * changed
* if an accounting rule has actually been changed
* *
* Hence, method {@link #validateForLoanProductCreate(String)} from this class * Hence, method {@link #validateForLoanProductCreate(String)} from this class is called separately for validation only
* is called separately for validation only if an accounting rule change is * if an accounting rule change is detected by {@link ProductToGLAccountMappingWritePlatformService}
* detected by {@link ProductToGLAccountMappingWritePlatformService}
* *
* Also, the class is probably named wrong (*FromApiJsonDeserializer) should * Also, the class is probably named wrong (*FromApiJsonDeserializer) should probably be named as (*Validator) instead
* probably be named as (*Validator) instead
* *
*/ */
@Component @Component
@@ -212,8 +212,7 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi
} }
/** /**
* Examines and updates each account mapping for given loan product with * Examines and updates each account mapping for given loan product with changes passed in from the Json element
* changes passed in from the Json element
* *
* @param loanProductId * @param loanProductId
* @param changes * @param changes
@@ -127,8 +127,8 @@ public class ProductToGLAccountMappingHelper {
} }
/** /**
* Saves the payment type to Fund source mappings for a particular * Saves the payment type to Fund source mappings for a particular product/product type (also populates the changes
* product/product type (also populates the changes array if passed in) * array if passed in)
* *
* @param command * @param command
* @param element * @param element
@@ -154,8 +154,8 @@ public class ProductToGLAccountMappingHelper {
} }
/** /**
* Saves the Charge to Income / Liability account mappings for a particular * Saves the Charge to Income / Liability account mappings for a particular product/product type (also populates the
* product/product type (also populates the changes array if passed in) * changes array if passed in)
* *
* @param command * @param command
* @param element * @param element
@@ -210,14 +210,12 @@ public class ProductToGLAccountMappingHelper {
final JsonArray chargeToIncomeAccountMappingArray = this.fromApiJsonHelper.extractJsonArrayNamed(arrayFragmentName, element); final JsonArray chargeToIncomeAccountMappingArray = this.fromApiJsonHelper.extractJsonArrayNamed(arrayFragmentName, element);
/** /**
* Variable stores a map representation of charges (key) and their * Variable stores a map representation of charges (key) and their associated income Id's (value) extracted from
* associated income Id's (value) extracted from the passed in * the passed in Jsoncommand
* Jsoncommand
**/ **/
final Map<Long, Long> inputChargeToIncomeAccountMap = new HashMap<>(); final Map<Long, Long> inputChargeToIncomeAccountMap = new HashMap<>();
/*** /***
* Variable stores all charges which have already been mapped to Income * Variable stores all charges which have already been mapped to Income Accounts in the system
* Accounts in the system
**/ **/
final Set<Long> existingCharges = new HashSet<>(); final Set<Long> existingCharges = new HashSet<>();
if (chargeToIncomeAccountMappingArray != null) { if (chargeToIncomeAccountMappingArray != null) {
@@ -238,10 +236,8 @@ public class ProductToGLAccountMappingHelper {
} /** } /**
* Else, <br/> * Else, <br/>
* update existing mappings OR <br/> * update existing mappings OR <br/>
* delete old mappings (which are already present, but not passed * delete old mappings (which are already present, but not passed in as a part of Jsoncommand)<br/>
* in 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
* Create new mappings for charges that are passed in as a part of
* the Jsoncommand but not already present
* *
**/ **/
else { else {
@@ -296,13 +292,12 @@ public class ProductToGLAccountMappingHelper {
final JsonArray paymentChannelMappingArray = this.fromApiJsonHelper final JsonArray paymentChannelMappingArray = this.fromApiJsonHelper
.extractJsonArrayNamed(LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element); .extractJsonArrayNamed(LoanProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), element);
/** /**
* Variable stores a map representation of Payment channels (key) and * Variable stores a map representation of Payment channels (key) and their fund sources (value) extracted from
* their fund sources (value) extracted from the passed in Jsoncommand * the passed in Jsoncommand
**/ **/
final Map<Long, Long> inputPaymentChannelFundSourceMap = new HashMap<>(); final Map<Long, Long> inputPaymentChannelFundSourceMap = new HashMap<>();
/*** /***
* Variable stores all payment types which have already been mapped to * Variable stores all payment types which have already been mapped to Fund Sources in the system
* Fund Sources in the system
**/ **/
final Set<Long> existingPaymentTypes = new HashSet<>(); final Set<Long> existingPaymentTypes = new HashSet<>();
if (paymentChannelMappingArray != null) { if (paymentChannelMappingArray != null) {
@@ -324,10 +319,9 @@ public class ProductToGLAccountMappingHelper {
} /** } /**
* Else, <br/> * Else, <br/>
* update existing mappings OR <br/> * update existing mappings OR <br/>
* delete old mappings (which re already present, but not passed * delete old mappings (which re already present, but not passed in as a part of Jsoncommand)<br/>
* in 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
* Create new mappings for payment types that are passed in as a * present
* part of the Jsoncommand but not already present
* *
**/ **/
else { else {
@@ -388,8 +382,7 @@ public class ProductToGLAccountMappingHelper {
GLAccount glAccount; GLAccount glAccount;
/** /**
* Both CASH and Accrual placeholders have the same value for income * Both CASH and Accrual placeholders have the same value for income from Interest and penalties
* from Interest and penalties
**/ **/
CashAccountsForLoan placeHolderAccountType; CashAccountsForLoan placeHolderAccountType;
if (isPenalty) { if (isPenalty) {
@@ -415,8 +408,8 @@ public class ProductToGLAccountMappingHelper {
} }
/** /**
* Fetches account with a particular Id and throws and Exception it is not * Fetches account with a particular Id and throws and Exception it is not of the expected Account Category
* of the expected Account Category ('ASSET','liability' etc) * ('ASSET','liability' etc)
* *
* @param paramName * @param paramName
* @param expectedAccountType * @param expectedAccountType
@@ -288,16 +288,15 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
public Map<String, Object> updateLoanProductToGLAccountMapping(final Long loanProductId, final JsonCommand command, public Map<String, Object> updateLoanProductToGLAccountMapping(final Long loanProductId, final JsonCommand command,
final boolean accountingRuleChanged, final int accountingRuleTypeId) { final boolean accountingRuleChanged, final int accountingRuleTypeId) {
/*** /***
* Variable tracks all accounting mapping properties that have been * Variable tracks all accounting mapping properties that have been updated
* updated
***/ ***/
Map<String, Object> changes = new HashMap<>(); Map<String, Object> changes = new HashMap<>();
final JsonElement element = this.fromApiJsonHelper.parse(command.json()); final JsonElement element = this.fromApiJsonHelper.parse(command.json());
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId); final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId);
/*** /***
* If the accounting rule has been changed, delete all existing mapping * If the accounting rule has been changed, delete all existing mapping for the product and recreate a new set
* for the product and recreate a new set of mappings * of mappings
***/ ***/
if (accountingRuleChanged) { if (accountingRuleChanged) {
this.deserializer.validateForLoanProductCreate(command.json()); this.deserializer.validateForLoanProductCreate(command.json());
@@ -319,16 +318,15 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
public Map<String, Object> updateSavingsProductToGLAccountMapping(final Long savingsProductId, final JsonCommand command, public Map<String, Object> updateSavingsProductToGLAccountMapping(final Long savingsProductId, final JsonCommand command,
final boolean accountingRuleChanged, final int accountingRuleTypeId, final DepositAccountType accountType) { final boolean accountingRuleChanged, final int accountingRuleTypeId, final DepositAccountType accountType) {
/*** /***
* Variable tracks all accounting mapping properties that have been * Variable tracks all accounting mapping properties that have been updated
* updated
***/ ***/
Map<String, Object> changes = new HashMap<>(); Map<String, Object> changes = new HashMap<>();
final JsonElement element = this.fromApiJsonHelper.parse(command.json()); final JsonElement element = this.fromApiJsonHelper.parse(command.json());
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId); final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId);
/*** /***
* If the accounting rule has been changed, delete all existing mapping * If the accounting rule has been changed, delete all existing mapping for the product and recreate a new set
* for the product and recreate a new set of mappings * of mappings
***/ ***/
if (accountingRuleChanged) { if (accountingRuleChanged) {
this.deserializer.validateForSavingsProductCreate(command.json(), accountType); this.deserializer.validateForSavingsProductCreate(command.json(), accountType);
@@ -351,16 +349,15 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
public Map<String, Object> updateShareProductToGLAccountMapping(final Long shareProductId, final JsonCommand command, public Map<String, Object> updateShareProductToGLAccountMapping(final Long shareProductId, final JsonCommand command,
final boolean accountingRuleChanged, final int accountingRuleTypeId) { final boolean accountingRuleChanged, final int accountingRuleTypeId) {
/*** /***
* Variable tracks all accounting mapping properties that have been * Variable tracks all accounting mapping properties that have been updated
* updated
***/ ***/
Map<String, Object> changes = new HashMap<>(); Map<String, Object> changes = new HashMap<>();
final JsonElement element = this.fromApiJsonHelper.parse(command.json()); final JsonElement element = this.fromApiJsonHelper.parse(command.json());
final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId); final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId);
/*** /***
* If the accounting rule has been changed, delete all existing mapping * If the accounting rule has been changed, delete all existing mapping for the product and recreate a new set
* for the product and recreate a new set of mappings * of mappings
***/ ***/
if (accountingRuleChanged) { if (accountingRuleChanged) {
this.shareProductToGLAccountMappingHelper.deleteSharesProductToGLAccountMapping(shareProductId); this.shareProductToGLAccountMappingHelper.deleteSharesProductToGLAccountMapping(shareProductId);
@@ -177,8 +177,7 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
} }
/** /**
* Examines and updates each account mapping for given loan product with * Examines and updates each account mapping for given loan product with changes passed in from the Json element
* changes passed in from the Json element
* *
* @param savingsProductId * @param savingsProductId
* @param changes * @param changes
@@ -154,8 +154,7 @@ public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMapp
} }
/** /**
* Examines and updates each account mapping for given loan product with * Examines and updates each account mapping for given loan product with changes passed in from the Json element
* changes passed in from the Json element
* *
* @param sharesProductId * @param sharesProductId
* @param changes * @param changes
@@ -29,8 +29,7 @@ import org.apache.fineract.organisation.office.data.OfficeData;
/** /**
* Immutable object representing a General Ledger Account * Immutable object representing a General Ledger Account
* *
* Note: no getter/setters required as google-gson will produce json from fields * Note: no getter/setters required as google-gson will produce json from fields of object.
* of object.
*/ */
public class AccountingRuleData { public class AccountingRuleData {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.rule.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/** /**
* A {@link RuntimeException} thrown when an Accounting rule with a given name * A {@link RuntimeException} thrown when an Accounting rule with a given name already exists
* already exists
*/ */
public class AccountingRuleDuplicateException extends AbstractPlatformDomainRuleException { public class AccountingRuleDuplicateException extends AbstractPlatformDomainRuleException {
@@ -21,8 +21,7 @@ package org.apache.fineract.accounting.rule.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException; import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
/** /**
* A {@link RuntimeException} thrown when Accounting rule resources are not * A {@link RuntimeException} thrown when Accounting rule resources are not found.
* found.
*/ */
public class AccountingRuleNotFoundException extends AbstractPlatformResourceNotFoundException { public class AccountingRuleNotFoundException extends AbstractPlatformResourceNotFoundException {
@@ -59,8 +59,7 @@ import org.springframework.stereotype.Component;
public class AdHocApiResource { public class AdHocApiResource {
/** /**
* The set of parameters that are supported in response for * The set of parameters that are supported in response for {@link AdhocData}
* {@link AdhocData}
*/ */
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "query", "tableName", "tableField", private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "query", "tableName", "tableField",
"isActive", "createdBy", "createdOn", "createdById", "updatedById", "updatedOn", "email")); "isActive", "createdBy", "createdOn", "createdById", "updatedById", "updatedOn", "email"));
@@ -139,12 +139,9 @@ public final class AdHocDataValidator {
baseDataValidator.reset().parameter("reportRunEvery").value(reportRunEvery).integerGreaterThanZero(); baseDataValidator.reset().parameter("reportRunEvery").value(reportRunEvery).integerGreaterThanZero();
} }
/* /*
* if (this.fromApiJsonHelper.parameterExists("isActive", element)) { * if (this.fromApiJsonHelper.parameterExists("isActive", element)) { final Integer isActive =
* final Integer isActive = * this.fromApiJsonHelper.extractIntegerNamed("isActive", element, Locale.getDefault());
* this.fromApiJsonHelper.extractIntegerNamed("isActive", element, * baseDataValidator.reset().parameter("isActive").value(isActive). notNull().inMinMaxRange(1, 2); }
* Locale.getDefault());
* baseDataValidator.reset().parameter("isActive").value(isActive).
* notNull().inMinMaxRange(1, 2); }
*/ */
throwExceptionIfValidationWarningsExist(dataValidationErrors); throwExceptionIfValidationWarningsExist(dataValidationErrors);
@@ -73,8 +73,7 @@ public class AdHocWritePlatformServiceJpaRepositoryImpl implements AdHocWritePla
} }
/* /*
* Guaranteed to throw an exception no matter what the data integrity issue * Guaranteed to throw an exception no matter what the data integrity issue is.
* is.
*/ */
private void handleDataIntegrityIssues(final JsonCommand command, final DataIntegrityViolationException dve) { private void handleDataIntegrityIssues(final JsonCommand command, final DataIntegrityViolationException dve) {
@@ -50,12 +50,10 @@ import org.springframework.stereotype.Component;
/** /**
* Provides a REST resource for Batch Requests. This class acts as a proxy to * Provides a REST resource for Batch Requests. This class acts as a proxy to
* {@link org.apache.fineract.batch.service.BatchApiService} and de-serializes * {@link org.apache.fineract.batch.service.BatchApiService} and de-serializes the incoming JSON string to a list of
* the incoming JSON string to a list of * {@link org.apache.fineract.batch.domain .BatchRequest} type. This list is forwarded to BatchApiService which finally
* {@link org.apache.fineract.batch.domain .BatchRequest} type. This list is * returns a list of {@link org.apache.fineract.batch.domain.BatchResponse} type which is then serialized into JSON
* forwarded to BatchApiService which finally returns a list of * response by this Resource class.
* {@link org.apache.fineract.batch.domain.BatchResponse} type which is then
* serialized into JSON response by this Resource class.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -83,8 +81,7 @@ public class BatchApiResource {
private final BatchRequestJsonHelper batchRequestJsonHelper; private final BatchRequestJsonHelper batchRequestJsonHelper;
/** /**
* Constructs a 'BatchApiService' with context, toApiJsonSerializer, service * Constructs a 'BatchApiService' with context, toApiJsonSerializer, service and batchRequestJsonHelper.
* and batchRequestJsonHelper.
* *
* @param context * @param context
* @param toApiJsonSerializer * @param toApiJsonSerializer
@@ -102,8 +99,7 @@ public class BatchApiResource {
} }
/** /**
* Rest assured POST method to get {@link BatchRequest} and returns back the * Rest assured POST method to get {@link BatchRequest} and returns back the consolidated {@link BatchResponse}
* consolidated {@link BatchResponse}
* *
* @param jsonRequestString * @param jsonRequestString
* @param enclosingTransaction * @param enclosingTransaction
@@ -19,10 +19,8 @@
package org.apache.fineract.batch.command; package org.apache.fineract.batch.command;
/** /**
* Provides an object to * Provides an object to {@link org.apache.fineract.batch.service.BatchApiService} to get the proper commandStrategy for
* {@link org.apache.fineract.batch.service.BatchApiService} to get the proper * each request in BatchRequest. It uses Builder pattern to create object of this type.
* commandStrategy for each request in BatchRequest. It uses Builder pattern to
* create object of this type.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -69,9 +67,8 @@ public final class CommandContext {
} }
/** /**
* Returns a boolean value if the relativeUrl 'matches' one of the regex * Returns a boolean value if the relativeUrl 'matches' one of the regex keys in the available commandStrategies. It
* keys in the available commandStrategies. It take CommandContext object as * take CommandContext object as parameter which contains a 'resource' member as a regex key for available
* parameter which contains a 'resource' member as a regex key for available
* commandStrategies. * commandStrategies.
* *
* @param other * @param other
@@ -23,8 +23,8 @@ import org.apache.fineract.batch.domain.BatchRequest;
import org.apache.fineract.batch.domain.BatchResponse; import org.apache.fineract.batch.domain.BatchResponse;
/** /**
* An interface for various Command Strategies. It contains a single function * An interface for various Command Strategies. It contains a single function which returns appropriate response from a
* which returns appropriate response from a particular command strategy. * particular command strategy.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -33,10 +33,8 @@ import org.apache.fineract.batch.domain.BatchResponse;
public interface CommandStrategy { public interface CommandStrategy {
/** /**
* Returns an object of type * Returns an object of type {@link org.apache.fineract.batch.domain.BatchResponse}. This takes
* {@link org.apache.fineract.batch.domain.BatchResponse}. This takes * {@link org.apache.fineract.batch.domain.BatchRequest} as it's single argument and provides appropriate response.
* {@link org.apache.fineract.batch.domain.BatchRequest} as it's single
* argument and provides appropriate response.
* *
* @param batchRequest * @param batchRequest
* @param uriInfo * @param uriInfo
@@ -25,8 +25,8 @@ import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Provides an appropriate CommandStrategy using the 'method' and 'resourceUrl'. * Provides an appropriate CommandStrategy using the 'method' and 'resourceUrl'. CommandStrategy bean is created using
* CommandStrategy bean is created using Spring Application Context. * Spring Application Context.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -39,9 +39,8 @@ public class CommandStrategyProvider {
private final ConcurrentHashMap<CommandContext, String> commandStrategies = new ConcurrentHashMap<>(); private final ConcurrentHashMap<CommandContext, String> commandStrategies = new ConcurrentHashMap<>();
/** /**
* Constructs a CommandStrategyProvider with argument of ApplicationContext * Constructs a CommandStrategyProvider with argument of ApplicationContext type. It also initialize
* type. It also initialize commandStrategies using init() function by * commandStrategies using init() function by filling it with available CommandStrategies in
* filling it with available CommandStrategies in
* {@link org.apache.fineract.batch.command.internal}. * {@link org.apache.fineract.batch.command.internal}.
* *
* @param applicationContext * @param applicationContext
@@ -56,9 +55,8 @@ public class CommandStrategyProvider {
} }
/** /**
* Returns an appropriate commandStrategy after determining it using the * Returns an appropriate commandStrategy after determining it using the CommandContext of the request. If no such
* CommandContext of the request. If no such Strategy is found then a * Strategy is found then a default strategy is returned back.
* default strategy is returned back.
* *
* @param commandContext * @param commandContext
* @return CommandStrategy * @return CommandStrategy
@@ -80,10 +78,8 @@ public class CommandStrategyProvider {
} }
/** /**
* Contains various available command strategies in * Contains various available command strategies in {@link org.apache.fineract.batch.command.internal}. Any new
* {@link org.apache.fineract.batch.command.internal}. Any new command * command Strategy will have to be added within this function in order to initiate it within the constructor.
* Strategy will have to be added within this function in order to initiate
* it within the constructor.
*/ */
private void init() { private void init() {
this.commandStrategies.put(CommandContext.resource("clients").method("POST").build(), "createClientCommandStrategy"); this.commandStrategies.put(CommandContext.resource("clients").method("POST").build(), "createClientCommandStrategy");
@@ -31,13 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to * Implements {@link org.apache.fineract.batch.command.CommandStrategy} to handle activation of a pending client. It
* handle activation of a pending client. It passes the contents of the body * passes the contents of the body from the BatchRequest to
* from the BatchRequest to * {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and gets back the response. This class will also
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and gets * catch any errors raised by {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map those errors
* back the response. This class will also catch any errors raised by * to appropriate status codes in BatchResponse.
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map
* those errors to appropriate status codes in BatchResponse.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -29,13 +29,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and * Implements {@link org.apache.fineract.batch.command.CommandStrategy} and applies a new loan on an existing client. It
* applies a new loan on an existing client. It passes the contents of the body * passes the contents of the body from the BatchRequest to
* from the BatchRequest to * {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and gets back the response. This class will
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and * also catch any errors raised by {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and map those
* gets back the response. This class will also catch any errors raised by * errors to appropriate status codes in BatchResponse.
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and
* map those errors to appropriate status codes in BatchResponse.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -29,13 +29,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and * Implements {@link org.apache.fineract.batch.command.CommandStrategy} and applies a new savings on an existing client.
* applies a new savings on an existing client. It passes the contents of the * It passes the contents of the body from the BatchRequest to
* body from the BatchRequest to * {@link org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource} and gets back the response. This class
* {@link org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource} * will also catch any errors raised by {@link org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource} and
* and gets back the response. This class will also catch any errors raised by * map those errors to appropriate status codes in BatchResponse.
* {@link org.apache.fineract.portfolio.savings.api.SavingsAccountsApiResource}
* and map those errors to appropriate status codes in BatchResponse.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -31,13 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to * Implements {@link org.apache.fineract.batch.command.CommandStrategy} to handle approval of a pending loan. It passes
* handle approval of a pending loan. It passes the contents of the body from * the contents of the body from the BatchRequest to
* the BatchRequest to * {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and gets back the response. This class will
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and * also catch any errors raised by {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and map those
* gets back the response. This class will also catch any errors raised by * errors to appropriate status codes in BatchResponse.
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and
* map those errors to appropriate status codes in BatchResponse.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -31,13 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and * Implements {@link org.apache.fineract.batch.command.CommandStrategy} and Collect Charges for a Loan. It passes the
* Collect Charges for a Loan. It passes the contents of the body from the * contents of the body from the BatchRequest to
* BatchRequest to * {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and gets back the response. This class
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} * will also catch any errors raised by {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and
* and gets back the response. This class will also catch any errors raised by * map those errors to appropriate status codes in BatchResponse.
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource}
* and map those errors to appropriate status codes in BatchResponse.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -31,13 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and * Implements {@link org.apache.fineract.batch.command.CommandStrategy} and Create Charge for a Loan. It passes the
* Create Charge for a Loan. It passes the contents of the body from the * contents of the body from the BatchRequest to
* BatchRequest to * {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and gets back the response. This class
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} * will also catch any errors raised by {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource} and
* and gets back the response. This class will also catch any errors raised by * map those errors to appropriate status codes in BatchResponse.
* {@link org.apache.fineract.portfolio.loanaccount.api.LoanChargesApiResource}
* and map those errors to appropriate status codes in BatchResponse.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -29,13 +29,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to * Implements {@link org.apache.fineract.batch.command.CommandStrategy} to handle creation of a new client. It passes
* handle creation of a new client. It passes the contents of the body from the * the contents of the body from the BatchRequest to {@link org.apache.fineract.portfolio.client.api.ClientsApiResource}
* BatchRequest to * and gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and gets * {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map those errors to appropriate status codes
* back the response. This class will also catch any errors raised by * in BatchResponse.
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map
* those errors to appropriate status codes in BatchResponse.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -31,13 +31,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} to * Implements {@link org.apache.fineract.batch.command.CommandStrategy} to handle disburse of a loan. It passes the
* handle disburse of a loan. It passes the contents of the body from the * contents of the body from the BatchRequest to {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource}
* BatchRequest to * and gets back the response. This class will also catch any errors raised by
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and * {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and map those errors to appropriate status
* gets back the response. This class will also catch any errors raised by * codes in BatchResponse.
* {@link org.apache.fineract.portfolio.loanaccount.api.LoansApiResource} and
* map those errors to appropriate status codes in BatchResponse.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -31,11 +31,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implements {@link CommandStrategy} and handles repayment for a Loan. It * Implements {@link CommandStrategy} and handles repayment for a Loan. It passes the contents of the body from the
* passes the contents of the body from the BatchRequest to * BatchRequest to {@link LoanTransactionsApiResource} and gets back the response. This class will also catch any errors
* {@link LoanTransactionsApiResource} and gets back the response. This class * raised by {@link LoanTransactionsApiResource} and map those errors to appropriate status codes in BatchResponse.
* will also catch any errors raised by {@link LoanTransactionsApiResource} and
* map those errors to appropriate status codes in BatchResponse.
* *
* @author Mohit Sinha * @author Mohit Sinha
* *
@@ -25,9 +25,8 @@ import org.apache.fineract.batch.domain.BatchResponse;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Provides a default CommandStrategy by implementing * Provides a default CommandStrategy by implementing {@link org.apache.fineract.batch.command.CommandStrategy} in case
* {@link org.apache.fineract.batch.command.CommandStrategy} in case there is no * there is no appropriate command strategy with requested 'method' and 'resoureUrl'.
* appropriate command strategy with requested 'method' and 'resoureUrl'.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
*/ */
@@ -29,13 +29,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Implements {@link org.apache.fineract.batch.command.CommandStrategy} and * Implements {@link org.apache.fineract.batch.command.CommandStrategy} and updates the information of an existing
* updates the information of an existing client. It passes the contents of the * client. It passes the contents of the body from the BatchRequest to
* body from the BatchRequest to * {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and gets back the response. This class will also
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and gets * catch any errors raised by {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map those errors
* back the response. This class will also catch any errors raised by * to appropriate status codes in BatchResponse.
* {@link org.apache.fineract.portfolio.client.api.ClientsApiResource} and map
* those errors to appropriate status codes in BatchResponse.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -21,10 +21,9 @@ package org.apache.fineract.batch.domain;
import java.util.Set; import java.util.Set;
/** /**
* Provides an object for separate HTTP requests in the Batch Request for Batch * Provides an object for separate HTTP requests in the Batch Request for Batch API. A requestId is also included as
* API. A requestId is also included as data field which takes care of * data field which takes care of dependency issues among various requests. This class also provides getter and setter
* dependency issues among various requests. This class also provides getter and * functions to access Batch Request data fields.
* setter functions to access Batch Request data fields.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -41,8 +40,8 @@ public class BatchRequest {
private String body; private String body;
/** /**
* Constructs a 'BatchRequest' with requestId, relativeUrl, method, headers, * Constructs a 'BatchRequest' with requestId, relativeUrl, method, headers, reference and body of the incoming
* reference and body of the incoming request. * request.
* *
* @param requestId * @param requestId
* of HTTP request. * of HTTP request.
@@ -131,8 +130,7 @@ public class BatchRequest {
} }
/** /**
* Returns the values of 'headers' of {@link Header} type of an object of * Returns the values of 'headers' of {@link Header} type of an object of this class.
* this class.
* *
* @return headers of the HTTP request. * @return headers of the HTTP request.
* @see Header * @see Header
@@ -142,8 +140,7 @@ public class BatchRequest {
} }
/** /**
* Sets the values of 'headers' of {@link Header} type of an object of this * Sets the values of 'headers' of {@link Header} type of an object of this class.
* class.
* *
* @param headers * @param headers
* @see Header * @see Header
@@ -21,10 +21,9 @@ package org.apache.fineract.batch.domain;
import java.util.Set; import java.util.Set;
/** /**
* Provides an object for separate HTTP responses in the Batch Response for * Provides an object for separate HTTP responses in the Batch Response for Batch API. It contains all the information
* Batch API. It contains all the information about a particular HTTP response * about a particular HTTP response in the Batch Response. Getter and Setter functions are also included to access
* in the Batch Response. Getter and Setter functions are also included to * response data fields.
* access response data fields.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -40,8 +39,7 @@ public class BatchResponse {
private String body; private String body;
/** /**
* Constructs a 'BatchResponse' with requestId, statusCode, headers and body * Constructs a 'BatchResponse' with requestId, statusCode, headers and body of the HTTP requests.
* of the HTTP requests.
* *
* @param requestId * @param requestId
* @param statusCode * @param statusCode
@@ -110,8 +108,7 @@ public class BatchResponse {
} }
/** /**
* Sets the value of 'headers' of {@link Header} type of an object of this * Sets the value of 'headers' of {@link Header} type of an object of this class.
* class.
* *
* @param headers * @param headers
* of {@link Header} Type * of {@link Header} Type
@@ -19,9 +19,8 @@
package org.apache.fineract.batch.domain; package org.apache.fineract.batch.domain;
/** /**
* Provides an object to handle HTTP headers as name and value pairs for Batch * Provides an object to handle HTTP headers as name and value pairs for Batch API. It is used in {@link BatchRequest}
* API. It is used in {@link BatchRequest} and {@link BatchResponse} to store * and {@link BatchResponse} to store the information regarding the headers in incoming and outgoing JSON Strings.
* the information regarding the headers in incoming and outgoing JSON Strings.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -38,11 +38,9 @@ import org.springframework.dao.NonTransientDataAccessException;
import org.springframework.transaction.TransactionException; import org.springframework.transaction.TransactionException;
/** /**
* Provides an Error Handler method that returns an object of type * Provides an Error Handler method that returns an object of type {@link ErrorInfo} to the CommandStrategy which raised
* {@link ErrorInfo} to the CommandStrategy which raised the exception. This * the exception. This class uses various subclasses of RuntimeException to check the kind of exception raised and
* class uses various subclasses of RuntimeException to check the kind of * provide appropriate status and error codes for each one of the raised exception.
* exception raised and provide appropriate status and error codes for each one
* of the raised exception.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -61,8 +59,7 @@ public class ErrorHandler extends RuntimeException {
} }
/** /**
* Returns an object of ErrorInfo type containing the information regarding * Returns an object of ErrorInfo type containing the information regarding the raised error.
* the raised error.
* *
* @param exception * @param exception
* @return ErrorInfo * @return ErrorInfo
@@ -19,8 +19,7 @@
package org.apache.fineract.batch.exception; package org.apache.fineract.batch.exception;
/** /**
* Provides members to hold the basic information about the exceptions raised in * Provides members to hold the basic information about the exceptions raised in commandStrategy classes.
* commandStrategy classes.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -90,8 +89,7 @@ public final class ErrorInfo {
} }
/** /**
* Getter method to provide the message of the error for an object of this * Getter method to provide the message of the error for an object of this type.
* type.
* *
* @return String * @return String
*/ */
@@ -26,10 +26,8 @@ import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Extends * Extends {@link org.apache.fineract.infrastructure.core.serialization.FromJsonHelper} to de-serialize the incoming
* {@link org.apache.fineract.infrastructure.core.serialization.FromJsonHelper} * String into a JSON List of type {@link org.apache.fineract.batch.domain.BatchRequest}
* to de-serialize the incoming String into a JSON List of type
* {@link org.apache.fineract.batch.domain.BatchRequest}
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -40,8 +38,7 @@ import org.springframework.stereotype.Component;
public class BatchRequestJsonHelper extends FromJsonHelper { public class BatchRequestJsonHelper extends FromJsonHelper {
/** /**
* Returns a list of batchRequests after de-serializing it from the input * Returns a list of batchRequests after de-serializing it from the input JSON string.
* JSON string.
* *
* @param json * @param json
* @return List&lt;BatchRequest&gt; * @return List&lt;BatchRequest&gt;
@@ -24,8 +24,7 @@ import org.apache.fineract.batch.domain.BatchRequest;
import org.apache.fineract.batch.domain.BatchResponse; import org.apache.fineract.batch.domain.BatchResponse;
/** /**
* Provides an interface for service class, that implements the method to handle * Provides an interface for service class, that implements the method to handle separate Batch Requests.
* separate Batch Requests.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -36,10 +35,9 @@ import org.apache.fineract.batch.domain.BatchResponse;
public interface BatchApiService { public interface BatchApiService {
/** /**
* Returns a list of {@link org.apache.fineract.batch.domain.BatchResponse}s * Returns a list of {@link org.apache.fineract.batch.domain.BatchResponse}s by getting the appropriate
* by getting the appropriate CommandStrategy for every * CommandStrategy for every {@link org.apache.fineract.batch.domain.BatchRequest}. It will be used when the Query
* {@link org.apache.fineract.batch.domain.BatchRequest}. It will be used * Parameter "enclosingTransaction "is set to 'false'.
* when the Query Parameter "enclosingTransaction "is set to 'false'.
* *
* @param requestList * @param requestList
* @param uriInfo * @param uriInfo
@@ -48,12 +46,10 @@ public interface BatchApiService {
List<BatchResponse> handleBatchRequestsWithoutEnclosingTransaction(List<BatchRequest> requestList, UriInfo uriInfo); List<BatchResponse> handleBatchRequestsWithoutEnclosingTransaction(List<BatchRequest> requestList, UriInfo uriInfo);
/** /**
* returns a list of {@link org.apache.fineract.batch.domain.BatchResponse}s * returns a list of {@link org.apache.fineract.batch.domain.BatchResponse}s by getting the appropriate
* by getting the appropriate CommandStrategy for every * CommandStrategy for every {@link org.apache.fineract.batch.domain.BatchRequest}. It will be used when the Query
* {@link org.apache.fineract.batch.domain.BatchRequest}. It will be used * Parameter "enclosingTransaction "is set to 'true'. If one or more of the requests are not completed properly then
* when the Query Parameter "enclosingTransaction "is set to 'true'. If one * whole of the transaction will be rolled back properly.
* or more of the requests are not completed properly then whole of the
* transaction will be rolled back properly.
* *
* @param requestList * @param requestList
* @param uriInfo * @param uriInfo
@@ -44,9 +44,8 @@ import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate; import org.springframework.transaction.support.TransactionTemplate;
/** /**
* Implementation for {@link BatchApiService} to iterate through all the * Implementation for {@link BatchApiService} to iterate through all the incoming requests and obtain the appropriate
* incoming requests and obtain the appropriate CommandStrategy from * CommandStrategy from CommandStrategyProvider.
* CommandStrategyProvider.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* *
@@ -78,10 +77,8 @@ public class BatchApiServiceImpl implements BatchApiService {
} }
/** /**
* Returns the response list by getting a proper * Returns the response list by getting a proper {@link org.apache.fineract.batch.command.CommandStrategy}.
* {@link org.apache.fineract.batch.command.CommandStrategy}. execute() * execute() method of acquired commandStrategy is then provided with the separate Request.
* method of acquired commandStrategy is then provided with the separate
* Request.
* *
* @param requestList * @param requestList
* @param uriInfo * @param uriInfo
@@ -34,9 +34,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* Provides methods to create dependency map among the various batchRequests. It * Provides methods to create dependency map among the various batchRequests. It also provides method that takes care of
* also provides method that takes care of dependency resolution among related * dependency resolution among related requests.
* requests.
* *
* @author Rishabh Shukla * @author Rishabh Shukla
* @see BatchApiServiceImpl * @see BatchApiServiceImpl
@@ -85,10 +84,9 @@ public class ResolutionHelper {
} }
/** /**
* Returns a map containing requests that are divided in accordance of * Returns a map containing requests that are divided in accordance of dependency relations among them. Each
* dependency relations among them. Each different list is identified with a * different list is identified with a "Key" which is the "requestId" of the request at topmost level in dependency
* "Key" which is the "requestId" of the request at topmost level in * hierarchy of that particular list.
* dependency hierarchy of that particular list.
* *
* @param batchRequests * @param batchRequests
* @return List&lt;ArrayList&lt;BatchRequestNode&gt;&gt; * @return List&lt;ArrayList&lt;BatchRequestNode&gt;&gt;
@@ -122,10 +120,8 @@ public class ResolutionHelper {
} }
/** /**
* Returns a BatchRequest after dependency resolution. It takes a request * Returns a BatchRequest after dependency resolution. It takes a request and the response of the request it is
* and the response of the request it is dependent upon as its arguments and * dependent upon as its arguments and change the body or relativeUrl of the request according to parent Request.
* change the body or relativeUrl of the request according to parent
* Request.
* *
* @param request * @param request
* @param parentResponse * @param parentResponse
@@ -27,8 +27,7 @@ import java.lang.annotation.Target;
/** /**
* Specifies the command type for the annotated class.<br> * Specifies the command type for the annotated class.<br>
* <br> * <br>
* The entity name (e.g. CLIENT, SAVINGSACCOUNT, LOANPRODUCT) and the action * The entity name (e.g. CLIENT, SAVINGSACCOUNT, LOANPRODUCT) and the action (e.g. CREATE, DELETE) must be given.
* (e.g. CREATE, DELETE) must be given.
* *
* @author Markus Geiss * @author Markus Geiss
* @version 1.0 * @version 1.0

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