Skip to content

Commit

Permalink
Fix invoice api (openMF#1797)
Browse files Browse the repository at this point in the history
* Redesign requeset screen UI

* fix MissingKoinDefinitionException

* removed comments and fixed share qr code bug

* fix: Invoice APIs
  • Loading branch information
Nagarjuna0033 authored and niyajali committed Nov 6, 2024
1 parent 3d32980 commit d582fa2
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.material3.OutlinedIconButton
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import org.jetbrains.compose.ui.tooling.preview.Preview
Expand All @@ -28,17 +29,26 @@ fun IconBox(
icon: ImageVector,
onClick: () -> Unit,
modifier: Modifier = Modifier,
tint: Color? = null,
) {
OutlinedIconButton(
onClick = onClick,
modifier = modifier,
shape = RoundedCornerShape(12.dp),
border = BorderStroke(2.dp, MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f)),
) {
Icon(
imageVector = icon,
contentDescription = icon.name,
)
if (tint != null) {
Icon(
imageVector = icon,
contentDescription = icon.name,
tint = tint,
)
} else {
Icon(
imageVector = icon,
contentDescription = icon.name,
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@ fun MifosTopBar(
backPress: () -> Unit,
modifier: Modifier = Modifier,
actions: @Composable RowScope.() -> Unit = {},
titleColor: Color? = null,
iconTint: Color? = null,
) {
CenterAlignedTopAppBar(
title = {
Text(
text = topBarTitle,
style = MaterialTheme.typography.titleMedium,
color = titleColor ?: MaterialTheme.colorScheme.onSurface,
)
},
navigationIcon = {
IconBox(
icon = MifosIcons.ArrowBack2,
onClick = backPress,
tint = iconTint,
)
},
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.entity.invoice

import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.parcelize.Parcelize

@Parcelize
data class Invoice(
val id: Long,
@SerializedName("client_id")
val clientId: Long,
val consumerId: String,
val consumerName: String,
val amount: Double,
@SerializedName("itemsbought")
val itemsBought: String,
val status: Long,
val transactionId: String,
val invoiceId: Long,
val title: String,
val date: String,
@SerializedName("created_at")
val createdAt: List<Long>,
@SerializedName("updated_at")
val updatedAt: List<Long>,
) : Parcelable
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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-wallet/blob/master/LICENSE.md
*/
package com.mifospay.core.model.entity.invoice

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class InvoiceEntity(
val id: Long,
val invoiceId: Long,
val consumerId: String,
val consumerName: String,
val amount: Double,
@SerialName("itemsbought")
val itemsBought: String,
val status: Long,
val transactionId: String,
val title: String,
val date: String,
val locale: String,
val dateFormat: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
*/
package org.mifospay.feature.invoices.di

import androidx.lifecycle.SavedStateHandle
import org.koin.core.module.dsl.viewModel
import org.koin.dsl.module
import org.mifospay.feature.invoices.InvoiceDetailViewModel
import org.mifospay.feature.invoices.InvoicesViewModel

val InvoicesModule = module {

viewModel {
viewModel { (savedStateHandle: SavedStateHandle) ->
InvoiceDetailViewModel(
mUseCaseHandler = get(),
mPreferencesHelper = get(),
fetchInvoiceUseCase = get(),
savedStateHandle = get(),
savedStateHandle = savedStateHandle,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<string name="feature_request_money_enter_valid_amount">Please enter a valid amount</string>
<string name="feature_request_money_enter_currency">Enter Currency</string>
<string name="feature_request_money_set_amount">Set Amount</string>
<string name="feature_request_money_title">Mifos Pay</string>
<string name="feature_request_money_share">Share</string>
<string name="feature_request_money_currency">Set Currency</string>
<string name="feature_request_money_cancel">Cancel</string>
<string name="feature_request_money_confirm">Confirm</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
*/
package org.mifospay.feature.request.money.di

import org.koin.android.ext.koin.androidContext
import org.koin.core.module.dsl.viewModel
import org.koin.dsl.module
import org.mifospay.feature.request.money.GenerateQr
import org.mifospay.feature.request.money.ShowQrViewModel

val RequestMoneyModule = module {
single {
GenerateQr()
GenerateQr(context = androidContext())
}

viewModel {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mifospay/src/test/java/org/mifospay/KoinModulesCheck.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class KoinModulesCheck : AutoCloseKoinTest() {
SelfServiceApiManager::class,
KtorAuthenticationService::class,
SavedStateHandle::class,
Context::class,
),
)
koinModules.coreDataStoreModules.verify(
Expand Down

0 comments on commit d582fa2

Please sign in to comment.