DeathGun44 commented on code in PR #6084:
URL: https://github.com/apache/fineract/pull/6084#discussion_r3535485370
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountDisbursementToSavingsWithAutoDownPaymentTest.java:
##########
@@ -22,77 +22,93 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
import java.math.BigDecimal;
import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.HashMap;
+import java.time.Month;
import java.util.List;
-import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import org.apache.fineract.accounting.common.AccountingConstants;
-import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
-import org.apache.fineract.client.models.GetSavingsAccountTransactionsPageItem;
+import org.apache.fineract.client.feign.FineractFeignClient;
+import
org.apache.fineract.client.models.DeleteFinancialActivityAccountsResponse;
+import org.apache.fineract.client.models.GetFinancialActivityAccountsResponse;
+import org.apache.fineract.client.models.PostFinancialActivityAccountsRequest;
+import org.apache.fineract.client.models.PostFinancialActivityAccountsResponse;
import org.apache.fineract.client.models.PostLoanProductsRequest;
-import org.apache.fineract.client.models.PostLoanProductsResponse;
import org.apache.fineract.client.models.PostLoansLoanIdRequest;
import org.apache.fineract.client.models.PostLoansLoanIdResponse;
-import
org.apache.fineract.client.models.SavingsAccountTransactionsSearchResponse;
+import org.apache.fineract.client.models.SavingsAccountData;
+import org.apache.fineract.client.models.SavingsAccountTransactionData;
import org.apache.fineract.infrastructure.core.service.MathUtil;
import
org.apache.fineract.infrastructure.event.external.data.ExternalEventResponse;
-import org.apache.fineract.integrationtests.common.ClientHelper;
-import org.apache.fineract.integrationtests.common.CommonConstants;
-import
org.apache.fineract.integrationtests.common.ExternalEventConfigurationHelper;
+import org.apache.fineract.integrationtests.client.feign.FeignLoanTestBase;
+import
org.apache.fineract.integrationtests.client.feign.helpers.FeignRawHttpHelper;
+import
org.apache.fineract.integrationtests.client.feign.helpers.FeignSavingsHelper;
+import
org.apache.fineract.integrationtests.client.feign.helpers.FeignSavingsProductHelper;
+import
org.apache.fineract.integrationtests.client.feign.modules.LoanRequestBuilders;
+import
org.apache.fineract.integrationtests.client.feign.modules.SavingsRequestBuilders;
+import org.apache.fineract.integrationtests.common.FineractFeignClientHelper;
import
org.apache.fineract.integrationtests.common.accounting.FinancialActivityAccountHelper;
-import
org.apache.fineract.integrationtests.common.externalevents.ExternalEventHelper;
-import
org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder;
-import
org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
-import
org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
-import org.hamcrest.Matchers;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-public class LoanAccountDisbursementToSavingsWithAutoDownPaymentTest extends
BaseLoanIntegrationTest {
+public class LoanAccountDisbursementToSavingsWithAutoDownPaymentTest extends
FeignLoanTestBase {
public static final BigDecimal DOWN_PAYMENT_PERCENTAGE = new
BigDecimal(25);
+ private static final String LOAN_BALANCE_CHANGED_EVENT =
"LoanBalanceChangedBusinessEvent";
+
+ private static FeignSavingsHelper savingsHelper;
+ private static FeignSavingsProductHelper savingsProductHelper;
+ private static FinancialActivityAccountHelper
financialActivityAccountHelper;
+
+ @BeforeAll
+ public static void setupSavingsAndFinancialActivityHelpers() {
+ FineractFeignClient client =
FineractFeignClientHelper.getFineractFeignClient();
+ savingsHelper = new FeignSavingsHelper(client);
+ savingsProductHelper = new FeignSavingsProductHelper(client);
+ financialActivityAccountHelper = new
FinancialActivityAccountHelper(null);
+ }
@Test
public void
loanDisbursementToSavingsWithAutoDownPaymentAndStandingInstructionsTest() {
runAt("01 March 2023", () -> {
- enableLoanBalanceChangedBusinessEvent();
- ExternalEventHelper.deleteAllExternalEvents(requestSpec,
createResponseSpecification(Matchers.is(204)));
+
externalEventHelper.enableBusinessEvent(LOAN_BALANCE_CHANGED_EVENT);
+ deleteAllExternalEvents();
- // loan external Id
String loanExternalIdStr = UUID.randomUUID().toString();
- // Create Client
- Long clientId =
clientHelper.createClient(ClientHelper.defaultClientCreationRequest()).getClientId();
+ Long clientId = createClient();
- // Create Loan Product
Long loanProductId =
createLoanProductWithMultiDisbursalAndRepaymentsWithEnableDownPayment();
- SavingsAccountHelper savingsAccountHelper = new
SavingsAccountHelper(requestSpec, responseSpec);
-
- // Create approve and activate savings account
- Integer savingsAccountId =
createApproveActivateSavingsAccountDailyPosting(clientId.intValue(), "01 March
2023",
- savingsAccountHelper);
+ Long savingsAccountId =
createApproveActivateSavingsAccountDailyPosting(clientId, "01 March 2023");
- // create Financial Activity Mapping for Liability Transfer
mapLiabilityTransferFinancialActivity(loanProductId);
- // Apply and Approve Loan
- Long loanId =
createLoanWithLinkedAccountAndStandingInstructions(clientId.intValue(),
loanProductId, savingsAccountId,
- loanExternalIdStr);
+ String loanApplicationJSON = new
org.apache.fineract.integrationtests.common.loans.LoanApplicationTestBuilder()
+
.withPrincipal("1000").withLoanTermFrequency("45").withLoanTermFrequencyAsDays().withNumberOfRepayments("3")
+
.withRepaymentEveryAfter("15").withRepaymentFrequencyTypeAsDays().withInterestRatePerPeriod("0")
+
.withInterestTypeAsFlatBalance().withAmortizationTypeAsEqualPrincipalPayments()
Review Comment:
Reverted to withInterestTypeAsDecliningBalance().
--
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]