gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: provide ex-nullable value in facade


From: gnunet
Subject: [libeufin] branch master updated: provide ex-nullable value in facade
Date: Fri, 05 Feb 2021 15:40:03 +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 5901700  provide ex-nullable value in facade
5901700 is described below

commit 59017006aa0000cced57077a89ff5d79bd67e1a0
Author: MS <ms@taler.net>
AuthorDate: Fri Feb 5 15:39:10 2021 +0100

    provide ex-nullable value in facade
---
 nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt       | 8 +++-----
 sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt | 9 ---------
 util/src/main/kotlin/strings.kt                          | 7 +++++++
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
index 91295e1..ec50424 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
@@ -42,10 +42,7 @@ import org.jetbrains.exposed.sql.transactions.transaction
 import tech.libeufin.nexus.bankaccount.addPaymentInitiation
 import tech.libeufin.nexus.iso20022.*
 import tech.libeufin.nexus.server.*
-import tech.libeufin.util.CryptoUtil
-import tech.libeufin.util.EbicsProtocolError
-import tech.libeufin.util.parseAmount
-import tech.libeufin.util.parsePayto
+import tech.libeufin.util.*
 import kotlin.math.abs
 import kotlin.math.min
 
@@ -327,7 +324,8 @@ private suspend fun talerAddIncoming(call: ApplicationCall, 
httpClient: HttpClie
                 "amount": "${parsedAmount.amount}",
                 "currency": "${parsedAmount.currency}",
                 "direction": "CRDT",
-                "subject": "${addIncomingData.reserve_pub}"
+                "subject": "${addIncomingData.reserve_pub}",
+                "uid": ${getRandomString(8)}
             }""".trimIndent()
             contentType(ContentType.Application.Json)
         }
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
index 8fcb273..bc9c908 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
@@ -82,13 +82,4 @@ fun getEbicsSubscriberFromDetails(userID: String, partnerID: 
String, hostID: Str
             "Ebics subscriber not found"
         )
     }
-}
-
-fun getRandomString(length: Int) : String {
-    val allowedChars = ('A'..'Z') + ('0'..'9')
-    val ret = (1..length)
-        .map { allowedChars.random() }
-        .joinToString("")
-    SandboxAssert(ret.length == length, "Unexpected random string")
-    return ret
 }
\ No newline at end of file
diff --git a/util/src/main/kotlin/strings.kt b/util/src/main/kotlin/strings.kt
index 2765762..30e502b 100644
--- a/util/src/main/kotlin/strings.kt
+++ b/util/src/main/kotlin/strings.kt
@@ -101,4 +101,11 @@ fun parseAmount(amount: String): AmountWithCurrency {
     EbicsProtocolError(HttpStatusCode.BadRequest, "invalid amount: $amount")
     val (currency, number) = match.destructured
     return AmountWithCurrency(currency, Amount(number))
+}
+
+fun getRandomString(length: Int) : String {
+    val allowedChars = ('A'..'Z') + ('0'..'9')
+    return (1..length)
+        .map { allowedChars.random() }
+        .joinToString("")
 }
\ 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]