[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: take amount from payto
From: |
gnunet |
Subject: |
[libeufin] branch master updated: take amount from payto |
Date: |
Mon, 31 Jan 2022 08:35:11 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 9eebaf45 take amount from payto
9eebaf45 is described below
commit 9eebaf45dea4c460bc4ec2c94b3252f76a6df5e7
Author: ms <ms@taler.net>
AuthorDate: Mon Jan 31 08:35:04 2022 +0100
take amount from payto
---
sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt | 2 +-
sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
index 02d61048..67eac25b 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
@@ -134,5 +134,5 @@ data class NewTransactionReq(
*/
val paytoUri: String,
// $currency:X.Y format
- val amount: String
+ val amount: String?
)
\ No newline at end of file
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 32f10a47..0520ac10 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -1097,7 +1097,8 @@ val sandboxApp: Application.() -> Unit = {
val bankAccount = getBankAccountWithAuth(call)
val req = call.receive<NewTransactionReq>()
val payto = parsePayto(req.paytoUri)
- val amount = parseAmount(req.amount)
+ val amount: String? = payto.amount ?: req.amount
+ if (amount == null) throw badRequest("Amount is missing")
/**
* Need a transaction block only to let the
* 'demoBank' field of 'bankAccount' accessed.
@@ -1114,7 +1115,7 @@ val sandboxApp: Application.() -> Unit = {
subject = payto.message ?: throw badRequest(
"'message' query parameter missing in Payto
address"
),
- amount = amount.amount.toPlainString()
+ amount = parseAmount(amount).amount.toPlainString()
)
}
call.respond(object {})
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: take amount from payto,
gnunet <=