FINERACT-2243: New command processing - payment type (#5506)

This commit is contained in:
Aleksandar Vidakovic
2026-02-18 08:19:29 -06:00
committed by GitHub
parent 020754bad4
commit 3a842ecb9a
69 changed files with 727 additions and 758 deletions
@@ -40,8 +40,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PutGlobalConfigurationsRequest;
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
import org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationConstants;
@@ -2664,10 +2663,10 @@ public class ClientSavingsIntegrationTest {
String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = false;
Integer position = 1;
Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeCreateRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne);
@@ -2688,8 +2687,8 @@ public class ClientSavingsIntegrationTest {
String paymentTypeNameTwo = PaymentTypeHelper.randomNameGenerator("P_T", 5);
PostPaymentTypesResponse paymentTypesResponseTwo = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(paymentTypeNameTwo).description(description).isCashPayment(isCashPayment).position(position));
var paymentTypesResponseTwo = paymentTypeHelper.createPaymentType(new PaymentTypeCreateRequest().name(paymentTypeNameTwo)
.description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdTwo = paymentTypesResponseTwo.getResourceId();
Assertions.assertNotNull(paymentTypeIdTwo);
@@ -36,8 +36,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.CommonConstants;
import org.apache.fineract.integrationtests.common.GroupHelper;
@@ -385,10 +384,10 @@ public class GroupSavingsIntegrationTest {
String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = true;
Integer position = 1;
Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeCreateRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeId = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeId);
@@ -47,13 +47,12 @@ import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionId
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.PaymentTypeRequest;
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.client.models.PostPaymentTypesResponse;
import org.apache.fineract.integrationtests.common.BusinessDateHelper;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
@@ -668,10 +667,10 @@ public class LoanAccountChargeOffWithAdvancedPaymentAllocationTest extends BaseL
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = false;
Integer position = 1;
Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position));
var paymentTypesResponse = paymentTypeHelper.createPaymentType(new PaymentTypeCreateRequest().name(paymentTypeName)
.description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne);
@@ -39,12 +39,11 @@ import org.apache.fineract.client.models.GetLoanPaymentChannelToFundSourceMappin
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
import org.apache.fineract.client.models.LoanProductChargeData;
import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
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.client.models.PostPaymentTypesResponse;
import org.apache.fineract.integrationtests.common.BusinessDateHelper;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
@@ -363,10 +362,10 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest exte
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = false;
Integer position = 1;
Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position));
var paymentTypesResponse = paymentTypeHelper.createPaymentType(new PaymentTypeCreateRequest().name(paymentTypeName)
.description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne);
@@ -42,12 +42,11 @@ import org.apache.fineract.client.models.GetLoansLoanIdTransactionsTransactionId
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.PaymentTypeRequest;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
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.client.models.PostPaymentTypesResponse;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
import org.apache.fineract.integrationtests.common.Utils;
@@ -1134,10 +1133,10 @@ public class LoanPostChargeOffScenariosTest extends BaseLoanIntegrationTest {
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = false;
Integer position = 1;
Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position));
var paymentTypesResponse = paymentTypeHelper.createPaymentType(new PaymentTypeCreateRequest().name(paymentTypeName)
.description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne);
@@ -23,11 +23,9 @@ import io.restassured.builder.ResponseSpecBuilder;
import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import org.apache.fineract.client.models.DeletePaymentTypesPaymentTypeIdResponse;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdRequest;
import org.apache.fineract.client.models.PaymentTypeUpdateRequest;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
import org.apache.fineract.integrationtests.common.Utils;
import org.junit.jupiter.api.Assertions;
@@ -55,10 +53,10 @@ public class PaymentTypeIntegrationTest {
String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = true;
Integer position = 1;
Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeCreateRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeId = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeId);
paymentTypeHelper.verifyPaymentTypeCreatedOnServer(paymentTypeId);
@@ -72,18 +70,18 @@ public class PaymentTypeIntegrationTest {
String newName = PaymentTypeHelper.randomNameGenerator("P_TU", 5);
String newDescription = PaymentTypeHelper.randomNameGenerator("PTU_Desc", 15);
Boolean isCashPaymentUpdatedValue = false;
Integer newPosition = 2;
Long newPosition = 2L;
paymentTypeHelper.updatePaymentType(paymentTypeId, new PutPaymentTypesPaymentTypeIdRequest().name(newName)
.description(newDescription).isCashPayment(isCashPaymentUpdatedValue).position(newPosition));
PaymentTypeData paymentTypeUpdatedResponse = paymentTypeHelper.retrieveById(paymentTypeId);
paymentTypeHelper.updatePaymentType(paymentTypeId, new PaymentTypeUpdateRequest().name(newName).description(newDescription)
.isCashPayment(isCashPaymentUpdatedValue).position(newPosition));
var paymentTypeUpdatedResponse = paymentTypeHelper.retrieveById(paymentTypeId);
Assertions.assertEquals(newName, paymentTypeUpdatedResponse.getName());
Assertions.assertEquals(newDescription, paymentTypeUpdatedResponse.getDescription());
Assertions.assertEquals(isCashPaymentUpdatedValue, paymentTypeUpdatedResponse.getIsCashPayment());
Assertions.assertEquals(newPosition, paymentTypeUpdatedResponse.getPosition());
// Delete
DeletePaymentTypesPaymentTypeIdResponse responseDelete = paymentTypeHelper.deletePaymentType(paymentTypeId);
var responseDelete = paymentTypeHelper.deletePaymentType(paymentTypeId);
Long deletedPaymentTypeId = responseDelete.getResourceId();
Assertions.assertEquals(paymentTypeId, deletedPaymentTypeId);
ResponseSpecification responseSpecification = new ResponseSpecBuilder().expectStatusCode(404).build();
@@ -34,9 +34,8 @@ import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.CollateralManagementHelper;
import org.apache.fineract.integrationtests.common.PaymentTypeHelper;
@@ -138,10 +137,10 @@ public class RepaymentWithPostDatedChecksTest {
String name = "PDC";
String description = PaymentTypeHelper.randomNameGenerator("PDC", 15);
Boolean isCashPayment = false;
Integer position = 1;
Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeCreateRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeId = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeId);
paymentTypeHelper.verifyPaymentTypeCreatedOnServer(paymentTypeId);
@@ -41,12 +41,11 @@ import org.apache.fineract.client.models.GetLoanProductsProductIdResponse;
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
import org.apache.fineract.client.models.LoanProductChargeData;
import org.apache.fineract.client.models.LoanProductChargeToGLAccountMapper;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostLoanProductsRequest;
import org.apache.fineract.client.models.PostLoanProductsResponse;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsTransactionIdRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PutGlobalConfigurationsRequest;
import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
import org.apache.fineract.infrastructure.configuration.api.GlobalConfigurationConstants;
@@ -211,10 +210,10 @@ public class UndoRepaymentWithDownPaymentIntegrationTest extends BaseLoanIntegra
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = false;
Integer position = 1;
Long position = 1L;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(paymentTypeName).description(description).isCashPayment(isCashPayment).position(position));
var paymentTypesResponse = paymentTypeHelper.createPaymentType(new PaymentTypeCreateRequest().name(paymentTypeName)
.description(description).isCashPayment(isCashPayment).position(position));
Long paymentTypeIdOne = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(paymentTypeIdOne);
@@ -41,8 +41,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.infrastructure.bulkimport.constants.LoanConstants;
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
import org.apache.fineract.integrationtests.bulkimport.importhandler.LocalContentStorageUtil;
@@ -168,8 +167,8 @@ public class LoanImportHandlerTest {
String paymentTypeName = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String paymentTypeDescription = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(paymentTypeName).description(paymentTypeDescription).isCashPayment(true).position(1));
var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeCreateRequest().name(paymentTypeName).description(paymentTypeDescription).isCashPayment(true).position(1L));
Long outcome_payment_creation = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(outcome_payment_creation, "Could not create payment type");
@@ -26,8 +26,7 @@ import io.restassured.specification.ResponseSpecification;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import java.io.IOException;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.infrastructure.bulkimport.constants.TemplatePopulateImportConstants;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.GroupHelper;
@@ -93,9 +92,9 @@ public class LoanWorkbookPopulatorTest {
String name = PaymentTypeHelper.randomNameGenerator("P_T", 5);
String description = PaymentTypeHelper.randomNameGenerator("PT_Desc", 15);
Boolean isCashPayment = true;
Integer position = 1;
PostPaymentTypesResponse paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long position = 1L;
var paymentTypesResponse = paymentTypeHelper.createPaymentType(
new PaymentTypeCreateRequest().name(name).description(description).isCashPayment(isCashPayment).position(position));
Long outcome_payment_creation = paymentTypesResponse.getResourceId();
Assertions.assertNotNull(outcome_payment_creation, "Could not create payment type");
@@ -26,12 +26,12 @@ import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.client.models.DeletePaymentTypesPaymentTypeIdResponse;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PaymentTypeCreateResponse;
import org.apache.fineract.client.models.PaymentTypeData;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdRequest;
import org.apache.fineract.client.models.PutPaymentTypesPaymentTypeIdResponse;
import org.apache.fineract.client.models.PaymentTypeDeleteResponse;
import org.apache.fineract.client.models.PaymentTypeUpdateRequest;
import org.apache.fineract.client.models.PaymentTypeUpdateResponse;
import org.apache.fineract.client.util.Calls;
@SuppressWarnings({ "rawtypes", "unchecked" })
@@ -50,7 +50,7 @@ public final class PaymentTypeHelper {
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.getAllPaymentTypes(onlyWithCode));
}
public PostPaymentTypesResponse createPaymentType(final PaymentTypeRequest paymentTypeRequest) {
public PaymentTypeCreateResponse createPaymentType(final PaymentTypeCreateRequest paymentTypeRequest) {
log.info("---------------------------------CREATING A PAYMENT TYPE---------------------------------------------");
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.createPaymentType(paymentTypeRequest));
}
@@ -80,14 +80,14 @@ public final class PaymentTypeHelper {
return new Gson().fromJson(jsonData, new TypeToken<PaymentTypeDomain>() {}.getType());
}
public PutPaymentTypesPaymentTypeIdResponse updatePaymentType(final Long paymentTypeId,
PutPaymentTypesPaymentTypeIdRequest putPaymentTypesPaymentTypeIdRequest) {
public PaymentTypeUpdateResponse updatePaymentType(final Long paymentTypeId,
PaymentTypeUpdateRequest putPaymentTypesPaymentTypeIdRequest) {
log.info("-------------------------------UPDATING PAYMENT TYPE-------------------------------------------");
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.updatePaymentType(paymentTypeId,
putPaymentTypesPaymentTypeIdRequest));
}
public DeletePaymentTypesPaymentTypeIdResponse deletePaymentType(final Long paymentTypeId) {
public PaymentTypeDeleteResponse deletePaymentType(final Long paymentTypeId) {
log.info("-------------------------------DELETING PAYMENT TYPE-------------------------------------------");
return Calls.ok(FineractClientHelper.getFineractClient().paymentTypes.deleteCode1(paymentTypeId));
}
@@ -23,9 +23,8 @@ import static io.restassured.RestAssured.given;
import java.math.BigDecimal;
import org.apache.fineract.client.models.AccountTransferRequest;
import org.apache.fineract.client.models.ChargeRequest;
import org.apache.fineract.client.models.PaymentTypeRequest;
import org.apache.fineract.client.models.PaymentTypeCreateRequest;
import org.apache.fineract.client.models.PostChargesResponse;
import org.apache.fineract.client.models.PostPaymentTypesResponse;
import org.apache.fineract.client.models.PostSavingsAccountsResponse;
import org.apache.fineract.client.models.PostSavingsAccountsSavingsAccountIdChargesRequest;
import org.apache.fineract.client.models.PostSavingsAccountsSavingsAccountIdChargesResponse;
@@ -109,9 +108,9 @@ public class AccountTransferWithdrawalFeeTest extends BaseSavingsIntegrationTest
public void testFromSavingsToSavingsAccountTransferWithPaymentTypeWithdrawalFee() {
// Create Payment Type
final PaymentTypeHelper paymentTypeHelper = new PaymentTypeHelper();
final PostPaymentTypesResponse paymentTypeResponse = paymentTypeHelper
.createPaymentType(new PaymentTypeRequest().name("Bank Transfer " + System.currentTimeMillis())
.description("Payment via bank transfer").isCashPayment(false).position(1));
final var paymentTypeResponse = paymentTypeHelper
.createPaymentType(new PaymentTypeCreateRequest().name("Bank Transfer " + System.currentTimeMillis())
.description("Payment via bank transfer").isCashPayment(false).position(1L));
final Long paymentTypeId = paymentTypeResponse.getResourceId();
// Create withdrawal fee charge WITH payment type binding