FINERACT-1971: Swagger classes primary keys fix (#3545)

FINERACT-1971 Swagger adjustments

---------

Co-authored-by: Arnold Galovics <galovicsarnold@gmail.com>
This commit is contained in:
peter-kovacs-dpc
2023-10-31 13:18:05 +01:00
committed by GitHub
co-authored by Arnold Galovics
parent 03e71a29ff
commit 5ebeca0f2d
57 changed files with 637 additions and 636 deletions
@@ -121,7 +121,7 @@ public abstract class BaseLoanIntegrationTest {
.maxInterestRatePerPeriod((double) 0)//
.interestRateFrequencyType(2)//
.repaymentEvery(30)//
.repaymentFrequencyType(0)//
.repaymentFrequencyType(0L)//
.amortizationType(1)//
.interestType(0)//
.isEqualAmortization(false)//
@@ -6894,7 +6894,7 @@ public class ClientLoanIntegrationTest {
}
private PostClientsRequest createRandomClientWithDate(String date) {
return new PostClientsRequest().officeId(1).legalFormId(1).firstname(Utils.randomStringGenerator("", 5))
return new PostClientsRequest().officeId(1L).legalFormId(1L).firstname(Utils.randomStringGenerator("", 5))
.lastname(Utils.randomStringGenerator("", 5)).active(true).locale("en").activationDate(date).dateFormat(DATETIME_PATTERN);
}
@@ -8036,7 +8036,7 @@ public class ClientLoanIntegrationTest {
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, REQUEST_SPEC, RESPONSE_SPEC);
}
private PostLoansResponse applyForLoanApplicationForOnePeriod30DaysLongNoInterestPeriodicAccrual(Integer clientId, Long loanProductId,
private PostLoansResponse applyForLoanApplicationForOnePeriod30DaysLongNoInterestPeriodicAccrual(Long clientId, Long loanProductId,
String loanDisbursementDate, String repaymentStrategyCode) {
return LOAN_TRANSACTION_HELPER.applyLoan(new PostLoansRequest().clientId(clientId.longValue()).productId(loanProductId)
.expectedDisbursementDate(loanDisbursementDate).dateFormat(DATETIME_PATTERN)
@@ -8068,7 +8068,7 @@ public class ClientLoanIntegrationTest {
.maxInterestRatePerPeriod((double) 0)//
.interestRateFrequencyType(2)//
.repaymentEvery(30)//
.repaymentFrequencyType(0)//
.repaymentFrequencyType(0L)//
.amortizationType(1)//
.interestType(0)//
.isEqualAmortization(false)//
@@ -39,7 +39,7 @@ public final class ClientStatusChecker {
}
public static void verifyClientStatus(final ClientStatus status, final GetClientsClientIdResponse clientResponse) {
assertEquals(status.getValue(), clientResponse.getStatus().getId());
assertEquals(status.getValue().longValue(), clientResponse.getStatus().getId());
}
public static void verifyClientClosed(final HashMap<String, Object> clientStatusHashMap) {
@@ -222,8 +222,9 @@ public class ClientTest {
long postalCode = 1000L;
// when
PostClientsAddressRequest addressRequest = new PostClientsAddressRequest().postalCode(postalCode).city(city).countryId(countryId)
.stateProvinceId(stateId).addressTypeId(addressTypeId.longValue()).isActive(addressIsActive);
PostClientsAddressRequest addressRequest = new PostClientsAddressRequest().postalCode(postalCode).city(city)
.countryId(Long.valueOf(countryId)).stateProvinceId(Long.valueOf(stateId)).addressTypeId(addressTypeId.longValue())
.isActive(addressIsActive);
PostClientsRequest request = ClientHelper.defaultClientCreationRequest().address(List.of(addressRequest));
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, request);
@@ -254,7 +255,7 @@ public class ClientTest {
final Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, clientRequest);
// when
PostClientClientIdAddressesRequest request = new PostClientClientIdAddressesRequest().postalCode(postalCode).city(city)
.countryId(countryId).stateProvinceId(stateId).isActive(addressIsActive);
.countryId(Long.valueOf(countryId)).stateProvinceId(Long.valueOf(stateId)).isActive(addressIsActive);
PostClientClientIdAddressesResponse response = ClientHelper.createClientAddress(requestSpec, responseSpec, clientId.longValue(),
addressTypeId, request);
// then
@@ -276,7 +277,7 @@ public class ClientTest {
String lastName = Utils.randomStringGenerator("LN", 48);
String fullName = firstName + ' ' + middleName + ' ' + lastName;
PostClientsRequest request = new PostClientsRequest().officeId(1).legalFormId(LEGALFORM_ID_PERSON).firstname(firstName)
PostClientsRequest request = new PostClientsRequest().officeId(1L).legalFormId(LEGALFORM_ID_PERSON).firstname(firstName)
.middlename(middleName).lastname(lastName).externalId(UUID.randomUUID().toString()).dateFormat(Utils.DATE_FORMAT)
.locale("en").active(true).activationDate(DEFAULT_DATE);
Integer clientId = ClientHelper.createClient(requestSpec, responseSpec, request);
@@ -286,7 +287,7 @@ public class ClientTest {
assertNotNull(client);
assertEquals(fullName, client.getDisplayName());
request = new PostClientsRequest().officeId(1).legalFormId(LEGALFORM_ID_PERSON).fullname(fullName)
request = new PostClientsRequest().officeId(1L).legalFormId(LEGALFORM_ID_PERSON).fullname(fullName)
.externalId(UUID.randomUUID().toString()).dateFormat(Utils.DATE_FORMAT).locale("en").active(true)
.activationDate(DEFAULT_DATE);
clientId = ClientHelper.createClient(requestSpec, responseSpec, request);
@@ -108,7 +108,7 @@ public class DelinquencyAndChargebackIntegrationTest {
// Client and Loan account creation
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final GetLoanProductsProductIdResponse getLoanProductsProductResponse = createLoanProduct(loanTransactionHelper,
delinquencyBucket.getId(), loanProductTestBuilder);
Math.toIntExact(delinquencyBucket.getId()), loanProductTestBuilder);
assertNotNull(getLoanProductsProductResponse);
// Older date to have more than one overdue installment
@@ -228,7 +228,7 @@ public class DelinquencyAndChargebackIntegrationTest {
// Client and Loan account creation
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final GetLoanProductsProductIdResponse getLoanProductsProductResponse = createLoanProduct(loanTransactionHelper,
delinquencyBucket.getId(), loanProductTestBuilder);
Math.toIntExact(delinquencyBucket.getId()), loanProductTestBuilder);
assertNotNull(getLoanProductsProductResponse);
// Older date to have more than one overdue installment
@@ -285,7 +285,7 @@ public class DelinquencyBucketsIntegrationTest {
// Client and Loan account creation
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final GetLoanProductsProductIdResponse getLoanProductsProductResponse = createLoanProduct(loanTransactionHelper,
delinquencyBucket.getId(), null);
Math.toIntExact(delinquencyBucket.getId()), null);
assertNotNull(getLoanProductsProductResponse);
log.info("Loan Product Bucket Name: {}", getLoanProductsProductResponse.getDelinquencyBucket().getName());
assertEquals(getLoanProductsProductResponse.getDelinquencyBucket().getName(), delinquencyBucket.getName());
@@ -381,7 +381,7 @@ public class DelinquencyBucketsIntegrationTest {
// Client and Loan account creation
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final GetLoanProductsProductIdResponse getLoanProductsProductResponse = createLoanProduct(loanTransactionHelper,
delinquencyBucket.getId(), null);
Math.toIntExact(delinquencyBucket.getId()), null);
assertNotNull(getLoanProductsProductResponse);
log.info("Loan Product Bucket Name: {}", getLoanProductsProductResponse.getDelinquencyBucket().getName());
assertEquals(getLoanProductsProductResponse.getDelinquencyBucket().getName(), delinquencyBucket.getName());
@@ -478,7 +478,7 @@ public class DelinquencyBucketsIntegrationTest {
// Client and Loan account creation
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final GetLoanProductsProductIdResponse getLoanProductsProductResponse = createLoanProduct(loanTransactionHelper,
delinquencyBucket.getId(), null);
Math.toIntExact(delinquencyBucket.getId()), null);
assertNotNull(getLoanProductsProductResponse);
log.info("Loan Product Bucket Name: {}", getLoanProductsProductResponse.getDelinquencyBucket().getName());
assertEquals(getLoanProductsProductResponse.getDelinquencyBucket().getName(), delinquencyBucket.getName());
@@ -571,7 +571,7 @@ public class DelinquencyBucketsIntegrationTest {
// Client and Loan account creation
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final GetLoanProductsProductIdResponse getLoanProductsProductResponse = createLoanProduct(loanTransactionHelper,
delinquencyBucket.getId(), null);
Math.toIntExact(delinquencyBucket.getId()), null);
assertNotNull(getLoanProductsProductResponse);
log.info("Loan Product Bucket Name: {}", getLoanProductsProductResponse.getDelinquencyBucket().getName());
assertEquals(getLoanProductsProductResponse.getDelinquencyBucket().getName(), delinquencyBucket.getName());
@@ -679,7 +679,7 @@ public class DelinquencyBucketsIntegrationTest {
// Client and Loan account creation
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final GetLoanProductsProductIdResponse getLoanProductsProductResponse = createLoanProduct(loanTransactionHelper,
delinquencyBucket.getId(), null);
Math.toIntExact(delinquencyBucket.getId()), null);
assertNotNull(getLoanProductsProductResponse);
log.info("Loan Product Bucket Name: {}", getLoanProductsProductResponse.getDelinquencyBucket().getName());
assertEquals(getLoanProductsProductResponse.getDelinquencyBucket().getName(), delinquencyBucket.getName());
@@ -768,7 +768,7 @@ public class DelinquencyBucketsIntegrationTest {
// Client and Loan account creation
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final GetLoanProductsProductIdResponse getLoanProductsProductResponse = createLoanProduct(loanTransactionHelper,
delinquencyBucket.getId(), null);
Math.toIntExact(delinquencyBucket.getId()), null);
assertNotNull(getLoanProductsProductResponse);
log.info("Loan Product Bucket Name: {}", getLoanProductsProductResponse.getDelinquencyBucket().getName());
assertEquals(getLoanProductsProductResponse.getDelinquencyBucket().getName(), delinquencyBucket.getName());
@@ -870,7 +870,7 @@ public class DelinquencyBucketsIntegrationTest {
// Client and Loan account creation
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final GetLoanProductsProductIdResponse getLoanProductsProductResponse = createLoanProduct(loanTransactionHelper,
delinquencyBucket.getId(), "3");
Math.toIntExact(delinquencyBucket.getId()), "3");
assertNotNull(getLoanProductsProductResponse);
log.info("Loan Product Bucket Name: {}", getLoanProductsProductResponse.getDelinquencyBucket().getName());
assertEquals(getLoanProductsProductResponse.getDelinquencyBucket().getName(), delinquencyBucket.getName());
@@ -949,7 +949,7 @@ public class DelinquencyBucketsIntegrationTest {
// Client and Loan account creation
final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec, "01 January 2012");
final GetLoanProductsProductIdResponse getLoanProductsProductResponse = createLoanProduct(loanTransactionHelper,
delinquencyBucket.getId(), "3");
Math.toIntExact(delinquencyBucket.getId()), "3");
assertNotNull(getLoanProductsProductResponse);
log.info("Loan Product Arrears: {}", getLoanProductsProductResponse.getInArrearsTolerance());
assertEquals(3, getLoanProductsProductResponse.getInArrearsTolerance());
@@ -413,15 +413,15 @@ public class ExternalIdSupportIntegrationTest extends IntegrationTest {
// Check whether an external id was generated
final PostLoansLoanIdTransactionsResponse chargeRefundResult = loanTransactionHelper.makeChargeRefund(loanExternalIdStr,
new PostLoansLoanIdTransactionsRequest().dateFormat("dd MMMM yyyy").locale("en").loanChargeId(penalty1LoanChargeId)
.transactionAmount(1.0));
new PostLoansLoanIdTransactionsRequest().dateFormat("dd MMMM yyyy").locale("en")
.loanChargeId(Long.valueOf(penalty1LoanChargeId)).transactionAmount(1.0));
assertNotNull(chargeRefundResult.getResourceExternalId());
// Check whether the provided external id was retrieved
transactionExternalIdStr = UUID.randomUUID().toString();
final PostLoansLoanIdTransactionsResponse chargeRefundResultWithExternalId = loanTransactionHelper
.makeChargeRefund(loanExternalIdStr, new PostLoansLoanIdTransactionsRequest().dateFormat("dd MMMM yyyy").locale("en")
.loanChargeId(penalty1LoanChargeId).transactionAmount(1.0).externalId(transactionExternalIdStr));
.loanChargeId(Long.valueOf(penalty1LoanChargeId)).transactionAmount(1.0).externalId(transactionExternalIdStr));
assertEquals(transactionExternalIdStr, chargeRefundResultWithExternalId.getResourceExternalId());
response = loanTransactionHelper.getLoanTransactionDetails((long) loanId, transactionExternalIdStr);
@@ -671,7 +671,7 @@ public class LoanAccountChargeOffWithAdvancedPaymentAllocationTest {
.maxInterestRatePerPeriod((double) 0)//
.interestRateFrequencyType(2)//
.repaymentEvery(30)//
.repaymentFrequencyType(0)//
.repaymentFrequencyType(0L)//
.principalVariationsForBorrowerCycle(principalVariationsForBorrowerCycle)//
.numberOfRepaymentVariationsForBorrowerCycle(numberOfRepaymentVariationsForBorrowerCycle)//
.interestRateVariationsForBorrowerCycle(interestRateVariationsForBorrowerCycle)//
@@ -423,7 +423,7 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest {
.maxInterestRatePerPeriod((double) 0)//
.interestRateFrequencyType(2)//
.repaymentEvery(30)//
.repaymentFrequencyType(0)//
.repaymentFrequencyType(0L)//
.principalVariationsForBorrowerCycle(principalVariationsForBorrowerCycle)//
.numberOfRepaymentVariationsForBorrowerCycle(numberOfRepaymentVariationsForBorrowerCycle)//
.interestRateVariationsForBorrowerCycle(interestRateVariationsForBorrowerCycle)//
@@ -1176,7 +1176,7 @@ public class LoanPostChargeOffScenariosTest {
.maxInterestRatePerPeriod((double) 0)//
.interestRateFrequencyType(2)//
.repaymentEvery(30)//
.repaymentFrequencyType(0)//
.repaymentFrequencyType(0L)//
.principalVariationsForBorrowerCycle(principalVariationsForBorrowerCycle)//
.numberOfRepaymentVariationsForBorrowerCycle(numberOfRepaymentVariationsForBorrowerCycle)//
.interestRateVariationsForBorrowerCycle(interestRateVariationsForBorrowerCycle)//
@@ -92,7 +92,7 @@ public class LoanWithAdvancedPaymentAllocationIntegrationTests {
Assertions.assertNotNull(loanProductId);
GetLoanProductsProductIdResponse loanProduct = LOAN_TRANSACTION_HELPER.getLoanProduct(loanProductId);
final PostClientsResponse clientResponse = CLIENT_HELPER.createClient(new PostClientsRequest().activationDate("01 January 2022")
.active(true).dateFormat("dd MMMM yyyy").fullname("fullName").locale("en").legalFormId(1).officeId(1));
.active(true).dateFormat("dd MMMM yyyy").fullname("fullName").locale("en").legalFormId(1L).officeId(1L));
Integer loanId = createLoanAccount(LOAN_TRANSACTION_HELPER, clientResponse.getClientId().toString(), loanProductId.toString(),
"02 January 2022");
// then
@@ -262,7 +262,7 @@ public class UndoRepaymentWithDownPaymentIntegrationTest {
.maxInterestRatePerPeriod((double) 0)//
.interestRateFrequencyType(2)//
.repaymentEvery(30)//
.repaymentFrequencyType(0)//
.repaymentFrequencyType(0L)//
.principalVariationsForBorrowerCycle(principalVariationsForBorrowerCycle)//
.numberOfRepaymentVariationsForBorrowerCycle(numberOfRepaymentVariationsForBorrowerCycle)//
.interestRateVariationsForBorrowerCycle(interestRateVariationsForBorrowerCycle)//
@@ -56,7 +56,7 @@ public class ClientTest extends IntegrationTest {
// TODO why dateFormat and locale required even when no activationDate?!
// https://issues.apache.org/jira/browse/FINERACT-1233
return ok(fineract().clients.create6(
new PostClientsRequest().legalFormId(1).officeId(1).fullname("TestClient").dateFormat(dateFormat()).locale("en_US")))
new PostClientsRequest().legalFormId(1L).officeId(1L).fullname("TestClient").dateFormat(dateFormat()).locale("en_US")))
.getClientId();
}
@@ -81,8 +81,8 @@ public class ClientHelper extends IntegrationTest {
public static final String UNDOREJECT_CLIENT_COMMAND = "undoRejection";
public static final String UNDOWITHDRAWN_CLIENT_COMMAND = "undoWithdrawal";
public static final String DEFAULT_OFFICE_ID = "1";
public static final Integer LEGALFORM_ID_PERSON = 1;
public static final Integer LEGALFORM_ID_ENTITY = 2;
public static final Long LEGALFORM_ID_PERSON = 1L;
public static final Long LEGALFORM_ID_ENTITY = 2L;
public static final String CREATED_DATE = Utils.getLocalDateOfTenant().minusDays(5).format(Utils.dateFormatter);
public static final String CREATED_DATE_PLUS_ONE = Utils.getLocalDateOfTenant().minusDays(4).format(Utils.dateFormatter);
public static final String CREATED_DATE_PLUS_TWO = Utils.getLocalDateOfTenant().minusDays(3).format(Utils.dateFormatter);
@@ -319,12 +319,11 @@ public class ClientHelper extends IntegrationTest {
return (Integer) getClient(requestSpec, responseSpec, clientId, "staffId");
}
public static HashMap<String, Object> setInitialClientValues(final String officeId, final Integer legalFormId) {
public static HashMap<String, Object> setInitialClientValues(final String officeId, final Long legalFormId) {
return setInitialClientValues(officeId, legalFormId, UUID.randomUUID().toString());
}
public static HashMap<String, Object> setInitialClientValues(final String officeId, final Integer legalFormId,
final String externalId) {
public static HashMap<String, Object> setInitialClientValues(final String officeId, final Long legalFormId, final String externalId) {
HashMap<String, Object> map = new HashMap<>();
map.put("officeId", officeId);
map.put("legalFormId", legalFormId);
@@ -338,7 +337,7 @@ public class ClientHelper extends IntegrationTest {
return map;
}
public static String getBasicClientAsJSON(final String officeId, final Integer legalFormId, final String externalId) {
public static String getBasicClientAsJSON(final String officeId, final Long legalFormId, final String externalId) {
HashMap<String, Object> map = setInitialClientValues(officeId, legalFormId, externalId);
map.put("active", "true");
map.put("activationDate", DEFAULT_DATE);
@@ -867,7 +866,7 @@ public class ClientHelper extends IntegrationTest {
}
public static PostClientsRequest defaultClientCreationRequest() {
return new PostClientsRequest().officeId(1).legalFormId(LEGALFORM_ID_PERSON)
return new PostClientsRequest().officeId(1L).legalFormId(LEGALFORM_ID_PERSON)
.firstname(Utils.randomStringGenerator("Client_FirstName_", 5)).lastname(Utils.randomStringGenerator("Client_LastName_", 5))
.externalId(UUID.randomUUID().toString()).dateFormat(Utils.DATE_FORMAT).locale("en").active(true)
.activationDate(DEFAULT_DATE);
@@ -185,7 +185,7 @@ public class InlineLoanCOBTest {
final GetDelinquencyBucketsResponse delinquencyBucket = DelinquencyBucketsHelper.getDelinquencyBucket(requestSpec, responseSpec,
delinquencyBucketResponse.getResourceId());
final Integer loanProductID = createLoanProduct(loanTransactionHelper, delinquencyBucket.getId());
final Integer loanProductID = createLoanProduct(loanTransactionHelper, Math.toIntExact(delinquencyBucket.getId()));
Assertions.assertNotNull(loanProductID);
HashMap loanStatusHashMap;