From d5b2f0b23c8e4796065e6828a8d023bbff714e8d Mon Sep 17 00:00:00 2001 From: Pronay sarker Date: Sun, 8 Dec 2024 01:06:14 +0600 Subject: [PATCH] MIFOSAC-299 applied spotless and detekt on core:network --- core/network/build.gradle.kts | 9 ++ core/network/src/main/AndroidManifest.xml | 9 ++ .../com/mifos/core/network/BaseApiManager.kt | 46 +++++----- .../java/com/mifos/core/network/BaseUrl.kt | 23 ++--- .../com/mifos/core/network/DataManager.kt | 43 ++++++--- .../com/mifos/core/network/GenericRequest.kt | 9 +- .../com/mifos/core/network/GenericResponse.kt | 13 ++- .../mifos/core/network/MifosInterceptor.kt | 9 +- .../mifos/core/network/MifosOkHttpClient.kt | 43 +++++---- .../core/network/UnsafeSSLSocketFactory.kt | 36 +++++--- .../network/datamanager/DataManagerAuth.kt | 11 ++- .../network/datamanager/DataManagerCenter.kt | 24 +++-- .../network/datamanager/DataManagerCharge.kt | 23 +++-- .../datamanager/DataManagerCheckerInbox.kt | 31 +++++-- .../network/datamanager/DataManagerClient.kt | 56 +++++++----- .../datamanager/DataManagerCollectionSheet.kt | 42 ++++++--- .../datamanager/DataManagerDataTable.kt | 27 ++++-- .../datamanager/DataManagerDocument.kt | 32 +++++-- .../network/datamanager/DataManagerGroups.kt | 23 +++-- .../network/datamanager/DataManagerLoan.kt | 31 ++++--- .../network/datamanager/DataManagerNote.kt | 15 +++- .../network/datamanager/DataManagerOffices.kt | 13 ++- .../datamanager/DataManagerRunReport.kt | 39 +++++--- .../network/datamanager/DataManagerSavings.kt | 89 ++++++++++++------- .../network/datamanager/DataManagerSearch.kt | 15 +++- .../network/datamanager/DataManagerStaff.kt | 13 ++- .../network/datamanager/DataManagerSurveys.kt | 25 ++++-- .../network/datamanger/DataManagerAuth.kt | 11 ++- .../mifos/core/network/di/NetworkModule.kt | 17 ++-- .../network/mappers/centers/CenterMapper.kt | 11 ++- .../centers/GetCentersResponseMapper.kt | 11 ++- .../network/mappers/clients/ClientMapper.kt | 11 ++- .../clients/GetClientResponseMapper.kt | 11 ++- .../GetClientsClientIdAccountMapper.kt | 11 ++- .../clients/GetIdentifiersTemplateMapper.kt | 11 ++- .../mappers/clients/IdentifierMapper.kt | 11 ++- .../dataTable/GetDataTablesResponseMapper.kt | 11 ++- .../mappers/groups/GetGroupsResponseMapper.kt | 11 ++- .../network/mappers/groups/GroupMapper.kt | 11 ++- .../offices/GetOfficeResponseMapper.kt | 13 ++- .../network/mappers/staffs/StaffMapper.kt | 11 ++- .../com/mifos/core/network/model/Changes.kt | 11 ++- .../network/model/CollectionSheetPayload.kt | 9 +- .../core/network/model/DefaultPayload.kt | 13 ++- .../model/IndividualCollectionSheetPayload.kt | 13 ++- .../com/mifos/core/network/model/Payload.kt | 21 +++-- .../model/RequestCollectionSheetPayload.kt | 13 ++- .../core/network/model/ScorecardPayload.kt | 11 ++- .../core/network/services/CenterService.kt | 23 +++-- .../core/network/services/ChargeService.kt | 15 ++-- .../network/services/CheckerInboxService.kt | 23 +++-- .../network/services/ClientAccountsService.kt | 9 +- .../core/network/services/ClientService.kt | 31 ++++--- .../services/CollectionSheetService.kt | 32 ++++--- .../core/network/services/DataTableService.kt | 19 ++-- .../core/network/services/DocumentService.kt | 19 ++-- .../core/network/services/GroupService.kt | 15 ++-- .../core/network/services/LoanService.kt | 21 +++-- .../core/network/services/NoteService.kt | 13 +-- .../core/network/services/OfficeService.kt | 10 ++- .../network/services/RunReportsService.kt | 25 ++++-- .../network/services/SavingsAccountService.kt | 23 +++-- .../core/network/services/SearchService.kt | 11 ++- .../core/network/services/StaffService.kt | 9 +- .../core/network/services/SurveyService.kt | 11 ++- .../core/network/utils/ImageLoaderUtils.kt | 23 +++-- .../com/mifos/core/network/ExampleUnitTest.kt | 14 ++- 67 files changed, 959 insertions(+), 389 deletions(-) diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index bdfae962e01..61ff64d0bd8 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ plugins { alias(libs.plugins.mifos.android.library) alias(libs.plugins.mifos.android.library.jacoco) diff --git a/core/network/src/main/AndroidManifest.xml b/core/network/src/main/AndroidManifest.xml index a5918e68abc..1dc76da0f7e 100644 --- a/core/network/src/main/AndroidManifest.xml +++ b/core/network/src/main/AndroidManifest.xml @@ -1,4 +1,13 @@ + \ No newline at end of file diff --git a/core/network/src/main/java/com/mifos/core/network/BaseApiManager.kt b/core/network/src/main/java/com/mifos/core/network/BaseApiManager.kt index fa408fe3090..c47310f2a21 100644 --- a/core/network/src/main/java/com/mifos/core/network/BaseApiManager.kt +++ b/core/network/src/main/java/com/mifos/core/network/BaseApiManager.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network @@ -36,7 +41,6 @@ import javax.inject.Inject */ class BaseApiManager @Inject constructor(private val prefManager: com.mifos.core.datastore.PrefManager) { - init { createService(prefManager) } @@ -98,55 +102,55 @@ class BaseApiManager @Inject constructor(private val prefManager: com.mifos.core fun init() { centerApi = createApi( - CenterService::class.java + CenterService::class.java, ) accountsApi = createApi( - ClientAccountsService::class.java + ClientAccountsService::class.java, ) clientsApi = createApi( - ClientService::class.java + ClientService::class.java, ) dataTableApi = createApi( - DataTableService::class.java + DataTableService::class.java, ) loanApi = createApi( - LoanService::class.java + LoanService::class.java, ) savingsApi = createApi( - SavingsAccountService::class.java + SavingsAccountService::class.java, ) searchApi = createApi( - SearchService::class.java + SearchService::class.java, ) groupApi = createApi( - GroupService::class.java + GroupService::class.java, ) documentApi = createApi( - DocumentService::class.java + DocumentService::class.java, ) officeApi = createApi( - OfficeService::class.java + OfficeService::class.java, ) staffApi = createApi( - StaffService::class.java + StaffService::class.java, ) surveyApi = createApi( - SurveyService::class.java + SurveyService::class.java, ) chargeApi = createApi( - ChargeService::class.java + ChargeService::class.java, ) runReportsService = createApi( - RunReportsService::class.java + RunReportsService::class.java, ) noteApi = createApi( - NoteService::class.java + NoteService::class.java, ) collectionSheetApi = createApi( - CollectionSheetService::class.java + CollectionSheetService::class.java, ) checkerInboxApi = createApi( - CheckerInboxService::class.java + CheckerInboxService::class.java, ) } @@ -162,9 +166,9 @@ class BaseApiManager @Inject constructor(private val prefManager: com.mifos.core .addConverterFactory(ScalarsConverterFactory.create()) .addConverterFactory(GsonConverterFactory.create(gson)) .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) - .client(MifosOkHttpClient(prefManager).mifosOkHttpClient) + .client(MifosOkHttpClient(prefManager).okHttpClient) .build() init() } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/BaseUrl.kt b/core/network/src/main/java/com/mifos/core/network/BaseUrl.kt index fcb16b76ba9..7297ae829ab 100644 --- a/core/network/src/main/java/com/mifos/core/network/BaseUrl.kt +++ b/core/network/src/main/java/com/mifos/core/network/BaseUrl.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network @@ -10,15 +15,13 @@ import com.mifos.core.common.utils.asServerConfig /** * @author fomenkoo */ -class BaseUrl { +object BaseUrl { // "/" in the last of the base url always - companion object { - private val configs = BuildConfig.DEMO_SERVER_CONFIG.asServerConfig() + private val configs = BuildConfig.DEMO_SERVER_CONFIG.asServerConfig() - val PROTOCOL_HTTPS = configs.protocol - val API_ENDPOINT = configs.endPoint - val API_PATH = configs.apiPath - val PORT = configs.port - } -} \ No newline at end of file + val PROTOCOL_HTTPS = configs.protocol + val API_ENDPOINT = configs.endPoint + val API_PATH = configs.apiPath + val PORT = configs.port +} diff --git a/core/network/src/main/java/com/mifos/core/network/DataManager.kt b/core/network/src/main/java/com/mifos/core/network/DataManager.kt index 8ecc3f7bb75..06ee62bfbb0 100644 --- a/core/network/src/main/java/com/mifos/core/network/DataManager.kt +++ b/core/network/src/main/java/com/mifos/core/network/DataManager.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network import com.mifos.core.data.ChargesPayload @@ -36,7 +45,7 @@ class DataManager { private val mBaseApiManager: BaseApiManager private var mDataManagerClient: DataManagerClient? = null - //TODO : This Constructor is temp after splitting the Datamanager layer into Sub DataManager + // TODO : This Constructor is temp after splitting the Datamanager layer into Sub DataManager constructor(baseApiManager: BaseApiManager) { mBaseApiManager = baseApiManager } @@ -44,7 +53,7 @@ class DataManager { @Inject constructor( baseApiManager: BaseApiManager, - dataManagerClient: DataManagerClient? + dataManagerClient: DataManagerClient?, ) { mBaseApiManager = baseApiManager mDataManagerClient = dataManagerClient @@ -67,33 +76,41 @@ class DataManager { fun saveCollectionSheet( centerId: Int, - collectionSheetPayload: CollectionSheetPayload? + collectionSheetPayload: CollectionSheetPayload?, ): Observable { return mBaseApiManager.centerApi.saveCollectionSheet( - centerId, collectionSheetPayload + centerId, + collectionSheetPayload, ) } fun saveCollectionSheetAsync( id: Int, - payload: CollectionSheetPayload? + payload: CollectionSheetPayload?, ): Observable { return mBaseApiManager.centerApi.saveCollectionSheetAsync(id, payload) } fun getCenterList( - dateFormat: String?, locale: String?, meetingDate: String?, officeId: Int, staffId: Int + dateFormat: String?, + locale: String?, + meetingDate: String?, + officeId: Int, + staffId: Int, ): Observable> { return mBaseApiManager.centerApi.getCenterList( - dateFormat, locale, meetingDate, - officeId, staffId + dateFormat, + locale, + meetingDate, + officeId, + staffId, ) } /** * Charges API */ - //TODO Remove this Method After fixing the Charge Test + // TODO Remove this Method After fixing the Charge Test fun getClientCharges(clientId: Int, offset: Int, limit: Int): Observable> { return mBaseApiManager.chargeApi.getListOfCharges(clientId, offset, limit) } @@ -104,7 +121,7 @@ class DataManager { suspend fun createCharges( clientId: Int, - payload: ChargesPayload + payload: ChargesPayload, ): ChargeCreationResponse { return mBaseApiManager.chargeApi.createCharges(clientId, payload) } @@ -115,7 +132,7 @@ class DataManager { suspend fun createLoanCharges( loanId: Int, - chargesPayload: ChargesPayload + chargesPayload: ChargesPayload, ): ChargeCreationResponse { return mBaseApiManager.chargeApi.createLoanCharges(loanId, chargesPayload) } @@ -129,7 +146,7 @@ class DataManager { suspend fun getGroupsByOffice( office: Int, - params: Map + params: Map, ): List { return mBaseApiManager.groupApi.getAllGroupsInOffice(office, params) } @@ -182,4 +199,4 @@ class DataManager { fun getListOfCharges(clientId: Int): Observable> { return mBaseApiManager.loanApi.getListOfCharges(clientId) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/GenericRequest.kt b/core/network/src/main/java/com/mifos/core/network/GenericRequest.kt index 6d9c6c7ec16..351f307da90 100644 --- a/core/network/src/main/java/com/mifos/core/network/GenericRequest.kt +++ b/core/network/src/main/java/com/mifos/core/network/GenericRequest.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network @@ -9,4 +14,4 @@ package com.mifos.core.network */ class GenericRequest { var requestFields = HashMap() -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/GenericResponse.kt b/core/network/src/main/java/com/mifos/core/network/GenericResponse.kt index e3fa646de5d..aff3ed915e8 100644 --- a/core/network/src/main/java/com/mifos/core/network/GenericResponse.kt +++ b/core/network/src/main/java/com/mifos/core/network/GenericResponse.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network @@ -11,7 +16,7 @@ class GenericResponse { var responseFields = HashMap() override fun toString(): String { return "GenericResponse{" + - "responseFields=" + responseFields + - '}' + "responseFields=" + responseFields + + '}' } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/MifosInterceptor.kt b/core/network/src/main/java/com/mifos/core/network/MifosInterceptor.kt index 29292d3b610..173add934ea 100644 --- a/core/network/src/main/java/com/mifos/core/network/MifosInterceptor.kt +++ b/core/network/src/main/java/com/mifos/core/network/MifosInterceptor.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network @@ -27,4 +32,4 @@ class MifosInterceptor(private val prefManager: com.mifos.core.datastore.PrefMan const val HEADER_TENANT = "Fineract-Platform-TenantId" const val HEADER_AUTH = "Authorization" } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/MifosOkHttpClient.kt b/core/network/src/main/java/com/mifos/core/network/MifosOkHttpClient.kt index 7c41440de3f..24655bdfebb 100644 --- a/core/network/src/main/java/com/mifos/core/network/MifosOkHttpClient.kt +++ b/core/network/src/main/java/com/mifos/core/network/MifosOkHttpClient.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network import com.facebook.stetho.okhttp3.StethoInterceptor @@ -16,20 +25,20 @@ import javax.net.ssl.X509TrustManager */ class MifosOkHttpClient(private val prefManager: com.mifos.core.datastore.PrefManager) { // Create a trust manager that does not validate certificate chains - val mifosOkHttpClient: OkHttpClient + val okHttpClient: OkHttpClient - // Install the all-trusting trust manager - // Create an ssl socket factory with our all-trusting manager + // Install the all-trusting trust manager + // Create an ssl socket factory with our all-trusting manager - //Enable Full Body Logging + // Enable Full Body Logging - //Set SSL certificate to OkHttpClient Builder + // Set SSL certificate to OkHttpClient Builder - //Enable Full Body Logging + // Enable Full Body Logging - //Setting Timeout 30 Seconds + // Setting Timeout 30 Seconds - //Interceptor :> Full Body Logger and ApiRequest Header + // Interceptor :> Full Body Logger and ApiRequest Header get() { val builder = OkHttpClient.Builder() try { @@ -39,21 +48,21 @@ class MifosOkHttpClient(private val prefManager: com.mifos.core.datastore.PrefMa @Throws(CertificateException::class) override fun checkClientTrusted( chain: Array, - authType: String + authType: String, ) { } @Throws(CertificateException::class) override fun checkServerTrusted( chain: Array, - authType: String + authType: String, ) { } override fun getAcceptedIssuers(): Array { return emptyArray() } - } + }, ) // Install the all-trusting trust manager @@ -62,11 +71,11 @@ class MifosOkHttpClient(private val prefManager: com.mifos.core.datastore.PrefMa // Create an ssl socket factory with our all-trusting manager val sslSocketFactory = sslContext.socketFactory - //Enable Full Body Logging + // Enable Full Body Logging val logger = HttpLoggingInterceptor() logger.level = HttpLoggingInterceptor.Level.BODY - //Set SSL certificate to OkHttpClient Builder + // Set SSL certificate to OkHttpClient Builder // builder.sslSocketFactory(sslSocketFactory) builder.sslSocketFactory(sslSocketFactory, trustAllCerts[0] as X509TrustManager) builder.hostnameVerifier { hostname, session -> true } @@ -74,18 +83,18 @@ class MifosOkHttpClient(private val prefManager: com.mifos.core.datastore.PrefMa throw RuntimeException(e) } - //Enable Full Body Logging + // Enable Full Body Logging val logger = HttpLoggingInterceptor() logger.level = HttpLoggingInterceptor.Level.BODY - //Setting Timeout 30 Seconds + // Setting Timeout 30 Seconds builder.connectTimeout(60, TimeUnit.SECONDS) builder.readTimeout(60, TimeUnit.SECONDS) - //Interceptor :> Full Body Logger and ApiRequest Header + // Interceptor :> Full Body Logger and ApiRequest Header builder.addInterceptor(logger) builder.addInterceptor(MifosInterceptor(prefManager)) builder.addNetworkInterceptor(StethoInterceptor()) return builder.build() } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/UnsafeSSLSocketFactory.kt b/core/network/src/main/java/com/mifos/core/network/UnsafeSSLSocketFactory.kt index 4341518e1a1..934fb64289f 100644 --- a/core/network/src/main/java/com/mifos/core/network/UnsafeSSLSocketFactory.kt +++ b/core/network/src/main/java/com/mifos/core/network/UnsafeSSLSocketFactory.kt @@ -1,9 +1,15 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network +import android.util.Log import java.io.IOException import java.net.InetAddress import java.net.Socket @@ -23,18 +29,20 @@ class UnsafeSSLSocketFactory(truststore: KeyStore?) : SSLSocketFactory() { var sslContext = SSLContext.getInstance("TLS") init { - + Log.d("truststore", truststore.toString()) // Create a trust manager that does not validate certificate chains - val trustAllCerts = arrayOf(object : X509TrustManager { - override fun checkServerTrusted(chain: Array, authType: String) {} - @Throws(CertificateException::class) - override fun checkClientTrusted(chain: Array, authType: String) { - } + val trustAllCerts = arrayOf( + object : X509TrustManager { + override fun checkServerTrusted(chain: Array, authType: String) {} + + @Throws(CertificateException::class) + override fun checkClientTrusted(chain: Array, authType: String) { + } - override fun getAcceptedIssuers(): Array { - return emptyArray() - } - } + override fun getAcceptedIssuers(): Array { + return emptyArray() + } + }, ) sslContext.init(null, trustAllCerts, null) } @@ -62,7 +70,7 @@ class UnsafeSSLSocketFactory(truststore: KeyStore?) : SSLSocketFactory() { host: String, port: Int, localHost: InetAddress, - localPort: Int + localPort: Int, ): Socket? { return null } @@ -77,8 +85,8 @@ class UnsafeSSLSocketFactory(truststore: KeyStore?) : SSLSocketFactory() { address: InetAddress, port: Int, localAddress: InetAddress, - localPort: Int + localPort: Int, ): Socket? { return null } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerAuth.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerAuth.kt index 630d1ed4a77..cf15d55095e 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerAuth.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerAuth.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import org.apache.fineract.client.models.PostAuthenticationRequest @@ -24,4 +33,4 @@ class DataManagerAuth @Inject constructor(private val baseApiManager: BaseApiMan } return baseApiManager.getAuthApi().authenticate(body, true) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCenter.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCenter.kt index a3324eb0b09..f1f5712b449 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCenter.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCenter.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.data.CenterPayload @@ -29,7 +38,7 @@ class DataManagerCenter @Inject constructor( val mBaseApiManager: BaseApiManager, private val mDatabaseHelperCenter: DatabaseHelperCenter, private val baseApiManager: org.mifos.core.apimanager.BaseApiManager, - private val prefManager: com.mifos.core.datastore.PrefManager + private val prefManager: com.mifos.core.datastore.PrefManager, ) { /** * This Method sending the Request to REST API if UserStatus is 0 and @@ -52,7 +61,7 @@ class DataManagerCenter @Inject constructor( false -> baseApiManager.getCenterApi() .retrieveAll23( null, null, null, null, null, paged, - offset, limit, null, null, null, null, null + offset, limit, null, null, null, null, null, ).map(GetCentersResponseMapper::mapFromEntity) true -> { @@ -88,7 +97,7 @@ class DataManagerCenter @Inject constructor( .concatMap { centerAccounts -> mDatabaseHelperCenter.saveCenterAccounts( centerAccounts, - centerId + centerId, ) } } @@ -151,7 +160,7 @@ class DataManagerCenter @Inject constructor( * This method loading the all CenterPayloads from the Database. * * @return List - */ + */ val allDatabaseCenterPayload: Observable> get() = mDatabaseHelperCenter.readAllCenterPayload() @@ -185,7 +194,7 @@ class DataManagerCenter @Inject constructor( */ fun activateCenter( centerId: Int, - activatePayload: ActivatePayload? + activatePayload: ActivatePayload?, ): Observable { return baseApiManager.getCenterApi().activate2( centerId.toLong(), @@ -193,7 +202,8 @@ class DataManagerCenter @Inject constructor( closureDate = activatePayload?.activationDate dateFormat = activatePayload?.dateFormat locale = activatePayload?.locale - }, "activate" + }, + "activate", ) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCharge.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCharge.kt index 61042aeef3e..63d0f3ab6d1 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCharge.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCharge.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.databasehelper.DatabaseHelperCharge @@ -20,7 +29,7 @@ import javax.inject.Singleton class DataManagerCharge @Inject constructor( val mBaseApiManager: BaseApiManager, val mDatabaseHelperCharge: DatabaseHelperCharge, - private val prefManager: com.mifos.core.datastore.PrefManager + private val prefManager: com.mifos.core.datastore.PrefManager, ) { /** * This Method Request the Charge API at @@ -45,10 +54,14 @@ class DataManagerCharge @Inject constructor( /** * Return Client Charges from DatabaseHelperClient only one time. */ - if (offset == 0) mDatabaseHelperCharge.readClientCharges(clientId) else Observable.just( - Page() - ) + if (offset == 0) { + mDatabaseHelperCharge.readClientCharges(clientId) + } else { + Observable.just( + Page(), + ) + } } } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCheckerInbox.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCheckerInbox.kt index 11d4b632974..413608ee66b 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCheckerInbox.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCheckerInbox.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.network.BaseApiManager @@ -8,18 +17,19 @@ import com.mifos.core.objects.checkerinboxandtasks.RescheduleLoansTask import rx.Observable import javax.inject.Inject - class DataManagerCheckerInbox @Inject constructor( - private val mBaseApiManager: BaseApiManager + private val mBaseApiManager: BaseApiManager, ) { - suspend fun getCheckerTaskList( - actionName: String? = null, entityName: String? = null, - resourceId: Int? = null + actionName: String? = null, + entityName: String? = null, + resourceId: Int? = null, ): List { return mBaseApiManager.checkerInboxApi.getCheckerList( - actionName, entityName, resourceId + actionName, + entityName, + resourceId, ) } @@ -44,11 +54,14 @@ class DataManagerCheckerInbox @Inject constructor( } fun getCheckerTaskFromResourceId( - actionName: String? = null, entityName: String? = null, - resourceId: Int? = null + actionName: String? = null, + entityName: String? = null, + resourceId: Int? = null, ): Observable> { return mBaseApiManager.checkerInboxApi.getCheckerTasksFromResourceId( - actionName, entityName, resourceId + actionName, + entityName, + resourceId, ) } } diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerClient.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerClient.kt index b2e505c676e..8ecc258a11f 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerClient.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerClient.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.databasehelper.DatabaseHelperClient @@ -38,7 +47,7 @@ class DataManagerClient @Inject constructor( val mBaseApiManager: BaseApiManager, private val mDatabaseHelperClient: DatabaseHelperClient, private val baseApiManager: org.mifos.core.apimanager.BaseApiManager, - private val prefManager: com.mifos.core.datastore.PrefManager + private val prefManager: com.mifos.core.datastore.PrefManager, ) { /** * This Method sending the Request to REST API if UserStatus is 0 and @@ -62,7 +71,7 @@ class DataManagerClient @Inject constructor( null, null, null, null, null, null, null, null, offset, - limit, null, null, null + limit, null, null, null, ).map(GetClientResponseMapper::mapFromEntity) true -> { @@ -146,7 +155,7 @@ class DataManagerClient @Inject constructor( .concatMap { clientAccounts -> mDatabaseHelperClient.saveClientAccounts( clientAccounts, - clientId + clientId, ) } } @@ -189,12 +198,13 @@ class DataManagerClient @Inject constructor( */ val clientTemplate: Observable get() = when (prefManager.userStatus) { - false -> mBaseApiManager.clientsApi.clientTemplate - .concatMap { clientsTemplate -> - mDatabaseHelperClient.saveClientTemplate( - clientsTemplate - ) - } + false -> + mBaseApiManager.clientsApi.clientTemplate + .concatMap { clientsTemplate -> + mDatabaseHelperClient.saveClientTemplate( + clientsTemplate, + ) + } true -> /** @@ -246,7 +256,7 @@ class DataManagerClient @Inject constructor( */ fun deleteAndUpdatePayloads( id: Int, - clientCreationTIme: Long + clientCreationTIme: Long, ): Observable> { return mDatabaseHelperClient.deleteAndUpdatePayloads(id, clientCreationTIme) } @@ -266,7 +276,7 @@ class DataManagerClient @Inject constructor( * * @param clientId Client Id * @return List - */ + */ fun getClientIdentifiers(clientId: Int): Observable> { return baseApiManager.getClient().clientIdentifiers.retrieveAllClientIdentifiers(clientId.toLong()) .map(IdentifierMapper::mapFromEntityList) @@ -280,7 +290,8 @@ class DataManagerClient @Inject constructor( * @return IdentifierCreationResponse */ suspend fun createClientIdentifier( - clientId: Int, identifierPayload: IdentifierPayload + clientId: Int, + identifierPayload: IdentifierPayload, ): IdentifierCreationResponse { return mBaseApiManager.clientsApi.createClientIdentifier(clientId, identifierPayload) } @@ -305,11 +316,11 @@ class DataManagerClient @Inject constructor( */ fun deleteClientIdentifier( clientId: Int, - identifierId: Int + identifierId: Int, ): Observable { return baseApiManager.getClient().clientIdentifiers.deleteClientIdentifier( clientId.toLong(), - identifierId.toLong() + identifierId.toLong(), ) } @@ -333,7 +344,7 @@ class DataManagerClient @Inject constructor( */ suspend fun addClientPinpointLocation( clientId: Int, - address: ClientAddressRequest? + address: ClientAddressRequest?, ): GenericResponse { return mBaseApiManager.clientsApi.addClientPinpointLocation(clientId, address) } @@ -347,7 +358,7 @@ class DataManagerClient @Inject constructor( */ suspend fun deleteClientAddressPinpointLocation( apptableId: Int, - datatableId: Int + datatableId: Int, ): GenericResponse { return mBaseApiManager.clientsApi .deleteClientPinpointLocation(apptableId, datatableId) @@ -364,10 +375,12 @@ class DataManagerClient @Inject constructor( suspend fun updateClientPinpointLocation( apptableId: Int, datatableId: Int, - address: ClientAddressRequest? + address: ClientAddressRequest?, ): GenericResponse { return mBaseApiManager.clientsApi.updateClientPinpointLocation( - apptableId, datatableId, address + apptableId, + datatableId, + address, ) } @@ -379,7 +392,7 @@ class DataManagerClient @Inject constructor( */ fun activateClient( clientId: Int, - clientActivate: ActivatePayload? + clientActivate: ActivatePayload?, ): Observable { return baseApiManager.getClientsApi().activate1( clientId.toLong(), @@ -387,7 +400,8 @@ class DataManagerClient @Inject constructor( activationDate = clientActivate?.activationDate dateFormat = clientActivate?.dateFormat locale = clientActivate?.locale - }, "activate" + }, + "activate", ) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCollectionSheet.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCollectionSheet.kt index c40a79f138f..06064eb05dd 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCollectionSheet.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerCollectionSheet.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.network.BaseApiManager @@ -11,7 +20,6 @@ import com.mifos.core.objects.collectionsheet.CollectionSheetResponse import com.mifos.core.objects.collectionsheet.IndividualCollectionSheet import com.mifos.core.objects.collectionsheet.ProductiveCollectionSheetPayload import com.mifos.core.objects.group.CenterWithAssociations -import rx.Observable import javax.inject.Inject import javax.inject.Singleton @@ -20,19 +28,19 @@ import javax.inject.Singleton */ @Singleton class DataManagerCollectionSheet @Inject constructor( - private val mBaseApiManager: BaseApiManager + private val mBaseApiManager: BaseApiManager, ) { /** * Individual CollectionSheet API */ suspend fun getIndividualCollectionSheet( - payload: RequestCollectionSheetPayload? + payload: RequestCollectionSheetPayload?, ): IndividualCollectionSheet { return mBaseApiManager.collectionSheetApi.getIndividualCollectionSheet(payload) } suspend fun saveIndividualCollectionSheet( - payload: IndividualCollectionSheetPayload? + payload: IndividualCollectionSheetPayload?, ): GenericResponse { return mBaseApiManager.collectionSheetApi.saveindividualCollectionSheet(payload) } @@ -41,21 +49,31 @@ class DataManagerCollectionSheet @Inject constructor( * Productive CollectionSheet API */ suspend fun fetchCenterDetails( - format: String?, locale: String?, meetingDate: String?, officeId: Int, staffId: Int + format: String?, + locale: String?, + meetingDate: String?, + officeId: Int, + staffId: Int, ): List { return mBaseApiManager.collectionSheetApi.fetchCenterDetails( - format, locale, meetingDate, officeId, staffId + format, + locale, + meetingDate, + officeId, + staffId, ) } suspend fun fetchProductiveCollectionSheet( - centerId: Int, payload: CollectionSheetRequestPayload? + centerId: Int, + payload: CollectionSheetRequestPayload?, ): CollectionSheetResponse { return mBaseApiManager.collectionSheetApi.fetchProductiveSheet(centerId, payload) } suspend fun submitProductiveSheet( - centerId: Int, payload: ProductiveCollectionSheetPayload? + centerId: Int, + payload: ProductiveCollectionSheetPayload?, ): GenericResponse { return mBaseApiManager.collectionSheetApi.submitProductiveSheet(centerId, payload) } @@ -64,13 +82,15 @@ class DataManagerCollectionSheet @Inject constructor( * CollectionSheet API */ suspend fun fetchCollectionSheet( - groupId: Int, payload: CollectionSheetRequestPayload? + groupId: Int, + payload: CollectionSheetRequestPayload?, ): CollectionSheetResponse { return mBaseApiManager.collectionSheetApi.fetchCollectionSheet(groupId, payload) } suspend fun submitCollectionSheet( - groupId: Int, payload: CollectionSheetPayload? + groupId: Int, + payload: CollectionSheetPayload?, ): GenericResponse { return mBaseApiManager.collectionSheetApi.submitCollectionSheet(groupId, payload) } @@ -81,4 +101,4 @@ class DataManagerCollectionSheet @Inject constructor( suspend fun fetchGroupsAssociatedWithCenter(centerId: Int): CenterWithAssociations { return mBaseApiManager.collectionSheetApi.fetchGroupsAssociatedWithCenter(centerId) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerDataTable.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerDataTable.kt index 5d96c5a22e1..db61c21d60c 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerDataTable.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerDataTable.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.google.gson.JsonArray @@ -22,7 +31,7 @@ import javax.inject.Singleton class DataManagerDataTable @Inject constructor( val mBaseApiManager: BaseApiManager, val mDatabaseHelperDataTable: DatabaseHelperDataTable, - private val baseApiManager: org.mifos.core.apimanager.BaseApiManager + private val baseApiManager: org.mifos.core.apimanager.BaseApiManager, ) { /** * This Method Request the REST API of Datatable and In response give the List of DataTable @@ -32,10 +41,10 @@ class DataManagerDataTable @Inject constructor( * 3. m_loan * @param tableName DataTable Name * @return List - */ + */ fun getDataTable(tableName: String?): Observable> { return baseApiManager.getDataTableApi().getDatatables(tableName).map( - GetDataTablesResponseMapper::mapFromEntityList + GetDataTablesResponseMapper::mapFromEntityList, ) } @@ -44,7 +53,9 @@ class DataManagerDataTable @Inject constructor( } suspend fun addDataTableEntry( - table: String, entityId: Int, payload: Map + table: String, + entityId: Int, + payload: Map, ): GenericResponse { return mBaseApiManager.dataTableApi .createEntryInDataTable(table, entityId, payload) @@ -53,7 +64,7 @@ class DataManagerDataTable @Inject constructor( fun deleteDataTableEntry( table: String?, entity: Int, - rowId: Int + rowId: Int, ): Observable { return baseApiManager.getDataTableApi() .deleteDatatableEntries1(table, entity.toLong(), rowId.toLong()) @@ -68,7 +79,7 @@ class DataManagerDataTable @Inject constructor( */ fun addUserPathTracking( userId: Int, - userLocation: UserLocation? + userLocation: UserLocation?, ): Observable { return mBaseApiManager.dataTableApi.addUserPathTracking(userId, userLocation) } @@ -78,8 +89,8 @@ class DataManagerDataTable @Inject constructor( * * @param userId UserId Id * @return List - */ + */ suspend fun getUserPathTracking(userId: Int): List { return mBaseApiManager.dataTableApi.getUserPathTracking(userId) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerDocument.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerDocument.kt index 22e2462a272..783cb8540ca 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerDocument.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerDocument.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.network.BaseApiManager @@ -23,7 +32,7 @@ class DataManagerDocument @Inject constructor(val mBaseApiManager: BaseApiManage * @param entityType Entity Type * @param entityId Entity Id * @return List - */ + */ suspend fun getDocumentsList(entityType: String, entityId: Int): List { return mBaseApiManager.documentApi.getDocuments(entityType, entityId) } @@ -41,8 +50,11 @@ class DataManagerDocument @Inject constructor(val mBaseApiManager: BaseApiManage * @return GenericResponse */ fun createDocument( - entityType: String?, entityId: Int, name: String?, - desc: String?, file: MultipartBody.Part? + entityType: String?, + entityId: Int, + name: String?, + desc: String?, + file: MultipartBody.Part?, ): Observable { return mBaseApiManager .documentApi @@ -61,8 +73,9 @@ class DataManagerDocument @Inject constructor(val mBaseApiManager: BaseApiManage * @return ResponseBody Binary File of Document */ suspend fun downloadDocument( - entityType: String, entityId: Int, - documentId: Int + entityType: String, + entityId: Int, + documentId: Int, ): ResponseBody { return mBaseApiManager.documentApi.downloadDocument(entityType, entityId, documentId) } @@ -80,8 +93,9 @@ class DataManagerDocument @Inject constructor(val mBaseApiManager: BaseApiManage * @return GenericResponse */ suspend fun removeDocument( - entityType: String, entityId: Int, - documentId: Int + entityType: String, + entityId: Int, + documentId: Int, ): GenericResponse { return mBaseApiManager.documentApi.removeDocument(entityType, entityId, documentId) } @@ -107,9 +121,9 @@ class DataManagerDocument @Inject constructor(val mBaseApiManager: BaseApiManage documentId: Int, name: String?, desc: String?, - file: MultipartBody.Part? + file: MultipartBody.Part?, ): Observable { return mBaseApiManager.documentApi .updateDocument(entityType, entityId, documentId, name, desc, file) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerGroups.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerGroups.kt index 11b8ef1baf2..0ce1daa2fe9 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerGroups.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerGroups.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.databasehelper.DatabaseHelperClient @@ -28,7 +37,7 @@ class DataManagerGroups @Inject constructor( private val mDatabaseHelperGroups: DatabaseHelperGroups, private val mDatabaseHelperClient: DatabaseHelperClient, private val baseApiManager: org.mifos.core.apimanager.BaseApiManager, - private val prefManager: com.mifos.core.datastore.PrefManager + private val prefManager: com.mifos.core.datastore.PrefManager, ) { /** * This Method sending the Request to REST API if UserStatus is 0 and @@ -59,7 +68,7 @@ class DataManagerGroups @Inject constructor( limit, null, null, - null + null, ).map(GetGroupsResponseMapper::mapFromEntity) true -> { @@ -80,7 +89,7 @@ class DataManagerGroups @Inject constructor( * read the all Groups from the Database Group table and returns the Page. * * @return Page - */ + */ val databaseGroups: Observable> get() = mDatabaseHelperGroups.readAllGroups() @@ -158,7 +167,7 @@ class DataManagerGroups @Inject constructor( .concatMap { groupAccounts -> mDatabaseHelperGroups.saveGroupAccounts( groupAccounts, - groupId + groupId, ) } } @@ -185,7 +194,7 @@ class DataManagerGroups @Inject constructor( * This method loading the all GroupPayloads from the Database. * * @return List - */ + */ val allDatabaseGroupPayload: Observable> get() = mDatabaseHelperGroups.realAllGroupPayload() @@ -219,8 +228,8 @@ class DataManagerGroups @Inject constructor( */ fun activateGroup( groupId: Int, - activatePayload: ActivatePayload? + activatePayload: ActivatePayload?, ): Observable { return mBaseApiManager.groupApi.activateGroup(groupId, activatePayload) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerLoan.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerLoan.kt index 032e5d25f73..6aeed2f338d 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerLoan.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerLoan.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.data.LoansPayload @@ -24,7 +33,7 @@ import javax.inject.Singleton class DataManagerLoan @Inject constructor( val mBaseApiManager: BaseApiManager, val mDatabaseHelperLoan: DatabaseHelperLoan, - private val prefManager: com.mifos.core.datastore.PrefManager + private val prefManager: com.mifos.core.datastore.PrefManager, ) { /** * This Method sending the Request to REST API if UserStatus is 0 and @@ -65,7 +74,7 @@ class DataManagerLoan @Inject constructor( .getLoanByIdWithAllAssociations(loanId) .concatMap { loanWithAssociations -> mDatabaseHelperLoan.saveLoanById( - loanWithAssociations + loanWithAssociations, ) } } @@ -129,7 +138,7 @@ class DataManagerLoan @Inject constructor( .concatMap { loanRepaymentTemplate -> mDatabaseHelperLoan.saveLoanRepaymentTemplate( loanId, - loanRepaymentTemplate + loanRepaymentTemplate, ) } } @@ -150,7 +159,7 @@ class DataManagerLoan @Inject constructor( */ fun submitPayment( loanId: Int, - request: LoanRepaymentRequest + request: LoanRepaymentRequest, ): Observable { return when (prefManager.userStatus) { false -> mBaseApiManager.loanApi.submitPayment(loanId, request) @@ -169,7 +178,7 @@ class DataManagerLoan @Inject constructor( * These LoanRepayment are those LoanRepayment that are saved during the Offline LoanRepayment. * * @return List - */ + */ val databaseLoanRepayments: Observable> get() = mDatabaseHelperLoan.readAllLoanRepaymentTransaction() @@ -198,7 +207,7 @@ class DataManagerLoan @Inject constructor( * PaymentTypeOption_Table. * * @return List - */ + */ val paymentTypeOption: Observable> get() = mDatabaseHelperLoan.paymentTypeOption @@ -208,7 +217,7 @@ class DataManagerLoan @Inject constructor( * * @param loanId Loan Id of the Loan * @return List - */ + */ fun deleteAndUpdateLoanRepayments(loanId: Int): Observable> { return mDatabaseHelperLoan.deleteAndUpdateLoanRepayments(loanId) } @@ -220,7 +229,7 @@ class DataManagerLoan @Inject constructor( * @return LoanRepaymentRequest */ fun updateLoanRepaymentTransaction( - loanRepaymentRequest: LoanRepaymentRequest + loanRepaymentRequest: LoanRepaymentRequest, ): Observable { return mDatabaseHelperLoan.updateLoanRepaymentTransaction(loanRepaymentRequest) } @@ -240,15 +249,15 @@ class DataManagerLoan @Inject constructor( */ fun getLoanTransactionTemplate( loanId: Int, - command: String? + command: String?, ): Observable { return mBaseApiManager.loanApi.getLoanTransactionTemplate(loanId, command) } fun disburseLoan( loanId: Int, - loanDisbursement: LoanDisbursement? + loanDisbursement: LoanDisbursement?, ): Observable { return mBaseApiManager.loanApi.disburseLoan(loanId, loanDisbursement) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerNote.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerNote.kt index d2f1c7ff35f..de7e030d971 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerNote.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerNote.kt @@ -1,10 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager -import android.database.Observable import com.mifos.core.databasehelper.DatabaseHelperNote import com.mifos.core.network.BaseApiManager import com.mifos.core.objects.noncore.Note -import kotlinx.coroutines.flow.StateFlow import javax.inject.Inject import javax.inject.Singleton @@ -16,7 +23,7 @@ import javax.inject.Singleton @Singleton class DataManagerNote @Inject constructor( val mBaseApiManager: BaseApiManager, - val mDatabaseHelperNote: DatabaseHelperNote + val mDatabaseHelperNote: DatabaseHelperNote, ) { /** * This Method Request the REST API of Note and In response give the List of Notes @@ -24,4 +31,4 @@ class DataManagerNote @Inject constructor( fun getNotes(entityType: String?, entityId: Int): List { return mBaseApiManager.noteApi.getNotes(entityType, entityId) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerOffices.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerOffices.kt index 04958f71bc5..d834d250441 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerOffices.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerOffices.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.databasehelper.DatabaseHelperOffices @@ -20,7 +29,7 @@ class DataManagerOffices @Inject constructor( val mBaseApiManager: BaseApiManager, private val mDatabaseHelperOffices: DatabaseHelperOffices, private val baseApiManager: org.mifos.core.apimanager.BaseApiManager, - private val prefManager: com.mifos.core.datastore.PrefManager + private val prefManager: com.mifos.core.datastore.PrefManager, ) { /** * return all List of Offices from DatabaseHelperOffices @@ -39,4 +48,4 @@ class DataManagerOffices @Inject constructor( */ mDatabaseHelperOffices.readAllOffices() } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerRunReport.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerRunReport.kt index e6b71de0470..a657e96f54a 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerRunReport.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerRunReport.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.network.BaseApiManager @@ -15,30 +24,34 @@ class DataManagerRunReport @Inject constructor(val mBaseApiManager: BaseApiManag suspend fun getReportCategories( reportCategory: String?, genericResultSet: Boolean, - parameterType: Boolean + parameterType: Boolean, ): List { return mBaseApiManager.runReportsService.getReportCategories( reportCategory, - genericResultSet, parameterType + genericResultSet, + parameterType, ) } suspend fun getReportFullParameterList( - reportName: String, parameterType: Boolean + reportName: String, + parameterType: Boolean, ): FullParameterListResponse { return mBaseApiManager.runReportsService .getReportFullParameterList(reportName, parameterType) } suspend fun getReportParameterDetails( - parameterName: String, parameterType: Boolean + parameterName: String, + parameterType: Boolean, ): FullParameterListResponse { return mBaseApiManager.runReportsService .getReportParameterDetails(parameterName, parameterType) } suspend fun getRunReportWithQuery( - reportName: String, options: Map + reportName: String, + options: Map, ): FullParameterListResponse { return mBaseApiManager.runReportsService .getRunReportWithQuery(reportName, options) @@ -46,29 +59,33 @@ class DataManagerRunReport @Inject constructor(val mBaseApiManager: BaseApiManag suspend fun getCenterSummaryInfo( centerId: Int, - genericResultSet: Boolean + genericResultSet: Boolean, ): List { return mBaseApiManager.runReportsService .getCenterSummaryInfo(centerId, genericResultSet) } suspend fun getRunReportOffices( - parameterName: String, officeId: Int, parameterType: Boolean + parameterName: String, + officeId: Int, + parameterType: Boolean, ): FullParameterListResponse { return mBaseApiManager.runReportsService.getReportOffice( parameterName, officeId, - parameterType + parameterType, ) } suspend fun getRunReportProduct( - parameterName: String, currency: String, parameterType: Boolean + parameterName: String, + currency: String, + parameterType: Boolean, ): FullParameterListResponse { return mBaseApiManager.runReportsService.getReportProduct( parameterName, currency, - parameterType + parameterType, ) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSavings.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSavings.kt index abde8f00a58..1c8b6821503 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSavings.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSavings.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.data.SavingsPayload @@ -16,7 +25,6 @@ import rx.Observable import javax.inject.Inject import javax.inject.Singleton - /** * Created by Rajan Maurya on 17/08/16. */ @@ -24,7 +32,7 @@ import javax.inject.Singleton class DataManagerSavings @Inject constructor( val mBaseApiManager: BaseApiManager, val mDatabaseHelperSavings: DatabaseHelperSavings, - private val prefManager: com.mifos.core.datastore.PrefManager + private val prefManager: com.mifos.core.datastore.PrefManager, ) { /** * This Method Make the Request to the REST API @@ -42,11 +50,15 @@ class DataManagerSavings @Inject constructor( * @return SavingsAccountWithAssociations */ fun getSavingsAccount( - type: String?, savingsAccountId: Int, association: String? + type: String?, + savingsAccountId: Int, + association: String?, ): Observable { return when (prefManager.userStatus) { false -> mBaseApiManager.savingsApi.getSavingsAccountWithAssociations( - type, savingsAccountId, association + type, + savingsAccountId, + association, ) true -> @@ -75,22 +87,25 @@ class DataManagerSavings @Inject constructor( * @return SavingsAccountWithAssociations */ fun syncSavingsAccount( - type: String?, savingsAccountId: Int, association: String? + type: String?, + savingsAccountId: Int, + association: String?, ): Observable { return mBaseApiManager.savingsApi.getSavingsAccountWithAssociations( type, - savingsAccountId, association + savingsAccountId, + association, ) .concatMap { savingsAccountWithAssociations -> mDatabaseHelperSavings.saveSavingsAccount( - savingsAccountWithAssociations + savingsAccountWithAssociations, ) } } fun activateSavings( savingsAccountId: Int, - request: HashMap + request: HashMap, ): Observable { return mBaseApiManager.savingsApi.activateSavings(savingsAccountId, request) } @@ -110,12 +125,15 @@ class DataManagerSavings @Inject constructor( * @return SavingsAccountTransactionTemplate */ fun getSavingsAccountTransactionTemplate( - type: String?, savingsAccountId: Int, transactionType: String? + type: String?, + savingsAccountId: Int, + transactionType: String?, ): Observable { return when (prefManager.userStatus) { false -> mBaseApiManager.savingsApi.getSavingsAccountTransactionTemplate( type, - savingsAccountId, transactionType + savingsAccountId, + transactionType, ) true -> @@ -140,16 +158,18 @@ class DataManagerSavings @Inject constructor( * @return SavingsAccountTransactionTemplate */ fun syncSavingsAccountTransactionTemplate( - savingsAccountType: String?, savingsAccountId: Int, transactionType: String? + savingsAccountType: String?, + savingsAccountId: Int, + transactionType: String?, ): Observable { return mBaseApiManager.savingsApi.getSavingsAccountTransactionTemplate( savingsAccountType, savingsAccountId, - transactionType + transactionType, ) .concatMap { savingsAccountTransactionTemplate -> mDatabaseHelperSavings.saveSavingsAccountTransactionTemplate( - savingsAccountTransactionTemplate + savingsAccountTransactionTemplate, ) } } @@ -167,13 +187,17 @@ class DataManagerSavings @Inject constructor( * @return SavingsAccountTransactionResponse */ fun processTransaction( - savingsAccountType: String?, savingsAccountId: Int, transactionType: String?, - request: SavingsAccountTransactionRequest + savingsAccountType: String?, + savingsAccountId: Int, + transactionType: String?, + request: SavingsAccountTransactionRequest, ): Observable { return when (prefManager.userStatus) { false -> mBaseApiManager.savingsApi.processTransaction( savingsAccountType, - savingsAccountId, transactionType, request + savingsAccountId, + transactionType, + request, ) true -> @@ -182,8 +206,10 @@ class DataManagerSavings @Inject constructor( */ mDatabaseHelperSavings .saveSavingsAccountTransaction( - savingsAccountType, savingsAccountId, - transactionType, request + savingsAccountType, + savingsAccountId, + transactionType, + request, ) } } @@ -198,7 +224,7 @@ class DataManagerSavings @Inject constructor( * @return SavingsAccountTransactionRequest */ fun getSavingsAccountTransaction( - savingAccountId: Int + savingAccountId: Int, ): Observable { return mDatabaseHelperSavings.getSavingsAccountTransaction(savingAccountId) } @@ -209,7 +235,7 @@ class DataManagerSavings @Inject constructor( * and returns the List * * @return List> - */ + */ val allSavingsAccountTransactions: Observable> get() = mDatabaseHelperSavings.allSavingsAccountTransaction @@ -220,9 +246,9 @@ class DataManagerSavings @Inject constructor( * * @param savingsAccountId Loan Id of the Loan * @return List - */ + */ fun deleteAndUpdateTransactions( - savingsAccountId: Int + savingsAccountId: Int, ): Observable> { return mDatabaseHelperSavings.deleteAndUpdateTransaction(savingsAccountId) } @@ -236,10 +262,10 @@ class DataManagerSavings @Inject constructor( * @return LoanRepaymentRequest */ fun updateLoanRepaymentTransaction( - savingsAccountTransactionRequest: SavingsAccountTransactionRequest + savingsAccountTransactionRequest: SavingsAccountTransactionRequest, ): Observable { return mDatabaseHelperSavings.updateSavingsAccountTransaction( - savingsAccountTransactionRequest + savingsAccountTransactionRequest, ) } @@ -255,30 +281,31 @@ class DataManagerSavings @Inject constructor( fun getClientSavingsAccountTemplateByProduct( clientId: Int, - productId: Int + productId: Int, ): Observable { return mBaseApiManager.savingsApi.getClientSavingsAccountTemplateByProduct( clientId, - productId + productId, ) } fun getGroupSavingsAccountTemplateByProduct( groupId: Int, - productId: Int + productId: Int, ): Observable { return mBaseApiManager.savingsApi.getGroupSavingsAccountTemplateByProduct( groupId, - productId + productId, ) } fun approveSavingsApplication( savingsAccountId: Int, - savingsApproval: SavingsApproval? + savingsApproval: SavingsApproval?, ): Observable { return mBaseApiManager.savingsApi.approveSavingsApplication( - savingsAccountId, savingsApproval + savingsAccountId, + savingsApproval, ) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSearch.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSearch.kt index f91dd309bf8..a639e74959b 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSearch.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSearch.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.network.BaseApiManager @@ -10,13 +19,13 @@ import javax.inject.Singleton */ @Singleton class DataManagerSearch @Inject constructor( - private val baseApiManager: BaseApiManager + private val baseApiManager: BaseApiManager, ) { suspend fun searchResources( query: String, resource: String?, - exactMatch: Boolean? + exactMatch: Boolean?, ): List { return baseApiManager.searchApi.searchResources(query, resource, exactMatch) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerStaff.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerStaff.kt index 687d3b5ff0d..b52fcb761cc 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerStaff.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerStaff.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.databasehelper.DatabaseHelperStaff @@ -16,7 +25,7 @@ class DataManagerStaff @Inject constructor( val mBaseApiManager: BaseApiManager, private val mDatabaseHelperStaff: DatabaseHelperStaff, private val baseApiManager: org.mifos.core.apimanager.BaseApiManager, - private val prefManager: com.mifos.core.datastore.PrefManager + private val prefManager: com.mifos.core.datastore.PrefManager, ) { /** * @param officeId @@ -34,4 +43,4 @@ class DataManagerStaff @Inject constructor( mDatabaseHelperStaff.readAllStaffOffices(officeId) } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSurveys.kt b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSurveys.kt index 46843f24295..6b094013685 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSurveys.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanager/DataManagerSurveys.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanager import com.mifos.core.databasehelper.DatabaseHelperSurveys @@ -20,7 +29,7 @@ import javax.inject.Singleton class DataManagerSurveys @Inject constructor( val mBaseApiManager: BaseApiManager, private val mDatabaseHelperSurveys: DatabaseHelperSurveys, - private val prefManager: com.mifos.core.datastore.PrefManager + private val prefManager: com.mifos.core.datastore.PrefManager, ) { /** * This Method sending the Request to REST API : @@ -28,7 +37,7 @@ class DataManagerSurveys @Inject constructor( * returns the Observable> to the Presenter. * * @return Observable> - */ + */ val allSurvey: Observable> get() = when (prefManager.userStatus) { false -> mBaseApiManager.surveyApi.allSurveys @@ -40,7 +49,7 @@ class DataManagerSurveys @Inject constructor( * read the all Surveys from the Database Survey table and returns the List. * * @return List - */ + */ val databaseSurveys: Observable> get() = mDatabaseHelperSurveys.readAllSurveys() @@ -49,7 +58,7 @@ class DataManagerSurveys @Inject constructor( * mDatabaseHelperSurveys.getQuestionDatas() read the all QuestionDatas * from the Database QuestionDatas table and returns the List. * @return List - */ + */ fun getDatabaseQuestionData(surveyId: Int): Observable> { return mDatabaseHelperSurveys.getQuestionDatas(surveyId) } @@ -59,7 +68,7 @@ class DataManagerSurveys @Inject constructor( * mDatabaseHelperSurveys.getResponseDatas() read the all ResponseDatas * from the Database ResponseDatas table and returns the List. * @return List - */ + */ fun getDatabaseResponseDatas(questionId: Int): Observable> { return mDatabaseHelperSurveys.getResponseDatas(questionId) } @@ -97,7 +106,7 @@ class DataManagerSurveys @Inject constructor( */ fun syncQuestionDataInDatabase( surveyId: Int, - questionDatas: QuestionDatas + questionDatas: QuestionDatas, ): Observable { return mDatabaseHelperSurveys.saveQuestionData(surveyId, questionDatas) } @@ -110,8 +119,8 @@ class DataManagerSurveys @Inject constructor( */ fun syncResponseDataInDatabase( questionId: Int, - responseDatas: ResponseDatas + responseDatas: ResponseDatas, ): Observable { return mDatabaseHelperSurveys.saveResponseData(questionId, responseDatas) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/datamanger/DataManagerAuth.kt b/core/network/src/main/java/com/mifos/core/network/datamanger/DataManagerAuth.kt index 44ee3856aed..184276cdfc7 100644 --- a/core/network/src/main/java/com/mifos/core/network/datamanger/DataManagerAuth.kt +++ b/core/network/src/main/java/com/mifos/core/network/datamanger/DataManagerAuth.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.datamanger import org.apache.fineract.client.models.PostAuthenticationRequest @@ -24,4 +33,4 @@ class DataManagerAuth @Inject constructor(private val baseApiManager: BaseApiMan } return baseApiManager.getAuthApi().authenticate(body, true) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/di/NetworkModule.kt b/core/network/src/main/java/com/mifos/core/network/di/NetworkModule.kt index 4b3de4b5164..e99129c9dd4 100644 --- a/core/network/src/main/java/com/mifos/core/network/di/NetworkModule.kt +++ b/core/network/src/main/java/com/mifos/core/network/di/NetworkModule.kt @@ -1,7 +1,15 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.di import android.content.Context -import android.util.Log import androidx.core.os.trace import coil.ImageLoader import coil.util.DebugLogger @@ -36,7 +44,7 @@ object NetworkModule { usernamePassword.second, prefManager.getServerConfig.getInstanceUrl(), prefManager.getServerConfig.tenant, - false + false, ) return baseManager } @@ -47,12 +55,11 @@ object NetworkModule { OkHttpClient.Builder().build() } - @Provides @Singleton fun provideImageLoader( okHttpCallFactory: dagger.Lazy, - @ApplicationContext context: Context + @ApplicationContext context: Context, ): ImageLoader { return ImageLoader.Builder(context) .callFactory { okHttpCallFactory.get() } @@ -60,4 +67,4 @@ object NetworkModule { logger(DebugLogger()) }.build() } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/mappers/centers/CenterMapper.kt b/core/network/src/main/java/com/mifos/core/network/mappers/centers/CenterMapper.kt index 5dfefe67483..be71919bede 100644 --- a/core/network/src/main/java/com/mifos/core/network/mappers/centers/CenterMapper.kt +++ b/core/network/src/main/java/com/mifos/core/network/mappers/centers/CenterMapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.mappers.centers import com.mifos.core.objects.client.Status @@ -39,4 +48,4 @@ object CenterMapper : AbstractMapper() { } } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/mappers/centers/GetCentersResponseMapper.kt b/core/network/src/main/java/com/mifos/core/network/mappers/centers/GetCentersResponseMapper.kt index be44a4f1537..44cafbf75a5 100644 --- a/core/network/src/main/java/com/mifos/core/network/mappers/centers/GetCentersResponseMapper.kt +++ b/core/network/src/main/java/com/mifos/core/network/mappers/centers/GetCentersResponseMapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.mappers.centers import com.mifos.core.objects.client.Page @@ -20,4 +29,4 @@ object GetCentersResponseMapper : AbstractMapper() { } } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetClientResponseMapper.kt b/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetClientResponseMapper.kt index 8799eb9f2f6..6834b9af4ec 100644 --- a/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetClientResponseMapper.kt +++ b/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetClientResponseMapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.mappers.clients import com.mifos.core.objects.client.Client @@ -20,4 +29,4 @@ object GetClientResponseMapper : AbstractMapper pageItems = ClientMapper.mapToEntityList(domainModel.pageItems) } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetClientsClientIdAccountMapper.kt b/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetClientsClientIdAccountMapper.kt index d28852af26c..78eb08a998b 100644 --- a/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetClientsClientIdAccountMapper.kt +++ b/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetClientsClientIdAccountMapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.mappers.clients import com.mifos.core.objects.accounts.ClientAccounts @@ -147,4 +156,4 @@ object GetClientsClientIdAccountMapper : } } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetIdentifiersTemplateMapper.kt b/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetIdentifiersTemplateMapper.kt index 65d9a0ec118..e1248412f47 100644 --- a/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetIdentifiersTemplateMapper.kt +++ b/core/network/src/main/java/com/mifos/core/network/mappers/clients/GetIdentifiersTemplateMapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.mappers.clients import com.mifos.core.objects.noncore.DocumentType @@ -36,4 +45,4 @@ object GetIdentifiersTemplateMapper : } } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/mappers/clients/IdentifierMapper.kt b/core/network/src/main/java/com/mifos/core/network/mappers/clients/IdentifierMapper.kt index 67d3d24a8a0..22b387c9057 100644 --- a/core/network/src/main/java/com/mifos/core/network/mappers/clients/IdentifierMapper.kt +++ b/core/network/src/main/java/com/mifos/core/network/mappers/clients/IdentifierMapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.mappers.clients import com.mifos.core.objects.noncore.DocumentType @@ -37,4 +46,4 @@ object IdentifierMapper : AbstractMapper>( pageItems = GroupMapper.mapToEntityList(domainModel.pageItems) } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/mappers/groups/GroupMapper.kt b/core/network/src/main/java/com/mifos/core/network/mappers/groups/GroupMapper.kt index d11622167f7..c85da3dbd02 100644 --- a/core/network/src/main/java/com/mifos/core/network/mappers/groups/GroupMapper.kt +++ b/core/network/src/main/java/com/mifos/core/network/mappers/groups/GroupMapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.mappers.groups import com.mifos.core.objects.client.Status @@ -39,4 +48,4 @@ object GroupMapper : AbstractMapper() { } } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/mappers/offices/GetOfficeResponseMapper.kt b/core/network/src/main/java/com/mifos/core/network/mappers/offices/GetOfficeResponseMapper.kt index b7c6afdefae..ddb37ce2a78 100644 --- a/core/network/src/main/java/com/mifos/core/network/mappers/offices/GetOfficeResponseMapper.kt +++ b/core/network/src/main/java/com/mifos/core/network/mappers/offices/GetOfficeResponseMapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.mappers.offices import com.mifos.core.objects.organisation.Office @@ -15,7 +24,7 @@ object GetOfficeResponseMapper : AbstractMapper() { openingDate = listOf( entity.openingDate?.year, entity.openingDate?.month, - entity.openingDate?.year + entity.openingDate?.year, ) externalId = entity.externalId } @@ -34,4 +43,4 @@ object GetOfficeResponseMapper : AbstractMapper() { externalId = domainModel.externalId } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/mappers/staffs/StaffMapper.kt b/core/network/src/main/java/com/mifos/core/network/mappers/staffs/StaffMapper.kt index 422d59ffd9d..49b5cb28804 100644 --- a/core/network/src/main/java/com/mifos/core/network/mappers/staffs/StaffMapper.kt +++ b/core/network/src/main/java/com/mifos/core/network/mappers/staffs/StaffMapper.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.mappers.staffs import com.mifos.core.objects.organisation.Staff @@ -30,4 +39,4 @@ object StaffMapper : AbstractMapper() { isActive = domainModel.isActive } } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/model/Changes.kt b/core/network/src/main/java/com/mifos/core/network/model/Changes.kt index 12b00b34c06..8d1fe14e05d 100644 --- a/core/network/src/main/java/com/mifos/core/network/model/Changes.kt +++ b/core/network/src/main/java/com/mifos/core/network/model/Changes.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.model @@ -8,9 +13,9 @@ import com.google.gson.Gson data class Changes( val locale: String, - val dateFormat: String + val dateFormat: String, ) { override fun toString(): String { return Gson().toJson(this) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/model/CollectionSheetPayload.kt b/core/network/src/main/java/com/mifos/core/network/model/CollectionSheetPayload.kt index 01a54a9a839..ca37e537399 100644 --- a/core/network/src/main/java/com/mifos/core/network/model/CollectionSheetPayload.kt +++ b/core/network/src/main/java/com/mifos/core/network/model/CollectionSheetPayload.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.model @@ -15,4 +20,4 @@ class CollectionSheetPayload : Payload() { override fun toString(): String { return Gson().toJson(this) } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/model/DefaultPayload.kt b/core/network/src/main/java/com/mifos/core/network/model/DefaultPayload.kt index 681abc6ac43..92223b32833 100644 --- a/core/network/src/main/java/com/mifos/core/network/model/DefaultPayload.kt +++ b/core/network/src/main/java/com/mifos/core/network/model/DefaultPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.model /** @@ -6,5 +15,5 @@ package com.mifos.core.network.model data class DefaultPayload( var dateFormat: String = "dd MMMM YYYY", - var locale: String = "en" -) \ No newline at end of file + var locale: String = "en", +) diff --git a/core/network/src/main/java/com/mifos/core/network/model/IndividualCollectionSheetPayload.kt b/core/network/src/main/java/com/mifos/core/network/model/IndividualCollectionSheetPayload.kt index 005b85b4333..ba146ac0806 100644 --- a/core/network/src/main/java/com/mifos/core/network/model/IndividualCollectionSheetPayload.kt +++ b/core/network/src/main/java/com/mifos/core/network/model/IndividualCollectionSheetPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.model import android.os.Parcelable @@ -16,5 +25,5 @@ data class IndividualCollectionSheetPayload( var bulkSavingsDueTransactions: List = ArrayList(), var dateFormat: String = "dd MMMM YYYY", var locale: String = "en", - var transactionDate: String? = null -) : Parcelable \ No newline at end of file + var transactionDate: String? = null, +) : Parcelable diff --git a/core/network/src/main/java/com/mifos/core/network/model/Payload.kt b/core/network/src/main/java/com/mifos/core/network/model/Payload.kt index 61e366e6b72..003b6116706 100644 --- a/core/network/src/main/java/com/mifos/core/network/model/Payload.kt +++ b/core/network/src/main/java/com/mifos/core/network/model/Payload.kt @@ -1,10 +1,15 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.model -//TODO Remove calendarId and TransactionDate from this Payload class; +// TODO Remove calendarId and TransactionDate from this Payload class; open class Payload { var dateFormat = "dd MMMM YYYY" var locale = "en" @@ -12,10 +17,10 @@ open class Payload { var transactionDate: String? = null override fun toString(): String { return "{" + - "dateFormat='" + dateFormat + '\'' + - ", locale='" + locale + '\'' + - ", calendarId=" + calendarId + - ", transactionDate='" + transactionDate + '\'' + - '}' + "dateFormat='" + dateFormat + '\'' + + ", locale='" + locale + '\'' + + ", calendarId=" + calendarId + + ", transactionDate='" + transactionDate + '\'' + + '}' } -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/model/RequestCollectionSheetPayload.kt b/core/network/src/main/java/com/mifos/core/network/model/RequestCollectionSheetPayload.kt index 732ec0ccb1b..58a8c6c1779 100644 --- a/core/network/src/main/java/com/mifos/core/network/model/RequestCollectionSheetPayload.kt +++ b/core/network/src/main/java/com/mifos/core/network/model/RequestCollectionSheetPayload.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.model /** @@ -8,5 +17,5 @@ data class RequestCollectionSheetPayload( var locale: String = "en", var officeId: Int? = null, var staffId: Int? = null, - var transactionDate: String = "" -) \ No newline at end of file + var transactionDate: String = "", +) diff --git a/core/network/src/main/java/com/mifos/core/network/model/ScorecardPayload.kt b/core/network/src/main/java/com/mifos/core/network/model/ScorecardPayload.kt index d03dcfbae8a..871a0f785c0 100644 --- a/core/network/src/main/java/com/mifos/core/network/model/ScorecardPayload.kt +++ b/core/network/src/main/java/com/mifos/core/network/model/ScorecardPayload.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.model @@ -14,5 +19,5 @@ data class ScorecardPayload( var userId: Int = 0, var clientId: Int = 0, var createdOn: Date? = null, - var scorecardValues: List? = null -) \ No newline at end of file + var scorecardValues: List? = null, +) diff --git a/core/network/src/main/java/com/mifos/core/network/services/CenterService.kt b/core/network/src/main/java/com/mifos/core/network/services/CenterService.kt index f769919365c..a12b4a8fed0 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/CenterService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/CenterService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -33,7 +38,7 @@ interface CenterService { fun getCenters( @Query("paged") b: Boolean, @Query("offset") offset: Int, - @Query("limit") limit: Int + @Query("limit") limit: Int, ): Observable> @GET(APIEndPoint.CENTERS + "/{centerId}/accounts") @@ -45,7 +50,7 @@ interface CenterService { @GET(APIEndPoint.CENTERS) suspend fun getAllCentersInOffice( @Query("officeId") officeId: Int, - @QueryMap additionalParams: Map + @QueryMap additionalParams: Map, ): List
@GET(APIEndPoint.CENTERS + "/{centerId}?associations=groupMembers") @@ -54,19 +59,19 @@ interface CenterService { @POST(APIEndPoint.CENTERS + "/{centerId}?command=generateCollectionSheet") fun getCollectionSheet( @Path("centerId") centerId: Long, - @Body payload: Payload? + @Body payload: Payload?, ): Observable @POST(APIEndPoint.CENTERS + "/{centerId}?command=saveCollectionSheet") fun saveCollectionSheet( @Path("centerId") centerId: Int, - @Body collectionSheetPayload: CollectionSheetPayload? + @Body collectionSheetPayload: CollectionSheetPayload?, ): Observable @POST(APIEndPoint.CENTERS + "/{centerId}?command=saveCollectionSheet") fun saveCollectionSheetAsync( @Path("centerId") centerId: Int, - @Body collectionSheetPayload: CollectionSheetPayload? + @Body collectionSheetPayload: CollectionSheetPayload?, ): Observable /*@POST(APIEndPoint.CLIENTS + "") @@ -80,7 +85,7 @@ interface CenterService { @Query("locale") locale: String?, @Query("meetingDate") meetingDate: String?, @Query("officeId") officeId: Int, - @Query("staffId") staffId: Int + @Query("staffId") staffId: Int, ): Observable> /** @@ -94,6 +99,6 @@ interface CenterService { @POST(APIEndPoint.CENTERS + "/{centerId}?command=activate") fun activateCenter( @Path("centerId") centerId: Int, - @Body activatePayload: ActivatePayload? + @Body activatePayload: ActivatePayload?, ): Observable -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/ChargeService.kt b/core/network/src/main/java/com/mifos/core/network/services/ChargeService.kt index e4d6a9d8da4..9c8b70dc666 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/ChargeService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/ChargeService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -35,13 +40,13 @@ interface ChargeService { fun getListOfCharges( @Path("clientId") clientId: Int, @Query("offset") offset: Int, - @Query("limit") limit: Int + @Query("limit") limit: Int, ): Observable> @POST(APIEndPoint.CLIENTS + "/{clientId}/charges") suspend fun createCharges( @Path("clientId") clientId: Int, - @Body chargesPayload: ChargesPayload + @Body chargesPayload: ChargesPayload, ): ChargeCreationResponse @GET(APIEndPoint.LOANS + "/{loanId}/charges") @@ -50,6 +55,6 @@ interface ChargeService { @POST(APIEndPoint.LOANS + "/{loanId}/charges") suspend fun createLoanCharges( @Path("loanId") loanId: Int, - @Body chargesPayload: ChargesPayload + @Body chargesPayload: ChargesPayload, ): ChargeCreationResponse -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/CheckerInboxService.kt b/core/network/src/main/java/com/mifos/core/network/services/CheckerInboxService.kt index 71650ef4162..cd8e408577c 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/CheckerInboxService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/CheckerInboxService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.services import com.mifos.core.model.APIEndPoint @@ -5,8 +14,11 @@ import com.mifos.core.network.GenericResponse import com.mifos.core.objects.checkerinboxandtasks.CheckerInboxSearchTemplate import com.mifos.core.objects.checkerinboxandtasks.CheckerTask import com.mifos.core.objects.checkerinboxandtasks.RescheduleLoansTask -import kotlinx.coroutines.flow.Flow -import retrofit2.http.* +import retrofit2.http.DELETE +import retrofit2.http.GET +import retrofit2.http.POST +import retrofit2.http.Path +import retrofit2.http.Query import rx.Observable interface CheckerInboxService { @@ -15,7 +27,7 @@ interface CheckerInboxService { suspend fun getCheckerList( @Query("actionName") actionName: String? = null, @Query("entityName") entityName: String? = null, - @Query("resourceId") resourceId: Int? = null + @Query("resourceId") resourceId: Int? = null, ): List @POST(APIEndPoint.MAKER_CHECKER + "/{auditId}?command=approve") @@ -37,7 +49,6 @@ interface CheckerInboxService { fun getCheckerTasksFromResourceId( @Query("actionName") actionName: String? = null, @Query("entityName") entityName: String? = null, - @Query("resourceId") resourceId: Int? = null + @Query("resourceId") resourceId: Int? = null, ): Observable> - -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/ClientAccountsService.kt b/core/network/src/main/java/com/mifos/core/network/services/ClientAccountsService.kt index 1b782aa7780..41007451efd 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/ClientAccountsService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/ClientAccountsService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -16,4 +21,4 @@ import rx.Observable interface ClientAccountsService { @GET(APIEndPoint.CLIENTS + "/{clientId}/accounts") fun getAllAccountsOfClient(@Path("clientId") clientId: Int): Observable -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/ClientService.kt b/core/network/src/main/java/com/mifos/core/network/services/ClientService.kt index 46a519c9cf2..f5255a21e8f 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/ClientService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/ClientService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -45,7 +50,7 @@ interface ClientService { fun getAllClients( @Query("paged") b: Boolean, @Query("offset") offset: Int, - @Query("limit") limit: Int + @Query("limit") limit: Int, ): Observable> @GET(APIEndPoint.CLIENTS + "/{clientId}") @@ -55,13 +60,13 @@ interface ClientService { @POST(APIEndPoint.CLIENTS + "/{clientId}/images") fun uploadClientImage( @Path("clientId") clientId: Int, - @Part file: MultipartBody.Part? + @Part file: MultipartBody.Part?, ): Observable @DELETE(APIEndPoint.CLIENTS + "/{clientId}/images") fun deleteClientImage(@Path("clientId") clientId: Int): Observable - //TODO: Implement when API Fixed + // TODO: Implement when API Fixed // @GET("/clients/{clientId}/images") // Observable getClientImage(@Path("clientId") int clientId); @POST(APIEndPoint.CLIENTS) @@ -80,7 +85,7 @@ interface ClientService { * * @param clientId Client Id * @return List - */ + */ @GET(APIEndPoint.CLIENTS + "/{clientId}/" + APIEndPoint.IDENTIFIERS) fun getClientIdentifiers(@Path("clientId") clientId: Int): Observable> @@ -96,7 +101,7 @@ interface ClientService { @POST(APIEndPoint.CLIENTS + "/{clientId}/identifiers") suspend fun createClientIdentifier( @Path("clientId") clientId: Int, - @Body identifierPayload: IdentifierPayload + @Body identifierPayload: IdentifierPayload, ): IdentifierCreationResponse /** @@ -123,7 +128,7 @@ interface ClientService { @DELETE(APIEndPoint.CLIENTS + "/{clientId}/" + APIEndPoint.IDENTIFIERS + "/{identifierId}") fun deleteClientIdentifier( @Path("clientId") clientId: Int, - @Path("identifierId") identifierId: Int + @Path("identifierId") identifierId: Int, ): Observable /** @@ -142,7 +147,7 @@ interface ClientService { */ @GET(APIEndPoint.DATATABLES + "/client_pinpoint_location/{clientId}") suspend fun getClientPinpointLocations( - @Path("clientId") clientId: Int + @Path("clientId") clientId: Int, ): List /** @@ -159,7 +164,7 @@ interface ClientService { @POST(APIEndPoint.DATATABLES + "/client_pinpoint_location/{clientId}") suspend fun addClientPinpointLocation( @Path("clientId") clientId: Int, - @Body clientAddressRequest: ClientAddressRequest? + @Body clientAddressRequest: ClientAddressRequest?, ): GenericResponse /** @@ -176,7 +181,7 @@ interface ClientService { @DELETE(APIEndPoint.DATATABLES + "/client_pinpoint_location/{apptableId}/{datatableId}") suspend fun deleteClientPinpointLocation( @Path("apptableId") apptableId: Int, - @Path("datatableId") datatableId: Int + @Path("datatableId") datatableId: Int, ): GenericResponse /** @@ -195,7 +200,7 @@ interface ClientService { suspend fun updateClientPinpointLocation( @Path("apptableId") apptableId: Int, @Path("datatableId") datatableId: Int, - @Body address: ClientAddressRequest? + @Body address: ClientAddressRequest?, ): GenericResponse /** @@ -209,6 +214,6 @@ interface ClientService { @POST(APIEndPoint.CLIENTS + "/{clientId}?command=activate") fun activateClient( @Path("clientId") clientId: Int, - @Body clientActivate: ActivatePayload? + @Body clientActivate: ActivatePayload?, ): Observable -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/CollectionSheetService.kt b/core/network/src/main/java/com/mifos/core/network/services/CollectionSheetService.kt index e07f65a6d88..3d0d05cdb53 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/CollectionSheetService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/CollectionSheetService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.services import com.mifos.core.model.APIEndPoint @@ -16,7 +25,6 @@ import retrofit2.http.GET import retrofit2.http.POST import retrofit2.http.Path import retrofit2.http.Query -import rx.Observable /** * Created by Tarun on 06-07-2017. @@ -24,14 +32,15 @@ import rx.Observable interface CollectionSheetService { @POST(APIEndPoint.COLLECTION_SHEET + "?command=generateCollectionSheet") suspend fun getIndividualCollectionSheet( - @Body payload: RequestCollectionSheetPayload? + @Body payload: RequestCollectionSheetPayload?, ): IndividualCollectionSheet @POST(APIEndPoint.COLLECTION_SHEET + "?command=saveCollectionSheet") suspend fun saveindividualCollectionSheet( - @Body payload: IndividualCollectionSheetPayload? + @Body payload: IndividualCollectionSheetPayload?, ): GenericResponse - //Productive CollectionSheet Endpoints + // Productive CollectionSheet Endpoints + /** * Endpoint to fetch Productive CollectionSheet * @param format "dd MMMM yyyy" @@ -47,7 +56,7 @@ interface CollectionSheetService { @Query("locale") locale: String?, @Query("meetingDate") meetingDate: String?, @Query("officeId") officeId: Int, - @Query("staffId") staffId: Int + @Query("staffId") staffId: Int, ): List /** @@ -59,28 +68,29 @@ interface CollectionSheetService { @POST(APIEndPoint.CENTERS + "/{centerId}" + "?command=generateCollectionSheet") suspend fun fetchProductiveSheet( @Path("centerId") centerId: Int, - @Body payload: CollectionSheetRequestPayload? + @Body payload: CollectionSheetRequestPayload?, ): CollectionSheetResponse @POST(APIEndPoint.CENTERS + "/{centerId}" + "?command=saveCollectionSheet") suspend fun submitProductiveSheet( @Path("centerId") centerId: Int, - @Body payload: ProductiveCollectionSheetPayload? + @Body payload: ProductiveCollectionSheetPayload?, ): GenericResponse @POST(APIEndPoint.GROUPS + "/{groupId}" + "?command=generateCollectionSheet") suspend fun fetchCollectionSheet( @Path("groupId") groupId: Int, - @Body payload: CollectionSheetRequestPayload? + @Body payload: CollectionSheetRequestPayload?, ): CollectionSheetResponse @POST(APIEndPoint.GROUPS + "/{groupId}" + "?command=saveCollectionSheet") suspend fun submitCollectionSheet( - @Path("groupId") groupId: Int, @Body payload: CollectionSheetPayload? + @Path("groupId") groupId: Int, + @Body payload: CollectionSheetPayload?, ): GenericResponse @GET(APIEndPoint.CENTERS + "/{centerId}?associations=groupMembers, collectionMeetingCalendar") suspend fun fetchGroupsAssociatedWithCenter( - @Path("centerId") centerId: Int + @Path("centerId") centerId: Int, ): CenterWithAssociations -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/DataTableService.kt b/core/network/src/main/java/com/mifos/core/network/services/DataTableService.kt index 97eb5c66069..f345ba8a890 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/DataTableService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/DataTableService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -27,30 +32,30 @@ interface DataTableService { @GET(APIEndPoint.DATATABLES + "/{dataTableName}/{entityId}/") suspend fun getDataOfDataTable( @Path("dataTableName") dataTableName: String, - @Path("entityId") entityId: Int + @Path("entityId") entityId: Int, ): JsonArray - //TODO Improve Body Implementation with Payload + // TODO Improve Body Implementation with Payload @POST(APIEndPoint.DATATABLES + "/{dataTableName}/{entityId}/") suspend fun createEntryInDataTable( @Path("dataTableName") dataTableName: String, @Path("entityId") entityId: Int, - @Body requestPayload: Map + @Body requestPayload: Map, ): GenericResponse @DELETE(APIEndPoint.DATATABLES + "/{dataTableName}/{entityId}/{dataTableRowId}") fun deleteEntryOfDataTableManyToMany( @Path("dataTableName") dataTableName: String?, @Path("entityId") entityId: Int, - @Path("dataTableRowId") dataTableRowId: Int + @Path("dataTableRowId") dataTableRowId: Int, ): Observable @POST(APIEndPoint.DATATABLES + "/user_tracking/{userId}") fun addUserPathTracking( @Path("userId") userId: Int, - @Body userLocation: UserLocation? + @Body userLocation: UserLocation?, ): Observable @GET(APIEndPoint.DATATABLES + "/user_tracking/{userId}") suspend fun getUserPathTracking(@Path("userId") userId: Int): List -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/DocumentService.kt b/core/network/src/main/java/com/mifos/core/network/services/DocumentService.kt index dfb656e09db..2041e8cf85e 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/DocumentService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/DocumentService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -25,7 +30,7 @@ interface DocumentService { @GET("{entityType}/{entityId}/" + APIEndPoint.DOCUMENTS) suspend fun getDocuments( @Path("entityType") entityType: String, - @Path("entityId") entityId: Int + @Path("entityId") entityId: Int, ): List /** @@ -43,7 +48,7 @@ interface DocumentService { @Path("entityId") entityId: Int, @Part("name") nameOfDocument: String?, @Part("description") description: String?, - @Part typedFile: MultipartBody.Part? + @Part typedFile: MultipartBody.Part?, ): Observable /** @@ -62,7 +67,7 @@ interface DocumentService { suspend fun downloadDocument( @Path("entityType") entityType: String, @Path("entityId") entityId: Int, - @Path("documentId") documentId: Int + @Path("documentId") documentId: Int, ): ResponseBody /** @@ -81,7 +86,7 @@ interface DocumentService { suspend fun removeDocument( @Path("entityType") entityType: String, @Path("entityId") entityId: Int, - @Path("documentId") documentId: Int + @Path("documentId") documentId: Int, ): GenericResponse /** @@ -107,6 +112,6 @@ interface DocumentService { @Path("documentId") documentId: Int, @Part("name") nameOfDocument: String?, @Part("description") description: String?, - @Part typedFile: MultipartBody.Part? + @Part typedFile: MultipartBody.Part?, ): Observable -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/GroupService.kt b/core/network/src/main/java/com/mifos/core/network/services/GroupService.kt index 116196c267f..3a8265fd0d6 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/GroupService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/GroupService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -29,7 +34,7 @@ interface GroupService { fun getGroups( @Query("paged") b: Boolean, @Query("offset") offset: Int, - @Query("limit") limit: Int + @Query("limit") limit: Int, ): Observable> @GET(APIEndPoint.GROUPS + "/{groupId}?associations=all") @@ -38,7 +43,7 @@ interface GroupService { @GET(APIEndPoint.GROUPS) suspend fun getAllGroupsInOffice( @Query("officeId") officeId: Int, - @QueryMap params: Map + @QueryMap params: Map, ): List @POST(APIEndPoint.GROUPS) @@ -61,6 +66,6 @@ interface GroupService { @POST(APIEndPoint.GROUPS + "/{groupId}?command=activate") fun activateGroup( @Path("groupId") groupId: Int, - @Body activatePayload: ActivatePayload? + @Body activatePayload: ActivatePayload?, ): Observable -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/LoanService.kt b/core/network/src/main/java/com/mifos/core/network/services/LoanService.kt index 29061a8fef8..9363c45ec41 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/LoanService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/LoanService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -43,7 +48,7 @@ interface LoanService { @POST(APIEndPoint.LOANS + "/{loanId}?command=approve") fun approveLoanApplication( @Path("loanId") loanId: Int, - @Body loanApproval: LoanApproval? + @Body loanApproval: LoanApproval?, ): Observable // Mandatory Fields @@ -51,13 +56,13 @@ interface LoanService { @POST(APIEndPoint.LOANS + "/{loanId}/?command=disburse") fun disburseLoan( @Path("loanId") loanId: Int, - @Body loanDisbursement: LoanDisbursement? + @Body loanDisbursement: LoanDisbursement?, ): Observable @POST(APIEndPoint.LOANS + "/{loanId}/transactions?command=repayment") fun submitPayment( @Path("loanId") loanId: Int, - @Body loanRepaymentRequest: LoanRepaymentRequest? + @Body loanRepaymentRequest: LoanRepaymentRequest?, ): Observable @GET(APIEndPoint.LOANS + "/{loanId}?associations=repaymentSchedule") @@ -75,7 +80,7 @@ interface LoanService { @GET(APIEndPoint.CREATE_LOANS_ACCOUNTS + "/template?templateType=individual") fun getLoansAccountTemplate( @Query("clientId") clientId: Int, - @Query("productId") productId: Int + @Query("productId") productId: Int, ): Observable /** @@ -94,7 +99,7 @@ interface LoanService { @GET(APIEndPoint.LOANS + "/{loanId}/transactions/template") fun getLoanTransactionTemplate( @Path("loanId") loanId: Int, - @Query("command") command: String? + @Query("command") command: String?, ): Observable @POST(APIEndPoint.CREATE_LOANS_ACCOUNTS) @@ -103,7 +108,7 @@ interface LoanService { @GET(APIEndPoint.CREATE_LOANS_ACCOUNTS + "/template?templateType=group") fun getGroupLoansAccountTemplate( @Query("groupId") groupId: Int, - @Query("productId") productId: Int + @Query("productId") productId: Int, ): Observable @GET(APIEndPoint.LOANS + "/{loanId}/" + APIEndPoint.CHARGES) @@ -111,4 +116,4 @@ interface LoanService { @GET(APIEndPoint.CLIENTS + "/{clientId}/" + APIEndPoint.CHARGES) fun getListOfCharges(@Path("clientId") clientId: Int): Observable> -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/NoteService.kt b/core/network/src/main/java/com/mifos/core/network/services/NoteService.kt index 8caa754b5f4..1fe03fa2e01 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/NoteService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/NoteService.kt @@ -1,13 +1,16 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services -import android.database.Observable import com.mifos.core.model.APIEndPoint import com.mifos.core.objects.noncore.Note -import kotlinx.coroutines.flow.StateFlow import retrofit2.http.GET import retrofit2.http.Path @@ -16,10 +19,10 @@ interface NoteService { @GET("{entityType}/{entityId}/" + APIEndPoint.NOTES) fun getNotes( @Path("entityType") entityType: String?, - @Path("entityId") entityId: Int + @Path("entityId") entityId: Int, ): List /** * @param entityType - Type for which note is being fetched (Client or Group) * @param entityId - Id of Entity */ -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/OfficeService.kt b/core/network/src/main/java/com/mifos/core/network/services/OfficeService.kt index 2127798d393..634234c3b92 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/OfficeService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/OfficeService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -7,7 +12,6 @@ package com.mifos.core.network.services import com.mifos.core.model.APIEndPoint import com.mifos.core.objects.organisation.Office import retrofit2.http.GET -import rx.Observable /** * @author fomenkoo @@ -20,4 +24,4 @@ interface OfficeService { */ @GET(APIEndPoint.OFFICES) suspend fun allOffices(): List -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/RunReportsService.kt b/core/network/src/main/java/com/mifos/core/network/services/RunReportsService.kt index 7ea0e277402..10297303ad0 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/RunReportsService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/RunReportsService.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.services import com.mifos.core.model.APIEndPoint @@ -24,7 +33,7 @@ interface RunReportsService { suspend fun getReportCategories( @Query("R_reportCategory") category: String?, @Query("genericResultSet") genericResultSet: Boolean, - @Query("parameterType") parameterType: Boolean + @Query("parameterType") parameterType: Boolean, ): List /** @@ -36,7 +45,7 @@ interface RunReportsService { @GET(APIEndPoint.RUN_REPORTS + "/FullParameterList") suspend fun getReportFullParameterList( @Query("R_reportListing") reportName: String, - @Query("parameterType") parameterType: Boolean + @Query("parameterType") parameterType: Boolean, ): FullParameterListResponse /** @@ -48,21 +57,21 @@ interface RunReportsService { @GET(APIEndPoint.RUN_REPORTS + "/{path}") suspend fun getReportParameterDetails( @Path("path") parameterName: String, - @Query("parameterType") parameterType: Boolean + @Query("parameterType") parameterType: Boolean, ): FullParameterListResponse @GET(APIEndPoint.RUN_REPORTS + "/{path}") suspend fun getReportOffice( @Path("path") parameterName: String, @Query("R_officeId") office: Int, - @Query("parameterType") parameterType: Boolean + @Query("parameterType") parameterType: Boolean, ): FullParameterListResponse @GET(APIEndPoint.RUN_REPORTS + "/{path}") suspend fun getReportProduct( @Path("path") parameterName: String, @Query("R_currencyId") currency: String, - @Query("parameterType") parameterType: Boolean + @Query("parameterType") parameterType: Boolean, ): FullParameterListResponse /** @@ -74,12 +83,12 @@ interface RunReportsService { @GET(APIEndPoint.RUN_REPORTS + "/{path}") suspend fun getRunReportWithQuery( @Path("path") reportName: String, - @QueryMap options: Map + @QueryMap options: Map, ): FullParameterListResponse @GET(APIEndPoint.RUN_REPORTS + "/GroupSummaryCounts") suspend fun getCenterSummaryInfo( @Query("R_groupId") centerId: Int, - @Query("genericResultSet") genericResultSet: Boolean + @Query("genericResultSet") genericResultSet: Boolean, ): List -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/SavingsAccountService.kt b/core/network/src/main/java/com/mifos/core/network/services/SavingsAccountService.kt index b3379a49d50..9c440f3a73a 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/SavingsAccountService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/SavingsAccountService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -46,7 +51,7 @@ interface SavingsAccountService { fun getSavingsAccountWithAssociations( @Path("savingsAccountType") savingsAccountType: String?, @Path("savingsAccountId") savingsAccountId: Int, - @Query("associations") association: String? + @Query("associations") association: String?, ): Observable /** @@ -63,7 +68,7 @@ interface SavingsAccountService { fun getSavingsAccountTransactionTemplate( @Path("savingsAccountType") savingsAccountType: String?, @Path("savingsAccountId") savingsAccountId: Int, - @Query("command") transactionType: String? + @Query("command") transactionType: String?, ): Observable /** @@ -82,19 +87,19 @@ interface SavingsAccountService { @Path("savingsAccountType") savingsAccountType: String?, @Path("savingsAccountId") savingsAccountId: Int, @Query("command") transactionType: String?, - @Body savingsAccountTransactionRequest: SavingsAccountTransactionRequest? + @Body savingsAccountTransactionRequest: SavingsAccountTransactionRequest?, ): Observable @POST(APIEndPoint.CREATE_SAVINGS_ACCOUNTS + "/{savingsAccountId}/?command=activate") fun activateSavings( @Path("savingsAccountId") savingsAccountId: Int, - @Body genericRequest: HashMap + @Body genericRequest: HashMap, ): Observable @POST(APIEndPoint.CREATE_SAVINGS_ACCOUNTS + "/{savingsAccountId}?command=approve") fun approveSavingsApplication( @Path("savingsAccountId") savingsAccountId: Int, - @Body savingsApproval: SavingsApproval? + @Body savingsApproval: SavingsApproval?, ): Observable @get:GET(APIEndPoint.CREATE_SAVINGS_PRODUCTS) @@ -109,12 +114,12 @@ interface SavingsAccountService { @GET(APIEndPoint.CREATE_SAVINGS_ACCOUNTS + "/template") fun getClientSavingsAccountTemplateByProduct( @Query("clientId") clientId: Int, - @Query("productId") productId: Int + @Query("productId") productId: Int, ): Observable @GET(APIEndPoint.CREATE_SAVINGS_ACCOUNTS + "/template") fun getGroupSavingsAccountTemplateByProduct( @Query("groupId") groupId: Int, - @Query("productId") productId: Int + @Query("productId") productId: Int, ): Observable -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/SearchService.kt b/core/network/src/main/java/com/mifos/core/network/services/SearchService.kt index 1ae66f516bd..9b7ee6132bb 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/SearchService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/SearchService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -18,6 +23,6 @@ interface SearchService { suspend fun searchResources( @Query("query") query: String, @Query("resource") resource: String?, - @Query("exactMatch") exactMatch: Boolean? + @Query("exactMatch") exactMatch: Boolean?, ): List -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/StaffService.kt b/core/network/src/main/java/com/mifos/core/network/services/StaffService.kt index 7523e2548f0..144e56664dd 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/StaffService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/StaffService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -22,4 +27,4 @@ interface StaffService { @get:GET(APIEndPoint.STAFF + "?isLoanOfficer=true") val fieldStaffForOffice: Observable> -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/services/SurveyService.kt b/core/network/src/main/java/com/mifos/core/network/services/SurveyService.kt index d971251bdd5..41395aa0ae9 100644 --- a/core/network/src/main/java/com/mifos/core/network/services/SurveyService.kt +++ b/core/network/src/main/java/com/mifos/core/network/services/SurveyService.kt @@ -1,5 +1,10 @@ /* - * This project is licensed under the open source MPL V2. + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ package com.mifos.core.network.services @@ -26,6 +31,6 @@ interface SurveyService { @POST(APIEndPoint.SURVEYS + "/{surveyId}/scorecards") fun submitScore( @Path("surveyId") surveyId: Int, - @Body scorecardPayload: Scorecard? + @Body scorecardPayload: Scorecard?, ): Observable -} \ No newline at end of file +} diff --git a/core/network/src/main/java/com/mifos/core/network/utils/ImageLoaderUtils.kt b/core/network/src/main/java/com/mifos/core/network/utils/ImageLoaderUtils.kt index fcb7955ce0f..a64bf806833 100644 --- a/core/network/src/main/java/com/mifos/core/network/utils/ImageLoaderUtils.kt +++ b/core/network/src/main/java/com/mifos/core/network/utils/ImageLoaderUtils.kt @@ -1,3 +1,12 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network.utils import android.content.Context @@ -11,14 +20,16 @@ import javax.inject.Inject class ImageLoaderUtils @Inject constructor( private val prefManager: com.mifos.core.datastore.PrefManager, private val imageLoader: ImageLoader, - @ApplicationContext private val context: Context + @ApplicationContext private val context: Context, ) { private fun buildImageUrl(clientId: Int): String { - return (prefManager.getInstanceUrl() - + "clients/" - + clientId - + "/images?maxHeight=120&maxWidth=120") + return ( + prefManager.getInstanceUrl() + + "clients/" + + clientId + + "/images?maxHeight=120&maxWidth=120" + ) } suspend fun loadImage(clientId: Int): ImageResult { @@ -30,4 +41,4 @@ class ImageLoaderUtils @Inject constructor( .build() return imageLoader.execute(request) } -} \ No newline at end of file +} diff --git a/core/network/src/test/java/com/mifos/core/network/ExampleUnitTest.kt b/core/network/src/test/java/com/mifos/core/network/ExampleUnitTest.kt index dc3064e936e..c31ba83ce30 100644 --- a/core/network/src/test/java/com/mifos/core/network/ExampleUnitTest.kt +++ b/core/network/src/test/java/com/mifos/core/network/ExampleUnitTest.kt @@ -1,9 +1,17 @@ +/* + * Copyright 2024 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * See https://github.com/openMF/android-client/blob/master/LICENSE.md + */ package com.mifos.core.network +import junit.framework.TestCase.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +22,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +}