From b752277fe5efba09a6d16599adaf4f95cb902c88 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 17 Oct 2022 13:26:34 -0300 Subject: adding summary to the invoice description --- wallet/src/main/java/net/taler/wallet/peer/OutgoingPullFragment.kt | 4 ++-- .../main/java/net/taler/wallet/peer/OutgoingPullIntroComposable.kt | 6 +++--- wallet/src/main/java/net/taler/wallet/peer/PeerManager.kt | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'wallet') diff --git a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullFragment.kt b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullFragment.kt index b1593ff..24bedc4 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullFragment.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullFragment.kt @@ -80,7 +80,7 @@ class OutgoingPullFragment : Fragment() { if (!requireActivity().isChangingConfigurations) peerManager.resetPullPayment() } - private fun onCreateInvoice(amount: Amount, exchange: ExchangeItem) { - peerManager.initiatePullPayment(amount, exchange) + private fun onCreateInvoice(amount: Amount, summary: String, exchange: ExchangeItem) { + peerManager.initiatePullPayment(amount, summary, exchange) } } diff --git a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullIntroComposable.kt b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullIntroComposable.kt index a338836..d2091ee 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullIntroComposable.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/OutgoingPullIntroComposable.kt @@ -53,7 +53,7 @@ import net.taler.wallet.exchanges.ExchangeItem fun OutgoingPullIntroComposable( amount: Amount, exchangeState: State, - onCreateInvoice: (amount: Amount, exchange: ExchangeItem) -> Unit, + onCreateInvoice: (amount: Amount, subject: String, exchange: ExchangeItem) -> Unit, ) { val scrollState = rememberScrollState() Column( @@ -109,7 +109,7 @@ fun OutgoingPullIntroComposable( modifier = Modifier.padding(16.dp), enabled = subject.isNotBlank() && exchangeItem != null, onClick = { - onCreateInvoice(amount, exchangeItem ?: error("clickable without exchange")) + onCreateInvoice(amount, subject, exchangeItem ?: error("clickable without exchange")) }, ) { Text(text = stringResource(R.string.receive_peer_create_button)) @@ -124,6 +124,6 @@ fun PreviewReceiveFundsIntro() { @SuppressLint("UnrememberedMutableState") val exchangeFlow = mutableStateOf(ExchangeItem("https://example.org", "TESTKUDOS", emptyList())) - OutgoingPullIntroComposable(Amount.fromDouble("TESTKUDOS", 42.23), exchangeFlow) { _, _ -> } + OutgoingPullIntroComposable(Amount.fromDouble("TESTKUDOS", 42.23), exchangeFlow) { _, _, _ -> } } } diff --git a/wallet/src/main/java/net/taler/wallet/peer/PeerManager.kt b/wallet/src/main/java/net/taler/wallet/peer/PeerManager.kt index b02b2b6..1e53e7c 100644 --- a/wallet/src/main/java/net/taler/wallet/peer/PeerManager.kt +++ b/wallet/src/main/java/net/taler/wallet/peer/PeerManager.kt @@ -46,14 +46,14 @@ class PeerManager( private val _incomingPushState = MutableStateFlow(IncomingChecking) val incomingPushState: StateFlow = _incomingPushState - fun initiatePullPayment(amount: Amount, exchange: ExchangeItem) { + fun initiatePullPayment(amount: Amount, summary: String, exchange: ExchangeItem) { _outgoingPullState.value = OutgoingCreating scope.launch(Dispatchers.IO) { api.request("initiatePeerPullPayment", InitiatePeerPullPaymentResponse.serializer()) { put("exchangeBaseUrl", exchange.exchangeBaseUrl) put("amount", amount.toJSONString()) put("partialContractTerms", JSONObject().apply { - put("summary", "test") + put("summary", summary) }) }.onSuccess { val qrCode = QrCodeManager.makeQrCode(it.talerUri) -- cgit v1.2.3