feat: Comment out features not using self API (#1928)

This commit is contained in:
Nagarjuna 2025-09-09 15:30:53 +05:30 committed by GitHub
parent 38eab321fd
commit df7be3d35c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 123 additions and 120 deletions

View File

@ -29,7 +29,6 @@ import org.mifospay.feature.faq.navigation.navigateToFAQ
import org.mifospay.feature.finance.FinanceScreenContents
import org.mifospay.feature.finance.navigation.FINANCE_ROUTE
import org.mifospay.feature.finance.navigation.financeScreen
import org.mifospay.feature.history.HistoryScreen
import org.mifospay.feature.history.navigation.historyNavigation
import org.mifospay.feature.history.navigation.navigateToHistory
import org.mifospay.feature.history.navigation.navigateToSpecificTransaction
@ -38,14 +37,10 @@ import org.mifospay.feature.history.navigation.specificTransactionsScreen
import org.mifospay.feature.history.navigation.transactionDetailNavigation
import org.mifospay.feature.home.navigation.HOME_ROUTE
import org.mifospay.feature.home.navigation.homeScreen
import org.mifospay.feature.invoices.InvoiceScreen
import org.mifospay.feature.invoices.navigation.invoiceDetailScreen
import org.mifospay.feature.invoices.navigation.navigateToInvoiceDetail
import org.mifospay.feature.kyc.KYCScreen
import org.mifospay.feature.kyc.navigation.kycLevel1Screen
import org.mifospay.feature.kyc.navigation.kycLevel2Screen
import org.mifospay.feature.kyc.navigation.kycLevel3Screen
import org.mifospay.feature.kyc.navigation.navigateToKYCLevel1
import org.mifospay.feature.kyc.navigation.navigateToKYCLevel2
import org.mifospay.feature.kyc.navigation.navigateToKYCLevel3
import org.mifospay.feature.make.transfer.navigation.navigateToTransferScreen
@ -53,7 +48,6 @@ import org.mifospay.feature.make.transfer.navigation.transferScreen
import org.mifospay.feature.make.transfer.success.navigateTransferSuccess
import org.mifospay.feature.make.transfer.success.transferSuccessScreen
import org.mifospay.feature.merchants.navigation.merchantTransferScreen
import org.mifospay.feature.merchants.ui.MerchantScreen
import org.mifospay.feature.notification.navigateToNotification
import org.mifospay.feature.notification.notificationScreen
import org.mifospay.feature.payments.PaymentsScreenContents
@ -66,20 +60,13 @@ import org.mifospay.feature.qr.navigation.scanQrScreen
import org.mifospay.feature.receipt.navigation.receiptScreen
import org.mifospay.feature.request.money.navigation.navigateToShowQrScreen
import org.mifospay.feature.request.money.navigation.showQrScreen
import org.mifospay.feature.savedcards.CardsScreen
import org.mifospay.feature.savedcards.createOrUpdate.addEditCardScreen
import org.mifospay.feature.savedcards.createOrUpdate.navigateToCardAddEdit
import org.mifospay.feature.savedcards.details.cardDetailRoute
import org.mifospay.feature.savedcards.details.navigateToCardDetails
import org.mifospay.feature.send.money.SendMoneyScreen
import org.mifospay.feature.send.money.navigation.SEND_MONEY_BASE_ROUTE
import org.mifospay.feature.send.money.navigation.navigateToSendMoneyScreen
import org.mifospay.feature.send.money.navigation.sendMoneyScreen
import org.mifospay.feature.settings.navigation.settingsScreen
import org.mifospay.feature.standing.instruction.StandingInstructionsScreen
import org.mifospay.feature.standing.instruction.createOrUpdate.addEditSIScreen
import org.mifospay.feature.standing.instruction.createOrUpdate.navigateToSIAddEdit
import org.mifospay.feature.standing.instruction.details.navigateSIDetails
import org.mifospay.feature.standing.instruction.details.siDetailsScreen
import org.mifospay.feature.upi.setup.navigation.setupUpiPinScreen
import org.mifospay.shared.ui.MifosAppState
@ -93,38 +80,39 @@ internal fun MifosNavHost(
val navController = appState.navController
val paymentsTabContents = listOf(
TabContent(PaymentsScreenContents.SEND.name) {
SendMoneyScreen(
onBackClick = navController::navigateUp,
navigateToTransferScreen = navController::navigateToTransferScreen,
navigateToScanQrScreen = navController::navigateToScanQr,
showTopBar = false,
)
},
// TabContent(PaymentsScreenContents.SEND.name) {
// SendMoneyScreen(
// onBackClick = navController::navigateUp,
// navigateToTransferScreen = navController::navigateToTransferScreen,
// navigateToScanQrScreen = navController::navigateToScanQr,
// showTopBar = false,
// )
// },
TabContent(PaymentsScreenContents.REQUEST.name) {
RequestScreen(
showQr = navController::navigateToShowQrScreen,
)
},
TabContent(PaymentsScreenContents.HISTORY.name) {
HistoryScreen(
viewTransferDetail = navController::navigateToTransactionDetail,
showTopBar = false,
)
},
TabContent(PaymentsScreenContents.SI.name) {
StandingInstructionsScreen(
onAddEditSI = navController::navigateToSIAddEdit,
onShowSIDetails = navController::navigateSIDetails,
)
},
TabContent(PaymentsScreenContents.INVOICES.name) {
InvoiceScreen(
navigateToInvoiceDetailScreen = navController::navigateToInvoiceDetail,
)
},
// TabContent(PaymentsScreenContents.HISTORY.name) {
// HistoryScreen(
// viewTransferDetail = navController::navigateToTransactionDetail,
// showTopBar = false,
// )
// },
// TabContent(PaymentsScreenContents.SI.name) {
// StandingInstructionsScreen(
// onAddEditSI = navController::navigateToSIAddEdit,
// onShowSIDetails = navController::navigateSIDetails,
// )
// },
// TabContent(PaymentsScreenContents.INVOICES.name) {
// InvoiceScreen(
// navigateToInvoiceDetailScreen = navController::navigateToInvoiceDetail,
// )
// },
)
// TODO Cards and Merchants are not using self api
val tabContents = listOf(
TabContent(FinanceScreenContents.ACCOUNTS.name) {
AccountsScreen(
@ -133,22 +121,22 @@ internal fun MifosNavHost(
onAddOrEditBeneficiary = navController::navigateToBeneficiaryAddEdit,
)
},
TabContent(FinanceScreenContents.CARDS.name) {
CardsScreen(
navigateToViewDetail = navController::navigateToCardDetails,
navigateToAddEdit = navController::navigateToCardAddEdit,
)
},
TabContent(FinanceScreenContents.MERCHANTS.name) {
MerchantScreen()
},
TabContent(FinanceScreenContents.KYC.name) {
KYCScreen(
onLevel1Clicked = navController::navigateToKYCLevel1,
onLevel2Clicked = navController::navigateToKYCLevel2,
onLevel3Clicked = navController::navigateToKYCLevel3,
)
},
// TabContent(FinanceScreenContents.CARDS.name) {
// CardsScreen(
// navigateToViewDetail = navController::navigateToCardDetails,
// navigateToAddEdit = navController::navigateToCardAddEdit,
// )
// },
// TabContent(FinanceScreenContents.MERCHANTS.name) {
// MerchantScreen()
// },
// TabContent(FinanceScreenContents.KYC.name) {
// KYCScreen(
// onLevel1Clicked = navController::navigateToKYCLevel1,
// onLevel2Clicked = navController::navigateToKYCLevel2,
// onLevel3Clicked = navController::navigateToKYCLevel3,
// )
// },
)
NavHost(

View File

@ -58,7 +58,6 @@ import org.mifospay.core.designsystem.component.MifosNavigationRail
import org.mifospay.core.designsystem.component.MifosNavigationRailItem
import org.mifospay.core.designsystem.icon.MifosIcons
import org.mifospay.core.designsystem.theme.LocalGradientColors
import org.mifospay.feature.notification.navigateToNotification
import org.mifospay.feature.profile.navigation.navigateToEditProfile
import org.mifospay.feature.settings.navigation.navigateToSettings
import org.mifospay.shared.navigation.MifosNavHost
@ -149,9 +148,9 @@ internal fun MifosApp(
onNavigateToEditProfile = {
appState.navController.navigateToEditProfile()
},
onNavigateToNotification = {
appState.navController.navigateToNotification()
},
// onNavigateToNotification = {
// appState.navController.navigateToNotification()
// },
destination = destination,
)
}
@ -166,6 +165,8 @@ internal fun MifosApp(
}
}
// TODO Notification feature is not using self api
// https://venus.mifos.community/fineract-provider/api/v1/notifications/?isRead=true
@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun MifosAppBar(
@ -174,7 +175,7 @@ private fun MifosAppBar(
onNavigateToFaq: () -> Unit,
onNavigateToSettings: () -> Unit,
onNavigateToEditProfile: () -> Unit,
onNavigateToNotification: () -> Unit,
// onNavigateToNotification: () -> Unit,
destination: TopLevelDestination?,
modifier: Modifier = Modifier,
) {
@ -187,10 +188,10 @@ private fun MifosAppBar(
Row(
horizontalArrangement = Arrangement.spacedBy(KptTheme.spacing.xs),
) {
IconBox(
icon = MifosIcons.OutlinedNotifications,
onClick = onNavigateToNotification,
)
// IconBox(
// icon = MifosIcons.OutlinedNotifications,
// onClick = onNavigateToNotification,
// )
IconBox(
icon = MifosIcons.SettingsOutlined,
@ -199,12 +200,12 @@ private fun MifosAppBar(
}
}
TopLevelDestination.PROFILE -> {
IconBox(
icon = MifosIcons.Edit2,
onClick = onNavigateToEditProfile,
)
}
// TopLevelDestination.PROFILE -> {
// IconBox(
// icon = MifosIcons.Edit2,
// onClick = onNavigateToEditProfile,
// )
// }
else -> {}
}

View File

@ -24,6 +24,7 @@ import org.mifospay.core.designsystem.icon.MifosIcons
* can contain one or more screens (based on the window size). Navigation from one screen to the
* next within a single destination will be handled directly in composables.
*/
// TODO Profile is not using self api
internal enum class TopLevelDestination(
val selectedIcon: ImageVector,
val unselectedIcon: ImageVector,

View File

@ -63,7 +63,7 @@ val RepositoryModule = module {
single<Json> { Json { ignoreUnknownKeys = true } }
single<AssetRepository> { AssetRepositoryImpl() }
single<AccountRepository> { AccountRepositoryImpl(get(), get(ioDispatcher)) }
single<AccountRepository> { AccountRepositoryImpl(get(), get(), get(ioDispatcher)) }
single<AuthenticationRepository> {
AuthenticationRepositoryImpl(get(), get(ioDispatcher))
}

View File

@ -27,9 +27,12 @@ import org.mifospay.core.model.savingsaccount.Transaction
import org.mifospay.core.model.savingsaccount.TransferDetail
import org.mifospay.core.model.search.AccountResult
import org.mifospay.core.network.FineractApiManager
import org.mifospay.core.network.SelfServiceApiManager
// TODO use self api for account operations later
class AccountRepositoryImpl(
private val apiManager: FineractApiManager,
private val selfManager: SelfServiceApiManager,
private val ioDispatcher: CoroutineDispatcher,
) : AccountRepository {
@ -37,27 +40,27 @@ class AccountRepositoryImpl(
accountId: Long,
transactionId: Long,
): Flow<DataState<Transaction>> {
return apiManager.accountTransfersApi
return selfManager.accountTransfersApi
.getTransaction(accountId, transactionId)
.map { it.toModel() }
.asDataStateFlow().flowOn(ioDispatcher)
}
override fun getAccountTransfer(transferId: Long): Flow<DataState<TransferDetail>> {
return apiManager.accountTransfersApi
return selfManager.accountTransfersApi
.getAccountTransfer(transferId.toInt())
.asDataStateFlow().flowOn(ioDispatcher)
}
override fun searchAccounts(query: String): Flow<DataState<List<AccountResult>>> {
return apiManager.accountTransfersApi
return selfManager.accountTransfersApi
.searchAccounts(query, "savings")
.catch { DataState.Error(it, null) }
.asDataStateFlow().flowOn(ioDispatcher)
}
override fun getSelfAccounts(clientId: Long): Flow<DataState<List<Account>>> {
return apiManager.clientsApi
return selfManager.clientsApi
.getAccounts(clientId, Constants.SAVINGS)
.map { it.toAccount() }
.asDataStateFlow().flowOn(ioDispatcher)
@ -66,7 +69,7 @@ class AccountRepositoryImpl(
override suspend fun makeTransfer(payload: AccountTransferPayload): DataState<String> {
return try {
withContext(ioDispatcher) {
apiManager.accountTransfersApi.makeTransfer(payload)
selfManager.accountTransfersApi.makeTransfer(payload)
}
DataState.Success("Transaction Successful")

View File

@ -40,7 +40,7 @@ class ClientRepositoryImpl(
}
override fun getClientInfo(clientId: Long): Flow<DataState<Client>> {
return fineractApiManager.clientsApi
return apiManager.clientsApi
.getClient(clientId)
.catch { DataState.Error(it, null) }
.map { DataState.Success(it.toModel()) }
@ -69,7 +69,7 @@ class ClientRepositoryImpl(
}
override fun getClientImage(clientId: Long): Flow<DataState<String>> {
return fineractApiManager.clientsApi
return apiManager.clientsApi
.getClientImage(clientId)
.catch { DataState.Error(it, null) }
.map { DataState.Success(it) }

View File

@ -16,7 +16,7 @@ data class Currency(
val code: String,
val name: String,
val decimalPlaces: Int,
val inMultiplesOf: Int,
val inMultiplesOf: Int? = null,
val displaySymbol: String,
val nameCode: String,
val displayLabel: String,

View File

@ -23,4 +23,6 @@ class SelfServiceApiManager(
val beneficiaryApi by lazy { ktorfitClient.beneficiaryApi }
val thirdPartyTransferApi by lazy { ktorfitClient.thirdPartyTransferApi }
val accountTransfersApi by lazy { ktorfitClient.accountTransfersApi }
}

View File

@ -33,7 +33,7 @@ val NetworkModule = module {
client = httpClient(
config = setupDefaultHttpClient(
baseUrl = BaseURL.selfServiceUrl,
loggableHosts = listOf("venus.mifos.community"),
loggableHosts = listOf("tt.mifos.community"),
),
).config {
install(KtorInterceptor) {
@ -60,11 +60,11 @@ val NetworkModule = module {
)
},
defaultHeaders = mapOf(
"Fineract-Platform-TenantId" to "venus",
"Fineract-Platform-TenantId" to "default",
"Content-Type" to "application/json",
"Accept" to "application/json",
),
loggableHosts = listOf("venus.mifos.community"),
loggableHosts = listOf("tt.mifos.community"),
),
),
)

View File

@ -11,16 +11,16 @@ package org.mifospay.core.network.utils
object BaseURL {
private const val PROTOCOL_HTTPS = "https://"
private const val API_ENDPOINT = "venus.mifos.community"
private const val API_ENDPOINT = "tt.mifos.community"
private const val API_PATH = "/fineract-provider/api/v1/"
// self service url
private const val API_ENDPOINT_SELF = "venus.mifos.community"
private const val API_ENDPOINT_SELF = "tt.mifos.community"
private const val API_PATH_SELF = "/fineract-provider/api/v1/self/"
const val HEADER_TENANT = "Fineract-Platform-TenantId"
const val HEADER_AUTH = "Authorization"
const val DEFAULT = "venus"
const val DEFAULT = "default"
val url: String
get() = PROTOCOL_HTTPS + API_ENDPOINT + API_PATH

View File

@ -25,7 +25,7 @@ class KtorInterceptor(
companion object Plugin : HttpClientPlugin<Config, KtorInterceptor> {
private const val HEADER_TENANT = "Fineract-Platform-TenantId"
private const val HEADER_AUTH = "Authorization"
private const val DEFAULT = "venus"
private const val DEFAULT = "default"
override val key: AttributeKey<KtorInterceptor> = AttributeKey("KtorInterceptor")

View File

@ -33,11 +33,14 @@ internal fun FinanceRoute(
}
}
// TODO Cards not using self apis until then commented it.
// https://venus.mifos.community/fineract-provider/api/v1/datatables/saved_cards/2
// https://venus.mifos.community/fineract-provider/api/v1/datatables/kyc_level1_details/2
enum class FinanceScreenContents {
ACCOUNTS,
CARDS,
MERCHANTS,
KYC,
// CARDS,
// MERCHANTS,
// KYC,
}
@Preview

View File

@ -88,12 +88,14 @@ internal fun TransactionItem(
showLeadingIcon: Boolean = true,
onClick: (Long) -> Unit,
) {
// TODO Disabling this view specific transfer details because of not using self api
Surface(
modifier = modifier,
enabled = transaction.transferId != null,
onClick = {
transaction.transferId?.let { onClick(it) }
},
// onClick = {
// transaction.transferId?.let { onClick(it) }
// },
onClick = { },
color = Color.Transparent,
contentColor = KptTheme.colorScheme.onSurface,
) {

View File

@ -56,12 +56,16 @@ private fun PaymentScreenContent(
}
}
// TODO History, SI, Invoices are not using self api
// https://venus.mifos.community/fineract-provider/api/v1/standinginstructions?clientId=2
// https://venus.mifos.community/fineract-provider/api/v1/datatables/invoice/2
//
enum class PaymentsScreenContents {
SEND,
// SEND,
REQUEST,
HISTORY,
SI,
INVOICES,
// HISTORY,
// SI,
// INVOICES,
}
@Preview

View File

@ -29,7 +29,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import mobile_wallet.feature.profile.generated.resources.Res
import mobile_wallet.feature.profile.generated.resources.feature_profile_link_bank_account
import mobile_wallet.feature.profile.generated.resources.feature_profile_loading
import mobile_wallet.feature.profile.generated.resources.feature_profile_personal_qr_code
import org.jetbrains.compose.resources.stringResource
@ -168,22 +167,23 @@ private fun ProfileScreenContent(
},
)
MifosButton(
modifier = Modifier
.fillMaxWidth()
.height(55.dp),
text = {
Text(
text = stringResource(Res.string.feature_profile_link_bank_account),
)
},
onClick = {
onAction(ProfileAction.NavigateToLinkBankAccount)
},
leadingIcon = {
Icon(imageVector = MifosIcons.AttachMoney, contentDescription = "")
},
)
// TODO uncomment this after migrating to self api to link savings account
// MifosButton(
// modifier = Modifier
// .fillMaxWidth()
// .height(55.dp),
// text = {
// Text(
// text = stringResource(Res.string.feature_profile_link_bank_account),
// )
// },
// onClick = {
// onAction(ProfileAction.NavigateToLinkBankAccount)
// },
// leadingIcon = {
// Icon(imageVector = MifosIcons.AttachMoney, contentDescription = "")
// },
// )
Spacer(modifier = Modifier.height(1.dp))
}

View File

@ -34,7 +34,6 @@ import mobile_wallet.feature.settings.generated.resources.feature_settings_chang
import mobile_wallet.feature.settings.generated.resources.feature_settings_disable_account
import mobile_wallet.feature.settings.generated.resources.feature_settings_faq
import mobile_wallet.feature.settings.generated.resources.feature_settings_log_out
import mobile_wallet.feature.settings.generated.resources.feature_settings_notification_settings
import mobile_wallet.feature.settings.generated.resources.feature_settings_settings
import mobile_wallet.feature.settings.generated.resources.outline_logout
import mobile_wallet.feature.settings.generated.resources.outline_password
@ -111,13 +110,13 @@ private fun SettingsScreenContent(
.verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(KptTheme.spacing.sm),
) {
SettingsCardItem(
title = stringResource(Res.string.feature_settings_notification_settings),
icon = MifosIcons.OutlinedNotifications,
onClick = {
onAction(SettingsAction.NavigateToNotificationSettings)
},
)
// SettingsCardItem(
// title = stringResource(Res.string.feature_settings_notification_settings),
// icon = MifosIcons.OutlinedNotifications,
// onClick = {
// onAction(SettingsAction.NavigateToNotificationSettings)
// },
// )
SettingsCardItem(
title = stringResource(Res.string.feature_settings_faq),