budaidev commented on code in PR #6050:
URL: https://github.com/apache/fineract/pull/6050#discussion_r3487702611
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/FeignLoanTestBase.java:
##########
@@ -239,6 +285,129 @@ protected void undoRepayment(Long loanId, Long
transactionId, String transaction
transactionHelper.undoRepayment(loanId, transactionId,
transactionDate);
}
+ protected PostLoansLoanIdTransactionsResponse
makeMerchantIssuedRefund(Long loanId, PostLoansLoanIdTransactionsRequest
request) {
+ return transactionHelper.makeMerchantIssuedRefund(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makePayoutRefund(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makePayoutRefund(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeGoodwillCredit(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeGoodwillCredit(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
makeInterestPaymentWaiver(Long loanId, PostLoansLoanIdTransactionsRequest
request) {
+ return transactionHelper.makeInterestPaymentWaiver(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeLoanRepayment(Long
loanId, String command, String date, Double amount) {
+ return transactionHelper.makeLoanRepayment(loanId, command, date,
amount);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeLoanRepayment(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeLoanRepayment(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeLoanRepayment(String
loanExternalId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeLoanRepayment(loanExternalId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse chargeOffLoan(Long loanId,
PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.chargeOffLoan(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
makeMerchantIssuedRefund(String loanExternalId,
+ PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeMerchantIssuedRefund(loanExternalId,
request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
makeCreditBalanceRefund(String loanExternalId,
+ PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeCreditBalanceRefund(loanExternalId,
request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
reverseLoanTransaction(String loanExternalId, Long transactionId,
+ PostLoansLoanIdTransactionsTransactionIdRequest request) {
+ return transactionHelper.reverseLoanTransaction(loanExternalId,
transactionId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
chargebackLoanTransaction(String loanExternalId, String transactionExternalId,
+ PostLoansLoanIdTransactionsTransactionIdRequest request) {
+ return transactionHelper.chargebackLoanTransaction(loanExternalId,
transactionExternalId, request);
+ }
+
+ protected GetLoansLoanIdResponse getLoanDetails(String loanExternalId) {
+ return loanHelper.getLoanDetailsByExternalId(loanExternalId);
+ }
+
+ protected void disburseLoanWithAmount(Long loanId, String date, double
amount) {
+ loanHelper.disburseLoanWithAmount(loanId, date, amount);
+ }
+
+ protected void reverseRepayment(Long loanId, Long transactionId, String
transactionDate) {
+ reverseLoanTransaction(loanId, transactionId, transactionDate);
+ }
+
+ protected void updateGlobalConfiguration(String configName,
PutGlobalConfigurationsRequest request) {
+ globalConfigurationHelper.updateGlobalConfiguration(configName,
request);
+ }
+
+ protected void runPeriodicAccrualAccounting(String date) {
+ PeriodicAccrualAccountingHelper.runPeriodicAccrualAccounting(date);
+ }
+
+ protected GetJournalEntriesTransactionIdResponse getJournalEntries(String
transactionId) {
+ return journalHelper.getJournalEntries(transactionId);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse reverseLoanTransaction(Long
loanId, Long transactionId, String transactionDate) {
+ return transactionHelper.reverseLoanTransaction(loanId, transactionId,
transactionDate);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse reverseLoanTransaction(Long
loanId, Long transactionId,
+ PostLoansLoanIdTransactionsTransactionIdRequest request) {
+ return transactionHelper.reverseLoanTransaction(loanId, transactionId,
request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeCreditBalanceRefund(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeCreditBalanceRefund(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
createManualInterestRefund(Long loanId, Long targetTransactionId, String
transactionDate,
+ Double amount, String externalId) {
+ return transactionHelper.createManualInterestRefund(loanId,
targetTransactionId, transactionDate, amount, externalId);
+ }
+
+ protected void undoLoanApproval(Long loanId) {
+ undoApproval(loanId);
+ }
+
+ protected void rejectLoan(Long loanId, String rejectedOnDate) {
+ rejectLoan(loanId, LoanRequestBuilders.rejectLoan(rejectedOnDate));
+ }
+
+ protected void changeLoanFraudState(Long loanId, boolean fraudState) {
+ loanHelper.markAsFraud(loanId, fraudState);
+ }
+
+ protected Long getTransactionId(Long loanId, String type, String date) {
+ GetLoansLoanIdResponse loan = getLoanDetails(loanId);
+ return loan.getTransactions().stream()
+ .filter(tr ->
java.util.Objects.equals(tr.getType().getValue(), type)
Review Comment:
We should do an import here, instead of FQN.
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/helpers/FeignJournalEntryHelper.java:
##########
@@ -42,32 +47,62 @@ public GetJournalEntriesTransactionIdResponse
getJournalEntriesForLoan(Long loan
}
public GetJournalEntriesTransactionIdResponse
getJournalEntriesByTransactionId(String transactionId) {
- return ok(() ->
fineractClient.journalEntries().retrieveAllJournalEntries(Map.of("transactionId",
transactionId)));
+ return ok(() -> fineractClient.journalEntries()
+ .retrieveAllJournalEntries(Map.of("transactionId",
transactionId, "orderBy", "id", "sortOrder", "desc")));
+ }
+
+ public GetJournalEntriesTransactionIdResponse getJournalEntries(String
transactionId) {
+ return getJournalEntriesByTransactionId(transactionId);
+ }
+
+ public void verifyTRJournalEntries(Long transactionId,
LoanTestData.Journal... entries) {
+ assertNotNull(transactionId, "transactionId is null");
+ GetJournalEntriesTransactionIdResponse journalEntries =
getJournalEntries("L" + transactionId);
+ assertEquals(entries.length, journalEntries.getPageItems().size());
+ verifyJournalEntriesMatch(new
ArrayList<>(journalEntries.getPageItems()), entries);
}
public void verifyJournalEntries(Long loanId, LoanTestData.Journal...
expectedEntries) {
GetJournalEntriesTransactionIdResponse journalEntries =
getJournalEntriesForLoan(loanId);
assertNotNull(journalEntries);
assertNotNull(journalEntries.getPageItems());
- List<JournalEntryTransactionItem> actualEntries =
journalEntries.getPageItems();
+ List<JournalEntryTransactionItem> actualEntries = new
ArrayList<>(journalEntries.getPageItems());
assertEquals(expectedEntries.length, actualEntries.size(),
"Expected " + expectedEntries.length + " journal entries but
found " + actualEntries.size());
- for (int i = 0; i < expectedEntries.length; i++) {
- LoanTestData.Journal expected = expectedEntries[i];
- JournalEntryTransactionItem actual = actualEntries.get(i);
-
- Double expectedAmount = expected.amount;
- Double actualAmount = actual.getAmount();
- assertEquals(0, Double.compare(expectedAmount, actualAmount),
- "Journal entry " + i + " amount mismatch: expected " +
expectedAmount + " but got " + actualAmount);
- assertEquals(expected.account.getAccountID().longValue(),
actual.getGlAccountId(), "Journal entry " + i + " account mismatch");
- assertEquals(expected.type, actual.getEntryType().getValue(),
"Journal entry " + i + " type mismatch");
- }
+ verifyJournalEntriesMatch(actualEntries, expectedEntries);
+ }
+
+ private static void
verifyJournalEntriesMatch(List<JournalEntryTransactionItem> actualEntries,
LoanTestData.Journal[] expectedEntries) {
Review Comment:
I like the way that it is not order dependent. One caveat though:
- if you expect duplicates, you cannot check them, since anyMatch will work
even if there is one record there.
- for the same reason unexpected extra entries could get in undetected. The
length and the matches will pass, but you can have an extra record there.
Recommendation: when you are making a match, remove it from the expected
result list, that way you can check for the exact result.
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/FeignLoanTestBase.java:
##########
@@ -239,6 +285,129 @@ protected void undoRepayment(Long loanId, Long
transactionId, String transaction
transactionHelper.undoRepayment(loanId, transactionId,
transactionDate);
}
+ protected PostLoansLoanIdTransactionsResponse
makeMerchantIssuedRefund(Long loanId, PostLoansLoanIdTransactionsRequest
request) {
+ return transactionHelper.makeMerchantIssuedRefund(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makePayoutRefund(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makePayoutRefund(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeGoodwillCredit(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeGoodwillCredit(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
makeInterestPaymentWaiver(Long loanId, PostLoansLoanIdTransactionsRequest
request) {
+ return transactionHelper.makeInterestPaymentWaiver(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeLoanRepayment(Long
loanId, String command, String date, Double amount) {
+ return transactionHelper.makeLoanRepayment(loanId, command, date,
amount);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeLoanRepayment(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeLoanRepayment(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeLoanRepayment(String
loanExternalId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeLoanRepayment(loanExternalId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse chargeOffLoan(Long loanId,
PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.chargeOffLoan(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
makeMerchantIssuedRefund(String loanExternalId,
+ PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeMerchantIssuedRefund(loanExternalId,
request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
makeCreditBalanceRefund(String loanExternalId,
+ PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeCreditBalanceRefund(loanExternalId,
request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
reverseLoanTransaction(String loanExternalId, Long transactionId,
+ PostLoansLoanIdTransactionsTransactionIdRequest request) {
+ return transactionHelper.reverseLoanTransaction(loanExternalId,
transactionId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
chargebackLoanTransaction(String loanExternalId, String transactionExternalId,
+ PostLoansLoanIdTransactionsTransactionIdRequest request) {
+ return transactionHelper.chargebackLoanTransaction(loanExternalId,
transactionExternalId, request);
+ }
+
+ protected GetLoansLoanIdResponse getLoanDetails(String loanExternalId) {
+ return loanHelper.getLoanDetailsByExternalId(loanExternalId);
+ }
+
+ protected void disburseLoanWithAmount(Long loanId, String date, double
amount) {
+ loanHelper.disburseLoanWithAmount(loanId, date, amount);
+ }
+
+ protected void reverseRepayment(Long loanId, Long transactionId, String
transactionDate) {
+ reverseLoanTransaction(loanId, transactionId, transactionDate);
+ }
+
+ protected void updateGlobalConfiguration(String configName,
PutGlobalConfigurationsRequest request) {
+ globalConfigurationHelper.updateGlobalConfiguration(configName,
request);
+ }
+
+ protected void runPeriodicAccrualAccounting(String date) {
+ PeriodicAccrualAccountingHelper.runPeriodicAccrualAccounting(date);
+ }
+
+ protected GetJournalEntriesTransactionIdResponse getJournalEntries(String
transactionId) {
+ return journalHelper.getJournalEntries(transactionId);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse reverseLoanTransaction(Long
loanId, Long transactionId, String transactionDate) {
+ return transactionHelper.reverseLoanTransaction(loanId, transactionId,
transactionDate);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse reverseLoanTransaction(Long
loanId, Long transactionId,
+ PostLoansLoanIdTransactionsTransactionIdRequest request) {
+ return transactionHelper.reverseLoanTransaction(loanId, transactionId,
request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeCreditBalanceRefund(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeCreditBalanceRefund(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
createManualInterestRefund(Long loanId, Long targetTransactionId, String
transactionDate,
+ Double amount, String externalId) {
+ return transactionHelper.createManualInterestRefund(loanId,
targetTransactionId, transactionDate, amount, externalId);
+ }
+
+ protected void undoLoanApproval(Long loanId) {
+ undoApproval(loanId);
+ }
+
+ protected void rejectLoan(Long loanId, String rejectedOnDate) {
+ rejectLoan(loanId, LoanRequestBuilders.rejectLoan(rejectedOnDate));
+ }
+
+ protected void changeLoanFraudState(Long loanId, boolean fraudState) {
+ loanHelper.markAsFraud(loanId, fraudState);
+ }
+
+ protected Long getTransactionId(Long loanId, String type, String date) {
+ GetLoansLoanIdResponse loan = getLoanDetails(loanId);
+ return loan.getTransactions().stream()
+ .filter(tr ->
java.util.Objects.equals(tr.getType().getValue(), type)
+ && java.util.Objects.equals(tr.getDate(),
LocalDate.parse(date, dateTimeFormatter)))
+ .findAny().orElseThrow().getId();
+ }
+
+ protected
org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse
getLoanTransactionDetails(Long loanId,
Review Comment:
We should do an import here, instead of FQN.
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/FeignLoanTestBase.java:
##########
@@ -247,6 +416,30 @@ protected void verifyJournalEntriesSequentially(Long
loanId, LoanTestData.Journa
journalHelper.verifyJournalEntriesSequentially(loanId,
expectedEntries);
}
+ protected LoanTestData.Journal journalEntry(double amount, Account
account, String type) {
+ return "DEBIT".equals(type) ?
LoanTestData.Journal.debit(account.getAccountID().longValue(), amount)
+ :
LoanTestData.Journal.credit(account.getAccountID().longValue(), amount);
+ }
+
+ protected GetLoansLoanIdTransactionsTemplateResponse getPrepayAmount(Long
loanId, String date) {
+ return transactionHelper.getPrepaymentAmount(loanId, date,
LoanTestData.DATETIME_PATTERN);
+ }
+
+ protected Long verifyPrepayAmountByRepayment(Long loanId, String date) {
+ GetLoansLoanIdTransactionsTemplateResponse prepayAmount =
getPrepayAmount(loanId, date);
+ Double amountToPrepayLoan = prepayAmount.getAmount();
+ Long repaymentId = null;
+ if (amountToPrepayLoan != null && amountToPrepayLoan > 0) {
+ PostLoansLoanIdTransactionsResponse repayment =
transactionHelper.makeLoanRepayment(loanId, "repayment", date,
+ amountToPrepayLoan);
+ org.junit.jupiter.api.Assertions.assertNotNull(repayment);
Review Comment:
We should do an import here, instead of FQN.
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/modules/LoanTestValidators.java:
##########
@@ -60,16 +60,20 @@ public static void
verifyTransactions(GetLoansLoanIdResponse loanDetails, LoanTe
return;
}
- boolean found = transactionsByDate.stream()
- .anyMatch(item ->
Objects.equals(Utils.getDoubleValue(item.getAmount()), tr.amount)
- && Objects.equals(item.getType().getValue(),
tr.type)
- &&
Objects.equals(Utils.getDoubleValue(item.getOutstandingLoanBalance()),
tr.outstandingPrincipal)
- &&
Objects.equals(Utils.getDoubleValue(item.getPrincipalPortion()),
tr.principalPortion)
- &&
Objects.equals(Utils.getDoubleValue(item.getInterestPortion()),
tr.interestPortion)
- &&
Objects.equals(Utils.getDoubleValue(item.getFeeChargesPortion()), tr.feePortion)
- &&
Objects.equals(Utils.getDoubleValue(item.getPenaltyChargesPortion()),
tr.penaltyPortion)
- &&
Objects.equals(Utils.getDoubleValue(item.getOverpaymentPortion()),
tr.overpaymentPortion)
- &&
Objects.equals(Utils.getDoubleValue(item.getUnrecognizedIncomePortion()),
tr.unrecognizedPortion));
+ boolean found = transactionsByDate.stream().anyMatch(item ->
Objects.equals(Utils.getDoubleValue(item.getAmount()), tr.amount)
Review Comment:
I wonder about these changes. If we expected null for a transaction, does
this mean we don't care about the result? As I understand this change will
modify the behavior from null expectation to when we pass null we don't care
about the result. Worth a check here.
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/modules/LoanProductTemplates.java:
##########
@@ -350,8 +458,30 @@ default PostLoanProductsRequest create4IProgressive() {
.principalVariationsForBorrowerCycle(List.of())//
.interestRateVariationsForBorrowerCycle(List.of())//
.numberOfRepaymentVariationsForBorrowerCycle(List.of())//
- .accountingRule(1)//
+ .accountingRule(3)//
.canUseForTopup(false)//
+ .fundSourceAccountId(getLiabilityAccountId("fundSource"))//
+ .loanPortfolioAccountId(getAssetAccountId("loansReceivable"))//
+ .transfersInSuspenseAccountId(getAssetAccountId("suspense"))//
+
.interestOnLoanAccountId(getIncomeAccountId("interestIncome"))//
+ .incomeFromFeeAccountId(getIncomeAccountId("feeIncome"))//
+
.incomeFromPenaltyAccountId(getIncomeAccountId("penaltyIncome"))//
+
.incomeFromRecoveryAccountId(getIncomeAccountId("recoveries"))//
+ .writeOffAccountId(getExpenseAccountId("writtenOff"))//
+
.overpaymentLiabilityAccountId(getLiabilityAccountId("overpayment"))//
+
.receivableInterestAccountId(getAssetAccountId("interestReceivable"))//
+ .receivableFeeAccountId(getAssetAccountId("feeReceivable"))//
+
.receivablePenaltyAccountId(getAssetAccountId("penaltyReceivable"))//
+
.goodwillCreditAccountId(getExpenseAccountId("goodwillExpense"))//
+
.incomeFromGoodwillCreditInterestAccountId(getIncomeAccountId("interestIncomeChargeOff"))//
+
.incomeFromGoodwillCreditFeesAccountId(getIncomeAccountId("feeChargeOff"))//
+
.incomeFromGoodwillCreditPenaltyAccountId(getIncomeAccountId("feeChargeOff"))//
Review Comment:
isn't this penaltyChargeOff?
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/FeignLoanTestBase.java:
##########
@@ -239,6 +285,129 @@ protected void undoRepayment(Long loanId, Long
transactionId, String transaction
transactionHelper.undoRepayment(loanId, transactionId,
transactionDate);
}
+ protected PostLoansLoanIdTransactionsResponse
makeMerchantIssuedRefund(Long loanId, PostLoansLoanIdTransactionsRequest
request) {
+ return transactionHelper.makeMerchantIssuedRefund(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makePayoutRefund(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makePayoutRefund(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeGoodwillCredit(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeGoodwillCredit(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
makeInterestPaymentWaiver(Long loanId, PostLoansLoanIdTransactionsRequest
request) {
+ return transactionHelper.makeInterestPaymentWaiver(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeLoanRepayment(Long
loanId, String command, String date, Double amount) {
+ return transactionHelper.makeLoanRepayment(loanId, command, date,
amount);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeLoanRepayment(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeLoanRepayment(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeLoanRepayment(String
loanExternalId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeLoanRepayment(loanExternalId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse chargeOffLoan(Long loanId,
PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.chargeOffLoan(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
makeMerchantIssuedRefund(String loanExternalId,
+ PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeMerchantIssuedRefund(loanExternalId,
request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
makeCreditBalanceRefund(String loanExternalId,
+ PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeCreditBalanceRefund(loanExternalId,
request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
reverseLoanTransaction(String loanExternalId, Long transactionId,
+ PostLoansLoanIdTransactionsTransactionIdRequest request) {
+ return transactionHelper.reverseLoanTransaction(loanExternalId,
transactionId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
chargebackLoanTransaction(String loanExternalId, String transactionExternalId,
+ PostLoansLoanIdTransactionsTransactionIdRequest request) {
+ return transactionHelper.chargebackLoanTransaction(loanExternalId,
transactionExternalId, request);
+ }
+
+ protected GetLoansLoanIdResponse getLoanDetails(String loanExternalId) {
+ return loanHelper.getLoanDetailsByExternalId(loanExternalId);
+ }
+
+ protected void disburseLoanWithAmount(Long loanId, String date, double
amount) {
+ loanHelper.disburseLoanWithAmount(loanId, date, amount);
+ }
+
+ protected void reverseRepayment(Long loanId, Long transactionId, String
transactionDate) {
+ reverseLoanTransaction(loanId, transactionId, transactionDate);
+ }
+
+ protected void updateGlobalConfiguration(String configName,
PutGlobalConfigurationsRequest request) {
+ globalConfigurationHelper.updateGlobalConfiguration(configName,
request);
+ }
+
+ protected void runPeriodicAccrualAccounting(String date) {
+ PeriodicAccrualAccountingHelper.runPeriodicAccrualAccounting(date);
+ }
+
+ protected GetJournalEntriesTransactionIdResponse getJournalEntries(String
transactionId) {
+ return journalHelper.getJournalEntries(transactionId);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse reverseLoanTransaction(Long
loanId, Long transactionId, String transactionDate) {
+ return transactionHelper.reverseLoanTransaction(loanId, transactionId,
transactionDate);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse reverseLoanTransaction(Long
loanId, Long transactionId,
+ PostLoansLoanIdTransactionsTransactionIdRequest request) {
+ return transactionHelper.reverseLoanTransaction(loanId, transactionId,
request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse makeCreditBalanceRefund(Long
loanId, PostLoansLoanIdTransactionsRequest request) {
+ return transactionHelper.makeCreditBalanceRefund(loanId, request);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
createManualInterestRefund(Long loanId, Long targetTransactionId, String
transactionDate,
+ Double amount, String externalId) {
+ return transactionHelper.createManualInterestRefund(loanId,
targetTransactionId, transactionDate, amount, externalId);
+ }
+
+ protected void undoLoanApproval(Long loanId) {
+ undoApproval(loanId);
+ }
+
+ protected void rejectLoan(Long loanId, String rejectedOnDate) {
+ rejectLoan(loanId, LoanRequestBuilders.rejectLoan(rejectedOnDate));
+ }
+
+ protected void changeLoanFraudState(Long loanId, boolean fraudState) {
+ loanHelper.markAsFraud(loanId, fraudState);
+ }
+
+ protected Long getTransactionId(Long loanId, String type, String date) {
+ GetLoansLoanIdResponse loan = getLoanDetails(loanId);
+ return loan.getTransactions().stream()
+ .filter(tr ->
java.util.Objects.equals(tr.getType().getValue(), type)
+ && java.util.Objects.equals(tr.getDate(),
LocalDate.parse(date, dateTimeFormatter)))
Review Comment:
We should do an import here, instead of FQN.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]