budaidev commented on code in PR #6084:
URL: https://github.com/apache/fineract/pull/6084#discussion_r3525582208


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanMultipleDisbursementsIntegrationTest.java:
##########
@@ -195,46 +167,38 @@ public void 
checkThatAllMultiDisbursalsAppearOnLoanScheduleAndOutStandingBalance
         BigDecimal totalPrincipalDisbursed = BigDecimal.ZERO;
         // First 8 lines should be disbursals
         for (int i = 0; i < loanScheduleLineCount - 1; i++) {
-            final Integer period = (Integer) loanSchedule.get(i).get("period");
-            final BigDecimal principalDisbursed = BigDecimal
-                    
.valueOf(Double.parseDouble(loanSchedule.get(i).get("principalDisbursed").toString()));
+            final Integer period = loanSchedule.get(i).getPeriod();
+            final BigDecimal principalDisbursed = 
loanSchedule.get(i).getPrincipalLoanBalanceOutstanding();

Review Comment:
   that's not the same as before. Can you check maybe on the 
getSummary().getPrincipalDisbursed()? 



##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountDisbursementToSavingsWithAutoDownPaymentTest.java:
##########
@@ -101,170 +115,90 @@ public void 
loanDisbursementToSavingsWithAutoDownPaymentAndStandingInstructionsT
                     installment(250.0, false, "15 April 2023")//
             );
 
-            // verify Disbursement Transaction is account transfer
-            verifyTransactionIsAccountTransfer(LocalDate.of(2023, 3, 1), 
1000.0f, loanId.intValue(), "disbursement");
+            verifyTransactionIsAccountTransfer(LocalDate.of(2023, Month.MARCH, 
1), 1000.0, loanId, "disbursement");
 
-            // verify Down payment Transaction is account transfer
-            verifyTransactionIsAccountTransfer(LocalDate.of(2023, 3, 1), 
250.0f, loanId.intValue(), "downPayment");
+            verifyTransactionIsAccountTransfer(LocalDate.of(2023, Month.MARCH, 
1), 250.0, loanId, "downPayment");
 
-            // verify savings transactions
-            verifySavingsTransactions(savingsAccountId, savingsAccountHelper);
+            verifySavingsTransactions(savingsAccountId);
 
             verifyBusinessEvent();
-            disableLoanBalanceChangedBusinessEvent();
+            
externalEventHelper.disableBusinessEvent(LOAN_BALANCE_CHANGED_EVENT);
         });
     }
 
