diff --git a/custom/acme/event/starter/src/main/java/com/acme/fineract/event/starter/AcmeEventAutoConfiguration.java b/custom/acme/event/starter/src/main/java/com/acme/fineract/event/starter/AcmeEventAutoConfiguration.java index ea8d65d74..671b75493 100644 --- a/custom/acme/event/starter/src/main/java/com/acme/fineract/event/starter/AcmeEventAutoConfiguration.java +++ b/custom/acme/event/starter/src/main/java/com/acme/fineract/event/starter/AcmeEventAutoConfiguration.java @@ -20,8 +20,7 @@ package com.acme.fineract.event.starter; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.ComponentScans; @AutoConfiguration -@ComponentScans({ @ComponentScan("com.acme.fineract.event.externalevent") }) +@ComponentScan("com.acme.fineract.event.externalevent") public class AcmeEventAutoConfiguration {} diff --git a/custom/acme/loan/starter/src/main/java/com/acme/fineract/loan/starter/AcmeLoanAutoConfiguration.java b/custom/acme/loan/starter/src/main/java/com/acme/fineract/loan/starter/AcmeLoanAutoConfiguration.java index d1516f3a0..0656d073b 100644 --- a/custom/acme/loan/starter/src/main/java/com/acme/fineract/loan/starter/AcmeLoanAutoConfiguration.java +++ b/custom/acme/loan/starter/src/main/java/com/acme/fineract/loan/starter/AcmeLoanAutoConfiguration.java @@ -26,11 +26,9 @@ import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.ComponentScans; @AutoConfiguration -@ComponentScans({ @ComponentScan("com.acme.fineract.loan.cob"), @ComponentScan("com.acme.fineract.loan.processor"), - @ComponentScan("com.acme.fineract.loan.job") }) +@ComponentScan(basePackages = { "com.acme.fineract.loan.cob", "com.acme.fineract.loan.processor", "com.acme.fineract.loan.job" }) @ConditionalOnProperty("acme.loan.enabled") public class AcmeLoanAutoConfiguration { diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java index 471f35801..ab9ffcd2b 100644 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java +++ b/fineract-accounting/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java @@ -24,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.POST; @@ -52,9 +51,13 @@ public class AccrualAccountingApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Executes Periodic Accrual Accounting", method = "POST", description = "Mandatory Fields\n" + "\n" + "tillDate\n") + @Operation(summary = "Executes Periodic Accrual Accounting", method = "POST", description = """ + Mandatory Fields + + tillDate + """) @RequestBody(required = true, content = @Content(schema = @Schema(implementation = AccrualAccountingApiResourceSwagger.PostRunaccrualsRequest.class))) - @ApiResponses({ @ApiResponse(responseCode = "200", description = "OK") }) + @ApiResponse(responseCode = "200", description = "OK") public CommandProcessingResult executePeriodicAccrualAccounting(@Parameter(hidden = true) AccrualAccountRequest accrualAccountRequest) { final CommandWrapper commandRequest = new CommandWrapperBuilder().excuteAccrualAccounting() .withJson(apiJsonSerializerService.serialize(accrualAccountRequest)).build(); diff --git a/fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java b/fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java index e69994034..0bc4e463f 100644 --- a/fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java +++ b/fineract-accounting/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java @@ -24,7 +24,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; @@ -69,13 +68,15 @@ import org.springframework.stereotype.Component; @Path("/v1/accountingrules") @Component -@Tag(name = "Accounting Rules", description = "It is typical scenario in MFI's that non accountants pass journal entries on a regular basis. For Ex: A branch office might deposit their entire cash at hand to their Bank account at the end of a working day. The branch office users might not understand enough of accounting to figure out which account needs to get credited and which account needs to be debited to represent this transaction.\n" - + "\n" - + "Enter accounting rules, an abstraction on top of manual Journal entires for enabling simpler data entry. An accounting rule can define any of the following abstractions\n" - + "\n" + "A Simple journal entry where both the credit and debit account have been preselected\n" - + "A Simple journal entry where either credit or debit accounts have been limited to a pre-selected list of accounts (Ex: Debit account should be one of \"Bank of America\" of \"JP Morgan\" and credit account should be \"Cash\")\n" - + "A Compound journal entry where multiple debits and / or multiple credits may be made amongst a set of preselected list of accounts (Ex: Credit account should be either \"Bank Of America\" or \"Cash\" and debit account can be \"Employee Salary\" and/or \"Miscellenous Expenses\")\n" - + "An accounting rule can also be optionally associated with a branch, so that only a particular Branch's users have access to the rule") +@Tag(name = "Accounting Rules", description = """ + It is typical scenario in MFI's that non accountants pass journal entries on a regular basis. For Ex: A branch office might deposit their entire cash at hand to their Bank account at the end of a working day. The branch office users might not understand enough of accounting to figure out which account needs to get credited and which account needs to be debited to represent this transaction. + + Enter accounting rules, an abstraction on top of manual Journal entires for enabling simpler data entry. An accounting rule can define any of the following abstractions + + A Simple journal entry where both the credit and debit account have been preselected + A Simple journal entry where either credit or debit accounts have been limited to a pre-selected list of accounts (Ex: Debit account should be one of "Bank of America" of "JP Morgan" and credit account should be "Cash") + A Compound journal entry where multiple debits and / or multiple credits may be made amongst a set of preselected list of accounts (Ex: Credit account should be either "Bank Of America" or "Cash" and debit account can be "Employee Salary" and/or "Miscellenous Expenses") + An accounting rule can also be optionally associated with a branch, so that only a particular Branch's users have access to the rule""") @RequiredArgsConstructor public class AccountingRuleApiResource { @@ -94,8 +95,14 @@ public class AccountingRuleApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Retrieve Accounting Rule Details Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:\n" - + "\n" + "Field Defaults\n" + "Allowed Value Lists\n" + "Example Request:\n" + "\n" + "accountingrules/template") + @Operation(summary = "Retrieve Accounting Rule Details Template", description = """ + This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of: + + Field Defaults + Allowed Value Lists + Example Request: + + accountingrules/template""") public AccountingRuleData retrieveTemplate() { context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSION); return handleTemplate(null); @@ -104,8 +111,12 @@ public class AccountingRuleApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Retrieve Accounting Rules", description = "Returns the list of defined accounting rules.\n" + "\n" - + "Example Requests:\n" + "\n" + "accountingrules") + @Operation(summary = "Retrieve Accounting Rules", description = """ + Returns the list of defined accounting rules. + + Example Requests: + + accountingrules""") public List retrieveAllAccountingRules(@Context final UriInfo uriInfo) { final AppUser currentUser = context.authenticatedUser(); currentUser.validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSION); @@ -122,8 +133,12 @@ public class AccountingRuleApiResource { @Path("{accountingRuleId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Retrieve a Accounting rule", description = "Returns the details of a defined Accounting rule.\n" + "\n" - + "Example Requests:\n" + "\n" + "accountingrules/1") + @Operation(summary = "Retrieve a Accounting rule", description = """ + Returns the details of a defined Accounting rule. + + Example Requests: + + accountingrules/1""") public AccountingRuleData retreiveAccountingRule( @PathParam("accountingRuleId") @Parameter(description = "accountingRuleId") final Long accountingRuleId, @Context final UriInfo uriInfo) { @@ -138,12 +153,18 @@ public class AccountingRuleApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Create/Define a Accounting rule", description = "Define a new Accounting rule.\n" + "\n" + "Mandatory Fields\n" - + "name, officeId,\n" + "accountToDebit OR debitTags,\n" + "accountToCredit OR creditTags.\n" + "\n" + "Optional Fields\n" - + "description") + @Operation(summary = "Create/Define a Accounting rule", description = """ + Define a new Accounting rule. + + Mandatory Fields + name, officeId, + accountToDebit OR debitTags, + accountToCredit OR creditTags. + + Optional Fields + description""") @RequestBody(content = @Content(schema = @Schema(implementation = AccountRuleRequest.class))) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.PostAccountingRulesResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.PostAccountingRulesResponse.class))) public CommandProcessingResult createAccountingRule(@Parameter(hidden = true) AccountRuleRequest accountRuleRequest) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createAccountingRule() .withJson(apiJsonSerializerService.serialize(accountRuleRequest)).build(); @@ -157,8 +178,7 @@ public class AccountingRuleApiResource { @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "Update a Accounting Rule", description = "Updates the details of a Accounting rule.") @RequestBody(content = @Content(schema = @Schema(implementation = AccountRuleRequest.class))) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.PutAccountingRulesResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.PutAccountingRulesResponse.class))) public CommandProcessingResult updateAccountingRule( @PathParam("accountingRuleId") @Parameter(description = "accountingRuleId") final Long accountingRuleId, @Parameter(hidden = true) AccountRuleRequest accountRuleRequest) { @@ -173,8 +193,7 @@ public class AccountingRuleApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "Delete a Accounting Rule", description = "Deletes a Accounting rule.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.DeleteAccountingRulesResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = AccountingRuleApiResourceSwagger.DeleteAccountingRulesResponse.class))) public CommandProcessingResult deleteAccountingRule( @PathParam("accountingRuleId") @Parameter(description = "accountingRuleId") final Long accountingRuleId) { diff --git a/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java b/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java index e003dca52..788ae2a56 100644 --- a/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java +++ b/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingConstants.java @@ -81,8 +81,7 @@ public final class AccountingConstants { } public static CashAccountsForLoan fromInt(final int i) { - final CashAccountsForLoan type = intToEnumMap.get(Integer.valueOf(i)); - return type; + return intToEnumMap.get(i); } } @@ -142,8 +141,7 @@ public final class AccountingConstants { } public static AccrualAccountsForLoan fromInt(final int i) { - final AccrualAccountsForLoan type = intToEnumMap.get(Integer.valueOf(i)); - return type; + return intToEnumMap.get(i); } } @@ -297,8 +295,7 @@ public final class AccountingConstants { } public static CashAccountsForSavings fromInt(final int i) { - final CashAccountsForSavings type = intToEnumMap.get(Integer.valueOf(i)); - return type; + return intToEnumMap.get(i); } } @@ -346,8 +343,7 @@ public final class AccountingConstants { } public static AccrualAccountsForSavings fromInt(final int i) { - final AccrualAccountsForSavings type = intToEnumMap.get(Integer.valueOf(i)); - return type; + return intToEnumMap.get(i); } } @@ -492,8 +488,7 @@ public final class AccountingConstants { } public static FinancialActivity fromInt(final int financialActivityId) { - final FinancialActivity type = intToEnumMap.get(Integer.valueOf(financialActivityId)); - return type; + return intToEnumMap.get(financialActivityId); } public static FinancialActivityData toFinancialActivityData(final int financialActivityId) { @@ -506,8 +501,7 @@ public final class AccountingConstants { } private static FinancialActivityData convertToFinancialActivityData(final FinancialActivity type) { - FinancialActivityData financialActivityData = new FinancialActivityData(type.value, type.code, type.getMappedGLAccountType()); - return financialActivityData; + return new FinancialActivityData(type.value, type.code, type.getMappedGLAccountType()); } } @@ -545,8 +539,7 @@ public final class AccountingConstants { } public static CashAccountsForShares fromInt(final int i) { - final CashAccountsForShares type = intToEnumMap.get(Integer.valueOf(i)); - return type; + return intToEnumMap.get(i); } } diff --git a/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingEnumerations.java b/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingEnumerations.java index a8d651ccd..65bdb835f 100755 --- a/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingEnumerations.java +++ b/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingEnumerations.java @@ -37,9 +37,7 @@ public final class AccountingEnumerations { } public static EnumOptionData gLAccountType(final GLAccountType accountType) { - final EnumOptionData optionData = new EnumOptionData(accountType.getValue().longValue(), accountType.getCode(), - accountType.toString()); - return optionData; + return new EnumOptionData(accountType.getValue().longValue(), accountType.getCode(), accountType.toString()); } public static List gLAccountType(final GLAccountType[] accountTypes) { @@ -55,9 +53,7 @@ public final class AccountingEnumerations { } public static EnumOptionData gLAccountUsage(final GLAccountUsage accountUsage) { - final EnumOptionData optionData = new EnumOptionData(accountUsage.getValue().longValue(), accountUsage.getCode(), - accountUsage.toString()); - return optionData; + return new EnumOptionData(accountUsage.getValue().longValue(), accountUsage.getCode(), accountUsage.toString()); } public static List gLAccountUsage(final GLAccountUsage[] accountUsages) { @@ -73,9 +69,7 @@ public final class AccountingEnumerations { } public static EnumOptionData journalEntryType(final JournalEntryType journalEntryType) { - final EnumOptionData optionData = new EnumOptionData(journalEntryType.getValue().longValue(), journalEntryType.getCode(), - journalEntryType.toString()); - return optionData; + return new EnumOptionData(journalEntryType.getValue().longValue(), journalEntryType.getCode(), journalEntryType.toString()); } public static List journalEntryTypes(final JournalEntryType[] journalEntryTypes) { @@ -91,9 +85,8 @@ public final class AccountingEnumerations { } public static EnumOptionData portfolioProductType(final PortfolioProductType portfolioProductType) { - final EnumOptionData optionData = new EnumOptionData(portfolioProductType.getValue().longValue(), portfolioProductType.getCode(), + return new EnumOptionData(portfolioProductType.getValue().longValue(), portfolioProductType.getCode(), portfolioProductType.toString()); - return optionData; } public static EnumOptionData accountingRuleType(final int id) { @@ -101,8 +94,7 @@ public final class AccountingEnumerations { } public static EnumOptionData accountingRuleType(final AccountingRuleType type) { - final EnumOptionData optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), type.toString()); - return optionData; + return new EnumOptionData(type.getValue().longValue(), type.getCode(), type.toString()); } public static List accountingRuleTypes(final AccountingRuleType[] accountingRuleTypes) { diff --git a/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingRuleType.java b/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingRuleType.java index e90b64044..a159d2325 100644 --- a/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingRuleType.java +++ b/fineract-core/src/main/java/org/apache/fineract/accounting/common/AccountingRuleType.java @@ -45,8 +45,7 @@ public enum AccountingRuleType { } public static AccountingRuleType fromInt(final Integer ruleTypeValue) { - final AccountingRuleType type = intToEnumMap.get(ruleTypeValue); - return type; + return intToEnumMap.get(ruleTypeValue); } AccountingRuleType(final Integer value, final String code, final String description) { diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/accountdetails/domain/AccountType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/accountdetails/domain/AccountType.java index 74b206456..a8f8c62b5 100644 --- a/fineract-core/src/main/java/org/apache/fineract/portfolio/accountdetails/domain/AccountType.java +++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/accountdetails/domain/AccountType.java @@ -44,26 +44,14 @@ public enum AccountType { } public static AccountType fromInt(final Integer accountTypeValue) { - - AccountType enumeration = AccountType.INVALID; - switch (accountTypeValue) { - case 1: - enumeration = AccountType.INDIVIDUAL; - break; - case 2: - enumeration = AccountType.GROUP; - break; - case 3: - enumeration = AccountType.JLG; - break; - case 4: - enumeration = AccountType.GLIM; - break; - case 5: - enumeration = AccountType.GSIM; - break; - } - return enumeration; + return switch (accountTypeValue) { + case 1 -> AccountType.INDIVIDUAL; + case 2 -> AccountType.GROUP; + case 3 -> AccountType.JLG; + case 4 -> AccountType.GLIM; + case 5 -> AccountType.GSIM; + default -> AccountType.INVALID; + }; } public static AccountType fromName(final String name) { diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/api/FineractClientConfiguration.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/api/FineractClientConfiguration.java index b690df76a..13dc80b0f 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/api/FineractClientConfiguration.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/api/FineractClientConfiguration.java @@ -42,9 +42,8 @@ public class FineractClientConfiguration { String apiBaseUrl = baseUrl + "/fineract-provider/api/"; boolean debugEnabled = Boolean.parseBoolean(System.getProperty("fineract.feign.debug", "false")); - FineractFeignClient client = FineractFeignClient.builder().baseUrl(apiBaseUrl).credentials(username, password).tenantId(tenantId) + return FineractFeignClient.builder().baseUrl(apiBaseUrl).credentials(username, password).tenantId(tenantId) .disableSslVerification(true).debug(debugEnabled).connectTimeout(60, TimeUnit.SECONDS) .readTimeout((int) readTimeout, TimeUnit.SECONDS).build(); - return client; } } diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/MessagingProperties.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/MessagingProperties.java index 2c121be7e..26373ef2c 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/MessagingProperties.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/config/MessagingProperties.java @@ -44,10 +44,8 @@ public class MessagingProperties implements InitializingBean { @Override public void afterPropertiesSet() throws Exception { - if (eventProperties.isEventVerificationEnabled()) { - if (isBlank(brokerUrl) || isBlank(topicName)) { - throw new IllegalStateException("Broker and topic must be configured in case event verification is enabled"); - } + if (eventProperties.isEventVerificationEnabled() && (isBlank(brokerUrl) || isBlank(topicName))) { + throw new IllegalStateException("Broker and topic must be configured in case event verification is enabled"); } } } diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/JournalEntriesStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/JournalEntriesStepDef.java index d302c86af..41c9feb94 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/JournalEntriesStepDef.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/common/JournalEntriesStepDef.java @@ -165,7 +165,7 @@ public class JournalEntriesStepDef extends AbstractStepDef { } public List> getJournalLinesActualList(List transactionsMatch) { - List> journalLinesActualList = transactionsMatch.stream().map(t -> { + return transactionsMatch.stream().map(t -> { String transactionId = "L" + t.getId(); GetJournalEntriesTransactionIdResponse journalEntryDataResponse = null; try { @@ -179,8 +179,6 @@ public class JournalEntriesStepDef extends AbstractStepDef { return journalEntryDataResponse.getPageItems(); }).collect(Collectors.toList()); - - return journalLinesActualList; } @Then("Loan Transactions tab has {int} a {string} transactions with date {string} which has the following Journal entries:") diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/api/ExternalAssetOwnersApiResource.java b/fineract-investor/src/main/java/org/apache/fineract/investor/api/ExternalAssetOwnersApiResource.java index 3dbebba00..f1a02f95e 100644 --- a/fineract-investor/src/main/java/org/apache/fineract/investor/api/ExternalAssetOwnersApiResource.java +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/api/ExternalAssetOwnersApiResource.java @@ -29,7 +29,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.GET; @@ -93,9 +92,8 @@ public class ExternalAssetOwnersApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ExternalAssetOwnerRequest.class))) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))), - @ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))) + @ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") public CommandProcessingResult transferRequestWithLoanId(@PathParam("loanId") final Long loanId, @Parameter ExternalAssetOwnerRequest assetOwnerReq, @QueryParam(COMMAND_PARAM) @Parameter(description = COMMAND_PARAM) final String commandParam) { @@ -111,9 +109,8 @@ public class ExternalAssetOwnersApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @RequestBody(required = true, content = @Content(schema = @Schema(implementation = ExternalAssetOwnerRequest.class))) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))), - @ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))) + @ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") public CommandProcessingResult transferRequestWithLoanExternalId(@PathParam("loanExternalId") final String externalLoanId, @Parameter ExternalAssetOwnerRequest assetOwnerReq, @QueryParam(COMMAND_PARAM) @Parameter(description = COMMAND_PARAM) final String commandParam) { @@ -130,9 +127,8 @@ public class ExternalAssetOwnersApiResource { @Path("/transfers/{id}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))), - @ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))) + @ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") public CommandProcessingResult transferRequestWithId(@PathParam("id") final Long id, @QueryParam(COMMAND_PARAM) @Parameter(description = COMMAND_PARAM) final String commandParam) { platformUserRightsContext.isAuthenticated(); @@ -145,9 +141,8 @@ public class ExternalAssetOwnersApiResource { @Path("/transfers/external-id/{externalId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))), - @ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = ExternalAssetOwnersApiResourceSwagger.PostInitiateTransferResponse.class))) + @ApiResponse(responseCode = "403", description = "Transfer cannot be initiated") public CommandProcessingResult transferRequestWithId(@PathParam("externalId") final String externalId, @QueryParam(COMMAND_PARAM) @Parameter(description = COMMAND_PARAM) final String commandParam) { platformUserRightsContext.isAuthenticated(); diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnersWriteServiceImpl.java b/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnersWriteServiceImpl.java index 56755787a..bb8477b23 100644 --- a/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnersWriteServiceImpl.java +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/service/ExternalAssetOwnersWriteServiceImpl.java @@ -223,7 +223,7 @@ public class ExternalAssetOwnersWriteServiceImpl implements ExternalAssetOwnersW List effectiveTransfers = externalAssetOwnerTransferRepository .findEffectiveTransfersOrderByIdDesc(loanDataForExternalTransfer.getId(), DateUtils.getBusinessLocalDate()); - if (effectiveTransfers.size() == 0) { + if (effectiveTransfers.isEmpty()) { throw new ExternalAssetOwnerInitiateTransferException( "This loan cannot be bought back, it is not owned by an external asset owner"); } else if (effectiveTransfers.size() == 2) { diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/service/LoanTransferabilityServiceImpl.java b/fineract-investor/src/main/java/org/apache/fineract/investor/service/LoanTransferabilityServiceImpl.java index 0f73c4045..681c33cb3 100644 --- a/fineract-investor/src/main/java/org/apache/fineract/investor/service/LoanTransferabilityServiceImpl.java +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/service/LoanTransferabilityServiceImpl.java @@ -55,12 +55,9 @@ public class LoanTransferabilityServiceImpl implements LoanTransferabilityServic return true; } - if (ExternalTransferStatus.PENDING_INTERMEDIATE == externalAssetOwnerTransfer.getStatus()) { - // When delayed settlement is enabled and asset is sold to intermediate. Need to validate. - return true; - } + // When delayed settlement is enabled and asset is sold to intermediate. Need to validate. + return ExternalTransferStatus.PENDING_INTERMEDIATE == externalAssetOwnerTransfer.getStatus(); // When delayed settlement is enabled and asset is sold from intermediate to investor. No need to validate. - return false; } } diff --git a/fineract-investor/src/main/java/org/apache/fineract/investor/service/serialization/serializer/investor/InvestorBusinessEventSerializer.java b/fineract-investor/src/main/java/org/apache/fineract/investor/service/serialization/serializer/investor/InvestorBusinessEventSerializer.java index db6836e1b..2d3378f95 100644 --- a/fineract-investor/src/main/java/org/apache/fineract/investor/service/serialization/serializer/investor/InvestorBusinessEventSerializer.java +++ b/fineract-investor/src/main/java/org/apache/fineract/investor/service/serialization/serializer/investor/InvestorBusinessEventSerializer.java @@ -63,9 +63,8 @@ public class InvestorBusinessEventSerializer extends AbstractBusinessEventWithCu private static CurrencyDataV1 getCurrencyFromEvent(InvestorBusinessEvent event) { MonetaryCurrency loanCurrency = event.getLoan().getCurrency(); - CurrencyDataV1 currency = CurrencyDataV1.newBuilder().setCode(loanCurrency.getCode()) - .setDecimalPlaces(loanCurrency.getDigitsAfterDecimal()).setInMultiplesOf(loanCurrency.getInMultiplesOf()).build(); - return currency; + return CurrencyDataV1.newBuilder().setCode(loanCurrency.getCode()).setDecimalPlaces(loanCurrency.getDigitsAfterDecimal()) + .setInMultiplesOf(loanCurrency.getInMultiplesOf()).build(); } @Override diff --git a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocJsonInputParams.java b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocJsonInputParams.java index e0f7cd05d..c0853cde7 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocJsonInputParams.java +++ b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocJsonInputParams.java @@ -56,7 +56,7 @@ public enum AdHocJsonInputParams { @Override public String toString() { - return name().toString().replaceAll("_", " "); + return name().replace("_", " "); } public String getValue() { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountAssociationType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountAssociationType.java index 737d79dd4..dff2179e6 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountAssociationType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountAssociationType.java @@ -31,18 +31,11 @@ public enum AccountAssociationType { private final String code; public static AccountAssociationType fromInt(final Integer statusValue) { - - AccountAssociationType enumeration = AccountAssociationType.INVALID; - switch (statusValue) { - case 1: - enumeration = AccountAssociationType.LINKED_ACCOUNT_ASSOCIATION; - break; - case 2: - enumeration = AccountAssociationType.GUARANTOR_ACCOUNT_ASSOCIATION; - break; - - } - return enumeration; + return switch (statusValue) { + case 1 -> AccountAssociationType.LINKED_ACCOUNT_ASSOCIATION; + case 2 -> AccountAssociationType.GUARANTOR_ACCOUNT_ASSOCIATION; + default -> AccountAssociationType.INVALID; + }; } AccountAssociationType(final Integer value, final String code) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferRecurrenceType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferRecurrenceType.java index f157ef076..c718654ff 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferRecurrenceType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferRecurrenceType.java @@ -31,17 +31,11 @@ public enum AccountTransferRecurrenceType { private final String code; public static AccountTransferRecurrenceType fromInt(final Integer statusValue) { - - AccountTransferRecurrenceType enumeration = AccountTransferRecurrenceType.INVALID; - switch (statusValue) { - case 1: - enumeration = AccountTransferRecurrenceType.PERIODIC; - break; - case 2: - enumeration = AccountTransferRecurrenceType.AS_PER_DUES; - break; - } - return enumeration; + return switch (statusValue) { + case 1 -> AccountTransferRecurrenceType.PERIODIC; + case 2 -> AccountTransferRecurrenceType.AS_PER_DUES; + default -> AccountTransferRecurrenceType.INVALID; + }; } AccountTransferRecurrenceType(final Integer value, final String code) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferType.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferType.java index 536fad14c..c45a2b5fd 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferType.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/domain/AccountTransferType.java @@ -34,26 +34,14 @@ public enum AccountTransferType { private final String code; public static AccountTransferType fromInt(final Integer statusValue) { - - AccountTransferType enumeration = AccountTransferType.INVALID; - switch (statusValue) { - case 1: - enumeration = AccountTransferType.ACCOUNT_TRANSFER; - break; - case 2: - enumeration = AccountTransferType.LOAN_REPAYMENT; - break; - case 3: - enumeration = AccountTransferType.CHARGE_PAYMENT; - break; - case 4: - enumeration = AccountTransferType.INTEREST_TRANSFER; - break; - case 5: - enumeration = AccountTransferType.LOAN_DOWN_PAYMENT; - break; - } - return enumeration; + return switch (statusValue) { + case 1 -> AccountTransferType.ACCOUNT_TRANSFER; + case 2 -> AccountTransferType.LOAN_REPAYMENT; + case 3 -> AccountTransferType.CHARGE_PAYMENT; + case 4 -> AccountTransferType.INTEREST_TRANSFER; + case 5 -> AccountTransferType.LOAN_DOWN_PAYMENT; + default -> AccountTransferType.INVALID; + }; } AccountTransferType(final Integer value, final String code) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java index 786baf95c..3c538c66f 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountsApiResource.java @@ -26,7 +26,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; @@ -112,11 +111,19 @@ public class FixedDepositAccountsApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Retrieve Fixed Deposit Account Template", description = "This is a convenience resource. It can be useful when building maintenance user interface screens for fixed deposit applications. The template data returned consists of any or all of:\n\n" - + "\n\n" + "Field Defaults\n\n" + "Allowed Value Lists" + "Example Requests:\n\n" + "\n\n" - + "fixeddepositaccounts/template?clientId=1") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsTemplateResponse.class))) }) + @Operation(summary = "Retrieve Fixed Deposit Account Template", description = """ + This is a convenience resource. It can be useful when building maintenance user interface screens for fixed deposit applications. The template data returned consists of any or all of: + + + + Field Defaults + + Allowed Value ListsExample Requests: + + + + fixeddepositaccounts/template?clientId=1""") + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsTemplateResponse.class))) public String template(@QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, @QueryParam("groupId") @Parameter(description = "groupId") final Long groupId, @QueryParam("productId") @Parameter(description = "productId") final Long productId, @@ -135,10 +142,19 @@ public class FixedDepositAccountsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "List Fixed deposit applications/accounts", description = "Lists Fixed Deposit Accounts\n\n" - + "Example Requests:\n\n" + "\n\n" + "fixeddepositaccounts\n\n" + "\n\n" + "fixeddepositaccounts?fields=name") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsResponse.class)))) }) + @Operation(summary = "List Fixed deposit applications/accounts", description = """ + Lists Fixed Deposit Accounts + + Example Requests: + + + + fixeddepositaccounts + + + + fixeddepositaccounts?fields=name""") + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsResponse.class)))) public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("paged") @Parameter(description = "paged") final Boolean paged, @QueryParam("offset") @Parameter(description = "offset") final Integer offset, @QueryParam("limit") @Parameter(description = "limit") final Integer limit, @@ -168,12 +184,13 @@ public class FixedDepositAccountsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Submit new fixed deposit application", description = "Submits a new fixed deposit application" - + "Mandatory Fields: clientId or groupId, productId, submittedOnDate, depositAmount, depositPeriod, depositPeriodFrequencyId\n\n" - + "Optional Fields: accountNo, externalId, fieldOfficerId,linkAccountId(if provided initial deposit amount will be collected from this account),transferInterestToSavings(By enabling this flag all interest postings will be transferred to linked saving account )") + @Operation(summary = "Submit new fixed deposit application", description = """ + Submits a new fixed deposit application + Mandatory Fields: clientId or groupId, productId, submittedOnDate, depositAmount, depositPeriod, depositPeriodFrequencyId + + Optional Fields: accountNo, externalId, fieldOfficerId,linkAccountId(if provided initial deposit amount will be collected from this account),transferInterestToSavings(By enabling this flag all interest postings will be transferred to linked saving account )""") @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsRequest.class))) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsResponse.class))) public String submitApplication(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createFixedDepositAccount().withJson(apiRequestBodyAsJson) @@ -188,10 +205,17 @@ public class FixedDepositAccountsApiResource { @Path("{accountId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Retrieve a fixed deposit application/account", description = "Retrieves a fixed deposit application/account\n\n" - + "Example Requests :\n\n" + "\n\n" + "fixeddepositaccounts/1" + "\n\n" + "fixeddepositaccounts/1?associations=all") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsAccountIdResponse.class))) }) + @Operation(summary = "Retrieve a fixed deposit application/account", description = """ + Retrieves a fixed deposit application/account + + Example Requests : + + + + fixeddepositaccounts/1 + + fixeddepositaccounts/1?associations=all""") + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.GetFixedDepositAccountsAccountIdResponse.class))) public String retrieveOne(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") @Parameter(description = "staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, @DefaultValue("all") @QueryParam("chargeStatus") @Parameter(description = "chargeStatus") final String chargeStatus, @@ -220,8 +244,7 @@ public class FixedDepositAccountsApiResource { @Path("calculate-fd-interest") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.CalculateFixedDepositInterestResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.CalculateFixedDepositInterestResponse.class))) public String calculateFixedDepositInterest(@Context final UriInfo uriInfo, @QueryParam("principalAmount") @Parameter(description = "BigDecimal principalAmount") final BigDecimal principalAmount, @QueryParam("annualInterestRate") @Parameter(description = "annualInterestRate") final BigDecimal annualInterestRate, @@ -320,8 +343,7 @@ public class FixedDepositAccountsApiResource { @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "Modify a fixed deposit application", description = "Fixed deposit application can only be modified when in 'Submitted and pending approval' state. Once the application is approved, the details cannot be changed using this method. Specific api endpoints will be created to allow change of interest detail such as rate, compounding period, posting period etc") @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PutFixedDepositAccountsAccountIdRequest.class))) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PutFixedDepositAccountsAccountIdResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PutFixedDepositAccountsAccountIdResponse.class))) public String update(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, @Parameter(hidden = true) final String apiRequestBodyAsJson) { @@ -357,8 +379,7 @@ public class FixedDepositAccountsApiResource { + "Calculates and Posts interest earned on a fixed deposit account based on today's date and whether an interest posting or crediting event is due.\n\n" + "Showing request/response for Calculate Interest on Fixed Deposit Account") @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsAccountIdRequest.class))) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsAccountIdResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.PostFixedDepositAccountsAccountIdResponse.class))) public String handleCommands(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId, @QueryParam("command") @Parameter(description = "command") final String commandParam, @Context final UriInfo uriInfo, @Parameter(hidden = true) final String apiRequestBodyAsJson) { @@ -426,8 +447,7 @@ public class FixedDepositAccountsApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "Delete a fixed deposit application", description = "At present we support hard delete of fixed deposit application so long as its in 'Submitted and pending approval' state. One the application is moves past this state, it is not possible to do a 'hard' delete of the application or the account. An API endpoint will be added to close/de-activate the fixed deposit account.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.DeleteFixedDepositAccountsAccountIdResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositAccountsApiResourceSwagger.DeleteFixedDepositAccountsAccountIdResponse.class))) public String delete(@PathParam("accountId") @Parameter(description = "accountId") final Long accountId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteFixedDepositAccount(accountId).build(); diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResource.java index 7bee90301..4086254f5 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositProductsApiResource.java @@ -25,7 +25,6 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DELETE; @@ -86,9 +85,12 @@ import org.springframework.util.CollectionUtils; @Path("/v1/fixeddepositproducts") @Component -@Tag(name = "Fixed Deposit Product", description = "This is one of the advanced term deposit product offered by MFI's. The Fixed Deposit Products (aka FD) product offerings are modeled using this API.\n" - + "\n" + "The FD products are deposit accounts which are held for a fixed term – like 1 year, 2 years etc.\n" + "\n" - + "When creating fixed deposit accounts, the details from the fixed deposit product are used to auto fill details of the fixed deposit account application process.") +@Tag(name = "Fixed Deposit Product", description = """ + This is one of the advanced term deposit product offered by MFI's. The Fixed Deposit Products (aka FD) product offerings are modeled using this API. + + The FD products are deposit accounts which are held for a fixed term – like 1 year, 2 years etc. + + When creating fixed deposit accounts, the details from the fixed deposit product are used to auto fill details of the fixed deposit account application process.""") @RequiredArgsConstructor public class FixedDepositProductsApiResource { @@ -112,14 +114,17 @@ public class FixedDepositProductsApiResource { @POST @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Create a Fixed Deposit Product", description = "Creates a Fixed Deposit Product\n\n" - + "Mandatory Fields: name, shortName, description, currencyCode, digitsAfterDecimal,inMultiplesOf, interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minDepositTerm, minDepositTermTypeId, accountingRule\n\n" - + "Optional Fields: lockinPeriodFrequency, lockinPeriodFrequencyType, maxDepositTerm, maxDepositTermTypeId, inMultiplesOfDepositTerm, inMultiplesOfDepositTermTypeId, preClosurePenalApplicable, preClosurePenalInterest, preClosurePenalInterestOnTypeId, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, charges, charts, , withHoldTax, taxGroupId\n\n" - + "\n" - + "Mandatory Fields for Cash based accounting (accountingRule = 2): savingsReferenceAccountId, savingsControlAccountId, interestOnSavingsAccountId, incomeFromFeeAccountId, transfersInSuspenseAccountId, incomeFromPenaltyAccountId") + @Operation(summary = "Create a Fixed Deposit Product", description = """ + Creates a Fixed Deposit Product + + Mandatory Fields: name, shortName, description, currencyCode, digitsAfterDecimal,inMultiplesOf, interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minDepositTerm, minDepositTermTypeId, accountingRule + + Optional Fields: lockinPeriodFrequency, lockinPeriodFrequencyType, maxDepositTerm, maxDepositTermTypeId, inMultiplesOfDepositTerm, inMultiplesOfDepositTermTypeId, preClosurePenalApplicable, preClosurePenalInterest, preClosurePenalInterestOnTypeId, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, charges, charts, , withHoldTax, taxGroupId + + + Mandatory Fields for Cash based accounting (accountingRule = 2): savingsReferenceAccountId, savingsControlAccountId, interestOnSavingsAccountId, incomeFromFeeAccountId, transfersInSuspenseAccountId, incomeFromPenaltyAccountId""") @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.PostFixedDepositProductsRequest.class))) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.PostFixedDepositProductsResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.PostFixedDepositProductsResponse.class))) public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { final CommandWrapper commandRequest = new CommandWrapperBuilder().createFixedDepositProduct().withJson(apiRequestBodyAsJson) @@ -136,8 +141,7 @@ public class FixedDepositProductsApiResource { @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "Update a Fixed Deposit Product", description = "Updates a Fixed Deposit Product") @RequestBody(required = true, content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.PutFixedDepositProductsProductIdRequest.class))) - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.PutFixedDepositProductsProductIdResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.PutFixedDepositProductsProductIdResponse.class))) public String update(@PathParam("productId") @Parameter(description = "productId") final Long productId, @Parameter(hidden = true) final String apiRequestBodyAsJson) { @@ -153,10 +157,17 @@ public class FixedDepositProductsApiResource { @GET @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "List Fixed Deposit Products", description = "Lists Fixed Deposit Products\n\n" + "Example Requests:\n" + "\n" - + "fixeddepositproducts\n" + "\n" + "\n" + "fixeddepositproducts?fields=name") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.GetFixedDepositProductsResponse.class)))) }) + @Operation(summary = "List Fixed Deposit Products", description = """ + Lists Fixed Deposit Products + + Example Requests: + + fixeddepositproducts + + + fixeddepositproducts?fields=name""") + + @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.GetFixedDepositProductsResponse.class)))) public String retrieveAll(@Context final UriInfo uriInfo) { this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.FIXED_DEPOSIT_PRODUCT_RESOURCE_NAME); @@ -173,11 +184,19 @@ public class FixedDepositProductsApiResource { @Path("{productId}") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Retrieve a Fixed Deposit Product", description = "Retrieves a Fixed Deposit Product\n\n" + "Example Requests:\n" - + "\n" + "fixeddepositproducts/1\n" + "\n" + "\n" + "fixeddepositproducts/1?template=true\n" + "\n" + "\n" - + "fixeddepositproducts/1?fields=name,description") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.GetFixedDepositProductsProductIdResponse.class))) }) + @Operation(summary = "Retrieve a Fixed Deposit Product", description = """ + Retrieves a Fixed Deposit Product + + Example Requests: + + fixeddepositproducts/1 + + + fixeddepositproducts/1?template=true + + + fixeddepositproducts/1?fields=name,description""") + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.GetFixedDepositProductsProductIdResponse.class))) public String retrieveOne(@PathParam("productId") @Parameter(description = "productId") final Long productId, @Context final UriInfo uriInfo) { @@ -320,8 +339,7 @@ public class FixedDepositProductsApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) @Operation(summary = "Delete a Fixed Deposit Product", description = "Deletes a Fixed Deposit Product") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.DeleteFixedDepositProductsProductIdResponse.class))) }) + @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = FixedDepositProductsApiResourceSwagger.DeleteFixedDepositProductsProductIdResponse.class))) public String delete(@PathParam("productId") @Parameter(description = "productId") final Long productId) { final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteFixedDepositProduct(productId).build();