Skip to content

Commit 0775557

Browse files
Recurring account template API (#2526)
1 parent 28b549c commit 0775557

File tree

88 files changed

+1924
-76
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1924
-76
lines changed

core/data/src/commonMain/kotlin/com/mifos/core/data/di/RepositoryModule.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import com.mifos.core.data.repository.NoteRepository
5151
import com.mifos.core.data.repository.OfflineDashboardRepository
5252
import com.mifos.core.data.repository.PathTrackingRepository
5353
import com.mifos.core.data.repository.PinPointClientRepository
54+
import com.mifos.core.data.repository.RecurringAccountRepository
5455
import com.mifos.core.data.repository.ReportCategoryRepository
5556
import com.mifos.core.data.repository.ReportDetailRepository
5657
import com.mifos.core.data.repository.SavingsAccountActivateRepository
@@ -112,6 +113,7 @@ import com.mifos.core.data.repositoryImp.NoteRepositoryImp
112113
import com.mifos.core.data.repositoryImp.OfflineDashboardRepositoryImp
113114
import com.mifos.core.data.repositoryImp.PathTrackingRepositoryImp
114115
import com.mifos.core.data.repositoryImp.PinPointClientRepositoryImp
116+
import com.mifos.core.data.repositoryImp.RecurringAccountRepositoryImp
115117
import com.mifos.core.data.repositoryImp.ReportCategoryRepositoryImp
116118
import com.mifos.core.data.repositoryImp.ReportDetailRepositoryImp
117119
import com.mifos.core.data.repositoryImp.SavingsAccountActivateRepositoryImp
@@ -220,6 +222,8 @@ val RepositoryModule = module {
220222
singleOf(::SurveySubmitRepositoryImp) bind SurveySubmitRepository::class
221223
singleOf(::SignatureRepositoryImp) bind SignatureRepository::class
222224

225+
singleOf(::RecurringAccountRepositoryImp) bind RecurringAccountRepository::class
226+
223227
includes(platformModule)
224228
single<PlatformDependentDataModule> { getPlatformDataModule }
225229
single<NetworkMonitor> { getPlatformDataModule.networkMonitor }
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.core.data.repository
11+
12+
import com.mifos.core.common.utils.DataState
13+
import com.mifos.core.model.objects.payloads.RecurringDepositAccountPayload
14+
import com.mifos.room.entities.accounts.recurring.RecurringDeposit
15+
import com.mifos.room.entities.templates.recurringDeposit.RecurringDepositAccountTemplate
16+
import kotlinx.coroutines.flow.Flow
17+
18+
interface RecurringAccountRepository {
19+
20+
fun getRecuttingAccountRepository(): Flow<DataState<RecurringDepositAccountTemplate>>
21+
22+
fun getRecuttingAccountRepositoryBtProduct(
23+
clientId: Int,
24+
productId: Int,
25+
): Flow<DataState<RecurringDepositAccountTemplate>>
26+
27+
fun createRecurringDepositAccount(
28+
recurringDepositAccountPayload: RecurringDepositAccountPayload?,
29+
): Flow<DataState<RecurringDeposit>>
30+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.core.data.repositoryImp
11+
12+
import com.mifos.core.common.utils.DataState
13+
import com.mifos.core.common.utils.asDataStateFlow
14+
import com.mifos.core.data.repository.RecurringAccountRepository
15+
import com.mifos.core.model.objects.payloads.RecurringDepositAccountPayload
16+
import com.mifos.core.network.datamanager.DataManagerRecurringAccount
17+
import com.mifos.room.entities.accounts.recurring.RecurringDeposit
18+
import com.mifos.room.entities.templates.recurringDeposit.RecurringDepositAccountTemplate
19+
import kotlinx.coroutines.flow.Flow
20+
21+
class RecurringAccountRepositoryImp(
22+
val dataManagerRecurringAccount: DataManagerRecurringAccount,
23+
) : RecurringAccountRepository {
24+
override fun getRecuttingAccountRepository(): Flow<DataState<RecurringDepositAccountTemplate>> {
25+
return dataManagerRecurringAccount.getRecurringDepositAccountTemplate
26+
.asDataStateFlow()
27+
}
28+
29+
override fun getRecuttingAccountRepositoryBtProduct(
30+
clientId: Int,
31+
productId: Int,
32+
): Flow<DataState<RecurringDepositAccountTemplate>> {
33+
return dataManagerRecurringAccount.getRecurringDepositAccountTemplateByProduct(
34+
clientId,
35+
productId,
36+
).asDataStateFlow()
37+
}
38+
39+
override fun createRecurringDepositAccount(
40+
recurringDepositAccountPayload: RecurringDepositAccountPayload?,
41+
): Flow<DataState<RecurringDeposit>> {
42+
return dataManagerRecurringAccount.createRecurringDepositAccount(
43+
recurringDepositAccountPayload,
44+
).asDataStateFlow()
45+
}
46+
}

core/database/src/commonMain/kotlin/com/mifos/room/basemodel/APIEndPoint.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ object APIEndPoint {
2525
const val CREATE_SAVINGS_PRODUCTS = "savingsproducts"
2626
const val CREATE_LOANS_ACCOUNTS = "loans"
2727
const val CREATE_LOANS_PRODUCTS = "loanproducts"
28+
29+
const val CREATE_RECURRING_DEPOSIT_ACCOUNTS = "recurringdepositaccounts"
2830
const val DATATABLES = "datatables"
2931
const val GROUPS = "groups"
3032
const val DOCUMENTS = "documents"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.room.entities.accounts.recurring
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class AccountChart(
16+
val accountId: Int? = null,
17+
val accountNumber: String? = null,
18+
val chartSlabs: List<ChartSlab>? = null,
19+
val endDate: List<Int>? = null,
20+
val fromDate: List<Int>? = null,
21+
val id: Int? = null,
22+
val isPrimaryGroupingByAmount: Boolean? = null,
23+
val name: String? = null,
24+
val periodTypes: List<PeriodType>? = null,
25+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.room.entities.accounts.recurring
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class AttributeName(
16+
val code: String? = null,
17+
val id: Int? = null,
18+
val value: String? = null,
19+
)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.room.entities.accounts.recurring
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class ChartSlab(
16+
val amountRangeFrom: Double? = null,
17+
val annualInterestRate: Double? = null,
18+
val currency: Currency? = null,
19+
val description: String? = null,
20+
val fromPeriod: Int? = null,
21+
val id: Int? = null,
22+
val incentives: List<Incentive>? = null,
23+
val periodType: PeriodType? = null,
24+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.room.entities.accounts.recurring
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class ConditionType(
16+
val code: String? = null,
17+
val id: Int? = null,
18+
val value: String? = null,
19+
)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.room.entities.accounts.recurring
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class Currency(
16+
val code: String? = null,
17+
val decimalPlaces: Int? = null,
18+
val displayLabel: String? = null,
19+
val displaySymbol: String? = null,
20+
val inMultiplesOf: Int? = null,
21+
val name: String? = null,
22+
val nameCode: String? = null,
23+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*
8+
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
9+
*/
10+
package com.mifos.room.entities.accounts.recurring
11+
12+
import kotlinx.serialization.Serializable
13+
14+
@Serializable
15+
data class EntityType(
16+
val code: String? = null,
17+
val id: Int? = null,
18+
val value: String? = null,
19+
)

0 commit comments

Comments
 (0)