FINERACT-821 Enforced Membername checkstyle(1)
This commit is contained in:
committed by
Michael Vorburger ⛑️
parent
1b8962fc81
commit
bd75a6c79b
+3
-3
@@ -74,8 +74,8 @@ public class AccountNumberPreferencesTest {
|
||||
private Integer savingsAccountNumberPreferenceId;
|
||||
private Integer groupsAccountNumberPreferenceId;
|
||||
private Integer centerAccountNumberPreferenceId;
|
||||
private final String MINIMUM_OPENING_BALANCE = "1000.0";
|
||||
private final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
||||
private static final String MINIMUM_OPENING_BALANCE = "1000.0";
|
||||
private static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
||||
private Boolean isAccountPreferenceSetUp = false;
|
||||
private Integer clientTypeCodeId;
|
||||
private String clientCodeValueName;
|
||||
@@ -447,7 +447,7 @@ public class AccountNumberPreferencesTest {
|
||||
.withMinBalanceForInterestCalculation(minBalanceForInterestCalculation)
|
||||
//
|
||||
.withMinRequiredBalance(minRequiredBalance).withEnforceMinRequiredBalance(enforceMinRequiredBalance)
|
||||
.withMinimumOpenningBalance(this.MINIMUM_OPENING_BALANCE).build();
|
||||
.withMinimumOpenningBalance(MINIMUM_OPENING_BALANCE).build();
|
||||
this.savingsProductId = SavingsProductHelper.createSavingsProduct(savingsProductJSON, this.requestSpec, this.responseSpec);
|
||||
LOG.info("Sucessfully created savings product (ID: {} )", this.savingsProductId);
|
||||
|
||||
|
||||
+2
-2
@@ -80,8 +80,8 @@ public class AccountTransferTest {
|
||||
private AccountHelper accountHelper;
|
||||
private JournalEntryHelper journalEntryHelper;
|
||||
|
||||
Float TRANSFER_AMOUNT = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
|
||||
Float TRANSFER_AMOUNT_ADJUST = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||
static Float TRANSFER_AMOUNT = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT);
|
||||
static Float TRANSFER_AMOUNT_ADJUST = Float.valueOf(ACCOUNT_TRANSFER_AMOUNT_ADJUST);
|
||||
|
||||
private FinancialActivityAccountHelper financialActivityAccountHelper;
|
||||
private Integer financialActivityAccountId;
|
||||
|
||||
+174
-175
@@ -74,33 +74,33 @@ public class AccountingScenarioIntegrationTest {
|
||||
private static RequestSpecification requestSpec;
|
||||
private static ResponseSpecification responseSpec;
|
||||
|
||||
private final String DATE_OF_JOINING = "01 January 2011";
|
||||
private static final String DATE_OF_JOINING = "01 January 2011";
|
||||
|
||||
private final Float LP_PRINCIPAL = 10000.0f;
|
||||
private final String LP_REPAYMENTS = "5";
|
||||
private final String LP_REPAYMENT_PERIOD = "2";
|
||||
private final String LP_INTEREST_RATE = "1";
|
||||
private final String EXPECTED_DISBURSAL_DATE = "04 March 2011";
|
||||
private final String LOAN_APPLICATION_SUBMISSION_DATE = "3 March 2011";
|
||||
private final String TRANSACTION_DATE = "01 March 2013";
|
||||
private final String LOAN_TERM_FREQUENCY = "10";
|
||||
private final String INDIVIDUAL_LOAN = "individual";
|
||||
private static final Float LP_PRINCIPAL = 10000.0f;
|
||||
private static final String LP_REPAYMENTS = "5";
|
||||
private static final String LP_REPAYMENT_PERIOD = "2";
|
||||
private static final String LP_INTEREST_RATE = "1";
|
||||
private static final String EXPECTED_DISBURSAL_DATE = "04 March 2011";
|
||||
private static final String LOAN_APPLICATION_SUBMISSION_DATE = "3 March 2011";
|
||||
private static final String TRANSACTION_DATE = "01 March 2013";
|
||||
private static final String LOAN_TERM_FREQUENCY = "10";
|
||||
private static final String INDIVIDUAL_LOAN = "individual";
|
||||
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
||||
public static final String MINIMUM_OPENING_BALANCE = "1000.0";
|
||||
public static final String DEPOSIT_AMOUNT = "7000";
|
||||
public static final String WITHDRAWAL_AMOUNT = "3000";
|
||||
public static final String WITHDRAWAL_AMOUNT_ADJUSTED = "2000";
|
||||
|
||||
Float SP_BALANCE = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||
Float SP_DEPOSIT_AMOUNT = Float.valueOf(DEPOSIT_AMOUNT);
|
||||
Float SP_WITHDRAWAL_AMOUNT = Float.valueOf(WITHDRAWAL_AMOUNT);
|
||||
Float SP_WITHDRAWAL_AMOUNT_ADJUSTED = Float.valueOf(WITHDRAWAL_AMOUNT_ADJUSTED);
|
||||
static Float SP_BALANCE = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||
static Float SP_DEPOSIT_AMOUNT = Float.valueOf(DEPOSIT_AMOUNT);
|
||||
static Float SP_WITHDRAWAL_AMOUNT = Float.valueOf(WITHDRAWAL_AMOUNT);
|
||||
static Float SP_WITHDRAWAL_AMOUNT_ADJUSTED = Float.valueOf(WITHDRAWAL_AMOUNT_ADJUSTED);
|
||||
|
||||
private final String[] REPAYMENT_DATE = { "", "04 May 2011", "04 July 2011", "04 September 2011", "04 November 2011",
|
||||
private static final String[] REPAYMENT_DATE = { "", "04 May 2011", "04 July 2011", "04 September 2011", "04 November 2011",
|
||||
"04 January 2012" };
|
||||
private final Float[] REPAYMENT_AMOUNT = { .0f, 2200.0f, 3000.0f, 900.0f, 2000.0f, 2500.0f };
|
||||
private static final Float[] REPAYMENT_AMOUNT = { .0f, 2200.0f, 3000.0f, 900.0f, 2000.0f, 2500.0f };
|
||||
|
||||
private final Float AMOUNT_TO_BE_WAIVE = 400.0f;
|
||||
private static final Float AMOUNT_TO_BE_WAIVE = 400.0f;
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private AccountHelper accountHelper;
|
||||
private JournalEntryHelper journalEntryHelper;
|
||||
@@ -136,17 +136,17 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithUpfrontAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
overpaymentAccount);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, DATE_OF_JOINING);
|
||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(EXPECTED_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(EXPECTED_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// CHECK ACCOUNT ENTRIES
|
||||
@@ -154,84 +154,84 @@ public class AccountingScenarioIntegrationTest {
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(TOTAL_INTEREST, JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||
new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||
LOG.info("CHECKING INCOME: ******************************************");
|
||||
final JournalEntry incomeJournalEntry = new JournalEntry(TOTAL_INTEREST, JournalEntry.TransactionType.CREDIT);
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.EXPECTED_DISBURSAL_DATE, incomeJournalEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, EXPECTED_DISBURSAL_DATE, incomeJournalEntry);
|
||||
|
||||
// MAKE 1
|
||||
LOG.info("Repayment 1 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[1], REPAYMENT_AMOUNT[1], loanID);
|
||||
final float FIRST_INTEREST = 200.0f;
|
||||
final float FIRST_PRINCIPAL = 2000.0f;
|
||||
float expected_value = this.LP_PRINCIPAL - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
float expected_value = LP_PRINCIPAL - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
||||
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(FIRST_INTEREST + FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||
LOG.info("Repayment 1 Done......");
|
||||
|
||||
// REPAYMENT 2
|
||||
LOG.info("Repayment 2 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[2], REPAYMENT_AMOUNT[2], loanID);
|
||||
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
||||
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
||||
final float SECOND_PRINCIPAL = REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(2, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
||||
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(SECOND_AND_THIRD_INTEREST + SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||
LOG.info("Repayment 2 Done ......");
|
||||
|
||||
// WAIVE INTEREST
|
||||
LOG.info("Waive Interest ......");
|
||||
this.loanTransactionHelper.waiveInterest(this.REPAYMENT_DATE[4], this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
||||
this.loanTransactionHelper.waiveInterest(REPAYMENT_DATE[4], AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
||||
|
||||
final JournalEntry waivedEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.CREDIT);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], waivedEntry);
|
||||
final JournalEntry waivedEntry = new JournalEntry(AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.CREDIT);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[4], waivedEntry);
|
||||
|
||||
final JournalEntry expenseJournalEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
|
||||
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
|
||||
final JournalEntry expenseJournalEntry = new JournalEntry(AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
|
||||
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, REPAYMENT_DATE[4], expenseJournalEntry);
|
||||
LOG.info("Waive Interest Done......");
|
||||
|
||||
// REPAYMENT 3
|
||||
LOG.info("Repayment 3 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[3], REPAYMENT_AMOUNT[3], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||
LOG.info("Repayment 3 Done ......");
|
||||
|
||||
// REPAYMENT 4
|
||||
LOG.info("Repayment 4 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[4], REPAYMENT_AMOUNT[4], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||
LOG.info("Repayment 4 Done ......");
|
||||
|
||||
// Repayment 5
|
||||
LOG.info("Repayment 5 ......");
|
||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[5], REPAYMENT_AMOUNT[5], loanID);
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[5], assetAccountFifthEntry);
|
||||
LOG.info("Repayment 5 Done ......");
|
||||
}
|
||||
|
||||
private Integer createLoanProductWithUpfrontAccrualAccountingEnabled(final Account... accounts) {
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(LP_REPAYMENT_PERIOD).withNumberOfRepayments(LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRuleUpfrontAccrual(accounts)
|
||||
.build(null);
|
||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||
@@ -239,13 +239,13 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString())
|
||||
.withLoanTermFrequency(this.LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths().withNumberOfRepayments(this.LP_REPAYMENTS)
|
||||
.withRepaymentEveryAfter(this.LP_REPAYMENT_PERIOD).withRepaymentFrequencyTypeAsMonths()
|
||||
.withInterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestTypeAsFlatBalance()
|
||||
.withAmortizationTypeAsEqualPrincipalPayments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate(this.EXPECTED_DISBURSAL_DATE).withSubmittedOnDate(this.LOAN_APPLICATION_SUBMISSION_DATE)
|
||||
.withLoanType(this.INDIVIDUAL_LOAN).build(clientID.toString(), loanProductID.toString(), null);
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(LP_PRINCIPAL.toString())
|
||||
.withLoanTermFrequency(LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths().withNumberOfRepayments(LP_REPAYMENTS)
|
||||
.withRepaymentEveryAfter(LP_REPAYMENT_PERIOD).withRepaymentFrequencyTypeAsMonths()
|
||||
.withInterestRatePerPeriod(LP_INTEREST_RATE).withInterestTypeAsFlatBalance().withAmortizationTypeAsEqualPrincipalPayments()
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate(EXPECTED_DISBURSAL_DATE)
|
||||
.withSubmittedOnDate(LOAN_APPLICATION_SUBMISSION_DATE).withLoanType(INDIVIDUAL_LOAN)
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer savingsProductID = createSavingsProduct(MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount,
|
||||
liabilityAccount);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, DATE_OF_JOINING);
|
||||
final Integer savingsID = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
|
||||
|
||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(requestSpec, responseSpec, savingsID);
|
||||
@@ -274,11 +274,10 @@ public class AccountingScenarioIntegrationTest {
|
||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||
|
||||
// Checking initial Account entries.
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountInitialEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||
liablilityAccountInitialEntry);
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(SP_BALANCE, JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, TRANSACTION_DATE, assetAccountInitialEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, TRANSACTION_DATE, liablilityAccountInitialEntry);
|
||||
|
||||
// First Transaction-Deposit
|
||||
this.savingsAccountHelper.depositToSavingsAccount(savingsID, DEPOSIT_AMOUNT, SavingsAccountHelper.TRANSACTION_DATE,
|
||||
@@ -289,11 +288,11 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
LOG.info("----------------------Verifying Journal Entry after the Transaction Deposit----------------------------");
|
||||
final JournalEntry[] assetAccountFirstTransactionEntry = {
|
||||
new JournalEntry(this.SP_DEPOSIT_AMOUNT, JournalEntry.TransactionType.DEBIT) };
|
||||
new JournalEntry(SP_DEPOSIT_AMOUNT, JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] liabililityAccountFirstTransactionEntry = {
|
||||
new JournalEntry(this.SP_DEPOSIT_AMOUNT, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountFirstTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||
new JournalEntry(SP_DEPOSIT_AMOUNT, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, TRANSACTION_DATE, assetAccountFirstTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, TRANSACTION_DATE,
|
||||
liabililityAccountFirstTransactionEntry);
|
||||
|
||||
// Second Transaction-Withdrawal
|
||||
@@ -305,11 +304,11 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
LOG.info("-------------------Verifying Journal Entry after the Transaction Withdrawal----------------------");
|
||||
final JournalEntry[] assetAccountSecondTransactionEntry = {
|
||||
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT, JournalEntry.TransactionType.CREDIT) };
|
||||
new JournalEntry(SP_WITHDRAWAL_AMOUNT, JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] liabililityAccountSecondTransactionEntry = {
|
||||
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT, JournalEntry.TransactionType.DEBIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountSecondTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||
new JournalEntry(SP_WITHDRAWAL_AMOUNT, JournalEntry.TransactionType.DEBIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, TRANSACTION_DATE, assetAccountSecondTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, TRANSACTION_DATE,
|
||||
liabililityAccountSecondTransactionEntry);
|
||||
|
||||
// Third Transaction-Add Charges for Withdrawal Fee
|
||||
@@ -331,14 +330,14 @@ public class AccountingScenarioIntegrationTest {
|
||||
balance = balance - SP_WITHDRAWAL_AMOUNT_ADJUSTED - chargeAmount;
|
||||
|
||||
final JournalEntry[] liabililityAccountThirdTransactionEntry = { new JournalEntry(chargeAmount, JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.DEBIT) };
|
||||
new JournalEntry(SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] assetAccountThirdTransactionEntry = {
|
||||
new JournalEntry(this.SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.CREDIT) };
|
||||
new JournalEntry(SP_WITHDRAWAL_AMOUNT_ADJUSTED, JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] incomeAccountThirdTransactionEntry = { new JournalEntry(chargeAmount, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountThirdTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, TRANSACTION_DATE, assetAccountThirdTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, TRANSACTION_DATE,
|
||||
liabililityAccountThirdTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.TRANSACTION_DATE, incomeAccountThirdTransactionEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, TRANSACTION_DATE, incomeAccountThirdTransactionEntry);
|
||||
|
||||
// Verifying Balance after applying Charge for Withdrawal Fee
|
||||
assertEquals(balance, summary.get("accountBalance"), "Verifying Balance");
|
||||
@@ -563,26 +562,26 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
overpaymentAccount);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, DATE_OF_JOINING);
|
||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(EXPECTED_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(EXPECTED_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// CHECK ACCOUNT ENTRIES
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||
|
||||
final String jobName = "Add Accrual Transactions";
|
||||
|
||||
@@ -594,75 +593,75 @@ public class AccountingScenarioIntegrationTest {
|
||||
final float FIRST_PRINCIPAL = 2000.0f;
|
||||
final float FEE_PORTION = 0.0f;
|
||||
final float PENALTY_PORTION = 0.0f;
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[1]), FIRST_INTEREST,
|
||||
FEE_PORTION, PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
|
||||
float expected_value = this.LP_PRINCIPAL - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(REPAYMENT_DATE[1]), FIRST_INTEREST, FEE_PORTION,
|
||||
PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[1], REPAYMENT_AMOUNT[1], loanID);
|
||||
float expected_value = LP_PRINCIPAL - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
||||
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(FIRST_INTEREST + FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||
LOG.info("Repayment 1 Done......");
|
||||
|
||||
// REPAYMENT 2
|
||||
LOG.info("Repayment 2 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[2], REPAYMENT_AMOUNT[2], loanID);
|
||||
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
||||
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
||||
final float SECOND_PRINCIPAL = REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[2]), FIRST_INTEREST,
|
||||
FEE_PORTION, PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[3]), FIRST_INTEREST,
|
||||
FEE_PORTION, PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(REPAYMENT_DATE[2]), FIRST_INTEREST, FEE_PORTION,
|
||||
PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(REPAYMENT_DATE[3]), FIRST_INTEREST, FEE_PORTION,
|
||||
PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(2, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
||||
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(SECOND_AND_THIRD_INTEREST + SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||
LOG.info("Repayment 2 Done ......");
|
||||
|
||||
// WAIVE INTEREST
|
||||
LOG.info("Waive Interest ......");
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[4]), FIRST_INTEREST,
|
||||
FEE_PORTION, PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[5]), FIRST_INTEREST,
|
||||
FEE_PORTION, PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.waiveInterest(this.REPAYMENT_DATE[4], this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(REPAYMENT_DATE[4]), FIRST_INTEREST, FEE_PORTION,
|
||||
PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(REPAYMENT_DATE[5]), FIRST_INTEREST, FEE_PORTION,
|
||||
PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.waiveInterest(REPAYMENT_DATE[4], AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
||||
|
||||
final JournalEntry waivedEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.CREDIT);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], waivedEntry);
|
||||
final JournalEntry waivedEntry = new JournalEntry(AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.CREDIT);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[4], waivedEntry);
|
||||
|
||||
final JournalEntry expenseJournalEntry = new JournalEntry(this.AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
|
||||
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, this.REPAYMENT_DATE[4], expenseJournalEntry);
|
||||
final JournalEntry expenseJournalEntry = new JournalEntry(AMOUNT_TO_BE_WAIVE, JournalEntry.TransactionType.DEBIT);
|
||||
this.journalEntryHelper.checkJournalEntryForExpenseAccount(expenseAccount, REPAYMENT_DATE[4], expenseJournalEntry);
|
||||
LOG.info("Waive Interest Done......");
|
||||
|
||||
// REPAYMENT 3
|
||||
LOG.info("Repayment 3 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[3], REPAYMENT_AMOUNT[3], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||
LOG.info("Repayment 3 Done ......");
|
||||
|
||||
// REPAYMENT 4
|
||||
LOG.info("Repayment 4 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[4], REPAYMENT_AMOUNT[4], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||
LOG.info("Repayment 4 Done ......");
|
||||
|
||||
// Repayment 5
|
||||
LOG.info("Repayment 5 ......");
|
||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[5], REPAYMENT_AMOUNT[5], loanID);
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[5], assetAccountFifthEntry);
|
||||
LOG.info("Repayment 5 Done ......");
|
||||
}
|
||||
|
||||
@@ -676,26 +675,26 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
overpaymentAccount);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, DATE_OF_JOINING);
|
||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(EXPECTED_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(EXPECTED_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// CHECK ACCOUNT ENTRIES
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||
|
||||
final String jobName = "Add Accrual Transactions";
|
||||
|
||||
@@ -707,15 +706,15 @@ public class AccountingScenarioIntegrationTest {
|
||||
final float FIRST_PRINCIPAL = 2000.0f;
|
||||
final float FEE_PORTION = 0.0f;
|
||||
final float PENALTY_PORTION = 0.0f;
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(this.REPAYMENT_DATE[1]), FIRST_INTEREST,
|
||||
FEE_PORTION, PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], 15000f, loanID);
|
||||
float expected_value = this.LP_PRINCIPAL - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.checkAccrualTransactionForRepayment(getDateAsLocalDate(REPAYMENT_DATE[1]), FIRST_INTEREST, FEE_PORTION,
|
||||
PENALTY_PORTION, loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[1], 15000f, loanID);
|
||||
float expected_value = LP_PRINCIPAL - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountEntry = { new JournalEntry(15000f, JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(11000f, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, this.REPAYMENT_DATE[1],
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[1], assetAccountEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(overpaymentAccount, REPAYMENT_DATE[1],
|
||||
new JournalEntry(4000f, JournalEntry.TransactionType.CREDIT));
|
||||
LOG.info("Repayment Done......");
|
||||
|
||||
@@ -731,7 +730,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
overpaymentAccount);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, DATE_OF_JOINING);
|
||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||
|
||||
final float FEE_PORTION = 50.0f;
|
||||
@@ -744,7 +743,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(EXPECTED_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
@@ -776,8 +775,8 @@ public class AccountingScenarioIntegrationTest {
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, LOAN_DISBURSEMENT_DATE, assetAccountInitialEntry);
|
||||
|
||||
final String jobName = "Add Periodic Accrual Transactions";
|
||||
@@ -820,7 +819,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithPeriodicAccrualAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
overpaymentAccount);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, DATE_OF_JOINING);
|
||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||
|
||||
final float FEE_PORTION = 50.0f;
|
||||
@@ -841,7 +840,7 @@ public class AccountingScenarioIntegrationTest {
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(EXPECTED_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
@@ -882,8 +881,8 @@ public class AccountingScenarioIntegrationTest {
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT), };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, LOAN_DISBURSEMENT_DATE, assetAccountInitialEntry);
|
||||
|
||||
this.periodicAccrualAccountingHelper.runPeriodicAccrualAccounting(runOndate);
|
||||
@@ -923,9 +922,9 @@ public class AccountingScenarioIntegrationTest {
|
||||
|
||||
private Integer createLoanProductWithPeriodicAccrualAccountingEnabled(final Account... accounts) {
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(LP_REPAYMENT_PERIOD).withNumberOfRepayments(LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRulePeriodicAccrual(accounts)
|
||||
.withDaysInMonth("30").withDaysInYear("365").build(null);
|
||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||
@@ -941,101 +940,101 @@ public class AccountingScenarioIntegrationTest {
|
||||
final Integer loanProductID = createLoanProductWithCashBasedAccountingEnabled(assetAccount, incomeAccount, expenseAccount,
|
||||
overpaymentAccount);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, DATE_OF_JOINING);
|
||||
final Integer loanID = applyForLoanApplication(clientID, loanProductID);
|
||||
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(EXPECTED_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.EXPECTED_DISBURSAL_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(EXPECTED_DISBURSAL_DATE, loanID);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
// CHECK ACCOUNT ENTRIES
|
||||
LOG.info("Entries ......");
|
||||
final float PRINCIPAL_VALUE_FOR_EACH_PERIOD = 2000.0f;
|
||||
final float TOTAL_INTEREST = 1000.0f;
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(this.LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.CREDIT),
|
||||
new JournalEntry(LP_PRINCIPAL, JournalEntry.TransactionType.DEBIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, EXPECTED_DISBURSAL_DATE, assetAccountInitialEntry);
|
||||
|
||||
// MAKE 1
|
||||
LOG.info("Repayment 1 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[1], this.REPAYMENT_AMOUNT[1], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[1], REPAYMENT_AMOUNT[1], loanID);
|
||||
final float FIRST_INTEREST = 200.0f;
|
||||
final float FIRST_PRINCIPAL = 2000.0f;
|
||||
float expected_value = this.LP_PRINCIPAL - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
float expected_value = LP_PRINCIPAL - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
||||
final JournalEntry[] assetAccountFirstEntry = { new JournalEntry(REPAYMENT_AMOUNT[1], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(FIRST_PRINCIPAL, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[1], assetAccountFirstEntry);
|
||||
LOG.info("CHECKING INCOME: ******************************************");
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[1],
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, REPAYMENT_DATE[1],
|
||||
new JournalEntry(FIRST_INTEREST, JournalEntry.TransactionType.CREDIT));
|
||||
LOG.info("Repayment 1 Done......");
|
||||
|
||||
// REPAYMENT 2
|
||||
LOG.info("Repayment 2 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[2], this.REPAYMENT_AMOUNT[2], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[2], REPAYMENT_AMOUNT[2], loanID);
|
||||
final float SECOND_AND_THIRD_INTEREST = 400.0f;
|
||||
final float SECOND_PRINCIPAL = this.REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
||||
final float SECOND_PRINCIPAL = REPAYMENT_AMOUNT[2] - SECOND_AND_THIRD_INTEREST;
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(2, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
||||
final JournalEntry[] assetAccountSecondEntry = { new JournalEntry(REPAYMENT_AMOUNT[2], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(SECOND_PRINCIPAL, JournalEntry.TransactionType.CREDIT), };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[2], assetAccountSecondEntry);
|
||||
LOG.info("CHECKING INCOME: ******************************************");
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, this.REPAYMENT_DATE[2],
|
||||
this.journalEntryHelper.checkJournalEntryForIncomeAccount(incomeAccount, REPAYMENT_DATE[2],
|
||||
new JournalEntry(SECOND_AND_THIRD_INTEREST, JournalEntry.TransactionType.CREDIT));
|
||||
LOG.info("Repayment 2 Done ......");
|
||||
|
||||
// WAIVE INTEREST
|
||||
LOG.info("Waive Interest ......");
|
||||
Integer transactionId = this.loanTransactionHelper.waiveInterestAndReturnTransactionId(this.REPAYMENT_DATE[4],
|
||||
this.AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
||||
Integer transactionId = this.loanTransactionHelper.waiveInterestAndReturnTransactionId(REPAYMENT_DATE[4],
|
||||
AMOUNT_TO_BE_WAIVE.toString(), loanID);
|
||||
// waive of fees and interest are not considered in cash based
|
||||
// accounting,
|
||||
this.journalEntryHelper.ensureNoAccountingTransactionsWithTransactionId("L" + transactionId);
|
||||
|
||||
// REPAYMENT 3
|
||||
LOG.info("Repayment 3 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[3], this.REPAYMENT_AMOUNT[3], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[3], REPAYMENT_AMOUNT[3], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] assetAccountThirdEntry = { new JournalEntry(REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(REPAYMENT_AMOUNT[3], JournalEntry.TransactionType.CREDIT) };
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(3, expected_value, loanID);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[3], assetAccountThirdEntry);
|
||||
LOG.info("Repayment 3 Done ......");
|
||||
|
||||
// REPAYMENT 4
|
||||
LOG.info("Repayment 4 ......");
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[4], this.REPAYMENT_AMOUNT[4], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[4], REPAYMENT_AMOUNT[4], loanID);
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(4, expected_value, loanID);
|
||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||
final JournalEntry[] assetAccountFourthEntry = { new JournalEntry(REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(REPAYMENT_AMOUNT[4], JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[4], assetAccountFourthEntry);
|
||||
LOG.info("Repayment 4 Done ......");
|
||||
|
||||
// Repayment 5
|
||||
LOG.info("Repayment 5 ......");
|
||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(this.REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||
final JournalEntry[] assetAccountFifthEntry = { new JournalEntry(REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.DEBIT),
|
||||
new JournalEntry(REPAYMENT_AMOUNT[5], JournalEntry.TransactionType.CREDIT) };
|
||||
expected_value = expected_value - PRINCIPAL_VALUE_FOR_EACH_PERIOD;
|
||||
this.loanTransactionHelper.makeRepayment(this.REPAYMENT_DATE[5], this.REPAYMENT_AMOUNT[5], loanID);
|
||||
this.loanTransactionHelper.makeRepayment(REPAYMENT_DATE[5], REPAYMENT_AMOUNT[5], loanID);
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(5, expected_value, loanID);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.REPAYMENT_DATE[5], assetAccountFifthEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, REPAYMENT_DATE[5], assetAccountFifthEntry);
|
||||
LOG.info("Repayment 5 Done ......");
|
||||
}
|
||||
|
||||
private Integer createLoanProductWithCashBasedAccountingEnabled(final Account... accounts) {
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(LP_PRINCIPAL.toString()).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(LP_REPAYMENT_PERIOD).withNumberOfRepayments(LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().withAccountingRuleAsCashBased(accounts).build(null);
|
||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class ConcurrencyIntegrationTest {
|
||||
|
||||
private static final String NO_ACCOUNTING = "1";
|
||||
|
||||
final int MYTHREADS = 30;
|
||||
static final int MYTHREADS = 30;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
|
||||
+32
-32
@@ -46,20 +46,20 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
|
||||
private final String LP_PRINCIPAL = "12,000.00";
|
||||
private final String LP_REPAYMENTS = "2";
|
||||
private final String LP_REPAYMENT_PERIOD = "6";
|
||||
private final String LP_INTEREST_RATE = "1";
|
||||
private final String PRINCIPAL = "4,500.00";
|
||||
private final String LOAN_TERM_FREQUENCY = "18";
|
||||
private final String NUMBER_OF_REPAYMENTS = "9";
|
||||
private final String REPAYMENT_PERIOD = "2";
|
||||
private final String DISBURSEMENT_DATE = "30 October 2010";
|
||||
private final String LOAN_APPLICATION_SUBMISSION_DATE = "23 September 2010";
|
||||
private final String EXPECTED_DISBURSAL_DATE = "28 October 2010";
|
||||
private final String RATE_OF_INTEREST_PER_PERIOD = "2";
|
||||
private final String DATE_OF_JOINING = "04 March 2009";
|
||||
private final String INTEREST_VALUE_AMOUNT = "40.00";
|
||||
private static final String LP_PRINCIPAL = "12,000.00";
|
||||
private static final String LP_REPAYMENTS = "2";
|
||||
private static final String LP_REPAYMENT_PERIOD = "6";
|
||||
private static final String LP_INTEREST_RATE = "1";
|
||||
private static final String PRINCIPAL = "4,500.00";
|
||||
private static final String LOAN_TERM_FREQUENCY = "18";
|
||||
private static final String NUMBER_OF_REPAYMENTS = "9";
|
||||
private static final String REPAYMENT_PERIOD = "2";
|
||||
private static final String DISBURSEMENT_DATE = "30 October 2010";
|
||||
private static final String LOAN_APPLICATION_SUBMISSION_DATE = "23 September 2010";
|
||||
private static final String EXPECTED_DISBURSAL_DATE = "28 October 2010";
|
||||
private static final String RATE_OF_INTEREST_PER_PERIOD = "2";
|
||||
private static final String DATE_OF_JOINING = "04 March 2009";
|
||||
private static final String INTEREST_VALUE_AMOUNT = "40.00";
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
|
||||
@BeforeEach
|
||||
@@ -74,7 +74,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
@Test
|
||||
public void checkClientLoanCreateAndDisburseFlow() {
|
||||
// CREATE CLIENT
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, DATE_OF_JOINING);
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
|
||||
|
||||
// CREATE LOAN PRODUCT
|
||||
@@ -100,7 +100,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
// DISBURSE
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(DISBURSEMENT_DATE, loanID);
|
||||
LOG.info("DISBURSE {}", loanStatusHashMap.toString());
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
@@ -113,7 +113,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
// DIBURSE AGAIN
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(DISBURSEMENT_DATE, loanID);
|
||||
LOG.info("DISBURSE {}", loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
@@ -124,13 +124,13 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(1, 4000.0F, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 January 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 March 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("1 May 2011", this.INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("1 May 2011", INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 May 2011", repayment_without_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 July 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("1 September 2011", this.INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("1 September 2011", INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 September 2011", repayment_without_interest, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 November 2011", repayment_with_interest, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("1 January 2012", this.INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.waiveInterest("1 January 2012", INTEREST_VALUE_AMOUNT, loanID);
|
||||
this.loanTransactionHelper.makeRepayment("1 January 2012", repayment_without_interest, loanID);
|
||||
this.loanTransactionHelper.verifyRepaymentScheduleEntryFor(7, 1000.0f, loanID);
|
||||
|
||||
@@ -142,7 +142,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
@Test
|
||||
public void checkClientLoan_WRITTEN_OFF() {
|
||||
// CREATE CLIENT
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, this.DATE_OF_JOINING);
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, DATE_OF_JOINING);
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
|
||||
|
||||
// CREATE LOAN PRODUCT
|
||||
@@ -159,7 +159,7 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
|
||||
// DISBURSE
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(this.DISBURSEMENT_DATE, loanID);
|
||||
loanStatusHashMap = this.loanTransactionHelper.disburseLoan(DISBURSEMENT_DATE, loanID);
|
||||
LOG.info("DISBURSE {}", loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
|
||||
|
||||
@@ -195,9 +195,9 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
|
||||
private Integer createLoanProduct() {
|
||||
LOG.info("------------------------------CREATING NEW LOAN PRODUCT ---------------------------------------");
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(this.LP_PRINCIPAL).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(this.LP_REPAYMENT_PERIOD).withNumberOfRepayments(this.LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(this.LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
final String loanProductJSON = new LoanProductTestBuilder().withPrincipal(LP_PRINCIPAL).withRepaymentTypeAsMonth()
|
||||
.withRepaymentAfterEvery(LP_REPAYMENT_PERIOD).withNumberOfRepayments(LP_REPAYMENTS).withRepaymentTypeAsMonth()
|
||||
.withinterestRatePerPeriod(LP_INTEREST_RATE).withInterestRateFrequencyTypeAsMonths()
|
||||
.withAmortizationTypeAsEqualPrincipalPayment().withInterestTypeAsFlat().build(null);
|
||||
|
||||
return this.loanTransactionHelper.getLoanProductId(loanProductJSON);
|
||||
@@ -205,13 +205,13 @@ public class LoanWithWaiveInterestAndWriteOffIntegrationTest {
|
||||
|
||||
private Integer applyForLoanApplication(final Integer clientID, final Integer loanProductID) {
|
||||
LOG.info("--------------------------------APPLYING FOR LOAN APPLICATION--------------------------------");
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(this.PRINCIPAL)
|
||||
.withLoanTermFrequency(this.LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths()
|
||||
.withNumberOfRepayments(this.NUMBER_OF_REPAYMENTS).withRepaymentEveryAfter(this.REPAYMENT_PERIOD)
|
||||
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod(this.RATE_OF_INTEREST_PER_PERIOD)
|
||||
.withInterestTypeAsFlatBalance().withAmortizationTypeAsEqualInstallments()
|
||||
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate(this.EXPECTED_DISBURSAL_DATE)
|
||||
.withSubmittedOnDate(this.LOAN_APPLICATION_SUBMISSION_DATE).build(clientID.toString(), loanProductID.toString(), null);
|
||||
final String loanApplicationJSON = new LoanApplicationTestBuilder().withPrincipal(PRINCIPAL)
|
||||
.withLoanTermFrequency(LOAN_TERM_FREQUENCY).withLoanTermFrequencyAsMonths().withNumberOfRepayments(NUMBER_OF_REPAYMENTS)
|
||||
.withRepaymentEveryAfter(REPAYMENT_PERIOD).withRepaymentFrequencyTypeAsMonths()
|
||||
.withInterestRatePerPeriod(RATE_OF_INTEREST_PER_PERIOD).withInterestTypeAsFlatBalance()
|
||||
.withAmortizationTypeAsEqualInstallments().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
|
||||
.withExpectedDisbursementDate(EXPECTED_DISBURSAL_DATE).withSubmittedOnDate(LOAN_APPLICATION_SUBMISSION_DATE)
|
||||
.build(clientID.toString(), loanProductID.toString(), null);
|
||||
return this.loanTransactionHelper.getLoanId(loanApplicationJSON);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-9
@@ -74,13 +74,13 @@ public class SchedulerJobsTestResults {
|
||||
private static final String FROM_ACCOUNT_TYPE_SAVINGS = "2";
|
||||
private static final String TO_ACCOUNT_TYPE_LOAN = "1";
|
||||
private static final String TO_ACCOUNT_TYPE_SAVINGS = "2";
|
||||
private final String DATE_OF_JOINING = "01 January 2011";
|
||||
private static final String DATE_OF_JOINING = "01 January 2011";
|
||||
|
||||
private final String TRANSACTION_DATE = "01 March 2013";
|
||||
private static final String TRANSACTION_DATE = "01 March 2013";
|
||||
public static final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
||||
public static final String MINIMUM_OPENING_BALANCE = "1000";
|
||||
|
||||
Float SP_BALANCE = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||
static Float SP_BALANCE = Float.valueOf(MINIMUM_OPENING_BALANCE);
|
||||
|
||||
private static ResponseSpecification responseSpec;
|
||||
private static RequestSpecification requestSpec;
|
||||
@@ -399,7 +399,7 @@ public class SchedulerJobsTestResults {
|
||||
final Integer savingsProductID = createSavingsProduct(MINIMUM_OPENING_BALANCE, assetAccount, incomeAccount, expenseAccount,
|
||||
liabilityAccount);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, this.DATE_OF_JOINING);
|
||||
final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec, DATE_OF_JOINING);
|
||||
final Integer savingsID = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
|
||||
|
||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(requestSpec, responseSpec, savingsID);
|
||||
@@ -412,11 +412,10 @@ public class SchedulerJobsTestResults {
|
||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||
|
||||
// Checking initial Account entries.
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(this.SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, this.TRANSACTION_DATE, assetAccountInitialEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, this.TRANSACTION_DATE,
|
||||
liablilityAccountInitialEntry);
|
||||
final JournalEntry[] assetAccountInitialEntry = { new JournalEntry(SP_BALANCE, JournalEntry.TransactionType.DEBIT) };
|
||||
final JournalEntry[] liablilityAccountInitialEntry = { new JournalEntry(SP_BALANCE, JournalEntry.TransactionType.CREDIT) };
|
||||
this.journalEntryHelper.checkJournalEntryForAssetAccount(assetAccount, TRANSACTION_DATE, assetAccountInitialEntry);
|
||||
this.journalEntryHelper.checkJournalEntryForLiabilityAccount(liabilityAccount, TRANSACTION_DATE, liablilityAccountInitialEntry);
|
||||
|
||||
String JobName = "Update Accounting Running Balances";
|
||||
|
||||
|
||||
+8
-9
@@ -34,9 +34,9 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TemplateIntegrationTest {
|
||||
|
||||
private final String GET_TEMPLATES_URL = "/fineract-provider/api/v1/templates?tenantIdentifier=default";
|
||||
private final String GET_TEMPLATE_ID_URL = "/fineract-provider/api/v1/templates/%s?tenantIdentifier=default";
|
||||
private final String RESPONSE_ATTRIBUTE_NAME = "name";
|
||||
private static final String GET_TEMPLATES_URL = "/fineract-provider/api/v1/templates?tenantIdentifier=default";
|
||||
|
||||
private static final String RESPONSE_ATTRIBUTE_NAME = "name";
|
||||
|
||||
private ResponseSpecification responseSpec;
|
||||
private RequestSpecification requestSpec;
|
||||
@@ -61,22 +61,21 @@ public class TemplateIntegrationTest {
|
||||
map.put("text", "Hello {{template}}");
|
||||
map.put("mappers", metadata);
|
||||
|
||||
ArrayList<?> get = Utils.performServerGet(this.requestSpec, this.responseSpec, this.GET_TEMPLATES_URL, "");
|
||||
ArrayList<?> get = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_TEMPLATES_URL, "");
|
||||
final int entriesBeforeTest = get.size();
|
||||
|
||||
final Integer id = Utils.performServerPost(this.requestSpec, this.responseSpec, this.GET_TEMPLATES_URL, new Gson().toJson(map),
|
||||
final Integer id = Utils.performServerPost(this.requestSpec, this.responseSpec, GET_TEMPLATES_URL, new Gson().toJson(map),
|
||||
"resourceId");
|
||||
|
||||
final String templateUrlForId = String.format(this.GET_TEMPLATE_ID_URL, id);
|
||||
final String templateUrlForId = String.format("/fineract-provider/api/v1/templates/%s?tenantIdentifier=default", id);
|
||||
|
||||
final String getrequest2 = Utils.performServerGet(this.requestSpec, this.responseSpec, templateUrlForId,
|
||||
this.RESPONSE_ATTRIBUTE_NAME);
|
||||
final String getrequest2 = Utils.performServerGet(this.requestSpec, this.responseSpec, templateUrlForId, RESPONSE_ATTRIBUTE_NAME);
|
||||
|
||||
Assertions.assertTrue(getrequest2.equals("foo"));
|
||||
|
||||
Utils.performServerDelete(this.requestSpec, this.responseSpec, templateUrlForId, "");
|
||||
|
||||
get = Utils.performServerGet(this.requestSpec, this.responseSpec, this.GET_TEMPLATES_URL, "");
|
||||
get = Utils.performServerGet(this.requestSpec, this.responseSpec, GET_TEMPLATES_URL, "");
|
||||
final int entriesAfterTest = get.size();
|
||||
|
||||
Assertions.assertEquals(entriesBeforeTest, entriesAfterTest);
|
||||
|
||||
+10
-10
@@ -27,8 +27,8 @@ import org.apache.fineract.integrationtests.common.Utils;
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class AccountHelper {
|
||||
|
||||
private final String CREATE_GL_ACCOUNT_URL = "/fineract-provider/api/v1/glaccounts?" + Utils.TENANT_IDENTIFIER;
|
||||
private final String GL_ACCOUNT_ID_RESPONSE = "resourceId";
|
||||
private static final String CREATE_GL_ACCOUNT_URL = "/fineract-provider/api/v1/glaccounts?" + Utils.TENANT_IDENTIFIER;
|
||||
private static final String GL_ACCOUNT_ID_RESPONSE = "resourceId";
|
||||
|
||||
private final RequestSpecification requestSpec;
|
||||
private final ResponseSpecification responseSpec;
|
||||
@@ -40,29 +40,29 @@ public class AccountHelper {
|
||||
|
||||
public Account createAssetAccount() {
|
||||
final String assetAccountJSON = new GLAccountBuilder().withAccountTypeAsAsset().build();
|
||||
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL, assetAccountJSON,
|
||||
this.GL_ACCOUNT_ID_RESPONSE);
|
||||
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, CREATE_GL_ACCOUNT_URL, assetAccountJSON,
|
||||
GL_ACCOUNT_ID_RESPONSE);
|
||||
return new Account(accountID, Account.AccountType.ASSET);
|
||||
}
|
||||
|
||||
public Account createIncomeAccount() {
|
||||
final String assetAccountJSON = new GLAccountBuilder().withAccountTypeAsIncome().build();
|
||||
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL, assetAccountJSON,
|
||||
this.GL_ACCOUNT_ID_RESPONSE);
|
||||
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, CREATE_GL_ACCOUNT_URL, assetAccountJSON,
|
||||
GL_ACCOUNT_ID_RESPONSE);
|
||||
return new Account(accountID, Account.AccountType.INCOME);
|
||||
}
|
||||
|
||||
public Account createExpenseAccount() {
|
||||
final String assetAccountJSON = new GLAccountBuilder().withAccountTypeAsExpense().build();
|
||||
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL, assetAccountJSON,
|
||||
this.GL_ACCOUNT_ID_RESPONSE);
|
||||
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, CREATE_GL_ACCOUNT_URL, assetAccountJSON,
|
||||
GL_ACCOUNT_ID_RESPONSE);
|
||||
return new Account(accountID, Account.AccountType.EXPENSE);
|
||||
}
|
||||
|
||||
public Account createLiabilityAccount() {
|
||||
final String liabilityAccountJSON = new GLAccountBuilder().withAccountTypeAsLiability().build();
|
||||
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, this.CREATE_GL_ACCOUNT_URL,
|
||||
liabilityAccountJSON, this.GL_ACCOUNT_ID_RESPONSE);
|
||||
final Integer accountID = Utils.performServerPost(this.requestSpec, this.responseSpec, CREATE_GL_ACCOUNT_URL, liabilityAccountJSON,
|
||||
GL_ACCOUNT_ID_RESPONSE);
|
||||
return new Account(accountID, Account.AccountType.LIABILITY);
|
||||
}
|
||||
|
||||
|
||||
+54
-50
@@ -56,12 +56,12 @@ public class GuarantorTest {
|
||||
private LoanTransactionHelper loanTransactionHelper;
|
||||
private GuarantorHelper guarantorHelper;
|
||||
private SavingsAccountHelper savingsAccountHelper;
|
||||
private final Float self1_balance = Float.valueOf((float) 5000);
|
||||
private final Float external1_balance = Float.valueOf((float) 5000);
|
||||
private final Float external2_balance = Float.valueOf((float) 5000);
|
||||
private final Float self1_guarantee = Float.valueOf((float) 2000);
|
||||
private final Float external1_guarantee = Float.valueOf((float) 2000);
|
||||
private final Float external2_guarantee = Float.valueOf((float) 1000);
|
||||
private static final Float SELF1_BALANCE = Float.valueOf((float) 5000);
|
||||
private static final Float EXTERNAL1_BALANCE = Float.valueOf((float) 5000);
|
||||
private static final Float EXTERNAL2_BALANCE = Float.valueOf((float) 5000);
|
||||
private static final Float SELF1_GURANTEE = Float.valueOf((float) 2000);
|
||||
private static final Float EXTERNAL1_GURANTEE = Float.valueOf((float) 2000);
|
||||
private static final Float EXTERNAL2_GURANTEE = Float.valueOf((float) 1000);
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
@@ -89,11 +89,11 @@ public class GuarantorTest {
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external);
|
||||
|
||||
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
|
||||
String.valueOf(self1_balance));
|
||||
String.valueOf(SELF1_BALANCE));
|
||||
final Integer externalSavigsId_1 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
|
||||
String.valueOf(external1_balance));
|
||||
String.valueOf(EXTERNAL1_BALANCE));
|
||||
final Integer externalSavigsId_2 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external2,
|
||||
String.valueOf(external2_balance));
|
||||
String.valueOf(EXTERNAL2_BALANCE));
|
||||
|
||||
final Integer loanProductID = createLoanProductWithHoldFunds("50", "20", "20");
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
@@ -119,8 +119,9 @@ public class GuarantorTest {
|
||||
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.external.guarantee.required"));
|
||||
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
|
||||
|
||||
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID),
|
||||
String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build();
|
||||
guarantorJSON = new GuarantorTestBuilder()
|
||||
.existingCustomerWithGuaranteeAmount(String.valueOf(clientID), String.valueOf(selfSavigsId), String.valueOf(SELF1_GURANTEE))
|
||||
.build();
|
||||
Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
verifySavingsOnHoldBalance(selfSavigsId, null);
|
||||
Assertions.assertNotNull(selfGuarantee);
|
||||
@@ -132,7 +133,7 @@ public class GuarantorTest {
|
||||
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
|
||||
|
||||
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
|
||||
String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build();
|
||||
String.valueOf(externalSavigsId_1), String.valueOf(EXTERNAL1_GURANTEE)).build();
|
||||
Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_1, null);
|
||||
Assertions.assertNotNull(externalGuarantee_1);
|
||||
@@ -144,7 +145,7 @@ public class GuarantorTest {
|
||||
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
|
||||
|
||||
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external2),
|
||||
String.valueOf(externalSavigsId_2), String.valueOf(external2_guarantee)).build();
|
||||
String.valueOf(externalSavigsId_2), String.valueOf(EXTERNAL2_GURANTEE)).build();
|
||||
Integer externalGuarantee_2 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_2, null);
|
||||
Assertions.assertNotNull(externalGuarantee_2);
|
||||
@@ -153,9 +154,9 @@ public class GuarantorTest {
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(loanDisbursementDate, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
self1_hold_funds += self1_guarantee;
|
||||
external1_hold_funds += external1_guarantee;
|
||||
external2_hold_funds += external2_guarantee;
|
||||
self1_hold_funds += SELF1_GURANTEE;
|
||||
external1_hold_funds += EXTERNAL1_GURANTEE;
|
||||
external2_hold_funds += EXTERNAL2_GURANTEE;
|
||||
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
|
||||
@@ -244,13 +245,13 @@ public class GuarantorTest {
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external);
|
||||
|
||||
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
|
||||
String.valueOf(self1_balance));
|
||||
String.valueOf(SELF1_BALANCE));
|
||||
final Integer externalSavigsId_1 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
|
||||
String.valueOf(external1_balance));
|
||||
String.valueOf(EXTERNAL1_BALANCE));
|
||||
final Integer externalSavigsId_3 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
|
||||
String.valueOf(external1_balance));
|
||||
String.valueOf(EXTERNAL1_BALANCE));
|
||||
final Integer externalSavigsId_2 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external2,
|
||||
String.valueOf(external2_balance));
|
||||
String.valueOf(EXTERNAL2_BALANCE));
|
||||
|
||||
final Integer loanProductID = createLoanProductWithHoldFunds("50", "20", "20");
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
@@ -276,8 +277,9 @@ public class GuarantorTest {
|
||||
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.min.external.guarantee.required"));
|
||||
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
|
||||
|
||||
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID),
|
||||
String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build();
|
||||
guarantorJSON = new GuarantorTestBuilder()
|
||||
.existingCustomerWithGuaranteeAmount(String.valueOf(clientID), String.valueOf(selfSavigsId), String.valueOf(SELF1_GURANTEE))
|
||||
.build();
|
||||
Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
verifySavingsOnHoldBalance(selfSavigsId, null);
|
||||
Assertions.assertNotNull(selfGuarantee);
|
||||
@@ -289,7 +291,7 @@ public class GuarantorTest {
|
||||
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
|
||||
|
||||
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
|
||||
String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build();
|
||||
String.valueOf(externalSavigsId_1), String.valueOf(EXTERNAL1_GURANTEE)).build();
|
||||
Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_1, null);
|
||||
Assertions.assertNotNull(externalGuarantee_1);
|
||||
@@ -301,7 +303,7 @@ public class GuarantorTest {
|
||||
assertTrue(checkForErrorCode(errorData, "validation.msg.loan.guarantor.mandated.guarantee.required"));
|
||||
|
||||
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external2),
|
||||
String.valueOf(externalSavigsId_2), String.valueOf(external2_guarantee)).build();
|
||||
String.valueOf(externalSavigsId_2), String.valueOf(EXTERNAL2_GURANTEE)).build();
|
||||
Integer externalGuarantee_2 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
Assertions.assertNotNull(externalGuarantee_2);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_2, null);
|
||||
@@ -310,9 +312,9 @@ public class GuarantorTest {
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(loanDisbursementDate, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
self1_hold_funds += self1_guarantee;
|
||||
external1_hold_funds += external1_guarantee;
|
||||
external2_hold_funds += external2_guarantee;
|
||||
self1_hold_funds += SELF1_GURANTEE;
|
||||
external1_hold_funds += EXTERNAL1_GURANTEE;
|
||||
external2_hold_funds += EXTERNAL2_GURANTEE;
|
||||
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_2, external2_hold_funds);
|
||||
@@ -347,9 +349,9 @@ public class GuarantorTest {
|
||||
assertTrue(checkForErrorCode(error, "validation.msg.loan.guarantor.min.external.guarantee.required"));
|
||||
|
||||
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
|
||||
String.valueOf(externalSavigsId_3), String.valueOf(external1_guarantee)).build();
|
||||
String.valueOf(externalSavigsId_3), String.valueOf(EXTERNAL1_GURANTEE)).build();
|
||||
Integer externalGuarantee_3 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_3, external1_guarantee);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_3, EXTERNAL1_GURANTEE);
|
||||
Assertions.assertNotNull(externalGuarantee_3);
|
||||
|
||||
this.guarantorHelper.deleteGuarantor(externalGuarantee_1, fundDetailId, loanID);
|
||||
@@ -417,9 +419,9 @@ public class GuarantorTest {
|
||||
loanStatusHashMap = this.loanTransactionHelper.undoDisbursal(loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
verifySavingsOnHoldBalance(selfSavigsId, Float.valueOf((float) self1_guarantee));
|
||||
verifySavingsOnHoldBalance(externalSavigsId_3, Float.valueOf((float) external1_guarantee));
|
||||
verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float) external2_guarantee));
|
||||
verifySavingsOnHoldBalance(selfSavigsId, Float.valueOf((float) SELF1_GURANTEE));
|
||||
verifySavingsOnHoldBalance(externalSavigsId_3, Float.valueOf((float) EXTERNAL1_GURANTEE));
|
||||
verifySavingsOnHoldBalance(externalSavigsId_2, Float.valueOf((float) EXTERNAL2_GURANTEE));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@@ -434,9 +436,9 @@ public class GuarantorTest {
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external);
|
||||
|
||||
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
|
||||
String.valueOf(self1_balance));
|
||||
String.valueOf(SELF1_BALANCE));
|
||||
final Integer externalSavigsId_1 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
|
||||
String.valueOf(external1_balance));
|
||||
String.valueOf(EXTERNAL1_BALANCE));
|
||||
|
||||
final Integer loanProductID = createLoanProductWithHoldFunds("40", "20", "20");
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
@@ -448,14 +450,15 @@ public class GuarantorTest {
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
String guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID),
|
||||
String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build();
|
||||
String guarantorJSON = new GuarantorTestBuilder()
|
||||
.existingCustomerWithGuaranteeAmount(String.valueOf(clientID), String.valueOf(selfSavigsId), String.valueOf(SELF1_GURANTEE))
|
||||
.build();
|
||||
Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
verifySavingsOnHoldBalance(selfSavigsId, null);
|
||||
Assertions.assertNotNull(selfGuarantee);
|
||||
|
||||
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
|
||||
String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build();
|
||||
String.valueOf(externalSavigsId_1), String.valueOf(EXTERNAL1_GURANTEE)).build();
|
||||
Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_1, null);
|
||||
Assertions.assertNotNull(externalGuarantee_1);
|
||||
@@ -464,8 +467,8 @@ public class GuarantorTest {
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(loanDisbursementDate, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
self1_hold_funds += self1_guarantee;
|
||||
external1_hold_funds += external1_guarantee;
|
||||
self1_hold_funds += SELF1_GURANTEE;
|
||||
external1_hold_funds += EXTERNAL1_GURANTEE;
|
||||
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
|
||||
|
||||
@@ -485,8 +488,8 @@ public class GuarantorTest {
|
||||
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
|
||||
|
||||
this.loanTransactionHelper.recoverFromGuarantor(loanID);
|
||||
verifySavingsBalanceAndOnHoldBalance(selfSavigsId, Float.valueOf((float) 0), self1_balance - self1_hold_funds);
|
||||
verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, Float.valueOf((float) 0), external1_balance - external1_hold_funds);
|
||||
verifySavingsBalanceAndOnHoldBalance(selfSavigsId, Float.valueOf((float) 0), SELF1_BALANCE - self1_hold_funds);
|
||||
verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, Float.valueOf((float) 0), EXTERNAL1_BALANCE - external1_hold_funds);
|
||||
|
||||
}
|
||||
|
||||
@@ -577,9 +580,9 @@ public class GuarantorTest {
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID_external);
|
||||
|
||||
final Integer selfSavigsId = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID,
|
||||
String.valueOf(self1_balance));
|
||||
String.valueOf(SELF1_BALANCE));
|
||||
final Integer externalSavigsId_1 = SavingsAccountHelper.openSavingsAccount(this.requestSpec, this.responseSpec, clientID_external,
|
||||
String.valueOf(external1_balance));
|
||||
String.valueOf(EXTERNAL1_BALANCE));
|
||||
|
||||
final Integer loanProductID = createLoanProductWithHoldFunds("40", "20", "20");
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy", Locale.US);
|
||||
@@ -591,14 +594,15 @@ public class GuarantorTest {
|
||||
HashMap loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(this.requestSpec, this.responseSpec, loanID);
|
||||
LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
|
||||
|
||||
String guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID),
|
||||
String.valueOf(selfSavigsId), String.valueOf(self1_guarantee)).build();
|
||||
String guarantorJSON = new GuarantorTestBuilder()
|
||||
.existingCustomerWithGuaranteeAmount(String.valueOf(clientID), String.valueOf(selfSavigsId), String.valueOf(SELF1_GURANTEE))
|
||||
.build();
|
||||
Integer selfGuarantee = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
verifySavingsOnHoldBalance(selfSavigsId, null);
|
||||
Assertions.assertNotNull(selfGuarantee);
|
||||
|
||||
guarantorJSON = new GuarantorTestBuilder().existingCustomerWithGuaranteeAmount(String.valueOf(clientID_external),
|
||||
String.valueOf(externalSavigsId_1), String.valueOf(external1_guarantee)).build();
|
||||
String.valueOf(externalSavigsId_1), String.valueOf(EXTERNAL1_GURANTEE)).build();
|
||||
Integer externalGuarantee_1 = this.guarantorHelper.createGuarantor(loanID, guarantorJSON);
|
||||
Assertions.assertNotNull(externalGuarantee_1);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_1, null);
|
||||
@@ -607,8 +611,8 @@ public class GuarantorTest {
|
||||
loanStatusHashMap = this.loanTransactionHelper.approveLoan(loanDisbursementDate, loanID);
|
||||
LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
|
||||
LoanStatusChecker.verifyLoanIsWaitingForDisbursal(loanStatusHashMap);
|
||||
self1_hold_funds += self1_guarantee;
|
||||
external1_hold_funds += external1_guarantee;
|
||||
self1_hold_funds += SELF1_GURANTEE;
|
||||
external1_hold_funds += EXTERNAL1_GURANTEE;
|
||||
verifySavingsOnHoldBalance(selfSavigsId, self1_hold_funds);
|
||||
verifySavingsOnHoldBalance(externalSavigsId_1, external1_hold_funds);
|
||||
|
||||
@@ -630,8 +634,8 @@ public class GuarantorTest {
|
||||
todaysDate = Calendar.getInstance();
|
||||
final String LOAN_WRITEOFF_DATE = dateFormat.format(todaysDate.getTime());
|
||||
this.loanTransactionHelper.writeOffLoan(LOAN_WRITEOFF_DATE, loanID);
|
||||
verifySavingsBalanceAndOnHoldBalance(selfSavigsId, Float.valueOf((float) 0), self1_balance);
|
||||
verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, Float.valueOf((float) 0), external1_balance);
|
||||
verifySavingsBalanceAndOnHoldBalance(selfSavigsId, Float.valueOf((float) 0), SELF1_BALANCE);
|
||||
verifySavingsBalanceAndOnHoldBalance(externalSavigsId_1, Float.valueOf((float) 0), EXTERNAL1_BALANCE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ import org.apache.fineract.integrationtests.common.Utils;
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class VariableIntallmentsTransactionHelper {
|
||||
|
||||
private final String URL = "https://localhost:8443/fineract-provider/api/v1/loans/";
|
||||
private static final String URL = "https://localhost:8443/fineract-provider/api/v1/loans/";
|
||||
|
||||
private final RequestSpecification requestSpec;
|
||||
private final ResponseSpecification responseSpec;
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public class JournalEntryDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
private final Set<String> RUNNING_BALANCE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
private static final Set<String> RUNNING_BALANCE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(JournalEntryJsonInputParams.OFFICE_ID.getValue()));
|
||||
|
||||
@Autowired
|
||||
|
||||
+5
-5
@@ -58,8 +58,8 @@ public class AdHocApiResource {
|
||||
/**
|
||||
* The set of parameters that are supported in response for {@link AdhocData}
|
||||
*/
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "query", "tableName", "tableField",
|
||||
"isActive", "createdBy", "createdOn", "createdById", "updatedById", "updatedOn", "email"));
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "query", "tableName",
|
||||
"tableField", "isActive", "createdBy", "createdOn", "createdById", "updatedById", "updatedOn", "email"));
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
private final AdHocReadPlatformService adHocReadPlatformService;
|
||||
@@ -86,7 +86,7 @@ public class AdHocApiResource {
|
||||
this.context.authenticatedUser();
|
||||
final Collection<AdHocData> adhocs = this.adHocReadPlatformService.retrieveAllAdHocQuery();
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, adhocs, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, adhocs, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -97,7 +97,7 @@ public class AdHocApiResource {
|
||||
this.context.authenticatedUser();
|
||||
final AdHocData user = this.adHocReadPlatformService.retrieveNewAdHocDetails();
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, user, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, user, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -128,7 +128,7 @@ public class AdHocApiResource {
|
||||
|
||||
final AdHocData adhoc = this.adHocReadPlatformService.retrieveOne(adHocId);
|
||||
|
||||
return this.toApiJsonSerializer.serialize(settings, adhoc, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, adhoc, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
+4
-4
@@ -63,7 +63,7 @@ import org.springframework.stereotype.Component;
|
||||
+ "Data Scope: A user can only see audits that are within their data scope. However, 'head office' users can see all audits including those that aren't office/branch related e.g. Loan Product changes.\")")
|
||||
public class AuditsApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
"subresourceId", "maker", "madeOnDate", "checker", "checkedOnDate", "processingResult", "commandAsJson", "officeName",
|
||||
"groupLevelName", "groupName", "clientName", "loanAccountNo", "savingsAccountNo", "clientId", "loanId", "url"));
|
||||
|
||||
@@ -127,13 +127,13 @@ public class AuditsApiResource {
|
||||
if (parameters.isPaged()) {
|
||||
final Page<AuditData> auditEntries = this.auditReadPlatformService.retrievePaginatedAuditEntries(extraCriteria,
|
||||
settings.isIncludeJson(), parameters);
|
||||
return this.toApiJsonSerializer.serialize(settings, auditEntries, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, auditEntries, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
final Collection<AuditData> auditEntries = this.auditReadPlatformService.retrieveAuditEntries(extraCriteria,
|
||||
settings.isIncludeJson());
|
||||
|
||||
return this.toApiJsonSerializer.serialize(settings, auditEntries, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, auditEntries, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -152,7 +152,7 @@ public class AuditsApiResource {
|
||||
final AuditData auditEntry = this.auditReadPlatformService.retrieveAuditEntry(auditId);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, auditEntry, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, auditEntry, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ import org.springframework.stereotype.Component;
|
||||
@Tag(name = "Maker Checker (or 4-eye) functionality")
|
||||
public class MakercheckersApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId",
|
||||
"subresourceId", "maker", "madeOnDate", "checker", "checkedOnDate", "processingResult", "commandAsJson", "officeName",
|
||||
"groupLevelName", "groupName", "clientName", "loanAccountNo", "savingsAccountNo", "clientId", "loanId"));
|
||||
|
||||
@@ -115,7 +115,7 @@ public class MakercheckersApiResource {
|
||||
final Collection<AuditData> entries = this.readPlatformService.retrieveAllEntriesToBeChecked(extraCriteria,
|
||||
settings.isIncludeJson());
|
||||
|
||||
return this.toApiJsonSerializerAudit.serialize(settings, entries, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializerAudit.serialize(settings, entries, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
|
||||
+6
-6
@@ -52,7 +52,7 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
private Boolean completed;
|
||||
|
||||
@Column(name = "entity_type")
|
||||
private Integer entity_type;
|
||||
private Integer entityType;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "createdby_id")
|
||||
@@ -71,7 +71,7 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
|
||||
}
|
||||
|
||||
public static ImportDocument instance(final Document document, final LocalDateTime importTime, final Integer entity_type,
|
||||
public static ImportDocument instance(final Document document, final LocalDateTime importTime, final Integer entityType,
|
||||
final AppUser createdBy, final Integer totalRecords) {
|
||||
|
||||
final Boolean completed = Boolean.FALSE;
|
||||
@@ -79,18 +79,18 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
final Integer failureCount = 0;
|
||||
final LocalDateTime endTime = LocalDateTime.now();
|
||||
|
||||
return new ImportDocument(document, importTime, endTime, completed, entity_type, createdBy, totalRecords, successCount,
|
||||
return new ImportDocument(document, importTime, endTime, completed, entityType, createdBy, totalRecords, successCount,
|
||||
failureCount);
|
||||
}
|
||||
|
||||
private ImportDocument(final Document document, final LocalDateTime importTime, final LocalDateTime endTime, Boolean completed,
|
||||
final Integer entity_type, final AppUser createdBy, final Integer totalRecords, final Integer successCount,
|
||||
final Integer entityType, final AppUser createdBy, final Integer totalRecords, final Integer successCount,
|
||||
final Integer failureCount) {
|
||||
this.document = document;
|
||||
this.importTime = importTime.toDate();
|
||||
this.endTime = endTime.toDate();
|
||||
this.completed = completed;
|
||||
this.entity_type = entity_type;
|
||||
this.entityType = entityType;
|
||||
this.createdBy = createdBy;
|
||||
this.totalRecords = totalRecords;
|
||||
this.successCount = successCount;
|
||||
@@ -110,7 +110,7 @@ public class ImportDocument extends AbstractPersistableCustom {
|
||||
}
|
||||
|
||||
public Integer getEntityType() {
|
||||
return this.entity_type;
|
||||
return this.entityType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -64,7 +64,7 @@ import org.springframework.stereotype.Component;
|
||||
+ "By default caching is set to No Caching. Switching between caches results in the cache been clear e.g. from Single node to No cache and back again would clear down the single node cache.")
|
||||
public class CacheApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id"));
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id"));
|
||||
private final String resourceNameForPermissions = "CACHE";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -97,7 +97,7 @@ public class CacheApiResource {
|
||||
final Collection<CacheData> codes = this.cacheService.retrieveAll();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, codes, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, codes, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
+6
-5
@@ -69,9 +69,10 @@ public class CodeValuesApiResource {
|
||||
/**
|
||||
* The set of parameters that are supported in response for {@link CodeData}
|
||||
*/
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(CodevalueJSONinputParams.CODEVALUE_ID.getValue(),
|
||||
CodevalueJSONinputParams.NAME.getValue(), CodevalueJSONinputParams.POSITION.getValue(),
|
||||
CodevalueJSONinputParams.IS_MANDATORY.getValue(), CodevalueJSONinputParams.DESCRIPTION.getValue()));
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(CodevalueJSONinputParams.CODEVALUE_ID.getValue(), CodevalueJSONinputParams.NAME.getValue(),
|
||||
CodevalueJSONinputParams.POSITION.getValue(), CodevalueJSONinputParams.IS_MANDATORY.getValue(),
|
||||
CodevalueJSONinputParams.DESCRIPTION.getValue()));
|
||||
private final String resourceNameForPermissions = "CODEVALUE";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -106,7 +107,7 @@ public class CodeValuesApiResource {
|
||||
final Collection<CodeValueData> codeValues = this.readPlatformService.retrieveAllCodeValues(codeId);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, codeValues, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, codeValues, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -125,7 +126,7 @@ public class CodeValuesApiResource {
|
||||
final CodeValueData codeValue = this.readPlatformService.retrieveCodeValue(codeValueId);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, codeValue, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, codeValue, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@POST
|
||||
|
||||
+3
-3
@@ -67,7 +67,7 @@ public class CodesApiResource {
|
||||
/**
|
||||
* The set of parameters that are supported in response for {@link CodeData}
|
||||
*/
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "systemDefined"));
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "systemDefined"));
|
||||
private final String resourceNameForPermissions = "CODE";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
@@ -100,7 +100,7 @@ public class CodesApiResource {
|
||||
final Collection<CodeData> codes = this.readPlatformService.retrieveAllCodes();
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, codes, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, codes, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@POST
|
||||
@@ -132,7 +132,7 @@ public class CodesApiResource {
|
||||
final CodeData code = this.readPlatformService.retrieveCode(codeId);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, code, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, code, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
+3
-3
@@ -70,7 +70,7 @@ import org.springframework.stereotype.Component;
|
||||
+ "meetings-mandatory-for-jlg-loans - if set to true, enforces all JLG loans to follow a meeting schedule belonging to either the parent group or Center.")
|
||||
public class GlobalConfigurationApiResource {
|
||||
|
||||
private final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("globalConfiguration"));
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("globalConfiguration"));
|
||||
|
||||
private final String resourceNameForPermissions = "CONFIGURATION";
|
||||
|
||||
@@ -112,7 +112,7 @@ public class GlobalConfigurationApiResource {
|
||||
final GlobalConfigurationData configurationData = this.readPlatformService.retrieveGlobalConfiguration(survey);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.toApiJsonSerializer.serialize(settings, configurationData, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.toApiJsonSerializer.serialize(settings, configurationData, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@GET
|
||||
@@ -131,7 +131,7 @@ public class GlobalConfigurationApiResource {
|
||||
final GlobalConfigurationPropertyData configurationData = this.readPlatformService.retrieveGlobalConfiguration(configId);
|
||||
|
||||
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
|
||||
return this.propertyDataJsonSerializer.serialize(settings, configurationData, this.RESPONSE_DATA_PARAMETERS);
|
||||
return this.propertyDataJsonSerializer.serialize(settings, configurationData, RESPONSE_DATA_PARAMETERS);
|
||||
}
|
||||
|
||||
@PUT
|
||||
|
||||
Reference in New Issue
Block a user