diff --git a/androidApp/dependencies/demoDebugRuntimeClasspath.txt b/androidApp/dependencies/demoDebugRuntimeClasspath.txt index 6bc5ee9453..be9a20c674 100644 --- a/androidApp/dependencies/demoDebugRuntimeClasspath.txt +++ b/androidApp/dependencies/demoDebugRuntimeClasspath.txt @@ -188,11 +188,9 @@ com.russhwolf:multiplatform-settings-no-arg:1.2.0 com.russhwolf:multiplatform-settings-serialization-android-debug:1.2.0 com.russhwolf:multiplatform-settings-serialization:1.2.0 com.russhwolf:multiplatform-settings:1.2.0 -com.squareup.okhttp3:logging-interceptor:4.12.0 com.squareup.okhttp3:okhttp:4.12.0 com.squareup.okio:okio-jvm:3.9.1 com.squareup.okio:okio:3.9.1 -com.squareup.retrofit2:adapter-rxjava2:2.11.0 com.squareup.retrofit2:converter-gson:2.11.0 com.squareup.retrofit2:retrofit:2.11.0 dev.chrisbanes.snapper:snapper:0.2.2 @@ -239,7 +237,6 @@ io.ktor:ktor-websocket-serialization:3.0.1 io.ktor:ktor-websockets-jvm:3.0.1 io.ktor:ktor-websockets:3.0.1 io.michaelrocks:libphonenumber-android:8.13.35 -io.reactivex.rxjava2:rxjava:2.2.21 jakarta.inject:jakarta.inject-api:2.0.1 javax.inject:javax.inject:1 net.bytebuddy:byte-buddy-agent:1.14.8 @@ -276,7 +273,7 @@ org.jetbrains.compose.ui:ui:1.7.0-rc01 org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.0 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 @@ -306,5 +303,4 @@ org.jetbrains:annotations:23.0.0 org.jspecify:jspecify:1.0.0 org.mockito:mockito-core:5.6.0 org.objenesis:objenesis:3.3 -org.reactivestreams:reactive-streams:1.0.4 org.slf4j:slf4j-api:2.0.16 diff --git a/androidApp/dependencies/demoReleaseRuntimeClasspath.txt b/androidApp/dependencies/demoReleaseRuntimeClasspath.txt index 830fb760e9..8f6afb06d4 100644 --- a/androidApp/dependencies/demoReleaseRuntimeClasspath.txt +++ b/androidApp/dependencies/demoReleaseRuntimeClasspath.txt @@ -183,11 +183,9 @@ com.russhwolf:multiplatform-settings-no-arg:1.2.0 com.russhwolf:multiplatform-settings-serialization-android:1.2.0 com.russhwolf:multiplatform-settings-serialization:1.2.0 com.russhwolf:multiplatform-settings:1.2.0 -com.squareup.okhttp3:logging-interceptor:4.12.0 com.squareup.okhttp3:okhttp:4.12.0 com.squareup.okio:okio-jvm:3.9.1 com.squareup.okio:okio:3.9.1 -com.squareup.retrofit2:adapter-rxjava2:2.11.0 com.squareup.retrofit2:converter-gson:2.11.0 com.squareup.retrofit2:retrofit:2.11.0 dev.chrisbanes.snapper:snapper:0.2.2 @@ -234,7 +232,6 @@ io.ktor:ktor-websocket-serialization:3.0.1 io.ktor:ktor-websockets-jvm:3.0.1 io.ktor:ktor-websockets:3.0.1 io.michaelrocks:libphonenumber-android:8.13.35 -io.reactivex.rxjava2:rxjava:2.2.21 jakarta.inject:jakarta.inject-api:2.0.1 javax.inject:javax.inject:1 net.bytebuddy:byte-buddy-agent:1.14.8 @@ -271,7 +268,7 @@ org.jetbrains.compose.ui:ui:1.7.0-rc01 org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.0 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 @@ -301,5 +298,4 @@ org.jetbrains:annotations:23.0.0 org.jspecify:jspecify:1.0.0 org.mockito:mockito-core:5.6.0 org.objenesis:objenesis:3.3 -org.reactivestreams:reactive-streams:1.0.4 org.slf4j:slf4j-api:2.0.16 diff --git a/androidApp/dependencies/prodDebugRuntimeClasspath.txt b/androidApp/dependencies/prodDebugRuntimeClasspath.txt index 6bc5ee9453..be9a20c674 100644 --- a/androidApp/dependencies/prodDebugRuntimeClasspath.txt +++ b/androidApp/dependencies/prodDebugRuntimeClasspath.txt @@ -188,11 +188,9 @@ com.russhwolf:multiplatform-settings-no-arg:1.2.0 com.russhwolf:multiplatform-settings-serialization-android-debug:1.2.0 com.russhwolf:multiplatform-settings-serialization:1.2.0 com.russhwolf:multiplatform-settings:1.2.0 -com.squareup.okhttp3:logging-interceptor:4.12.0 com.squareup.okhttp3:okhttp:4.12.0 com.squareup.okio:okio-jvm:3.9.1 com.squareup.okio:okio:3.9.1 -com.squareup.retrofit2:adapter-rxjava2:2.11.0 com.squareup.retrofit2:converter-gson:2.11.0 com.squareup.retrofit2:retrofit:2.11.0 dev.chrisbanes.snapper:snapper:0.2.2 @@ -239,7 +237,6 @@ io.ktor:ktor-websocket-serialization:3.0.1 io.ktor:ktor-websockets-jvm:3.0.1 io.ktor:ktor-websockets:3.0.1 io.michaelrocks:libphonenumber-android:8.13.35 -io.reactivex.rxjava2:rxjava:2.2.21 jakarta.inject:jakarta.inject-api:2.0.1 javax.inject:javax.inject:1 net.bytebuddy:byte-buddy-agent:1.14.8 @@ -276,7 +273,7 @@ org.jetbrains.compose.ui:ui:1.7.0-rc01 org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.0 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 @@ -306,5 +303,4 @@ org.jetbrains:annotations:23.0.0 org.jspecify:jspecify:1.0.0 org.mockito:mockito-core:5.6.0 org.objenesis:objenesis:3.3 -org.reactivestreams:reactive-streams:1.0.4 org.slf4j:slf4j-api:2.0.16 diff --git a/androidApp/dependencies/prodReleaseRuntimeClasspath.txt b/androidApp/dependencies/prodReleaseRuntimeClasspath.txt index 830fb760e9..8f6afb06d4 100644 --- a/androidApp/dependencies/prodReleaseRuntimeClasspath.txt +++ b/androidApp/dependencies/prodReleaseRuntimeClasspath.txt @@ -183,11 +183,9 @@ com.russhwolf:multiplatform-settings-no-arg:1.2.0 com.russhwolf:multiplatform-settings-serialization-android:1.2.0 com.russhwolf:multiplatform-settings-serialization:1.2.0 com.russhwolf:multiplatform-settings:1.2.0 -com.squareup.okhttp3:logging-interceptor:4.12.0 com.squareup.okhttp3:okhttp:4.12.0 com.squareup.okio:okio-jvm:3.9.1 com.squareup.okio:okio:3.9.1 -com.squareup.retrofit2:adapter-rxjava2:2.11.0 com.squareup.retrofit2:converter-gson:2.11.0 com.squareup.retrofit2:retrofit:2.11.0 dev.chrisbanes.snapper:snapper:0.2.2 @@ -234,7 +232,6 @@ io.ktor:ktor-websocket-serialization:3.0.1 io.ktor:ktor-websockets-jvm:3.0.1 io.ktor:ktor-websockets:3.0.1 io.michaelrocks:libphonenumber-android:8.13.35 -io.reactivex.rxjava2:rxjava:2.2.21 jakarta.inject:jakarta.inject-api:2.0.1 javax.inject:javax.inject:1 net.bytebuddy:byte-buddy-agent:1.14.8 @@ -271,7 +268,7 @@ org.jetbrains.compose.ui:ui:1.7.0-rc01 org.jetbrains.kotlin:kotlin-android-extensions-runtime:2.1.0 org.jetbrains.kotlin:kotlin-parcelize-runtime:2.1.0 org.jetbrains.kotlin:kotlin-stdlib-common:2.1.0 -org.jetbrains.kotlin:kotlin-stdlib-jdk7:2.1.0 +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.23 org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.22 org.jetbrains.kotlin:kotlin-stdlib:2.1.0 org.jetbrains.kotlinx:atomicfu-jvm:0.23.2 @@ -301,5 +298,4 @@ org.jetbrains:annotations:23.0.0 org.jspecify:jspecify:1.0.0 org.mockito:mockito-core:5.6.0 org.objenesis:objenesis:3.3 -org.reactivestreams:reactive-streams:1.0.4 org.slf4j:slf4j-api:2.0.16 diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts index aa1450d2dc..b4c71445db 100644 --- a/core/data/build.gradle.kts +++ b/core/data/build.gradle.kts @@ -31,8 +31,8 @@ android { dependencies { api(projects.core.common) - api(projects.core.model) - api(projects.core.network) +// api(projects.core.model) +// api(projects.core.network) api(projects.core.database) api(projects.core.datastore) diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Charge.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Charge.kt index f894f34b49..6838f3a2d4 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Charge.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Charge.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Charge( val clientId: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/ChargeTimeType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/ChargeTimeType.kt index f9619ea59f..a7a8aa9b3b 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/ChargeTimeType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/ChargeTimeType.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by michaelsosnick on 12/11/16. - */ - +@Serializable @Parcelize data class ChargeTimeType( val id: Int = 0, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Currency.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Currency.kt index 2935c20865..d9ea1ddbc2 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Currency.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Currency.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by michaelsosnick on 12/11/16. - */ - +@Serializable @Parcelize data class Currency( val code: String? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Timeline.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Timeline.kt index 207b124074..ce4c4f3eea 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Timeline.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Timeline.kt @@ -9,6 +9,7 @@ */ package org.mifos.mobile.core.model.entity +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize @@ -22,6 +23,7 @@ import org.mifos.mobile.core.model.Parcelize * See https://github.com/openMF/android-client/blob/master/LICENSE.md */ +@Serializable @Parcelize data class Timeline( val submittedOnDate: List = emptyList(), diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Transaction.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Transaction.kt index a572a7710d..528a86c6d1 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Transaction.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/Transaction.kt @@ -9,15 +9,12 @@ */ package org.mifos.mobile.core.model.entity +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.client.Type -/** - * @author Vishwajeet - * @since 10/8/16. - */ - +@Serializable @Parcelize data class Transaction( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/User.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/User.kt index c29a16dea8..313de793c8 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/User.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/User.kt @@ -10,13 +10,11 @@ package org.mifos.mobile.core.model.entity import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * @author Vishwajeet - * @since 12/06/16 - */ +@Serializable @Parcelize data class User( val userId: Long = 0, @@ -32,6 +30,7 @@ data class User( val isTwoFactorAuthenticationRequired: Boolean = false, ) : Parcelable +@Serializable @Parcelize data class Role( @SerialName("id") diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/AmortizationType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/AmortizationType.kt index 2139e9b04d..ac5bf3621a 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/AmortizationType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/AmortizationType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class AmortizationType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Currency.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Currency.kt index b75eae4c63..50d95d9085 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Currency.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Currency.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Currency( val code: String? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/DaysInMonthType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/DaysInMonthType.kt index 1399470896..ed622042f3 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/DaysInMonthType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/DaysInMonthType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class DaysInMonthType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/DaysInYearType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/DaysInYearType.kt index c68ed24363..3405250f15 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/DaysInYearType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/DaysInYearType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class DaysInYearType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestCalculationPeriodType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestCalculationPeriodType.kt index ea2f93a103..7dd7b8bdd5 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestCalculationPeriodType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestCalculationPeriodType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class InterestCalculationPeriodType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRateFrequencyType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRateFrequencyType.kt index 1e27b62986..aa0ebebaf7 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRateFrequencyType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRateFrequencyType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class InterestRateFrequencyType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRecalculationCompoundingType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRecalculationCompoundingType.kt index 02a854f2b3..2c12e3f5b3 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRecalculationCompoundingType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRecalculationCompoundingType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class InterestRecalculationCompoundingType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRecalculationData.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRecalculationData.kt index 7780813b70..a683251600 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRecalculationData.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestRecalculationData.kt @@ -10,10 +10,12 @@ package org.mifos.mobile.core.model.entity.accounts.loan import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.accounts.loan.calendardata.CalendarData +@Serializable @Parcelize data class InterestRecalculationData( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestType.kt index ac26d32266..0d76b37e5a 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/InterestType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class InterestType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanAccount.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanAccount.kt index 71bb4da73b..ba067dd989 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanAccount.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanAccount.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class LoanAccount( val id: Long = 0, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanType.kt index 82f3d8bb4a..4bbc7c41bf 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class LoanType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanWithAssociations.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanWithAssociations.kt index 0095f93af3..4c02a1fbfa 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanWithAssociations.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/LoanWithAssociations.kt @@ -10,10 +10,12 @@ package org.mifos.mobile.core.model.entity.accounts.loan import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.Transaction +@Serializable @Parcelize data class LoanWithAssociations( val id: Int? = null, @@ -72,7 +74,7 @@ data class LoanWithAssociations( val interestCalculationPeriodType: InterestCalculationPeriodType? = null, - val allowPartialPeriodInterestCalcualtion: Boolean? = null, + val allowPartialPeriodInterestCalculation: Boolean? = null, val transactionProcessingStrategyId: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Periods.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Periods.kt index 2492cb5fca..cf44735fb7 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Periods.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Periods.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Periods( val period: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RecalculationCompoundingFrequencyType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RecalculationCompoundingFrequencyType.kt index f27a4af466..684b31e2dc 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RecalculationCompoundingFrequencyType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RecalculationCompoundingFrequencyType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class RecalculationCompoundingFrequencyType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RecalculationRestFrequencyType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RecalculationRestFrequencyType.kt index 8099288a47..c0244f12ca 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RecalculationRestFrequencyType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RecalculationRestFrequencyType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class RecalculationRestFrequencyType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RepaymentFrequencyType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RepaymentFrequencyType.kt index 6b1c869add..421acf73ed 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RepaymentFrequencyType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RepaymentFrequencyType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class RepaymentFrequencyType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RepaymentSchedule.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RepaymentSchedule.kt index 9801e154fd..27e4b53237 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RepaymentSchedule.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RepaymentSchedule.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class RepaymentSchedule( val currency: Currency? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RescheduleStrategyType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RescheduleStrategyType.kt index bf2dd5058f..3273429dd2 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RescheduleStrategyType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/RescheduleStrategyType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class RescheduleStrategyType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Status.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Status.kt index ea6bde8200..97f5793863 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Status.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Status.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Status( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Summary.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Summary.kt index e3de26c107..26909262c6 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Summary.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Summary.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Summary( val principalDisbursed: Double = 0.0, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/TermPeriodFrequencyType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/TermPeriodFrequencyType.kt index 81c96e8c73..b7d262e3c4 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/TermPeriodFrequencyType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/TermPeriodFrequencyType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class TermPeriodFrequencyType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Timeline.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Timeline.kt index 8469bf3fb6..994279e362 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Timeline.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/Timeline.kt @@ -9,10 +9,12 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize @Suppress("ktlint:standard:property-naming") +@Serializable @Parcelize data class Timeline( val submittedOnDate: List? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/CalendarData.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/CalendarData.kt index b4b540c283..0f217bdc27 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/CalendarData.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/CalendarData.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan.calendardata +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class CalendarData( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/EntityType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/EntityType.kt index a4430e4ce2..b2693f4a30 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/EntityType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/EntityType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan.calendardata +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class EntityType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/Frequency.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/Frequency.kt index c03da76ade..71f207e08a 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/Frequency.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/Frequency.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan.calendardata +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Frequency( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/RepeatsOnNthDayOfMonth.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/RepeatsOnNthDayOfMonth.kt index b88ebc22c3..117c8a126b 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/RepeatsOnNthDayOfMonth.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/RepeatsOnNthDayOfMonth.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan.calendardata +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class RepeatsOnNthDayOfMonth( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/Type.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/Type.kt index a2542ec721..8296c48a7b 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/Type.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/loan/calendardata/Type.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.loan.calendardata +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Type( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Currency.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Currency.kt index 25efb6bbd7..12a27fa44b 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Currency.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Currency.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Currency( val code: String? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/PaymentDetailData.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/PaymentDetailData.kt index e26f6e5c02..4e02f979f1 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/PaymentDetailData.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/PaymentDetailData.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class PaymentDetailData( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/PaymentType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/PaymentType.kt index 3e004c3004..fc9b354193 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/PaymentType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/PaymentType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class PaymentType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/SavingAccount.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/SavingAccount.kt index 5a052cdb78..012e5ba034 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/SavingAccount.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/SavingAccount.kt @@ -9,10 +9,12 @@ */ package org.mifos.mobile.core.model.entity.accounts.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.client.DepositType +@Serializable @Parcelize data class SavingAccount( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/SavingsWithAssociations.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/SavingsWithAssociations.kt index 73db0e2ba6..32cc25681e 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/SavingsWithAssociations.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/SavingsWithAssociations.kt @@ -9,10 +9,12 @@ */ package org.mifos.mobile.core.model.entity.accounts.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.client.DepositType +@Serializable @Parcelize data class SavingsWithAssociations( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Status.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Status.kt index 733e33c310..144bae9a95 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Status.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Status.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Status( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Summary.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Summary.kt index 2df5b96fac..d5a79d8b57 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Summary.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Summary.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Summary( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/TimeLine.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/TimeLine.kt index a54230d44f..937358eeb2 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/TimeLine.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/TimeLine.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class TimeLine( val submittedOnDate: List = emptyList(), diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/TransactionType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/TransactionType.kt index 186db1dac0..c0f41339db 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/TransactionType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/TransactionType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class TransactionType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Transactions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Transactions.kt index 3aef2261fc..0f13cc60f8 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Transactions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/savings/Transactions.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Transactions( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/ShareAccount.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/ShareAccount.kt index 0cd15bb526..b691fd3c20 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/ShareAccount.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/ShareAccount.kt @@ -9,10 +9,12 @@ */ package org.mifos.mobile.core.model.entity.accounts.share +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.accounts.savings.Currency +@Serializable @Parcelize data class ShareAccount( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/Status.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/Status.kt index 228345cdc3..9d89ba4f95 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/Status.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/Status.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.share +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Status( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/Timeline.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/Timeline.kt index 97a06e4785..b864cd3bc3 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/Timeline.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/accounts/share/Timeline.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.accounts.share +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Timeline( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/Beneficiary.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/Beneficiary.kt index 40f3f02a49..9cd5cc3836 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/Beneficiary.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/Beneficiary.kt @@ -9,10 +9,12 @@ */ package org.mifos.mobile.core.model.entity.beneficiary +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.templates.account.AccountType +@Serializable @Parcelize data class Beneficiary( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/BeneficiaryPayload.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/BeneficiaryPayload.kt index e51e1e971b..edb3c669cb 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/BeneficiaryPayload.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/BeneficiaryPayload.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.beneficiary +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class BeneficiaryPayload( internal val locale: String = "en_GB", diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/BeneficiaryUpdatePayload.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/BeneficiaryUpdatePayload.kt index ef929f8e05..64bac51ac9 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/BeneficiaryUpdatePayload.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/beneficiary/BeneficiaryUpdatePayload.kt @@ -9,7 +9,10 @@ */ package org.mifos.mobile.core.model.entity.beneficiary -data class BeneficiaryUpdatePayload constructor( +import kotlinx.serialization.Serializable + +@Serializable +data class BeneficiaryUpdatePayload( val name: String? = null, val transferLimit: Float = 0f, ) diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Client.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Client.kt index 8ede768e83..a4240d29fc 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Client.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Client.kt @@ -9,10 +9,12 @@ */ package org.mifos.mobile.core.model.entity.client +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.Timeline +@Serializable @Parcelize data class Client( val id: Int = 0, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientAccounts.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientAccounts.kt index abf3cf5e0c..14511c32c1 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientAccounts.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientAccounts.kt @@ -9,17 +9,18 @@ */ package org.mifos.mobile.core.model.entity.client +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.accounts.loan.LoanAccount import org.mifos.mobile.core.model.entity.accounts.savings.SavingAccount import org.mifos.mobile.core.model.entity.accounts.share.ShareAccount +@Serializable @Parcelize data class ClientAccounts( val loanAccounts: List = emptyList(), val savingsAccounts: List? = emptyList(), - val shareAccounts: List = emptyList(), ) : Parcelable { diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientClassification.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientClassification.kt index 338371f126..ff17dc839b 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientClassification.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientClassification.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.client +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class ClientClassification( val id: Int, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientType.kt index de1f86759e..0fa1547fbb 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/ClientType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.client +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class ClientType( val id: Int, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/DepositType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/DepositType.kt index cccc66fa96..be9da31047 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/DepositType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/DepositType.kt @@ -9,6 +9,7 @@ */ package org.mifos.mobile.core.model.entity.client +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize @@ -16,6 +17,7 @@ import org.mifos.mobile.core.model.Parcelize private const val SAVINGS_ACCOUNTS = "savingsaccounts" private const val RECURRING_ACCOUNTS = "recurringdepositaccounts" +@Serializable @Parcelize data class DepositType( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Gender.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Gender.kt index 1dccf090e8..c48cc6fddf 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Gender.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Gender.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.client +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Gender( val id: Int, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Group.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Group.kt index b1fc0a5c4c..137120aa14 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Group.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Group.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.client +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Group( val id: Int, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Status.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Status.kt index dea2e28229..8966d7248a 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Status.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Status.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.client +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Status( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Type.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Type.kt index 0ce9c2b609..cc6ada7bbb 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Type.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/client/Type.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.client +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class Type( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorPayload.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorPayload.kt index ec5976cb6f..18aefbb8e2 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorPayload.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorPayload.kt @@ -9,14 +9,12 @@ */ package org.mifos.mobile.core.model.entity.guarantor -/* - * Created by saksham on 24/July/2018 - */ - +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.RawValue +@Serializable @Parcelize data class GuarantorPayload( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorTemplatePayload.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorTemplatePayload.kt index b62c9ce78c..7b83c75b15 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorTemplatePayload.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorTemplatePayload.kt @@ -9,10 +9,9 @@ */ package org.mifos.mobile.core.model.entity.guarantor -/* - * Created by saksham on 23/July/2018 - */ +import kotlinx.serialization.Serializable +@Serializable data class GuarantorTemplatePayload( val guarantorType: GuarantorType? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorType.kt index e2932426d4..a5267f2bb4 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/guarantor/GuarantorType.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.guarantor +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/* - * Created by saksham on 23/July/2018 - */ - +@Serializable @Parcelize class GuarantorType( val id: Long? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/notification/NotificationUserDetail.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/notification/NotificationUserDetail.kt index 6c3cf57915..749b82eec8 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/notification/NotificationUserDetail.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/notification/NotificationUserDetail.kt @@ -9,11 +9,11 @@ */ package org.mifos.mobile.core.model.entity.notification -/** - * Created by dilpreet on 17/12/17. - */ +import kotlinx.serialization.Serializable +@Serializable data class NotificationUserDetail( val id: Int = 0, + ) diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/payload/LoansPayload.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/payload/LoansPayload.kt index ca8f4b68f0..75046862ee 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/payload/LoansPayload.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/payload/LoansPayload.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.payload +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by nellyk on 2/20/2016. - */ - +@Serializable @Parcelize data class LoansPayload( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/payload/LoginPayload.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/payload/LoginPayload.kt index 02be522420..58dc1ad888 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/payload/LoginPayload.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/payload/LoginPayload.kt @@ -9,6 +9,9 @@ */ package org.mifos.mobile.core.model.entity.payload +import kotlinx.serialization.Serializable + +@Serializable data class LoginPayload( val username: String, val password: String, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountOption.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountOption.kt index d232c02ff9..81bd5220ac 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountOption.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountOption.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.account +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 10/03/17. - */ - +@Serializable @Parcelize data class AccountOption( val accountId: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountOptionsTemplate.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountOptionsTemplate.kt index ef23ad27ea..40630d235f 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountOptionsTemplate.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountOptionsTemplate.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.account +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 10/03/17. - */ - +@Serializable @Parcelize data class AccountOptionsTemplate( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountType.kt index 92042ff8e7..783295dddb 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/account/AccountType.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.account +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 10/03/17. - */ - +@Serializable @Parcelize data class AccountType( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/beneficiary/AccountTypeOption.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/beneficiary/AccountTypeOption.kt index 6788da35aa..6590ab21c4 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/beneficiary/AccountTypeOption.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/beneficiary/AccountTypeOption.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.beneficiary +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by dilpreet on 14/6/17. - */ - +@Serializable @Parcelize data class AccountTypeOption( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/beneficiary/BeneficiaryTemplate.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/beneficiary/BeneficiaryTemplate.kt index cca21f8050..1142b1e0c6 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/beneficiary/BeneficiaryTemplate.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/beneficiary/BeneficiaryTemplate.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.beneficiary +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by dilpreet on 14/6/17. - */ - +@Serializable @Parcelize data class BeneficiaryTemplate( val accountTypeOptions: List? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AccountLinkingOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AccountLinkingOptions.kt index 7ccc16be8d..e1c349a6f0 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AccountLinkingOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AccountLinkingOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Tarun on 12/16/2016. - */ - +@Serializable @Parcelize data class AccountLinkingOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AccountingRule.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AccountingRule.kt index 0086f37a8c..6e0824d244 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AccountingRule.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AccountingRule.kt @@ -9,12 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ +@Serializable @Parcelize data class AccountingRule( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AllowAttributeOverrides.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AllowAttributeOverrides.kt index 1db244367e..67ee0f0b54 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AllowAttributeOverrides.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AllowAttributeOverrides.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class AllowAttributeOverrides( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AmortizationTypeOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AmortizationTypeOptions.kt index 25252130c8..f682226b2e 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AmortizationTypeOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/AmortizationTypeOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class AmortizationTypeOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargeAppliesTo.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargeAppliesTo.kt index b78f36e166..ff90d5e112 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargeAppliesTo.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargeAppliesTo.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class ChargeAppliesTo( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargeOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargeOptions.kt index 9d10dcd757..00e44f0d70 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargeOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargeOptions.kt @@ -9,15 +9,13 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.ChargeCalculationType import org.mifos.mobile.core.model.entity.ChargeTimeType -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class ChargeOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargePaymentMode.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargePaymentMode.kt index 6645ce488e..90f2818f12 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargePaymentMode.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ChargePaymentMode.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class ChargePaymentMode( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Currency.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Currency.kt index 179c0c95fa..8a97423e2e 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Currency.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Currency.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class Currency( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/FundOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/FundOptions.kt index 0fa27ffe61..184d243fce 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/FundOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/FundOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class FundOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/InterestRateFrequencyTypeOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/InterestRateFrequencyTypeOptions.kt index 138f39e309..588cc98452 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/InterestRateFrequencyTypeOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/InterestRateFrequencyTypeOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class InterestRateFrequencyTypeOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/InterestTypeOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/InterestTypeOptions.kt index 49c1ad8820..ed3b9a70a7 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/InterestTypeOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/InterestTypeOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class InterestTypeOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanCollateralOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanCollateralOptions.kt index 7a596dc22b..c5dc56e314 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanCollateralOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanCollateralOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class LoanCollateralOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanOfficerOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanOfficerOptions.kt index 4488029f3f..b0d29eed23 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanOfficerOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanOfficerOptions.kt @@ -10,13 +10,11 @@ package org.mifos.mobile.core.model.entity.templates.loans import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class LoanOfficerOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanPurposeOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanPurposeOptions.kt index b66a5c0eb1..f799ff6ef3 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanPurposeOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanPurposeOptions.kt @@ -10,13 +10,11 @@ package org.mifos.mobile.core.model.entity.templates.loans import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class LoanPurposeOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanTemplate.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanTemplate.kt index 10f63d3267..ba010b2410 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanTemplate.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/LoanTemplate.kt @@ -10,6 +10,7 @@ package org.mifos.mobile.core.model.entity.templates.loans import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.accounts.loan.AmortizationType @@ -21,10 +22,7 @@ import org.mifos.mobile.core.model.entity.accounts.loan.InterestType import org.mifos.mobile.core.model.entity.accounts.loan.RepaymentFrequencyType import org.mifos.mobile.core.model.entity.accounts.loan.TermPeriodFrequencyType -/** - * Created by Rajan Maurya on 15/07/16. - */ - +@Serializable @Parcelize data class LoanTemplate( @@ -78,7 +76,7 @@ data class LoanTemplate( val interestCalculationPeriodType: InterestCalculationPeriodType? = null, - val allowPartialPeriodInterestCalcualtion: Boolean? = null, + val allowPartialPeriodInterestCalculation: Boolean? = null, val transactionProcessingStrategyId: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Product.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Product.kt index 142de75ef4..e7827adcfb 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Product.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Product.kt @@ -10,6 +10,7 @@ package org.mifos.mobile.core.model.entity.templates.loans import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.accounts.loan.AmortizationType @@ -21,10 +22,7 @@ import org.mifos.mobile.core.model.entity.accounts.loan.InterestRecalculationDat import org.mifos.mobile.core.model.entity.accounts.loan.InterestType import org.mifos.mobile.core.model.entity.accounts.loan.RepaymentFrequencyType -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class Product( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ProductOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ProductOptions.kt index 41af18eba4..0b2248d206 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ProductOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/ProductOptions.kt @@ -10,13 +10,11 @@ package org.mifos.mobile.core.model.entity.templates.loans import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class ProductOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyDaysOfWeekTypeOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyDaysOfWeekTypeOptions.kt index 4dd4aa0c1f..6efa0b7b88 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyDaysOfWeekTypeOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyDaysOfWeekTypeOptions.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class RepaymentFrequencyDaysOfWeekTypeOptions( diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyNthDayTypeOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyNthDayTypeOptions.kt index 2d25d392ab..a354b8df47 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyNthDayTypeOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyNthDayTypeOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class RepaymentFrequencyNthDayTypeOptions( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyTypeOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyTypeOptions.kt index b012b1e15e..6598cc786a 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyTypeOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/RepaymentFrequencyTypeOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class RepaymentFrequencyTypeOptions( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TaxGroup.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TaxGroup.kt index 46dafa863d..6620251f1c 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TaxGroup.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TaxGroup.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class TaxGroup( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TermFrequencyTypeOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TermFrequencyTypeOptions.kt index 99c835dbbd..c020fddf93 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TermFrequencyTypeOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TermFrequencyTypeOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class TermFrequencyTypeOptions( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Timeline.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Timeline.kt index e875d94171..1703ed6850 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Timeline.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/Timeline.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class Timeline( val expectedDisbursementDate: List, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TransactionProcessingStrategyOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TransactionProcessingStrategyOptions.kt index 31ea0d1b88..baad6ce0ec 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TransactionProcessingStrategyOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/loans/TransactionProcessingStrategyOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.loans +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/** - * Created by Rajan Maurya on 16/07/16. - */ - +@Serializable @Parcelize data class TransactionProcessingStrategyOptions( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeAppliesTo.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeAppliesTo.kt index 8875e87060..24c25eb7a9 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeAppliesTo.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeAppliesTo.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class ChargeAppliesTo( val id: Float = 0f, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeCalculationType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeCalculationType.kt index 29d733816f..c2e0aefddd 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeCalculationType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeCalculationType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class ChargeCalculationType( val id: Float = 0f, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeOptions.kt index 86636e9285..31123dae83 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeOptions.kt @@ -9,10 +9,12 @@ */ package org.mifos.mobile.core.model.entity.templates.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize import org.mifos.mobile.core.model.entity.Currency +@Serializable @Parcelize data class ChargeOptions( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargePaymentMode.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargePaymentMode.kt index 7482f19d48..fa04bf057a 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargePaymentMode.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargePaymentMode.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class ChargePaymentMode( val id: Float = 0f, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeTimeType.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeTimeType.kt index d269850c2c..837cfc8f10 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeTimeType.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ChargeTimeType.kt @@ -9,9 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class ChargeTimeType( val id: Float = 0f, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ProductOptions.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ProductOptions.kt index e4024bcd73..1dc10133e8 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ProductOptions.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/ProductOptions.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.savings +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize -/* - * Created by saksham on 01/July/2018 - */ - +@Serializable @Parcelize data class ProductOptions( val id: Int? = null, diff --git a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/SavingsAccountTemplate.kt b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/SavingsAccountTemplate.kt index 1c2e0ff0b9..33f80c869b 100644 --- a/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/SavingsAccountTemplate.kt +++ b/core/model/src/commonMain/kotlin/org/mifos/mobile/core/model/entity/templates/savings/SavingsAccountTemplate.kt @@ -9,13 +9,11 @@ */ package org.mifos.mobile.core.model.entity.templates.savings -/* - * Created by saksham on 01/July/2018 - */ - +import kotlinx.serialization.Serializable import org.mifos.mobile.core.model.Parcelable import org.mifos.mobile.core.model.Parcelize +@Serializable @Parcelize data class SavingsAccountTemplate( val clientId: Int = 0, diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index 3bf69828a9..97118723d4 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -7,10 +7,12 @@ * * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ + plugins { - alias(libs.plugins.mifos.android.library) - alias(libs.plugins.mifos.android.hilt) + alias(libs.plugins.mifos.kmp.library) + alias(libs.plugins.ktorfit) id("kotlinx-serialization") + id("com.google.devtools.ksp") } android { @@ -18,26 +20,61 @@ android { defaultConfig { consumerProguardFiles("consumer-rules.pro") } + testOptions { + unitTests { + isReturnDefaultValues = true + isIncludeAndroidResources = true + } + } } -dependencies { - api(projects.core.common) - api(projects.core.model) - api(projects.core.datastore) +kotlin { + sourceSets { + commonMain.dependencies { + api(projects.core.common) + implementation(projects.core.model) + implementation(projects.core.datastore) + implementation(libs.kotlinx.serialization.json) + implementation(libs.ktor.client.core) + implementation(libs.ktor.client.json) + implementation(libs.ktor.client.logging) + implementation(libs.ktor.client.serialization) + implementation(libs.ktor.client.content.negotiation) + implementation(libs.ktor.client.auth) + implementation(libs.ktor.serialization.kotlinx.json) + implementation(libs.ktorfit.lib) + implementation(libs.squareup.okio) + } + androidMain.dependencies { + implementation(libs.ktor.client.okhttp) + implementation(libs.koin.android) + } - //Square dependencies - implementation(libs.squareup.retrofit2) { - // exclude Retrofit’s OkHttp peer-dependency module and define your own module import - exclude(module = "okhttp") - } - implementation(libs.squareup.retrofit.adapter.rxjava) - implementation(libs.squareup.retrofit.converter.gson) - implementation(libs.squareup.logging.interceptor) - implementation(libs.squareup.okhttp) + nativeMain.dependencies { + implementation(libs.ktor.client.darwin) + } - implementation(libs.jetbrains.kotlin.jdk7) + val desktopMain by getting { + dependencies { + implementation(libs.ktor.client.okhttp) + } + } + jsMain.dependencies { + implementation(libs.ktor.client.js) + } + wasmJsMain.dependencies { + implementation(libs.ktor.client.js) + } + } +} - testImplementation(libs.junit) - testImplementation(libs.mockito.core) - implementation(libs.mockito.core) -} \ No newline at end of file +dependencies { + add("kspCommonMainMetadata", libs.ktorfit.ksp) + add("kspAndroid", libs.ktorfit.ksp) + add("kspJs", libs.ktorfit.ksp) + add("kspWasmJs", libs.ktorfit.ksp) + add("kspDesktop", libs.ktorfit.ksp) + add("kspIosX64", libs.ktorfit.ksp) + add("kspIosArm64", libs.ktorfit.ksp) + add("kspIosSimulatorArm64", libs.ktorfit.ksp) +} diff --git a/core/network/src/androidMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.android.kt b/core/network/src/androidMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.android.kt new file mode 100644 index 0000000000..9d24f82b25 --- /dev/null +++ b/core/network/src/androidMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.android.kt @@ -0,0 +1,51 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network + +import io.ktor.client.HttpClient +import io.ktor.client.engine.okhttp.OkHttp +import io.ktor.client.plugins.HttpTimeout +import io.ktor.client.plugins.contentnegotiation.ContentNegotiation +import io.ktor.client.plugins.logging.DEFAULT +import io.ktor.client.plugins.logging.LogLevel +import io.ktor.client.plugins.logging.Logger +import io.ktor.client.plugins.logging.Logging +import io.ktor.serialization.kotlinx.json.json +import kotlinx.serialization.json.Json +import co.touchlab.kermit.Logger.Companion as KermitLogger + +actual val ktorHttpClient: HttpClient + get() = HttpClient(OkHttp) { + install(HttpTimeout) { + socketTimeoutMillis = 60_000 + requestTimeoutMillis = 60_000 + } + + install(Logging) { + logger = Logger.DEFAULT + level = LogLevel.ALL + logger = object : Logger { + override fun log(message: String) { + KermitLogger.d(tag = "KtorClient", messageString = message) + } + } + } + + install(ContentNegotiation) { + json( + Json { + prettyPrint = true + isLenient = true + ignoreUnknownKeys = true + explicitNulls = false + }, + ) + } + } diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/DataManager.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/DataManager.kt new file mode 100644 index 0000000000..6470cd419e --- /dev/null +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/DataManager.kt @@ -0,0 +1,39 @@ +/* + * 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network + +class DataManager( + private val ktorfitClient: KtorfitClient, +) { + + internal val authenticationApi by lazy { ktorfitClient.authenticationApi } + + internal val beneficiaryApi by lazy { ktorfitClient.beneficiaryApi } + + internal val clientsApi by lazy { ktorfitClient.clientsApi } + + internal val loanAccountsListApi by lazy { ktorfitClient.loanAccountsListApi } + + internal val savingAccountsListApi by lazy { ktorfitClient.savingAccountsListApi } + + internal val recentTransactionsApi by lazy { ktorfitClient.recentTransactionsApi } + + internal val clientChargeApi by lazy { ktorfitClient.clientChargeApi } + + internal val thirdPartyTransferApi by lazy { ktorfitClient.thirdPartyTransferApi } + + internal val registrationApi by lazy { ktorfitClient.registrationApi } + + internal val notificationApi by lazy { ktorfitClient.notificationApi } + + internal val userDetailsApi by lazy { ktorfitClient.userDetailsApi } + + internal val guarantorApi by lazy { ktorfitClient.guarantorApi } +} diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.kt new file mode 100644 index 0000000000..918db15734 --- /dev/null +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.kt @@ -0,0 +1,14 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network + +import io.ktor.client.HttpClient + +expect val ktorHttpClient: HttpClient diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/KtorfitClient.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/KtorfitClient.kt new file mode 100644 index 0000000000..f2b59021c9 --- /dev/null +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/KtorfitClient.kt @@ -0,0 +1,86 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network + +import de.jensklingenberg.ktorfit.Ktorfit +import io.ktor.client.HttpClient +import org.mifos.mobile.core.network.services.createAuthenticationService +import org.mifos.mobile.core.network.services.createBeneficiaryService +import org.mifos.mobile.core.network.services.createClientChargeService +import org.mifos.mobile.core.network.services.createClientService +import org.mifos.mobile.core.network.services.createGuarantorService +import org.mifos.mobile.core.network.services.createLoanAccountsListService +import org.mifos.mobile.core.network.services.createNotificationService +import org.mifos.mobile.core.network.services.createRecentTransactionsService +import org.mifos.mobile.core.network.services.createRegistrationService +import org.mifos.mobile.core.network.services.createSavingAccountsListService +import org.mifos.mobile.core.network.services.createThirdPartyTransferService +import org.mifos.mobile.core.network.services.createUserDetailsService +import org.mifos.mobile.core.network.utils.FlowConverterFactory + +class KtorfitClient( + ktorfit: Ktorfit, +) { + + internal val authenticationApi by lazy { ktorfit.createAuthenticationService() } + + internal val beneficiaryApi by lazy { ktorfit.createBeneficiaryService() } + + internal val clientsApi by lazy { ktorfit.createClientService() } + + internal val loanAccountsListApi by lazy { ktorfit.createLoanAccountsListService() } + + internal val savingAccountsListApi by lazy { ktorfit.createSavingAccountsListService() } + + internal val recentTransactionsApi by lazy { ktorfit.createRecentTransactionsService() } + + internal val clientChargeApi by lazy { ktorfit.createClientChargeService() } + + internal val thirdPartyTransferApi by lazy { ktorfit.createThirdPartyTransferService() } + + internal val registrationApi by lazy { ktorfit.createRegistrationService() } + + internal val notificationApi by lazy { ktorfit.createNotificationService() } + + internal val userDetailsApi by lazy { ktorfit.createUserDetailsService() } + + internal val guarantorApi by lazy { ktorfit.createGuarantorService() } + + class Builder internal constructor() { + private lateinit var baseURL: String + private lateinit var httpClient: HttpClient + + fun baseURL(baseURL: String): Builder { + this.baseURL = baseURL + return this + } + + fun httpClient(ktorHttpClient: HttpClient): Builder { + this.httpClient = ktorHttpClient + return this + } + + fun build(): KtorfitClient { + val ktorfitBuilder = Ktorfit.Builder() + .httpClient(httpClient) + .baseUrl(baseURL) + .converterFactories(FlowConverterFactory()) + .build() + + return KtorfitClient(ktorfitBuilder) + } + } + + companion object { + fun builder(): Builder { + return Builder() + } + } +} diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/di/NetworkModule.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/di/NetworkModule.kt new file mode 100644 index 0000000000..727aef6a0b --- /dev/null +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/di/NetworkModule.kt @@ -0,0 +1,45 @@ +/* + * 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network.di + +import io.ktor.client.HttpClient +import io.ktor.client.plugins.auth.Auth +import org.koin.dsl.module +import org.mifos.mobile.core.datastore.UserPreferencesRepository +import org.mifos.mobile.core.network.DataManager +import org.mifos.mobile.core.network.KtorfitClient +import org.mifos.mobile.core.network.ktorHttpClient +import org.mifos.mobile.core.network.utils.BaseURL +import org.mifos.mobile.core.network.utils.KtorInterceptor + +val NetworkModule = module { + + single(KtorClient) { + val preferencesRepository = get() + + ktorHttpClient.config { + install(Auth) + install(KtorInterceptor) { + getToken = { preferencesRepository.token.value } + } + } + } + + single(MifosClient) { + KtorfitClient.builder() + .httpClient(get(KtorBaseClient)) + .baseURL(BaseURL().url) + .build() + } + + single { + DataManager(ktorfitClient = get(MifosClient)) + } +} diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/di/Qualifier.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/di/Qualifier.kt new file mode 100644 index 0000000000..f879ce0de0 --- /dev/null +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/di/Qualifier.kt @@ -0,0 +1,16 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network.di + +import org.koin.core.qualifier.named + +val MifosClient = named("MifosClient") +val KtorClient = named("KtorClient") +val KtorBaseClient = named("KtorBaseClient") diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/AuthenticationService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/AuthenticationService.kt similarity index 81% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/AuthenticationService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/AuthenticationService.kt index 3528a9dd1e..af40b1dc8c 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/AuthenticationService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/AuthenticationService.kt @@ -9,11 +9,11 @@ */ package org.mifos.mobile.core.network.services -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.Body +import de.jensklingenberg.ktorfit.http.POST import org.mifos.mobile.core.model.entity.User import org.mifos.mobile.core.model.entity.payload.LoginPayload -import retrofit2.http.Body -import retrofit2.http.POST +import org.mifos.mobile.core.network.utils.ApiEndPoints interface AuthenticationService { diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/BeneficiaryService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/BeneficiaryService.kt similarity index 65% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/BeneficiaryService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/BeneficiaryService.kt index bd2cc6a0f5..f84607b16d 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/BeneficiaryService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/BeneficiaryService.kt @@ -9,35 +9,36 @@ */ package org.mifos.mobile.core.network.services -import okhttp3.ResponseBody -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.Body +import de.jensklingenberg.ktorfit.http.DELETE +import de.jensklingenberg.ktorfit.http.GET +import de.jensklingenberg.ktorfit.http.POST +import de.jensklingenberg.ktorfit.http.PUT +import de.jensklingenberg.ktorfit.http.Path +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow import org.mifos.mobile.core.model.entity.beneficiary.Beneficiary import org.mifos.mobile.core.model.entity.beneficiary.BeneficiaryPayload import org.mifos.mobile.core.model.entity.beneficiary.BeneficiaryUpdatePayload import org.mifos.mobile.core.model.entity.templates.beneficiary.BeneficiaryTemplate -import retrofit2.http.Body -import retrofit2.http.DELETE -import retrofit2.http.GET -import retrofit2.http.POST -import retrofit2.http.PUT -import retrofit2.http.Path +import org.mifos.mobile.core.network.utils.ApiEndPoints interface BeneficiaryService { @GET(ApiEndPoints.BENEFICIARIES + "/tpt") - suspend fun beneficiaryList(): List + fun beneficiaryList(): Flow> @GET(ApiEndPoints.BENEFICIARIES + "/tpt/template") - suspend fun beneficiaryTemplate(): BeneficiaryTemplate + fun beneficiaryTemplate(): Flow @POST(ApiEndPoints.BENEFICIARIES + "/tpt") - suspend fun createBeneficiary(@Body beneficiaryPayload: BeneficiaryPayload?): ResponseBody + suspend fun createBeneficiary(@Body beneficiaryPayload: BeneficiaryPayload?): HttpResponse @PUT(ApiEndPoints.BENEFICIARIES + "/tpt/{beneficiaryId}") suspend fun updateBeneficiary( - @Path("beneficiaryId") beneficiaryId: Long?, + @Path("beneficiaryId") beneficiaryId: Long, @Body payload: BeneficiaryUpdatePayload?, - ): ResponseBody + ): HttpResponse @DELETE(ApiEndPoints.BENEFICIARIES + "/tpt/{beneficiaryId}") - suspend fun deleteBeneficiary(@Path("beneficiaryId") beneficiaryId: Long?): ResponseBody + suspend fun deleteBeneficiary(@Path("beneficiaryId") beneficiaryId: Long): HttpResponse } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/ClientChargeService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/ClientChargeService.kt similarity index 60% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/ClientChargeService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/ClientChargeService.kt index 3985947c55..fa68bcdd35 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/ClientChargeService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/ClientChargeService.kt @@ -9,20 +9,21 @@ */ package org.mifos.mobile.core.network.services -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.GET +import de.jensklingenberg.ktorfit.http.Path +import kotlinx.coroutines.flow.Flow import org.mifos.mobile.core.model.entity.Charge import org.mifos.mobile.core.model.entity.Page -import retrofit2.http.GET -import retrofit2.http.Path +import org.mifos.mobile.core.network.utils.ApiEndPoints interface ClientChargeService { @GET(ApiEndPoints.CLIENTS + "/{clientId}/charges") - suspend fun getClientChargeList(@Path("clientId") clientId: Long?): Page + fun getClientChargeList(@Path("clientId") clientId: Long): Flow> @GET(ApiEndPoints.LOANS + "/{loanId}/charges") - suspend fun getLoanAccountChargeList(@Path("loanId") loanId: Long?): List + fun getLoanAccountChargeList(@Path("loanId") loanId: Long): Flow> @GET(ApiEndPoints.SAVINGS_ACCOUNTS + "/{savingsId}/charges") - suspend fun getSavingsAccountChargeList(@Path("savingsId") savingsId: Long?): List + fun getSavingsAccountChargeList(@Path("savingsId") savingsId: Long): Flow> } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/ClientService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/ClientService.kt similarity index 59% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/ClientService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/ClientService.kt index ce87bc4389..902f539a6b 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/ClientService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/ClientService.kt @@ -9,38 +9,35 @@ */ package org.mifos.mobile.core.network.services -import okhttp3.ResponseBody -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.GET +import de.jensklingenberg.ktorfit.http.Path +import de.jensklingenberg.ktorfit.http.Query +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow import org.mifos.mobile.core.model.entity.Page import org.mifos.mobile.core.model.entity.client.Client import org.mifos.mobile.core.model.entity.client.ClientAccounts -import retrofit2.http.GET -import retrofit2.http.Path -import retrofit2.http.Query +import org.mifos.mobile.core.network.utils.ApiEndPoints -/** - * @author Vishwajeet - * @since 20/6/16. - */ interface ClientService { - // This is a default call and Loads client from 0 to 200 + @GET(ApiEndPoints.CLIENTS) - suspend fun clients(): Page + fun clients(): Flow> @GET(ApiEndPoints.CLIENTS + "/{clientId}") - suspend fun getClientForId(@Path(CLIENT_ID) clientId: Long?): Client + fun getClientForId(@Path(CLIENT_ID) clientId: Long): Flow @GET(ApiEndPoints.CLIENTS + "/{clientId}/images") - suspend fun getClientImage(@Path(CLIENT_ID) clientId: Long?): ResponseBody + fun getClientImage(@Path(CLIENT_ID) clientId: Long): Flow @GET(ApiEndPoints.CLIENTS + "/{clientId}/accounts") - suspend fun getClientAccounts(@Path(CLIENT_ID) clientId: Long?): ClientAccounts + fun getClientAccounts(@Path(CLIENT_ID) clientId: Long): Flow @GET(ApiEndPoints.CLIENTS + "/{clientId}/accounts") - suspend fun getAccounts( - @Path(CLIENT_ID) clientId: Long?, + fun getAccounts( + @Path(CLIENT_ID) clientId: Long, @Query("fields") accountType: String?, - ): ClientAccounts + ): Flow companion object { const val CLIENT_ID = "clientId" diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/GuarantorService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/GuarantorService.kt similarity index 57% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/GuarantorService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/GuarantorService.kt index b80fef3714..35b6493d38 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/GuarantorService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/GuarantorService.kt @@ -9,40 +9,41 @@ */ package org.mifos.mobile.core.network.services -import okhttp3.ResponseBody +import de.jensklingenberg.ktorfit.http.Body +import de.jensklingenberg.ktorfit.http.DELETE +import de.jensklingenberg.ktorfit.http.GET +import de.jensklingenberg.ktorfit.http.POST +import de.jensklingenberg.ktorfit.http.PUT +import de.jensklingenberg.ktorfit.http.Path +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow import org.mifos.mobile.core.model.entity.guarantor.GuarantorApplicationPayload import org.mifos.mobile.core.model.entity.guarantor.GuarantorPayload import org.mifos.mobile.core.model.entity.guarantor.GuarantorTemplatePayload -import retrofit2.http.Body -import retrofit2.http.DELETE -import retrofit2.http.GET -import retrofit2.http.POST -import retrofit2.http.PUT -import retrofit2.http.Path interface GuarantorService { @GET("loans/{loanId}/guarantors/template") - suspend fun getGuarantorTemplate(@Path("loanId") loanId: Long?): GuarantorTemplatePayload + fun getGuarantorTemplate(@Path("loanId") loanId: Long): Flow @GET("loans/{loanId}/guarantors") - suspend fun getGuarantorList(@Path("loanId") loanId: Long?): List + fun getGuarantorList(@Path("loanId") loanId: Long): Flow> @POST("loans/{loanId}/guarantors") suspend fun createGuarantor( - @Path("loanId") loanId: Long?, + @Path("loanId") loanId: Long, @Body payload: GuarantorApplicationPayload?, - ): ResponseBody + ): HttpResponse @PUT("loans/{loanId}/guarantors/{guarantorId}") suspend fun updateGuarantor( @Body payload: GuarantorApplicationPayload?, - @Path("loanId") loanId: Long?, - @Path("guarantorId") guarantorId: Long?, - ): ResponseBody + @Path("loanId") loanId: Long, + @Path("guarantorId") guarantorId: Long, + ): HttpResponse @DELETE("loans/{loanId}/guarantors/{guarantorId}") suspend fun deleteGuarantor( - @Path("loanId") loanId: Long?, - @Path("guarantorId") guarantorId: Long?, - ): ResponseBody + @Path("loanId") loanId: Long, + @Path("guarantorId") guarantorId: Long, + ): HttpResponse } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/LoanAccountsListService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/LoanAccountsListService.kt similarity index 65% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/LoanAccountsListService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/LoanAccountsListService.kt index d53f0840fd..fd212f371f 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/LoanAccountsListService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/LoanAccountsListService.kt @@ -9,52 +9,52 @@ */ package org.mifos.mobile.core.network.services -import io.reactivex.Observable -import okhttp3.ResponseBody -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.Body +import de.jensklingenberg.ktorfit.http.GET +import de.jensklingenberg.ktorfit.http.POST +import de.jensklingenberg.ktorfit.http.PUT +import de.jensklingenberg.ktorfit.http.Path +import de.jensklingenberg.ktorfit.http.Query +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow import org.mifos.mobile.core.model.entity.accounts.loan.LoanAccount import org.mifos.mobile.core.model.entity.accounts.loan.LoanWithAssociations import org.mifos.mobile.core.model.entity.accounts.loan.LoanWithdraw import org.mifos.mobile.core.model.entity.payload.LoansPayload import org.mifos.mobile.core.model.entity.templates.loans.LoanTemplate -import retrofit2.http.Body -import retrofit2.http.GET -import retrofit2.http.POST -import retrofit2.http.PUT -import retrofit2.http.Path -import retrofit2.http.Query +import org.mifos.mobile.core.network.utils.ApiEndPoints interface LoanAccountsListService { @GET(ApiEndPoints.LOANS + "/{loanId}/") - fun getLoanAccountsDetail(@Path("loanId") loanId: Long): Observable? + fun getLoanAccountsDetail(@Path("loanId") loanId: Long): Flow? @GET(ApiEndPoints.LOANS + "/{loanId}") - suspend fun getLoanWithAssociations( - @Path("loanId") loanId: Long?, + fun getLoanWithAssociations( + @Path("loanId") loanId: Long, @Query("associations") associationType: String?, - ): LoanWithAssociations + ): Flow @GET(ApiEndPoints.LOANS + "/template?templateType=individual") - suspend fun getLoanTemplate(@Query("clientId") clientId: Long?): LoanTemplate + fun getLoanTemplate(@Query("clientId") clientId: Long?): Flow @GET(ApiEndPoints.LOANS + "/template?templateType=individual") - suspend fun getLoanTemplateByProduct( + fun getLoanTemplateByProduct( @Query("clientId") clientId: Long?, @Query("productId") productId: Int?, - ): LoanTemplate + ): Flow @POST(ApiEndPoints.LOANS) - suspend fun createLoansAccount(@Body loansPayload: LoansPayload?): ResponseBody + suspend fun createLoansAccount(@Body loansPayload: LoansPayload?): HttpResponse @PUT(ApiEndPoints.LOANS + "/{loanId}/") suspend fun updateLoanAccount( @Path("loanId") loanId: Long, @Body loansPayload: LoansPayload?, - ): ResponseBody + ): HttpResponse @POST(ApiEndPoints.LOANS + "/{loanId}?command=withdrawnByApplicant") suspend fun withdrawLoanAccount( - @Path(org.mifos.mobile.core.common.Constants.LOAN_ID) loanId: Long?, + @Path("loanId") loanId: Long, @Body loanWithdraw: LoanWithdraw?, - ): ResponseBody + ): HttpResponse } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/NotificationService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/NotificationService.kt similarity index 64% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/NotificationService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/NotificationService.kt index 82679b01b6..205c4d71f2 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/NotificationService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/NotificationService.kt @@ -9,26 +9,27 @@ */ package org.mifos.mobile.core.network.services -import okhttp3.ResponseBody -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.Body +import de.jensklingenberg.ktorfit.http.GET +import de.jensklingenberg.ktorfit.http.POST +import de.jensklingenberg.ktorfit.http.PUT +import de.jensklingenberg.ktorfit.http.Path +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow import org.mifos.mobile.core.model.entity.notification.NotificationRegisterPayload import org.mifos.mobile.core.model.entity.notification.NotificationUserDetail -import retrofit2.http.Body -import retrofit2.http.GET -import retrofit2.http.POST -import retrofit2.http.PUT -import retrofit2.http.Path +import org.mifos.mobile.core.network.utils.ApiEndPoints interface NotificationService { @GET(ApiEndPoints.DEVICE + "/registration/client/{clientId}") - suspend fun getUserNotificationId(@Path("clientId") clientId: Long): NotificationUserDetail + fun getUserNotificationId(@Path("clientId") clientId: Long): Flow @POST(ApiEndPoints.DEVICE + "/registration") - suspend fun registerNotification(@Body payload: NotificationRegisterPayload?): ResponseBody + suspend fun registerNotification(@Body payload: NotificationRegisterPayload?): HttpResponse @PUT(ApiEndPoints.DEVICE + "/registration/{id}") suspend fun updateRegisterNotification( @Path("id") id: Long, @Body payload: NotificationRegisterPayload?, - ): ResponseBody + ): HttpResponse } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/RecentTransactionsService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/RecentTransactionsService.kt similarity index 66% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/RecentTransactionsService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/RecentTransactionsService.kt index 1f54d6173e..dc69036816 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/RecentTransactionsService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/RecentTransactionsService.kt @@ -9,18 +9,19 @@ */ package org.mifos.mobile.core.network.services -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.GET +import de.jensklingenberg.ktorfit.http.Path +import de.jensklingenberg.ktorfit.http.Query +import kotlinx.coroutines.flow.Flow import org.mifos.mobile.core.model.entity.Page import org.mifos.mobile.core.model.entity.Transaction -import retrofit2.http.GET -import retrofit2.http.Path -import retrofit2.http.Query +import org.mifos.mobile.core.network.utils.ApiEndPoints interface RecentTransactionsService { @GET(ApiEndPoints.CLIENTS + "/{clientId}/transactions") - suspend fun getRecentTransactionsList( - @Path("clientId") clientId: Long?, + fun getRecentTransactionsList( + @Path("clientId") clientId: Long, @Query("offset") offset: Int?, @Query("limit") limit: Int?, - ): Page + ): Flow> } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/RegistrationService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/RegistrationService.kt similarity index 70% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/RegistrationService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/RegistrationService.kt index 861c56b4c9..f2462a89f3 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/RegistrationService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/RegistrationService.kt @@ -9,17 +9,17 @@ */ package org.mifos.mobile.core.network.services -import okhttp3.ResponseBody -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.Body +import de.jensklingenberg.ktorfit.http.POST +import io.ktor.client.statement.HttpResponse import org.mifos.mobile.core.model.entity.register.RegisterPayload import org.mifos.mobile.core.model.entity.register.UserVerify -import retrofit2.http.Body -import retrofit2.http.POST +import org.mifos.mobile.core.network.utils.ApiEndPoints interface RegistrationService { @POST(ApiEndPoints.REGISTRATION) - suspend fun registerUser(@Body registerPayload: RegisterPayload?): ResponseBody + suspend fun registerUser(@Body registerPayload: RegisterPayload?): HttpResponse @POST(ApiEndPoints.REGISTRATION + "/user") - suspend fun verifyUser(@Body userVerify: UserVerify?): ResponseBody + suspend fun verifyUser(@Body userVerify: UserVerify?): HttpResponse } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/SavingAccountsListService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/SavingAccountsListService.kt similarity index 70% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/SavingAccountsListService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/SavingAccountsListService.kt index 4cf2931640..926b18b754 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/SavingAccountsListService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/SavingAccountsListService.kt @@ -9,8 +9,14 @@ */ package org.mifos.mobile.core.network.services -import okhttp3.ResponseBody -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.Body +import de.jensklingenberg.ktorfit.http.GET +import de.jensklingenberg.ktorfit.http.POST +import de.jensklingenberg.ktorfit.http.PUT +import de.jensklingenberg.ktorfit.http.Path +import de.jensklingenberg.ktorfit.http.Query +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow import org.mifos.mobile.core.model.entity.accounts.savings.SavingsAccountApplicationPayload import org.mifos.mobile.core.model.entity.accounts.savings.SavingsAccountUpdatePayload import org.mifos.mobile.core.model.entity.accounts.savings.SavingsAccountWithdrawPayload @@ -18,48 +24,43 @@ import org.mifos.mobile.core.model.entity.accounts.savings.SavingsWithAssociatio import org.mifos.mobile.core.model.entity.payload.TransferPayload import org.mifos.mobile.core.model.entity.templates.account.AccountOptionsTemplate import org.mifos.mobile.core.model.entity.templates.savings.SavingsAccountTemplate -import retrofit2.http.Body -import retrofit2.http.GET -import retrofit2.http.POST -import retrofit2.http.PUT -import retrofit2.http.Path -import retrofit2.http.Query +import org.mifos.mobile.core.network.utils.ApiEndPoints interface SavingAccountsListService { @GET(ApiEndPoints.SAVINGS_ACCOUNTS + "/{accountId}") - suspend fun getSavingsWithAssociations( - @Path("accountId") accountId: Long?, + fun getSavingsWithAssociations( + @Path("accountId") accountId: Long, @Query("associations") associationType: String?, - ): SavingsWithAssociations + ): Flow @GET(ApiEndPoints.ACCOUNT_TRANSFER + "/template") - suspend fun accountTransferTemplate( + fun accountTransferTemplate( @Query("fromAccountId") accountId: Long?, @Query("fromAccountType") accountType: Long?, - ): AccountOptionsTemplate + ): Flow @POST(ApiEndPoints.ACCOUNT_TRANSFER) - suspend fun makeTransfer(@Body transferPayload: TransferPayload?): ResponseBody + suspend fun makeTransfer(@Body transferPayload: TransferPayload?): HttpResponse @GET(ApiEndPoints.SAVINGS_ACCOUNTS + "/template") - suspend fun getSavingsAccountApplicationTemplate( + fun getSavingsAccountApplicationTemplate( @Query("clientId") clientId: Long?, - ): SavingsAccountTemplate + ): Flow @POST(ApiEndPoints.SAVINGS_ACCOUNTS) suspend fun submitSavingAccountApplication( @Body payload: SavingsAccountApplicationPayload?, - ): ResponseBody + ): HttpResponse @PUT(ApiEndPoints.SAVINGS_ACCOUNTS + "/{accountsId}") suspend fun updateSavingsAccountUpdate( - @Path("accountsId") accountsId: Long?, + @Path("accountsId") accountsId: Long, @Body payload: SavingsAccountUpdatePayload?, - ): ResponseBody + ): HttpResponse @POST(ApiEndPoints.SAVINGS_ACCOUNTS + "/{savingsId}?command=withdrawnByApplicant") suspend fun submitWithdrawSavingsAccount( - @Path("savingsId") savingsId: String?, + @Path("savingsId") savingsId: String, @Body payload: SavingsAccountWithdrawPayload?, - ): ResponseBody + ): HttpResponse } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/ThirdPartyTransferService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/ThirdPartyTransferService.kt similarity index 67% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/ThirdPartyTransferService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/ThirdPartyTransferService.kt index a0d33f5f3b..8d0a477cc5 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/ThirdPartyTransferService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/ThirdPartyTransferService.kt @@ -9,18 +9,19 @@ */ package org.mifos.mobile.core.network.services -import okhttp3.ResponseBody -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.Body +import de.jensklingenberg.ktorfit.http.GET +import de.jensklingenberg.ktorfit.http.POST +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow import org.mifos.mobile.core.model.entity.payload.TransferPayload import org.mifos.mobile.core.model.entity.templates.account.AccountOptionsTemplate -import retrofit2.http.Body -import retrofit2.http.GET -import retrofit2.http.POST +import org.mifos.mobile.core.network.utils.ApiEndPoints interface ThirdPartyTransferService { @GET(ApiEndPoints.ACCOUNT_TRANSFER + "/template?type=tpt") - suspend fun accountTransferTemplate(): AccountOptionsTemplate + fun accountTransferTemplate(): Flow @POST(ApiEndPoints.ACCOUNT_TRANSFER + "?type=tpt") - suspend fun makeTransfer(@Body transferPayload: TransferPayload?): ResponseBody + suspend fun makeTransfer(@Body transferPayload: TransferPayload?): HttpResponse } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/services/UserDetailsService.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/UserDetailsService.kt similarity index 72% rename from core/network/src/main/java/org/mifos/mobile/core/network/services/UserDetailsService.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/UserDetailsService.kt index 31a14b1f34..0773b60c2a 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/services/UserDetailsService.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/services/UserDetailsService.kt @@ -9,13 +9,13 @@ */ package org.mifos.mobile.core.network.services -import okhttp3.ResponseBody -import org.mifos.mobile.core.common.ApiEndPoints +import de.jensklingenberg.ktorfit.http.Body +import de.jensklingenberg.ktorfit.http.PUT +import io.ktor.client.statement.HttpResponse import org.mifos.mobile.core.model.entity.UpdatePasswordPayload -import retrofit2.http.Body -import retrofit2.http.PUT +import org.mifos.mobile.core.network.utils.ApiEndPoints interface UserDetailsService { @PUT(ApiEndPoints.USER) - suspend fun updateAccountPassword(@Body payload: UpdatePasswordPayload?): ResponseBody + suspend fun updateAccountPassword(@Body payload: UpdatePasswordPayload?): HttpResponse } diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/ApiEndPoints.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/ApiEndPoints.kt new file mode 100644 index 0000000000..b03faa4d7d --- /dev/null +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/ApiEndPoints.kt @@ -0,0 +1,25 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network.utils + +object ApiEndPoints { + // This class contains all the Constants for API End Points + const val AUTHENTICATION = "authentication" + const val CLIENTS = "clients" + const val SAVINGS_ACCOUNTS = "savingsaccounts" + const val LOAN_ACCOUNTS = "loanAccounts" + const val RECURRING_ACCOUNTS = "recurringdepositaccounts" + const val LOANS = "loans" + const val ACCOUNT_TRANSFER = "accounttransfers" + const val BENEFICIARIES = "beneficiaries" + const val REGISTRATION = "registration" + const val DEVICE = "device" + const val USER = "user" +} diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/BaseURL.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/BaseURL.kt similarity index 87% rename from core/network/src/main/java/org/mifos/mobile/core/network/BaseURL.kt rename to core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/BaseURL.kt index c18947dc31..9e00e366ff 100644 --- a/core/network/src/main/java/org/mifos/mobile/core/network/BaseURL.kt +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/BaseURL.kt @@ -7,7 +7,7 @@ * * See https://github.com/openMF/mobile-mobile/blob/master/LICENSE.md */ -package org.mifos.mobile.core.network +package org.mifos.mobile.core.network.utils class BaseURL { val url: String @@ -21,7 +21,7 @@ class BaseURL { } companion object { - const val API_ENDPOINT = "demo.mifos.community" + const val API_ENDPOINT = "gsoc.mifos.community" const val API_PATH = "/fineract-provider/api/v1/" const val PROTOCOL_HTTPS = "https://" } diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/FlowConverterFactory.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/FlowConverterFactory.kt new file mode 100644 index 0000000000..4f5cbebb93 --- /dev/null +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/FlowConverterFactory.kt @@ -0,0 +1,49 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network.utils + +import de.jensklingenberg.ktorfit.Ktorfit +import de.jensklingenberg.ktorfit.converter.Converter +import de.jensklingenberg.ktorfit.converter.KtorfitResult +import de.jensklingenberg.ktorfit.converter.TypeData +import io.ktor.client.call.body +import io.ktor.client.statement.HttpResponse +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flow + +class FlowConverterFactory : Converter.Factory { + override fun responseConverter( + typeData: TypeData, + ktorfit: Ktorfit, + ): Converter.ResponseConverter? { + if (typeData.typeInfo.type == Flow::class) { + return object : Converter.ResponseConverter> { + override fun convert(getResponse: suspend () -> HttpResponse): Flow { + val requestType = typeData.typeArgs.first() + return flow { + val response = getResponse() + if (requestType.typeInfo.type == HttpResponse::class) { + emit(response) + } else { + val convertedBody = + ktorfit.nextSuspendResponseConverter( + this@FlowConverterFactory, + typeData.typeArgs.first(), + )?.convert(KtorfitResult.Success(response)) + ?: response.body(typeData.typeArgs.first().typeInfo) + emit(convertedBody) + } + } + } + } + } + return null + } +} diff --git a/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/KtorInterceptor.kt b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/KtorInterceptor.kt new file mode 100644 index 0000000000..9a364b5fa7 --- /dev/null +++ b/core/network/src/commonMain/kotlin/org/mifos/mobile/core/network/utils/KtorInterceptor.kt @@ -0,0 +1,89 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network.utils + +import io.ktor.client.HttpClient +import io.ktor.client.plugins.HttpClientPlugin +import io.ktor.client.request.HttpRequestPipeline +import io.ktor.client.request.header +import io.ktor.util.AttributeKey +import org.mifos.mobile.core.datastore.UserPreferencesRepository + +class KtorInterceptor( + private val getToken: () -> String?, +) { + companion object Plugin : HttpClientPlugin { + private const val HEADER_TENANT = "Fineract-Platform-TenantId" + private const val HEADER_AUTH = "Authorization" + private const val DEFAULT = "default" + private const val CONTENT_TYPE = "Content-Type" + override val key: AttributeKey = AttributeKey("KtorInterceptor") + + override fun install(plugin: KtorInterceptor, scope: HttpClient) { + scope.requestPipeline.intercept(HttpRequestPipeline.State) { + context.header(CONTENT_TYPE, "application/json") + context.header("Accept", "application/json") + context.header(HEADER_TENANT, DEFAULT) + + plugin.getToken()?.let { token -> + if (token.isNotEmpty()) { + context.headers[HEADER_AUTH] = "Basic $token" + } + } + } + } + + override fun prepare(block: Config.() -> Unit): KtorInterceptor { + val config = Config().apply(block) + return KtorInterceptor(config.getToken) + } + } +} + +class Config { + lateinit var getToken: () -> String? +} + +class KtorInterceptorRe( + private val repository: UserPreferencesRepository, +) { + companion object Plugin : HttpClientPlugin { + private const val HEADER_TENANT = "Fineract-Platform-TenantId" + private const val HEADER_AUTH = "Authorization" + private const val DEFAULT = "venus" + private const val CONTENT_TYPE = "Content-Type" + override val key: AttributeKey = AttributeKey("KtorInterceptorRe") + + override fun install(plugin: KtorInterceptorRe, scope: HttpClient) { + val token = plugin.repository.token.value + + scope.requestPipeline.intercept(HttpRequestPipeline.State) { + context.header(CONTENT_TYPE, "application/json") + context.header("Accept", "application/json") + context.header(HEADER_TENANT, DEFAULT) + + token?.let { token -> + if (token.isNotEmpty()) { + context.headers[HEADER_AUTH] = "Basic $token" + } + } + } + } + + override fun prepare(block: ConfigRe.() -> Unit): KtorInterceptorRe { + val config = ConfigRe().apply(block) + return KtorInterceptorRe(config.repository) + } + } +} + +class ConfigRe { + lateinit var repository: UserPreferencesRepository +} diff --git a/core/network/src/desktopMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.desktop.kt b/core/network/src/desktopMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.desktop.kt new file mode 100644 index 0000000000..57645b4ddd --- /dev/null +++ b/core/network/src/desktopMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.desktop.kt @@ -0,0 +1,50 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network + +import io.ktor.client.HttpClient +import io.ktor.client.engine.okhttp.OkHttp +import io.ktor.client.plugins.HttpTimeout +import io.ktor.client.plugins.contentnegotiation.ContentNegotiation +import io.ktor.client.plugins.logging.DEFAULT +import io.ktor.client.plugins.logging.LogLevel +import io.ktor.client.plugins.logging.Logger +import io.ktor.client.plugins.logging.Logging +import io.ktor.serialization.kotlinx.json.json +import kotlinx.serialization.json.Json + +actual val ktorHttpClient: HttpClient + get() = HttpClient(OkHttp) { + install(HttpTimeout) { + socketTimeoutMillis = 60_000 + requestTimeoutMillis = 60_000 + } + + install(Logging) { + logger = Logger.DEFAULT + level = LogLevel.ALL + logger = object : Logger { + override fun log(message: String) { + co.touchlab.kermit.Logger.d(tag = "KtorClient", messageString = message) + } + } + } + + install(ContentNegotiation) { + json( + Json { + prettyPrint = true + isLenient = true + ignoreUnknownKeys = true + explicitNulls = false + }, + ) + } + } diff --git a/core/network/src/jsMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.js.kt b/core/network/src/jsMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.js.kt new file mode 100644 index 0000000000..09e57dd858 --- /dev/null +++ b/core/network/src/jsMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.js.kt @@ -0,0 +1,50 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network + +import io.ktor.client.HttpClient +import io.ktor.client.engine.js.Js +import io.ktor.client.plugins.HttpTimeout +import io.ktor.client.plugins.contentnegotiation.ContentNegotiation +import io.ktor.client.plugins.logging.DEFAULT +import io.ktor.client.plugins.logging.LogLevel +import io.ktor.client.plugins.logging.Logger +import io.ktor.client.plugins.logging.Logging +import io.ktor.serialization.kotlinx.json.json +import kotlinx.serialization.json.Json + +actual val ktorHttpClient: HttpClient + get() = HttpClient(Js) { + install(HttpTimeout) { + socketTimeoutMillis = 60_000 + requestTimeoutMillis = 60_000 + } + + install(Logging) { + logger = Logger.DEFAULT + level = LogLevel.ALL + logger = object : Logger { + override fun log(message: String) { + co.touchlab.kermit.Logger.d(tag = "KtorClient", messageString = message) + } + } + } + + install(ContentNegotiation) { + json( + Json { + prettyPrint = true + isLenient = true + ignoreUnknownKeys = true + explicitNulls = false + }, + ) + } + } diff --git a/core/network/src/main/AndroidManifest.xml b/core/network/src/main/AndroidManifest.xml deleted file mode 100644 index 4ee22a4fb1..0000000000 --- a/core/network/src/main/AndroidManifest.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - \ No newline at end of file diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/BaseApiManager.kt b/core/network/src/main/java/org/mifos/mobile/core/network/BaseApiManager.kt deleted file mode 100644 index 6508a62427..0000000000 --- a/core/network/src/main/java/org/mifos/mobile/core/network/BaseApiManager.kt +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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/mobile-mobile/blob/master/LICENSE.md - */ -package org.mifos.mobile.core.network - -import org.mifos.mobile.core.network.services.AuthenticationService -import org.mifos.mobile.core.network.services.BeneficiaryService -import org.mifos.mobile.core.network.services.ClientChargeService -import org.mifos.mobile.core.network.services.ClientService -import org.mifos.mobile.core.network.services.GuarantorService -import org.mifos.mobile.core.network.services.LoanAccountsListService -import org.mifos.mobile.core.network.services.NotificationService -import org.mifos.mobile.core.network.services.RecentTransactionsService -import org.mifos.mobile.core.network.services.RegistrationService -import org.mifos.mobile.core.network.services.SavingAccountsListService -import org.mifos.mobile.core.network.services.ThirdPartyTransferService -import org.mifos.mobile.core.network.services.UserDetailsService -import javax.inject.Inject - -class BaseApiManager @Inject constructor( - private val authenticationService: AuthenticationService, - private val clientsService: ClientService, - private val savingAccountsListService: SavingAccountsListService, - private val loanAccountsListService: LoanAccountsListService, - private val recentTransactionsService: RecentTransactionsService, - private val clientChargeService: ClientChargeService, - private val beneficiaryService: BeneficiaryService, - private val thirdPartyTransferService: ThirdPartyTransferService, - private val registrationService: RegistrationService, - private val notificationService: NotificationService, - private val userDetailsService: UserDetailsService, - private val guarantorService: GuarantorService, -) { - val authenticationApi: AuthenticationService - get() = authenticationService - val clientsApi: ClientService - get() = clientsService - val savingAccountsListApi: SavingAccountsListService - get() = savingAccountsListService - val loanAccountsListApi: LoanAccountsListService - get() = loanAccountsListService - val recentTransactionsApi: RecentTransactionsService - get() = recentTransactionsService - val clientChargeApi: ClientChargeService - get() = clientChargeService - val beneficiaryApi: BeneficiaryService - get() = beneficiaryService - val thirdPartyTransferApi: ThirdPartyTransferService - get() = thirdPartyTransferService - val registrationApi: RegistrationService - get() = registrationService - val notificationApi: NotificationService - get() = notificationService - val userDetailsApi: UserDetailsService - get() = userDetailsService - val guarantorApi: GuarantorService - get() = guarantorService -} diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/DataManager.kt b/core/network/src/main/java/org/mifos/mobile/core/network/DataManager.kt deleted file mode 100644 index b524fe16a8..0000000000 --- a/core/network/src/main/java/org/mifos/mobile/core/network/DataManager.kt +++ /dev/null @@ -1,252 +0,0 @@ -/* - * 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/mobile-mobile/blob/master/LICENSE.md - */ -package org.mifos.mobile.core.network - -import io.reactivex.Observable -import okhttp3.ResponseBody -import org.mifos.mobile.core.datastore.PreferencesHelper -import org.mifos.mobile.core.model.entity.Charge -import org.mifos.mobile.core.model.entity.Page -import org.mifos.mobile.core.model.entity.Transaction -import org.mifos.mobile.core.model.entity.UpdatePasswordPayload -import org.mifos.mobile.core.model.entity.User -import org.mifos.mobile.core.model.entity.accounts.loan.LoanAccount -import org.mifos.mobile.core.model.entity.accounts.loan.LoanWithAssociations -import org.mifos.mobile.core.model.entity.accounts.loan.LoanWithdraw -import org.mifos.mobile.core.model.entity.accounts.savings.SavingsAccountApplicationPayload -import org.mifos.mobile.core.model.entity.accounts.savings.SavingsAccountUpdatePayload -import org.mifos.mobile.core.model.entity.accounts.savings.SavingsAccountWithdrawPayload -import org.mifos.mobile.core.model.entity.accounts.savings.SavingsWithAssociations -import org.mifos.mobile.core.model.entity.beneficiary.Beneficiary -import org.mifos.mobile.core.model.entity.beneficiary.BeneficiaryPayload -import org.mifos.mobile.core.model.entity.beneficiary.BeneficiaryUpdatePayload -import org.mifos.mobile.core.model.entity.client.Client -import org.mifos.mobile.core.model.entity.client.ClientAccounts -import org.mifos.mobile.core.model.entity.guarantor.GuarantorApplicationPayload -import org.mifos.mobile.core.model.entity.guarantor.GuarantorPayload -import org.mifos.mobile.core.model.entity.guarantor.GuarantorTemplatePayload -import org.mifos.mobile.core.model.entity.notification.NotificationRegisterPayload -import org.mifos.mobile.core.model.entity.notification.NotificationUserDetail -import org.mifos.mobile.core.model.entity.payload.LoansPayload -import org.mifos.mobile.core.model.entity.payload.LoginPayload -import org.mifos.mobile.core.model.entity.payload.TransferPayload -import org.mifos.mobile.core.model.entity.register.RegisterPayload -import org.mifos.mobile.core.model.entity.register.UserVerify -import org.mifos.mobile.core.model.entity.templates.account.AccountOptionsTemplate -import org.mifos.mobile.core.model.entity.templates.beneficiary.BeneficiaryTemplate -import org.mifos.mobile.core.model.entity.templates.loans.LoanTemplate -import org.mifos.mobile.core.model.entity.templates.savings.SavingsAccountTemplate -import javax.inject.Inject -import javax.inject.Singleton - -@Singleton -@Suppress("TooManyFunctions") -class DataManager @Inject constructor( - val preferencesHelper: PreferencesHelper, - private val baseApiManager: BaseApiManager, -) { - var clientId: Long? = preferencesHelper.clientId - - suspend fun login(loginPayload: LoginPayload): User { - return baseApiManager.authenticationApi.authenticate(loginPayload) - } - - suspend fun clients(): Page = baseApiManager.clientsApi.clients() - - suspend fun currentClient(): Client { - return baseApiManager.clientsApi.getClientForId(clientId) - } - - suspend fun clientImage(): ResponseBody { - return baseApiManager.clientsApi.getClientImage(clientId) - } - - suspend fun clientAccounts(): ClientAccounts { - return baseApiManager.clientsApi.getClientAccounts(clientId) - } - - suspend fun getAccounts(accountType: String?): ClientAccounts { - return baseApiManager.clientsApi.getAccounts(clientId, accountType) - } - - suspend fun getRecentTransactions(offset: Int, limit: Int): Page { - return baseApiManager.recentTransactionsApi.getRecentTransactionsList( - clientId, - offset, - limit, - ) - } - - suspend fun getClientCharges(clientId: Long): Page { - return baseApiManager.clientChargeApi.getClientChargeList(clientId) - } - - suspend fun getLoanCharges(loanId: Long): List { - return baseApiManager.clientChargeApi.getLoanAccountChargeList(loanId) - } - - suspend fun getSavingsCharges(savingsId: Long): List { - return baseApiManager.clientChargeApi.getSavingsAccountChargeList(savingsId) - } - - suspend fun getSavingsWithAssociations( - accountId: Long?, - associationType: String?, - ): SavingsWithAssociations { - return baseApiManager.savingAccountsListApi.getSavingsWithAssociations( - accountId, - associationType, - ) - } - - suspend fun accountTransferTemplate( - accountId: Long?, - accountType: Long?, - ): AccountOptionsTemplate = - baseApiManager.savingAccountsListApi.accountTransferTemplate(accountId, accountType) - - suspend fun makeTransfer(transferPayload: TransferPayload?): ResponseBody { - return baseApiManager.savingAccountsListApi.makeTransfer(transferPayload) - } - - suspend fun getSavingAccountApplicationTemplate(client: Long?): SavingsAccountTemplate { - return baseApiManager.savingAccountsListApi.getSavingsAccountApplicationTemplate(client) - } - - suspend fun submitSavingAccountApplication(payload: SavingsAccountApplicationPayload?): ResponseBody { - return baseApiManager.savingAccountsListApi.submitSavingAccountApplication(payload) - } - - suspend fun updateSavingsAccount( - accountId: Long?, - payload: SavingsAccountUpdatePayload?, - ): ResponseBody { - return baseApiManager.savingAccountsListApi.updateSavingsAccountUpdate(accountId, payload) - } - - suspend fun submitWithdrawSavingsAccount( - accountId: String?, - payload: SavingsAccountWithdrawPayload?, - ): ResponseBody { - return baseApiManager.savingAccountsListApi.submitWithdrawSavingsAccount(accountId, payload) - } - - fun getLoanAccountDetails(loanId: Long): Observable? { - return baseApiManager.loanAccountsListApi.getLoanAccountsDetail(loanId) - } - - suspend fun getLoanWithAssociations( - associationType: String?, - loanId: Long?, - ): LoanWithAssociations { - return baseApiManager.loanAccountsListApi.getLoanWithAssociations(loanId, associationType) - } - - suspend fun loanTemplate(): LoanTemplate = - baseApiManager.loanAccountsListApi.getLoanTemplate(clientId) - - suspend fun getLoanTemplateByProduct(productId: Int?): LoanTemplate { - return baseApiManager.loanAccountsListApi.getLoanTemplateByProduct(clientId, productId) - } - - suspend fun createLoansAccount(loansPayload: LoansPayload?): ResponseBody { - return baseApiManager.loanAccountsListApi.createLoansAccount(loansPayload) - } - - suspend fun updateLoanAccount(loanId: Long, loansPayload: LoansPayload?): ResponseBody { - return baseApiManager.loanAccountsListApi.updateLoanAccount(loanId, loansPayload) - } - - suspend fun withdrawLoanAccount(loanId: Long?, loanWithdraw: LoanWithdraw?): ResponseBody { - return baseApiManager.loanAccountsListApi.withdrawLoanAccount(loanId, loanWithdraw) - } - - suspend fun beneficiaryList(): List = - baseApiManager.beneficiaryApi.beneficiaryList() - - suspend fun beneficiaryTemplate(): BeneficiaryTemplate = - baseApiManager.beneficiaryApi.beneficiaryTemplate() - - suspend fun createBeneficiary(beneficiaryPayload: BeneficiaryPayload?): ResponseBody { - return baseApiManager.beneficiaryApi.createBeneficiary(beneficiaryPayload) - } - - suspend fun updateBeneficiary( - beneficiaryId: Long?, - payload: BeneficiaryUpdatePayload?, - ): ResponseBody { - return baseApiManager.beneficiaryApi.updateBeneficiary(beneficiaryId, payload) - } - - suspend fun deleteBeneficiary(beneficiaryId: Long?): ResponseBody { - return baseApiManager.beneficiaryApi.deleteBeneficiary(beneficiaryId) - } - - suspend fun thirdPartyTransferTemplate(): AccountOptionsTemplate = - baseApiManager.thirdPartyTransferApi.accountTransferTemplate() - - suspend fun makeThirdPartyTransfer(transferPayload: TransferPayload?): ResponseBody { - return baseApiManager.thirdPartyTransferApi.makeTransfer(transferPayload) - } - - suspend fun registerUser(registerPayload: RegisterPayload?): ResponseBody { - return baseApiManager.registrationApi.registerUser(registerPayload) - } - - suspend fun verifyUser(userVerify: UserVerify?): ResponseBody { - return baseApiManager.registrationApi.verifyUser(userVerify) - } - - suspend fun registerNotification(payload: NotificationRegisterPayload?): ResponseBody { - return baseApiManager.notificationApi.registerNotification(payload) - } - - suspend fun updateRegisterNotification( - id: Long, - payload: NotificationRegisterPayload?, - ): ResponseBody { - return baseApiManager.notificationApi.updateRegisterNotification(id, payload) - } - - suspend fun getUserNotificationId(id: Long): NotificationUserDetail { - return baseApiManager.notificationApi.getUserNotificationId(id) - } - - suspend fun updateAccountPassword(payload: UpdatePasswordPayload?): ResponseBody { - return baseApiManager.userDetailsApi.updateAccountPassword(payload) - } - - suspend fun getGuarantorTemplate(loanId: Long?): GuarantorTemplatePayload { - return baseApiManager.guarantorApi.getGuarantorTemplate(loanId) - } - - suspend fun getGuarantorList(loanId: Long): List { - return baseApiManager.guarantorApi.getGuarantorList(loanId) - } - - suspend fun createGuarantor( - loanId: Long?, - payload: GuarantorApplicationPayload?, - ): ResponseBody { - return baseApiManager.guarantorApi.createGuarantor(loanId, payload) - } - - suspend fun updateGuarantor( - payload: GuarantorApplicationPayload?, - loanId: Long?, - guarantorId: Long?, - ): ResponseBody { - return baseApiManager.guarantorApi.updateGuarantor(payload, loanId, guarantorId) - } - - suspend fun deleteGuarantor(loanId: Long?, guarantorId: Long?): ResponseBody { - return baseApiManager.guarantorApi.deleteGuarantor(loanId, guarantorId) - } -} diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/Result.kt b/core/network/src/main/java/org/mifos/mobile/core/network/Result.kt deleted file mode 100644 index 980cbdb3f4..0000000000 --- a/core/network/src/main/java/org/mifos/mobile/core/network/Result.kt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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/mobile-mobile/blob/master/LICENSE.md - */ -package org.mifos.mobile.core.network - -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.catch -import kotlinx.coroutines.flow.map -import kotlinx.coroutines.flow.onStart - -sealed interface Result { - data class Success(val data: T) : Result - data class Error(val exception: Throwable) : Result - data object Loading : Result -} - -fun Flow.asResult(): Flow> = map> { Result.Success(it) } - .onStart { emit(Result.Loading) } - .catch { emit(Result.Error(it)) } diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/SelfServiceInterceptor.kt b/core/network/src/main/java/org/mifos/mobile/core/network/SelfServiceInterceptor.kt deleted file mode 100644 index 728669d41e..0000000000 --- a/core/network/src/main/java/org/mifos/mobile/core/network/SelfServiceInterceptor.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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/mobile-mobile/blob/master/LICENSE.md - */ -package org.mifos.mobile.core.network - -import android.text.TextUtils -import okhttp3.Interceptor -import okhttp3.Response -import org.mifos.mobile.core.datastore.PreferencesHelper -import java.io.IOException - -class SelfServiceInterceptor(private val preferencesHelper: PreferencesHelper) : Interceptor { - @Throws(IOException::class) - override fun intercept(chain: Interceptor.Chain): Response { - val chainRequest = chain.request() - val builder = chainRequest.newBuilder() - .header(HEADER_TENANT, DEFAULT_TENANT) - .header(CONTENT_TYPE, "application/json") - if (!TextUtils.isEmpty(preferencesHelper.token)) { - builder.header(HEADER_AUTH, preferencesHelper.token!!) - } - val request = builder.build() - return chain.proceed(request) - } - - companion object { - const val HEADER_TENANT = "Fineract-Platform-TenantId" - const val HEADER_AUTH = "Authorization" - const val DEFAULT_TENANT = "default" - const val CONTENT_TYPE = "Content-Type" - } -} diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/SelfServiceOkHttpClient.kt b/core/network/src/main/java/org/mifos/mobile/core/network/SelfServiceOkHttpClient.kt deleted file mode 100644 index 933eb14fff..0000000000 --- a/core/network/src/main/java/org/mifos/mobile/core/network/SelfServiceOkHttpClient.kt +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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/mobile-mobile/blob/master/LICENSE.md - */ -package org.mifos.mobile.core.network - -import okhttp3.OkHttpClient -import okhttp3.logging.HttpLoggingInterceptor -import org.mifos.mobile.core.datastore.PreferencesHelper -import java.security.SecureRandom -import java.security.cert.CertificateException -import java.security.cert.X509Certificate -import java.util.concurrent.TimeUnit -import javax.net.ssl.SSLContext -import javax.net.ssl.TrustManager -import javax.net.ssl.X509TrustManager - -class SelfServiceOkHttpClient(private val preferences: PreferencesHelper) { - // Create a trust manager that does not validate certificate chains - val mifosOkHttpClient: OkHttpClient - // Interceptor :> Full Body Logger and ApiRequest Header - get() { - val builder = OkHttpClient.Builder() - try { - // Create a trust manager that does not validate certificate chains - val trustAllCerts = arrayOf( - object : X509TrustManager { - @Throws(CertificateException::class) - override fun checkClientTrusted( - chain: Array, - authType: String, - ) { - } - - @Throws(CertificateException::class) - override fun checkServerTrusted( - chain: Array, - authType: String, - ) { - } - - override fun getAcceptedIssuers(): Array { - return emptyArray() - } - }, - ) - - // Install the all-trusting trust manager - val sslContext = SSLContext.getInstance("SSL") - sslContext.init(null, trustAllCerts, SecureRandom()) - // Create an ssl socket factory with our all-trusting manager - val sslSocketFactory = sslContext.socketFactory - - // Enable Full Body Logging - val logger = HttpLoggingInterceptor() - logger.level = HttpLoggingInterceptor.Level.BODY - - // Set SSL certificate to OkHttpClient Builder -// builder.sslSocketFactory(sslSocketFactory) - builder.sslSocketFactory(sslSocketFactory, trustAllCerts[0] as X509TrustManager) - builder.hostnameVerifier { hostname, session -> true } - } catch (e: Exception) { - throw RuntimeException(e) - } - - // Enable Full Body Logging - val logger = HttpLoggingInterceptor() - logger.level = HttpLoggingInterceptor.Level.BODY - - // Setting Timeout 30 Seconds - builder.connectTimeout(60, TimeUnit.SECONDS) - builder.readTimeout(60, TimeUnit.SECONDS) - - // Interceptor :> Full Body Logger and ApiRequest Header - builder.addInterceptor(logger) - builder.addInterceptor(SelfServiceInterceptor(preferences)) - return builder.build() - } -} diff --git a/core/network/src/main/java/org/mifos/mobile/core/network/di/NetworkModule.kt b/core/network/src/main/java/org/mifos/mobile/core/network/di/NetworkModule.kt deleted file mode 100644 index 247a0d5fb7..0000000000 --- a/core/network/src/main/java/org/mifos/mobile/core/network/di/NetworkModule.kt +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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/mobile-mobile/blob/master/LICENSE.md - */ -package org.mifos.mobile.core.network.di - -import dagger.Module -import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent -import org.mifos.mobile.core.datastore.PreferencesHelper -import org.mifos.mobile.core.network.BaseURL -import org.mifos.mobile.core.network.SelfServiceOkHttpClient -import org.mifos.mobile.core.network.services.AuthenticationService -import org.mifos.mobile.core.network.services.BeneficiaryService -import org.mifos.mobile.core.network.services.ClientChargeService -import org.mifos.mobile.core.network.services.ClientService -import org.mifos.mobile.core.network.services.GuarantorService -import org.mifos.mobile.core.network.services.LoanAccountsListService -import org.mifos.mobile.core.network.services.NotificationService -import org.mifos.mobile.core.network.services.RecentTransactionsService -import org.mifos.mobile.core.network.services.RegistrationService -import org.mifos.mobile.core.network.services.SavingAccountsListService -import org.mifos.mobile.core.network.services.ThirdPartyTransferService -import org.mifos.mobile.core.network.services.UserDetailsService -import retrofit2.Retrofit -import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory -import retrofit2.converter.gson.GsonConverterFactory -import javax.inject.Singleton - -@Module -@InstallIn(SingletonComponent::class) -object NetworkModule { - - @Provides - @Singleton - fun providesRetrofitInstance(preferencesHelper: PreferencesHelper): Retrofit { - return Retrofit.Builder() - .baseUrl(BaseURL().url) - .addConverterFactory(GsonConverterFactory.create()) - .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) - .client(SelfServiceOkHttpClient(preferencesHelper).mifosOkHttpClient) - .build() - } - - @Provides - @Singleton - fun providesAuthenticationService(retrofit: Retrofit): AuthenticationService { - return retrofit.create(AuthenticationService::class.java) - } - - @Provides - @Singleton - fun providesClientService(retrofit: Retrofit): ClientService { - return retrofit.create(ClientService::class.java) - } - - @Provides - @Singleton - fun providesSavingAccountsListService(retrofit: Retrofit): SavingAccountsListService { - return retrofit.create(SavingAccountsListService::class.java) - } - - @Provides - @Singleton - fun providesLoanAccountListService(retrofit: Retrofit): LoanAccountsListService { - return retrofit.create(LoanAccountsListService::class.java) - } - - @Provides - @Singleton - fun providesRecentTransactionService(retrofit: Retrofit): RecentTransactionsService { - return retrofit.create(RecentTransactionsService::class.java) - } - - @Provides - @Singleton - fun providesClientChargeService(retrofit: Retrofit): ClientChargeService { - return retrofit.create(ClientChargeService::class.java) - } - - @Provides - @Singleton - fun providesBeneficiaryService(retrofit: Retrofit): BeneficiaryService { - return retrofit.create(BeneficiaryService::class.java) - } - - @Provides - @Singleton - fun provideThirdPartyTransferService(retrofit: Retrofit): ThirdPartyTransferService { - return retrofit.create(ThirdPartyTransferService::class.java) - } - - @Provides - @Singleton - fun providesRegistrationService(retrofit: Retrofit): RegistrationService { - return retrofit.create(RegistrationService::class.java) - } - - @Provides - @Singleton - fun providesNotificationService(retrofit: Retrofit): NotificationService { - return retrofit.create(NotificationService::class.java) - } - - @Provides - @Singleton - fun providesGuarantorService(retrofit: Retrofit): GuarantorService { - return retrofit.create(GuarantorService::class.java) - } - - @Provides - @Singleton - fun providesUserDetailsService(retrofit: Retrofit): UserDetailsService { - return retrofit.create(UserDetailsService::class.java) - } -} diff --git a/core/network/src/nativeMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.native.kt b/core/network/src/nativeMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.native.kt new file mode 100644 index 0000000000..b00db89293 --- /dev/null +++ b/core/network/src/nativeMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.native.kt @@ -0,0 +1,50 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network + +import io.ktor.client.HttpClient +import io.ktor.client.engine.darwin.Darwin +import io.ktor.client.plugins.HttpTimeout +import io.ktor.client.plugins.contentnegotiation.ContentNegotiation +import io.ktor.client.plugins.logging.DEFAULT +import io.ktor.client.plugins.logging.LogLevel +import io.ktor.client.plugins.logging.Logger +import io.ktor.client.plugins.logging.Logging +import io.ktor.serialization.kotlinx.json.json +import kotlinx.serialization.json.Json + +actual val ktorHttpClient: HttpClient + get() = HttpClient(Darwin) { + install(HttpTimeout) { + socketTimeoutMillis = 60_000 + requestTimeoutMillis = 60_000 + } + + install(Logging) { + logger = Logger.DEFAULT + level = LogLevel.ALL + logger = object : Logger { + override fun log(message: String) { + co.touchlab.kermit.Logger.d(tag = "KtorClient", messageString = message) + } + } + } + + install(ContentNegotiation) { + json( + Json { + prettyPrint = true + isLenient = true + ignoreUnknownKeys = true + explicitNulls = false + }, + ) + } + } diff --git a/core/network/src/wasmJsMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.wasmJs.kt b/core/network/src/wasmJsMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.wasmJs.kt new file mode 100644 index 0000000000..09e57dd858 --- /dev/null +++ b/core/network/src/wasmJsMain/kotlin/org/mifos/mobile/core/network/KtorHttpClient.wasmJs.kt @@ -0,0 +1,50 @@ +/* + * Copyright 2025 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/mobile-mobile/blob/master/LICENSE.md + */ +package org.mifos.mobile.core.network + +import io.ktor.client.HttpClient +import io.ktor.client.engine.js.Js +import io.ktor.client.plugins.HttpTimeout +import io.ktor.client.plugins.contentnegotiation.ContentNegotiation +import io.ktor.client.plugins.logging.DEFAULT +import io.ktor.client.plugins.logging.LogLevel +import io.ktor.client.plugins.logging.Logger +import io.ktor.client.plugins.logging.Logging +import io.ktor.serialization.kotlinx.json.json +import kotlinx.serialization.json.Json + +actual val ktorHttpClient: HttpClient + get() = HttpClient(Js) { + install(HttpTimeout) { + socketTimeoutMillis = 60_000 + requestTimeoutMillis = 60_000 + } + + install(Logging) { + logger = Logger.DEFAULT + level = LogLevel.ALL + logger = object : Logger { + override fun log(message: String) { + co.touchlab.kermit.Logger.d(tag = "KtorClient", messageString = message) + } + } + } + + install(ContentNegotiation) { + json( + Json { + prettyPrint = true + isLenient = true + ignoreUnknownKeys = true + explicitNulls = false + }, + ) + } + } diff --git a/core/testing/build.gradle.kts b/core/testing/build.gradle.kts index 01d7a07c06..2287543d0f 100644 --- a/core/testing/build.gradle.kts +++ b/core/testing/build.gradle.kts @@ -22,7 +22,7 @@ dependencies { api(libs.kotlinx.coroutines.test) api(projects.core.data) // api(projects.core.logs) - api(projects.core.model) +// api(projects.core.model) api(libs.turbine) api(libs.mockito.core) diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index fb1be6485a..3b2ac907ba 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -21,7 +21,7 @@ android { dependencies { api(projects.core.designsystem) - api(projects.core.model) +// api(projects.core.model) api(projects.core.common) api(libs.androidx.metrics)