You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ar...@apache.org on 2023/05/15 11:19:12 UTC
[fineract] branch develop updated: FINERACT-1724: Preparation for versioned APIs
This is an automated email from the ASF dual-hosted git repository.
arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 037f7f264 FINERACT-1724: Preparation for versioned APIs
037f7f264 is described below
commit 037f7f264fc2a4603656884bdf2554b9ab4c0240
Author: Arnold Galovics <ga...@gmail.com>
AuthorDate: Thu May 11 19:02:38 2023 +0200
FINERACT-1724: Preparation for versioned APIs
---
.../client/services/DocumentsApiFixed.java | 12 +-
.../apache/fineract/client/services/ImagesApi.java | 8 +-
.../fineract/client/services/RunReportsApi.java | 4 +-
.../accrual/api/AccrualAccountingApiResource.java | 4 +-
.../closure/api/GLClosuresApiResource.java | 4 +-
.../api/FinancialActivityAccountsApiResource.java | 4 +-
.../glaccount/api/GLAccountsApiResource.java | 4 +-
.../api/JournalEntriesApiResource.java | 4 +-
.../api/ProvisioningEntriesApiResource.java | 4 +-
.../rule/api/AccountingRuleApiResource.java | 4 +-
.../fineract/adhocquery/api/AdHocApiResource.java | 4 +-
.../fineract/batch/api/BatchApiResource.java | 4 +-
.../fineract/batch/command/CommandContext.java | 4 +-
.../batch/command/CommandStrategyProvider.java | 144 +++++++++++----------
.../batch/command/CommandStrategyUtils.java | 25 ++++
.../internal/ActivateClientCommandStrategy.java | 4 +-
...ustChargeByChargeExternalIdCommandStrategy.java | 4 +-
.../internal/AdjustChargeCommandStrategy.java | 4 +-
...justTransactionByExternalIdCommandStrategy.java | 4 +-
.../internal/AdjustTransactionCommandStrategy.java | 4 +-
.../internal/ApproveLoanCommandStrategy.java | 4 +-
.../ApproveLoanRescheduleCommandStrategy.java | 4 +-
...lectChargesByLoanExternalIdCommandStrategy.java | 4 +-
.../internal/CollectChargesCommandStrategy.java | 4 +-
...reateChargeByLoanExternalIdCommandStrategy.java | 4 +-
.../internal/CreateChargeCommandStrategy.java | 4 +-
.../CreateDatatableEntryCommandStrategy.java | 4 +-
...TransactionByLoanExternalIdCommandStrategy.java | 4 +-
.../CreateTransactionLoanCommandStrategy.java | 4 +-
.../internal/DisburseLoanCommandStrategy.java | 4 +-
...GetChargeByChargeExternalIdCommandStrategy.java | 4 +-
.../internal/GetChargeByIdCommandStrategy.java | 4 +-
...yByAppTableIdAndDataTableIdCommandStrategy.java | 4 +-
...tDatatableEntryByAppTableIdCommandStrategy.java | 4 +-
.../GetDatatableEntryByQueryCommandStrategy.java | 4 +-
.../GetLoanByExternalIdCommandStrategy.java | 4 +-
.../internal/GetLoanByIdCommandStrategy.java | 4 +-
.../GetSavingsAccountByIdCommandStrategy.java | 4 +-
.../GetTransactionByExternalIdCommandStrategy.java | 4 +-
.../GetTransactionByIdCommandStrategy.java | 4 +-
...ateTransistionsByExternalIdCommandStrategy.java | 4 +-
...LoanApplicationByExternalIdCommandStrategy.java | 4 +-
.../ModifyLoanApplicationCommandStrategy.java | 4 +-
...ngsAccountAdjustTransactionCommandStrategy.java | 4 +-
.../SavingsAccountTransactionCommandStrategy.java | 4 +-
.../internal/UpdateClientCommandStrategy.java | 4 +-
...dateDatatableEntryOneToManyCommandStrategy.java | 4 +-
...pdateDatatableEntryOneToOneCommandStrategy.java | 4 +-
....java => ConfigureBusinessStepApiResource.java} | 4 +-
.../api/InternalLoanAccountLockApiResource.java | 2 +-
.../cob/api/LoanAccountLockApiResource.java | 2 +-
.../cob/api/LoanCOBCatchUpApiResource.java | 2 +-
.../fineract/commands/api/AuditsApiResource.java | 4 +-
.../commands/api/MakercheckersApiResource.java | 4 +-
.../api/AccountNumberFormatsApiResource.java | 18 +--
.../service/AccountNumberFormatConstants.java | 2 +-
.../bulkimport/api/BulkImportApiResource.java | 16 +--
.../businessdate/api/BusinessDateApiResource.java | 2 +-
.../infrastructure/cache/api/CacheApiResource.java | 20 +--
.../campaigns/email/api/EmailApiResource.java | 4 +-
.../email/api/EmailCampaignApiResource.java | 4 +-
.../email/api/EmailConfigurationApiResource.java | 21 +--
.../campaigns/sms/api/SmsCampaignApiResource.java | 4 +-
.../codes/api/CodeValuesApiResource.java | 18 +--
.../infrastructure/codes/api/CodesApiResource.java | 18 +--
.../ExternalServicesConfigurationApiResource.java | 23 +---
.../api/GlobalConfigurationApiResource.java | 21 +--
.../infrastructure/core/config/JerseyConfig.java | 6 +-
...rsResource.java => EchoHeadersApiResource.java} | 6 +-
...a => CreditBureauConfigurationApiResource.java} | 35 +----
...ava => CreditBureauIntegrationApiResource.java} | 6 +-
.../dataqueries/api/DatatablesApiResource.java | 19 +--
.../api/EntityDatatableChecksApiResource.java | 8 +-
.../dataqueries/api/ReportsApiResource.java | 20 +--
.../dataqueries/api/RunreportsApiResource.java | 15 +--
.../api/DocumentManagementApiResource.java | 20 +--
.../documentmanagement/api/ImagesApiResource.java | 4 +-
.../api/FineractEntityApiResource.java | 21 +--
.../api/ExternalEventConfigurationApiResource.java | 2 +-
.../gcm/api/DeviceRegistrationApiResource.java | 18 +--
.../infrastructure/hooks/api/HookApiResource.java | 2 +-
.../instancemode/api/InstanceModeApiResource.java | 2 +-
.../filter/FineractInstanceModeApiFilter.java | 21 ++-
.../jobs/api/InlineJobApiResource.java | 2 +-
.../jobs/api/SchedulerApiResource.java | 3 +-
.../jobs/api/SchedulerJobApiResource.java | 2 +-
.../jobs/filter/LoanCOBApiFilter.java | 20 ++-
.../api/ReportMailingJobApiResource.java | 20 +--
.../api/ReportMailingJobRunHistoryApiResource.java | 17 +--
.../security/api/AuthenticationApiResource.java | 20 +--
.../security/api/TwoFactorApiResource.java | 21 +--
.../api/TwoFactorConfigurationApiResource.java | 17 +--
.../security/api/UserDetailsApiResource.java | 14 +-
.../infrastructure/sms/api/SmsApiResource.java | 2 +-
.../survey/api/LikelihoodApiResource.java | 19 +--
.../survey/api/PovertyLineApiResource.java | 21 +--
.../survey/api/SurveyApiResource.java | 21 +--
.../interoperation/api/InteropApiResource.java | 30 ++---
.../fineract/mix/api/MixReportApiResource.java | 14 +-
.../fineract/mix/api/MixTaxonomyApiResource.java | 17 +--
.../mix/api/MixTaxonomyMappingApiResource.java | 22 +---
.../notification/api/NotificationApiResource.java | 2 +-
.../holiday/api/HolidaysApiResource.java | 18 +--
.../monetary/api/CurrenciesApiResource.java | 20 +--
.../office/api/OfficeTransactionsApiResource.java | 20 +--
.../office/api/OfficesApiResource.java | 2 +-
.../api/ProvisioningCategoryApiResource.java | 21 +--
.../api/ProvisioningCriteriaApiResource.java | 21 +--
.../organisation/staff/api/StaffApiResource.java | 2 +-
.../teller/api/CashierApiResource.java | 15 +--
.../organisation/teller/api/TellerApiResource.java | 19 +--
.../teller/api/TellerJournalApiResource.java | 17 +--
.../workingdays/api/WorkingDaysApiResource.java | 20 +--
.../account/api/AccountTransfersApiResource.java | 20 +--
.../api/StandingInstructionApiResource.java | 22 +---
.../api/StandingInstructionHistoryApiResource.java | 18 +--
.../accounts/api/AccountsApiResource.java | 22 +---
...va => EntityFieldConfigurationApiResource.java} | 20 +--
.../calendar/api/CalendarsApiResource.java | 20 +--
.../portfolio/charge/api/ChargesApiResource.java | 18 +--
...esources.java => ClientAddressApiResource.java} | 20 +--
.../client/api/ClientChargesApiResource.java | 21 +--
...es.java => ClientFamilyMembersApiResource.java} | 23 +---
.../client/api/ClientIdentifiersApiResource.java | 23 +---
.../client/api/ClientTransactionsApiResource.java | 2 +-
.../portfolio/client/api/ClientsApiResource.java | 2 +-
.../api/InternalClientInformationApiResource.java | 2 +-
.../collateral/api/CollateralsApiResource.java | 20 +--
.../api/ClientCollateralManagementApiResource.java | 23 +---
.../api/CollateralManagementApiResource.java | 21 +--
...va => LoanCollateralManagementApiResource.java} | 21 +--
...sourse.java => CollectionSheetApiResource.java} | 22 +---
.../delinquency/api/DelinquencyApiResource.java | 2 +-
.../api/FloatingRatesApiResource.java | 20 +--
.../portfolio/fund/api/FundsApiResource.java | 2 +-
.../portfolio/group/api/CentersApiResource.java | 36 +-----
.../portfolio/group/api/GroupsApiResource.java | 2 +-
.../group/api/GroupsLevelApiResource.java | 16 +--
.../api/InterestRateChartSlabsApiResource.java | 20 +--
.../api/InterestRateChartsApiResource.java | 20 +--
.../loanaccount/api/BulkLoansApiResource.java | 22 +---
.../api/InternalLoanInformationApiResource.java | 2 +-
.../loanaccount/api/LoanChargesApiResource.java | 2 +-
.../api/LoanDisbursementDetailApiResource.java | 18 +--
.../loanaccount/api/LoanScheduleApiResource.java | 20 +--
.../api/LoanTransactionsApiResource.java | 2 +-
.../loanaccount/api/LoansApiResource.java | 2 +-
.../guarantor/api/GuarantorsApiResource.java | 27 +---
.../api/RescheduleLoansApiResource.java | 24 +---
.../loanproduct/api/LoanProductsApiResource.java | 2 +-
.../productmix/api/ProductMixApiResource.java | 21 +--
.../portfolio/meeting/api/MeetingsApiResource.java | 25 +---
.../portfolio/note/api/NotesApiResource.java | 18 +--
.../paymenttype/api/PaymentTypeApiResource.java | 7 +-
.../products/api/ProductsApiResource.java | 18 +--
.../portfolio/rate/api/RateApiResource.java | 18 +--
.../RepaymentWithPostDatedChecksApiResource.java | 19 +--
...itAccountOnHoldFundTransactionsApiResource.java | 18 +--
...FixedDepositAccountTransactionsApiResource.java | 22 +---
.../api/FixedDepositAccountsApiResource.java | 30 +----
.../api/FixedDepositProductsApiResource.java | 39 +-----
...rringDepositAccountTransactionsApiResource.java | 24 +---
.../api/RecurringDepositAccountsApiResource.java | 28 +---
.../api/RecurringDepositProductsApiResource.java | 39 +-----
.../api/SavingsAccountChargesApiResource.java | 22 +---
.../api/SavingsAccountTransactionsApiResource.java | 22 +---
.../savings/api/SavingsAccountsApiResource.java | 2 +-
.../savings/api/SavingsProductsApiResource.java | 34 +----
.../portfolio/search/api/SearchApiResource.java | 19 +--
.../api/SelfAccountTransferApiResource.java | 28 +---
.../api/SelfBeneficiariesTPTApiResource.java | 20 +--
.../self/client/api/SelfClientsApiResource.java | 22 +---
.../self/loanaccount/api/SelfLoansApiResource.java | 23 +---
.../self/pockets/api/PocketApiResource.java | 18 +--
.../products/api/SelfLoanProductsApiResource.java | 15 +--
.../api/SelfSavingsProductsApiResource.java | 15 +--
.../products/api/SelfShareProductsApiResource.java | 15 +--
.../api/SelfServiceRegistrationApiResource.java | 15 +--
.../self/runreport/SelfRunReportApiResource.java | 13 +-
.../self/savings/api/SelfSavingsApiResource.java | 23 +---
.../api/SelfAuthenticationApiResource.java | 12 +-
.../self/security/api/SelfUserApiResource.java | 15 +--
.../security/api/SelfUserDetailsApiResource.java | 13 +-
.../api/SelfShareAccountsApiResource.java | 2 +-
.../self/spm/api/SelfScorecardApiResource.java | 16 +--
.../portfolio/self/spm/api/SelfSpmApiResource.java | 14 +-
.../api/ShareDividendApiResource.java | 23 +---
.../portfolio/tax/api/TaxComponentApiResource.java | 20 +--
.../portfolio/tax/api/TaxGroupApiResource.java | 19 +--
.../fineract/spm/api/LookupTableApiResource.java | 16 +--
.../fineract/spm/api/ScorecardApiResource.java | 19 +--
.../apache/fineract/spm/api/SpmApiResource.java | 14 +-
.../template/api/TemplatesApiResource.java | 24 +---
.../api/PasswordPreferencesApiResource.java | 20 +--
.../api/PermissionsApiResource.java | 18 +--
.../useradministration/api/RolesApiResource.java | 23 +---
.../useradministration/api/UsersApiResource.java | 25 +---
.../org/apache/fineract/AbstractSpringTest.java | 49 +++++++
.../batch/command/CommandStrategyProviderTest.java | 27 +++-
.../batch/command/CommandStrategyUtilsTest.java | 93 +++++++++++++
.../CreateTransactionLoanCommandStrategyTest.java | 2 +-
.../internal/GetLoanByIdCommandStrategyTest.java | 2 +-
.../core/config/ApiVerificationTest.java | 97 ++++++++++++++
.../filter/FineractInstanceModeApiFilterTest.java | 42 +++---
.../jobs/filter/LoanCOBApiFilterTest.java | 67 +++++-----
.../fineract/integrationtests/BatchApiTest.java | 83 +++++++++++-
.../integrationtests/client/ImageTest.java | 4 +-
.../integrationtests/client/IntegrationTest.java | 2 +-
.../integrationtests/common/BatchHelper.java | 111 +++++++++-------
.../inlinecob/InlineLoanCOBTest.java | 69 ++++++++++
.../instancemode/InstanceModeSupportExtension.java | 25 +++-
211 files changed, 1191 insertions(+), 2204 deletions(-)
diff --git a/fineract-client/src/main/java/org/apache/fineract/client/services/DocumentsApiFixed.java b/fineract-client/src/main/java/org/apache/fineract/client/services/DocumentsApiFixed.java
index 29e631c7d..b559b5bbb 100644
--- a/fineract-client/src/main/java/org/apache/fineract/client/services/DocumentsApiFixed.java
+++ b/fineract-client/src/main/java/org/apache/fineract/client/services/DocumentsApiFixed.java
@@ -53,7 +53,7 @@ public interface DocumentsApiFixed {
* @return Call<PostEntityTypeEntityIdDocumentsResponse>
*/
@retrofit2.http.Multipart
- @POST("{entityType}/{entityId}/documents")
+ @POST("v1/{entityType}/{entityId}/documents")
Call<PostEntityTypeEntityIdDocumentsResponse> createDocument(@retrofit2.http.Path("entityType") String entityType,
@retrofit2.http.Path("entityId") Long entityId, @retrofit2.http.Part okhttp3.MultipartBody.Part file,
@retrofit2.http.Part("name") String name, @retrofit2.http.Part("description") String description);
@@ -69,7 +69,7 @@ public interface DocumentsApiFixed {
* documentId (required)
* @return Call<DeleteEntityTypeEntityIdDocumentsResponse>
*/
- @DELETE("{entityType}/{entityId}/documents/{documentId}")
+ @DELETE("v1/{entityType}/{entityId}/documents/{documentId}")
Call<DeleteEntityTypeEntityIdDocumentsResponse> deleteDocument(@retrofit2.http.Path("entityType") String entityType,
@retrofit2.http.Path("entityId") Long entityId, @retrofit2.http.Path("documentId") Long documentId);
@@ -85,7 +85,7 @@ public interface DocumentsApiFixed {
* documentId (required)
* @return Call<Void>
*/
- @GET("{entityType}/{entityId}/documents/{documentId}/attachment")
+ @GET("v1/{entityType}/{entityId}/documents/{documentId}/attachment")
Call<ResponseBody> downloadFile(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Path("documentId") Long documentId);
@@ -101,7 +101,7 @@ public interface DocumentsApiFixed {
* documentId (required)
* @return Call<GetEntityTypeEntityIdDocumentsResponse>
*/
- @GET("{entityType}/{entityId}/documents/{documentId}")
+ @GET("v1/{entityType}/{entityId}/documents/{documentId}")
Call<GetEntityTypeEntityIdDocumentsResponse> getDocument(@retrofit2.http.Path("entityType") String entityType,
@retrofit2.http.Path("entityId") Long entityId, @retrofit2.http.Path("documentId") Long documentId);
@@ -115,7 +115,7 @@ public interface DocumentsApiFixed {
* entityId (required)
* @return Call<List<GetEntityTypeEntityIdDocumentsResponse>>
*/
- @GET("{entityType}/{entityId}/documents")
+ @GET("v1/{entityType}/{entityId}/documents")
Call<List<GetEntityTypeEntityIdDocumentsResponse>> retrieveAllDocuments(@retrofit2.http.Path("entityType") String entityType,
@retrofit2.http.Path("entityId") Long entityId);
@@ -138,7 +138,7 @@ public interface DocumentsApiFixed {
* @return Call<PutEntityTypeEntityIdDocumentsResponse>
*/
@retrofit2.http.Multipart
- @PUT("{entityType}/{entityId}/documents/{documentId}")
+ @PUT("v1/{entityType}/{entityId}/documents/{documentId}")
Call<PutEntityTypeEntityIdDocumentsResponse> updateDocument(@retrofit2.http.Path("entityType") String entityType,
@retrofit2.http.Path("entityId") Long entityId, @retrofit2.http.Path("documentId") Long documentId,
@retrofit2.http.Part okhttp3.MultipartBody.Part file, @retrofit2.http.Part("name") String name,
diff --git a/fineract-client/src/main/java/org/apache/fineract/client/services/ImagesApi.java b/fineract-client/src/main/java/org/apache/fineract/client/services/ImagesApi.java
index 015c89214..a7f05d65b 100644
--- a/fineract-client/src/main/java/org/apache/fineract/client/services/ImagesApi.java
+++ b/fineract-client/src/main/java/org/apache/fineract/client/services/ImagesApi.java
@@ -36,21 +36,21 @@ import retrofit2.http.PUT;
*/
public interface ImagesApi {
- @POST("{entityType}/{entityId}/images")
+ @POST("v1/{entityType}/{entityId}/images")
@retrofit2.http.Multipart
Call<Void> create(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Part okhttp3.MultipartBody.Part file);
- @GET("{entityType}/{entityId}/images")
+ @GET("v1/{entityType}/{entityId}/images")
Call<ResponseBody> get(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Query("maxWidth") Integer maxWidth, @retrofit2.http.Query("maxHeight") Integer maxHeight,
@retrofit2.http.Query("output") String output);
- @PUT("{entityType}/{entityId}/images")
+ @PUT("v1/{entityType}/{entityId}/images")
@retrofit2.http.Multipart
Call<Void> update(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Part okhttp3.MultipartBody.Part file);
- @DELETE("{entityType}/{entityId}/images")
+ @DELETE("v1/{entityType}/{entityId}/images")
Call<Void> delete(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId);
}
diff --git a/fineract-client/src/main/java/org/apache/fineract/client/services/RunReportsApi.java b/fineract-client/src/main/java/org/apache/fineract/client/services/RunReportsApi.java
index 06817a389..32bf70741 100644
--- a/fineract-client/src/main/java/org/apache/fineract/client/services/RunReportsApi.java
+++ b/fineract-client/src/main/java/org/apache/fineract/client/services/RunReportsApi.java
@@ -51,14 +51,14 @@ public interface RunReportsApi {
* isSelfServiceUserReport (optional, default to false)
* @return Call<GetReportNameResponse>
*/
- @GET("runreports/{reportName}")
+ @GET("v1/runreports/{reportName}")
Call<RunReportsResponse> runReportGetData(@retrofit2.http.Path("reportName") String reportName,
@QueryMap Map<String, String> parameters, @retrofit2.http.Query("isSelfServiceUserReport") Boolean isSelfServiceUserReport);
/**
* Run Report which returns a response such as a PDF, CSV, XLS or XSLX file.
*/
- @GET("runreports/{reportName}")
+ @GET("v1/runreports/{reportName}")
Call<ResponseBody> runReportGetFile(@retrofit2.http.Path("reportName") String reportName, @QueryMap Map<String, String> parameters,
@retrofit2.http.Query("isSelfServiceUserReport") Boolean isSelfServiceUserReport);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java
index bc591ab8f..373456e54 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/accrual/api/AccrualAccountingApiResource.java
@@ -37,12 +37,10 @@ import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/runaccruals")
+@Path("/v1/runaccruals")
@Component
-@Scope("singleton")
@Tag(name = "Periodic Accrual Accounting", description = "Periodic Accrual is to accrue the loan income till the specific date or till batch job scheduled time.\n")
@RequiredArgsConstructor
public class AccrualAccountingApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java
index 8c1cdda44..b513ea417 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/closure/api/GLClosuresApiResource.java
@@ -55,12 +55,10 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/glclosures")
+@Path("/v1/glclosures")
@Component
-@Scope("singleton")
@Tag(name = "Accounting Closure", description = "An accounting closure indicates that no more journal entries may be logged (or reversed) in the system, either manually or via the portfolio with an entry date prior to the defined closure date\n"
+ "\n" + "Field Descriptions\n" + "closingDate\n" + "The date for which the accounting closure is defined\n" + "officeId\n"
+ "The identifer of the branch for which accounting has been closed\n" + "comments\n"
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java
index 6d30a10c8..ac5356e96 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/financialactivityaccount/api/FinancialActivityAccountsApiResource.java
@@ -50,12 +50,10 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/financialactivityaccounts")
+@Path("/v1/financialactivityaccounts")
@Component
-@Scope("singleton")
@Tag(name = "Mapping Financial Activities to Accounts", description = "Organization Level Financial Activities like Asset and Liability Transfer can be mapped to GL Account. Integrated accounting takes these accounts into consideration when an Account transfer is made between a savings to loan/savings account and vice-versa\n"
+ "\n" + "Field Descriptions\n" + "financialActivityId\n" + "The identifier of the Financial Activity\n" + "glAccountId\n"
+ "The identifier of a GL Account ( Ledger Account) which shall be used as the default account for the selected Financial Activity")
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java
index f77fc40aa..a1a8ac1cf 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/glaccount/api/GLAccountsApiResource.java
@@ -70,12 +70,10 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/glaccounts")
+@Path("/v1/glaccounts")
@Component
-@Scope("singleton")
@Tag(name = "General Ledger Account", description = "Ledger accounts represent an Individual account within an Organizations Chart Of Accounts(COA) and are assigned a name and unique number by which they can be identified. \n"
+ "All transactions relating to a company's assets, liabilities, owners' equity, revenue and expenses are recorded against these accounts")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java
index d9741307e..0294ca920 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/journalentry/api/JournalEntriesApiResource.java
@@ -67,12 +67,10 @@ import org.apache.fineract.infrastructure.core.service.SearchParameters;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/journalentries")
+@Path("/v1/journalentries")
@Component
-@Scope("singleton")
@Tag(name = "Journal Entries", description = "A journal entry refers to the logging of transactions against general ledger accounts. A journal entry may consist of several line items, each of which is either a \"debit\" or a \"credit\". The total amount of the debits must equal the total amount of the credits or the journal entry is said to be \"unbalanced\" \n"
+ "\n" + "A journal entry directly changes the account balances on the general ledger")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java
index 82ad05a2b..a59d82dd1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/provisioning/api/ProvisioningEntriesApiResource.java
@@ -56,12 +56,10 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.infrastructure.core.service.SearchParameters;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/provisioningentries")
+@Path("/v1/provisioningentries")
@Component
-@Scope("singleton")
@Tag(name = "Provisioning Entries", description = "This defines the Provisioning Entries for all active loan products\n" + "\n"
+ "Field Descriptions\n" + "date\n" + "Date on which day provisioning entries should be created\n" + "createjournalentries\n"
+ "Boolean variable whether to add journal entries for generated provisioning entries\n")
diff --git a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java
index ce32b0f70..4d76f8bda 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/accounting/rule/api/AccountingRuleApiResource.java
@@ -67,12 +67,10 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.apache.fineract.organisation.office.data.OfficeData;
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
import org.apache.fineract.useradministration.domain.AppUser;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/accountingrules")
+@Path("/v1/accountingrules")
@Component
-@Scope("singleton")
@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"
diff --git a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocApiResource.java
index 273ac5f4e..19264a0bd 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/adhocquery/api/AdHocApiResource.java
@@ -46,12 +46,10 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/adhocquery")
+@Path("/v1/adhocquery")
@Component
-@Scope("singleton")
@Tag(name = "AdhocQuery Api", description = "")
@RequiredArgsConstructor
public class AdHocApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResource.java
index 663f70bd0..c054e0d51 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/api/BatchApiResource.java
@@ -49,7 +49,6 @@ import org.apache.fineract.infrastructure.core.config.FineractProperties;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.exception.InvalidInstanceTypeMethodException;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
@@ -65,9 +64,8 @@ import org.springframework.stereotype.Component;
* @see org.apache.fineract.batch.domain.BatchRequest
* @see org.apache.fineract.batch.domain.BatchResponse
*/
-@Path("/batches")
+@Path("/v1/batches")
@Component
-@Scope("singleton")
@Tag(name = "Batch API", description = "The Apache Fineract Batch API enables a consumer to access significant amounts of data in a single call or to make changes to several objects at once. Batching allows a consumer to pass instructions for several operations in a single HTTP request. A consumer can also specify dependencies between related operations. Once all operations have been completed, a consolidated response will be passed back and the HTTP connection will be closed.\n"
+ "\n"
+ "The Batch API takes in an array of logical HTTP requests represented as JSON arrays - each request has a requestId (the id of a request used to specify the sequence and as a dependency between requests), a method (corresponding to HTTP method GET/PUT/POST/DELETE etc.), a relativeUrl (the portion of the URL after https://example.org/api/v2/), optional headers array (corresponding to HTTP headers), optional reference parameter if a request is dependent on another request and an [...]
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandContext.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandContext.java
index 010943a57..ff405a9c4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandContext.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandContext.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command;
+import lombok.Getter;
+
/**
* Provides an object to {@link org.apache.fineract.batch.service.BatchApiService} to get the proper commandStrategy for
* each request in BatchRequest. It uses Builder pattern to create object of this type.
@@ -26,6 +28,7 @@ package org.apache.fineract.batch.command;
*
* @see org.apache.fineract.batch.service.BatchApiService
*/
+@Getter
public final class CommandContext {
/**
@@ -57,7 +60,6 @@ public final class CommandContext {
private final String method;
private CommandContext(final String resource, final String method) {
-
this.resource = resource;
this.method = method;
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandStrategyProvider.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandStrategyProvider.java
index 7b422f076..f73254561 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandStrategyProvider.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandStrategyProvider.java
@@ -21,6 +21,7 @@ package org.apache.fineract.batch.command;
import static javax.ws.rs.HttpMethod.GET;
import static javax.ws.rs.HttpMethod.POST;
import static javax.ws.rs.HttpMethod.PUT;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.isResourceVersioned;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -101,7 +102,17 @@ public class CommandStrategyProvider {
* @see org.apache.fineract.batch.command.internal.UnknownCommandStrategy
*/
public CommandStrategy getCommandStrategy(final CommandContext commandContext) {
+ if (isResourceVersioned(commandContext)) {
+ return internalGetCommandStrategy(commandContext);
+ } else {
+ // for backward compatibility, support non-versioned relative paths too
+ CommandContext alteredCommandContext = CommandContext.resource("v1/" + commandContext.getResource())
+ .method(commandContext.getMethod()).build();
+ return internalGetCommandStrategy(alteredCommandContext);
+ }
+ }
+ private CommandStrategy internalGetCommandStrategy(CommandContext commandContext) {
if (commandStrategies.containsKey(commandContext)) {
return (CommandStrategy) this.applicationContext.getBean(commandStrategies.get(commandContext));
}
@@ -111,7 +122,6 @@ public class CommandStrategyProvider {
return (CommandStrategy) applicationContext.getBean(commandStrategies.get(entry.getKey()));
}
}
-
return new UnknownCommandStrategy();
}
@@ -120,100 +130,98 @@ public class CommandStrategyProvider {
* command Strategy will have to be added within this function in order to initiate it within the constructor.
*/
private static void init() {
- commandStrategies.put(CommandContext.resource("clients").method(POST).build(), "createClientCommandStrategy");
- commandStrategies.put(CommandContext.resource("clients\\/" + NUMBER_REGEX).method(PUT).build(), "updateClientCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans").method(POST).build(), "applyLoanCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
+ commandStrategies.put(CommandContext.resource("v1\\/clients").method(POST).build(), "createClientCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/clients\\/" + NUMBER_REGEX).method(PUT).build(), "updateClientCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/loans").method(POST).build(), "applyLoanCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
"getLoanByIdCommandStrategy");
commandStrategies.put(
- CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
+ CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
"getLoanByExternalIdCommandStrategy");
- commandStrategies.put(CommandContext.resource("savingsaccounts\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
+ commandStrategies.put(
+ CommandContext.resource("v1\\/savingsaccounts\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
"getSavingsAccountByIdCommandStrategy");
- commandStrategies.put(CommandContext.resource("savingsaccounts").method(POST).build(), "applySavingsCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/savingsaccounts").method(POST).build(), "applySavingsCommandStrategy");
commandStrategies.put(CommandContext
- .resource("savingsaccounts\\/" + NUMBER_REGEX + "\\/transactions" + OPTIONAL_COMMAND_PARAM_REGEX).method(POST).build(),
+ .resource("v1\\/savingsaccounts\\/" + NUMBER_REGEX + "\\/transactions" + OPTIONAL_COMMAND_PARAM_REGEX).method(POST).build(),
"savingsAccountTransactionCommandStrategy");
commandStrategies.put(CommandContext
- .resource("savingsaccounts\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
+ .resource("v1\\/savingsaccounts\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
.method(POST).build(), "savingsAccountAdjustTransactionCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/charges").method(POST).build(),
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/charges").method(POST).build(),
"createChargeCommandStrategy");
- commandStrategies
- .put(CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges" + OPTIONAL_COMMAND_PARAM_REGEX + "")
- .method(POST).build(), "createChargeByLoanExternalIdCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/charges").method(GET).build(),
+ commandStrategies.put(
+ CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges" + OPTIONAL_COMMAND_PARAM_REGEX + "")
+ .method(POST).build(),
+ "createChargeByLoanExternalIdCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/charges").method(GET).build(),
"collectChargesCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges").method(GET).build(),
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges").method(GET).build(),
"collectChargesByLoanExternalIdCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/charges\\/" + NUMBER_REGEX).method(GET).build(),
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/charges\\/" + NUMBER_REGEX).method(GET).build(),
"getChargeByIdCommandStrategy");
- commandStrategies.put(CommandContext.resource(
- "loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges\\/external-id\\/" + UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX)
- .method(GET).build(), "getChargeByChargeExternalIdCommandStrategy");
- commandStrategies.put(CommandContext
- .resource("loans\\/" + NUMBER_REGEX + "\\/charges\\/" + NUMBER_REGEX + MANDATORY_COMMAND_PARAM_REGEX).method(POST).build(),
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges\\/external-id\\/"
+ + UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(), "getChargeByChargeExternalIdCommandStrategy");
+ commandStrategies.put(
+ CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/charges\\/" + NUMBER_REGEX + MANDATORY_COMMAND_PARAM_REGEX)
+ .method(POST).build(),
"adjustChargeCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges\\/external-id\\/"
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/charges\\/external-id\\/"
+ UUID_PARAM_REGEX + MANDATORY_COMMAND_PARAM_REGEX).method(POST).build(), "adjustChargeByChargeExternalIdCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/transactions" + MANDATORY_COMMAND_PARAM_REGEX)
+ .method(POST).build(), "createTransactionLoanCommandStrategy");
+ commandStrategies.put(CommandContext
+ .resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions" + MANDATORY_COMMAND_PARAM_REGEX).method(POST)
+ .build(), "createTransactionByLoanExternalIdCommandStrategy");
commandStrategies.put(
- CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/transactions" + MANDATORY_COMMAND_PARAM_REGEX).method(POST).build(),
- "createTransactionLoanCommandStrategy");
- commandStrategies.put(
- CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions" + MANDATORY_COMMAND_PARAM_REGEX)
+ CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
.method(POST).build(),
- "createTransactionByLoanExternalIdCommandStrategy");
- commandStrategies
- .put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
- .method(POST).build(), "adjustTransactionCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
- + UUID_PARAM_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(POST).build(), "adjustTransactionByExternalIdCommandStrategy");
- commandStrategies.put(CommandContext.resource("clients\\/" + NUMBER_REGEX + "\\?command=activate").method(POST).build(),
+ "adjustTransactionCommandStrategy");
+ commandStrategies.put(
+ CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
+ + UUID_PARAM_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(POST).build(),
+ "adjustTransactionByExternalIdCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/clients\\/" + NUMBER_REGEX + "\\?command=activate").method(POST).build(),
"activateClientCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\?command=approve").method(POST).build(),
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\?command=approve").method(POST).build(),
"approveLoanCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\?command=disburse").method(POST).build(),
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\?command=disburse").method(POST).build(),
"disburseLoanCommandStrategy");
- commandStrategies.put(
- CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + MANDATORY_COMMAND_PARAM_REGEX).method(POST).build(),
- "loanStateTransistionsByExternalIdCommandStrategy");
- commandStrategies.put(CommandContext.resource("rescheduleloans").method(POST).build(),
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + MANDATORY_COMMAND_PARAM_REGEX)
+ .method(POST).build(), "loanStateTransistionsByExternalIdCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/rescheduleloans").method(POST).build(),
"createLoanRescheduleRequestCommandStrategy");
- commandStrategies.put(CommandContext.resource("rescheduleloans\\/" + NUMBER_REGEX + "\\?command=approve").method(POST).build(),
+ commandStrategies.put(CommandContext.resource("v1\\/rescheduleloans\\/" + NUMBER_REGEX + "\\?command=approve").method(POST).build(),
"approveLoanRescheduleCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX).method(GET).build(),
+ commandStrategies.put(
+ CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + "\\/transactions\\/" + NUMBER_REGEX).method(GET).build(),
"getTransactionByIdCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + "\\/transactions\\/external-id\\/"
+ UUID_PARAM_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(), "getTransactionByExternalIdCommandStrategy");
- commandStrategies.put(
- CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX).method(POST).build(),
- "createDatatableEntryCommandStrategy");
- commandStrategies.put(
- CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/" + NUMBER_REGEX)
- .method(PUT).build(),
- "updateDatatableEntryOneToManyCommandStrategy");
- commandStrategies.put(
- CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX).method(PUT).build(),
- "updateDatatableEntryOneToOneCommandStrategy");
- commandStrategies.put(
- CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/" + NUMBER_REGEX)
- .method(PUT).build(),
- "updateDatatableEntryOneToManyCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX)
+ .method(POST).build(), "createDatatableEntryCommandStrategy");
commandStrategies.put(CommandContext
- .resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX)
+ .resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/" + NUMBER_REGEX)
+ .method(PUT).build(), "updateDatatableEntryOneToManyCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX)
+ .method(PUT).build(), "updateDatatableEntryOneToOneCommandStrategy");
+ commandStrategies.put(CommandContext
+ .resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/" + NUMBER_REGEX)
+ .method(PUT).build(), "updateDatatableEntryOneToManyCommandStrategy");
+ commandStrategies.put(CommandContext
+ .resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX)
.method(GET).build(), "getDatatableEntryByAppTableIdCommandStrategy");
- commandStrategies.put(CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/"
- + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
+ commandStrategies.put(
+ CommandContext.resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/" + NUMBER_REGEX + "\\/"
+ + NUMBER_REGEX + OPTIONAL_QUERY_PARAM_REGEX).method(GET).build(),
"getDatatableEntryByAppTableIdAndDataTableIdCommandStrategy");
- commandStrategies.put(CommandContext.resource("loans\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(PUT).build(),
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/" + NUMBER_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(PUT).build(),
"modifyLoanApplicationCommandStrategy");
- commandStrategies.put(
- CommandContext.resource("loans\\/external-id\\/" + UUID_PARAM_REGEX + OPTIONAL_COMMAND_PARAM_REGEX).method(PUT).build(),
- "modifyLoanApplicationByExternalIdCommandStrategy");
- commandStrategies.put(
- CommandContext.resource("datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/query" + MANDATORY_QUERY_PARAM_REGEX)
- .method(GET).build(),
- "getDatatableEntryByQueryCommandStrategy");
+ commandStrategies.put(CommandContext.resource("v1\\/loans\\/external-id\\/" + UUID_PARAM_REGEX + OPTIONAL_COMMAND_PARAM_REGEX)
+ .method(PUT).build(), "modifyLoanApplicationByExternalIdCommandStrategy");
+ commandStrategies.put(CommandContext
+ .resource("v1\\/datatables\\/" + ALPHANUMBERIC_WITH_UNDERSCORE_REGEX + "\\/query" + MANDATORY_QUERY_PARAM_REGEX).method(GET)
+ .build(), "getDatatableEntryByQueryCommandStrategy");
}
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandStrategyUtils.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandStrategyUtils.java
index 3510392d1..56f2db01c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandStrategyUtils.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/CommandStrategyUtils.java
@@ -20,11 +20,16 @@ package org.apache.fineract.batch.command;
import java.util.HashMap;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
+import org.apache.fineract.batch.domain.BatchRequest;
import org.apache.fineract.infrastructure.core.api.MutableUriInfo;
public final class CommandStrategyUtils {
+ private static final Pattern VERSIONED_RELATIVE_URL_PATTERN = Pattern.compile("^(v[1-9][0-9]*/)(.*)$");
+
private CommandStrategyUtils() {
}
@@ -61,4 +66,24 @@ public final class CommandStrategyUtils {
}
}
+ public static String relativeUrlWithoutVersion(BatchRequest request) {
+ String relativeUrl = request.getRelativeUrl();
+ Matcher m = VERSIONED_RELATIVE_URL_PATTERN.matcher(relativeUrl);
+ if (m.matches()) {
+ return m.group(2);
+ } else {
+ return relativeUrl;
+ }
+ }
+
+ public static boolean isResourceVersioned(CommandContext commandContext) {
+ String relativeUrl = commandContext.getResource();
+ return isRelativeUrlVersioned(relativeUrl);
+ }
+
+ public static boolean isRelativeUrlVersioned(String relativeUrl) {
+ Matcher m = VERSIONED_RELATIVE_URL_PATTERN.matcher(relativeUrl);
+ return m.matches();
+ }
+
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ActivateClientCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ActivateClientCommandStrategy.java
index b0b8eb88b..de9b2b92f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ActivateClientCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ActivateClientCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -57,7 +59,7 @@ public class ActivateClientCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long clientId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
// Calls 'activate' function from 'ClientsApiResource' to activate a
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustChargeByChargeExternalIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustChargeByChargeExternalIdCommandStrategy.java
index eb6e4961a..aaf8a2f76 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustChargeByChargeExternalIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustChargeByChargeExternalIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.regex.Matcher;
@@ -57,7 +59,7 @@ public class AdjustChargeByChargeExternalIdCommandStrategy implements CommandStr
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected pattern - loans\/external-id\/[\w\d_-]+\/charges\/external-id\/[\w\d_-]+(\?command=[\w]+)?
// Get the loan and charge ids for use in loanChargesApiResource
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustChargeCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustChargeCommandStrategy.java
index 1ee3f437e..a0c5e978f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustChargeCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustChargeCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.regex.Matcher;
@@ -57,7 +59,7 @@ public class AdjustChargeCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan and charge ids for use in loanChargesApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustTransactionByExternalIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustTransactionByExternalIdCommandStrategy.java
index d0d5f21c3..8fa1d75b6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustTransactionByExternalIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustTransactionByExternalIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -58,7 +60,7 @@ public class AdjustTransactionByExternalIdCommandStrategy implements CommandStra
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected URL pattern - loans\/external-id\/[\w\d_-]+\/transactions\/external-id\/[\w\d_-]+(\?command=[\w]+)?
// Get the loan and transaction ids for use in loanTransactionsApiResource
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustTransactionCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustTransactionCommandStrategy.java
index 572ff88bd..1934eb6d6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustTransactionCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/AdjustTransactionCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -57,7 +59,7 @@ public class AdjustTransactionCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan and transaction ids for use in loanTransactionsApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ApproveLoanCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ApproveLoanCommandStrategy.java
index ef98ff6c1..9406202f6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ApproveLoanCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ApproveLoanCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -57,7 +59,7 @@ public class ApproveLoanCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long loanId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
// Calls 'approve' function from 'LoansApiResource' to approve a
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ApproveLoanRescheduleCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ApproveLoanRescheduleCommandStrategy.java
index a901015fb..695f53757 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ApproveLoanRescheduleCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ApproveLoanRescheduleCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -43,7 +45,7 @@ public class ApproveLoanRescheduleCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long scheduleId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
// Calls 'approve' function from 'Loans reschedule Request' to
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CollectChargesByLoanExternalIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CollectChargesByLoanExternalIdCommandStrategy.java
index bd411a994..d2baf85c1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CollectChargesByLoanExternalIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CollectChargesByLoanExternalIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -58,7 +60,7 @@ public class CollectChargesByLoanExternalIdCommandStrategy implements CommandStr
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected pattern - loans\/external-id\/[\w\d_-]+\/charges
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CollectChargesCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CollectChargesCommandStrategy.java
index 72abb5018..330bcab69 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CollectChargesCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CollectChargesCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -58,7 +60,7 @@ public class CollectChargesCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
// Pluck out the loanId out of the relative path
final Long loanId = Long.parseLong(pathParameters.get(1));
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateChargeByLoanExternalIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateChargeByLoanExternalIdCommandStrategy.java
index b935cd0a4..088259b5e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateChargeByLoanExternalIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateChargeByLoanExternalIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -58,7 +60,7 @@ public class CreateChargeByLoanExternalIdCommandStrategy implements CommandStrat
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected pattern - loans\/external-id\/[\w\d_-]+\/charges
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateChargeCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateChargeCommandStrategy.java
index 470f284c9..018adc5c3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateChargeCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateChargeCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -57,7 +59,7 @@ public class CreateChargeCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long loanId = Long.parseLong(pathParameters.get(1));
// Calls 'executeLoanCharge' function from 'LoanChargesApiResource'
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateDatatableEntryCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateDatatableEntryCommandStrategy.java
index 5bd41b630..6ab4f4e55 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateDatatableEntryCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateDatatableEntryCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -53,7 +55,7 @@ public class CreateDatatableEntryCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
// Pluck out the datatable name & loanId out of the relative path
final String datatableName = pathParameters.get(1);
final Long loanId = Long.parseLong(pathParameters.get(2));
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateTransactionByLoanExternalIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateTransactionByLoanExternalIdCommandStrategy.java
index 550009817..eec6b152e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateTransactionByLoanExternalIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateTransactionByLoanExternalIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.regex.Matcher;
@@ -60,7 +62,7 @@ public class CreateTransactionByLoanExternalIdCommandStrategy implements Command
response.setHeaders(request.getHeaders());
// Expected Pattern - loans\/external-id\/[a-zA-Z0-9_-]*\/transactions\?command=[\w]+
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final String loanExternalId = pathParameters.get(2);
final Pattern commandPattern = Pattern.compile("^?command=[a-zA-Z]+");
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateTransactionLoanCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateTransactionLoanCommandStrategy.java
index 1cb4cac28..0e4fac923 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateTransactionLoanCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/CreateTransactionLoanCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.regex.Matcher;
@@ -59,7 +61,7 @@ public class CreateTransactionLoanCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long loanId = Long.parseLong(pathParameters.get(1));
final Pattern commandPattern = Pattern.compile("^?command=[a-zA-Z]+");
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/DisburseLoanCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/DisburseLoanCommandStrategy.java
index 88fa9d60a..f2151614e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/DisburseLoanCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/DisburseLoanCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -57,7 +59,7 @@ public class DisburseLoanCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
final Long loanId = Long.parseLong(pathParameters.get(1).substring(0, pathParameters.get(1).indexOf("?")));
// Calls 'disburse' function from 'LoansApiResource' to disburse a
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetChargeByChargeExternalIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetChargeByChargeExternalIdCommandStrategy.java
index 2ca8f6321..7079daaac 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetChargeByChargeExternalIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetChargeByChargeExternalIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -61,7 +63,7 @@ public class GetChargeByChargeExternalIdCommandStrategy implements CommandStrate
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected pattern - loans\/external-id\/[\w\d_-]+\/charges\/external-id\/[\w\d_-]+
// Get the loan and charge external ids for use in loanChargesApiResource
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetChargeByIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetChargeByIdCommandStrategy.java
index 0fd4d3036..aa922c5c9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetChargeByIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetChargeByIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -61,7 +63,7 @@ public class GetChargeByIdCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan and charge ids for use in loanChargesApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByAppTableIdAndDataTableIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByAppTableIdAndDataTableIdCommandStrategy.java
index c1d3e4cad..55580a834 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByAppTableIdAndDataTableIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByAppTableIdAndDataTableIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import java.util.Map;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
@@ -54,7 +56,7 @@ public class GetDatatableEntryByAppTableIdAndDataTableIdCommandStrategy implemen
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
final String relativeUrlSubString = StringUtils.substringAfter(relativeUrl, "/");
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByAppTableIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByAppTableIdCommandStrategy.java
index 58c8e5b5c..39c0435f4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByAppTableIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByAppTableIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import java.util.Map;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
@@ -54,7 +56,7 @@ public class GetDatatableEntryByAppTableIdCommandStrategy implements CommandStra
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
final String relativeUrlSubString = StringUtils.substringAfter(relativeUrl, "/");
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByQueryCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByQueryCommandStrategy.java
index 09b0bb219..c9e25ec11 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByQueryCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetDatatableEntryByQueryCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import java.util.Map;
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
@@ -54,7 +56,7 @@ public class GetDatatableEntryByQueryCommandStrategy implements CommandStrategy
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
final String relativeUrlSubString = StringUtils.substringAfter(relativeUrl, "/");
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetLoanByExternalIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetLoanByExternalIdCommandStrategy.java
index 9daac5f8c..1b6752089 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetLoanByExternalIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetLoanByExternalIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.HashMap;
import java.util.List;
@@ -59,7 +61,7 @@ public class GetLoanByExternalIdCommandStrategy implements CommandStrategy {
response.setHeaders(request.getHeaders());
// Expected pattern - loans\/external-id\/[\w\d_-]+\?associations=transactions
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
final String loanExternalIdPathParameter = pathParameters.get(2);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetLoanByIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetLoanByIdCommandStrategy.java
index 15cea55f0..72b863d6e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetLoanByIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetLoanByIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.UriInfo;
@@ -55,7 +57,7 @@ public class GetLoanByIdCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
Long loanId;
// uriInfo will contain the query parameter value(s) that are sent in the actual batch uri.
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetSavingsAccountByIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetSavingsAccountByIdCommandStrategy.java
index fb2c28b03..437f588cc 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetSavingsAccountByIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetSavingsAccountByIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.UriInfo;
@@ -46,7 +48,7 @@ public class GetSavingsAccountByIdCommandStrategy implements CommandStrategy {
response.setRequestId(batchRequest.getRequestId());
response.setHeaders(batchRequest.getHeaders());
- final String relativeUrl = batchRequest.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(batchRequest);
final Long savingsAccountId;
Map<String, String> queryParameters = new HashMap<>();
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetTransactionByExternalIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetTransactionByExternalIdCommandStrategy.java
index 12a5505fc..cbe135e50 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetTransactionByExternalIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetTransactionByExternalIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.HashMap;
import java.util.List;
@@ -63,7 +65,7 @@ public class GetTransactionByExternalIdCommandStrategy implements CommandStrateg
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Expected pattern - loans\/external-id\/[\w\d_-]+\/transactions\/external-id\/[\w\d_-]+
// Get the loan and transaction ids for use in loanTransactionsApiResource
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetTransactionByIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetTransactionByIdCommandStrategy.java
index ea06239c8..de3ec6940 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetTransactionByIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/GetTransactionByIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.HashMap;
import java.util.List;
@@ -62,7 +64,7 @@ public class GetTransactionByIdCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan and transaction ids for use in loanTransactionsApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/LoanStateTransistionsByExternalIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/LoanStateTransistionsByExternalIdCommandStrategy.java
index 8177ee965..9072a9fa6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/LoanStateTransistionsByExternalIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/LoanStateTransistionsByExternalIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.regex.Matcher;
@@ -60,7 +62,7 @@ public class LoanStateTransistionsByExternalIdCommandStrategy implements Command
response.setHeaders(request.getHeaders());
// Expected pattern - loans\/external-id\/[\w\d_-]+\?command=***
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
final String loanExternalIdPathParameter = pathParameters.get(2);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ModifyLoanApplicationByExternalIdCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ModifyLoanApplicationByExternalIdCommandStrategy.java
index 9efd78149..27981f694 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ModifyLoanApplicationByExternalIdCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ModifyLoanApplicationByExternalIdCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -68,7 +70,7 @@ public class ModifyLoanApplicationByExternalIdCommandStrategy implements Command
response.setHeaders(request.getHeaders());
// Expected pattern - loans\/external-id\/[\w\d_-]+\?command=adjust
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan id for use in loansApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ModifyLoanApplicationCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ModifyLoanApplicationCommandStrategy.java
index 922a8cf9e..189dfa145 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ModifyLoanApplicationCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/ModifyLoanApplicationCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -69,7 +71,7 @@ public class ModifyLoanApplicationCommandStrategy implements CommandStrategy {
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
// Get the loan id for use in loansApiResource
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/SavingsAccountAdjustTransactionCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/SavingsAccountAdjustTransactionCommandStrategy.java
index d97b8e32c..9c95a3c8f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/SavingsAccountAdjustTransactionCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/SavingsAccountAdjustTransactionCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -44,7 +46,7 @@ public class SavingsAccountAdjustTransactionCommandStrategy implements CommandSt
response.setRequestId(batchRequest.getRequestId());
response.setHeaders(batchRequest.getHeaders());
- String relativeUrl = batchRequest.getRelativeUrl();
+ String relativeUrl = relativeUrlWithoutVersion(batchRequest);
final List<String> pathParameters;
String command = null;
if (relativeUrl.indexOf('?') > 0) {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/SavingsAccountTransactionCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/SavingsAccountTransactionCommandStrategy.java
index ce200fbee..3d13799c2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/SavingsAccountTransactionCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/SavingsAccountTransactionCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import java.util.Map;
@@ -43,7 +45,7 @@ public class SavingsAccountTransactionCommandStrategy implements CommandStrategy
response.setRequestId(batchRequest.getRequestId());
response.setHeaders(batchRequest.getHeaders());
- String relativeUrl = batchRequest.getRelativeUrl();
+ String relativeUrl = relativeUrlWithoutVersion(batchRequest);
final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrl);
String command = null;
if (relativeUrl.indexOf('?') > 0) {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateClientCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateClientCommandStrategy.java
index 1e53d313f..db5e810cd 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateClientCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateClientCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import javax.ws.rs.core.UriInfo;
import lombok.RequiredArgsConstructor;
import org.apache.fineract.batch.command.CommandStrategy;
@@ -56,7 +58,7 @@ public class UpdateClientCommandStrategy implements CommandStrategy {
response.setHeaders(request.getHeaders());
// Get the clientID
- final String relativeUrl = request.getRelativeUrl();
+ final String relativeUrl = relativeUrlWithoutVersion(request);
final Long clientId = Long.parseLong(relativeUrl.substring(relativeUrl.indexOf('/') + 1));
// Calls 'update' function from 'ClientsApiResource' to update a
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateDatatableEntryOneToManyCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateDatatableEntryOneToManyCommandStrategy.java
index de903a371..1679565b4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateDatatableEntryOneToManyCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateDatatableEntryOneToManyCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -53,7 +55,7 @@ public class UpdateDatatableEntryOneToManyCommandStrategy implements CommandStra
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
// Pluck out the datatable name, entity id & datatable entry id out of the relative path
final String datatableName = pathParameters.get(1);
final Long entityId = Long.parseLong(pathParameters.get(2));
diff --git a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateDatatableEntryOneToOneCommandStrategy.java b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateDatatableEntryOneToOneCommandStrategy.java
index c41508602..9b29a7752 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateDatatableEntryOneToOneCommandStrategy.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/batch/command/internal/UpdateDatatableEntryOneToOneCommandStrategy.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.batch.command.internal;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.relativeUrlWithoutVersion;
+
import com.google.common.base.Splitter;
import java.util.List;
import javax.ws.rs.core.UriInfo;
@@ -52,7 +54,7 @@ public class UpdateDatatableEntryOneToOneCommandStrategy implements CommandStrat
response.setRequestId(request.getRequestId());
response.setHeaders(request.getHeaders());
- final List<String> pathParameters = Splitter.on('/').splitToList(request.getRelativeUrl());
+ final List<String> pathParameters = Splitter.on('/').splitToList(relativeUrlWithoutVersion(request));
// Pluck out the datatable name, entity id & datatable entry id out of the relative path
final String datatableName = pathParameters.get(1);
final Long entityId = Long.parseLong(pathParameters.get(2));
diff --git a/fineract-provider/src/main/java/org/apache/fineract/cob/api/ConfigureBusinessStepResource.java b/fineract-provider/src/main/java/org/apache/fineract/cob/api/ConfigureBusinessStepApiResource.java
similarity index 99%
rename from fineract-provider/src/main/java/org/apache/fineract/cob/api/ConfigureBusinessStepResource.java
rename to fineract-provider/src/main/java/org/apache/fineract/cob/api/ConfigureBusinessStepApiResource.java
index 7d1d6f40b..50ad1b83a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/cob/api/ConfigureBusinessStepResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/cob/api/ConfigureBusinessStepApiResource.java
@@ -53,11 +53,11 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.springframework.stereotype.Component;
-@Path("/jobs")
+@Path("/v1/jobs")
@Component
@Tag(name = "Business Step Configuration", description = "")
@RequiredArgsConstructor
-public class ConfigureBusinessStepResource {
+public class ConfigureBusinessStepApiResource {
private static final Set<String> BUSINESS_STEP_CONFIG_RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("jobName", "businessSteps"));
diff --git a/fineract-provider/src/main/java/org/apache/fineract/cob/api/InternalLoanAccountLockApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/cob/api/InternalLoanAccountLockApiResource.java
index ec29a0ff1..57d5fd4f8 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/cob/api/InternalLoanAccountLockApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/cob/api/InternalLoanAccountLockApiResource.java
@@ -42,7 +42,7 @@ import org.springframework.web.bind.annotation.RequestBody;
@Profile("test")
@Component
-@Path("/internal/loans")
+@Path("/v1/internal/loans")
@RequiredArgsConstructor
@Slf4j
public class InternalLoanAccountLockApiResource implements InitializingBean {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/cob/api/LoanAccountLockApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/cob/api/LoanAccountLockApiResource.java
index 69f0a352d..e6099b933 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/cob/api/LoanAccountLockApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/cob/api/LoanAccountLockApiResource.java
@@ -46,7 +46,7 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.springframework.stereotype.Component;
-@Path("/loans")
+@Path("/v1/loans")
@Component
@Tag(name = "Loan Account Lock", description = "")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/cob/api/LoanCOBCatchUpApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/cob/api/LoanCOBCatchUpApiResource.java
index b76a601c9..af742a3a5 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/cob/api/LoanCOBCatchUpApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/cob/api/LoanCOBCatchUpApiResource.java
@@ -38,7 +38,7 @@ import org.apache.fineract.cob.service.LoanCOBCatchUpService;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.springframework.stereotype.Component;
-@Path("/loans")
+@Path("/v1/loans")
@Component
@Tag(name = "Loan COB Catch Up", description = "")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java
index 5e1eff7c9..dffa9d733 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/commands/api/AuditsApiResource.java
@@ -50,12 +50,10 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.infrastructure.security.utils.SQLBuilder;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/audits")
+@Path("/v1/audits")
@Component
-@Scope("singleton")
@Tag(name = "Audits", description = "Every non-read Mifos API request is audited. A fully processed request can not be changed or deleted. See maker checker api for situations where an audit is not fully processed.\n"
+ "\n"
+ "Permissions: To search and look at audit entries a user needs to be attached to a role that has one of the ALL_FUNCTIONS, ALL_FUNCTIONS_READ or READ_AUDIT permissions.\n"
diff --git a/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResource.java
index 1f302846a..ca1984f44 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/commands/api/MakercheckersApiResource.java
@@ -53,12 +53,10 @@ import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamE
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.utils.SQLBuilder;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/makercheckers")
+@Path("/v1/makercheckers")
@Component
-@Scope("singleton")
@Tag(name = "Maker Checker (or 4-eye) functionality")
@RequiredArgsConstructor
public class MakercheckersApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResource.java
index ceda11fc2..b16528196 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/api/AccountNumberFormatsApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -54,14 +55,12 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Path(AccountNumberFormatConstants.resourceRelativeURL)
@Component
-@Scope("singleton")
@Tag(name = "Account number format", description = "Account number preferences are used to describe custom formats for account numbers associated with Customer, Loan and Savings accounts.")
+@RequiredArgsConstructor
public class AccountNumberFormatsApiResource {
private final PlatformSecurityContext context;
@@ -74,19 +73,6 @@ public class AccountNumberFormatsApiResource {
AccountNumberFormatConstants.prefixTypeParamName, AccountNumberFormatConstants.accountTypeOptionsParamName,
AccountNumberFormatConstants.prefixTypeOptionsParamName));
- @Autowired
- public AccountNumberFormatsApiResource(final PlatformSecurityContext context,
- final ToApiJsonSerializer<AccountNumberFormatData> toApiJsonSerializer,
- final AccountNumberFormatReadPlatformService accountNumberFormatReadPlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.accountNumberFormatReadPlatformService = accountNumberFormatReadPlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatConstants.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatConstants.java
index 5800e2361..2164c5b9b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/accountnumberformat/service/AccountNumberFormatConstants.java
@@ -34,7 +34,7 @@ public final class AccountNumberFormatConstants {
public static final String dateFormatParamName = "dateFormat";
// REST end point
- public static final String resourceRelativeURL = "/accountnumberformats";
+ public static final String resourceRelativeURL = "/v1/accountnumberformats";
// request parameters
public static final String idParamName = "id";
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/api/BulkImportApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/api/BulkImportApiResource.java
index a2a5cb7ac..616d11f5b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/api/BulkImportApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/api/BulkImportApiResource.java
@@ -30,6 +30,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.bulkimport.data.GlobalEntityType;
import org.apache.fineract.infrastructure.bulkimport.data.ImportData;
import org.apache.fineract.infrastructure.bulkimport.exceptions.ImportTypeNotFoundException;
@@ -39,14 +40,12 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.documentmanagement.data.DocumentData;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/imports")
+@Path("/v1/imports")
@Component
-@Scope("singleton")
@Tag(name = "Bulk Import", description = "")
+@RequiredArgsConstructor
public class BulkImportApiResource {
private static final String RESOURCE_NAME_FOR_PERMISSION = "IMPORT";
@@ -56,15 +55,6 @@ public class BulkImportApiResource {
private final DefaultToApiJsonSerializer<ImportData> toApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
- @Autowired
- public BulkImportApiResource(final PlatformSecurityContext context, final BulkImportWorkbookService bulkImportWorkbookService,
- final DefaultToApiJsonSerializer<ImportData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper) {
- this.context = context;
- this.bulkImportWorkbookService = bulkImportWorkbookService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/businessdate/api/BusinessDateApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/businessdate/api/BusinessDateApiResource.java
index 94f0678a6..da7d8175b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/businessdate/api/BusinessDateApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/businessdate/api/BusinessDateApiResource.java
@@ -51,7 +51,7 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.springframework.stereotype.Component;
@RequiredArgsConstructor
-@Path("businessdate")
+@Path("/v1/businessdate")
@Component
@Tag(name = "Business Date Management", description = "Business date management enables you to set up, fetch and adjust organisation business dates")
public class BusinessDateApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResource.java
index 815bc8eb0..573a4f300 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/cache/api/CacheApiResource.java
@@ -39,6 +39,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -49,19 +50,17 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/caches")
+@Path("/v1/caches")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
-@Scope("singleton")
@Tag(name = "Cache", description = "The following settings are possible for cache:\n" + "\n" + "No Caching: caching turned off\n"
+ "Single node: caching on for single instance deployments of platorm (works for multiple tenants but only one tomcat)\n"
+ "By default caching is set to No Caching. Switching between caches results in the cache been clear e.g. from Single node to No cache and back again would clear down the single node cache.")
+@RequiredArgsConstructor
public class CacheApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(List.of("id"));
@@ -71,20 +70,9 @@ public class CacheApiResource {
private final DefaultToApiJsonSerializer<CacheData> toApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+ @Qualifier("runtimeDelegatingCacheManager")
private final RuntimeDelegatingCacheManager cacheService;
- @Autowired
- public CacheApiResource(final PlatformSecurityContext context,
- @Qualifier("runtimeDelegatingCacheManager") final RuntimeDelegatingCacheManager cacheService,
- final DefaultToApiJsonSerializer<CacheData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.cacheService = cacheService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Operation(summary = "Retrieve Cache Types", description = "Returns the list of caches.\n" + "\n" + "Example Requests:\n" + "\n"
+ "caches")
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailApiResource.java
index a8eec5d09..162916fde 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailApiResource.java
@@ -46,14 +46,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.infrastructure.core.service.SearchParameters;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/email")
+@Path("/v1/email")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
-@Scope("singleton")
@RequiredArgsConstructor
public class EmailApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailCampaignApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailCampaignApiResource.java
index 4f72c0c28..d737f02a2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailCampaignApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailCampaignApiResource.java
@@ -50,18 +50,16 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Created with IntelliJ IDEA. User: andrew Date: 19-5-14 Time: 15:17 To change this template use File | Settings | File
* Templates.
*/
-@Path("/email/campaign")
+@Path("/v1/email/campaign")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
-@Scope("singleton")
@RequiredArgsConstructor
public class EmailCampaignApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailConfigurationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailConfigurationApiResource.java
index 3ff5e131a..9085a679a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailConfigurationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/email/api/EmailConfigurationApiResource.java
@@ -27,26 +27,24 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.campaigns.email.data.EmailConfigurationData;
import org.apache.fineract.infrastructure.campaigns.email.service.EmailConfigurationReadPlatformService;
-import org.apache.fineract.infrastructure.campaigns.email.service.EmailReadPlatformService;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/email/configuration")
+@Path("/v1/email/configuration")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
-@Scope("singleton")
+@RequiredArgsConstructor
public class EmailConfigurationApiResource {
private static final String RESOURCE_NAME_FOR_PERMISSIONS = "EMAIL_CONFIGURATION";
@@ -56,19 +54,6 @@ public class EmailConfigurationApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final EmailConfigurationReadPlatformService emailConfigurationReadPlatformService;
- @Autowired
- public EmailConfigurationApiResource(final PlatformSecurityContext context, final EmailReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<EmailConfigurationData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final EmailConfigurationReadPlatformService emailConfigurationReadPlatformService) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.emailConfigurationReadPlatformService = emailConfigurationReadPlatformService;
- }
-
@GET
public String retrieveAll(@Context final UriInfo uriInfo) {
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/api/SmsCampaignApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/api/SmsCampaignApiResource.java
index e318c323b..8b41602b7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/api/SmsCampaignApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/campaigns/sms/api/SmsCampaignApiResource.java
@@ -58,12 +58,10 @@ import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.infrastructure.core.service.Page;
import org.apache.fineract.infrastructure.core.service.SearchParameters;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/smscampaigns")
+@Path("/v1/smscampaigns")
@Component
-@Scope("singleton")
@RequiredArgsConstructor
public class SmsCampaignApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResource.java
index 5c5a72e2a..be5a8e399 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodeValuesApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -54,16 +55,14 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/codes/{codeId}/codevalues")
+@Path("/v1/codes/{codeId}/codevalues")
@Component
-@Scope("singleton")
@Tag(name = "Code Values", description = "Code and code values: Codes represent a specific category of data, their code values are a specific instance of that category.\n"
+ "\n"
+ "Codes are mostly system defined which means the code itself comes out of the box and cannot be modified however its code values can be. e.g. 'Customer Identifier', it defaults to a code value of 'Passport' but could be 'Drivers License, National Id' etc")
+@RequiredArgsConstructor
public class CodeValuesApiResource {
/**
@@ -81,17 +80,6 @@ public class CodeValuesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public CodeValuesApiResource(final PlatformSecurityContext context, final CodeValueReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<CodeValueData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResource.java
index cca281a36..a727b84d8 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/codes/api/CodesApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -52,16 +53,14 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/codes")
+@Path("/v1/codes")
@Component
-@Scope("singleton")
@Tag(name = "Codes", description = "Code and code values: Codes represent a specific category of data, their code values are a specific instance of that category.\n"
+ "\n"
+ "Codes are mostly system defined which means the code itself comes out of the box and cannot be modified however its code values can be. e.g. 'Customer Identifier', it defaults to a code value of 'Passport' but could be 'Drivers License, National Id' etc")
+@RequiredArgsConstructor
public class CodesApiResource {
/**
@@ -76,17 +75,6 @@ public class CodesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public CodesApiResource(final PlatformSecurityContext context, final CodeReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<CodeData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResource.java
index 0f171b02e..be66d2ab8 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/ExternalServicesConfigurationApiResource.java
@@ -36,6 +36,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -46,40 +47,22 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/externalservice")
+@Path("/v1/externalservice")
@Component
-@Scope("singleton")
@Tag(name = "External Services", description = "External Services Configuration related to set of supported configurations for third party services like Amazon S3 and SMTP:\n"
+ "\n" + "S3 (Amazon S3):\n" + "s3_access_key -\n" + "s3_bucket_name -\n" + "s3_secret_key -\n" + "\n" + "\n"
+ "SMTP (Email Service):\n" + "username -\n" + "password -\n" + "host -\n" + "port -\n" + "useTLS -")
+@RequiredArgsConstructor
public class ExternalServicesConfigurationApiResource {
private final PlatformSecurityContext context;
private final ExternalServicesPropertiesReadPlatformService externalServicePropertiesReadPlatformService;
private final ToApiJsonSerializer<ExternalServicesPropertiesData> toApiJsonSerializer;
- // private final ToApiJsonSerializer<S3CredentialsData>
- // s3ToApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public ExternalServicesConfigurationApiResource(final PlatformSecurityContext context,
- final ExternalServicesPropertiesReadPlatformService readPlatformService,
- final ToApiJsonSerializer<ExternalServicesPropertiesData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.externalServicePropertiesReadPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- // this.s3ToApiJsonSerializer = s3ToApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Path("{servicename}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResource.java
index 2bf63d455..23565916f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/api/GlobalConfigurationApiResource.java
@@ -40,6 +40,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -51,13 +52,10 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/configurations")
+@Path("/v1/configurations")
@Component
-@Scope("singleton")
@Tag(name = "Global Configuration", description = "Global configuration related to set of supported enable/disable configurations:\n" + "\n"
+ "maker-checker - defaults to false - if true turns on maker-checker functionality\n"
+ "reschedule-future-repayments - defaults to false - if true reschedules repayemnts which falls on a non-working day to configured repayment rescheduling rule\n"
@@ -67,6 +65,7 @@ import org.springframework.stereotype.Component;
+ "savings-interest-posting-current-period-end - Set it at the database level before any savings interest is posted. When set as false(default), interest will be posted on the first date of next period. If set as true, interest will be posted on last date of current period. There is no difference in the interest amount posted.\n"
+ "financial-year-beginning-month - Set it at the database level before any savings interest is posted. Allowed values 1 - 12 (January - December). Interest posting periods are evaluated based on this configuration.\n"
+ "meetings-mandatory-for-jlg-loans - if set to true, enforces all JLG loans to follow a meeting schedule belonging to either the parent group or Center.")
+@RequiredArgsConstructor
public class GlobalConfigurationApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("globalConfiguration"));
@@ -80,20 +79,6 @@ public class GlobalConfigurationApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public GlobalConfigurationApiResource(final PlatformSecurityContext context, final ConfigurationReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<GlobalConfigurationData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final DefaultToApiJsonSerializer<GlobalConfigurationPropertyData> propertyDataJsonSerializer) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.propertyDataJsonSerializer = propertyDataJsonSerializer;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JerseyConfig.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JerseyConfig.java
index b5d915cd7..bf4504788 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JerseyConfig.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JerseyConfig.java
@@ -25,18 +25,14 @@ import javax.ws.rs.Path;
import javax.ws.rs.ext.Provider;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.ServerProperties;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;
@Configuration
-@ApplicationPath("/api/v1")
+@ApplicationPath("/api")
public class JerseyConfig extends ResourceConfig {
- private static final Logger LOG = LoggerFactory.getLogger(JerseyConfig.class);
-
JerseyConfig() {
register(org.glassfish.jersey.media.multipart.MultiPartFeature.class);
property(ServerProperties.WADL_FEATURE_DISABLE, true);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/debug/EchoHeadersResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/debug/EchoHeadersApiResource.java
similarity index 94%
rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/debug/EchoHeadersResource.java
rename to fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/debug/EchoHeadersApiResource.java
index f2cd0dc7f..2390a4bcc 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/debug/EchoHeadersResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/debug/EchoHeadersApiResource.java
@@ -25,7 +25,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
@@ -39,9 +38,8 @@ import org.springframework.stereotype.Component;
* @author Michael Vorburger.ch
*/
@Component
-@Path("/echo")
-@Scope("singleton")
-public class EchoHeadersResource {
+@Path("/v1/echo")
+public class EchoHeadersApiResource {
@GET
@Consumes({ MediaType.WILDCARD })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationApiResource.java
similarity index 84%
rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java
rename to fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationApiResource.java
index 3b30bb55e..996c4ef54 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationAPI.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauConfigurationApiResource.java
@@ -34,6 +34,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -50,15 +51,13 @@ import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauReadC
import org.apache.fineract.infrastructure.creditbureau.service.CreditBureauReadPlatformService;
import org.apache.fineract.infrastructure.creditbureau.service.OrganisationCreditBureauReadPlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/CreditBureauConfiguration")
+@Path("/v1/CreditBureauConfiguration")
@Component
-@Scope("singleton")
@Tag(name = "Credit Bureau Configuration", description = "")
-public class CreditBureauConfigurationAPI {
+@RequiredArgsConstructor
+public class CreditBureauConfigurationApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("creditBureauId", "alias", "country", "creditBureauProductId", "startDate", "endDate", "isActive"));
@@ -75,32 +74,6 @@ public class CreditBureauConfigurationAPI {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final CreditBureauReadConfigurationService creditBureauConfiguration;
- @Autowired
- public CreditBureauConfigurationAPI(final PlatformSecurityContext context, final CreditBureauReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<CreditBureauData> toApiJsonSerializer,
- final CreditBureauLoanProductMappingReadPlatformService readPlatformServiceCreditBureauLoanProduct,
- final CreditBureauReadConfigurationService readPlatformServiceCreditBureauConfiguration,
- final DefaultToApiJsonSerializer<CreditBureauLoanProductMappingData> toApiJsonSerializerCreditBureauLoanProduct,
- final OrganisationCreditBureauReadPlatformService readPlatformServiceOrganisationCreditBureau,
- final DefaultToApiJsonSerializer<OrganisationCreditBureauData> toApiJsonSerializerOrganisationCreditBureau,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final DefaultToApiJsonSerializer<CreditBureauConfigurationData> toApiJsonSerializerReport,
- final CreditBureauReadConfigurationService creditBureauConfiguration) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.readPlatformServiceCreditBureauLoanProduct = readPlatformServiceCreditBureauLoanProduct;
- this.toApiJsonSerializerCreditBureauLoanProduct = toApiJsonSerializerCreditBureauLoanProduct;
- this.readPlatformServiceOrganisationCreditBureau = readPlatformServiceOrganisationCreditBureau;
- this.toApiJsonSerializerOrganisationCreditBureau = toApiJsonSerializerOrganisationCreditBureau;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.toApiJsonSerializerReport = toApiJsonSerializerReport;
- this.creditBureauConfiguration = creditBureauConfiguration;
-
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationAPI.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationApiResource.java
similarity index 98%
rename from fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationAPI.java
rename to fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationApiResource.java
index d63401612..5dd49deb0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationAPI.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/api/CreditBureauIntegrationApiResource.java
@@ -62,10 +62,10 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
-@Path("/creditBureauIntegration")
+@Path("/v1/creditBureauIntegration")
@Component
@RequiredArgsConstructor
-public class CreditBureauIntegrationAPI {
+public class CreditBureauIntegrationApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "creditBureauId", "nrc", "creditReport"));
@@ -76,7 +76,7 @@ public class CreditBureauIntegrationAPI {
private final CreditReportWritePlatformService creditReportWritePlatformService;
private final CreditReportReadPlatformService creditReportReadPlatformService;
private final DefaultToApiJsonSerializer<CreditReportData> toApiJsonSerializer;
- private static final Logger LOG = LoggerFactory.getLogger(CreditBureauIntegrationAPI.class);
+ private static final Logger LOG = LoggerFactory.getLogger(CreditBureauIntegrationApiResource.class);
@POST
@Path("creditReport")
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResource.java
index dc5bdb14c..cbbf46124 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResource.java
@@ -44,6 +44,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -56,16 +57,14 @@ import org.apache.fineract.infrastructure.dataqueries.data.GenericResultsetData;
import org.apache.fineract.infrastructure.dataqueries.service.GenericDataService;
import org.apache.fineract.infrastructure.dataqueries.service.ReadWriteNonCoreDataService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/datatables")
+@Path("/v1/datatables")
@Component
-@Scope("singleton")
@Tag(name = "Data Tables", description = "The datatables API allows you to plug-in your own tables (MySql) that have a relationship to a Apache Fineract core table. For example, you might want to add some extra client fields and record information about each of the clients' family members. Via the API you can create, read, update and delete entries for each 'plugged-in' table. The API checks for permission and for 'data scoping' (only data within the users' office hierarchy can be manage [...]
+ "\n"
+ "The Apache Fineract Reference App uses a JQuery plug-in called stretchydatatables (which in turn uses this datatables resource) to provide a pretty flexible CRUD (Create, Read, Update, Delete) User Interface.")
+@RequiredArgsConstructor
public class DatatablesApiResource {
private final PlatformSecurityContext context;
@@ -74,18 +73,6 @@ public class DatatablesApiResource {
private final ToApiJsonSerializer<GenericResultsetData> toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public DatatablesApiResource(final PlatformSecurityContext context, final GenericDataService genericDataService,
- final ReadWriteNonCoreDataService readWriteNonCoreDataService,
- final ToApiJsonSerializer<GenericResultsetData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.genericDataService = genericDataService;
- this.readWriteNonCoreDataService = readWriteNonCoreDataService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResource.java
index 85aa01359..0126aa750 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/EntityDatatableChecksApiResource.java
@@ -38,7 +38,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
-import lombok.AllArgsConstructor;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -51,13 +51,11 @@ import org.apache.fineract.infrastructure.dataqueries.data.EntityDataTableChecks
import org.apache.fineract.infrastructure.dataqueries.data.EntityDataTableChecksTemplateData;
import org.apache.fineract.infrastructure.dataqueries.data.GenericResultsetData;
import org.apache.fineract.infrastructure.dataqueries.service.EntityDatatableChecksReadService;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/entityDatatableChecks")
-@AllArgsConstructor
+@Path("/v1/entityDatatableChecks")
+@RequiredArgsConstructor
@Component
-@Scope("singleton")
@Tag(name = "Entity Data Table", description = "This defines Entity-Datatable Check.")
public class EntityDatatableChecksApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResource.java
index 0cd513644..dc7b1f4d8 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/ReportsApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -53,14 +54,12 @@ import org.apache.fineract.infrastructure.dataqueries.data.ReportData;
import org.apache.fineract.infrastructure.dataqueries.service.ReadReportingService;
import org.apache.fineract.infrastructure.report.provider.ReportingProcessServiceProvider;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/reports")
+@Path("/v1/reports")
@Component
-@Scope("singleton")
@Tag(name = "Reports", description = "Non-core reports can be added, updated and deleted.")
+@RequiredArgsConstructor
public class ReportsApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "reportName", "reportType",
@@ -74,19 +73,6 @@ public class ReportsApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final ReportingProcessServiceProvider reportingProcessServiceProvider;
- @Autowired
- public ReportsApiResource(final PlatformSecurityContext context, final ReadReportingService readReportingService,
- final ToApiJsonSerializer<ReportData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper, ReportingProcessServiceProvider reportingProcessServiceProvider) {
- this.context = context;
- this.readReportingService = readReportingService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.reportingProcessServiceProvider = reportingProcessServiceProvider;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java
index ab859a25c..69b6cb584 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/RunreportsApiResource.java
@@ -38,6 +38,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiParameterHelper;
import org.apache.fineract.infrastructure.core.exception.PlatformServiceUnavailableException;
import org.apache.fineract.infrastructure.dataqueries.data.ReportExportType;
@@ -48,14 +49,12 @@ import org.apache.fineract.infrastructure.security.exception.NoAuthorizationExce
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.useradministration.domain.AppUser;
import org.glassfish.jersey.internal.util.collection.MultivaluedStringMap;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/runreports")
+@Path("/v1/runreports")
@Component
-@Scope("singleton")
@Tag(name = "Run Reports", description = "")
+@RequiredArgsConstructor
public class RunreportsApiResource {
public static final String IS_SELF_SERVICE_USER_REPORT_PARAMETER = "isSelfServiceUserReport";
@@ -64,14 +63,6 @@ public class RunreportsApiResource {
private final ReadReportingService readExtraDataAndReportingService;
private final ReportingProcessServiceProvider reportingProcessServiceProvider;
- @Autowired
- public RunreportsApiResource(final PlatformSecurityContext context, final ReadReportingService readExtraDataAndReportingService,
- final ReportingProcessServiceProvider reportingProcessServiceProvider) {
- this.context = context;
- this.readExtraDataAndReportingService = readExtraDataAndReportingService;
- this.reportingProcessServiceProvider = reportingProcessServiceProvider;
- }
-
@GET
@Path("/availableExports/{reportName}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResource.java
index d1d941994..a0ae6deec 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/DocumentManagementApiResource.java
@@ -45,6 +45,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
@@ -58,17 +59,15 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Component
-@Scope("singleton")
-@Path("{entityType}/{entityId}/documents")
+@Path("/v1/{entityType}/{entityId}/documents")
@Tag(name = "Documents", description = "Multiple Documents (a combination of a name, description and a file) may be attached to different Entities like Clients, Groups, Staff, Loans, Savings and Client Identifiers in the system\n"
+ "\n" + "Note: The currently allowed Entities are\n" + "\n" + "Clients: URL Pattern as clients\n" + "Staff: URL Pattern as staff\n"
+ "Loans: URL Pattern as loans\n" + "Savings: URL Pattern as savings\n" + "Client Identifiers: URL Pattern as client_identifiers\n"
+ "Groups: URL Pattern as groups")
+@RequiredArgsConstructor
public class DocumentManagementApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
@@ -83,19 +82,6 @@ public class DocumentManagementApiResource {
private final ToApiJsonSerializer<DocumentData> toApiJsonSerializer;
private final FileUploadValidator fileUploadValidator;
- @Autowired
- public DocumentManagementApiResource(final PlatformSecurityContext context,
- final DocumentReadPlatformService documentReadPlatformService, final DocumentWritePlatformService documentWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper, final ToApiJsonSerializer<DocumentData> toApiJsonSerializer,
- final FileUploadValidator fileUploadValidator) {
- this.context = context;
- this.documentReadPlatformService = documentReadPlatformService;
- this.documentWritePlatformService = documentWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.fileUploadValidator = fileUploadValidator;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java
index bf010e84c..3606374f2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/api/ImagesApiResource.java
@@ -56,14 +56,12 @@ import org.apache.fineract.portfolio.client.data.ClientData;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Slf4j
@RequiredArgsConstructor
@Component
-@Scope("singleton")
-@Path("{entity}/{entityId}/images")
+@Path("/v1/{entity}/{entityId}/images")
public class ImagesApiResource {
private final PlatformSecurityContext context;
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/api/FineractEntityApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/api/FineractEntityApiResource.java
index 8f5569bc9..17f6ae5f9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/api/FineractEntityApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/entityaccess/api/FineractEntityApiResource.java
@@ -31,6 +31,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -42,16 +43,14 @@ import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityRelati
import org.apache.fineract.infrastructure.entityaccess.data.FineractEntityToEntityMappingData;
import org.apache.fineract.infrastructure.entityaccess.service.FineractEntityAccessReadService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/entitytoentitymapping")
+@Path("/v1/entitytoentitymapping")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
-@Scope("singleton")
@Tag(name = "Fineract Entity", description = "")
+@RequiredArgsConstructor
public class FineractEntityApiResource {
private final PlatformSecurityContext context;
@@ -61,20 +60,6 @@ public class FineractEntityApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public FineractEntityApiResource(final PlatformSecurityContext context, final FineractEntityAccessReadService readPlatformService,
- final DefaultToApiJsonSerializer<FineractEntityRelationData> toApiJsonSerializer,
- final DefaultToApiJsonSerializer<FineractEntityToEntityMappingData> toApiJsonSerializerOfficeToLoanProducts,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.toApiJsonSerializerOfficeToLoanProducts = toApiJsonSerializerOfficeToLoanProducts;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/api/ExternalEventConfigurationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/api/ExternalEventConfigurationApiResource.java
index 71c72c818..7fd405c15 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/api/ExternalEventConfigurationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/api/ExternalEventConfigurationApiResource.java
@@ -51,7 +51,7 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.springframework.stereotype.Component;
@RequiredArgsConstructor
-@Path("/externalevents/configuration")
+@Path("/v1/externalevents/configuration")
@Component
@Tag(name = "External event configuration", description = "External event configuration enables user to enable/disable event posting to downstream message channel")
public class ExternalEventConfigurationApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/api/DeviceRegistrationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/api/DeviceRegistrationApiResource.java
index a5811cba5..128df228f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/api/DeviceRegistrationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/gcm/api/DeviceRegistrationApiResource.java
@@ -34,20 +34,19 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistration;
import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistrationData;
import org.apache.fineract.infrastructure.gcm.service.DeviceRegistrationReadPlatformService;
import org.apache.fineract.infrastructure.gcm.service.DeviceRegistrationWritePlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/device/registration")
+@Path("/v1/self/device/registration")
@Component
-@Scope("singleton")
@Tag(name = "Device Registration", description = "")
+@RequiredArgsConstructor
public class DeviceRegistrationApiResource {
private final PlatformSecurityContext context;
@@ -55,17 +54,6 @@ public class DeviceRegistrationApiResource {
private final DefaultToApiJsonSerializer<DeviceRegistrationData> toApiJsonSerializer;
private final DeviceRegistrationReadPlatformService deviceRegistrationReadPlatformService;
- @Autowired
- public DeviceRegistrationApiResource(PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<DeviceRegistrationData> toApiJsonSerializer,
- final DeviceRegistrationReadPlatformService deviceRegistrationReadPlatformService,
- final DeviceRegistrationWritePlatformService deviceRegistrationWritePlatformService) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.deviceRegistrationReadPlatformService = deviceRegistrationReadPlatformService;
- this.deviceRegistrationWritePlatformService = deviceRegistrationWritePlatformService;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResource.java
index c064d729b..de73d64f7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/hooks/api/HookApiResource.java
@@ -55,7 +55,7 @@ import org.apache.fineract.infrastructure.hooks.service.HookReadPlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.stereotype.Component;
-@Path("/hooks")
+@Path("/v1/hooks")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/instancemode/api/InstanceModeApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/instancemode/api/InstanceModeApiResource.java
index 54a385845..dadeadb42 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/instancemode/api/InstanceModeApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/instancemode/api/InstanceModeApiResource.java
@@ -39,7 +39,7 @@ import org.springframework.stereotype.Component;
@Profile("test")
@Component
-@Path("/instance-mode")
+@Path("/v1/instance-mode")
@Tag(name = "Instance Mode", description = "Instance mode changing API")
@RequiredArgsConstructor
@Slf4j
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/instancemode/filter/FineractInstanceModeApiFilter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/instancemode/filter/FineractInstanceModeApiFilter.java
index dea80f259..7bd73cf24 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/instancemode/filter/FineractInstanceModeApiFilter.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/instancemode/filter/FineractInstanceModeApiFilter.java
@@ -41,17 +41,16 @@ import org.springframework.web.filter.OncePerRequestFilter;
@RequiredArgsConstructor
public class FineractInstanceModeApiFilter extends OncePerRequestFilter {
- private static final List<ExceptionListItem> EXCEPTION_LIST = List
- .of(item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/jobs")),
- item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/scheduler")),
- item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/loans/catch-up")),
- item(FineractProperties.FineractModeProperties::isBatchManagerEnabled,
- pi -> pi.startsWith("/loans/is-catch-up-running")),
- item(p -> true, pi -> pi.startsWith("/instance-mode")),
- // Batches with all GET requests need to be allowed in read-only instances, hence this check will be
- // moved
- // under the Api Resource.
- item(p -> true, pi -> pi.startsWith("/batches")));
+ private static final List<ExceptionListItem> EXCEPTION_LIST = List.of(
+ item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/v1/jobs")),
+ item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/v1/scheduler")),
+ item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/v1/loans/catch-up")),
+ item(FineractProperties.FineractModeProperties::isBatchManagerEnabled, pi -> pi.startsWith("/v1/loans/is-catch-up-running")),
+ item(p -> true, pi -> pi.startsWith("/v1/instance-mode")),
+ // Batches with all GET requests need to be allowed in read-only instances, hence this check will be
+ // moved
+ // under the Api Resource.
+ item(p -> true, pi -> pi.startsWith("/v1/batches")));
private final FineractProperties fineractProperties;
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/InlineJobApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/InlineJobApiResource.java
index 620b66df8..2af36529a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/InlineJobApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/InlineJobApiResource.java
@@ -41,7 +41,7 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.springframework.stereotype.Component;
-@Path("/jobs")
+@Path("/v1/jobs")
@Component
@Tag(name = "Inline Job", description = "")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResource.java
index 91fe1c011..7d552fb85 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerApiResource.java
@@ -47,9 +47,8 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-@Path("/scheduler")
+@Path("/v1/scheduler")
@Component
-
@Tag(name = "Scheduler", description = "")
public class SchedulerApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResource.java
index 37750755d..ff9eb004f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/api/SchedulerJobApiResource.java
@@ -63,7 +63,7 @@ import org.apache.fineract.infrastructure.security.exception.NoAuthorizationExce
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.stereotype.Component;
-@Path("/jobs")
+@Path("/v1/jobs")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java
index 41ef30570..9a410cb2e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilter.java
@@ -18,6 +18,8 @@
*/
package org.apache.fineract.infrastructure.jobs.filter;
+import static org.apache.fineract.batch.command.CommandStrategyUtils.isRelativeUrlVersioned;
+
import com.google.common.collect.Lists;
import io.github.resilience4j.core.functions.Either;
import java.io.IOException;
@@ -76,10 +78,10 @@ public class LoanCOBApiFilter extends OncePerRequestFilter implements BatchReque
private static final List<HttpMethod> HTTP_METHODS = List.of(HttpMethod.POST, HttpMethod.PUT, HttpMethod.DELETE);
- public static final Pattern IGNORE_LOAN_PATH_PATTERN = Pattern.compile("\\/loans\\/catch-up");
- public static final Pattern LOAN_PATH_PATTERN = Pattern.compile("\\/(?:reschedule)?loans\\/(?:external-id\\/)?([^\\/\\?]+).*");
+ public static final Pattern IGNORE_LOAN_PATH_PATTERN = Pattern.compile("/v[1-9][0-9]*/loans/catch-up");
+ public static final Pattern LOAN_PATH_PATTERN = Pattern.compile("/v[1-9][0-9]*/(?:reschedule)?loans/(?:external-id/)?([^/?]+).*");
- public static final Pattern LOAN_GLIMACCOUNT_PATH_PATTERN = Pattern.compile("\\/loans\\/glimAccount\\/(\\d+).*");
+ public static final Pattern LOAN_GLIMACCOUNT_PATH_PATTERN = Pattern.compile("/v[1-9][0-9]*/loans/glimAccount/(\\d+).*");
private static final Predicate<String> URL_FUNCTION = s -> LOAN_PATH_PATTERN.matcher(s).find()
|| LOAN_GLIMACCOUNT_PATH_PATTERN.matcher(s).find();
private static final String JOB_NAME = "INLINE_LOAN_COB";
@@ -223,7 +225,7 @@ public class LoanCOBApiFilter extends OncePerRequestFilter implements BatchReque
}
private boolean isRescheduleLoans(String pathInfo) {
- return LOAN_PATH_PATTERN.matcher(pathInfo).matches() && pathInfo.contains("/rescheduleloans/");
+ return LOAN_PATH_PATTERN.matcher(pathInfo).matches() && pathInfo.contains("/v1/rescheduleloans/");
}
private boolean isOnApiList(String pathInfo, String method) {
@@ -244,10 +246,16 @@ public class LoanCOBApiFilter extends OncePerRequestFilter implements BatchReque
tr.setPropagationBehavior(TransactionDefinition.PROPAGATION_NOT_SUPPORTED);
return tr.execute(status -> {
try {
- if (isOnApiList("/" + batchRequest.getRelativeUrl(), batchRequest.getMethod())) {
+ String method = batchRequest.getMethod();
+ String relativeUrl = "/" + batchRequest.getRelativeUrl();
+ if (!isRelativeUrlVersioned(batchRequest.getRelativeUrl())) {
+ // to support pre-versioned relative paths
+ relativeUrl = "/v1/" + batchRequest.getRelativeUrl();
+ }
+ if (isOnApiList(relativeUrl, method)) {
boolean bypassUser = isBypassUser();
if (!bypassUser) {
- List<Long> result = calculateRelevantLoanIds("/" + batchRequest.getRelativeUrl());
+ List<Long> result = calculateRelevantLoanIds(relativeUrl);
if (!result.isEmpty() && (isLoanSoftLocked(result) || isLoanBehind(result))) {
executeInlineCob(result);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResource.java
index 820ca2589..7904e3efd 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobApiResource.java
@@ -39,6 +39,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -52,14 +53,12 @@ import org.apache.fineract.infrastructure.reportmailingjob.ReportMailingJobConst
import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobData;
import org.apache.fineract.infrastructure.reportmailingjob.service.ReportMailingJobReadPlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RESOURCE_NAME)
+@Path("/v1/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RESOURCE_NAME)
@Component
-@Scope("singleton")
@Tag(name = "Report Mailing Jobs", description = "This resource allows you to create a scheduled job that runs a report and sents it by email to specified email addresses.\n\nThe scheduled job can be configured to run once or on a regular basis (once a day, twice a week, etc)")
+@RequiredArgsConstructor
public class ReportMailingJobApiResource {
private final PlatformSecurityContext platformSecurityContext;
@@ -68,19 +67,6 @@ public class ReportMailingJobApiResource {
private final DefaultToApiJsonSerializer<ReportMailingJobData> reportMailingToApiJsonSerializer;
private final ReportMailingJobReadPlatformService reportMailingJobReadPlatformService;
- @Autowired
- public ReportMailingJobApiResource(final PlatformSecurityContext platformSecurityContext,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final DefaultToApiJsonSerializer<ReportMailingJobData> reportMailingToApiJsonSerializer,
- final ReportMailingJobReadPlatformService reportMailingJobReadPlatformService) {
- this.platformSecurityContext = platformSecurityContext;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.reportMailingToApiJsonSerializer = reportMailingToApiJsonSerializer;
- this.reportMailingJobReadPlatformService = reportMailingJobReadPlatformService;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResource.java
index 122ad2345..27bb206b3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/reportmailingjob/api/ReportMailingJobRunHistoryApiResource.java
@@ -33,6 +33,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
@@ -42,13 +43,12 @@ import org.apache.fineract.infrastructure.reportmailingjob.ReportMailingJobConst
import org.apache.fineract.infrastructure.reportmailingjob.data.ReportMailingJobRunHistoryData;
import org.apache.fineract.infrastructure.reportmailingjob.service.ReportMailingJobRunHistoryReadPlatformService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-@Path("/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RUN_HISTORY_RESOURCE_NAME)
+@Path("/v1/" + ReportMailingJobConstants.REPORT_MAILING_JOB_RUN_HISTORY_RESOURCE_NAME)
@Component
-
@Tag(name = "List Report Mailing Job History", description = "")
+@RequiredArgsConstructor
public class ReportMailingJobRunHistoryApiResource {
private final PlatformSecurityContext platformSecurityContext;
@@ -56,17 +56,6 @@ public class ReportMailingJobRunHistoryApiResource {
private final DefaultToApiJsonSerializer<ReportMailingJobRunHistoryData> reportMailingToApiJsonSerializer;
private final ReportMailingJobRunHistoryReadPlatformService reportMailingJobRunHistoryReadPlatformService;
- @Autowired
- public ReportMailingJobRunHistoryApiResource(final PlatformSecurityContext platformSecurityContext,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final DefaultToApiJsonSerializer<ReportMailingJobRunHistoryData> reportMailingToApiJsonSerializer,
- final ReportMailingJobRunHistoryReadPlatformService reportMailingJobRunHistoryReadPlatformService) {
- this.platformSecurityContext = platformSecurityContext;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.reportMailingToApiJsonSerializer = reportMailingToApiJsonSerializer;
- this.reportMailingJobRunHistoryReadPlatformService = reportMailingJobRunHistoryReadPlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResource.java
index b2863f53b..741944f49 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/AuthenticationApiResource.java
@@ -39,6 +39,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.constants.TwoFactorConstants;
@@ -48,11 +49,9 @@ import org.apache.fineract.portfolio.client.service.ClientReadPlatformService;
import org.apache.fineract.useradministration.data.RoleData;
import org.apache.fineract.useradministration.domain.AppUser;
import org.apache.fineract.useradministration.domain.Role;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Scope;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.core.Authentication;
@@ -60,10 +59,10 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.stereotype.Component;
@Component
-@Scope("singleton")
@ConditionalOnProperty("fineract.security.basicauth.enabled")
-@Path("/authentication")
+@Path("/v1/authentication")
@Tag(name = "Authentication HTTP Basic", description = "An API capability that allows client applications to verify authentication details using HTTP Basic Authentication.")
+@RequiredArgsConstructor
public class AuthenticationApiResource {
@Value("${fineract.security.2fa.enabled}")
@@ -75,23 +74,12 @@ public class AuthenticationApiResource {
public String password;
}
+ @Qualifier("customAuthenticationProvider")
private final DaoAuthenticationProvider customAuthenticationProvider;
private final ToApiJsonSerializer<AuthenticatedUserData> apiJsonSerializerService;
private final SpringSecurityPlatformSecurityContext springSecurityPlatformSecurityContext;
private final ClientReadPlatformService clientReadPlatformService;
- @Autowired
- public AuthenticationApiResource(
- @Qualifier("customAuthenticationProvider") final DaoAuthenticationProvider customAuthenticationProvider,
- final ToApiJsonSerializer<AuthenticatedUserData> apiJsonSerializerService,
- final SpringSecurityPlatformSecurityContext springSecurityPlatformSecurityContext,
- ClientReadPlatformService aClientReadPlatformService) {
- this.customAuthenticationProvider = customAuthenticationProvider;
- this.apiJsonSerializerService = apiJsonSerializerService;
- this.springSecurityPlatformSecurityContext = springSecurityPlatformSecurityContext;
- clientReadPlatformService = aClientReadPlatformService;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/TwoFactorApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/TwoFactorApiResource.java
index 91617dd6e..8b5613f59 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/TwoFactorApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/TwoFactorApiResource.java
@@ -30,6 +30,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -44,16 +45,14 @@ import org.apache.fineract.infrastructure.security.domain.TFAccessToken;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.infrastructure.security.service.TwoFactorService;
import org.apache.fineract.useradministration.domain.AppUser;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/twofactor")
+@Path("/v1/twofactor")
@Component
@ConditionalOnProperty("fineract.security.2fa.enabled")
-@Scope("singleton")
@Tag(name = "Two Factor", description = "")
+@RequiredArgsConstructor
public class TwoFactorApiResource {
private final ToApiJsonSerializer<OTPMetadata> otpRequestSerializer;
@@ -65,20 +64,6 @@ public class TwoFactorApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final TwoFactorService twoFactorService;
- @Autowired
- public TwoFactorApiResource(ToApiJsonSerializer<OTPMetadata> otpRequestSerializer,
- ToApiJsonSerializer<OTPDeliveryMethod> otpDeliveryMethodSerializer, ToApiJsonSerializer<AccessTokenData> accessTokenSerializer,
- DefaultToApiJsonSerializer<Map<String, Object>> toApiJsonSerializer, PlatformSecurityContext context,
- PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, TwoFactorService twoFactorService) {
- this.otpRequestSerializer = otpRequestSerializer;
- this.otpDeliveryMethodSerializer = otpDeliveryMethodSerializer;
- this.accessTokenSerializer = accessTokenSerializer;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.context = context;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.twoFactorService = twoFactorService;
- }
-
@GET
@Produces({ MediaType.APPLICATION_JSON })
public String getOTPDeliveryMethods(@Context final UriInfo uriInfo) {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/TwoFactorConfigurationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/TwoFactorConfigurationApiResource.java
index b88015221..6febf0b05 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/TwoFactorConfigurationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/TwoFactorConfigurationApiResource.java
@@ -25,6 +25,7 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -32,17 +33,15 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.infrastructure.security.service.TwoFactorConfigurationService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/twofactor/configure")
+@Path("/v1/twofactor/configure")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
-@Scope("singleton")
@ConditionalOnProperty("fineract.security.2fa.enabled")
+@RequiredArgsConstructor
public class TwoFactorConfigurationApiResource {
private static final String RESOURCE_NAME_FOR_PERMISSIONS = "TWOFACTOR_CONFIG";
@@ -52,16 +51,6 @@ public class TwoFactorConfigurationApiResource {
private final DefaultToApiJsonSerializer<Map<String, Object>> toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public TwoFactorConfigurationApiResource(PlatformSecurityContext context, TwoFactorConfigurationService configurationService,
- DefaultToApiJsonSerializer<Map<String, Object>> toApiJsonSerializer,
- PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.configurationService = configurationService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
public String retrieveAll() {
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResource.java
index e78b5ea43..38e2bbb3e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/security/api/UserDetailsApiResource.java
@@ -31,6 +31,7 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.constants.TwoFactorConstants;
@@ -40,10 +41,8 @@ import org.apache.fineract.infrastructure.security.service.SpringSecurityPlatfor
import org.apache.fineract.useradministration.data.RoleData;
import org.apache.fineract.useradministration.domain.AppUser;
import org.apache.fineract.useradministration.domain.Role;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Scope;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
@@ -52,11 +51,11 @@ import org.springframework.stereotype.Component;
/*
* Implementation of Oauth2 authentication APIs, loaded only when "oauth" profile is enabled.
*/
-@Path("/userdetails")
+@Path("/v1/userdetails")
@Component
@ConditionalOnProperty("fineract.security.oauth.enabled")
-@Scope("singleton")
@Tag(name = "Fetch authenticated user details", description = "")
+@RequiredArgsConstructor
public class UserDetailsApiResource {
private final ToApiJsonSerializer<AuthenticatedOauthUserData> apiJsonSerializerService;
@@ -65,13 +64,6 @@ public class UserDetailsApiResource {
@Value("${fineract.security.2fa.enabled}")
private boolean twoFactorEnabled;
- @Autowired
- public UserDetailsApiResource(final ToApiJsonSerializer<AuthenticatedOauthUserData> apiJsonSerializerService,
- final SpringSecurityPlatformSecurityContext springSecurityPlatformSecurityContext) {
- this.apiJsonSerializerService = apiJsonSerializerService;
- this.springSecurityPlatformSecurityContext = springSecurityPlatformSecurityContext;
- }
-
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Fetch authenticated user details\n", description = "checks the Authentication and returns the set roles and permissions allowed.")
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/sms/api/SmsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/sms/api/SmsApiResource.java
index eabe973e6..3582e74ac 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/sms/api/SmsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/sms/api/SmsApiResource.java
@@ -49,7 +49,7 @@ import org.apache.fineract.infrastructure.sms.data.SmsData;
import org.apache.fineract.infrastructure.sms.service.SmsReadPlatformService;
import org.springframework.stereotype.Component;
-@Path("/sms")
+@Path("/v1/sms")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/LikelihoodApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/LikelihoodApiResource.java
index a4b13e8e5..7f71b62c6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/LikelihoodApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/LikelihoodApiResource.java
@@ -27,6 +27,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -35,17 +36,15 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.infrastructure.survey.data.LikelihoodData;
import org.apache.fineract.infrastructure.survey.service.ReadLikelihoodService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Created by Cieyou on 3/12/14.
*/
-@Path("/likelihood")
+@Path("/v1/likelihood")
@Component
-@Scope("singleton")
@Tag(name = "Likelihood", description = "")
+@RequiredArgsConstructor
public class LikelihoodApiResource {
private final DefaultToApiJsonSerializer<LikelihoodData> toApiJsonSerializer;
@@ -53,18 +52,6 @@ public class LikelihoodApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final ReadLikelihoodService readService;
- @Autowired
- LikelihoodApiResource(final PlatformSecurityContext context,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final DefaultToApiJsonSerializer<LikelihoodData> toApiJsonSerializer, final ReadLikelihoodService readService) {
-
- this.context = context;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.readService = readService;
-
- }
-
@GET
@Path("{ppiName}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/PovertyLineApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/PovertyLineApiResource.java
index 95deeb686..7ec71804f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/PovertyLineApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/PovertyLineApiResource.java
@@ -25,40 +25,25 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.infrastructure.survey.data.LikeliHoodPovertyLineData;
import org.apache.fineract.infrastructure.survey.data.PpiPovertyLineData;
import org.apache.fineract.infrastructure.survey.service.PovertyLineService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/povertyLine")
+@Path("/v1/povertyLine")
@Component
-@Scope("singleton")
@Tag(name = "Poverty Line", description = "")
+@RequiredArgsConstructor
public class PovertyLineApiResource {
private final DefaultToApiJsonSerializer<PpiPovertyLineData> toApiJsonSerializer;
private final DefaultToApiJsonSerializer<LikeliHoodPovertyLineData> likelihoodToApiJsonSerializer;
- // private final DefaultToApiJsonSerializer<PpiPovertyLineData>
- // toApiJsonSerializer;
private final PlatformSecurityContext context;
private final PovertyLineService readService;
- @Autowired
- PovertyLineApiResource(final PlatformSecurityContext context, final DefaultToApiJsonSerializer<PpiPovertyLineData> toApiJsonSerializer,
- final PovertyLineService readService,
- final DefaultToApiJsonSerializer<LikeliHoodPovertyLineData> likelihoodToApiJsonSerializer) {
-
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.readService = readService;
- this.likelihoodToApiJsonSerializer = likelihoodToApiJsonSerializer;
-
- }
-
@GET
@Path("{ppiName}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResource.java
index 19bc1aa31..d98423bf9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/survey/api/SurveyApiResource.java
@@ -37,6 +37,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -49,17 +50,15 @@ import org.apache.fineract.infrastructure.survey.data.ClientScoresOverview;
import org.apache.fineract.infrastructure.survey.data.SurveyData;
import org.apache.fineract.infrastructure.survey.data.SurveyDataTableData;
import org.apache.fineract.infrastructure.survey.service.ReadSurveyService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Created by Cieyou on 2/27/14.
*/
-@Path("/survey")
+@Path("/v1/survey")
@Component
-@Scope("singleton")
@Tag(name = "Survey", description = "")
+@RequiredArgsConstructor
public class SurveyApiResource {
private final DefaultToApiJsonSerializer<SurveyData> toApiJsonSerializer;
@@ -69,20 +68,6 @@ public class SurveyApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final GenericDataService genericDataService;
- @Autowired
- public SurveyApiResource(final DefaultToApiJsonSerializer<SurveyData> toApiJsonSerializer, final PlatformSecurityContext context,
- final ReadSurveyService readSurveyService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final DefaultToApiJsonSerializer<ClientScoresOverview> toApiJsonClientScoreOverviewSerializer,
- final GenericDataService genericDataService) {
-
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.context = context;
- this.readSurveyService = readSurveyService;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.toApiJsonClientScoreOverviewSerializer = toApiJsonClientScoreOverviewSerializer;
- this.genericDataService = genericDataService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/interoperation/api/InteropApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/interoperation/api/InteropApiResource.java
index 3703416bb..cf4588552 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/interoperation/api/InteropApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/interoperation/api/InteropApiResource.java
@@ -45,6 +45,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
@@ -70,34 +71,19 @@ import org.apache.fineract.interoperation.data.InteropTransferResponseData;
import org.apache.fineract.interoperation.domain.InteropIdentifierType;
import org.apache.fineract.interoperation.domain.InteropTransferActionType;
import org.apache.fineract.interoperation.service.InteropService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/interoperation") // api/v1/
+@Path("/v1/interoperation") // api/v1/
@Component
-@Scope("singleton")
@Tag(name = "Inter Operation", description = "")
+@RequiredArgsConstructor
public class InteropApiResource {
- private PlatformSecurityContext context;
- private ApiRequestParameterHelper apiRequestParameterHelper;
-
- private DefaultToApiJsonSerializer<CommandProcessingResult> jsonSerializer;
-
- private InteropService interopService;
- private PortfolioCommandSourceWritePlatformService commandsSourceService;
-
- @Autowired
- public InteropApiResource(PlatformSecurityContext context, ApiRequestParameterHelper apiRequestParameterHelper,
- DefaultToApiJsonSerializer<CommandProcessingResult> defaultToApiJsonSerializer, InteropService interopService,
- PortfolioCommandSourceWritePlatformService portfolioCommandSourceWritePlatformService) {
- this.context = context;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.jsonSerializer = defaultToApiJsonSerializer;
- this.interopService = interopService;
- this.commandsSourceService = portfolioCommandSourceWritePlatformService;
- }
+ private final PlatformSecurityContext context;
+ private final ApiRequestParameterHelper apiRequestParameterHelper;
+ private final DefaultToApiJsonSerializer<CommandProcessingResult> jsonSerializer;
+ private final InteropService interopService;
+ private final PortfolioCommandSourceWritePlatformService commandsSourceService;
@GET
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java
index 5e0477846..d5e7bbda7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java
@@ -25,29 +25,21 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.mix.data.XBRLData;
import org.apache.fineract.mix.service.XBRLBuilder;
import org.apache.fineract.mix.service.XBRLResultService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/mixreport")
+@Path("/v1/mixreport")
@Component
-@Scope("singleton")
-
@Tag(name = "Mix Report", description = "")
+@RequiredArgsConstructor
public class MixReportApiResource {
private final XBRLResultService xbrlResultService;
private final XBRLBuilder xbrlBuilder;
- @Autowired
- public MixReportApiResource(final XBRLResultService xbrlResultService, final XBRLBuilder xbrlBuilder) {
- this.xbrlResultService = xbrlResultService;
- this.xbrlBuilder = xbrlBuilder;
- }
-
@GET
@Produces({ MediaType.APPLICATION_XML })
public String retrieveXBRLReport(@QueryParam("startDate") final Date startDate, @QueryParam("endDate") final Date endDate,
diff --git a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java
index 2e90e8f48..5ff61d463 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java
@@ -30,21 +30,19 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.mix.data.MixTaxonomyData;
import org.apache.fineract.mix.service.MixTaxonomyReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/mixtaxonomy")
+@Path("/v1/mixtaxonomy")
@Component
-@Scope("singleton")
-
@Tag(name = "Mix Taxonomy", description = "")
+@RequiredArgsConstructor
public class MixTaxonomyApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
@@ -55,15 +53,6 @@ public class MixTaxonomyApiResource {
private final MixTaxonomyReadPlatformService readTaxonomyService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
- @Autowired
- public MixTaxonomyApiResource(final PlatformSecurityContext context, final ToApiJsonSerializer<MixTaxonomyData> toApiJsonSerializer,
- final MixTaxonomyReadPlatformService readTaxonomyService, final ApiRequestParameterHelper apiRequestParameterHelper) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.readTaxonomyService = readTaxonomyService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java
index b23583cc8..e20945d72 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java
@@ -30,6 +30,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -40,15 +41,12 @@ import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.mix.data.MixTaxonomyMappingData;
import org.apache.fineract.mix.service.MixTaxonomyMappingReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/mixmapping")
+@Path("/v1/mixmapping")
@Component
-@Scope("singleton")
-
@Tag(name = "Mix Mapping", description = "")
+@RequiredArgsConstructor
public class MixTaxonomyMappingApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("identifier", "config"));
@@ -59,20 +57,6 @@ public class MixTaxonomyMappingApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
- @Autowired
- public MixTaxonomyMappingApiResource(final PlatformSecurityContext context,
- final ToApiJsonSerializer<MixTaxonomyMappingData> toApiJsonSerializer,
- final MixTaxonomyMappingReadPlatformService readTaxonomyMappingService,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper) {
-
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.readTaxonomyMappingService = readTaxonomyMappingService;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/notification/api/NotificationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/notification/api/NotificationApiResource.java
index 88f8cf94f..1f30cd772 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/notification/api/NotificationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/notification/api/NotificationApiResource.java
@@ -45,7 +45,7 @@ import org.apache.fineract.notification.data.NotificationData;
import org.apache.fineract.notification.service.NotificationReadPlatformService;
import org.springframework.stereotype.Component;
-@Path("/notifications")
+@Path("/v1/notifications")
@Component
@Tag(name = "Notification", description = "")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java
index 41bbddf6b..1a1884ad7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/holiday/api/HolidaysApiResource.java
@@ -44,6 +44,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.accounting.journalentry.api.DateParam;
import org.apache.fineract.commands.domain.CommandWrapper;
@@ -57,18 +58,16 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.holiday.data.HolidayData;
import org.apache.fineract.organisation.holiday.service.HolidayReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/holidays")
+@Path("/v1/holidays")
@Component
-@Scope("singleton")
@Tag(name = "Holidays", description = "Some MFI's span large regions where different branch offices might observe different holidays. They need the ability to define holidays for specific branch offices and be able to set the repayment rule to follow during those holidays.\n"
+ "\n"
+ "The reschedule of repayments to repaymentsRescheduledTo date during defined holidays is turned on/off by enabling/disabling reschedule-repayments-on-holidays in Global configurations.\n"
+ "\n"
+ "Allow Repayment transactions on a defined holidays is turned on/off by enabling/disabling allow-transactions-on-holiday in Global configurations.")
+@RequiredArgsConstructor
public class HolidaysApiResource {
private final DefaultToApiJsonSerializer<HolidayData> toApiJsonSerializer;
@@ -78,17 +77,6 @@ public class HolidaysApiResource {
private final HolidayReadPlatformService holidayReadPlatformService;
- @Autowired
- public HolidaysApiResource(final DefaultToApiJsonSerializer<HolidayData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, final PlatformSecurityContext context,
- final ApiRequestParameterHelper apiRequestParameterHelper, final HolidayReadPlatformService holidayReadPlatformService) {
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.context = context;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.holidayReadPlatformService = holidayReadPlatformService;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResource.java
index a05b60f80..395e6c4e2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/monetary/api/CurrenciesApiResource.java
@@ -37,6 +37,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -47,15 +48,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.monetary.data.ApplicationCurrencyConfigurationData;
import org.apache.fineract.organisation.monetary.service.OrganisationCurrencyReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/currencies")
+@Path("/v1/currencies")
@Component
-@Scope("singleton")
-
@Tag(name = "Currency", description = "Application related configuration around viewing/updating the currencies permitted for use within the MFI.")
+@RequiredArgsConstructor
public class CurrenciesApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("selectedCurrencyOptions", "currencyOptions"));
@@ -68,18 +66,6 @@ public class CurrenciesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public CurrenciesApiResource(final PlatformSecurityContext context, final OrganisationCurrencyReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<ApplicationCurrencyConfigurationData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficeTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficeTransactionsApiResource.java
index a50e4eee3..1b3464d37 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficeTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficeTransactionsApiResource.java
@@ -32,6 +32,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -42,14 +43,11 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.office.data.OfficeTransactionData;
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/officetransactions")
+@Path("/v1/officetransactions")
@Component
-@Scope("singleton")
-
+@RequiredArgsConstructor
public class OfficeTransactionsApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
@@ -64,18 +62,6 @@ public class OfficeTransactionsApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public OfficeTransactionsApiResource(final PlatformSecurityContext context, final OfficeReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<OfficeTransactionData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResource.java
index b07348b54..9826eaedb 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/office/api/OfficesApiResource.java
@@ -65,7 +65,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.springframework.stereotype.Component;
-@Path("/offices")
+@Path("/v1/offices")
@Component
@Tag(name = "Offices", description = "Offices are used to model an MFIs structure. A hierarchical representation of offices is supported. There will always be at least one office (which represents the MFI or an MFIs head office). All subsequent offices added must have a parent office.")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCategoryApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCategoryApiResource.java
index 88b07ed1d..04432ad19 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCategoryApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCategoryApiResource.java
@@ -31,6 +31,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -41,15 +42,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.provisioning.data.ProvisioningCategoryData;
import org.apache.fineract.organisation.provisioning.service.ProvisioningCategoryReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/provisioningcategory")
+@Path("/v1/provisioningcategory")
@Component
-@Scope("singleton")
-
@Tag(name = "Provisioning Category", description = "")
+@RequiredArgsConstructor
public class ProvisioningCategoryApiResource {
private final PlatformSecurityContext platformSecurityContext;
@@ -58,19 +56,6 @@ public class ProvisioningCategoryApiResource {
private final DefaultToApiJsonSerializer<ProvisioningCategoryData> toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public ProvisioningCategoryApiResource(final PlatformSecurityContext platformSecurityContext,
- final ProvisioningCategoryReadPlatformService provisioningCategoryReadPlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final DefaultToApiJsonSerializer<ProvisioningCategoryData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.platformSecurityContext = platformSecurityContext;
- this.provisioningCategoryReadPlatformService = provisioningCategoryReadPlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java
index ea21f8a9b..268b32e09 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/api/ProvisioningCriteriaApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -53,15 +54,12 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.apache.fineract.organisation.provisioning.constants.ProvisioningCriteriaConstants;
import org.apache.fineract.organisation.provisioning.data.ProvisioningCriteriaData;
import org.apache.fineract.organisation.provisioning.service.ProvisioningCriteriaReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/provisioningcriteria")
+@Path("/v1/provisioningcriteria")
@Component
-@Scope("singleton")
-
@Tag(name = "Provisioning Criteria", description = "This defines the Provisioning Criteria")
+@RequiredArgsConstructor
public class ProvisioningCriteriaApiResource {
private final PlatformSecurityContext platformSecurityContext;
@@ -82,19 +80,6 @@ public class ProvisioningCriteriaApiResource {
Arrays.asList(ProvisioningCriteriaConstants.CRITERIA_ID_PARAM, ProvisioningCriteriaConstants.CRITERIA_NAME_PARAM,
ProvisioningCriteriaConstants.CREATED_BY_PARAM));
- @Autowired
- public ProvisioningCriteriaApiResource(final PlatformSecurityContext platformSecurityContext,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final ProvisioningCriteriaReadPlatformService provisioningCriteriaReadPlatformService,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final DefaultToApiJsonSerializer<ProvisioningCriteriaData> toApiJsonSerializer) {
- this.platformSecurityContext = platformSecurityContext;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.provisioningCriteriaReadPlatformService = provisioningCriteriaReadPlatformService;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResource.java
index 38a2e0d48..8fefb180e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/staff/api/StaffApiResource.java
@@ -66,7 +66,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.springframework.stereotype.Component;
-@Path("/staff")
+@Path("/v1/staff")
@Component
@Tag(name = "Staff", description = "Allows you to model staff members. At present the key role of significance is whether this staff member is a loan officer or not.")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/CashierApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/CashierApiResource.java
index d55b5e114..bec9a33e1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/CashierApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/CashierApiResource.java
@@ -28,31 +28,22 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.organisation.teller.data.CashierData;
import org.apache.fineract.organisation.teller.service.TellerManagementReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("cashiers")
+@Path("/v1/cashiers")
@Component
-@Scope("singleton")
-
@Tag(name = "Cashiers", description = "")
+@RequiredArgsConstructor
public class CashierApiResource {
private final DefaultToApiJsonSerializer<CashierData> jsonSerializer;
private final TellerManagementReadPlatformService readPlatformService;
- @Autowired
- public CashierApiResource(DefaultToApiJsonSerializer<CashierData> jsonSerializer,
- TellerManagementReadPlatformService readPlatformService) {
- this.jsonSerializer = jsonSerializer;
- this.readPlatformService = readPlatformService;
- }
-
@GET
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResource.java
index e480a196a..e09bdbead 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerApiResource.java
@@ -40,6 +40,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -57,15 +58,12 @@ import org.apache.fineract.organisation.teller.data.TellerJournalData;
import org.apache.fineract.organisation.teller.data.TellerTransactionData;
import org.apache.fineract.organisation.teller.service.TellerManagementReadPlatformService;
import org.apache.fineract.organisation.teller.util.DateRange;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("tellers")
+@Path("/v1/tellers")
@Component
-@Scope("singleton")
-
@Tag(name = "Teller Cash Management", description = "Teller cash management which will allow an organization to manage their cash transactions at branches or head office more effectively.")
+@RequiredArgsConstructor
public class TellerApiResource {
private final PlatformSecurityContext securityContext;
@@ -73,17 +71,6 @@ public class TellerApiResource {
private final TellerManagementReadPlatformService readPlatformService;
private final PortfolioCommandSourceWritePlatformService commandWritePlatformService;
- @Autowired
- public TellerApiResource(PlatformSecurityContext securityContext, DefaultToApiJsonSerializer<TellerData> jsonSerializer,
- TellerManagementReadPlatformService readPlatformService,
- PortfolioCommandSourceWritePlatformService commandWritePlatformService) {
-
- this.securityContext = securityContext;
- this.jsonSerializer = jsonSerializer;
- this.readPlatformService = readPlatformService;
- this.commandWritePlatformService = commandWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerJournalApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerJournalApiResource.java
index 25a6c72e7..2dff4824d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerJournalApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/teller/api/TellerJournalApiResource.java
@@ -26,36 +26,25 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.teller.data.TellerData;
import org.apache.fineract.organisation.teller.data.TellerJournalData;
import org.apache.fineract.organisation.teller.service.TellerManagementReadPlatformService;
import org.apache.fineract.organisation.teller.util.DateRange;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("cashiersjournal")
+@Path("/v1/cashiersjournal")
@Component
-@Scope("singleton")
-
@Tag(name = "Cashier Journals", description = "")
+@RequiredArgsConstructor
public class TellerJournalApiResource {
private final PlatformSecurityContext securityContext;
private final DefaultToApiJsonSerializer<TellerData> jsonSerializer;
private final TellerManagementReadPlatformService readPlatformService;
- @Autowired
- public TellerJournalApiResource(final PlatformSecurityContext securityContext,
- final DefaultToApiJsonSerializer<TellerData> jsonSerializer, final TellerManagementReadPlatformService readPlatformService) {
-
- this.securityContext = securityContext;
- this.jsonSerializer = jsonSerializer;
- this.readPlatformService = readPlatformService;
- }
-
@GET
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java
index 05335882d..3ac8e8498 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java
@@ -35,6 +35,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -45,18 +46,15 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.workingdays.data.WorkingDaysData;
import org.apache.fineract.organisation.workingdays.service.WorkingDaysReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/workingdays")
+@Path("/v1/workingdays")
@Component
-@Scope("singleton")
-
@Tag(name = "Working days", description = "The days of the week that are workdays.\n" + "\n"
+ "Rescheduling of repayments when it falls on a non-working is turned on /off by enable/disable reschedule-future-repayments parameter in Global configurations\n"
+ "\n"
+ "Allow transactions on non-working days is configurable by enabling/disbaling the allow-transactions-on-non_workingday parameter in Global configurations.")
+@RequiredArgsConstructor
public class WorkingDaysApiResource {
private final DefaultToApiJsonSerializer<WorkingDaysData> toApiJsonSerializer;
@@ -65,18 +63,6 @@ public class WorkingDaysApiResource {
private final PlatformSecurityContext context;
private final ApiRequestParameterHelper apiRequestParameterHelper;
- @Autowired
- public WorkingDaysApiResource(DefaultToApiJsonSerializer<WorkingDaysData> toApiJsonSerializer,
- WorkingDaysReadPlatformService workingDaysReadPlatformService,
- PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, PlatformSecurityContext context,
- ApiRequestParameterHelper apiRequestParameterHelper) {
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.workingDaysReadPlatformService = workingDaysReadPlatformService;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.context = context;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResource.java
index 70d89ce67..e55c40350 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/AccountTransfersApiResource.java
@@ -36,6 +36,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -48,14 +49,12 @@ import org.apache.fineract.infrastructure.core.service.SearchParameters;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.account.data.AccountTransferData;
import org.apache.fineract.portfolio.account.service.AccountTransfersReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/accounttransfers")
+@Path("/v1/accounttransfers")
@Component
-@Scope("singleton")
@Tag(name = "Account Transfers", description = "Ability to be able to transfer monetary funds from one account to another.\n\nNote: At present only savings account to savings account transfers are supported.")
+@RequiredArgsConstructor
public class AccountTransfersApiResource {
private final PlatformSecurityContext context;
@@ -64,19 +63,6 @@ public class AccountTransfersApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final AccountTransfersReadPlatformService accountTransfersReadPlatformService;
- @Autowired
- public AccountTransfersApiResource(final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<AccountTransferData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final AccountTransfersReadPlatformService accountTransfersReadPlatformService) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.accountTransfersReadPlatformService = accountTransfersReadPlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java
index 0cc8d19d0..c26468a2c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionApiResource.java
@@ -40,6 +40,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -58,15 +59,13 @@ import org.apache.fineract.portfolio.account.data.StandingInstructionDTO;
import org.apache.fineract.portfolio.account.data.StandingInstructionData;
import org.apache.fineract.portfolio.account.service.AccountTransfersReadPlatformService;
import org.apache.fineract.portfolio.account.service.StandingInstructionReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/standinginstructions")
+@Path("/v1/standinginstructions")
@Component
-@Scope("singleton")
@Tag(name = "Standing Instructions", description = "Standing instructions (or standing orders) refer to instructions a bank account holder (\"the payer\") gives to his or her bank to pay a set amount at regular intervals to another's (\"the payee's\") account.\n"
+ "\n" + "Note: At present only savings account to savings account and savings account to Loan account transfers are permitted.")
+@RequiredArgsConstructor
public class StandingInstructionApiResource {
private final PlatformSecurityContext context;
@@ -76,21 +75,6 @@ public class StandingInstructionApiResource {
private final StandingInstructionReadPlatformService standingInstructionReadPlatformService;
private final AccountTransfersReadPlatformService accountTransfersReadPlatformService;
- @Autowired
- public StandingInstructionApiResource(final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<StandingInstructionData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final StandingInstructionReadPlatformService standingInstructionReadPlatformService,
- final AccountTransfersReadPlatformService accountTransfersReadPlatformService) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.standingInstructionReadPlatformService = standingInstructionReadPlatformService;
- this.accountTransfersReadPlatformService = accountTransfersReadPlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResource.java
index 067135930..db32ff4cf 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/api/StandingInstructionHistoryApiResource.java
@@ -34,6 +34,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.accounting.journalentry.api.DateParam;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
@@ -44,14 +45,12 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.apache.fineract.portfolio.account.data.StandingInstructionDTO;
import org.apache.fineract.portfolio.account.data.StandingInstructionHistoryData;
import org.apache.fineract.portfolio.account.service.StandingInstructionHistoryReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/standinginstructionrunhistory")
+@Path("/v1/standinginstructionrunhistory")
@Component
-@Scope("singleton")
@Tag(name = "Standing Instructions History", description = "The list capability of history can support pagination and sorting.")
+@RequiredArgsConstructor
public class StandingInstructionHistoryApiResource {
private final PlatformSecurityContext context;
@@ -59,17 +58,6 @@ public class StandingInstructionHistoryApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final StandingInstructionHistoryReadPlatformService standingInstructionHistoryReadPlatformService;
- @Autowired
- public StandingInstructionHistoryApiResource(final PlatformSecurityContext context,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final StandingInstructionHistoryReadPlatformService standingInstructionHistoryReadPlatformService,
- final DefaultToApiJsonSerializer<StandingInstructionHistoryData> toApiJsonSerializer) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.standingInstructionHistoryReadPlatformService = standingInstructionHistoryReadPlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResource.java
index 43cb3da5e..0ff286c89 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/accounts/api/AccountsApiResource.java
@@ -39,6 +39,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -59,15 +60,13 @@ import org.apache.fineract.portfolio.products.exception.ResourceNotFoundExceptio
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/accounts/{type}")
+@Path("/v1/accounts/{type}")
@Component
-@Scope("singleton")
@Tag(name = "Share Account", description = "Share accounts are instances of a praticular share product created for an individual. An application process around the creation of accounts is also supported.")
+@RequiredArgsConstructor
public class AccountsApiResource {
private final ApplicationContext applicationContext;
@@ -78,21 +77,6 @@ public class AccountsApiResource {
private final BulkImportWorkbookService bulkImportWorkbookService;
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
- @Autowired
- public AccountsApiResource(final ApplicationContext applicationContext, final ApiRequestParameterHelper apiRequestParameterHelper,
- final DefaultToApiJsonSerializer<AccountData> toApiJsonSerializer, final PlatformSecurityContext platformSecurityContext,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final BulkImportWorkbookService bulkImportWorkbookService,
- final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) {
- this.applicationContext = applicationContext;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.platformSecurityContext = platformSecurityContext;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.bulkImportWorkbookService = bulkImportWorkbookService;
- this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResource.java
similarity index 84%
rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java
rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResource.java
index 9709abb2f..338ac0d8a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResources.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/address/api/EntityFieldConfigurationApiResource.java
@@ -38,23 +38,22 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.address.data.FieldConfigurationData;
import org.apache.fineract.portfolio.address.service.FieldConfigurationReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/fieldconfiguration/{entity}")
+@Path("/v1/fieldconfiguration/{entity}")
@Component
-@Scope("singleton")
@Tag(name = "Entity Field Configuration", description = "Entity Field configuration API is a generic and extensible \n"
+ "wherein various entities and subentities can be related.\n" + "Also it gives the user an ability to enable/disable fields,\n"
+ "add regular expression for validation")
-public class EntityFieldConfigurationApiResources {
+@RequiredArgsConstructor
+public class EntityFieldConfigurationApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("clientAddressId", "client_id", "address_id", "address_type_id", "isActive", "fieldConfigurationId", "entity",
@@ -65,17 +64,6 @@ public class EntityFieldConfigurationApiResources {
private final DefaultToApiJsonSerializer<FieldConfigurationData> toApiJsonSerializerfld;
private final ApiRequestParameterHelper apiRequestParameterHelper;
- @Autowired
- public EntityFieldConfigurationApiResources(final PlatformSecurityContext context,
- final FieldConfigurationReadPlatformService readPlatformServicefld,
- final DefaultToApiJsonSerializer<FieldConfigurationData> toApiJsonSerializerfld,
- final ApiRequestParameterHelper apiRequestParameterHelper) {
- this.context = context;
- this.readPlatformServicefld = readPlatformServicefld;
- this.toApiJsonSerializerfld = toApiJsonSerializerfld;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/api/CalendarsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/api/CalendarsApiResource.java
index f85c84ed4..e90432210 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/api/CalendarsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/calendar/api/CalendarsApiResource.java
@@ -39,6 +39,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -56,14 +57,12 @@ import org.apache.fineract.portfolio.calendar.exception.CalendarEntityTypeNotSup
import org.apache.fineract.portfolio.calendar.service.CalendarDropdownReadPlatformService;
import org.apache.fineract.portfolio.calendar.service.CalendarReadPlatformService;
import org.apache.fineract.portfolio.calendar.service.CalendarUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/{entityType}/{entityId}/calendars")
+@Path("/v1/{entityType}/{entityId}/calendars")
@Component
-@Scope("singleton")
@Tag(name = "Calendar", description = "")
+@RequiredArgsConstructor
public class CalendarsApiResource {
/**
@@ -84,19 +83,6 @@ public class CalendarsApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final CalendarDropdownReadPlatformService dropdownReadPlatformService;
- @Autowired
- public CalendarsApiResource(final PlatformSecurityContext context, final CalendarReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<CalendarData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final CalendarDropdownReadPlatformService dropdownReadPlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.dropdownReadPlatformService = dropdownReadPlatformService;
- }
-
@GET
@Path("{calendarId}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResource.java
index 94932bce8..db9c3816b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/charge/api/ChargesApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -52,16 +53,14 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.charge.data.ChargeData;
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/charges")
+@Path("/v1/charges")
@Component
-@Scope("singleton")
@Tag(name = "Charges", description = "Its typical for MFIs to add extra costs for their financial products. These are typically Fees or Penalties.\n"
+ "\n" + "A Charge on fineract platform is what we use to model both Fees and Penalties.\n" + "\n"
+ "At present we support defining charges for use with Client accounts and both loan and saving products.")
+@RequiredArgsConstructor
public class ChargesApiResource {
private static final Set<String> CHARGES_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "amount", "currency", "penalty",
@@ -78,17 +77,6 @@ public class ChargesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public ChargesApiResource(final PlatformSecurityContext context, final ChargeReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<ChargeData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResources.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResource.java
similarity index 91%
rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResources.java
rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResource.java
index 94346c98a..0b9704c86 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResources.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientAddressApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -52,15 +53,13 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.address.data.AddressData;
import org.apache.fineract.portfolio.address.service.AddressReadPlatformServiceImpl;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/client")
+@Path("/v1/client")
@Component
-@Scope("singleton")
@Tag(name = "Clients Address", description = "Address module is an optional module and can be configured into the system by using GlobalConfiguration setting: enable-address. In order to activate Address module, we need to enable the configuration, enable-address by setting its value to true.")
-public class ClientAddressApiResources {
+@RequiredArgsConstructor
+public class ClientAddressApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("addressId", "street", "addressLine1", "addressLine2", "addressLine3", "townVillage", "city", "countyDistrict",
@@ -74,17 +73,6 @@ public class ClientAddressApiResources {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public ClientAddressApiResources(final PlatformSecurityContext context, final AddressReadPlatformServiceImpl readPlatformService,
- final DefaultToApiJsonSerializer<AddressData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Path("addresses/template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResource.java
index 4a9e2e162..6199abeb3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientChargesApiResource.java
@@ -41,6 +41,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -60,15 +61,15 @@ import org.apache.fineract.portfolio.client.data.ClientChargeData;
import org.apache.fineract.portfolio.client.data.ClientTransactionData;
import org.apache.fineract.portfolio.client.service.ClientChargeReadPlatformService;
import org.apache.fineract.portfolio.client.service.ClientTransactionReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-@Path("/clients/{clientId}/charges")
+@Path("/v1/clients/{clientId}/charges")
@Component
@Tag(name = "Client Charges", description = "It is typical for MFI's to directly associate charges with an implicit Client account. These can be either fees or penalties\n"
+ "\n"
+ "Client Charges are client specific instances of Charges. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Client account) are described here")
+@RequiredArgsConstructor
public class ClientChargesApiResource {
private final PlatformSecurityContext context;
@@ -79,22 +80,6 @@ public class ClientChargesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public ClientChargesApiResource(final PlatformSecurityContext context, final ChargeReadPlatformService chargeReadPlatformService,
- final ClientChargeReadPlatformService clientChargeReadPlatformService,
- final DefaultToApiJsonSerializer<ClientChargeData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ClientTransactionReadPlatformService clientTransactionReadPlatformService) {
- this.context = context;
- this.chargeReadPlatformService = chargeReadPlatformService;
- this.clientChargeReadPlatformService = clientChargeReadPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.clientTransactionReadPlatformService = clientTransactionReadPlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientFamilyMembersApiResources.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientFamilyMembersApiResource.java
similarity index 88%
rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientFamilyMembersApiResources.java
rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientFamilyMembersApiResource.java
index 4e367608c..60d445ad3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientFamilyMembersApiResources.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientFamilyMembersApiResource.java
@@ -36,6 +36,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -46,15 +47,13 @@ import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.client.data.ClientFamilyMembersData;
import org.apache.fineract.portfolio.client.service.ClientFamilyMembersReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/clients/{clientId}/familymembers")
+@Path("/v1/clients/{clientId}/familymembers")
@Component
-@Scope("singleton")
@Tag(name = "Client Family Member", description = "")
-public class ClientFamilyMembersApiResources {
+@RequiredArgsConstructor
+public class ClientFamilyMembersApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "clientId", "firstName", "middleName",
"lastName", "qualification", "relationship", "maritalStatus", "gender", "dateOfBirth", "profession", "clientFamilyMemberId"));
@@ -65,20 +64,6 @@ public class ClientFamilyMembersApiResources {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public ClientFamilyMembersApiResources(final PlatformSecurityContext context,
- final ClientFamilyMembersReadPlatformService readPlatformService,
- final ToApiJsonSerializer<ClientFamilyMembersData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
-
- }
-
@GET
@Path("/{familyMemberId}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResource.java
index 70b793749..9091697fe 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientIdentifiersApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -57,15 +58,13 @@ import org.apache.fineract.portfolio.client.data.ClientIdentifierData;
import org.apache.fineract.portfolio.client.exception.DuplicateClientIdentifierException;
import org.apache.fineract.portfolio.client.service.ClientIdentifierReadPlatformService;
import org.apache.fineract.portfolio.client.service.ClientReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/clients/{clientId}/identifiers")
+@Path("/v1/clients/{clientId}/identifiers")
@Component
-@Scope("singleton")
@Tag(name = "Client Identifier", description = "Client Identifiers refer to documents that are used to uniquely identify a customer\n"
+ "Ex: Drivers License, Passport, Ration card etc ")
+@RequiredArgsConstructor
public class ClientIdentifiersApiResource {
private static final Set<String> CLIENT_IDENTIFIER_DATA_PARAMETERS = new HashSet<>(
@@ -81,22 +80,6 @@ public class ClientIdentifiersApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public ClientIdentifiersApiResource(final PlatformSecurityContext context, final ClientReadPlatformService readPlatformService,
- final CodeValueReadPlatformService codeValueReadPlatformService,
- final DefaultToApiJsonSerializer<ClientIdentifierData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ClientIdentifierReadPlatformService clientIdentifierReadPlatformService) {
- this.context = context;
- this.clientReadPlatformService = readPlatformService;
- this.codeValueReadPlatformService = codeValueReadPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.clientIdentifierReadPlatformService = clientIdentifierReadPlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResource.java
index 8bcc5030e..dd7d06226 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientTransactionsApiResource.java
@@ -52,7 +52,7 @@ import org.apache.fineract.portfolio.client.data.ClientTransactionData;
import org.apache.fineract.portfolio.client.service.ClientTransactionReadPlatformService;
import org.springframework.stereotype.Component;
-@Path("/clients/{clientId}/transactions")
+@Path("/v1/clients/{clientId}/transactions")
@Component
@Tag(name = "Client Transaction", description = "Client Transactions refer to transactions made directly against a Client's internal account. Currently, these transactions are only created as a result of charge payments/waivers. You are allowed to undo a transaction, however you cannot explicitly create one. ")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResource.java
index 0229590d8..54b3198aa 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/ClientsApiResource.java
@@ -75,7 +75,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
import org.springframework.stereotype.Component;
-@Path("/clients")
+@Path("/v1/clients")
@Component
@Tag(name = "Client", description = "Clients are people and businesses that have applied (or may apply) to an MFI for loans.\n" + "\n"
+ "Clients can be created in Pending or straight into Active state.")
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/InternalClientInformationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/InternalClientInformationApiResource.java
index 8063a0b8c..22e1a7849 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/InternalClientInformationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/client/api/InternalClientInformationApiResource.java
@@ -46,7 +46,7 @@ import org.springframework.stereotype.Component;
@Profile("test")
@Component
-@Path("/internal/client")
+@Path("/v1/internal/client")
@RequiredArgsConstructor
@Slf4j
public class InternalClientInformationApiResource implements InitializingBean {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResource.java
index 1f357d193..885d1b357 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateral/api/CollateralsApiResource.java
@@ -43,6 +43,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -55,14 +56,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.collateral.data.CollateralData;
import org.apache.fineract.portfolio.collateral.service.CollateralReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/loans/{loanId}/collaterals")
+@Path("/v1/loans/{loanId}/collaterals")
@Component
-@Scope("singleton")
@Tag(name = "Loan Collateral", description = "In lending agreements, collateral is a borrower's pledge of specific property to a lender, to secure repayment of a loan. The collateral serves as protection for a lender against a borrower's default - that is, any borrower failing to pay the principal and interest under the terms of a loan obligation. If a borrower does default on a loan (due to insolvency or other event), that borrower forfeits (gives up) the property pledged as collateral [...]
+@RequiredArgsConstructor
public class CollateralsApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
@@ -77,19 +76,6 @@ public class CollateralsApiResource {
private final PlatformSecurityContext context;
private final CodeValueReadPlatformService codeValueReadPlatformService;
- @Autowired
- public CollateralsApiResource(final PlatformSecurityContext context, final CollateralReadPlatformService collateralReadPlatformService,
- final DefaultToApiJsonSerializer<CollateralData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final CodeValueReadPlatformService codeValueReadPlatformService) {
- this.context = context;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiJsonSerializerService = toApiJsonSerializer;
- this.collateralReadPlatformService = collateralReadPlatformService;
- this.codeValueReadPlatformService = codeValueReadPlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/ClientCollateralManagementApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/ClientCollateralManagementApiResource.java
index 27945519b..890a86f7f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/ClientCollateralManagementApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/ClientCollateralManagementApiResource.java
@@ -43,6 +43,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -55,13 +56,12 @@ import org.apache.fineract.portfolio.collateralmanagement.data.ClientCollateralM
import org.apache.fineract.portfolio.collateralmanagement.data.LoanCollateralTemplateData;
import org.apache.fineract.portfolio.collateralmanagement.domain.ClientCollateralManagement;
import org.apache.fineract.portfolio.collateralmanagement.service.ClientCollateralManagementReadPlatformService;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/clients/{clientId}/collaterals")
+@Path("/v1/clients/{clientId}/collaterals")
@Component
-@Scope("singleton")
@Tag(name = "Client Collateral Management", description = "Client Collateral Management is for managing collateral operations")
+@RequiredArgsConstructor
public class ClientCollateralManagementApiResource {
private final DefaultToApiJsonSerializer<ClientCollateralManagement> apiJsonSerializerService;
@@ -75,23 +75,6 @@ public class ClientCollateralManagementApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
Arrays.asList("name", "quantity", "total", "totalCollateral", "clientId", "loanTransactionData"));
- public ClientCollateralManagementApiResource(final DefaultToApiJsonSerializer<ClientCollateralManagement> apiJsonSerializerService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, final PlatformSecurityContext context,
- final CodeValueReadPlatformService codeValueReadPlatformService,
- final ClientCollateralManagementReadPlatformService clientCollateralManagementReadPlatformService,
- final DefaultToApiJsonSerializer<ClientCollateralManagementData> apiJsonSerializerDataService,
- final DefaultToApiJsonSerializer<LoanCollateralTemplateData> apiJsonSerializerForLoanCollateralTemplateService) {
- this.apiJsonSerializerService = apiJsonSerializerService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.context = context;
- this.codeValueReadPlatformService = codeValueReadPlatformService;
- this.clientCollateralManagementReadPlatformService = clientCollateralManagementReadPlatformService;
- this.apiJsonSerializerDataService = apiJsonSerializerDataService;
- this.apiJsonSerializerForLoanCollateralTemplateService = apiJsonSerializerForLoanCollateralTemplateService;
- }
-
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/CollateralManagementApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/CollateralManagementApiResource.java
index 825409937..610944a5c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/CollateralManagementApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/CollateralManagementApiResource.java
@@ -39,6 +39,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -49,14 +50,12 @@ import org.apache.fineract.organisation.monetary.data.CurrencyData;
import org.apache.fineract.organisation.monetary.service.CurrencyReadPlatformService;
import org.apache.fineract.portfolio.collateralmanagement.data.CollateralManagementData;
import org.apache.fineract.portfolio.collateralmanagement.service.CollateralManagementReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/collateral-management")
+@Path("/v1/collateral-management")
@Component
-@Scope("singleton")
@Tag(name = "Collateral Management", description = "Collateral Management is for managing collateral operations")
+@RequiredArgsConstructor
public class CollateralManagementApiResource {
private final DefaultToApiJsonSerializer<CollateralManagementData> apiJsonSerializerService;
@@ -66,20 +65,6 @@ public class CollateralManagementApiResource {
private final CollateralManagementReadPlatformService collateralManagementReadPlatformService;
private final CurrencyReadPlatformService currencyReadPlatformService;
- @Autowired
- public CollateralManagementApiResource(final DefaultToApiJsonSerializer<CollateralManagementData> apiJsonSerializerService,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, final PlatformSecurityContext context,
- final CollateralManagementReadPlatformService collateralManagementReadPlatformService,
- final CurrencyReadPlatformService currencyReadPlatformService,
- final DefaultToApiJsonSerializer<CurrencyData> apiJsonSerializerServiceForCurrency) {
- this.apiJsonSerializerService = apiJsonSerializerService;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.context = context;
- this.collateralManagementReadPlatformService = collateralManagementReadPlatformService;
- this.currencyReadPlatformService = currencyReadPlatformService;
- this.apiJsonSerializerServiceForCurrency = apiJsonSerializerServiceForCurrency;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/LoanCollateralManagementApiResources.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/LoanCollateralManagementApiResource.java
similarity index 78%
rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/LoanCollateralManagementApiResources.java
rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/LoanCollateralManagementApiResource.java
index c3f16af77..162afaf5f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/LoanCollateralManagementApiResources.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collateralmanagement/api/LoanCollateralManagementApiResource.java
@@ -28,6 +28,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -38,14 +39,13 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.collateralmanagement.data.LoanCollateralResponseData;
import org.apache.fineract.portfolio.collateralmanagement.service.LoanCollateralManagementReadPlatformService;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/loan-collateral-management")
+@Path("/v1/loan-collateral-management")
@Component
-@Scope("singleton")
@Tag(name = "Loan Collateral Management", description = "Loan Collateral Management is for managing collateral operations")
-public class LoanCollateralManagementApiResources {
+@RequiredArgsConstructor
+public class LoanCollateralManagementApiResource {
private final DefaultToApiJsonSerializer<LoanCollateralResponseData> apiJsonSerializerService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
@@ -54,19 +54,6 @@ public class LoanCollateralManagementApiResources {
private final LoanCollateralManagementReadPlatformService loanCollateralManagementReadPlatformService;
private final CodeValueReadPlatformService codeValueReadPlatformService;
- public LoanCollateralManagementApiResources(final DefaultToApiJsonSerializer<LoanCollateralResponseData> apiJsonSerializerService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, final PlatformSecurityContext context,
- final CodeValueReadPlatformService codeValueReadPlatformService,
- final LoanCollateralManagementReadPlatformService loanCollateralManagementReadPlatformService) {
- this.apiJsonSerializerService = apiJsonSerializerService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.context = context;
- this.codeValueReadPlatformService = codeValueReadPlatformService;
- this.loanCollateralManagementReadPlatformService = loanCollateralManagementReadPlatformService;
- }
-
@DELETE
@Path("{id}")
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourse.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResource.java
similarity index 85%
rename from fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourse.java
rename to fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResource.java
index 01fec0d36..5ca80069c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResourse.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/api/CollectionSheetApiResource.java
@@ -35,6 +35,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -49,15 +50,13 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants;
import org.apache.fineract.portfolio.collectionsheet.data.IndividualCollectionSheetData;
import org.apache.fineract.portfolio.collectionsheet.service.CollectionSheetReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/collectionsheet")
+@Path("/v1/collectionsheet")
@Component
-@Scope("singleton")
@Tag(name = "Collection Sheet", description = "")
-public class CollectionSheetApiResourse {
+@RequiredArgsConstructor
+public class CollectionSheetApiResource {
private final CollectionSheetReadPlatformService collectionSheetReadPlatformService;
private final ToApiJsonSerializer<Object> toApiJsonSerializer;
@@ -66,19 +65,6 @@ public class CollectionSheetApiResourse {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final PlatformSecurityContext context;
- @Autowired
- public CollectionSheetApiResourse(final CollectionSheetReadPlatformService collectionSheetReadPlatformService,
- final ToApiJsonSerializer<Object> toApiJsonSerializer, final FromJsonHelper fromJsonHelper,
- final ApiRequestParameterHelper apiRequestPrameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, final PlatformSecurityContext context) {
- this.collectionSheetReadPlatformService = collectionSheetReadPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.fromJsonHelper = fromJsonHelper;
- this.apiRequestPrameterHelper = apiRequestPrameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.context = context;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/delinquency/api/DelinquencyApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/delinquency/api/DelinquencyApiResource.java
index 937361e8c..413f368bc 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/delinquency/api/DelinquencyApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/delinquency/api/DelinquencyApiResource.java
@@ -54,7 +54,7 @@ import org.apache.fineract.portfolio.delinquency.service.DelinquencyReadPlatform
import org.springframework.stereotype.Component;
@RequiredArgsConstructor
-@Path("delinquency")
+@Path("/v1/delinquency")
@Component
@Tag(name = "Delinquency Range and Buckets Management", description = "Delinquency Range and Buckets management enables you to set up, fetch and adjust Delinquency overdue ranges")
public class DelinquencyApiResource {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResource.java
index 0c0af43ca..b6fe34197 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/floatingrates/api/FloatingRatesApiResource.java
@@ -41,6 +41,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -51,14 +52,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.floatingrates.data.FloatingRateData;
import org.apache.fineract.portfolio.floatingrates.service.FloatingRatesReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/floatingrates")
+@Path("/v1/floatingrates")
@Component
-@Scope("singleton")
@Tag(name = "Floating Rates", description = "It lets you create, list, retrieve and upload the floating rates")
+@RequiredArgsConstructor
public class FloatingRatesApiResource {
private static final String RESOURCE_NAME = "FLOATINGRATE";
@@ -72,19 +71,6 @@ public class FloatingRatesApiResource {
private final FloatingRatesReadPlatformService floatingRatesReadPlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
- @Autowired
- public FloatingRatesApiResource(final PlatformSecurityContext context,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final DefaultToApiJsonSerializer<FloatingRateData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final FloatingRatesReadPlatformService floatingRatesReadPlatformService) {
- this.context = context;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.floatingRatesReadPlatformService = floatingRatesReadPlatformService;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResource.java
index dff3b9b19..b4db0cf02 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/fund/api/FundsApiResource.java
@@ -55,7 +55,7 @@ import org.apache.fineract.portfolio.fund.data.FundData;
import org.apache.fineract.portfolio.fund.service.FundReadPlatformService;
import org.springframework.stereotype.Component;
-@Path("/funds")
+@Path("/v1/funds")
@Component
@Tag(name = "Funds", description = "")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResource.java
index 653e8614c..9bf06d0af 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/CentersApiResource.java
@@ -48,6 +48,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.accounting.journalentry.api.DateParam;
import org.apache.fineract.commands.domain.CommandWrapper;
@@ -88,14 +89,12 @@ import org.apache.fineract.portfolio.meeting.data.MeetingData;
import org.apache.fineract.portfolio.meeting.service.MeetingReadPlatformService;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/centers")
+@Path("/v1/centers")
@Component
-@Scope("singleton")
@Tag(name = "Centers", description = "Centers along with Groups are used to provided a distinctive banking distribution channel used in microfinance. Its common in areas such as Southern Asia to use Centers and Group as administrative units in grameen style lending. Typically groups will contain one to five people and centers themselves will be made of anywhere between 2-10 groups.")
+@RequiredArgsConstructor
public class CentersApiResource {
private final PlatformSecurityContext context;
@@ -114,35 +113,6 @@ public class CentersApiResource {
private final BulkImportWorkbookService bulkImportWorkbookService;
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
- @Autowired
- public CentersApiResource(final PlatformSecurityContext context, final CenterReadPlatformService centerReadPlatformService,
- final ToApiJsonSerializer<CenterData> centerApiJsonSerializer, final ToApiJsonSerializer<Object> toApiJsonSerializer,
- final ToApiJsonSerializer<AccountSummaryCollectionData> groupSummaryToApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final CollectionSheetReadPlatformService collectionSheetReadPlatformService, final FromJsonHelper fromJsonHelper,
- final AccountDetailsReadPlatformService accountDetailsReadPlatformService,
- final CalendarReadPlatformService calendarReadPlatformService, final MeetingReadPlatformService meetingReadPlatformService,
- final EntityDatatableChecksReadService entityDatatableChecksReadService,
- final BulkImportWorkbookService bulkImportWorkbookService,
- final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) {
- this.context = context;
- this.centerReadPlatformService = centerReadPlatformService;
- this.centerApiJsonSerializer = centerApiJsonSerializer;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.groupSummaryToApiJsonSerializer = groupSummaryToApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.collectionSheetReadPlatformService = collectionSheetReadPlatformService;
- this.fromJsonHelper = fromJsonHelper;
- this.accountDetailsReadPlatformService = accountDetailsReadPlatformService;
- this.calendarReadPlatformService = calendarReadPlatformService;
- this.meetingReadPlatformService = meetingReadPlatformService;
- this.entityDatatableChecksReadService = entityDatatableChecksReadService;
- this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
- this.bulkImportWorkbookService = bulkImportWorkbookService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java
index 371e8bfe2..d0f337a23 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsApiResource.java
@@ -100,7 +100,7 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-@Path("/groups")
+@Path("/v1/groups")
@Component
@Tag(name = "Groups", description = "Groups are used to provide a distinctive banking distribution channel used in microfinances throughout the world. The Group is an administrative unit. It can contain as few as 5 people or as many as 40 depending on how its used.\n"
+ "\n"
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsLevelApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsLevelApiResource.java
index c8215227a..5cc6a03a4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsLevelApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/group/api/GroupsLevelApiResource.java
@@ -30,20 +30,19 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.group.data.GroupLevelData;
import org.apache.fineract.portfolio.group.service.GroupLevelReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/grouplevels")
+@Path("/v1/grouplevels")
@Component
-@Scope("singleton")
@Tag(name = "Groups Level", description = "")
+@RequiredArgsConstructor
public class GroupsLevelApiResource {
private static final Set<String> GROUPLEVEL_DATA_PARAMETERS = new HashSet<>(Arrays.asList("levelId", "levelName", "parentLevelId",
@@ -54,15 +53,6 @@ public class GroupsLevelApiResource {
private final ToApiJsonSerializer<GroupLevelData> toApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
- @Autowired
- public GroupsLevelApiResource(final PlatformSecurityContext context, final GroupLevelReadPlatformService groupLevelReadPlatformService,
- final ToApiJsonSerializer<GroupLevelData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper) {
- this.context = context;
- this.groupLevelReadPlatformService = groupLevelReadPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java
index 61046faec..10985cae2 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartSlabsApiResource.java
@@ -53,6 +53,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -64,14 +65,12 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.apache.fineract.portfolio.interestratechart.InterestRateChartSlabApiConstants;
import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartSlabData;
import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartSlabReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/interestratecharts/{chartId}/chartslabs")
+@Path("/v1/interestratecharts/{chartId}/chartslabs")
@Component
-@Scope("singleton")
@Tag(name = "Interest Rate Slab (A.K.A interest bands)", description = "The slabs a.k.a interest bands are associated with Interest Rate Chart. These bands allow to define different interest rates for different deposit term periods.")
+@RequiredArgsConstructor
public class InterestRateChartSlabsApiResource {
private final InterestRateChartSlabReadPlatformService interestRateChartSlabReadPlatformService;
@@ -84,19 +83,6 @@ public class InterestRateChartSlabsApiResource {
descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName, amountRangeFromParamName,
amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName));
- @Autowired
- public InterestRateChartSlabsApiResource(final InterestRateChartSlabReadPlatformService interestRateChartSlabReadPlatformService,
- final PlatformSecurityContext context, final DefaultToApiJsonSerializer<InterestRateChartSlabData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper) {
-
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.interestRateChartSlabReadPlatformService = interestRateChartSlabReadPlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java
index 4c4893db1..5225879f0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/interestratechart/api/InterestRateChartsApiResource.java
@@ -51,6 +51,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -63,14 +64,12 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.apache.fineract.portfolio.interestratechart.InterestRateChartApiConstants;
import org.apache.fineract.portfolio.interestratechart.data.InterestRateChartData;
import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/interestratecharts")
+@Path("/v1/interestratecharts")
@Component
-@Scope("singleton")
@Tag(name = "Interest Rate Chart", description = "This defines an interest rate scheme that can be associated to a term deposit product. This will have a slab (band or range) of deposit periods and the associated interest rates applicable along with incentives for each band.")
+@RequiredArgsConstructor
public class InterestRateChartsApiResource {
private final InterestRateChartReadPlatformService chartReadPlatformService;
@@ -82,19 +81,6 @@ public class InterestRateChartsApiResource {
InterestRateChartApiConstants.localeParamName, InterestRateChartApiConstants.dateFormatParamName, idParamName, nameParamName,
descriptionParamName, fromDateParamName, endDateParamName, chartSlabs, isPrimaryGroupingByAmountParamName));
- @Autowired
- public InterestRateChartsApiResource(final InterestRateChartReadPlatformService chartReadPlatformService,
- final PlatformSecurityContext context, final DefaultToApiJsonSerializer<InterestRateChartData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper) {
-
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.chartReadPlatformService = chartReadPlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/BulkLoansApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/BulkLoansApiResource.java
index e2956ed2a..a4016eda1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/BulkLoansApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/BulkLoansApiResource.java
@@ -33,6 +33,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -49,14 +50,12 @@ import org.apache.fineract.organisation.staff.data.StaffAccountSummaryCollection
import org.apache.fineract.organisation.staff.data.StaffData;
import org.apache.fineract.organisation.staff.service.StaffReadPlatformService;
import org.apache.fineract.portfolio.loanaccount.service.BulkLoansReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/loans/loanreassignment")
+@Path("/v1/loans/loanreassignment")
@Component
-@Scope("singleton")
@Tag(name = "Bulk Loans", description = "")
+@RequiredArgsConstructor
public class BulkLoansApiResource {
public static final String OFFICE_ID = "officeId";
@@ -78,21 +77,6 @@ public class BulkLoansApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public BulkLoansApiResource(final PlatformSecurityContext context, final StaffReadPlatformService staffReadPlatformService,
- final OfficeReadPlatformService officeReadPlatformService, final BulkLoansReadPlatformService bulkLoansReadPlatformService,
- final DefaultToApiJsonSerializer<BulkTransferLoanOfficerData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.staffReadPlatformService = staffReadPlatformService;
- this.officeReadPlatformService = officeReadPlatformService;
- this.bulkLoansReadPlatformService = bulkLoansReadPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/InternalLoanInformationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/InternalLoanInformationApiResource.java
index 3a02ae5ea..5a18a9f7d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/InternalLoanInformationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/InternalLoanInformationApiResource.java
@@ -49,7 +49,7 @@ import org.springframework.stereotype.Component;
@Profile("test")
@Component
-@Path("/internal/loan")
+@Path("/v1/internal/loan")
@RequiredArgsConstructor
@Slf4j
public class InternalLoanInformationApiResource implements InitializingBean {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java
index c56f76cfb..55f1aa79a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanChargesApiResource.java
@@ -67,7 +67,7 @@ import org.apache.fineract.portfolio.loanaccount.service.LoanChargeReadPlatformS
import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
import org.springframework.stereotype.Component;
-@Path("/loans")
+@Path("/v1/loans")
@Component
@Tag(name = "Loan Charges", description = "Its typical for MFIs to add extra costs for their loan products. They can be either Fees or Penalties.\n"
+ "\n"
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanDisbursementDetailApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanDisbursementDetailApiResource.java
index 65fa16995..d91330b48 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanDisbursementDetailApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanDisbursementDetailApiResource.java
@@ -31,6 +31,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -41,14 +42,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.loanaccount.data.DisbursementData;
import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/loans/{loanId}/disbursements")
+@Path("/v1/loans/{loanId}/disbursements")
@Component
-@Scope("singleton")
@Tag(name = "Loan Disbursement Details", description = "")
+@RequiredArgsConstructor
public class LoanDisbursementDetailApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
@@ -62,17 +61,6 @@ public class LoanDisbursementDetailApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final LoanReadPlatformService loanReadPlatformService;
- @Autowired
- public LoanDisbursementDetailApiResource(final DefaultToApiJsonSerializer<DisbursementData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, final PlatformSecurityContext context,
- final ApiRequestParameterHelper apiRequestParameterHelper, final LoanReadPlatformService loanReadPlatformService) {
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.context = context;
- this.loanReadPlatformService = loanReadPlatformService;
- }
-
@PUT
@Path("{disbursementId}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResource.java
index 3c7138492..1926f7b9f 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanScheduleApiResource.java
@@ -36,6 +36,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -47,14 +48,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanScheduleData;
import org.apache.fineract.portfolio.loanaccount.loanschedule.service.LoanScheduleCalculationPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/loans/{loanId}/schedule")
+@Path("/v1/loans/{loanId}/schedule")
@Component
-@Scope("singleton")
@Tag(name = "Loan Rescheduling", description = "Loan Term Variations provides the ability to change due dates, amounts and number of instalments before loan approval.")
+@RequiredArgsConstructor
public class LoanScheduleApiResource {
private static final String RESOURCE_NAME_FOR_PERMISSIONS = "LOAN";
@@ -64,19 +63,6 @@ public class LoanScheduleApiResource {
private final LoanScheduleCalculationPlatformService calculationPlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
- @Autowired
- public LoanScheduleApiResource(final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<LoanScheduleData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final LoanScheduleCalculationPlatformService calculationPlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.calculationPlatformService = calculationPlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java
index 0aeaddc6e..5fb30907a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanTransactionsApiResource.java
@@ -70,7 +70,7 @@ import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
import org.springframework.stereotype.Component;
-@Path("/loans")
+@Path("/v1/loans")
@Component
@AllArgsConstructor
@Tag(name = "Loan Transactions", description = "Capabilities include loan repayment's, interest waivers and the ability to 'adjust' an existing transaction. An 'adjustment' of a transaction is really a 'reversal' of existing transaction followed by creation of a new transaction with the provided details.")
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java
index 9de6673bb..eecde271c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java
@@ -159,7 +159,7 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-@Path("/loans")
+@Path("/v1/loans")
@Component
@Tag(name = "Loans", description = "The API concept of loans models the loan application process and the loan contract/monitoring process.\n"
+ "\n" + "Field Descriptions\n" + "accountNo\n"
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java
index 1fb872188..bc5107875 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java
@@ -41,6 +41,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -70,14 +71,12 @@ import org.apache.fineract.portfolio.loanaccount.guarantor.service.GuarantorRead
import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/loans/{loanId}/guarantors")
+@Path("/v1/loans/{loanId}/guarantors")
@Component
-@Scope("singleton")
@Tag(name = "Guarantors", description = "")
+@RequiredArgsConstructor
public class GuarantorsApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
@@ -102,26 +101,6 @@ public class GuarantorsApiResource {
private final BulkImportWorkbookService bulkImportWorkbookService;
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
- @Autowired
- public GuarantorsApiResource(final PlatformSecurityContext context, final GuarantorReadPlatformService guarantorReadPlatformService,
- final DefaultToApiJsonSerializer<GuarantorData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final CodeValueReadPlatformService codeValueReadPlatformService,
- final PortfolioAccountReadPlatformService portfolioAccountReadPlatformService,
- final LoanReadPlatformService loanReadPlatformService, final BulkImportWorkbookService bulkImportWorkbookService,
- final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) {
- this.context = context;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiJsonSerializerService = toApiJsonSerializer;
- this.guarantorReadPlatformService = guarantorReadPlatformService;
- this.codeValueReadPlatformService = codeValueReadPlatformService;
- this.portfolioAccountReadPlatformService = portfolioAccountReadPlatformService;
- this.loanReadPlatformService = loanReadPlatformService;
- this.bulkImportWorkbookService = bulkImportWorkbookService;
- this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java
index 4e1a1adea..bc9a1e766 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/api/RescheduleLoansApiResource.java
@@ -38,6 +38,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -54,14 +55,12 @@ import org.apache.fineract.portfolio.loanaccount.rescheduleloan.RescheduleLoansA
import org.apache.fineract.portfolio.loanaccount.rescheduleloan.data.LoanRescheduleRequestData;
import org.apache.fineract.portfolio.loanaccount.rescheduleloan.service.LoanReschedulePreviewPlatformService;
import org.apache.fineract.portfolio.loanaccount.rescheduleloan.service.LoanRescheduleRequestReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/rescheduleloans")
+@Path("/v1/rescheduleloans")
@Component
-@Scope("singleton")
@Tag(name = "Reschedule Loans", description = "")
+@RequiredArgsConstructor
public class RescheduleLoansApiResource {
private final DefaultToApiJsonSerializer<LoanRescheduleRequestData> loanRescheduleRequestToApiJsonSerializer;
@@ -72,23 +71,6 @@ public class RescheduleLoansApiResource {
private final LoanReschedulePreviewPlatformService loanReschedulePreviewPlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
- @Autowired
- public RescheduleLoansApiResource(final DefaultToApiJsonSerializer<LoanRescheduleRequestData> loanRescheduleRequestToApiJsonSerializer,
- final PlatformSecurityContext platformSecurityContext,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final LoanRescheduleRequestReadPlatformService loanRescheduleRequestReadPlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final DefaultToApiJsonSerializer<LoanScheduleData> loanRescheduleToApiJsonSerializer,
- final LoanReschedulePreviewPlatformService loanReschedulePreviewPlatformService) {
- this.loanRescheduleRequestToApiJsonSerializer = loanRescheduleRequestToApiJsonSerializer;
- this.platformSecurityContext = platformSecurityContext;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.loanRescheduleRequestReadPlatformService = loanRescheduleRequestReadPlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.loanRescheduleToApiJsonSerializer = loanRescheduleToApiJsonSerializer;
- this.loanReschedulePreviewPlatformService = loanReschedulePreviewPlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java
index 2a5556601..f3f463b0a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/api/LoanProductsApiResource.java
@@ -86,7 +86,7 @@ import org.apache.fineract.portfolio.rate.data.RateData;
import org.apache.fineract.portfolio.rate.service.RateReadService;
import org.springframework.stereotype.Component;
-@Path("/loanproducts")
+@Path("/v1/loanproducts")
@Component
@Tag(name = "Loan Products", description = "A Loan product is a template that is used when creating a loan. Much of the template definition can be overridden during loan creation.")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/api/ProductMixApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/api/ProductMixApiResource.java
index 62e67085a..6e5d6659b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/api/ProductMixApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanproduct/productmix/api/ProductMixApiResource.java
@@ -34,6 +34,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -46,14 +47,12 @@ import org.apache.fineract.portfolio.loanproduct.data.LoanProductData;
import org.apache.fineract.portfolio.loanproduct.productmix.data.ProductMixData;
import org.apache.fineract.portfolio.loanproduct.productmix.service.ProductMixReadPlatformService;
import org.apache.fineract.portfolio.loanproduct.service.LoanProductReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/loanproducts/{productId}/productmix")
+@Path("/v1/loanproducts/{productId}/productmix")
@Component
-@Scope("singleton")
@Tag(name = "Product Mix")
+@RequiredArgsConstructor
public class ProductMixApiResource {
private static final String RESOURCE_NAME_FOR_PERMISSIONS = "PRODUCTMIX";
@@ -69,20 +68,6 @@ public class ProductMixApiResource {
private final ProductMixReadPlatformService productMixReadPlatformService;
private final LoanProductReadPlatformService loanProductReadPlatformService;
- @Autowired
- public ProductMixApiResource(final PlatformSecurityContext context,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper, final DefaultToApiJsonSerializer<ProductMixData> toApiJsonSerializer,
- final ProductMixReadPlatformService productMixReadPlatformService,
- final LoanProductReadPlatformService loanProductReadPlatformService) {
- this.context = context;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.productMixReadPlatformService = productMixReadPlatformService;
- this.loanProductReadPlatformService = loanProductReadPlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
index 98b70e977..69702bbcd 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/meeting/api/MeetingsApiResource.java
@@ -38,6 +38,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -62,14 +63,12 @@ import org.apache.fineract.portfolio.meeting.attendance.service.ClientAttendance
import org.apache.fineract.portfolio.meeting.data.MeetingData;
import org.apache.fineract.portfolio.meeting.exception.MeetingNotSupportedResourceException;
import org.apache.fineract.portfolio.meeting.service.MeetingReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/{entityType}/{entityId}/meetings")
+@Path("/v1/{entityType}/{entityId}/meetings")
@Component
-@Scope("singleton")
@Tag(name = "Meetings", description = "")
+@RequiredArgsConstructor
public class MeetingsApiResource {
private final PlatformSecurityContext context;
@@ -85,24 +84,6 @@ public class MeetingsApiResource {
Arrays.asList(MeetingApiConstants.idParamName, MeetingApiConstants.meetingDateParamName, MeetingApiConstants.clientsAttendance,
MeetingApiConstants.clients, MeetingApiConstants.calendarData, MeetingApiConstants.attendanceTypeOptions));
- @Autowired
- public MeetingsApiResource(final PlatformSecurityContext context, final MeetingReadPlatformService readPlatformService,
- final ClientAttendanceReadPlatformService attendanceReadPlatformService,
- final ClientReadPlatformService clientReadPlatformService, final CalendarReadPlatformService calendarReadPlatformService,
- final AttendanceDropdownReadPlatformService attendanceDropdownReadPlatformService,
- final DefaultToApiJsonSerializer<MeetingData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.attendanceReadPlatformService = attendanceReadPlatformService;
- this.clientReadPlatformService = clientReadPlatformService;
- this.calendarReadPlatformService = calendarReadPlatformService;
- this.attendanceDropdownReadPlatformService = attendanceDropdownReadPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java
index 10d7aa8fc..bd2215046 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/api/NotesApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -54,14 +55,12 @@ import org.apache.fineract.portfolio.note.data.NoteData;
import org.apache.fineract.portfolio.note.domain.NoteType;
import org.apache.fineract.portfolio.note.exception.NoteResourceNotSupportedException;
import org.apache.fineract.portfolio.note.service.NoteReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/{resourceType}/{resourceId}/notes")
+@Path("/v1/{resourceType}/{resourceId}/notes")
@Component
-@Scope("singleton")
@Tag(name = "Notes", description = "Notes API allows to enter notes for supported resources.")
+@RequiredArgsConstructor
public class NotesApiResource {
public static final String CLIENTNOTE = "CLIENTNOTE";
@@ -79,17 +78,6 @@ public class NotesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public NotesApiResource(final PlatformSecurityContext context, final NoteReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<NoteData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResource.java
index aeb359e77..fb3090f9b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/paymenttype/api/PaymentTypeApiResource.java
@@ -40,7 +40,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
-import lombok.AllArgsConstructor;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -54,11 +54,10 @@ import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWra
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadPlatformService;
import org.springframework.stereotype.Component;
-@AllArgsConstructor
-@Path("/paymenttypes")
+@Path("/v1/paymenttypes")
@Component
-
@Tag(name = "Payment Type", description = "This defines the payment type")
+@RequiredArgsConstructor
public class PaymentTypeApiResource {
private final PlatformSecurityContext securityContext;
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java
index bc41974b6..f63842c9c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/products/api/ProductsApiResource.java
@@ -37,6 +37,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -51,15 +52,13 @@ import org.apache.fineract.portfolio.products.data.ProductData;
import org.apache.fineract.portfolio.products.exception.ResourceNotFoundException;
import org.apache.fineract.portfolio.products.service.ShareProductReadPlatformService;
import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/products/{type}")
+@Path("/v1/products/{type}")
@Component
-@Scope("singleton")
@Tag(name = "Products", description = "")
+@RequiredArgsConstructor
public class ProductsApiResource {
private final ApplicationContext applicationContext;
@@ -68,17 +67,6 @@ public class ProductsApiResource {
private final PlatformSecurityContext platformSecurityContext;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public ProductsApiResource(final ApplicationContext applicationContext, final ApiRequestParameterHelper apiRequestParameterHelper,
- final DefaultToApiJsonSerializer<ProductData> toApiJsonSerializer, final PlatformSecurityContext platformSecurityContext,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.applicationContext = applicationContext;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.platformSecurityContext = platformSecurityContext;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/api/RateApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/api/RateApiResource.java
index ffa0edd56..069226fc5 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/api/RateApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/rate/api/RateApiResource.java
@@ -34,6 +34,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -44,18 +45,16 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.rate.data.RateData;
import org.apache.fineract.portfolio.rate.service.RateReadService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
/**
* Bowpi GT Created by Jose on 19/07/2017.
*/
-@Path("/rates")
+@Path("/v1/rates")
@Component
-@Scope("singleton")
@Tag(name = "Rate", description = "")
+@RequiredArgsConstructor
public class RateApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
@@ -67,17 +66,6 @@ public class RateApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public RateApiResource(final PlatformSecurityContext context, final RateReadService rateReadService,
- final DefaultToApiJsonSerializer<RateData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = rateReadService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Path("{rateId}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/repaymentwithpostdatedchecks/api/RepaymentWithPostDatedChecksApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/repaymentwithpostdatedchecks/api/RepaymentWithPostDatedChecksApiResource.java
index e8d2293a6..fa078c7ce 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/repaymentwithpostdatedchecks/api/RepaymentWithPostDatedChecksApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/repaymentwithpostdatedchecks/api/RepaymentWithPostDatedChecksApiResource.java
@@ -37,6 +37,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -46,14 +47,12 @@ import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.repaymentwithpostdatedchecks.data.PostDatedChecksData;
import org.apache.fineract.portfolio.repaymentwithpostdatedchecks.service.RepaymentWithPostDatedChecksReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/loans/{loanId}/postdatedchecks")
+@Path("/v1/loans/{loanId}/postdatedchecks")
@Component
-@Scope("singleton")
@Tag(name = "repayment with post dated checks", description = "Repay with post dated checks")
+@RequiredArgsConstructor
public class RepaymentWithPostDatedChecksApiResource {
private final PlatformSecurityContext context;
@@ -62,18 +61,6 @@ public class RepaymentWithPostDatedChecksApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final RepaymentWithPostDatedChecksReadPlatformService repaymentWithPostDatedChecksReadPlatformService;
- @Autowired
- public RepaymentWithPostDatedChecksApiResource(final PlatformSecurityContext context, final FromJsonHelper fromJsonHelper,
- final DefaultToApiJsonSerializer<PostDatedChecksData> apiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService portfolioCommandSourceWritePlatformService,
- final RepaymentWithPostDatedChecksReadPlatformService repaymentWithPostDatedChecksReadPlatformService) {
- this.context = context;
- this.fromJsonHelper = fromJsonHelper;
- this.apiJsonSerializer = apiJsonSerializer;
- this.commandsSourceWritePlatformService = portfolioCommandSourceWritePlatformService;
- this.repaymentWithPostDatedChecksReadPlatformService = repaymentWithPostDatedChecksReadPlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
index 2dccb00d8..005abedfa 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/DepositAccountOnHoldFundTransactionsApiResource.java
@@ -28,6 +28,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
@@ -37,14 +38,12 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
import org.apache.fineract.portfolio.savings.SavingsApiConstants;
import org.apache.fineract.portfolio.savings.data.DepositAccountOnHoldTransactionData;
import org.apache.fineract.portfolio.savings.service.DepositAccountOnHoldTransactionReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/savingsaccounts/{savingsId}/onholdtransactions")
+@Path("/v1/savingsaccounts/{savingsId}/onholdtransactions")
@Component
-@Scope("singleton")
@Tag(name = "Deposit Account On Hold Fund Transactions", description = "")
+@RequiredArgsConstructor
public class DepositAccountOnHoldFundTransactionsApiResource {
private final PlatformSecurityContext context;
@@ -52,17 +51,6 @@ public class DepositAccountOnHoldFundTransactionsApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final DepositAccountOnHoldTransactionReadPlatformService depositAccountOnHoldTransactionReadPlatformService;
- @Autowired
- public DepositAccountOnHoldFundTransactionsApiResource(final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<DepositAccountOnHoldTransactionData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final DepositAccountOnHoldTransactionReadPlatformService depositAccountOnHoldTransactionReadPlatformService) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.depositAccountOnHoldTransactionReadPlatformService = depositAccountOnHoldTransactionReadPlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
index a63d80c0d..d16605751 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/FixedDepositAccountTransactionsApiResource.java
@@ -33,6 +33,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -49,14 +50,12 @@ import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.DepositsApiConstants;
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/fixeddepositaccounts/{fixedDepositAccountId}/transactions")
+@Path("/v1/fixeddepositaccounts/{fixedDepositAccountId}/transactions")
@Component
-@Scope("singleton")
@Tag(name = "Fixed Deposit Account Transactions", description = "")
+@RequiredArgsConstructor
public class FixedDepositAccountTransactionsApiResource {
private final PlatformSecurityContext context;
@@ -71,21 +70,6 @@ public class FixedDepositAccountTransactionsApiResource {
DepositsApiConstants.dateParamName, DepositsApiConstants.paymentDetailDataParamName,
DepositsApiConstants.runningBalanceParamName, DepositsApiConstants.reversedParamName));
- @Autowired
- public FixedDepositAccountTransactionsApiResource(final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<SavingsAccountTransactionData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final SavingsAccountReadPlatformService savingsAccountReadPlatformService,
- PaymentTypeReadPlatformService paymentTypeReadPlatformService) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.savingsAccountReadPlatformService = savingsAccountReadPlatformService;
- this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
- }
-
private boolean is(final String commandParam, final String commandValue) {
return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue);
}
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 07efc5185..bde088cc0 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
@@ -48,6 +48,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -81,15 +82,13 @@ import org.apache.fineract.portfolio.savings.service.DepositAccountReadPlatformS
import org.apache.fineract.portfolio.savings.service.SavingsAccountChargeReadPlatformService;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-@Path("/fixeddepositaccounts")
+@Path("/v1/fixeddepositaccounts")
@Component
-@Scope("singleton")
@Tag(name = "Fixed Deposit Account", description = "Fixed Deposit accounts are instances of a praticular fixed deposit product created. An application process around the creation of accounts is also supported.")
+@RequiredArgsConstructor
public class FixedDepositAccountsApiResource {
private final DepositAccountReadPlatformService depositAccountReadPlatformService;
@@ -104,29 +103,6 @@ public class FixedDepositAccountsApiResource {
private final BulkImportWorkbookService bulkImportWorkbookService;
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
- @Autowired
- public FixedDepositAccountsApiResource(final DepositAccountReadPlatformService depositAccountReadPlatformService,
- final PlatformSecurityContext context, final DefaultToApiJsonSerializer<DepositAccountData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService, final FromJsonHelper fromJsonHelper,
- final DepositAccountPreMatureCalculationPlatformService accountPreMatureCalculationPlatformService,
- final AccountAssociationsReadPlatformService accountAssociationsReadPlatformService,
- final BulkImportWorkbookService bulkImportWorkbookService,
- final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) {
- this.depositAccountReadPlatformService = depositAccountReadPlatformService;
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.savingsAccountChargeReadPlatformService = savingsAccountChargeReadPlatformService;
- this.fromJsonHelper = fromJsonHelper;
- this.accountPreMatureCalculationPlatformService = accountPreMatureCalculationPlatformService;
- this.accountAssociationsReadPlatformService = accountAssociationsReadPlatformService;
- this.bulkImportWorkbookService = bulkImportWorkbookService;
- this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
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 8d1900205..c1505c8ab 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
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
import org.apache.fineract.accounting.common.AccountingEnumerations;
import org.apache.fineract.accounting.common.AccountingRuleType;
@@ -80,17 +81,15 @@ import org.apache.fineract.portfolio.savings.service.SavingsDropdownReadPlatform
import org.apache.fineract.portfolio.savings.service.SavingsEnumerations;
import org.apache.fineract.portfolio.tax.data.TaxGroupData;
import org.apache.fineract.portfolio.tax.service.TaxReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-@Path("/fixeddepositproducts")
+@Path("/v1/fixeddepositproducts")
@Component
-@Scope("singleton")
@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.")
+@RequiredArgsConstructor
public class FixedDepositProductsApiResource {
private final DepositProductReadPlatformService depositProductReadPlatformService;
@@ -110,38 +109,6 @@ public class FixedDepositProductsApiResource {
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService;
private final TaxReadPlatformService taxReadPlatformService;
- @Autowired
- public FixedDepositProductsApiResource(final DepositProductReadPlatformService depositProductReadPlatformService,
- final SavingsDropdownReadPlatformService savingsDropdownReadPlatformService,
- final CurrencyReadPlatformService currencyReadPlatformService, final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<FixedDepositProductData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService,
- final ProductToGLAccountMappingReadPlatformService accountMappingReadPlatformService,
- final ChargeReadPlatformService chargeReadPlatformService, final InterestRateChartReadPlatformService chartReadPlatformService,
- final InterestRateChartReadPlatformService interestRateChartReadPlatformService,
- final DepositsDropdownReadPlatformService depositsDropdownReadPlatformService,
- final DropdownReadPlatformService dropdownReadPlatformService,
- final PaymentTypeReadPlatformService paymentTypeReadPlatformService, final TaxReadPlatformService taxReadPlatformService) {
- this.depositProductReadPlatformService = depositProductReadPlatformService;
- this.savingsDropdownReadPlatformService = savingsDropdownReadPlatformService;
- this.currencyReadPlatformService = currencyReadPlatformService;
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.accountingDropdownReadPlatformService = accountingDropdownReadPlatformService;
- this.accountMappingReadPlatformService = accountMappingReadPlatformService;
- this.chargeReadPlatformService = chargeReadPlatformService;
- this.chartReadPlatformService = chartReadPlatformService;
- this.interestRateChartReadPlatformService = interestRateChartReadPlatformService;
- this.depositsDropdownReadPlatformService = depositsDropdownReadPlatformService;
- this.dropdownReadPlatformService = dropdownReadPlatformService;
- this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
- this.taxReadPlatformService = taxReadPlatformService;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
index 6d36fc509..6e1400135 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountTransactionsApiResource.java
@@ -40,6 +40,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -57,14 +58,12 @@ import org.apache.fineract.portfolio.savings.DepositsApiConstants;
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
import org.apache.fineract.portfolio.savings.service.DepositAccountReadPlatformService;
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/recurringdepositaccounts/{recurringDepositAccountId}/transactions")
+@Path("/v1/recurringdepositaccounts/{recurringDepositAccountId}/transactions")
@Component
-@Scope("singleton")
@Tag(name = "Recurring Deposit Account Transactions", description = "Transactions possible on a recurring deposit account.")
+@RequiredArgsConstructor
public class RecurringDepositAccountTransactionsApiResource {
private final PlatformSecurityContext context;
@@ -80,23 +79,6 @@ public class RecurringDepositAccountTransactionsApiResource {
DepositsApiConstants.dateParamName, DepositsApiConstants.paymentDetailDataParamName,
DepositsApiConstants.runningBalanceParamName, DepositsApiConstants.reversedParamName));
- @Autowired
- public RecurringDepositAccountTransactionsApiResource(final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<SavingsAccountTransactionData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final SavingsAccountReadPlatformService savingsAccountReadPlatformService,
- final DepositAccountReadPlatformService depositAccountReadPlatformService,
- final PaymentTypeReadPlatformService paymentTypeReadPlatformService) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.savingsAccountReadPlatformService = savingsAccountReadPlatformService;
- this.depositAccountReadPlatformService = depositAccountReadPlatformService;
- this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
- }
-
private boolean is(final String commandParam, final String commandValue) {
return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java
index 36dd1e4ed..ceef6c20d 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositAccountsApiResource.java
@@ -47,6 +47,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -78,15 +79,13 @@ import org.apache.fineract.portfolio.savings.service.DepositAccountReadPlatformS
import org.apache.fineract.portfolio.savings.service.SavingsAccountChargeReadPlatformService;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-@Path("/recurringdepositaccounts")
+@Path("/v1/recurringdepositaccounts")
@Component
-@Scope("singleton")
@Tag(name = "Recurring Deposit Account", description = "Recurring Deposit accounts are instances of a praticular recurring deposit product created. An application process around the creation of accounts is also supported.")
+@RequiredArgsConstructor
public class RecurringDepositAccountsApiResource {
private final DepositAccountReadPlatformService depositAccountReadPlatformService;
@@ -100,27 +99,6 @@ public class RecurringDepositAccountsApiResource {
private final BulkImportWorkbookService bulkImportWorkbookService;
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
- @Autowired
- public RecurringDepositAccountsApiResource(final DepositAccountReadPlatformService depositAccountReadPlatformService,
- final PlatformSecurityContext context, final DefaultToApiJsonSerializer<DepositAccountData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService, final FromJsonHelper fromJsonHelper,
- final DepositAccountPreMatureCalculationPlatformService accountPreMatureCalculationPlatformService,
- final BulkImportWorkbookService bulkImportWorkbookService,
- final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) {
- this.depositAccountReadPlatformService = depositAccountReadPlatformService;
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.savingsAccountChargeReadPlatformService = savingsAccountChargeReadPlatformService;
- this.fromJsonHelper = fromJsonHelper;
- this.accountPreMatureCalculationPlatformService = accountPreMatureCalculationPlatformService;
- this.bulkImportWorkbookService = bulkImportWorkbookService;
- this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResource.java
index 6bbadf767..5c16ea47a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/RecurringDepositProductsApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
import org.apache.fineract.accounting.common.AccountingEnumerations;
import org.apache.fineract.accounting.common.AccountingRuleType;
@@ -80,19 +81,17 @@ import org.apache.fineract.portfolio.savings.service.SavingsDropdownReadPlatform
import org.apache.fineract.portfolio.savings.service.SavingsEnumerations;
import org.apache.fineract.portfolio.tax.data.TaxGroupData;
import org.apache.fineract.portfolio.tax.service.TaxReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-@Path("/recurringdepositproducts")
+@Path("/v1/recurringdepositproducts")
@Component
-@Scope("singleton")
@Tag(name = "Recurring Deposit Product", description = "Recurring Deposits are a special kind of Term Deposits offered by MFI's. The Recurring Deposit Products (aka RD) product offerings are modeled using this API.\n"
+ "\n"
+ "Recurring Deposits help people with regular incomes to deposit a fixed amount every month (specified recurring frequency) into their Recurring Deposit account.\n"
+ "\n"
+ "When creating recurring deposit accounts, the details from the recurring deposit product are used to auto fill details of the recurring deposit account application process.")
+@RequiredArgsConstructor
public class RecurringDepositProductsApiResource {
private final DepositProductReadPlatformService depositProductReadPlatformService;
@@ -112,38 +111,6 @@ public class RecurringDepositProductsApiResource {
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService;
private final TaxReadPlatformService taxReadPlatformService;
- @Autowired
- public RecurringDepositProductsApiResource(final DepositProductReadPlatformService depositProductReadPlatformService,
- final SavingsDropdownReadPlatformService savingsDropdownReadPlatformService,
- final CurrencyReadPlatformService currencyReadPlatformService, final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<RecurringDepositProductData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService,
- final ProductToGLAccountMappingReadPlatformService accountMappingReadPlatformService,
- final ChargeReadPlatformService chargeReadPlatformService, final InterestRateChartReadPlatformService chartReadPlatformService,
- final InterestRateChartReadPlatformService interestRateChartReadPlatformService,
- final DepositsDropdownReadPlatformService depositsDropdownReadPlatformService,
- final DropdownReadPlatformService dropdownReadPlatformService,
- final PaymentTypeReadPlatformService paymentTypeReadPlatformService, final TaxReadPlatformService taxReadPlatformService) {
- this.depositProductReadPlatformService = depositProductReadPlatformService;
- this.savingsDropdownReadPlatformService = savingsDropdownReadPlatformService;
- this.currencyReadPlatformService = currencyReadPlatformService;
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.accountingDropdownReadPlatformService = accountingDropdownReadPlatformService;
- this.accountMappingReadPlatformService = accountMappingReadPlatformService;
- this.chargeReadPlatformService = chargeReadPlatformService;
- this.chartReadPlatformService = chartReadPlatformService;
- this.interestRateChartReadPlatformService = interestRateChartReadPlatformService;
- this.depositsDropdownReadPlatformService = depositsDropdownReadPlatformService;
- this.dropdownReadPlatformService = dropdownReadPlatformService;
- this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
- this.taxReadPlatformService = taxReadPlatformService;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
index 500dbe74c..e1c25d3c9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountChargesApiResource.java
@@ -46,6 +46,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -60,16 +61,14 @@ import org.apache.fineract.portfolio.charge.data.ChargeData;
import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService;
import org.apache.fineract.portfolio.savings.data.SavingsAccountChargeData;
import org.apache.fineract.portfolio.savings.service.SavingsAccountChargeReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/savingsaccounts/{savingsAccountId}/charges")
+@Path("/v1/savingsaccounts/{savingsAccountId}/charges")
@Component
-@Scope("singleton")
@Tag(name = "Savings Charges", description = "Its typical for MFIs to add maintenance and operating charges. They can be either Fees or Penalties.\n"
+ "\n"
+ "Savings Charges are instances of Charges and represent either fees and penalties for savings products. Refer Charges for documentation of the various properties of a charge, Only additional properties ( specific to the context of a Charge being associated with a Savings account) are described here")
+@RequiredArgsConstructor
public class SavingsAccountChargesApiResource {
private final PlatformSecurityContext context;
@@ -79,21 +78,6 @@ public class SavingsAccountChargesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public SavingsAccountChargesApiResource(final PlatformSecurityContext context,
- final ChargeReadPlatformService chargeReadPlatformService,
- final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService,
- final DefaultToApiJsonSerializer<SavingsAccountChargeData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.chargeReadPlatformService = chargeReadPlatformService;
- this.savingsAccountChargeReadPlatformService = savingsAccountChargeReadPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
private boolean is(final String commandParam, final String commandValue) {
return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
index 582837aa3..a4081d347 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountTransactionsApiResource.java
@@ -37,6 +37,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -54,16 +55,14 @@ import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.SavingsApiConstants;
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.dao.CannotAcquireLockException;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.stereotype.Component;
-@Path("/savingsaccounts/{savingsId}/transactions")
+@Path("/v1/savingsaccounts/{savingsId}/transactions")
@Component
-@Scope("singleton")
@Tag(name = "Savings Account Transactions", description = "")
+@RequiredArgsConstructor
public class SavingsAccountTransactionsApiResource {
private final PlatformSecurityContext context;
@@ -73,21 +72,6 @@ public class SavingsAccountTransactionsApiResource {
private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
private final PaymentTypeReadPlatformService paymentTypeReadPlatformService;
- @Autowired
- public SavingsAccountTransactionsApiResource(final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<SavingsAccountTransactionData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final SavingsAccountReadPlatformService savingsAccountReadPlatformService,
- PaymentTypeReadPlatformService paymentTypeReadPlatformService) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.savingsAccountReadPlatformService = savingsAccountReadPlatformService;
- this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
- }
-
private boolean is(final String commandParam, final String commandValue) {
return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue);
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
index f292d8398..556e4f96e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsAccountsApiResource.java
@@ -75,7 +75,7 @@ import org.glassfish.jersey.media.multipart.FormDataParam;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-@Path("/savingsaccounts")
+@Path("/v1/savingsaccounts")
@Component
@Tag(name = "Savings Account", description = "Savings accounts are instances of a particular savings product created for an individual or group. An application process around the creation of accounts is also supported.")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
index 57727c27d..68ce01943 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/SavingsProductsApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
import org.apache.fineract.accounting.common.AccountingEnumerations;
import org.apache.fineract.accounting.common.AccountingRuleType;
@@ -76,17 +77,14 @@ import org.apache.fineract.portfolio.savings.service.SavingsEnumerations;
import org.apache.fineract.portfolio.savings.service.SavingsProductReadPlatformService;
import org.apache.fineract.portfolio.tax.data.TaxGroupData;
import org.apache.fineract.portfolio.tax.service.TaxReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-@Path("/savingsproducts")
+@Path("/v1/savingsproducts")
@Component
-@Scope("singleton")
-
@Tag(name = "Savings Product", description = "An MFIs savings product offerings are modeled using this API." + "\n"
+ "When creating savings accounts, the details from the savings product are used to auto fill details of the savings account application process.")
+@RequiredArgsConstructor
public class SavingsProductsApiResource {
private final SavingsProductReadPlatformService savingProductReadPlatformService;
@@ -103,32 +101,6 @@ public class SavingsProductsApiResource {
private final TaxReadPlatformService taxReadPlatformService;
private final ConfigurationDomainService configurationDomainService;
- @Autowired
- public SavingsProductsApiResource(final SavingsProductReadPlatformService savingProductReadPlatformService,
- final SavingsDropdownReadPlatformService dropdownReadPlatformService,
- final CurrencyReadPlatformService currencyReadPlatformService, final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<SavingsProductData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService,
- final ProductToGLAccountMappingReadPlatformService accountMappingReadPlatformService,
- final ChargeReadPlatformService chargeReadPlatformService, PaymentTypeReadPlatformService paymentTypeReadPlatformService,
- final TaxReadPlatformService taxReadPlatformService, final ConfigurationDomainService configurationDomainService) {
- this.savingProductReadPlatformService = savingProductReadPlatformService;
- this.dropdownReadPlatformService = dropdownReadPlatformService;
- this.currencyReadPlatformService = currencyReadPlatformService;
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.accountingDropdownReadPlatformService = accountingDropdownReadPlatformService;
- this.accountMappingReadPlatformService = accountMappingReadPlatformService;
- this.chargeReadPlatformService = chargeReadPlatformService;
- this.paymentTypeReadPlatformService = paymentTypeReadPlatformService;
- this.taxReadPlatformService = taxReadPlatformService;
- this.configurationDomainService = configurationDomainService;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResource.java
index 0c95fc9c7..11ab63e86 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/search/api/SearchApiResource.java
@@ -39,6 +39,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
import org.apache.fineract.infrastructure.core.serialization.ToApiJsonSerializer;
@@ -49,14 +50,12 @@ import org.apache.fineract.portfolio.search.data.AdHocSearchQueryData;
import org.apache.fineract.portfolio.search.data.SearchConditions;
import org.apache.fineract.portfolio.search.data.SearchData;
import org.apache.fineract.portfolio.search.service.SearchReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/search")
+@Path("/v1/search")
@Component
-@Scope("singleton")
@Tag(name = "Search API", description = "Search API allows to search scoped resources clients, loans and groups on specified fields.")
+@RequiredArgsConstructor
public class SearchApiResource {
private static final Set<String> SEARCH_RESPONSE_PARAMETERS = SearchResponseParameters.getAllValues();
@@ -66,18 +65,6 @@ public class SearchApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final AdHocQueryDataValidator fromApiJsonDeserializer;
- @Autowired
- public SearchApiResource(final SearchReadPlatformService searchReadPlatformService,
- final ToApiJsonSerializer<Object> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final AdHocQueryDataValidator fromApiJsonDeserializer) {
-
- this.searchReadPlatformService = searchReadPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.fromApiJsonDeserializer = fromApiJsonDeserializer;
-
- }
-
@GET
@Path("/template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java
index abce15da4..08e95887c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfAccountTransferApiResource.java
@@ -40,6 +40,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService;
import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
@@ -55,15 +56,12 @@ import org.apache.fineract.portfolio.self.account.exception.DailyTPTTransactionA
import org.apache.fineract.portfolio.self.account.service.SelfAccountTransferReadService;
import org.apache.fineract.portfolio.self.account.service.SelfBeneficiariesTPTReadPlatformService;
import org.apache.fineract.useradministration.domain.AppUser;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/accounttransfers")
+@Path("/v1/self/accounttransfers")
@Component
-@Scope("singleton")
-
@Tag(name = "Self Account transfer", description = "")
+@RequiredArgsConstructor
public class SelfAccountTransferApiResource {
private final PlatformSecurityContext context;
@@ -76,26 +74,6 @@ public class SelfAccountTransferApiResource {
private final ConfigurationDomainService configurationDomainService;
private final AccountTransfersReadPlatformService accountTransfersReadPlatformService;
- @Autowired
- public SelfAccountTransferApiResource(final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<SelfAccountTransferData> toApiJsonSerializer,
- final AccountTransfersApiResource accountTransfersApiResource,
- final SelfAccountTransferReadService selfAccountTransferReadService, final ApiRequestParameterHelper apiRequestParameterHelper,
- final SelfAccountTransferDataValidator dataValidator,
- final SelfBeneficiariesTPTReadPlatformService tptBeneficiaryReadPlatformService,
- final ConfigurationDomainService configurationDomainService,
- final AccountTransfersReadPlatformService accountTransfersReadPlatformService) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.accountTransfersApiResource = accountTransfersApiResource;
- this.selfAccountTransferReadService = selfAccountTransferReadService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.dataValidator = dataValidator;
- this.tptBeneficiaryReadPlatformService = tptBeneficiaryReadPlatformService;
- this.configurationDomainService = configurationDomainService;
- this.accountTransfersReadPlatformService = accountTransfersReadPlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java
index bea11e1ea..44a875025 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/account/api/SelfBeneficiariesTPTApiResource.java
@@ -42,6 +42,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -55,15 +56,12 @@ import org.apache.fineract.portfolio.account.PortfolioAccountType;
import org.apache.fineract.portfolio.account.service.AccountTransferEnumerations;
import org.apache.fineract.portfolio.self.account.data.SelfBeneficiariesTPTData;
import org.apache.fineract.portfolio.self.account.service.SelfBeneficiariesTPTReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/beneficiaries/tpt")
+@Path("/v1/self/beneficiaries/tpt")
@Component
-@Scope("singleton")
-
@Tag(name = "Self Third Party Transfer", description = "")
+@RequiredArgsConstructor
public class SelfBeneficiariesTPTApiResource {
private final PlatformSecurityContext context;
@@ -77,18 +75,6 @@ public class SelfBeneficiariesTPTApiResource {
SelfBeneficiariesTPTApiConstants.TRANSFER_LIMIT_PARAM_NAME, SelfBeneficiariesTPTApiConstants.ID_PARAM_NAME,
SelfBeneficiariesTPTApiConstants.CLIENT_NAME_PARAM_NAME, SelfBeneficiariesTPTApiConstants.ACCOUNT_TYPE_OPTIONS_PARAM_NAME));
- @Autowired
- public SelfBeneficiariesTPTApiResource(final PlatformSecurityContext context,
- final DefaultToApiJsonSerializer<SelfBeneficiariesTPTData> toApiJsonSerializer,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final ApiRequestParameterHelper apiRequestParameterHelper, final SelfBeneficiariesTPTReadPlatformService readPlatformService) {
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.readPlatformService = readPlatformService;
- }
-
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java
index be21857e3..f41b9e004 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/client/api/SelfClientsApiResource.java
@@ -41,6 +41,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.data.UploadRequest;
import org.apache.fineract.infrastructure.documentmanagement.api.ImagesApiResource;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
@@ -55,15 +56,12 @@ import org.apache.fineract.useradministration.domain.AppUser;
import org.glassfish.jersey.media.multipart.FormDataBodyPart;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/clients")
+@Path("/v1/self/clients")
@Component
-@Scope("singleton")
-
@Tag(name = "Self Client", description = "")
+@RequiredArgsConstructor
public class SelfClientsApiResource {
private final PlatformSecurityContext context;
@@ -74,20 +72,6 @@ public class SelfClientsApiResource {
private final AppuserClientMapperReadService appUserClientMapperReadService;
private final SelfClientDataValidator dataValidator;
- @Autowired
- public SelfClientsApiResource(final PlatformSecurityContext context, final ClientsApiResource clientApiResource,
- final ImagesApiResource imagesApiResource, final ClientChargesApiResource clientChargesApiResource,
- final ClientTransactionsApiResource clientTransactionsApiResource,
- final AppuserClientMapperReadService appUserClientMapperReadService, final SelfClientDataValidator dataValidator) {
- this.context = context;
- this.clientApiResource = clientApiResource;
- this.imagesApiResource = imagesApiResource;
- this.clientChargesApiResource = clientChargesApiResource;
- this.clientTransactionsApiResource = clientTransactionsApiResource;
- this.appUserClientMapperReadService = appUserClientMapperReadService;
- this.dataValidator = dataValidator;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java
index f763891b8..dde5c4b6e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/loanaccount/api/SelfLoansApiResource.java
@@ -40,6 +40,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
@@ -56,14 +57,12 @@ import org.apache.fineract.portfolio.self.client.service.AppuserClientMapperRead
import org.apache.fineract.portfolio.self.loanaccount.data.SelfLoansDataValidator;
import org.apache.fineract.portfolio.self.loanaccount.service.AppuserLoansMapperReadService;
import org.apache.fineract.useradministration.domain.AppUser;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/loans")
+@Path("/v1/self/loans")
@Component
-@Scope("singleton")
@Tag(name = "Self Loans", description = "")
+@RequiredArgsConstructor
public class SelfLoansApiResource {
private final PlatformSecurityContext context;
@@ -75,22 +74,6 @@ public class SelfLoansApiResource {
private final SelfLoansDataValidator dataValidator;
private final GuarantorsApiResource guarantorsApiResource;
- @Autowired
- public SelfLoansApiResource(final PlatformSecurityContext context, final LoansApiResource loansApiResource,
- final LoanTransactionsApiResource loanTransactionsApiResource, final LoanChargesApiResource loanChargesApiResource,
- final AppuserLoansMapperReadService appuserLoansMapperReadService,
- final AppuserClientMapperReadService appUserClientMapperReadService, final SelfLoansDataValidator dataValidator,
- final GuarantorsApiResource guarantorsApiResource) {
- this.context = context;
- this.loansApiResource = loansApiResource;
- this.loanTransactionsApiResource = loanTransactionsApiResource;
- this.loanChargesApiResource = loanChargesApiResource;
- this.appuserLoansMapperReadService = appuserLoansMapperReadService;
- this.appUserClientMapperReadService = appUserClientMapperReadService;
- this.dataValidator = dataValidator;
- this.guarantorsApiResource = guarantorsApiResource;
- }
-
@GET
@Path("{loanId}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java
index 857505546..23176b5c3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/pockets/api/PocketApiResource.java
@@ -35,6 +35,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -43,15 +44,12 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.portfolio.self.pockets.service.PocketAccountMappingReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/pockets")
+@Path("/v1/self/pockets")
@Component
-@Scope("singleton")
-
@Tag(name = "Pocket", description = "")
+@RequiredArgsConstructor
public class PocketApiResource {
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
@@ -59,16 +57,6 @@ public class PocketApiResource {
private final DefaultToApiJsonSerializer toApiJsonSerializer;
private final PocketAccountMappingReadPlatformService pocketAccountMappingReadPlatformService;
- @SuppressWarnings("rawtypes")
- @Autowired
- public PocketApiResource(PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final DefaultToApiJsonSerializer toApiJsonSerializer,
- final PocketAccountMappingReadPlatformService pocketAccountMappingReadPlatformService) {
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.pocketAccountMappingReadPlatformService = pocketAccountMappingReadPlatformService;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfLoanProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfLoanProductsApiResource.java
index 8eab22e15..38b4e5565 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfLoanProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfLoanProductsApiResource.java
@@ -29,16 +29,14 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.portfolio.loanaccount.api.LoanApiConstants;
import org.apache.fineract.portfolio.loanproduct.api.LoanProductsApiResource;
import org.apache.fineract.portfolio.self.client.service.AppuserClientMapperReadService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/loanproducts")
+@Path("/v1/self/loanproducts")
@Component
-@Scope("singleton")
@Tag(name = "Self Loan Products", description = "A Loan product is a template that is used when creating a loan. Much of the template definition can be overridden during loan creation.\n"
+ "\n" + "Field Descriptions\n" + "name\n" + "Name associated with loan product on system.\n" + "shortName\n"
+ "Short name associated with a loan product. \n"
@@ -115,19 +113,12 @@ import org.springframework.stereotype.Component;
+ "Example Values:1=Calculate till pre closure date, 2=Calculate till rest frequency date\n" + "isArrearsBasedOnOriginalSchedule\n"
+ "If Specified as true, arrears will be identified based on original schedule.\n" + "allowAttributeOverrides\n"
+ "Specifies if select attributes may be overridden for individual loan accounts.")
+@RequiredArgsConstructor
public class SelfLoanProductsApiResource {
private final LoanProductsApiResource loanProductsApiResource;
private final AppuserClientMapperReadService appUserClientMapperReadService;
- @Autowired
- public SelfLoanProductsApiResource(final LoanProductsApiResource loanProductsApiResource,
- final AppuserClientMapperReadService appUserClientMapperReadService) {
- this.loanProductsApiResource = loanProductsApiResource;
- this.appUserClientMapperReadService = appUserClientMapperReadService;
-
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfSavingsProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfSavingsProductsApiResource.java
index b77dbfc58..54127149e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfSavingsProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfSavingsProductsApiResource.java
@@ -29,30 +29,21 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.portfolio.savings.SavingsApiConstants;
import org.apache.fineract.portfolio.savings.api.SavingsProductsApiResource;
import org.apache.fineract.portfolio.self.client.service.AppuserClientMapperReadService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/savingsproducts")
+@Path("/v1/self/savingsproducts")
@Component
-@Scope("singleton")
@Tag(name = "Self Savings Products", description = "")
+@RequiredArgsConstructor
public class SelfSavingsProductsApiResource {
private final SavingsProductsApiResource savingsProductsApiResource;
private final AppuserClientMapperReadService appUserClientMapperReadService;
- @Autowired
- public SelfSavingsProductsApiResource(final SavingsProductsApiResource savingsProductsApiResource,
- final AppuserClientMapperReadService appUserClientMapperReadService) {
- this.savingsProductsApiResource = savingsProductsApiResource;
- this.appUserClientMapperReadService = appUserClientMapperReadService;
-
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfShareProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfShareProductsApiResource.java
index 895074150..b929e773b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfShareProductsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/products/api/SelfShareProductsApiResource.java
@@ -29,30 +29,21 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.portfolio.accounts.constants.ShareAccountApiConstants;
import org.apache.fineract.portfolio.products.api.ProductsApiResource;
import org.apache.fineract.portfolio.self.client.service.AppuserClientMapperReadService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/products/share")
+@Path("/v1/self/products/share")
@Component
-@Scope("singleton")
@Tag(name = "Self Share Products", description = "")
+@RequiredArgsConstructor
public class SelfShareProductsApiResource {
private final ProductsApiResource productsApiResource;
private final AppuserClientMapperReadService appUserClientMapperReadService;
- @Autowired
- public SelfShareProductsApiResource(final ProductsApiResource productsApiResource,
- final AppuserClientMapperReadService appUserClientMapperReadService) {
- this.productsApiResource = productsApiResource;
- this.appUserClientMapperReadService = appUserClientMapperReadService;
-
- }
-
@GET
@Path("{productId}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/api/SelfServiceRegistrationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/api/SelfServiceRegistrationApiResource.java
index 5eecb309e..e32cb56c9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/api/SelfServiceRegistrationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/registration/api/SelfServiceRegistrationApiResource.java
@@ -24,32 +24,23 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
import org.apache.fineract.portfolio.self.registration.SelfServiceApiConstants;
import org.apache.fineract.portfolio.self.registration.service.SelfServiceRegistrationWritePlatformService;
import org.apache.fineract.useradministration.domain.AppUser;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/registration")
+@Path("/v1/self/registration")
@Component
-@Scope("singleton")
-
@Tag(name = "Self Service Registration", description = "")
+@RequiredArgsConstructor
public class SelfServiceRegistrationApiResource {
private final SelfServiceRegistrationWritePlatformService selfServiceRegistrationWritePlatformService;
private final DefaultToApiJsonSerializer<AppUser> toApiJsonSerializer;
- @Autowired
- public SelfServiceRegistrationApiResource(final SelfServiceRegistrationWritePlatformService selfServiceRegistrationWritePlatformService,
- final DefaultToApiJsonSerializer<AppUser> toApiJsonSerializer) {
- this.selfServiceRegistrationWritePlatformService = selfServiceRegistrationWritePlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- }
-
@POST
@Produces({ MediaType.APPLICATION_JSON })
public String createSelfServiceRegistrationRequest(final String apiRequestBodyAsJson) {
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResource.java
index 6ce6fea9b..c5882cecf 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/runreport/SelfRunReportApiResource.java
@@ -34,15 +34,13 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.dataqueries.api.RunreportsApiResource;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/runreports")
+@Path("/v1/self/runreports")
@Component
-@Scope("singleton")
@Tag(name = "Self Run Report", description = "This resource allows you to run and receive output from pre-defined Apache Fineract reports.\n"
+ "\n"
+ "The default output is a JSON formatted \"Generic Resultset\". The Generic Resultset contains Column Heading as well as Data information. However, you can export to CSV format by simply adding \"&exportCSV=true\" to the end of your URL.\n"
@@ -52,17 +50,12 @@ import org.springframework.stereotype.Component;
+ "The Apache Fineract reference application uses a JQuery plugin called stretchyreporting which, itself, uses this reports resource to provide a pretty flexible reporting User Interface (UI).\n"
+ "\n" + "ARGUMENTS\n"
+ "R_'parameter names' ... optional, No defaults The number and names of the parameters depend on the specific report and how it has been configured. R_officeId is an example parameter name.Note: the prefix R_ stands for ReportinggenericResultSetoptional, defaults to true If 'true' an optimised JSON format is returned suitable for tabular display of data. If 'false' a simple JSON format is returned. parameterType optional, The only valid value is 'true'. If any other value is pro [...]
+@RequiredArgsConstructor
public class SelfRunReportApiResource {
private final PlatformSecurityContext context;
private final RunreportsApiResource runreportsApiResource;
- @Autowired
- public SelfRunReportApiResource(final PlatformSecurityContext context, final RunreportsApiResource runreportsApiResource) {
- this.context = context;
- this.runreportsApiResource = runreportsApiResource;
- }
-
@GET
@Path("{reportName}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java
index 7d71b6078..4cd2292a9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/savings/api/SelfSavingsApiResource.java
@@ -39,6 +39,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.client.exception.ClientNotFoundException;
import org.apache.fineract.portfolio.savings.api.SavingsAccountChargesApiResource;
@@ -50,15 +51,12 @@ import org.apache.fineract.portfolio.self.savings.data.SelfSavingsAccountConstan
import org.apache.fineract.portfolio.self.savings.data.SelfSavingsDataValidator;
import org.apache.fineract.portfolio.self.savings.service.AppuserSavingsMapperReadService;
import org.apache.fineract.useradministration.domain.AppUser;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/savingsaccounts")
+@Path("/v1/self/savingsaccounts")
@Component
-@Scope("singleton")
-
@Tag(name = "Self Savings Account", description = "")
+@RequiredArgsConstructor
public class SelfSavingsApiResource {
private final PlatformSecurityContext context;
@@ -69,21 +67,6 @@ public class SelfSavingsApiResource {
private final SelfSavingsDataValidator dataValidator;
private final AppuserClientMapperReadService appUserClientMapperReadService;
- @Autowired
- public SelfSavingsApiResource(final PlatformSecurityContext context, final SavingsAccountsApiResource savingsAccountsApiResource,
- final SavingsAccountChargesApiResource savingsAccountChargesApiResource,
- final SavingsAccountTransactionsApiResource savingsAccountTransactionsApiResource,
- final AppuserSavingsMapperReadService appuserSavingsMapperReadService, final SelfSavingsDataValidator dataValidator,
- final AppuserClientMapperReadService appUserClientMapperReadService) {
- this.context = context;
- this.savingsAccountsApiResource = savingsAccountsApiResource;
- this.savingsAccountChargesApiResource = savingsAccountChargesApiResource;
- this.savingsAccountTransactionsApiResource = savingsAccountTransactionsApiResource;
- this.appuserSavingsMapperReadService = appuserSavingsMapperReadService;
- this.dataValidator = dataValidator;
- this.appUserClientMapperReadService = appUserClientMapperReadService;
- }
-
@GET
@Path("{accountId}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java
index bb881048e..38e7dceba 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfAuthenticationApiResource.java
@@ -30,27 +30,21 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.security.api.AuthenticationApiResource;
import org.apache.fineract.infrastructure.security.api.AuthenticationApiResourceSwagger;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@Component
-@Scope("singleton")
@ConditionalOnProperty("fineract.security.basicauth.enabled")
-@Path("/self/authentication")
+@Path("/v1/self/authentication")
@Tag(name = "Self Authentication", description = "Authenticates the credentials provided and returns the set roles and permissions allowed")
+@RequiredArgsConstructor
public class SelfAuthenticationApiResource {
private final AuthenticationApiResource authenticationApiResource;
- @Autowired
- public SelfAuthenticationApiResource(final AuthenticationApiResource authenticationApiResource) {
- this.authenticationApiResource = authenticationApiResource;
- }
-
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java
index 76fff75be..7612b978a 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserApiResource.java
@@ -35,19 +35,19 @@ import java.util.Map;
import java.util.Set;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.useradministration.api.UsersApiResource;
import org.apache.fineract.useradministration.domain.AppUser;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-@Path("/self/user")
+@Path("/v1/self/user")
@Component
-
@Tag(name = "Self User", description = "")
+@RequiredArgsConstructor
public class SelfUserApiResource {
private final UsersApiResource usersApiResource;
@@ -55,15 +55,6 @@ public class SelfUserApiResource {
private final FromJsonHelper fromApiJsonHelper;
private static final Set<String> SUPPORTED_PARAMETERS = new HashSet<>(Arrays.asList("password", "repeatPassword"));
- @Autowired
- public SelfUserApiResource(final UsersApiResource usersApiResource, final PlatformSecurityContext context,
- final FromJsonHelper fromApiJsonHelper) {
-
- this.usersApiResource = usersApiResource;
- this.context = context;
- this.fromApiJsonHelper = fromApiJsonHelper;
- }
-
@PUT
@Operation(summary = "Update User", description = "This API can be used by Self Service user to update their own user information. Currently, \"password\" and \"repeatPassword\" are the only parameters accepted.")
@RequestBody(required = true, content = @Content(schema = @Schema(implementation = SelfUserApiResourceSwagger.PutSelfUserRequest.class)))
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResource.java
index 79e431df4..da04a6753 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/security/api/SelfUserDetailsApiResource.java
@@ -28,27 +28,20 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.security.api.UserDetailsApiResource;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/self/userdetails")
+@Path("/v1/self/userdetails")
@Component
@ConditionalOnProperty("fineract.security.oauth.enabled")
-@Scope("singleton")
-
@Tag(name = "Self User Details", description = "")
+@RequiredArgsConstructor
public class SelfUserDetailsApiResource {
private final UserDetailsApiResource userDetailsApiResource;
- @Autowired
- public SelfUserDetailsApiResource(final UserDetailsApiResource userDetailsApiResource) {
- this.userDetailsApiResource = userDetailsApiResource;
- }
-
@GET
@Produces({ MediaType.APPLICATION_JSON })
@Operation(summary = "Fetch authenticated user details", description = "Checks the Authentication and returns the set roles and permissions allowed\n\n"
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java
index ddf12917f..a5d5eac39 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/shareaccounts/api/SelfShareAccountsApiResource.java
@@ -62,7 +62,7 @@ import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountReadPlatf
import org.apache.fineract.useradministration.domain.AppUser;
import org.springframework.stereotype.Component;
-@Path("/self/shareaccounts")
+@Path("/v1/self/shareaccounts")
@Component
@Tag(name = "Self Share Accounts", description = "")
@RequiredArgsConstructor
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java
index a87780a1a..f57926421 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfScorecardApiResource.java
@@ -28,36 +28,26 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.client.exception.ClientNotFoundException;
import org.apache.fineract.portfolio.self.client.service.AppuserClientMapperReadService;
import org.apache.fineract.spm.api.ScorecardApiResource;
import org.apache.fineract.spm.data.ScorecardData;
import org.apache.fineract.useradministration.domain.AppUser;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-@Path("/self/surveys/scorecards")
+@Path("/v1/self/surveys/scorecards")
@Component
-@Scope("singleton")
-
@Tag(name = "Self Score Card", description = "")
+@RequiredArgsConstructor
public class SelfScorecardApiResource {
private final PlatformSecurityContext context;
private final ScorecardApiResource scorecardApiResource;
private final AppuserClientMapperReadService appuserClientMapperReadService;
- @Autowired
- public SelfScorecardApiResource(final PlatformSecurityContext securityContext,
- final AppuserClientMapperReadService appuserClientMapperReadService, final ScorecardApiResource scorecardApiResource) {
- this.context = securityContext;
- this.scorecardApiResource = scorecardApiResource;
- this.appuserClientMapperReadService = appuserClientMapperReadService;
- }
-
@GET
@Path("clients/{clientId}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfSpmApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfSpmApiResource.java
index b0d53bd6d..7880512be 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfSpmApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/self/spm/api/SelfSpmApiResource.java
@@ -26,30 +26,22 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.spm.api.SpmApiResource;
import org.apache.fineract.spm.data.SurveyData;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-@Path("/self/surveys")
+@Path("/v1/self/surveys")
@Component
-@Scope("singleton")
-
@Tag(name = "Self Spm", description = "")
+@RequiredArgsConstructor
public class SelfSpmApiResource {
private final PlatformSecurityContext securityContext;
private final SpmApiResource spmApiResource;
- @Autowired
- public SelfSpmApiResource(final PlatformSecurityContext securityContext, final SpmApiResource spmApiResource) {
- this.securityContext = securityContext;
- this.spmApiResource = spmApiResource;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/api/ShareDividendApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/api/ShareDividendApiResource.java
index 9b53495a7..e73c42276 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/api/ShareDividendApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareproducts/api/ShareDividendApiResource.java
@@ -29,6 +29,7 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -43,15 +44,12 @@ import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountDividendData
import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountDividendReadPlatformService;
import org.apache.fineract.portfolio.shareproducts.data.ShareProductDividendPayOutData;
import org.apache.fineract.portfolio.shareproducts.service.ShareProductDividendReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/shareproduct/{productId}/dividend")
+@Path("/v1/shareproduct/{productId}/dividend")
@Component
-@Scope("singleton")
-
@Tag(name = "Self Dividend", description = "")
+@RequiredArgsConstructor
public class ShareDividendApiResource {
public static final String APPROVE = "approve";
@@ -63,21 +61,6 @@ public class ShareDividendApiResource {
private final ShareAccountDividendReadPlatformService shareAccountDividendReadPlatformService;
private final ShareProductDividendReadPlatformService shareProductDividendReadPlatformService;
- @Autowired
- public ShareDividendApiResource(final DefaultToApiJsonSerializer<ShareProductDividendPayOutData> toApiJsonSerializer,
- final PlatformSecurityContext platformSecurityContext,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final DefaultToApiJsonSerializer<ShareAccountDividendData> toApiDividendsJsonSerializer,
- final ShareAccountDividendReadPlatformService shareAccountDividendReadPlatformService,
- final ShareProductDividendReadPlatformService shareProductDividendReadPlatformService) {
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.platformSecurityContext = platformSecurityContext;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.toApiAccountDetailJsonSerializer = toApiDividendsJsonSerializer;
- this.shareAccountDividendReadPlatformService = shareAccountDividendReadPlatformService;
- this.shareProductDividendReadPlatformService = shareProductDividendReadPlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResource.java
index 9ab0ac54a..660d8bdf1 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxComponentApiResource.java
@@ -38,6 +38,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -48,15 +49,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.tax.data.TaxComponentData;
import org.apache.fineract.portfolio.tax.service.TaxReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/taxes/component")
+@Path("/v1/taxes/component")
@Component
-@Scope("singleton")
-
@Tag(name = "Tax Components", description = "This defines the Tax Components")
+@RequiredArgsConstructor
public class TaxComponentApiResource {
private static final String RESOURCE_NAME_FOR_PERMISSIONS = "TAXCOMPONENT";
@@ -67,18 +65,6 @@ public class TaxComponentApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public TaxComponentApiResource(final PlatformSecurityContext context, final TaxReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<TaxComponentData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResource.java
index d16417800..904b12945 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/tax/api/TaxGroupApiResource.java
@@ -38,6 +38,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -48,15 +49,12 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.tax.data.TaxGroupData;
import org.apache.fineract.portfolio.tax.service.TaxReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/taxes/group")
+@Path("/v1/taxes/group")
@Component
-@Scope("singleton")
-
@Tag(name = "Tax Group", description = "This defines the Tax Group")
+@RequiredArgsConstructor
public class TaxGroupApiResource {
private static final String RESOURCE_NAME_FOR_PERMISSIONS = "TAXGROUP";
@@ -67,17 +65,6 @@ public class TaxGroupApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public TaxGroupApiResource(final PlatformSecurityContext context, final TaxReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<TaxGroupData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java
index d3f9a99fd..7aca90bf4 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/spm/api/LookupTableApiResource.java
@@ -35,6 +35,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.spm.data.LookupTableData;
import org.apache.fineract.spm.domain.LookupTable;
@@ -44,30 +45,19 @@ import org.apache.fineract.spm.exception.SurveyNotFoundException;
import org.apache.fineract.spm.service.LookupTableService;
import org.apache.fineract.spm.service.SpmService;
import org.apache.fineract.spm.util.LookupTableMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-@Path("/surveys/{surveyId}/lookuptables")
+@Path("/v1/surveys/{surveyId}/lookuptables")
@Component
-@Scope("singleton")
@Tag(name = "SPM API - LookUp Table", description = "The Apache Fineract SPM API provides the ability to create custom surveys to collect social performance measurentment data or any additional questionnaire a financial institute want to collect.")
+@RequiredArgsConstructor
public class LookupTableApiResource {
private final PlatformSecurityContext securityContext;
private final SpmService spmService;
private final LookupTableService lookupTableService;
- @Autowired
- public LookupTableApiResource(final PlatformSecurityContext securityContext, final SpmService spmService,
- final LookupTableService lookupTableService) {
-
- this.securityContext = securityContext;
- this.spmService = spmService;
- this.lookupTableService = lookupTableService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/spm/api/ScorecardApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/spm/api/ScorecardApiResource.java
index 329d99ccc..34f137907 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/spm/api/ScorecardApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/spm/api/ScorecardApiResource.java
@@ -34,6 +34,7 @@ import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.client.domain.Client;
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
@@ -45,16 +46,13 @@ import org.apache.fineract.spm.service.ScorecardService;
import org.apache.fineract.spm.service.SpmService;
import org.apache.fineract.spm.util.ScorecardMapper;
import org.apache.fineract.useradministration.domain.AppUser;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-@Path("/surveys/scorecards")
+@Path("/v1/surveys/scorecards")
@Component
-@Scope("singleton")
-
@Tag(name = "Score Card", description = "")
+@RequiredArgsConstructor
public class ScorecardApiResource {
private final PlatformSecurityContext securityContext;
@@ -63,17 +61,6 @@ public class ScorecardApiResource {
private final ClientRepositoryWrapper clientRepositoryWrapper;
private final ScorecardReadPlatformService scorecardReadPlatformService;
- @Autowired
- public ScorecardApiResource(final PlatformSecurityContext securityContext, final SpmService spmService,
- final ScorecardService scorecardService, final ClientRepositoryWrapper clientRepositoryWrapper,
- final ScorecardReadPlatformService scorecardReadPlatformService) {
- this.securityContext = securityContext;
- this.spmService = spmService;
- this.scorecardService = scorecardService;
- this.clientRepositoryWrapper = clientRepositoryWrapper;
- this.scorecardReadPlatformService = scorecardReadPlatformService;
- }
-
@GET
@Path("{surveyId}")
@Consumes({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/spm/api/SpmApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/spm/api/SpmApiResource.java
index 539ab3552..33af3a058 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/spm/api/SpmApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/spm/api/SpmApiResource.java
@@ -39,33 +39,25 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.spm.data.SurveyData;
import org.apache.fineract.spm.domain.Survey;
import org.apache.fineract.spm.service.SpmService;
import org.apache.fineract.spm.util.SurveyMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-@Path("/surveys")
+@Path("/v1/surveys")
@Component
-@Scope("singleton")
-
@Tag(name = "Spm-Surveys", description = "")
+@RequiredArgsConstructor
public class SpmApiResource {
private final PlatformSecurityContext securityContext;
private final SpmService spmService;
- @Autowired
- public SpmApiResource(final PlatformSecurityContext securityContext, final SpmService spmService) {
- this.securityContext = securityContext;
- this.spmService = spmService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResource.java
index 4ba4ef5c8..9637d95c7 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/template/api/TemplatesApiResource.java
@@ -47,6 +47,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -61,21 +62,18 @@ import org.apache.fineract.template.domain.TemplateEntity;
import org.apache.fineract.template.domain.TemplateType;
import org.apache.fineract.template.service.TemplateDomainService;
import org.apache.fineract.template.service.TemplateMergeService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/templates")
+@Path("/v1/templates")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
@Component
-@Scope("singleton")
-
@Tag(name = "User Generated Documents", description = "User Generated Documents(alternatively, Templates) are used for end-user features such as custom user defined document generation (AKA UGD). They are based on {{ moustache }} templates. Think of them as a sort of built-in \"mail merge\" functionality.\n"
+ "\n"
+ "User Generated Documents (and other types of templates) can aggregate data from several Apache Fineract back-end API calls via mappers. Mappers can even access non-Apache Fineract REST services from other servers. UGDs can render such data in tables, show images, etc. TBD: Please have a look at some of the Example UGDs included in Apache Fineract (or the Wiki page, for now.).\n"
+ "\n"
+ "UGDs can be assigned to an entity like client or loan and be of a type like Document or SMS. The entity and type of a UGD is only there for the convenience of user agents (UIs), in order to know where to show UGDs for the user (i.e. which tab). The Template Engine back-end runner does not actually need this metadata.")
+@RequiredArgsConstructor
public class TemplatesApiResource {
public static final String ID = "id";
@@ -94,22 +92,6 @@ public class TemplatesApiResource {
private final TemplateMergeService templateMergeService;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public TemplatesApiResource(final PlatformSecurityContext context, final DefaultToApiJsonSerializer<Template> toApiJsonSerializer,
- final DefaultToApiJsonSerializer<TemplateData> templateDataApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper, final TemplateDomainService templateService,
- final TemplateMergeService templateMergeService,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
-
- this.context = context;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.templateDataApiJsonSerializer = templateDataApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.templateService = templateService;
- this.templateMergeService = templateMergeService;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Operation(summary = "Retrieve all UGDs", description = "Example Requests:\n" + "\n" + "templates\n" + "\n"
+ "It is also possible to get specific UGDs by entity and type:\n" + "\n" + "templates?type=0&entity=0\n"
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResource.java
index 10c656d47..1400319f0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PasswordPreferencesApiResource.java
@@ -36,6 +36,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -46,16 +47,14 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.useradministration.data.PasswordValidationPolicyData;
import org.apache.fineract.useradministration.service.PasswordValidationPolicyReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/" + PasswordPreferencesApiConstants.RESOURCE_NAME)
+@Path("/v1/" + PasswordPreferencesApiConstants.RESOURCE_NAME)
@Component
-@Scope("singleton")
@Tag(name = "Password preferences", description = "This API enables management of password policy for user administration.\n" + "\n"
+ "There is no Apache Fineract functionality for creating a validation policy. The validation policies come pre-installed.\n" + "\n"
+ "Validation policies may be updated")
+@RequiredArgsConstructor
public class PasswordPreferencesApiResource {
private final PlatformSecurityContext context;
@@ -64,19 +63,6 @@ public class PasswordPreferencesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public PasswordPreferencesApiResource(final PlatformSecurityContext context,
- final PasswordValidationPolicyReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<PasswordValidationPolicyData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.passwordValidationPolicyReadPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResource.java
index b5deaa027..3bfd434f6 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/PermissionsApiResource.java
@@ -39,6 +39,7 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -49,16 +50,14 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.useradministration.data.PermissionData;
import org.apache.fineract.useradministration.service.PermissionReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/permissions")
+@Path("/v1/permissions")
@Component
-@Scope("singleton")
@Tag(name = "Permissions", description = "An API capability to support management of application permissions for user administration.\n"
+ "\n" + "There is no Apache Fineract functionality for creating or deleting permissions. Permissions come pre-installed.\n" + "\n"
+ "Permissions are not updated, except in the case of enabling or disabling non-read transactions for Maker Checker functionality")
+@RequiredArgsConstructor
public class PermissionsApiResource {
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
@@ -71,17 +70,6 @@ public class PermissionsApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public PermissionsApiResource(final PlatformSecurityContext context, final PermissionReadPlatformService readPlatformService,
- final DefaultToApiJsonSerializer<PermissionData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.permissionReadPlatformService = readPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResource.java
index 39abd0bca..c5fc03449 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/RolesApiResource.java
@@ -44,6 +44,7 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
@@ -58,14 +59,12 @@ import org.apache.fineract.useradministration.data.RoleData;
import org.apache.fineract.useradministration.data.RolePermissionsData;
import org.apache.fineract.useradministration.service.PermissionReadPlatformService;
import org.apache.fineract.useradministration.service.RoleReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/roles")
+@Path("/v1/roles")
@Component
-@Scope("singleton")
@Tag(name = "Roles", description = "An API capability to support management of application roles for user administration.")
+@RequiredArgsConstructor
public class RolesApiResource {
public static final String ID = "id";
@@ -96,22 +95,6 @@ public class RolesApiResource {
private final ApiRequestParameterHelper apiRequestParameterHelper;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- @Autowired
- public RolesApiResource(final PlatformSecurityContext context, final RoleReadPlatformService readPlatformService,
- final PermissionReadPlatformService permissionReadPlatformService,
- final DefaultToApiJsonSerializer<RoleData> toApiJsonSerializer,
- final DefaultToApiJsonSerializer<RolePermissionsData> permissionsToApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
- this.context = context;
- this.roleReadPlatformService = readPlatformService;
- this.permissionReadPlatformService = permissionReadPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.permissionsToApiJsonSerializer = permissionsToApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- }
-
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
diff --git a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResource.java
index 3ba7d33fd..ccfa04b4b 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/useradministration/api/UsersApiResource.java
@@ -45,6 +45,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import lombok.RequiredArgsConstructor;
import org.apache.fineract.commands.domain.CommandWrapper;
import org.apache.fineract.commands.service.CommandWrapperBuilder;
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
@@ -63,15 +64,12 @@ import org.apache.fineract.useradministration.data.AppUserData;
import org.apache.fineract.useradministration.service.AppUserReadPlatformService;
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
import org.glassfish.jersey.media.multipart.FormDataParam;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/users")
+@Path("/v1/users")
@Component
-@Scope("singleton")
-
@Tag(name = "Users", description = "An API capability to support administration of application users.")
+@RequiredArgsConstructor
public class UsersApiResource {
/**
@@ -91,23 +89,6 @@ public class UsersApiResource {
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
private final BulkImportWorkbookService bulkImportWorkbookService;
- @Autowired
- public UsersApiResource(final PlatformSecurityContext context, final AppUserReadPlatformService readPlatformService,
- final OfficeReadPlatformService officeReadPlatformService, final DefaultToApiJsonSerializer<AppUserData> toApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper,
- final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
- final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService,
- final BulkImportWorkbookService bulkImportWorkbookService) {
- this.context = context;
- this.readPlatformService = readPlatformService;
- this.officeReadPlatformService = officeReadPlatformService;
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
- this.bulkImportWorkbookService = bulkImportWorkbookService;
- }
-
@GET
@Operation(summary = "Retrieve list of users", description = "Example Requests:\n" + "\n" + "users\n" + "\n" + "\n"
+ "users?fields=id,username,email,officeName")
diff --git a/fineract-provider/src/test/java/org/apache/fineract/AbstractSpringTest.java b/fineract-provider/src/test/java/org/apache/fineract/AbstractSpringTest.java
new file mode 100644
index 000000000..eef3ccd03
--- /dev/null
+++ b/fineract-provider/src/test/java/org/apache/fineract/AbstractSpringTest.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract;
+
+import org.apache.fineract.infrastructure.core.service.ThreadLocalContextUtil;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.TestPropertySource;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+import org.springframework.test.context.web.WebAppConfiguration;
+
+@ExtendWith(SpringExtension.class)
+@TestPropertySource("classpath:application-test.properties")
+@WebAppConfiguration
+@ContextConfiguration(classes = TestConfiguration.class)
+public class AbstractSpringTest {
+
+ @BeforeAll
+ public static void cleanupBeforeClass() {
+ cleanupThreadLocals();
+ }
+
+ @BeforeEach
+ public void cleanupBeforeEach() {
+ cleanupThreadLocals();
+ }
+
+ private static void cleanupThreadLocals() {
+ ThreadLocalContextUtil.reset();
+ }
+}
diff --git a/fineract-provider/src/test/java/org/apache/fineract/batch/command/CommandStrategyProviderTest.java b/fineract-provider/src/test/java/org/apache/fineract/batch/command/CommandStrategyProviderTest.java
index a4c7f9bf0..e9e9a1390 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/batch/command/CommandStrategyProviderTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/batch/command/CommandStrategyProviderTest.java
@@ -208,7 +208,7 @@ public class CommandStrategyProviderTest {
*/
@ParameterizedTest
@MethodSource("provideCommandStrategies")
- public void testGetCommandStrategySuccess(final String url, final String httpMethod, final String beanName,
+ public void testGetCommandStrategySuccess_OldUrls(final String url, final String httpMethod, final String beanName,
final CommandStrategy commandStrategy) {
final ApplicationContext applicationContext = mock(ApplicationContext.class);
final CommandStrategyProvider commandStrategyProvider = new CommandStrategyProvider(applicationContext);
@@ -217,6 +217,31 @@ public class CommandStrategyProviderTest {
assertEquals(commandStrategy, result);
}
+ /**
+ * Tests {@link CommandStrategyProvider#getCommandStrategy} for success scenarios.
+ *
+ * @param url
+ * the resource URL
+ * @param httpMethod
+ * the resource HTTP method
+ * @param beanName
+ * the context bean name
+ * @param commandStrategy
+ * the command strategy
+ */
+ @ParameterizedTest
+ @MethodSource("provideCommandStrategies")
+ public void testGetCommandStrategySuccess_VersionedUrls(final String url, final String httpMethod, final String beanName,
+ final CommandStrategy commandStrategy) {
+ String versionedUrl = "v1/" + url;
+ final ApplicationContext applicationContext = mock(ApplicationContext.class);
+ final CommandStrategyProvider commandStrategyProvider = new CommandStrategyProvider(applicationContext);
+ when(applicationContext.getBean(beanName)).thenReturn(commandStrategy);
+ final CommandStrategy result = commandStrategyProvider
+ .getCommandStrategy(CommandContext.resource(versionedUrl).method(httpMethod).build());
+ assertEquals(commandStrategy, result);
+ }
+
/**
* Command strategy provider for error scenarios.
*
diff --git a/fineract-provider/src/test/java/org/apache/fineract/batch/command/CommandStrategyUtilsTest.java b/fineract-provider/src/test/java/org/apache/fineract/batch/command/CommandStrategyUtilsTest.java
new file mode 100644
index 000000000..6f1394e24
--- /dev/null
+++ b/fineract-provider/src/test/java/org/apache/fineract/batch/command/CommandStrategyUtilsTest.java
@@ -0,0 +1,93 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.batch.command;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.fineract.batch.domain.BatchRequest;
+import org.junit.jupiter.api.Test;
+
+class CommandStrategyUtilsTest {
+
+ @Test
+ public void testRelativeUrlWithoutVersionRemovesV1() {
+ // given
+ BatchRequest request = new BatchRequest();
+ request.setRelativeUrl("v1/clients/123");
+ // when
+ String result = CommandStrategyUtils.relativeUrlWithoutVersion(request);
+ // then
+ assertThat(result).isEqualTo("clients/123");
+ }
+
+ @Test
+ public void testRelativeUrlWithoutVersionRemovesV2() {
+ // given
+ BatchRequest request = new BatchRequest();
+ request.setRelativeUrl("v2/clients/123");
+ // when
+ String result = CommandStrategyUtils.relativeUrlWithoutVersion(request);
+ // then
+ assertThat(result).isEqualTo("clients/123");
+ }
+
+ @Test
+ public void testRelativeUrlWithoutVersionRemovesV12() {
+ // given
+ BatchRequest request = new BatchRequest();
+ request.setRelativeUrl("v12/clients/123");
+ // when
+ String result = CommandStrategyUtils.relativeUrlWithoutVersion(request);
+ // then
+ assertThat(result).isEqualTo("clients/123");
+ }
+
+ @Test
+ public void testRelativeUrlWithoutVersionRemovesV1WhenQueryParamsPresent() {
+ // given
+ BatchRequest request = new BatchRequest();
+ request.setRelativeUrl("v1/clients/123?command=action&something=else");
+ // when
+ String result = CommandStrategyUtils.relativeUrlWithoutVersion(request);
+ // then
+ assertThat(result).isEqualTo("clients/123?command=action&something=else");
+ }
+
+ @Test
+ public void testRelativeUrlWithoutVersionRemovesNothing() {
+ // given
+ BatchRequest request = new BatchRequest();
+ request.setRelativeUrl("clients/123");
+ // when
+ String result = CommandStrategyUtils.relativeUrlWithoutVersion(request);
+ // then
+ assertThat(result).isEqualTo("clients/123");
+ }
+
+ @Test
+ public void testRelativeUrlWithoutVersionRemovesNothingWhenQueryParamsPresent() {
+ // given
+ BatchRequest request = new BatchRequest();
+ request.setRelativeUrl("clients/123?command=action&something=else");
+ // when
+ String result = CommandStrategyUtils.relativeUrlWithoutVersion(request);
+ // then
+ assertThat(result).isEqualTo("clients/123?command=action&something=else");
+ }
+}
diff --git a/fineract-provider/src/test/java/org/apache/fineract/batch/command/internal/CreateTransactionLoanCommandStrategyTest.java b/fineract-provider/src/test/java/org/apache/fineract/batch/command/internal/CreateTransactionLoanCommandStrategyTest.java
index 29636669f..8e46323bc 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/batch/command/internal/CreateTransactionLoanCommandStrategyTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/batch/command/internal/CreateTransactionLoanCommandStrategyTest.java
@@ -75,7 +75,7 @@ public class CreateTransactionLoanCommandStrategyTest {
private BatchRequest getBatchRequest(final Long loanId, final String command) {
final BatchRequest br = new BatchRequest();
- String relativeUrl = "loans/" + loanId + "/transactions?command=" + command;
+ String relativeUrl = "v1/loans/" + loanId + "/transactions?command=" + command;
br.setRequestId(Long.valueOf(RandomStringUtils.randomNumeric(5)));
br.setRelativeUrl(relativeUrl);
diff --git a/fineract-provider/src/test/java/org/apache/fineract/batch/command/internal/GetLoanByIdCommandStrategyTest.java b/fineract-provider/src/test/java/org/apache/fineract/batch/command/internal/GetLoanByIdCommandStrategyTest.java
index 38eddf866..1e93abe46 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/batch/command/internal/GetLoanByIdCommandStrategyTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/batch/command/internal/GetLoanByIdCommandStrategyTest.java
@@ -98,7 +98,7 @@ public class GetLoanByIdCommandStrategyTest {
private BatchRequest getBatchRequest(final Long loanId, final String associations, final String exclude, final String fields) {
final BatchRequest br = new BatchRequest();
- String relativeUrl = "loans/" + loanId;
+ String relativeUrl = "v1/loans/" + loanId;
Set<String> queryParams = new HashSet<>();
if (associations != null) {
diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/config/ApiVerificationTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/config/ApiVerificationTest.java
new file mode 100644
index 000000000..d8ea651b2
--- /dev/null
+++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/core/config/ApiVerificationTest.java
@@ -0,0 +1,97 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.infrastructure.core.config;
+
+import java.util.Set;
+import java.util.stream.Collectors;
+import javax.ws.rs.Path;
+import org.apache.fineract.AbstractSpringTest;
+import org.assertj.core.api.SoftAssertions;
+import org.glassfish.jersey.server.model.Resource;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.annotation.AnnotationUtils;
+import org.springframework.util.ClassUtils;
+
+public class ApiVerificationTest extends AbstractSpringTest {
+
+ @Autowired
+ private JerseyConfig jerseyConfig;
+
+ @Test
+ public void testAllApiClassesAreNamedAsApiResource() {
+ Set<Class<?>> registeredClasses = jerseyConfig.getClasses();
+
+ SoftAssertions assertions = new SoftAssertions();
+ registeredClasses.stream().filter(this::isApi).forEach(apiClass -> verifyApiNaming(apiClass, assertions));
+ assertions.assertAll();
+ }
+
+ private void verifyApiNaming(Class<?> apiClass, SoftAssertions assertions) {
+ String apiClassName = ClassUtils.getUserClass(apiClass).getName();
+ String msg = "API class '%s' should have the postfix 'ApiResource'".formatted(apiClassName);
+ assertions.assertThat(apiClassName).as(msg).endsWith("ApiResource");
+ }
+
+ @Test
+ public void testAllApisAreVersioned() {
+ Set<Class<?>> registeredClasses = jerseyConfig.getClasses();
+
+ SoftAssertions assertions = new SoftAssertions();
+ registeredClasses.stream().filter(this::isApi).forEach(apiClass -> verifyApiIsVersioned(apiClass, assertions));
+ assertions.assertAll();
+ }
+
+ private boolean isApi(Class<?> c) {
+ return getPathAnnotation(c) != null;
+ }
+
+ private Path getPathAnnotation(Class<?> c) {
+ return AnnotationUtils.findAnnotation(c, Path.class);
+ }
+
+ private void verifyApiIsVersioned(Class<?> apiClass, SoftAssertions assertions) {
+ Resource apiResource = Resource.from(apiClass);
+ String basePath = apiResource.getPath();
+ Set<String> paths = apiResource.getChildResources() //
+ .stream() //
+ .map(Resource::getPath) //
+ .map(cPath -> normalizePath(basePath, cPath)) //
+ .collect(Collectors.toSet()); //
+ paths.add(normalizePath(basePath, null));
+ paths.forEach(fullPath -> {
+ String msg = "%s has a non versioned API on path %s".formatted(apiClass, fullPath);
+ assertions.assertThat(fullPath).as(msg).matches("^/(v[1-9][0-9]*/).*$");
+ });
+ }
+
+ private String normalizePath(String prefix, String path) {
+ String basePath = prefix;
+ if (!basePath.startsWith("/")) {
+ basePath = "/" + basePath;
+ }
+ if (path == null) {
+ return basePath;
+ }
+ if (basePath.endsWith("/")) {
+ return path.startsWith("/") ? basePath + path.substring(1) : basePath + path;
+ }
+ return path.startsWith("/") ? basePath + path : basePath + "/" + path;
+ }
+}
diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/instancemode/filter/FineractInstanceModeApiFilterTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/instancemode/filter/FineractInstanceModeApiFilterTest.java
index ad20c1693..60d3b1bf1 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/instancemode/filter/FineractInstanceModeApiFilterTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/instancemode/filter/FineractInstanceModeApiFilterTest.java
@@ -74,7 +74,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, true, true, true);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.GET.name());
- given(request.getPathInfo()).willReturn("/loans");
+ given(request.getPathInfo()).willReturn("/v1/loans");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -87,7 +87,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.GET.name());
- given(request.getPathInfo()).willReturn("/loans");
+ given(request.getPathInfo()).willReturn("/v1/loans");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -115,7 +115,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/loans");
+ given(request.getPathInfo()).willReturn("/v1/loans");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -129,7 +129,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/jobs/1");
+ given(request.getPathInfo()).willReturn("/v1/jobs/1");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -143,7 +143,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.GET.name());
- given(request.getPathInfo()).willReturn("/loans");
+ given(request.getPathInfo()).willReturn("/v1/loans");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -156,7 +156,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/loans");
+ given(request.getPathInfo()).willReturn("/v1/loans");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -169,7 +169,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.PUT.name());
- given(request.getPathInfo()).willReturn("/loans/1");
+ given(request.getPathInfo()).willReturn("/v1/loans/1");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -196,7 +196,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/jobs/1");
+ given(request.getPathInfo()).willReturn("/v1/jobs/1");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -210,7 +210,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true, true);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/jobs/1");
+ given(request.getPathInfo()).willReturn("/v1/jobs/1");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -224,7 +224,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true, true);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.GET.name());
- given(request.getPathInfo()).willReturn("/jobs");
+ given(request.getPathInfo()).willReturn("/v1/jobs");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -251,7 +251,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/batches");
+ given(request.getPathInfo()).willReturn("/v1/batches");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -264,7 +264,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, true, false, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/batches");
+ given(request.getPathInfo()).willReturn("/v1/batches");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -277,7 +277,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true, true);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/batches");
+ given(request.getPathInfo()).willReturn("/v1/batches");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -290,7 +290,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, false, true);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/loans/catch-up");
+ given(request.getPathInfo()).willReturn("/v1/loans/catch-up");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -304,7 +304,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/loans/catch-up");
+ given(request.getPathInfo()).willReturn("/v1/loans/catch-up");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -319,7 +319,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, false, true);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/loans/is-catch-up-running");
+ given(request.getPathInfo()).willReturn("/v1/loans/is-catch-up-running");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -333,7 +333,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, true, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/loans/is-catch-up-running");
+ given(request.getPathInfo()).willReturn("/v1/loans/is-catch-up-running");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -348,7 +348,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false, true);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.GET.name());
- given(request.getPathInfo()).willReturn("/loans/oldest-cob-closed");
+ given(request.getPathInfo()).willReturn("/v1/loans/oldest-cob-closed");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -362,7 +362,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, false, false, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.GET.name());
- given(request.getPathInfo()).willReturn("/loans/oldest-cob-closed");
+ given(request.getPathInfo()).willReturn("/v1/loans/oldest-cob-closed");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -375,7 +375,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(false, false, false, true);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/scheduler?command=start");
+ given(request.getPathInfo()).willReturn("/v1/scheduler?command=start");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
@@ -388,7 +388,7 @@ class FineractInstanceModeApiFilterTest {
FineractProperties.FineractModeProperties modeProperties = InstanceModeMock.createModeProps(true, true, true, false);
given(fineractProperties.getMode()).willReturn(modeProperties);
given(request.getMethod()).willReturn(HttpMethod.POST.name());
- given(request.getPathInfo()).willReturn("/scheduler?command=start");
+ given(request.getPathInfo()).willReturn("/v1/scheduler?command=start");
// when
underTest.doFilterInternal(request, response, filterChain);
// then
diff --git a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilterTest.java b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilterTest.java
index 5e67a4c39..68e838eab 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilterTest.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/infrastructure/jobs/filter/LoanCOBApiFilterTest.java
@@ -92,33 +92,34 @@ class LoanCOBApiFilterTest {
@Test
void shouldLoanAndExternalMatchToo() {
String externalId = UUID.randomUUID().toString();
- Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/loans/12").matches());
- Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/loans/12?correct=parameter").matches());
- Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/loans/12?correct=parameter").matches());
- Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/rescheduleloans/12").matches());
- Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/rescheduleloans/12?correct=parameter").matches());
- Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/rescheduleloans/12?correct=parameter").matches());
- Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/loans/external-id/" + externalId).matches());
+ Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/loans/12").matches());
+ Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/loans/12?correct=parameter").matches());
+ Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/loans/12?correct=parameter").matches());
+ Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/rescheduleloans/12").matches());
+ Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/rescheduleloans/12?correct=parameter").matches());
+ Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/rescheduleloans/12?correct=parameter").matches());
+ Assertions.assertTrue(LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/loans/external-id/" + externalId).matches());
Assertions.assertTrue(
- LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/loans/external-id/" + externalId + "?additional=parameter").matches());
- Assertions.assertEquals("12", LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/loans/12").replaceAll("$1"));
- Assertions.assertEquals("12", LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/loans/12?correct=parameter").replaceAll("$1"));
- Assertions.assertEquals("12", LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/rescheduleloans/12").replaceAll("$1"));
- Assertions.assertEquals("12", LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/rescheduleloans/12?correct=parameter").replaceAll("$1"));
- Assertions.assertEquals(externalId,
- LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/loans/external-id/" + externalId).replaceAll("$1"));
+ LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/loans/external-id/" + externalId + "?additional=parameter").matches());
+ Assertions.assertEquals("12", LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/loans/12").replaceAll("$1"));
+ Assertions.assertEquals("12", LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/loans/12?correct=parameter").replaceAll("$1"));
+ Assertions.assertEquals("12", LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/rescheduleloans/12").replaceAll("$1"));
+ Assertions.assertEquals("12",
+ LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/rescheduleloans/12?correct=parameter").replaceAll("$1"));
Assertions.assertEquals(externalId,
- LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/loans/external-id/" + externalId + "?additional=parameter").replaceAll("$1"));
+ LoanCOBApiFilter.LOAN_PATH_PATTERN.matcher("/v1/loans/external-id/" + externalId).replaceAll("$1"));
+ Assertions.assertEquals(externalId, LoanCOBApiFilter.LOAN_PATH_PATTERN
+ .matcher("/v1/loans/external-id/" + externalId + "?additional=parameter").replaceAll("$1"));
}
@Test
void shouldGlimAccountMatch() {
- Assertions.assertTrue(LoanCOBApiFilter.LOAN_GLIMACCOUNT_PATH_PATTERN.matcher("/loans/glimAccount/12").matches());
- Assertions
- .assertTrue(LoanCOBApiFilter.LOAN_GLIMACCOUNT_PATH_PATTERN.matcher("/loans/glimAccount/12?additional=parameter").matches());
- Assertions.assertEquals("12", LoanCOBApiFilter.LOAN_GLIMACCOUNT_PATH_PATTERN.matcher("/loans/glimAccount/12").replaceAll("$1"));
+ Assertions.assertTrue(LoanCOBApiFilter.LOAN_GLIMACCOUNT_PATH_PATTERN.matcher("/v1/loans/glimAccount/12").matches());
+ Assertions.assertTrue(
+ LoanCOBApiFilter.LOAN_GLIMACCOUNT_PATH_PATTERN.matcher("/v1/loans/glimAccount/12?additional=parameter").matches());
+ Assertions.assertEquals("12", LoanCOBApiFilter.LOAN_GLIMACCOUNT_PATH_PATTERN.matcher("/v1/loans/glimAccount/12").replaceAll("$1"));
Assertions.assertEquals("12",
- LoanCOBApiFilter.LOAN_GLIMACCOUNT_PATH_PATTERN.matcher("/loans/glimAccount/12?additional=parameter").replaceAll("$1"));
+ LoanCOBApiFilter.LOAN_GLIMACCOUNT_PATH_PATTERN.matcher("/v1/loans/glimAccount/12?additional=parameter").replaceAll("$1"));
}
@Test
@@ -127,7 +128,7 @@ class LoanCOBApiFilterTest {
MockHttpServletResponse response = mock(MockHttpServletResponse.class);
FilterChain filterChain = mock(FilterChain.class);
- given(request.getPathInfo()).willReturn("/jobs/2/inline");
+ given(request.getPathInfo()).willReturn("/v1/jobs/2/inline");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
testObj.doFilterInternal(request, response, filterChain);
@@ -147,7 +148,7 @@ class LoanCOBApiFilterTest {
businessDates.put(BusinessDateType.COB_DATE, businessDate.minusDays(1));
ThreadLocalContextUtil.setBusinessDates(businessDates);
- given(request.getPathInfo()).willReturn("/loans/invalid2LoanId/charges");
+ given(request.getPathInfo()).willReturn("/v1/loans/invalid2LoanId/charges");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(context.authenticatedUser()).willReturn(appUser);
given(fineractProperties.getQuery()).willReturn(fineractQueryProperties);
@@ -167,7 +168,7 @@ class LoanCOBApiFilterTest {
FilterChain filterChain = mock(FilterChain.class);
AppUser appUser = mock(AppUser.class);
- given(request.getPathInfo()).willReturn("/jobs/2/inline");
+ given(request.getPathInfo()).willReturn("/v1/jobs/2/inline");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(context.authenticatedUser()).willReturn(appUser);
given(appUser.isBypassUser()).willReturn(true);
@@ -189,7 +190,7 @@ class LoanCOBApiFilterTest {
businessDates.put(BusinessDateType.COB_DATE, businessDate.minusDays(1));
ThreadLocalContextUtil.setBusinessDates(businessDates);
- given(request.getPathInfo()).willReturn("/loans/2/charges");
+ given(request.getPathInfo()).willReturn("/v1/loans/2/charges");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(loanAccountLockService.isLoanHardLocked(2L)).willReturn(false);
given(loanAccountLockService.isLoanSoftLocked(2L)).willReturn(false);
@@ -217,7 +218,7 @@ class LoanCOBApiFilterTest {
businessDates.put(BusinessDateType.COB_DATE, businessDate.minusDays(1));
ThreadLocalContextUtil.setBusinessDates(businessDates);
String uuid = UUID.randomUUID().toString();
- given(request.getPathInfo()).willReturn("/loans/external-id/" + uuid + "/charges");
+ given(request.getPathInfo()).willReturn("/v1/loans/external-id/" + uuid + "/charges");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(loanAccountLockService.isLoanHardLocked(2L)).willReturn(false);
given(loanAccountLockService.isLoanSoftLocked(2L)).willReturn(false);
@@ -246,7 +247,7 @@ class LoanCOBApiFilterTest {
businessDates.put(BusinessDateType.COB_DATE, businessDate.minusDays(1));
ThreadLocalContextUtil.setBusinessDates(businessDates);
Long resourceId = 123L;
- given(request.getPathInfo()).willReturn("/rescheduleloans/" + resourceId + "/charges");
+ given(request.getPathInfo()).willReturn("/v1/rescheduleloans/" + resourceId + "/charges");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(loanAccountLockService.isLoanHardLocked(2L)).willReturn(false);
given(loanAccountLockService.isLoanSoftLocked(2L)).willReturn(false);
@@ -271,7 +272,7 @@ class LoanCOBApiFilterTest {
FilterChain filterChain = mock(FilterChain.class);
AppUser appUser = mock(AppUser.class);
- given(request.getPathInfo()).willReturn("/loans/2/charges");
+ given(request.getPathInfo()).willReturn("/v1/loans/2/charges");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(loanAccountLockService.isLoanHardLocked(2L)).willReturn(false);
given(loanAccountLockService.isLoanSoftLocked(2L)).willReturn(true);
@@ -298,7 +299,7 @@ class LoanCOBApiFilterTest {
LoanIdAndLastClosedBusinessDate result = mock(LoanIdAndLastClosedBusinessDate.class);
given(result.getId()).willReturn(2L);
- given(request.getPathInfo()).willReturn("/loans/2?command=approve");
+ given(request.getPathInfo()).willReturn("/v1/loans/2?command=approve");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(loanAccountLockService.isLoanHardLocked(2L)).willReturn(false);
given(loanAccountLockService.isLoanSoftLocked(2L)).willReturn(true);
@@ -331,7 +332,7 @@ class LoanCOBApiFilterTest {
LoanIdAndLastClosedBusinessDate result = mock(LoanIdAndLastClosedBusinessDate.class);
given(result.getId()).willReturn(2L);
- given(request.getPathInfo()).willReturn("/loans/2?command=approve");
+ given(request.getPathInfo()).willReturn("/v1/loans/2?command=approve");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(loanAccountLockService.isLoanHardLocked(2L)).willReturn(false);
given(loanAccountLockService.isLoanSoftLocked(2L)).willReturn(false);
@@ -355,7 +356,7 @@ class LoanCOBApiFilterTest {
FilterChain filterChain = mock(FilterChain.class);
AppUser appUser = mock(AppUser.class);
- given(request.getPathInfo()).willReturn("/loans");
+ given(request.getPathInfo()).willReturn("/v1/loans");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(context.authenticatedUser()).willReturn(appUser);
@@ -372,7 +373,7 @@ class LoanCOBApiFilterTest {
FilterChain filterChain = mock(FilterChain.class);
AppUser appUser = mock(AppUser.class);
- given(request.getPathInfo()).willReturn("/loans/catch-up");
+ given(request.getPathInfo()).willReturn("/v1/loans/catch-up");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(context.authenticatedUser()).willReturn(appUser);
@@ -390,7 +391,7 @@ class LoanCOBApiFilterTest {
PrintWriter writer = mock(PrintWriter.class);
AppUser appUser = mock(AppUser.class);
- given(request.getPathInfo()).willReturn("/loans/2/charges");
+ given(request.getPathInfo()).willReturn("/v1/loans/2/charges");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(loanAccountLockService.isLoanHardLocked(2L)).willReturn(true);
given(response.getWriter()).willReturn(writer);
@@ -411,7 +412,7 @@ class LoanCOBApiFilterTest {
Long loanId = 2L;
AppUser appUser = mock(AppUser.class);
- given(request.getPathInfo()).willReturn("/loans/glimAccount/2");
+ given(request.getPathInfo()).willReturn("/v1/loans/glimAccount/2");
given(request.getMethod()).willReturn(HTTPMethods.POST.value());
given(glimAccountInfoRepository.findOneByIsAcceptingChildAndApplicationId(true, BigDecimal.valueOf(2))).willReturn(glimAccount);
given(glimAccount.getChildLoan()).willReturn(Collections.singleton(loan));
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
index 4e4816221..eac30e78f 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/BatchApiTest.java
@@ -2340,7 +2340,7 @@ public class BatchApiTest {
* @see org.apache.fineract.batch.command.internal.ModifyLoanApplicationByExternalIdCommandStrategy
*/
@Test
- public void shoulRetrieveTheProperErrorDuringLockedLoan() {
+ public void shoulRetrieveTheProperErrorDuringLockedLoan_OldRelativePath() {
ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(202).build();
LoanAccountLockHelper loanAccountLockHelper = new LoanAccountLockHelper(this.requestSpec, responseSpec);
final String loanProductJSON = new LoanProductTestBuilder() //
@@ -2415,6 +2415,87 @@ public class BatchApiTest {
Assertions.assertEquals(HttpStatus.SC_CONFLICT, repaymentResponse.get(0).getStatusCode(), "Verify Status Code 409 for Locked Loan");
}
+ /**
+ * Tests that a loan is hard locked and if a repayment triggered in as a batch request, it returns the proper error
+ *
+ * @see org.apache.fineract.batch.command.internal.ModifyLoanApplicationByExternalIdCommandStrategy
+ */
+ @Test
+ public void shoulRetrieveTheProperErrorDuringLockedLoan() {
+ ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(202).build();
+ LoanAccountLockHelper loanAccountLockHelper = new LoanAccountLockHelper(this.requestSpec, responseSpec);
+ final String loanProductJSON = new LoanProductTestBuilder() //
+ .withPrincipal("1000.00") //
+ .withNumberOfRepayments("24") //
+ .withRepaymentAfterEvery("1") //
+ .withRepaymentTypeAsMonth() //
+ .withinterestRatePerPeriod("2") //
+ .withInterestRateFrequencyTypeAsMonths() //
+ .withAmortizationTypeAsEqualPrincipalPayment() //
+ .withInterestTypeAsDecliningBalance() //
+ .currencyDetails("0", "100").build(null);
+
+ final Long applyLoanRequestId = RandomUtils.nextLong(100, 1000);
+ final Long approveLoanRequestId = applyLoanRequestId + 1;
+ final Long disburseLoanRequestId = approveLoanRequestId + 1;
+ final Long getLoanRequestId = disburseLoanRequestId + 1;
+
+ // Create product
+ final Integer productId = new LoanTransactionHelper(this.requestSpec, this.responseSpec).getLoanProductId(loanProductJSON);
+
+ // Create client
+ final Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
+ ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientId);
+
+ final BatchRequest applyLoanRequest = BatchHelper.applyLoanRequestWithClientId(applyLoanRequestId, clientId, productId);
+
+ final BatchRequest approveLoanRequest = BatchHelper.transistionLoanStateByExternalId(approveLoanRequestId, applyLoanRequestId,
+ LocalDate.now(ZoneId.systemDefault()).minusDays(10), "approve");
+
+ final BatchRequest disburseLoanRequest = BatchHelper.transistionLoanStateByExternalId(disburseLoanRequestId, approveLoanRequestId,
+ LocalDate.now(ZoneId.systemDefault()).minusDays(8), "disburse");
+
+ final BatchRequest getLoanRequest = BatchHelper.getLoanByExternalIdRequest(getLoanRequestId, approveLoanRequestId,
+ "associations=all");
+
+ // Create batch requests list
+ final List<BatchRequest> batchRequests = Arrays.asList(applyLoanRequest, approveLoanRequest, disburseLoanRequest, getLoanRequest);
+
+ final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
+
+ final List<BatchResponse> responses = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec, this.responseSpec,
+ jsonifiedRequest);
+
+ Assertions.assertEquals(HttpStatus.SC_OK, responses.get(0).getStatusCode(), "Verify Status Code 200 for Apply Loan");
+ Assertions.assertEquals(HttpStatus.SC_OK, responses.get(1).getStatusCode(), "Verify Status Code 200 for Approve Loan");
+ Assertions.assertEquals(HttpStatus.SC_OK, responses.get(2).getStatusCode(), "Verify Status Code 200 for Disburse Loan");
+ Assertions.assertEquals(HttpStatus.SC_OK, responses.get(3).getStatusCode(), "Verify Status Code 200 for Get Loan");
+
+ final Long loanId = new FromJsonHelper().parse(responses.get(2).getBody()).getAsJsonObject().get("resourceId").getAsLong();
+
+ loanAccountLockHelper.placeSoftLockOnLoanAccount(loanId.intValue(), "LOAN_COB_CHUNK_PROCESSING");
+
+ RequestSpecification requestSpec = UserHelper.getSimpleUserWithoutBypassPermission(this.requestSpec, this.responseSpec);
+
+ // Create a repayment Request
+ final BatchRequest br = new BatchRequest();
+
+ br.setRequestId(1L);
+ br.setRelativeUrl(String.format("v1/loans/" + loanId + "/transactions?command=repayment"));
+ br.setMethod("POST");
+ String dateString = LocalDate.now(ZoneId.systemDefault()).format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
+ br.setBody(String.format(
+ "{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", " + "\"transactionDate\": \"%s\", \"transactionAmount\": \"500\"}",
+ dateString));
+
+ final String jsonifiedRepaymentRequest = BatchHelper.toJsonString(List.of(br));
+
+ final List<BatchResponse> repaymentResponse = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(requestSpec,
+ this.responseSpec, jsonifiedRepaymentRequest);
+
+ Assertions.assertEquals(HttpStatus.SC_CONFLICT, repaymentResponse.get(0).getStatusCode(), "Verify Status Code 409 for Locked Loan");
+ }
+
/**
* Delete datatable
*
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/ImageTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/ImageTest.java
index 0bad4fb36..b2fe6fb37 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/ImageTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/ImageTest.java
@@ -256,13 +256,13 @@ public class ImageTest extends IntegrationTest {
interface ImagesApiWithHeadersForTest extends ImagesApi {
@Headers("Accept: text/plain")
- @GET("{entityType}/{entityId}/images")
+ @GET("v1/{entityType}/{entityId}/images")
Call<ResponseBody> getText(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Query("maxWidth") Integer maxWidth, @retrofit2.http.Query("maxHeight") Integer maxHeight,
@retrofit2.http.Query("output") String output);
@Headers("Accept: application/octet-stream")
- @GET("{entityType}/{entityId}/images")
+ @GET("v1/{entityType}/{entityId}/images")
Call<ResponseBody> getBytes(@retrofit2.http.Path("entityType") String entityType, @retrofit2.http.Path("entityId") Long entityId,
@retrofit2.http.Query("maxWidth") Integer maxWidth, @retrofit2.http.Query("maxHeight") Integer maxHeight,
@retrofit2.http.Query("output") String output);
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/IntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/IntegrationTest.java
index ccebad53e..a60c30dc5 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/IntegrationTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/client/IntegrationTest.java
@@ -62,7 +62,7 @@ public abstract class IntegrationTest {
protected FineractClient fineract() {
if (fineract == null) {
- String url = System.getProperty("fineract.it.url", "https://localhost:8443/fineract-provider/api/v1/");
+ String url = System.getProperty("fineract.it.url", "https://localhost:8443/fineract-provider/api/");
// insecure(true) should *ONLY* ever be used for https://localhost:8443, NOT in real clients!!
fineract = FineractClient.builder().insecure(true).baseURL(url).tenant("default").basicAuth("mifos", "password")
.logging(Level.NONE).build();
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BatchHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BatchHelper.java
index d846fdb44..a533a0eb5 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BatchHelper.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/BatchHelper.java
@@ -158,7 +158,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("clients");
+ br.setRelativeUrl("v1/clients");
br.setMethod("POST");
final String extId;
@@ -189,7 +189,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("clients");
+ br.setRelativeUrl("v1/clients");
br.setMethod("POST");
final String extId;
@@ -221,7 +221,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("clients/$.clientId");
+ br.setRelativeUrl("v1/clients/$.clientId");
br.setMethod("PUT");
br.setReference(reference);
br.setBody("{\"firstname\": \"TestFirstName\", \"lastname\": \"TestLastName\"}");
@@ -269,7 +269,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("loans");
+ br.setRelativeUrl("v1/loans");
br.setMethod("POST");
br.setReference(reference);
String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
@@ -329,7 +329,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("loans");
+ br.setRelativeUrl("v1/loans");
br.setMethod("POST");
String body = String.format("{\"dateFormat\": \"dd MMMM yyyy\", \"locale\": \"en_GB\", \"clientId\": %s, "
@@ -359,7 +359,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("savingsaccounts");
+ br.setRelativeUrl("v1/savingsaccounts");
br.setMethod("POST");
br.setReference(reference);
@@ -383,7 +383,7 @@ public final class BatchHelper {
* @return BatchRequest
*/
public static BatchRequest createChargeByLoanIdRequest(final Long requestId, final Long reference, final Integer chargeId) {
- return createChargeRequest(requestId, reference, "loans/$.loanId/charges", chargeId);
+ return createChargeRequest(requestId, reference, "v1/loans/$.loanId/charges", chargeId);
}
/**
@@ -400,7 +400,7 @@ public final class BatchHelper {
* @return BatchRequest
*/
public static BatchRequest createChargeByLoanExternalIdRequest(final Long requestId, final Long reference, final Integer chargeId) {
- return createChargeRequest(requestId, reference, "loans/external-id/$.externalId/charges", chargeId);
+ return createChargeRequest(requestId, reference, "v1/loans/external-id/$.externalId/charges", chargeId);
}
/**
@@ -450,7 +450,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("loans/$.loanId/charges/$.resourceId?command=adjustment");
+ br.setRelativeUrl("v1/loans/$.loanId/charges/$.resourceId?command=adjustment");
br.setMethod("POST");
br.setReference(reference);
br.setBody("{\"amount\":7.00,\"locale\":\"en\"}");
@@ -479,7 +479,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
br.setRelativeUrl(
- String.format("loans/external-id/%s/charges/external-id/%s?command=adjustment", loanExternalId, chargeExternalId));
+ String.format("v1/loans/external-id/%s/charges/external-id/%s?command=adjustment", loanExternalId, chargeExternalId));
br.setMethod("POST");
br.setReference(reference);
br.setBody("{\"amount\":7.00,\"locale\":\"en\"}");
@@ -498,7 +498,7 @@ public final class BatchHelper {
* @return BatchRequest
*/
public static BatchRequest collectChargesByLoanIdRequest(final Long requestId, final Long reference) {
- return collectChargesRequest(requestId, reference, "loans/$.loanId/charges");
+ return collectChargesRequest(requestId, reference, "v1/loans/$.loanId/charges");
}
/**
@@ -513,7 +513,7 @@ public final class BatchHelper {
* @return BatchRequest
*/
public static BatchRequest collectChargesByLoanExternalIdRequest(final Long requestId, final Long reference) {
- return collectChargesRequest(requestId, reference, "loans/external-id/$.externalId/charges");
+ return collectChargesRequest(requestId, reference, "v1/loans/external-id/$.externalId/charges");
}
/**
@@ -574,7 +574,7 @@ public final class BatchHelper {
* @return the {@link BatchRequest}
*/
public static BatchRequest getChargeByLoanIdChargeId(final Long requestId, final Long reference) {
- return getChargeById(requestId, reference, "loans/$.loanId/charges/$.resourceId");
+ return getChargeById(requestId, reference, "v1/loans/$.loanId/charges/$.resourceId");
}
/**
@@ -591,7 +591,7 @@ public final class BatchHelper {
public static BatchRequest getChargeByLoanExternalIdChargeExternalId(final Long requestId, final Long reference,
final String loanExternalId, final String chargeExternalId) {
return getChargeById(requestId, reference,
- String.format("loans/external-id/%s/charges/external-id/%s", loanExternalId, chargeExternalId));
+ String.format("v1/loans/external-id/%s/charges/external-id/%s", loanExternalId, chargeExternalId));
}
/**
@@ -608,7 +608,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("clients/$.clientId?command=activate");
+ br.setRelativeUrl("v1/clients/$.clientId?command=activate");
br.setReference(reference);
br.setMethod("POST");
br.setBody("{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", \"activationDate\": \"01 March 2011\"}");
@@ -663,7 +663,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("loans/$.loanId?command=approve");
+ br.setRelativeUrl("v1/loans/$.loanId?command=approve");
br.setReference(reference);
br.setMethod("POST");
String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
@@ -677,7 +677,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("loans/$.loanId?command=approveX");
+ br.setRelativeUrl("v1/loans/$.loanId?command=approveX");
br.setReference(reference);
br.setMethod("POST");
String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
@@ -719,7 +719,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("loans/$.loanId?command=disburse");
+ br.setRelativeUrl("v1/loans/$.loanId?command=disburse");
br.setReference(reference);
br.setMethod("POST");
String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
@@ -749,7 +749,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("loans/external-id/$.resourceExternalId?command=" + command);
+ br.setRelativeUrl("v1/loans/external-id/$.resourceExternalId?command=" + command);
br.setReference(reference);
br.setMethod("POST");
String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
@@ -783,6 +783,21 @@ public final class BatchHelper {
return createTransactionRequestWithGivenLoanId(requestId, loanId, "repayment", amount, date);
}
+ public static BatchRequest oldRepayLoanRequestWithGivenLoanId(final Long requestId, final Integer loanId, final String amount,
+ final LocalDate date) {
+ final BatchRequest br = new BatchRequest();
+
+ br.setRequestId(requestId);
+ br.setRelativeUrl(String.format("loans/" + loanId + "/transactions?command=%s", "repayment"));
+ br.setMethod("POST");
+ String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
+ br.setBody(String.format(
+ "{\"locale\": \"en\", \"dateFormat\": \"dd MMMM yyyy\", " + "\"transactionDate\": \"%s\", \"transactionAmount\": %s}",
+ dateString, amount));
+
+ return br;
+ }
+
/**
* Creates and returns a {@link CreateTransactionLoanCommandStrategy} Request with given requestId.
*
@@ -802,7 +817,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl(String.format("loans/$.loanId/transactions?command=%s", transactionCommand));
+ br.setRelativeUrl(String.format("v1/loans/$.loanId/transactions?command=%s", transactionCommand));
br.setMethod("POST");
String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
br.setBody(String.format(
@@ -817,7 +832,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl(String.format("loans/" + loanId + "/transactions?command=%s", transactionCommand));
+ br.setRelativeUrl(String.format("v1/loans/" + loanId + "/transactions?command=%s", transactionCommand));
br.setMethod("POST");
String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
br.setBody(String.format(
@@ -848,7 +863,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl(String.format("loans/external-id/$.externalId/transactions?command=%s", transactionCommand));
+ br.setRelativeUrl(String.format("v1/loans/external-id/$.externalId/transactions?command=%s", transactionCommand));
br.setMethod("POST");
String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
br.setBody(String.format(
@@ -948,7 +963,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl("rescheduleloans");
+ br.setRelativeUrl("v1/rescheduleloans");
br.setMethod("POST");
final LocalDate today = LocalDate.now(ZoneId.systemDefault());
final LocalDate adjustedDueDate = LocalDate.now(ZoneId.systemDefault()).plusDays(40);
@@ -978,7 +993,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl("rescheduleloans/$.resourceId?command=approve");
+ br.setRelativeUrl("v1/rescheduleloans/$.resourceId?command=approve");
br.setMethod("POST");
final LocalDate approvedOnDate = LocalDate.now(ZoneId.systemDefault());
final String approvedOnDateString = approvedOnDate.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
@@ -1020,9 +1035,9 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
String relativeUrl;
if (subResourceId) {
- relativeUrl = "loans/$.loanId/transactions/$.subResourceId";
+ relativeUrl = "v1/loans/$.loanId/transactions/$.subResourceId";
} else {
- relativeUrl = "loans/$.loanId/transactions/$.resourceId";
+ relativeUrl = "v1/loans/$.loanId/transactions/$.resourceId";
}
br.setRequestId(requestId);
@@ -1051,9 +1066,9 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
String relativeUrl;
if (subResourceExternalId) {
- relativeUrl = String.format("loans/external-id/%s/transactions/external-id/$.subResourceExternalId", loanExternalId);
+ relativeUrl = String.format("v1/loans/external-id/%s/transactions/external-id/$.subResourceExternalId", loanExternalId);
} else {
- relativeUrl = String.format("loans/external-id/%s/transactions/external-id/$.resourceExternalId", loanExternalId);
+ relativeUrl = String.format("v1/loans/external-id/%s/transactions/external-id/$.resourceExternalId", loanExternalId);
}
br.setRequestId(requestId);
@@ -1080,7 +1095,7 @@ public final class BatchHelper {
public static BatchRequest getLoanByIdRequest(final Long requestId, final Long reference, final String queryParameter) {
final BatchRequest br = new BatchRequest();
- String relativeUrl = "loans/$.loanId";
+ String relativeUrl = "v1/loans/$.loanId";
if (queryParameter != null) {
relativeUrl = relativeUrl + "?" + queryParameter;
}
@@ -1109,7 +1124,7 @@ public final class BatchHelper {
public static BatchRequest getLoanByExternalIdRequest(final Long requestId, final Long reference, final String queryParameter) {
final BatchRequest br = new BatchRequest();
- String relativeUrl = "loans/external-id/$.resourceExternalId";
+ String relativeUrl = "v1/loans/external-id/$.resourceExternalId";
if (queryParameter != null) {
relativeUrl = relativeUrl + "?" + queryParameter;
}
@@ -1154,7 +1169,7 @@ public final class BatchHelper {
public static BatchRequest getLoanByIdRequest(final Long loanId, final Long requestId, final Long referenceId,
final String queryParameter) {
final BatchRequest br = new BatchRequest();
- String relativeUrl = String.format("loans/%s", loanId);
+ String relativeUrl = String.format("v1/loans/%s", loanId);
if (queryParameter != null) {
relativeUrl = relativeUrl + "?" + queryParameter;
}
@@ -1184,7 +1199,7 @@ public final class BatchHelper {
public static BatchRequest getDatatableByIdRequest(final Long loanId, final String datatableName, final String queryParameter,
final Long referenceId) {
final BatchRequest br = new BatchRequest();
- String relativeUrl = String.format("datatables/%s/%s", datatableName, loanId);
+ String relativeUrl = String.format("v1/datatables/%s/%s", datatableName, loanId);
if (queryParameter != null) {
relativeUrl = relativeUrl + "?" + queryParameter;
}
@@ -1216,7 +1231,7 @@ public final class BatchHelper {
public static BatchRequest getDatatableEntryByIdRequest(final Long loanId, final String datatableName, final String appTableId,
final String queryParameter, final Long referenceId) {
final BatchRequest br = new BatchRequest();
- String relativeUrl = String.format("datatables/%s/%s/%s", datatableName, loanId, appTableId);
+ String relativeUrl = String.format("v1/datatables/%s/%s/%s", datatableName, loanId, appTableId);
if (queryParameter != null) {
relativeUrl = relativeUrl + "?" + queryParameter;
}
@@ -1243,7 +1258,7 @@ public final class BatchHelper {
*/
public static BatchRequest createDatatableEntryRequest(final Long loanId, final String datatableName, final List<String> columnNames) {
final BatchRequest br = new BatchRequest();
- final String relativeUrl = String.format("datatables/%s/%s", datatableName, loanId);
+ final String relativeUrl = String.format("v1/datatables/%s/%s", datatableName, loanId);
final Map<String, Object> datatableEntryMap = new HashMap<>();
datatableEntryMap.putAll(columnNames.stream().collect(Collectors.toMap(v -> v, v -> Utils.randomStringGenerator("VAL_", 3))));
final String datatableEntryRequestJsonString = new Gson().toJson(datatableEntryMap);
@@ -1273,7 +1288,7 @@ public final class BatchHelper {
public static BatchRequest updateDatatableEntryByEntryIdRequest(final Long loanId, final String datatableName,
final Long datatableEntryId, final List<String> columnNames) {
final BatchRequest br = new BatchRequest();
- final String relativeUrl = String.format("datatables/%s/%s/%s", datatableName, loanId, datatableEntryId);
+ final String relativeUrl = String.format("v1/datatables/%s/%s/%s", datatableName, loanId, datatableEntryId);
final Map<String, Object> datatableEntryMap = new HashMap<>();
datatableEntryMap.putAll(columnNames.stream().collect(Collectors.toMap(v -> v, v -> Utils.randomStringGenerator("VAL_", 3))));
final String datatableEntryRequestJsonString = new Gson().toJson(datatableEntryMap);
@@ -1307,7 +1322,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl("loans/$.loanId/transactions/$.resourceId");
+ br.setRelativeUrl("v1/loans/$.loanId/transactions/$.resourceId");
br.setMethod("POST");
String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
br.setBody(String.format(
@@ -1340,7 +1355,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl(String.format("loans/external-id/%s/transactions/external-id/%s", loanExternalId, transactionExternalId));
+ br.setRelativeUrl(String.format("v1/loans/external-id/%s/transactions/external-id/%s", loanExternalId, transactionExternalId));
br.setMethod("POST");
String dateString = date.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
br.setBody(String.format(
@@ -1367,7 +1382,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl("loans/$.loanId/transactions/$.resourceId?command=chargeback");
+ br.setRelativeUrl("v1/loans/$.loanId/transactions/$.resourceId?command=chargeback");
br.setMethod("POST");
br.setBody(String.format("{\"locale\": \"en\", \"transactionAmount\": %s, \"paymentTypeId\": 2}", amount));
@@ -1389,7 +1404,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("loans/$.loanId?command=markAsFraud");
+ br.setRelativeUrl("v1/loans/$.loanId?command=markAsFraud");
br.setMethod("PUT");
br.setReference(reference);
br.setBody("{\"fraud\": \"true\"}");
@@ -1411,7 +1426,7 @@ public final class BatchHelper {
final BatchRequest br = new BatchRequest();
br.setRequestId(requestId);
- br.setRelativeUrl("loans/external-id/$.resourceExternalId?command=markAsFraud");
+ br.setRelativeUrl("v1/loans/external-id/$.resourceExternalId?command=markAsFraud");
br.setMethod("PUT");
br.setReference(reference);
br.setBody("{\"fraud\": \"true\"}");
@@ -1431,7 +1446,7 @@ public final class BatchHelper {
public static BatchRequest queryDatatableEntries(final String datatableName, final String columnName, final String columnValue,
final String columnResult) {
final BatchRequest br = new BatchRequest();
- String relativeUrl = String.format("datatables/%s/query", datatableName);
+ String relativeUrl = String.format("v1/datatables/%s/query", datatableName);
relativeUrl += "?columnFilter=" + columnName + "&" + "valueFilter=" + columnValue + "&" + "resultColumns=" + columnResult;
br.setRequestId(1L);
@@ -1455,7 +1470,7 @@ public final class BatchHelper {
public static BatchRequest updateDatatableEntry(final String datatableName, final String resourceId, final String columnName,
final String columnValue) {
final BatchRequest br = new BatchRequest();
- final String relativeUrl = String.format("datatables/%s/%s", datatableName, resourceId);
+ final String relativeUrl = String.format("v1/datatables/%s/%s", datatableName, resourceId);
final Map<String, Object> datatableEntryMap = new HashMap<>();
datatableEntryMap.put(columnName, columnValue);
final String datatableEntryRequestJsonString = new Gson().toJson(datatableEntryMap);
@@ -1483,7 +1498,7 @@ public final class BatchHelper {
public static BatchRequest updateDatatableEntry(final String datatableName, final String resourceId, final String subResourceId,
final String columnName, final String columnValue) {
final BatchRequest br = new BatchRequest();
- final String relativeUrl = String.format("datatables/%s/%s/%s", datatableName, resourceId, subResourceId);
+ final String relativeUrl = String.format("v1/datatables/%s/%s/%s", datatableName, resourceId, subResourceId);
final Map<String, Object> datatableEntryMap = new HashMap<>();
datatableEntryMap.put(columnName, columnValue);
final String datatableEntryRequestJsonString = new Gson().toJson(datatableEntryMap);
@@ -1512,7 +1527,7 @@ public final class BatchHelper {
public static BatchRequest getSavingAccount(final Long requestId, final Long accountId, final String queryParameter,
final Long referenceId) {
final BatchRequest br = new BatchRequest();
- String relativeUrl = String.format("savingsaccounts/%s", accountId);
+ String relativeUrl = String.format("v1/savingsaccounts/%s", accountId);
if (queryParameter != null) {
relativeUrl = relativeUrl + "?" + queryParameter;
}
@@ -1542,7 +1557,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl("savingsaccounts/$.id/transactions?command=deposit");
+ br.setRelativeUrl("v1/savingsaccounts/$.id/transactions?command=deposit");
br.setMethod(HttpMethod.POST);
final LocalDate transactionDate = LocalDate.now(ZoneId.systemDefault());
final String transactionDateString = transactionDate.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
@@ -1568,7 +1583,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl("savingsaccounts/$.id/transactions?command=withdrawal");
+ br.setRelativeUrl("v1/savingsaccounts/$.id/transactions?command=withdrawal");
br.setMethod(HttpMethod.POST);
final LocalDate transactionDate = LocalDate.now(ZoneId.systemDefault());
final String transactionDateString = transactionDate.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
@@ -1594,7 +1609,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl("savingsaccounts/$.id/transactions?command=holdAmount");
+ br.setRelativeUrl("v1/savingsaccounts/$.id/transactions?command=holdAmount");
br.setMethod(HttpMethod.POST);
final LocalDate transactionDate = LocalDate.now(ZoneId.systemDefault());
final String transactionDateString = transactionDate.format(DateTimeFormatter.ofPattern("dd MMMM yyyy"));
@@ -1625,7 +1640,7 @@ public final class BatchHelper {
br.setRequestId(requestId);
br.setReference(reference);
- br.setRelativeUrl("savingsaccounts/$.id/transactions/" + transactionId + "?command=releaseAmount");
+ br.setRelativeUrl("v1/savingsaccounts/$.id/transactions/" + transactionId + "?command=releaseAmount");
br.setMethod(HttpMethod.POST);
br.setBody("{\"isBulk\": \"false\"}");
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/inlinecob/InlineLoanCOBTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/inlinecob/InlineLoanCOBTest.java
index bfd709ff6..50ca643cd 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/inlinecob/InlineLoanCOBTest.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/inlinecob/InlineLoanCOBTest.java
@@ -357,6 +357,75 @@ public class InlineLoanCOBTest {
}
}
+ @Test
+ public void testInlineCOBOnBatchAPIWithOldRelativeUrls() {
+ try {
+ GlobalConfigurationHelper.updateIsBusinessDateEnabled(requestSpec, responseSpec, Boolean.TRUE);
+ BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, LocalDate.of(2020, 3, 2));
+ GlobalConfigurationHelper.updateValueForGlobalConfiguration(this.requestSpec, this.responseSpec, "10", "0");
+ loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
+ loanAccountLockHelper = new LoanAccountLockHelper(requestSpec, new ResponseSpecBuilder().expectStatusCode(202).build());
+
+ final Integer clientID = ClientHelper.createClient(requestSpec, responseSpec);
+ Assertions.assertNotNull(clientID);
+
+ Integer overdueFeeChargeId = ChargesHelper.createCharges(requestSpec, responseSpec,
+ ChargesHelper.getLoanOverdueFeeJSONWithCalculationTypePercentage("1"));
+ Assertions.assertNotNull(overdueFeeChargeId);
+
+ final Integer loanProductID = createLoanProduct(overdueFeeChargeId.toString());
+ Assertions.assertNotNull(loanProductID);
+ HashMap loanStatusHashMap;
+ final Integer loanID = applyForLoanApplication(clientID.toString(), loanProductID.toString(), null, "10 January 2020");
+
+ Assertions.assertNotNull(loanID);
+
+ loanStatusHashMap = LoanStatusChecker.getStatusOfLoan(requestSpec, responseSpec, loanID);
+ LoanStatusChecker.verifyLoanIsPending(loanStatusHashMap);
+
+ loanStatusHashMap = loanTransactionHelper.approveLoan("01 March 2020", loanID);
+ LoanStatusChecker.verifyLoanIsApproved(loanStatusHashMap);
+
+ String loanDetails = loanTransactionHelper.getLoanDetails(requestSpec, responseSpec, loanID);
+ loanStatusHashMap = loanTransactionHelper.disburseLoanWithNetDisbursalAmount("02 March 2020", loanID,
+ JsonPath.from(loanDetails).get("netDisbursalAmount").toString());
+ LoanStatusChecker.verifyLoanIsActive(loanStatusHashMap);
+
+ BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.COB_DATE, LocalDate.of(2020, 3, 2));
+ inlineLoanCOBHelper.executeInlineCOB(List.of(loanID.longValue()));
+ GetLoansLoanIdResponse loan = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanID);
+ Assertions.assertEquals(LocalDate.of(2020, 3, 2), loan.getLastClosedBusinessDate());
+
+ BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, LocalDate.of(2020, 3, 10));
+
+ requestSpec = UserHelper.getSimpleUserWithoutBypassPermission(requestSpec, responseSpec);
+
+ loanAccountLockHelper.placeSoftLockOnLoanAccount(loanID, "LOAN_COB_PARTITIONING");
+ loanTransactionHelper = new LoanTransactionHelper(requestSpec, responseSpec);
+
+ final BatchRequest br1 = BatchHelper.oldRepayLoanRequestWithGivenLoanId(4730L, loanID, "10", LocalDate.of(2020, 3, 10));
+
+ final List<BatchRequest> batchRequests = new ArrayList<>();
+
+ batchRequests.add(br1);
+
+ final String jsonifiedRequest = BatchHelper.toJsonString(batchRequests);
+
+ final List<BatchResponse> response = BatchHelper.postBatchRequestsWithoutEnclosingTransaction(this.requestSpec,
+ this.responseSpec, jsonifiedRequest);
+ Assertions.assertEquals(HttpStatus.SC_OK, (long) response.get(0).getStatusCode(), "Verify Status Code 200 for Repayment");
+
+ loan = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanID);
+ Assertions.assertEquals(LocalDate.of(2020, 3, 9), loan.getLastClosedBusinessDate());
+ } finally {
+ requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
+ requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+ requestSpec.header("Fineract-Platform-TenantId", "default");
+ responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
+ GlobalConfigurationHelper.updateIsBusinessDateEnabled(requestSpec, responseSpec, Boolean.FALSE);
+ }
+ }
+
@Test
public void testInlineCOBOnBatchAPI() {
try {
diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/support/instancemode/InstanceModeSupportExtension.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/support/instancemode/InstanceModeSupportExtension.java
index 259544526..d756acf19 100644
--- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/support/instancemode/InstanceModeSupportExtension.java
+++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/support/instancemode/InstanceModeSupportExtension.java
@@ -24,22 +24,38 @@ import io.restassured.http.ContentType;
import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import org.apache.fineract.integrationtests.common.Utils;
+import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
+import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
import org.junit.jupiter.api.extension.ExtensionContext.Store;
-public class InstanceModeSupportExtension implements BeforeTestExecutionCallback, AfterTestExecutionCallback {
+public class InstanceModeSupportExtension
+ implements BeforeAllCallback, BeforeTestExecutionCallback, AfterAllCallback, AfterTestExecutionCallback {
private static final Namespace INSTANCE_MODE_NAMESPACE = Namespace.create(InstanceModeSupportExtension.class);
private static final String AUTH_KEY = "AUTH_KEY";
+ @Override
+ public void beforeAll(ExtensionContext context) throws Exception {
+ Utils.initializeRESTAssured();
+ resetInstanceMode(context);
+ }
+
+ @Override
+ public void afterAll(ExtensionContext context) throws Exception {
+ Utils.initializeRESTAssured();
+ resetInstanceMode(context);
+ }
+
@Override
public void beforeTestExecution(ExtensionContext context) throws Exception {
context.getTestMethod().ifPresent(m -> {
ConfigureInstanceMode annotation = m.getAnnotation(ConfigureInstanceMode.class);
if (annotation != null) {
+ Utils.initializeRESTAssured();
boolean readEnabled = annotation.readEnabled();
boolean writeEnabled = annotation.writeEnabled();
boolean batchWorkerEnabled = annotation.batchWorkerEnabled();
@@ -54,11 +70,16 @@ public class InstanceModeSupportExtension implements BeforeTestExecutionCallback
context.getTestMethod().ifPresent(m -> {
ConfigureInstanceMode annotation = m.getAnnotation(ConfigureInstanceMode.class);
if (annotation != null) {
- changeInstanceMode(context, true, true, true, true);
+ Utils.initializeRESTAssured();
+ resetInstanceMode(context);
}
});
}
+ private void resetInstanceMode(ExtensionContext context) {
+ changeInstanceMode(context, true, true, true, true);
+ }
+
private void changeInstanceMode(ExtensionContext extensionContext, boolean readEnabled, boolean writeEnabled,
boolean batchWorkerEnabled, boolean batchManagerEnabled) {
Store store = extensionContext.getStore(INSTANCE_MODE_NAMESPACE);