-    private void verifySavingsTransactions(final Integer savingsId, final 
SavingsAccountHelper savingsAccountHelper) {
-        Map<String, Object> queryParams = new HashMap<>();
-        SavingsAccountTransactionsSearchResponse transactionsResponse = 
savingsAccountHelper.searchSavingsTransactions(savingsId,
-                queryParams);
+    private void verifySavingsTransactions(final Long savingsId) {
+        SavingsAccountData savingsAccount = 
savingsHelper.getSavingsDetails(savingsId);
+        List<SavingsAccountTransactionData> pageItemsList = 
savingsAccount.getTransactions();
 
-        Assertions.assertNotNull(transactionsResponse);
-        assertEquals(2, transactionsResponse.getTotal());
-        Assertions.assertNotNull(transactionsResponse.getContent());
-        List<GetSavingsAccountTransactionsPageItem> pageItemsList = 
List.copyOf(transactionsResponse.getContent());
+        Assertions.assertNotNull(pageItemsList);
         assertEquals(2, pageItemsList.size());
 
-        // check withdrawal
-        GetSavingsAccountTransactionsPageItem withDrawalTransaction = 
pageItemsList.get(0);
+        SavingsAccountTransactionData withDrawalTransaction = 
pageItemsList.get(0);
         assertEquals("savingsAccountTransactionType.withdrawal", 
withDrawalTransaction.getTransactionType().getCode());
         assertTrue(MathUtil.isEqualTo(BigDecimal.valueOf(250), 
withDrawalTransaction.getAmount()));
-        assertEquals("DEBIT", withDrawalTransaction.getEntryType().getValue());
+        assertEquals(SavingsAccountTransactionData.EntryTypeEnum.DEBIT, 
withDrawalTransaction.getEntryType());
         assertTrue(MathUtil.isEqualTo(BigDecimal.valueOf(750), 
withDrawalTransaction.getRunningBalance()));
 
-        // check deposit
-        GetSavingsAccountTransactionsPageItem depositTransaction = 
pageItemsList.get(1);
+        SavingsAccountTransactionData depositTransaction = 
pageItemsList.get(1);
         assertEquals("savingsAccountTransactionType.deposit", 
depositTransaction.getTransactionType().getCode());
         assertTrue(MathUtil.isEqualTo(BigDecimal.valueOf(1000), 
depositTransaction.getAmount()));
-        assertEquals("CREDIT", depositTransaction.getEntryType().getValue());
+        assertEquals(SavingsAccountTransactionData.EntryTypeEnum.CREDIT, 
depositTransaction.getEntryType());
         assertTrue(MathUtil.isEqualTo(BigDecimal.valueOf(1000), 
depositTransaction.getRunningBalance()));
-
     }
 
     private void mapLiabilityTransferFinancialActivity(Long loanProductId) {
-        FinancialActivityAccountHelper financialActivityAccountHelper = new 
FinancialActivityAccountHelper(requestSpec);
-        GetLoanProductsProductIdResponse getLoanProductsProductIdResponse = 
loanProductHelper.retrieveLoanProductById(loanProductId);
-        Integer financialActivityAccountId = (Integer) 
financialActivityAccountHelper.createFinancialActivityAccount(
-                
AccountingConstants.FinancialActivity.LIABILITY_TRANSFER.getValue(),
-                
getLoanProductsProductIdResponse.getAccountingMappings().getFundSourceAccount().getId().intValue(),
 responseSpec,
-                CommonConstants.RESPONSE_RESOURCE_ID);
-        assertNotNull(financialActivityAccountId);
-    }
-
-    private Long createLoanWithLinkedAccountAndStandingInstructions(final 
Integer clientID, final Long loanProductID,
-            final Integer savingsId, final String externalId) {
-
-        String loanApplicationJSON = new 
LoanApplicationTestBuilder().withPrincipal("1000").withLoanTermFrequency("45")
-                
.withLoanTermFrequencyAsDays().withNumberOfRepayments("3").withRepaymentEveryAfter("15").withRepaymentFrequencyTypeAsDays()
-                
.withInterestRatePerPeriod("0").withInterestTypeAsDecliningBalance().withAmortizationTypeAsEqualPrincipalPayments()
-                
.withInterestCalculationPeriodTypeSameAsRepaymentPeriod().withExpectedDisbursementDate("01
 March 2023")
-                .withSubmittedOnDate("01 March 
2023").withLoanType("individual").withExternalId(externalId)
-                
.withCreateStandingInstructionAtDisbursement().build(clientID.toString(), 
loanProductID.toString(), savingsId.toString());
-
-        final Integer loanId = 
loanTransactionHelper.getLoanId(loanApplicationJSON);
-        loanTransactionHelper.approveLoan("01 March 2023", "1000", loanId, 
null);
-        return loanId.longValue();
+        Long fundSourceAccountId = 
retrieveLoanProduct(loanProductId).getAccountingMappings().getFundSourceAccount().getId();
+        PostFinancialActivityAccountsResponse response = 
financialActivityAccountHelper
+                .createFinancialActivityAccount(new 
PostFinancialActivityAccountsRequest()
+                        .financialActivityId((long) 
AccountingConstants.FinancialActivity.LIABILITY_TRANSFER.getValue())
+                        .glAccountId(fundSourceAccountId));
+        assertNotNull(response.getResourceId());
     }
 
-    private Integer createApproveActivateSavingsAccountDailyPosting(final 
Integer clientID, final String startDate,
-            final SavingsAccountHelper savingsAccountHelper) {
-        final Integer savingsProductID = createSavingsProductDailyPosting();
-        assertNotNull(savingsProductID);
-        return 
savingsAccountHelper.createApproveActivateSavingsAccount(clientID, 
savingsProductID, startDate);
+    private Long createApproveActivateSavingsAccountDailyPosting(final Long 
clientId, final String startDate) {
+        final Long savingsProductId = createSavingsProductDailyPosting();
+        assertNotNull(savingsProductId);
+        return savingsHelper.createApproveActivateSavings(clientId, 
savingsProductId, startDate);
     }
 
-    private Integer createSavingsProductDailyPosting() {
-        SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
-        final String savingsProductJSON = 
savingsProductHelper.withInterestCompoundingPeriodTypeAsDaily()
-                
.withInterestPostingPeriodTypeAsMonthly().withInterestCalculationPeriodTypeAsDailyBalance().build();
-        return SavingsProductHelper.createSavingsProduct(savingsProductJSON, 
requestSpec, responseSpec);
+    private Long createSavingsProductDailyPosting() {
+        return 
savingsProductHelper.createSavingsProduct(SavingsRequestBuilders.defaultSavingsProduct()).getResourceId();
     }
 
     private Long 
createLoanProductWithMultiDisbursalAndRepaymentsWithEnableDownPayment() {
-        boolean multiDisburseEnabled = true;
         PostLoanProductsRequest product = 
createOnePeriod30DaysLongNoInterestPeriodicAccrualProduct();
-        product.setMultiDisburseLoan(multiDisburseEnabled);
+        product.setMultiDisburseLoan(true);
         product.setNumberOfRepayments(3);
         product.setRepaymentEvery(15);
-
-        if (!multiDisburseEnabled) {
-            product.disallowExpectedDisbursements(null);
-            product.setAllowApprovedDisbursedAmountsOverApplied(null);
-            product.overAppliedCalculationType(null);
-            product.overAppliedNumber(null);
-        }
-
         product.setEnableDownPayment(true);
         
product.setDisbursedAmountPercentageForDownPayment(DOWN_PAYMENT_PERCENTAGE);
         product.setEnableAutoRepaymentForDownPayment(true);
-
-        PostLoanProductsResponse loanProductResponse = 
loanProductHelper.createLoanProduct(product);
-        GetLoanProductsProductIdResponse getLoanProductsProductIdResponse = 
loanProductHelper
-                .retrieveLoanProductById(loanProductResponse.getResourceId());
-        assertNotNull(getLoanProductsProductIdResponse);
-        return loanProductResponse.getResourceId();
-
+        return createLoanProduct(product);
     }
 
-    private void verifyTransactionIsAccountTransfer(final LocalDate 
transactionDate, final Float transactionAmount, final Integer loanID,
+    private void verifyTransactionIsAccountTransfer(final LocalDate 
transactionDate, final double transactionAmount, final Long loanId,
             final String transactionOfType) {
-        ArrayList<HashMap> transactions = (ArrayList<HashMap>) 
loanTransactionHelper.getLoanTransactions(requestSpec, responseSpec, loanID);
+        GetLoansLoanIdResponse loanDetails = getLoanDetails(loanId);
         boolean isTransactionFound = false;
-        for (int i = 0; i < transactions.size(); i++) {
-            HashMap transactionType = (HashMap) 
transactions.get(i).get("type");
-            boolean isTransaction = (Boolean) 
transactionType.get(transactionOfType);
-
-            if (isTransaction) {
-                ArrayList<Integer> transactionDateAsArray = 
(ArrayList<Integer>) transactions.get(i).get("date");
-                LocalDate transactionEntryDate = 
LocalDate.of(transactionDateAsArray.get(0), transactionDateAsArray.get(1),
-                        transactionDateAsArray.get(2));
-
-                if (transactionDate.isEqual(transactionEntryDate)) {
-                    isTransactionFound = true;
-                    assertEquals(transactionAmount, 
Float.valueOf(String.valueOf(transactions.get(i).get("amount"))),
-                            "Mismatch in transaction amounts");
-
-                    // verify transfer details
-                    assertNotNull(transactions.get(i).get("transfer"));
-
-                    final HashMap<String, Object> actualTransferMap = 
(HashMap) transactions.get(i).get("transfer");
-
-                    assertEquals(transactionAmount, 
Float.valueOf(String.valueOf(actualTransferMap.get("transferAmount"))));
-
-                    ArrayList<Integer> transferDate = (ArrayList<Integer>) 
actualTransferMap.get("transferDate");
-
-                    LocalDate dateOfTransfer = 
LocalDate.of(transferDate.get(0), transferDate.get(1), transferDate.get(2));
-                    assertTrue(transactionDate.isEqual(dateOfTransfer));
-
-                    break;
-                }
+        for (var transaction : loanDetails.getTransactions()) {
+            GetLoansLoanIdLoanTransactionEnumData type = transaction.getType();
+            boolean isTransaction = switch (transactionOfType) {
+                case "disbursement" -> 
Boolean.TRUE.equals(type.getDisbursement());
+                case "downPayment" -> 
"loanTransactionType.downPayment".equals(type.getCode());
+                default -> false;
+            };
+            if (isTransaction && 
transactionDate.equals(transaction.getDate())) {
+                isTransactionFound = true;
+                assertEquals(transactionAmount, 
Utils.getDoubleValue(transaction.getAmount()), "Mismatch in transaction 
amounts");

Review Comment:
   The method still claims to verify "TransactionIsAccountTransfer" but no 
longer checks the transfer sub-object, its transfer amount, or its date — it 
only re-checks the transaction amount it already matched on. The 
transfer-to-savings behavior this test exists to prove is no longer verified



##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanRescheduleWithAdvancePaymentTest.java:
##########
@@ -294,73 +233,63 @@ private void 
createLoanProductWithInterestRecalculationForTestMultipleAdvancePay
         LOG.info(
                 "---------------------------------CREATING LOAN PRODUCT WITH 
RECALULATION ENABLED ------------------------------------------");
 
-        final String interestRecalculationCompoundingMethod = 
LoanProductTestBuilder.RECALCULATION_COMPOUNDING_METHOD_NONE;
-        final String rescheduleStrategyMethod = 
LoanProductTestBuilder.RECALCULATION_STRATEGY_REDUCE_NUMBER_OF_INSTALLMENTS;
-        final String recalculationRestFrequencyType = 
LoanProductTestBuilder.RECALCULATION_FREQUENCY_TYPE_DAILY;
-        final String recalculationRestFrequencyInterval = "0";
-        final String preCloseInterestCalculationStrategy = 
LoanProductTestBuilder.INTEREST_APPLICABLE_STRATEGY_ON_PRE_CLOSE_DATE;
-        final String recalculationCompoundingFrequencyType = null;
-        final String recalculationCompoundingFrequencyInterval = null;
-        final Integer recalculationCompoundingFrequencyOnDayType = null;
-        final Integer recalculationCompoundingFrequencyDayOfWeekType = null;
-        final Integer recalculationRestFrequencyOnDayType = null;
-        final Integer recalculationRestFrequencyDayOfWeekType = null;
-
-        final String loanProductJSON = new 
LoanProductTestBuilder().withPrincipal(loanPrincipalAmount)
-                
.withNumberOfRepayments(numberOfRepayments).withinterestRatePerPeriod(interestRatePerPeriod)
-                
.withInterestRateFrequencyTypeAsYear().withInterestTypeAsDecliningBalance().withInterestCalculationPeriodTypeAsDays()
-                
.withInterestRecalculationDetails(interestRecalculationCompoundingMethod, 
rescheduleStrategyMethod,
-                        preCloseInterestCalculationStrategy)
-                
.withInterestRecalculationRestFrequencyDetails(recalculationRestFrequencyType, 
recalculationRestFrequencyInterval,
-                        recalculationRestFrequencyOnDayType, 
recalculationRestFrequencyDayOfWeekType)
-                
.withInterestRecalculationCompoundingFrequencyDetails(recalculationCompoundingFrequencyType,
-                        recalculationCompoundingFrequencyInterval, 
recalculationCompoundingFrequencyOnDayType,
-                        recalculationCompoundingFrequencyDayOfWeekType)
-                .withInstallmentAmountInMultiplesOf("10").build(null);
-
-        this.loanProductId = 
this.loanTransactionHelper.getLoanProductId(loanProductJSON);
+        PostLoanProductsRequest product = 
twelveMonthInterestRecalculationProduct()//
+                .principal(loanPrincipalAmount)//
+                .interestRatePerPeriod(interestRatePerPeriod)//
+                .installmentAmountInMultiplesOf(10);
+
+        this.loanProductId = createLoanProduct(product);
         LOG.info("Successfully created loan product  (ID:{}) ", 
this.loanProductId);
     }
 
     private void createLoanEntityForTestMultipleAdvancePaymentWithReschedule() 
{
-        String firstRepaymentDate = "03 January 2022";
-        String submittedDate = "29 November 2021";
+        String submittedDate = "2021-11-29";
 
         LOG.info("---------------------------------NEW LOAN 
APPLICATION------------------------------------------");
 
-        final String loanApplicationJSON = new 
LoanApplicationTestBuilder().withPrincipal("15000").withLoanTermFrequency("12")
-                
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("12").withRepaymentEveryAfter("1")
-                
.withRepaymentFrequencyTypeAsMonths().withAmortizationTypeAsEqualInstallments().withInterestCalculationPeriodTypeAsDays()
-                
.withInterestRatePerPeriod("12").withInterestTypeAsDecliningBalance().withSubmittedOnDate(submittedDate)
-                
.withExpectedDisbursementDate(submittedDate).withFirstRepaymentDate(firstRepaymentDate)
-                
.withRepaymentStrategy(LoanApplicationTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY)
-                
.withinterestChargedFromDate(submittedDate).build(this.clientId.toString(), 
this.loanProductId.toString(), null);
-
-        this.loanId = 
this.loanTransactionHelper.getLoanId(loanApplicationJSON);
+        PostLoansRequest applyRequest = applyLoanRequest(this.clientId, 
this.loanProductId, submittedDate, 15000.0, 12, req -> {
+            req.loanTermFrequency(12);
+            
req.loanTermFrequencyType(LoanTestData.RepaymentFrequencyType.MONTHS);
+            req.repaymentEvery(1);
+            
req.repaymentFrequencyType(LoanTestData.RepaymentFrequencyType.MONTHS);
+            req.interestRatePerPeriod(BigDecimal.valueOf(12));
+            
req.interestCalculationPeriodType(LoanTestData.InterestCalculationPeriodType.DAILY);
+            req.interestType(LoanTestData.InterestType.DECLINING_BALANCE);
+            
req.amortizationType(LoanTestData.AmortizationType.EQUAL_INSTALLMENTS);
+            
req.transactionProcessingStrategyCode(LoanProductTestBuilder.INTEREST_PRINCIPAL_PENALTIES_FEES_ORDER_STRATEGY);
+            req.dateFormat(LoanTestData.ISO_DATE_PATTERN);
+            req.submittedOnDate(submittedDate);
+            req.expectedDisbursementDate(submittedDate);
+            req.repaymentsStartingFromDate(LocalDate.of(2022, Month.JANUARY, 
3));
+        });
+
+        this.loanId = applyForLoan(applyRequest);
 
         LOG.info("Sucessfully created loan (ID: {} )", this.loanId);
 
-        this.approveLoanApplication(submittedDate);
-        this.disburseLoan(submittedDate);
+        approveLoan(this.loanId,
+                new 
org.apache.fineract.client.models.PostLoansLoanIdRequest().approvedLoanAmount(BigDecimal.valueOf(15000))
+                        
.approvedOnDate(submittedDate).dateFormat(LoanTestData.ISO_DATE_PATTERN).locale(LoanTestData.LOCALE));
+        disburseLoan(this.loanId,
+                new 
org.apache.fineract.client.models.PostLoansLoanIdRequest().actualDisbursementDate(submittedDate)
+                        
.transactionAmount(getLoanDetails(this.loanId).getNetDisbursalAmount()).dateFormat(LoanTestData.ISO_DATE_PATTERN)
+                        .locale(LoanTestData.LOCALE));
+        LOG.info("Successfully disbursed loan (ID: {} )", this.loanId);
     }
 
     private void doMultipleAdvancePaymentsAndVerifySchedule() {
 
         LOG.info("-------------Make Advance repayment 1-----------");
-        this.loanTransactionHelper.makeRepayment("02 December 2021", 
Float.parseFloat("1"), this.loanId);
+        addRepaymentForLoan(this.loanId, 1.0, "02 December 2021");
 
         LOG.info("-------------Make Advance repayment 2-----------");
-        this.loanTransactionHelper.makeRepayment("03 December 2021", 
Float.parseFloat("1"), this.loanId);
-
-        final Map repaymentSchedule = (Map) 
this.loanTransactionHelper.getLoanDetailExcludeFutureSchedule(requestSpec, 
generalResponseSpec,
-                this.loanId, "repaymentSchedule");
+        addRepaymentForLoan(this.loanId, 1.0, "03 December 2021");
 
-        final ArrayList periods = (ArrayList) repaymentSchedule.get("periods");
-        HashMap period = (HashMap) periods.get(3);
+        GetLoansLoanIdRepaymentPeriod period = 
getLoanDetails(this.loanId).getRepaymentSchedule().getPeriods().get(3);
         LOG.info("period  {}", period);
 
-        assertEquals(new ArrayList<>(Arrays.asList(2022, 1, 3)), 
period.get("dueDate"), "Checking for Due Date for 1st Month");
-        assertEquals(period.get("principalDue"), Float.parseFloat("1177.12"));
-        assertEquals(period.get("interestDue"), Float.parseFloat("152.88"));
+        assertEquals(LocalDate.of(2022, Month.JANUARY, 3), 
period.getDueDate(), "Checking for Due Date for 1st Month");
+        assertEquals(0, 
BigDecimal.valueOf(1177.13).compareTo(period.getPrincipalDue()));

Review Comment:
   I know that the calculation with float is not precise, but it's interesting 
that it changed by 1 cent for both of these assertation. In a refactor it is 
unusual to change the expected values



##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java:
##########
@@ -77,176 +72,144 @@
 import org.junit.jupiter.params.provider.MethodSource;
 
 @Slf4j
-public class LoanTransactionChargebackTest extends BaseLoanIntegrationTest {
-
-    private ResponseSpecification responseSpec;
-    private ResponseSpecification responseSpecErr400;
-    private ResponseSpecification responseSpecErr403;
-    private ResponseSpecification responseSpecErr503;
-    private RequestSpecification requestSpec;
-    private LoanTransactionHelper loanTransactionHelper;
-    private JournalEntryHelper journalEntryHelper;
-    private AccountHelper accountHelper;
+public class LoanTransactionChargebackTest extends FeignLoanTestBase {
+
     private final String amountVal = "1000";
     private LocalDate todaysDate;
     private String operationDate;
     private static Long clientId;
 
     @BeforeEach
     public void setup() {
-        Utils.initializeRESTAssured();
-        this.requestSpec = new 
RequestSpecBuilder().setContentType(ContentType.JSON).build();
-        this.requestSpec.header("Authorization", "Basic " + 
Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
-        this.responseSpec = new 
ResponseSpecBuilder().expectStatusCode(200).build();
-        this.responseSpecErr400 = new 
ResponseSpecBuilder().expectStatusCode(400).build();
-        this.responseSpecErr403 = new 
ResponseSpecBuilder().expectStatusCode(403).build();
-        this.responseSpecErr503 = new 
ResponseSpecBuilder().expectStatusCode(503).build();
-        this.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
-        this.journalEntryHelper = new JournalEntryHelper(requestSpec, 
responseSpec);
-        this.accountHelper = new AccountHelper(requestSpec, responseSpec);
-        PostClientsResponse client = new ClientHelper(requestSpec, 
responseSpec).createClient(ClientHelper.defaultClientCreationRequest());
-        clientId = client.getResourceId();
-
+        clientId = createClient("01 January 2012");
         this.todaysDate = Utils.getLocalDateOfTenant();
         this.operationDate = Utils.dateFormatter.format(this.todaysDate);
     }
 
     @ParameterizedTest
     @MethodSource("loanProductFactory")
-    public void applyLoanTransactionChargeback(LoanProductTestBuilder 
loanProductTestBuilder) {
+    public void applyLoanTransactionChargeback(String strategyCode, boolean 
advancedAllocation) {
         // Client and Loan account creation
-        final Integer loanId = createAccounts(15, 1, true, 
loanProductTestBuilder);
+        final Long loanId = createAccounts(15, 1, true, strategyCode, 
advancedAllocation);
 
-        GetLoansLoanIdResponse getLoansLoanIdResponse = 
loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId);
+        GetLoansLoanIdResponse getLoansLoanIdResponse = getLoanDetails(loanId);
         assertNotNull(getLoansLoanIdResponse);
 
-        loanTransactionHelper.printRepaymentSchedule(getLoansLoanIdResponse);
-
         Float amount = Float.valueOf(amountVal);
-        PostLoansLoanIdTransactionsResponse loanIdTransactionsResponse = 
loanTransactionHelper.makeLoanRepayment(operationDate, amount,
-                loanId);
+        PostLoansLoanIdTransactionsResponse loanIdTransactionsResponse = 
makeLoanRepayment(loanId, "Repayment", operationDate,
+                amount.doubleValue());
         assertNotNull(loanIdTransactionsResponse);
         final Long transactionId = loanIdTransactionsResponse.getResourceId();
         assertNotNull(transactionId);
 
-        getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
+        getLoansLoanIdResponse = getLoanDetails(loanId);
         assertNotNull(getLoansLoanIdResponse);
-        loanTransactionHelper.validateLoanStatus(getLoansLoanIdResponse, 
"loanStatusType.closed.obligations.met");
+        validateLoanStatus(getLoansLoanIdResponse, 
"loanStatusType.closed.obligations.met");
 
         reviewLoanTransactionRelations(loanId, transactionId, 0, 
Double.valueOf("0.00"));
 
-        final Long chargebackTransactionId = 
loanTransactionHelper.applyChargebackTransaction(loanId, transactionId, 
"1000.00", 0,
-                responseSpec);
+        final Long chargebackTransactionId = 
applyChargebackTransaction(loanId, transactionId, "1000.00", 0);
 
         reviewLoanTransactionRelations(loanId, transactionId, 1, 
Double.valueOf("0.00"));
         reviewLoanTransactionRelations(loanId, chargebackTransactionId, 0, 
Double.valueOf("1000.00"));
 
-        getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, 
responseSpec, loanId);
+        getLoansLoanIdResponse = getLoanDetails(loanId);
         assertNotNull(getLoansLoanIdResponse);
-        loanTransactionHelper.validateLoanStatus(getLoansLoanIdResponse, 
"loanStatusType.active");
+        validateLoanStatus(getLoansLoanIdResponse, "loanStatusType.active");
 
-        
loanTransactionHelper.validateLoanPrincipalOustandingBalance(getLoansLoanIdResponse,
 amount.doubleValue());
+        validateLoanPrincipalOustandingBalance(getLoansLoanIdResponse, 
amount.doubleValue());
 
         verifyTRJournalEntries(chargebackTransactionId, //
-                credit(fundSource, 1000.0), //
-                debit(loansReceivableAccount, 1000.0) //
+                credit(getAccounts().getFundSource(), 1000.0), //
+                debit(getAccounts().getLoansReceivableAccount(), 1000.0) //
         );
 
         // Try to reverse a Loan Transaction charge back
-        PostLoansLoanIdTransactionsResponse reverseTransactionResponse = 
loanTransactionHelper.reverseLoanTransaction(loanId,
-                chargebackTransactionId, operationDate, responseSpecErr403);
+        assertThrows(CallFailedRuntimeException.class, () -> 
reverseLoanTransaction(loanId, chargebackTransactionId, operationDate));

Review Comment:
   I think it would make sense to check the 403 status as well, like what you 
did with the status 500 below.



-- 
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]

Reply via email to