Skip to content

Commit 81fd74e

Browse files
committed
Remove the default parameter values for LoanChargeOffRequestDto to avoid the serializer omitting the default values issue
1 parent ca2b7b3 commit 81fd74e

8 files changed

Lines changed: 16 additions & 22 deletions

File tree

core/model/src/commonMain/kotlin/com/mifos/core/model/objects/account/loan/LoanChargeOffInput.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ data class LoanChargeOffInput(
1717
val externalId: String? = null,
1818
val note: String? = null,
1919
val locale: String = DateConstants.LOCALE,
20-
val dateFormat: String = DateConstants.DATE_FORMAT,
20+
val dateFormat: String = "dd-MM-yyyy",
2121
)

core/network/src/commonMain/kotlin/com/mifos/core/network/dto/loans/LoanChargeOffRequestDto.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
package com.mifos.core.network.dto.loans
1111

12-
import com.mifos.core.model.utils.DateConstants
1312
import kotlinx.serialization.Serializable
1413

1514
@Serializable
@@ -18,6 +17,6 @@ data class LoanChargeOffRequestDto(
1817
val transactionDate: String,
1918
val externalId: String? = null,
2019
val note: String? = null,
21-
val locale: String = DateConstants.LOCALE,
22-
val dateFormat: String = DateConstants.DATE_FORMAT,
20+
val locale: String,
21+
val dateFormat: String,
2322
)

feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountAction/LoanAccountActionItem.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ import androidclient.feature.loan.generated.resources.feature_loan_action_withdr
145145
import androidclient.feature.loan.generated.resources.feature_loan_action_withdrawn_by_client_sub
146146
import androidclient.feature.loan.generated.resources.feature_loan_action_write_off
147147
import androidclient.feature.loan.generated.resources.feature_loan_action_write_off_sub
148+
import androidclient.feature.loan.generated.resources.feature_loan_charge_off
149+
import androidclient.feature.loan.generated.resources.feature_loan_charge_off_subtitle
148150
import androidclient.feature.loan.generated.resources.feature_loan_create_guarantors
149151
import androidclient.feature.loan.generated.resources.feature_loan_create_guarantors_sub
150152
import androidclient.feature.loan.generated.resources.feature_loan_merchant_issued_refund_schedule
@@ -439,4 +441,10 @@ sealed class LoanAccountActionItem(
439441
subTitle = LoanRes.string.feature_loan_action_merchant_issued_refund_sub,
440442
icon = UiRes.drawable.merchant_issued_refund,
441443
)
444+
445+
data object LoanChargeOff : LoanAccountActionItem(
446+
title = LoanRes.string.feature_loan_charge_off,
447+
subTitle = LoanRes.string.feature_loan_charge_off_subtitle,
448+
icon = UiRes.drawable.charge_off,
449+
)
442450
}

feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountAction/LoanAccountActionNavigation.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ fun NavGraphBuilder.loanAccountActionDestination(
2323
navController: NavController,
2424
onNavigateBack: () -> Unit,
2525
navigateToPaymentsActionScreen: () -> Unit,
26+
navigateToChargeOff: (loanId: Int) -> Unit,
2627
// add other actions navigation lambda parameters here
2728
) {
2829
composable<LoanAccountActionRoute> {
@@ -78,6 +79,7 @@ fun NavGraphBuilder.loanAccountActionDestination(
7879
LoanAccountActionItem.WithdrawnByClient -> {}
7980
LoanAccountActionItem.WriteOff -> {}
8081
LoanAccountActionItem.WaiveInterest -> {}
82+
LoanAccountActionItem.LoanChargeOff -> navigateToChargeOff(loanId)
8183
}
8284
},
8385
)

feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountProfile/LoanAccountProfileNavigation.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ fun NavGraphBuilder.loanProfileAccountDestination(
3434
approveLoan: (Int, LoanWithAssociationsEntity) -> Unit,
3535
onRepaymentClick: (LoanWithAssociationsEntity) -> Unit,
3636
navigateToTransferScreen: (loanId: Int) -> Unit,
37-
navigateToChargeOff: (Int) -> Unit,
3837
) {
3938
composable<LoanAccountRoute> {
4039
LoanAccountProfileScreen(
41-
onNavigateBack = onNavigateBack,
4240
navController = navController,
41+
onNavigateBack = onNavigateBack,
4342
navigateToRepaymentSchedule = navigateToRepaymentSchedule,
4443
navigateToTransactions = navigateToTransactions,
4544
navigateToCharges = navigateToCharges,
@@ -50,7 +49,6 @@ fun NavGraphBuilder.loanProfileAccountDestination(
5049
approveLoan = approveLoan,
5150
onRepaymentClick = onRepaymentClick,
5251
navigateToTransferScreen = navigateToTransferScreen,
53-
navigateToChargeOff = navigateToChargeOff,
5452
navigateToLoanAction = navigateToLoanAction,
5553
)
5654
}

feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountProfile/LoanAccountProfileScreen.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ import template.core.base.designsystem.theme.KptTheme
7777

7878
@Composable
7979
internal fun LoanAccountProfileScreen(
80+
navController: NavController,
8081
onNavigateBack: () -> Unit,
8182
approveLoan: (Int, LoanWithAssociationsEntity) -> Unit,
8283
onRepaymentClick: (LoanWithAssociationsEntity) -> Unit,
@@ -88,9 +89,7 @@ internal fun LoanAccountProfileScreen(
8889
navigateToNotes: (Int) -> Unit,
8990
navigateToLoanAction: (Int) -> Unit,
9091
navigateToTransferScreen: (loanId: Int) -> Unit,
91-
navigateToChargeOff: (Int) -> Unit,
9292
navigateToDashboard: (Int) -> Unit,
93-
navController: NavController,
9493
modifier: Modifier = Modifier,
9594
viewModel: LoanAccountProfileViewModel = koinViewModel(),
9695
) {
@@ -128,9 +127,7 @@ internal fun LoanAccountProfileScreen(
128127
LoanAccountProfileActionItem.Reschedules -> navigateToReschedules(loanId)
129128
LoanAccountProfileActionItem.Dashboard -> navigateToDashboard(loanId)
130129
LoanAccountProfileActionItem.Notes -> navigateToNotes(loanId)
131-
LoanAccountProfileActionItem.LoanChargeOff -> navigateToChargeOff(loanId)
132130
else -> {}
133-
134131
}
135132
}
136133

feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/loanAccountProfile/components/LoanAccountProfileActionItem.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ package com.mifos.feature.loan.loanAccountProfile.components
1111

1212
import androidclient.core.ui.generated.resources.account_details
1313
import androidclient.core.ui.generated.resources.autorenew
14-
import androidclient.core.ui.generated.resources.charge_off
1514
import androidclient.core.ui.generated.resources.charges
1615
import androidclient.core.ui.generated.resources.collateral
1716
import androidclient.core.ui.generated.resources.dashboard
@@ -23,8 +22,6 @@ import androidclient.core.ui.generated.resources.repayment_schedule
2322
import androidclient.core.ui.generated.resources.reschedules
2423
import androidclient.core.ui.generated.resources.term_variations
2524
import androidclient.core.ui.generated.resources.transaction
26-
import androidclient.feature.loan.generated.resources.feature_loan_charge_off
27-
import androidclient.feature.loan.generated.resources.feature_loan_charge_off_subtitle
2825
import androidclient.feature.loan.generated.resources.feature_loan_profile_item_account_details_subtitle
2926
import androidclient.feature.loan.generated.resources.feature_loan_profile_item_account_details_title
3027
import androidclient.feature.loan.generated.resources.feature_loan_profile_item_charges_subtitle
@@ -128,12 +125,6 @@ sealed class LoanAccountProfileActionItem(
128125
subTitle = LoanRes.string.feature_loan_profile_item_standing_instructions_subtitle,
129126
icon = UiRes.drawable.autorenew,
130127
)
131-
132-
data object LoanChargeOff : LoanAccountProfileActionItem(
133-
title = LoanRes.string.feature_loan_charge_off,
134-
subTitle = LoanRes.string.feature_loan_charge_off_subtitle,
135-
icon = UiRes.drawable.charge_off,
136-
)
137128
}
138129

139130
internal val loanProfileActionItems: ImmutableList<LoanAccountProfileActionItem> = persistentListOf(
@@ -150,5 +141,4 @@ internal val loanProfileActionItems: ImmutableList<LoanAccountProfileActionItem>
150141
LoanAccountProfileActionItem.Documents,
151142
LoanAccountProfileActionItem.Notes,
152143
LoanAccountProfileActionItem.StandingInstructions,
153-
LoanAccountProfileActionItem.LoanChargeOff,
154144
)

feature/loan/src/commonMain/kotlin/com/mifos/feature/loan/navigation/LoanNavigation.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,13 @@ fun NavGraphBuilder.loanDestination(
116116
navigateToTransferScreen = navController::navigateToTransferScreen,
117117
navigateToLoanAction = navController::navigateToLoanAccountActionScreen,
118118
navigateToReschedules = navController::navigateToLoanReschedulesScreen,
119-
navigateToChargeOff = navController::navigateToLoanChargeOffScreen,
120119
)
121120

122121
loanAccountActionDestination(
123122
navController = navController,
124123
onNavigateBack = navController::popBackStack,
125124
navigateToPaymentsActionScreen = navController::navigateToLoanPaymentsAction,
125+
navigateToChargeOff = navController::navigateToLoanChargeOffScreen,
126126
)
127127

128128
loanPaymentsActionDestination(

0 commit comments

Comments
 (0)