summaryrefslogtreecommitdiff
path: root/wallet/src/main/java/net/taler/wallet/refund
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2023-07-11 14:06:51 -0300
committerTorsten Grote <t@grobox.de>2023-07-11 14:06:51 -0300
commitc4ee1c719d2b31e59be6788d7b2ccec95d39548a (patch)
tree4e7b4647d7742c335f1b041cfcd048717c1b2bff /wallet/src/main/java/net/taler/wallet/refund
parent469360fb851236e4773a020b0938eca591d4f5f6 (diff)
downloadtaler-android-c4ee1c719d2b31e59be6788d7b2ccec95d39548a.tar.gz
taler-android-c4ee1c719d2b31e59be6788d7b2ccec95d39548a.tar.bz2
taler-android-c4ee1c719d2b31e59be6788d7b2ccec95d39548a.zip
[wallet] fix refund transaction after API change
Diffstat (limited to 'wallet/src/main/java/net/taler/wallet/refund')
-rw-r--r--wallet/src/main/java/net/taler/wallet/refund/RefundPaymentInfo.kt39
-rw-r--r--wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt22
2 files changed, 47 insertions, 14 deletions
diff --git a/wallet/src/main/java/net/taler/wallet/refund/RefundPaymentInfo.kt b/wallet/src/main/java/net/taler/wallet/refund/RefundPaymentInfo.kt
new file mode 100644
index 0000000..d5f59be
--- /dev/null
+++ b/wallet/src/main/java/net/taler/wallet/refund/RefundPaymentInfo.kt
@@ -0,0 +1,39 @@
+/*
+ * This file is part of GNU Taler
+ * (C) 2023 Taler Systems S.A.
+ *
+ * GNU Taler is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 3, or (at your option) any later version.
+ *
+ * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+ * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
+ */
+
+package net.taler.wallet.refund
+
+import kotlinx.serialization.SerialName
+import kotlinx.serialization.Serializable
+
+@Serializable
+class RefundPaymentInfo(
+ val summary: String,
+ @SerialName("summary_i18n")
+ val summaryI18n: Map<String, String>? = null,
+ /**
+ * More information about the merchant
+ */
+ val merchant: MerchantInfo,
+)
+
+@Serializable
+class MerchantInfo(
+ val name: String,
+ val logo: String? = null,
+ val website: String? = null,
+ val email: String? = null,
+)
diff --git a/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt b/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt
index 9dc6267..ac5e2da 100644
--- a/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt
+++ b/wallet/src/main/java/net/taler/wallet/refund/TransactionRefundComposable.kt
@@ -31,14 +31,12 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import net.taler.common.Amount
-import net.taler.common.ContractMerchant
import net.taler.common.Timestamp
import net.taler.common.toAbsoluteTime
import net.taler.wallet.R
import net.taler.wallet.backend.TalerErrorCode
import net.taler.wallet.backend.TalerErrorInfo
import net.taler.wallet.compose.TalerSurface
-import net.taler.wallet.payment.PurchaseDetails
import net.taler.wallet.transactions.AmountType
import net.taler.wallet.transactions.ErrorTransactionButton
import net.taler.wallet.transactions.TransactionAction
@@ -46,7 +44,7 @@ import net.taler.wallet.transactions.TransactionAction.Abort
import net.taler.wallet.transactions.TransactionAction.Retry
import net.taler.wallet.transactions.TransactionAction.Suspend
import net.taler.wallet.transactions.TransactionAmountComposable
-import net.taler.wallet.transactions.TransactionInfo
+import net.taler.wallet.transactions.TransactionInfoComposable
import net.taler.wallet.transactions.TransactionMajorState.Pending
import net.taler.wallet.transactions.TransactionRefund
import net.taler.wallet.transactions.TransactionState
@@ -56,7 +54,6 @@ import net.taler.wallet.transactions.TransitionsComposable
fun TransactionRefundComposable(
t: TransactionRefund,
devMode: Boolean,
- onFulfill: (url: String) -> Unit,
onTransition: (t: TransactionAction) -> Unit,
) {
val scrollState = rememberScrollState()
@@ -87,9 +84,10 @@ fun TransactionRefundComposable(
amount = t.amountRaw - t.amountEffective,
amountType = AmountType.Negative,
)
- PurchaseDetails(info = t.info) {
- onFulfill(t.info.fulfillmentUrl ?: "")
- }
+ TransactionInfoComposable(
+ label = stringResource(id = R.string.transaction_order),
+ info = t.paymentInfo?.summary ?: "",
+ )
TransitionsComposable(t, devMode, onTransition)
if (devMode && t.error != null) {
ErrorTransactionButton(error = t.error)
@@ -105,13 +103,9 @@ fun TransactionRefundComposablePreview() {
timestamp = Timestamp.fromMillis(System.currentTimeMillis() - 360 * 60 * 1000),
txState = TransactionState(Pending),
txActions = listOf(Retry, Suspend, Abort),
- info = TransactionInfo(
- orderId = "123",
- merchant = ContractMerchant(name = "Taler"),
+ paymentInfo = RefundPaymentInfo(
+ merchant = MerchantInfo(name = "Taler"),
summary = "Some Product that was bought and can have quite a long label",
- fulfillmentMessage = "This is some fulfillment message",
- fulfillmentUrl = "https://bank.demo.taler.net/",
- products = listOf(),
),
refundedTransactionId = "transactionId",
amountRaw = Amount.fromString("TESTKUDOS", "42.23"),
@@ -119,6 +113,6 @@ fun TransactionRefundComposablePreview() {
error = TalerErrorInfo(code = TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED),
)
TalerSurface {
- TransactionRefundComposable(t = t, devMode = true, onFulfill = {}) {}
+ TransactionRefundComposable(t = t, devMode = true) {}
}
}