gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libeufin] branch master updated: SPA + amount fix on manual wire transf


From: gnunet
Subject: [libeufin] branch master updated: SPA + amount fix on manual wire transfers.
Date: Wed, 07 Sep 2022 16:23:58 +0200

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 5e4224bd SPA + amount fix on manual wire transfers.
5e4224bd is described below

commit 5e4224bd7282fa8289f86db7044bf07345c71e37
Author: MS <ms@taler.net>
AuthorDate: Wed Sep 7 16:23:01 2022 +0200

    SPA + amount fix on manual wire transfers.
---
 sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 16 +++++++---------
 sandbox/src/main/resources/static/spa.html            |  4 ++--
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 7256684b..498e7512 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -1209,16 +1209,14 @@ val sandboxApp: Application.() -> Unit = {
                     val payto = parsePayto(req.paytoUri)
                     val amount: String? = payto.amount ?: req.amount
                     if (amount == null) throw badRequest("Amount is missing")
+                    val amountParsed = parseAmountAsString(amount)
                     /**
-                     * Need a transaction block only to let the
-                     * 'demoBank' field of 'bankAccount' accessed.
-                     *
-                     * This could be fixed by making 'getBankAccountWithAuth()'
-                     * return a pair, consisting of the bank account and the 
demobank
-                     * hosting it.
-                     */
-                    if (!validatePlainAmount(amount)) throw 
badRequest("Invalid amount: $amount")
+                     * The transaction block below lets the 'demoBank' field
+                     * of 'bankAccount' be correctly accessed.  */
                     transaction {
+                        if ((amountParsed.second != null)
+                            && (bankAccount.demoBank.currency != 
amountParsed.second))
+                            throw badRequest("Currency 
'${amountParsed.second}' is wrong")
                         wireTransfer(
                             debitAccount = bankAccount,
                             creditAccount = getBankAccountFromIban(payto.iban),
@@ -1226,7 +1224,7 @@ val sandboxApp: Application.() -> Unit = {
                             subject = payto.message ?: throw badRequest(
                                 "'message' query parameter missing in Payto 
address"
                             ),
-                            amount = amount
+                            amount = amountParsed.first
                         )
                     }
                     call.respond(object {})
diff --git a/sandbox/src/main/resources/static/spa.html 
b/sandbox/src/main/resources/static/spa.html
index bab309b3..b181fa03 100644
--- a/sandbox/src/main/resources/static/spa.html
+++ b/sandbox/src/main/resources/static/spa.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html><html lang="en" class="has-aside-left 
has-aside-mobile-transition has-navbar-fixed-top 
has-aside-expanded"><head><meta charset="utf-8"><title>taler-bank</title><meta 
name="viewport" content="width=device-width,initial-scale=1"><meta 
name="mobile-web-app-capable" content="yes"><meta 
name="apple-mobile-web-app-capable" content="yes"><link rel="icon" 
href="data:;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAAD/////////////////////////
 [...]
+<!DOCTYPE html><html lang="en" class="has-aside-left 
has-aside-mobile-transition has-navbar-fixed-top 
has-aside-expanded"><head><meta charset="utf-8"><title>taler-bank</title><meta 
name="viewport" content="width=device-width,initial-scale=1"><meta 
name="mobile-web-app-capable" content="yes"><meta 
name="apple-mobile-web-app-capable" content="yes"><link rel="icon" 
href="data:;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAABILAAASCwAAAAAAAAAAAAD/////////////////////////
 [...]
 Pure v0.6.2
 Copyright 2013 Yahoo!
 Licensed under the BSD License.
@@ -6,4 +6,4 @@ https://github.com/yahoo/pure/blob/master/LICENSE.md
 *//*!
 normalize.css v^3.0 | MIT License | git.io/normalize
 Copyright (c) Nicolas Gallagher and Jonathan Neal
-*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css 
*/html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[
 [...]
\ No newline at end of file
+*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css 
*/html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[
 [...]
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]