gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Give IBAN upon registration.


From: gnunet
Subject: [libeufin] branch master updated: Give IBAN upon registration.
Date: Tue, 19 Oct 2021 11:11:03 +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 50fa9ee  Give IBAN upon registration.
50fa9ee is described below

commit 50fa9ee62b22b32252885e20e7d38255caf09593
Author: ms <ms@taler.net>
AuthorDate: Tue Oct 19 11:11:00 2021 +0200

    Give IBAN upon registration.
---
 sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt   |  2 ++
 sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt |  3 ++-
 util/src/main/kotlin/iban.kt                          | 11 +++++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index 7a48531..4186087 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -117,6 +117,7 @@ object DemobankCustomersTable : LongIdTable() {
     val passwordHash = text("passwordHash")
     val isDebit = bool("isDebit").default(false)
     val name = text("name").nullable()
+    val iban = text("iban")
 }
 
 class DemobankCustomerEntity(id: EntityID<Long>) : LongEntity(id) {
@@ -128,6 +129,7 @@ class DemobankCustomerEntity(id: EntityID<Long>) : 
LongEntity(id) {
     var passwordHash by DemobankCustomersTable.passwordHash
     var isDebit by DemobankCustomersTable.isDebit
     var name by DemobankCustomersTable.name
+    var iban by DemobankCustomersTable.iban
 }
 
 /**
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt 
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 7e3f119..fc53da8 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -1120,7 +1120,7 @@ val sandboxApp: Application.() -> Unit = {
                                 CustomerInfo(
                                     username = it.username,
                                     balance = it.balance,
-                                    iban = "To Do",
+                                    iban = it.iban,
                                     name = it.name ?: throw 
internalServerError(
                                         "Found name-less public account, 
username: ${it.username}"
                                     )
@@ -1160,6 +1160,7 @@ val sandboxApp: Application.() -> Unit = {
                             username = req.username
                             passwordHash = CryptoUtil.hashpw(req.password)
                             demobankConfig = demobank.id
+                            iban = getIban()
                         }
                     }
                     call.respondText("Registration successful")
diff --git a/util/src/main/kotlin/iban.kt b/util/src/main/kotlin/iban.kt
new file mode 100644
index 0000000..4b8055d
--- /dev/null
+++ b/util/src/main/kotlin/iban.kt
@@ -0,0 +1,11 @@
+package tech.libeufin.util
+
+fun getIban(): String {
+    val bankCode = "00000000" // 8 digits
+    val accountCodeChars = ('0'..'9')
+    // 10 digits
+    val accountCode = (0..9).map {
+        accountCodeChars.random()
+    }.joinToString("")
+    return "EU00" + bankCode + accountCode
+}
\ 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]