DeathGun44 commented on code in PR #6084:
URL: https://github.com/apache/fineract/pull/6084#discussion_r3543596090
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/client/feign/FeignLoanTestBase.java:
##########
@@ -557,16 +723,372 @@ protected void executeInlineCOB(Long loanId) {
transactionHelper.executeInlineCOB(loanId);
}
+ protected void executeInlineCOB(List<Long> loanIds) {
+ transactionHelper.executeInlineCOB(loanIds);
+ }
+
+ protected void addCapitalizedIncome(Long loanId, String transactionDate,
double amount) {
+ transactionHelper.addCapitalizedIncome(loanId, transactionDate,
amount);
+ }
+
+ protected PostLoansLoanIdTransactionsResponse
addCapitalizedIncomeTransaction(Long loanId, String transactionDate, double
amount) {
+ return transactionHelper.addCapitalizedIncome(loanId, transactionDate,
amount);
+ }
+
+ protected PutLoansApprovedAmountResponse modifyLoanApprovedAmount(Long
loanId, BigDecimal approvedAmount) {
+ return loanHelper.modifyApprovedAmount(loanId, approvedAmount);
+ }
+
+ protected List<LoanApprovedAmountHistoryData>
getLoanApprovedAmountHistory(Long loanId) {
+ return loanHelper.getLoanApprovedAmountHistory(loanId);
+ }
+
+ protected PutLoansAvailableDisbursementAmountResponse
modifyLoanAvailableDisbursementAmount(Long loanId, BigDecimal amount) {
+ return loanHelper.modifyAvailableDisbursementAmount(loanId,
+ new
PutLoansAvailableDisbursementAmountRequest().amount(amount).locale("en"));
+ }
+
+ protected PostLoansLoanIdResponse undoDisbursement(Long loanId,
PostLoansLoanIdRequest request) {
+ return loanHelper.undoDisbursement(loanId, request);
+ }
+
+ protected void verifyBusinessEvents(BusinessEvent... businessEvents) {
+ assertNotNull(businessEvents);
+
Awaitility.await().atMost(Duration.ofSeconds(30)).pollInterval(Duration.ofMillis(500)).untilAsserted(()
-> {
+ List<ExternalEventResponse> allExternalEvents =
externalEventHelper.getAllExternalEvents();
+ assertNotNull(allExternalEvents);
+ assertTrue(businessEvents.length <= allExternalEvents.size(),
"Expected business event count is less than actual. Expected: "
+ + businessEvents.length + " Actual: " +
allExternalEvents.size());
+ for (BusinessEvent businessEvent : businessEvents) {
+ long count = allExternalEvents.stream().filter(externalEvent
-> businessEvent.verify(externalEvent, dateTimeFormatter))
+ .count();
+ assertEquals(1, count, "Expected business event not found " +
businessEvent);
+ }
+ });
+ }
+
+ protected Integer getLoanProductId(String loanProductJson) {
+ return createLoanProductFromJson(loanProductJson).intValue();
+ }
+
+ protected HashMap<String, Object> applyForLoanApplication(Integer
clientId, Integer loanProductId, String externalId) {
+ return applyForLoanApplication(clientId, loanProductId, externalId,
null);
+ }
+
+ protected HashMap<String, Object> applyForLoanApplication(Integer
clientId, Integer loanProductId, String externalId,
+ String linkAccountId) {
+ final String loanApplicationJSON = new
org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder()
+
.withPrincipal("1000").withLoanTermFrequency("1").withLoanTermFrequencyAsMonths().withNumberOfRepayments("1")
+
.withRepaymentEveryAfter("1").withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("0")
+
.withInterestTypeAsDecliningBalance().withAmortizationTypeAsEqualPrincipalPayments()
+
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate("03
September 2022")
+ .withSubmittedOnDate("01 September
2022").withLoanType("individual").withInArrearsTolerance("1001")
+ .withExternalId(externalId).build(clientId.toString(),
loanProductId.toString(), linkAccountId);
+ Long loanId = applyForLoanFromJson(loanApplicationJSON);
+ HashMap<String, Object> result = new HashMap<>();
+ result.put("resourceId", loanId.intValue());
+ result.put("resourceExternalId",
getLoanDetails(loanId).getExternalId());
+ return result;
+ }
+
+ protected HashMap<String, Object> getLoanIdFromApplication(String
loanApplicationJson) {
+ Long loanId = applyForLoanFromJson(loanApplicationJson);
+ HashMap<String, Object> result = new HashMap<>();
+ result.put("resourceId", loanId.intValue());
+ result.put("resourceExternalId",
getLoanDetails(loanId).getExternalId());
+ return result;
+ }
+
+ protected HashMap<String, Object> disburseLoanAsMap(String date, Integer
loanId, String transactionAmount, String externalId) {
+ PostLoansLoanIdResponse response =
loanHelper.disburseLoanWithExternalId(date, loanId.longValue(),
transactionAmount, externalId);
+ HashMap<String, Object> result = new HashMap<>();
+ result.put("subResourceExternalId",
response.getSubResourceExternalId());
+ return result;
+ }
+
+ protected HashMap<String, Object> disburseLoanAsMap(String date, Integer
loanId, String transactionAmount) {
+ PostLoansLoanIdResponse response = loanHelper.disburseLoan(date,
loanId.longValue(), transactionAmount);
+ HashMap<String, Object> result = new HashMap<>();
+ result.put("subResourceExternalId",
response.getSubResourceExternalId());
+ return result;
+ }
+
+ protected HashMap<String, Object> disburseLoan(String date, Integer
loanId, String transactionAmount, String externalId) {
+ return disburseLoanAsMap(date, loanId, transactionAmount, externalId);
+ }
+
+ protected HashMap<String, Object> disburseLoan(String date, Integer
loanId, String transactionAmount) {
+ return disburseLoanAsMap(date, loanId, transactionAmount);
+ }
Review Comment:
Replaced all HashMap<String, Object> returns with PostLoansResponse /
PostLoansLoanIdResponse. Removed disburseLoanAsMap entirely.
--
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]