-
Notifications
You must be signed in to change notification settings - Fork 698
feature(standingInstructions) : Implemented new module and network layer implementation for the standing instructions endpoint. #2694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
techsavvy185
wants to merge
17
commits into
openMF:dev
Choose a base branch
from
techsavvy185:loanStandingInstructions
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
8554a6b
feature(standingInstructions) : Implemented new module and network la…
techsavvy185 e61da2e
Implemented the screen.
techsavvy185 0174b32
Merge branch 'dev' into loanStandingInstructions
techsavvy185 452704f
Implemented the navigation from savings account.
techsavvy185 b618637
Added Refresh button.
techsavvy185 16d1ed9
Fix error.
techsavvy185 77fd653
Implemented Edit and Delete functionality.
techsavvy185 9d86236
Added currency formatter.
techsavvy185 17658c5
Minor fixes.
techsavvy185 5114fda
Replaced magic number with a type safe declaration.
techsavvy185 bb967e9
Merge branch 'dev' into loanStandingInstructions
niyajali 7ca9228
Fix date formatting.
techsavvy185 47b29fc
Merge remote-tracking branch 'origin/loanStandingInstructions' into l…
techsavvy185 6ffe411
Merge branch 'dev' into loanStandingInstructions
techsavvy185 037df6f
Small changes.
techsavvy185 5287979
Merge remote-tracking branch 'origin/loanStandingInstructions' into l…
techsavvy185 a5b1ee2
Merge branch 'dev' into loanStandingInstructions
techsavvy185 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...otlin/com/mifos/core/data/mappers/standingInstructions/StandingInstructionEntityMapper.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * Copyright 2026 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/mifos-x-field-officer-app/blob/master/LICENSE.md | ||
| */ | ||
| package com.mifos.core.data.mappers.standingInstructions | ||
|
|
||
| import com.mifos.core.model.objects.standingInstructions.StandingInstruction | ||
| import com.mifos.core.model.objects.standingInstructions.StandingInstructionAccount | ||
| import com.mifos.core.model.objects.standingInstructions.StandingInstructionClient | ||
| import com.mifos.core.network.dto.standingInstruction.StandingInstructionDto | ||
| import com.mifos.room.entities.standingInstructions.StandingInstructionAccountEntity | ||
| import com.mifos.room.entities.standingInstructions.StandingInstructionClientEntity | ||
| import com.mifos.room.entities.standingInstructions.StandingInstructionEntity | ||
|
|
||
| fun StandingInstructionDto.toEntity(): StandingInstructionEntity { | ||
| return StandingInstructionEntity( | ||
| id = this.id, | ||
| amount = this.amount, | ||
| validFrom = this.validFrom, | ||
| fromClient = this.fromClient?.let { StandingInstructionClientEntity(it.id, it.displayName) }, | ||
| toClient = this.toClient?.let { StandingInstructionClientEntity(it.id, it.displayName) }, | ||
| fromAccount = this.fromAccount?.let { StandingInstructionAccountEntity(it.id, it.accountNo, it.productName) }, | ||
| toAccount = this.toAccount?.let { | ||
| StandingInstructionAccountEntity( | ||
| it.id, | ||
| it.accountNo, | ||
| it.productName, | ||
| ) | ||
| }, | ||
| ) | ||
| } | ||
|
|
||
| fun StandingInstructionEntity.toDomain(): StandingInstruction { | ||
| return StandingInstruction( | ||
| id = this.id, | ||
| amount = this.amount, | ||
| validFrom = this.validFrom, | ||
| fromClient = this.fromClient?.toDomain(), | ||
| toClient = this.toClient?.toDomain(), | ||
| fromAccount = this.fromAccount?.toDomain(), | ||
| toAccount = this.toAccount?.toDomain(), | ||
| ) | ||
| } | ||
|
|
||
| fun StandingInstructionClientEntity.toDomain(): StandingInstructionClient { | ||
| return StandingInstructionClient( | ||
| id = this.id, | ||
| displayName = this.displayName, | ||
| ) | ||
| } | ||
|
|
||
| fun StandingInstructionAccountEntity.toDomain(): StandingInstructionAccount { | ||
| return StandingInstructionAccount( | ||
| id = this.id, | ||
| accountNo = this.accountNo, | ||
| productName = this.productName, | ||
| ) | ||
| } |
44 changes: 44 additions & 0 deletions
44
.../kotlin/com/mifos/core/data/mappers/standingInstructions/StandingInstructionsDtoMapper.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Copyright 2026 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/mifos-x-field-officer-app/blob/master/LICENSE.md | ||
| */ | ||
| package com.mifos.core.data.mappers.standingInstructions | ||
|
|
||
| import com.mifos.core.model.objects.standingInstructions.StandingInstruction | ||
| import com.mifos.core.model.objects.standingInstructions.StandingInstructionAccount | ||
| import com.mifos.core.model.objects.standingInstructions.StandingInstructionClient | ||
| import com.mifos.core.network.dto.standingInstruction.ClientDto | ||
| import com.mifos.core.network.dto.standingInstruction.StandingInstructionAccountDto | ||
| import com.mifos.core.network.dto.standingInstruction.StandingInstructionDto | ||
|
|
||
| fun StandingInstructionDto.toDomain(): StandingInstruction { | ||
| return StandingInstruction( | ||
| id = this.id, | ||
| amount = this.amount, | ||
| validFrom = this.validFrom, | ||
| fromClient = this.fromClient?.toDomain(), | ||
| toClient = this.toClient?.toDomain(), | ||
| fromAccount = this.fromAccount?.toDomain(), | ||
| toAccount = this.toAccount?.toDomain(), | ||
| ) | ||
| } | ||
|
|
||
| fun ClientDto.toDomain(): StandingInstructionClient { | ||
| return StandingInstructionClient( | ||
| id = this.id, | ||
| displayName = this.displayName, | ||
| ) | ||
| } | ||
|
|
||
| fun StandingInstructionAccountDto.toDomain(): StandingInstructionAccount { | ||
| return StandingInstructionAccount( | ||
| id = this.id, | ||
| accountNo = this.accountNo, | ||
| productName = this.productName, | ||
| ) | ||
| } |
26 changes: 26 additions & 0 deletions
26
...ta/src/commonMain/kotlin/com/mifos/core/data/repository/StandingInstructionsRepository.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /* | ||
| * Copyright 2026 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/mifos-x-field-officer-app/blob/master/LICENSE.md | ||
| */ | ||
| package com.mifos.core.data.repository | ||
|
|
||
| import com.mifos.core.common.utils.DataState | ||
| import com.mifos.core.common.utils.Page | ||
| import com.mifos.core.model.objects.standingInstructions.StandingInstruction | ||
| import kotlinx.coroutines.flow.Flow | ||
|
|
||
| interface StandingInstructionsRepository { | ||
| fun getStandingInstructionList( | ||
| clientId: Long, | ||
| clientName: String, | ||
| fromAccountType: Int, | ||
| fromAccountId: Long, | ||
| limit: Int, | ||
| offset: Int, | ||
| ): Flow<DataState<Page<StandingInstruction>>> | ||
| } |
59 changes: 59 additions & 0 deletions
59
.../commonMain/kotlin/com/mifos/core/data/repositoryImp/StandingInstructionsRepositoryImp.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Copyright 2026 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/mifos-x-field-officer-app/blob/master/LICENSE.md | ||
| */ | ||
| package com.mifos.core.data.repositoryImp | ||
|
|
||
| import com.mifos.core.common.utils.DataState | ||
| import com.mifos.core.common.utils.Page | ||
| import com.mifos.core.common.utils.asDataStateFlow | ||
| import com.mifos.core.data.mappers.standingInstructions.toDomain | ||
| import com.mifos.core.data.repository.StandingInstructionsRepository | ||
| import com.mifos.core.data.util.NetworkMonitor | ||
| import com.mifos.core.data.util.withNetworkCheck | ||
| import com.mifos.core.model.objects.standingInstructions.StandingInstruction | ||
| import com.mifos.core.network.datamanager.DataManagerStandingInstructions | ||
| import kotlinx.coroutines.flow.Flow | ||
| import kotlinx.coroutines.flow.flowOn | ||
| import kotlinx.coroutines.flow.map | ||
| import template.core.base.common.manager.DispatcherManager | ||
|
|
||
| class StandingInstructionsRepositoryImp( | ||
| private val dataManagerStandingInstructions: DataManagerStandingInstructions, | ||
| private val networkMonitor: NetworkMonitor, | ||
| private val dispatcher: DispatcherManager, | ||
| ) : StandingInstructionsRepository { | ||
|
|
||
| override fun getStandingInstructionList( | ||
| clientId: Long, | ||
| clientName: String, | ||
| fromAccountType: Int, | ||
| fromAccountId: Long, | ||
| limit: Int, | ||
| offset: Int, | ||
| ): Flow<DataState<Page<StandingInstruction>>> { | ||
| return networkMonitor.withNetworkCheck( | ||
| dataManagerStandingInstructions | ||
| .retrieveListStandingInstructions( | ||
| clientId = clientId, | ||
| clientName = clientName, | ||
| fromAccountType = fromAccountType, | ||
| fromAccountId = fromAccountId, | ||
| limit = limit, | ||
| offset = offset, | ||
| ) | ||
| .map { pageDto -> | ||
| Page( | ||
| totalFilteredRecords = pageDto.totalFilteredRecords, | ||
| pageItems = pageDto.pageItems.map { it.toDomain() }, | ||
| ) | ||
| } | ||
| .asDataStateFlow(), | ||
| ).flowOn(dispatcher.io) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...n/kotlin/com/mifos/room/entities/standingInstructions/StandingInstructionAccountEntity.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* | ||
| * Copyright 2026 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/mifos-x-field-officer-app/blob/master/LICENSE.md | ||
| */ | ||
| package com.mifos.room.entities.standingInstructions | ||
|
|
||
| import com.mifos.core.model.utils.Parcelable | ||
| import com.mifos.core.model.utils.Parcelize | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| @Parcelize | ||
| data class StandingInstructionAccountEntity( | ||
| val id: Int? = null, | ||
| val accountNo: String? = null, | ||
| val productName: String? = null, | ||
| ) : Parcelable |
21 changes: 21 additions & 0 deletions
21
...in/kotlin/com/mifos/room/entities/standingInstructions/StandingInstructionClientEntity.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /* | ||
| * Copyright 2026 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/mifos-x-field-officer-app/blob/master/LICENSE.md | ||
| */ | ||
| package com.mifos.room.entities.standingInstructions | ||
|
|
||
| import com.mifos.core.model.utils.Parcelable | ||
| import com.mifos.core.model.utils.Parcelize | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| @Parcelize | ||
| data class StandingInstructionClientEntity( | ||
| val id: Int? = null, | ||
| val displayName: String? = null, | ||
| ) : Parcelable |
43 changes: 43 additions & 0 deletions
43
...mmonMain/kotlin/com/mifos/room/entities/standingInstructions/StandingInstructionEntity.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * 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/mifos-x-field-officer-app/blob/master/LICENSE.md | ||
| */ | ||
| package com.mifos.room.entities.standingInstructions | ||
|
|
||
| import com.mifos.core.model.utils.Parcelable | ||
| import com.mifos.core.model.utils.Parcelize | ||
| import kotlinx.serialization.Serializable | ||
| import template.core.base.database.Entity | ||
| import template.core.base.database.PrimaryKey | ||
|
|
||
| @Entity( | ||
| tableName = "StandingInstruction", | ||
| indices = [], | ||
| inheritSuperIndices = false, | ||
| primaryKeys = [], | ||
| ignoredColumns = [], | ||
| foreignKeys = [], | ||
| ) | ||
| @Serializable | ||
| @Parcelize | ||
| data class StandingInstructionEntity( | ||
| @PrimaryKey(autoGenerate = false) | ||
| val id: Int, | ||
|
|
||
| val amount: Double? = null, | ||
|
|
||
| val validFrom: String? = null, | ||
|
|
||
| val fromClient: StandingInstructionClientEntity? = null, | ||
|
|
||
| val toClient: StandingInstructionClientEntity? = null, | ||
|
|
||
| val fromAccount: StandingInstructionAccountEntity? = null, | ||
|
|
||
| val toAccount: StandingInstructionAccountEntity? = null, | ||
| ) : Parcelable |
23 changes: 23 additions & 0 deletions
23
...ommonMain/kotlin/com/mifos/core/model/objects/standingInstructions/StandingInstruction.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* | ||
| * Copyright 2026 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/mifos-x-field-officer-app/blob/master/LICENSE.md | ||
| */ | ||
| package com.mifos.core.model.objects.standingInstructions | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class StandingInstruction( | ||
| val id: Int, | ||
| val amount: Double? = null, | ||
| val validFrom: String? = null, | ||
| val fromClient: StandingInstructionClient? = null, | ||
| val toClient: StandingInstructionClient? = null, | ||
| val fromAccount: StandingInstructionAccount? = null, | ||
| val toAccount: StandingInstructionAccount? = null, | ||
| ) | ||
19 changes: 19 additions & 0 deletions
19
...in/kotlin/com/mifos/core/model/objects/standingInstructions/StandingInstructionAccount.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /* | ||
| * Copyright 2026 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/mifos-x-field-officer-app/blob/master/LICENSE.md | ||
| */ | ||
| package com.mifos.core.model.objects.standingInstructions | ||
|
|
||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class StandingInstructionAccount( | ||
| val id: Int? = null, | ||
| val accountNo: String? = null, | ||
| val productName: String? = null, | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.