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


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountChargeOffWithAdvancedPaymentAllocationTest.java:
##########
@@ -43,170 +38,94 @@
 import 
org.apache.fineract.client.models.GetLoanPaymentChannelToFundSourceMappings;
 import org.apache.fineract.client.models.GetLoanTransactionRelation;
 import org.apache.fineract.client.models.GetLoansLoanIdResponse;
+import org.apache.fineract.client.models.GetLoansLoanIdTransactions;
 import 
org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionIdResponse;
 import org.apache.fineract.client.models.JournalEntryTransactionItem;
 import org.apache.fineract.client.models.LoanProductChargeData;
 import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper;
 import org.apache.fineract.client.models.PaymentTypeCreateRequest;
-import org.apache.fineract.client.models.PostClientsResponse;
 import org.apache.fineract.client.models.PostLoanProductsRequest;
-import org.apache.fineract.client.models.PostLoanProductsResponse;
 import org.apache.fineract.client.models.PostLoansLoanIdTransactionsRequest;
 import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse;
-import org.apache.fineract.integrationtests.common.BusinessDateHelper;
+import org.apache.fineract.integrationtests.client.feign.FeignLoanTestBase;
+import org.apache.fineract.integrationtests.client.feign.modules.LoanTestData;
 import org.apache.fineract.integrationtests.common.ClientHelper;
 import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
 import org.apache.fineract.integrationtests.common.Utils;
 import org.apache.fineract.integrationtests.common.accounting.Account;
-import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
-import 
org.apache.fineract.integrationtests.common.accounting.JournalEntryHelper;
-import org.apache.fineract.integrationtests.common.charges.ChargesHelper;
-import org.apache.fineract.integrationtests.common.funds.FundsHelper;
+import org.apache.fineract.integrationtests.common.accounting.JournalEntry;
 import org.apache.fineract.integrationtests.common.funds.FundsResourceHandler;
 import 
org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
-import org.apache.fineract.integrationtests.common.loans.LoanProductHelper;
-import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper;
 import 
org.apache.fineract.integrationtests.common.products.DelinquencyBucketsHelper;
-import org.apache.fineract.integrationtests.common.system.CodeHelper;
 import 
org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType;
 import 
org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType;
 import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-public class LoanAccountChargeOffWithAdvancedPaymentAllocationTest extends 
BaseLoanIntegrationTest {
+public class LoanAccountChargeOffWithAdvancedPaymentAllocationTest extends 
FeignLoanTestBase {
 
     private static final DateTimeFormatter DATE_FORMATTER = new 
DateTimeFormatterBuilder().appendPattern("dd MMMM yyyy").toFormatter();
-    private ResponseSpecification responseSpec;
-    private RequestSpecification requestSpec;
-    private ClientHelper clientHelper;
-    private LoanTransactionHelper loanTransactionHelper;
-    private JournalEntryHelper journalEntryHelper;
-    private AccountHelper accountHelper;
-    private LoanProductHelper loanProductHelper;
-    private PaymentTypeHelper paymentTypeHelper;
-    private final BusinessDateHelper businessDateHelper = new 
BusinessDateHelper();
-    private static final String DATETIME_PATTERN = "dd MMMM yyyy";
-    // asset
-    private Account loansReceivable;
-    private Account interestFeeReceivable;
-    private Account suspenseAccount;
-    private Account fundReceivables;
-    // liability
-    private Account suspenseClearingAccount;
-    private Account overpaymentAccount;
-    // income
-    private Account interestIncome;
-    private Account feeIncome;
-    private Account feeChargeOff;
-    private Account recoveries;
-    private Account interestIncomeChargeOff;
-    // expense
-    private Account creditLossBadDebt;
-    private Account creditLossBadDebtFraud;
-    private Account writtenOff;
-    private Account goodwillExpenseAccount;
-
-    @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.loanTransactionHelper = new 
LoanTransactionHelper(this.requestSpec, this.responseSpec);
-        this.accountHelper = new AccountHelper(this.requestSpec, 
this.responseSpec);
-        this.loanProductHelper = new LoanProductHelper();
-        this.paymentTypeHelper = new PaymentTypeHelper();
-
-        // Asset
-        this.loansReceivable = this.accountHelper.createAssetAccount();
-        this.interestFeeReceivable = this.accountHelper.createAssetAccount();
-        this.suspenseAccount = this.accountHelper.createAssetAccount();
-        this.fundReceivables = this.accountHelper.createAssetAccount();
-
-        // Liability
-        this.suspenseClearingAccount = 
this.accountHelper.createLiabilityAccount();
-        this.overpaymentAccount = this.accountHelper.createLiabilityAccount();
-
-        // income
-        this.interestIncome = this.accountHelper.createIncomeAccount();
-        this.feeIncome = this.accountHelper.createIncomeAccount();
-        this.feeChargeOff = this.accountHelper.createIncomeAccount();
-        this.recoveries = this.accountHelper.createIncomeAccount();
-        this.interestIncomeChargeOff = 
this.accountHelper.createIncomeAccount();
-
-        // expense
-        this.creditLossBadDebt = this.accountHelper.createExpenseAccount();
-        this.creditLossBadDebtFraud = 
this.accountHelper.createExpenseAccount();
-        this.writtenOff = this.accountHelper.createExpenseAccount();
-        this.goodwillExpenseAccount = 
this.accountHelper.createExpenseAccount();
-
-        this.journalEntryHelper = new JournalEntryHelper(this.requestSpec, 
this.responseSpec);
-        this.clientHelper = new ClientHelper(this.requestSpec, 
this.responseSpec);
-    }
 
     // Charge-off accounting and balances
     @Test
     public void loanChargeOffWithAdvancedPaymentStrategyTest() {
         runAt("10 September 2022", () -> {
             String loanExternalIdStr = UUID.randomUUID().toString();
-            final Integer loanProductID = 
createLoanProductWithPeriodicAccrualAccountingAndAdvancedPaymentAllocationStrategy();
-            final Integer clientId = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId().intValue();
-            final Integer loanId = createLoanAccount(clientId, loanProductID, 
loanExternalIdStr);
+            final Long loanProductId = 
createLoanProductWithPeriodicAccrualAccountingAndAdvancedPaymentAllocationStrategy();
+            final Long clientId = 
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
+            final Long loanId = createLoanAccount(clientId, loanProductId, 
loanExternalIdStr);
 
             // apply charges
-            Integer feeCharge = ChargesHelper.createCharges(requestSpec, 
responseSpec,
-                    
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT,
 "10", false));
+            Long feeCharge = createLoanSpecifiedDueDateCharge(10.0);
 
-            LocalDate targetDate = LocalDate.of(2022, 9, 5);
+            LocalDate targetDate = LocalDate.of(2022, Month.SEPTEMBER, 5);
             final String feeCharge1AddedDate = 
DATE_FORMATTER.format(targetDate);
-            Integer feeLoanChargeId = 
loanTransactionHelper.addChargesForLoan(loanId,
-                    
LoanTransactionHelper.getSpecifiedDueDateChargesForLoanAsJSON(String.valueOf(feeCharge),
 feeCharge1AddedDate, "10"));
+            addLoanCharge(loanId, feeCharge, feeCharge1AddedDate, 10.0);
 
             // apply penalty
-            Integer penalty = ChargesHelper.createCharges(requestSpec, 
responseSpec,
-                    
ChargesHelper.getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT,
 "10", true));
-
+            Long penalty = createLoanSpecifiedDueDateCharge(10.0);

Review Comment:
   Removed



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