diff options
Diffstat (limited to 'wallet/src/main/java/net/taler/wallet/peer')
4 files changed, 25 insertions, 21 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt index 898ff69..3b15b6f 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullCredit.kt @@ -22,6 +22,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import net.taler.common.Amount +import net.taler.common.CurrencySpecification import net.taler.common.Timestamp import net.taler.wallet.R import net.taler.wallet.backend.TalerErrorCode.EXCHANGE_GENERIC_KYC_REQUIRED @@ -41,7 +42,7 @@ import net.taler.wallet.transactions.TransactionPeerPullCredit import net.taler.wallet.transactions.TransactionState @Composable -fun ColumnScope.TransactionPeerPullCreditComposable(t: TransactionPeerPullCredit) { +fun ColumnScope.TransactionPeerPullCreditComposable(t: TransactionPeerPullCredit, spec: CurrencySpecification?) { if (t.error == null) PeerQrCode( state = t.txState, talerUri = t.talerUri, @@ -49,7 +50,7 @@ fun ColumnScope.TransactionPeerPullCreditComposable(t: TransactionPeerPullCredit TransactionAmountComposable( label = stringResource(id = R.string.receive_peer_amount_invoiced), - amount = t.amountRaw, + amount = t.amountRaw.withSpec(spec), amountType = AmountType.Neutral, ) @@ -57,14 +58,14 @@ fun ColumnScope.TransactionPeerPullCreditComposable(t: TransactionPeerPullCredit if (!fee.isZero()) { TransactionAmountComposable( label = stringResource(id = R.string.withdraw_fees), - amount = fee, + amount = fee.withSpec(spec), amountType = AmountType.Negative, ) } TransactionAmountComposable( label = stringResource(id = R.string.amount_received), - amount = t.amountEffective, + amount = t.amountEffective.withSpec(spec), amountType = AmountType.Positive, ) @@ -93,7 +94,7 @@ fun TransactionPeerPullCreditPreview(loading: Boolean = false) { error = TalerErrorInfo(code = EXCHANGE_GENERIC_KYC_REQUIRED), ) Surface { - TransactionPeerComposable(t, true) {} + TransactionPeerComposable(t, true, null) {} } } diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt index 783907e..dadff4a 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPullDebit.kt @@ -21,6 +21,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import net.taler.common.Amount +import net.taler.common.CurrencySpecification import net.taler.common.Timestamp import net.taler.wallet.R import net.taler.wallet.backend.TalerErrorCode.EXCHANGE_GENERIC_KYC_REQUIRED @@ -38,25 +39,25 @@ import net.taler.wallet.transactions.TransactionPeerPullDebit import net.taler.wallet.transactions.TransactionState @Composable -fun TransactionPeerPullDebitComposable(t: TransactionPeerPullDebit) { +fun TransactionPeerPullDebitComposable(t: TransactionPeerPullDebit, spec: CurrencySpecification?) { TransactionAmountComposable( label = stringResource(id = R.string.transaction_order_total), - amount = t.amountRaw, + amount = t.amountRaw.withSpec(spec), amountType = AmountType.Neutral, ) - + val fee = t.amountEffective - t.amountRaw if (!fee.isZero()) { TransactionAmountComposable( label = stringResource(id = R.string.withdraw_fees), - amount = fee, + amount = fee.withSpec(spec), amountType = AmountType.Negative, ) } TransactionAmountComposable( label = stringResource(id = R.string.transaction_paid), - amount = t.amountEffective, + amount = t.amountEffective.withSpec(spec), amountType = AmountType.Negative, ) @@ -84,6 +85,6 @@ fun TransactionPeerPullDebitPreview() { error = TalerErrorInfo(code = EXCHANGE_GENERIC_KYC_REQUIRED), ) Surface { - TransactionPeerComposable(t, true) {} + TransactionPeerComposable(t, true, null) {} } } diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt index 75d299b..dbf0fb9 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushCredit.kt @@ -21,6 +21,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import net.taler.common.Amount +import net.taler.common.CurrencySpecification import net.taler.common.Timestamp import net.taler.wallet.R import net.taler.wallet.backend.TalerErrorCode.EXCHANGE_GENERIC_KYC_REQUIRED @@ -38,10 +39,10 @@ import net.taler.wallet.transactions.TransactionPeerPushCredit import net.taler.wallet.transactions.TransactionState @Composable -fun TransactionPeerPushCreditComposable(t: TransactionPeerPushCredit) { +fun TransactionPeerPushCreditComposable(t: TransactionPeerPushCredit, spec: CurrencySpecification?) { TransactionAmountComposable( label = stringResource(id = R.string.amount_sent), - amount = t.amountRaw, + amount = t.amountRaw.withSpec(spec), amountType = AmountType.Neutral, ) @@ -49,14 +50,14 @@ fun TransactionPeerPushCreditComposable(t: TransactionPeerPushCredit) { if (!fee.isZero()) { TransactionAmountComposable( label = stringResource(id = R.string.withdraw_fees), - amount = fee, + amount = fee.withSpec(spec), amountType = AmountType.Negative, ) } TransactionAmountComposable( label = stringResource(id = R.string.amount_received), - amount = t.amountEffective, + amount = t.amountEffective.withSpec(spec), amountType = AmountType.Positive, ) @@ -84,6 +85,6 @@ fun TransactionPeerPushCreditPreview() { error = TalerErrorInfo(code = EXCHANGE_GENERIC_KYC_REQUIRED), ) Surface { - TransactionPeerComposable(t, true) {} + TransactionPeerComposable(t, true, null) {} } } diff --git a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt index 909fd47..e592c3e 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/TransactionPeerPushDebit.kt @@ -30,6 +30,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import net.taler.common.Amount +import net.taler.common.CurrencySpecification import net.taler.common.Timestamp import net.taler.wallet.R import net.taler.wallet.backend.TalerErrorCode.EXCHANGE_GENERIC_KYC_REQUIRED @@ -52,7 +53,7 @@ import net.taler.wallet.transactions.TransactionPeerPushDebit import net.taler.wallet.transactions.TransactionState @Composable -fun ColumnScope.TransactionPeerPushDebitComposable(t: TransactionPeerPushDebit) { +fun ColumnScope.TransactionPeerPushDebitComposable(t: TransactionPeerPushDebit, spec: CurrencySpecification?) { if (t.error == null) PeerQrCode( state = t.txState, talerUri = t.talerUri, @@ -60,7 +61,7 @@ fun ColumnScope.TransactionPeerPushDebitComposable(t: TransactionPeerPushDebit) TransactionAmountComposable( label = stringResource(id = R.string.transaction_order_total), - amount = t.amountRaw, + amount = t.amountRaw.withSpec(spec), amountType = AmountType.Neutral, ) @@ -68,14 +69,14 @@ fun ColumnScope.TransactionPeerPushDebitComposable(t: TransactionPeerPushDebit) if (!fee.isZero()) { TransactionAmountComposable( label = stringResource(id = R.string.withdraw_fees), - amount = fee, + amount = fee.withSpec(spec), amountType = AmountType.Negative, ) } TransactionAmountComposable( label = stringResource(id = R.string.transaction_paid), - amount = t.amountEffective, + amount = t.amountEffective.withSpec(spec), amountType = AmountType.Negative, ) @@ -140,7 +141,7 @@ fun TransactionPeerPushDebitPreview(loading: Boolean = false) { ) TalerSurface { - TransactionPeerComposable(t, true) {} + TransactionPeerComposable(t, true, null) {} } } |