gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Not allowing multiple bank account wit


From: gnunet
Subject: [libeufin] branch master updated: Not allowing multiple bank account with same id.
Date: Thu, 13 Feb 2020 18:29:10 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository libeufin.

The following commit(s) were added to refs/heads/master by this push:
     new a9b19b4  Not allowing multiple bank account with same id.
a9b19b4 is described below

commit a9b19b40109ff361498439025780f105ccecaaf5
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Feb 13 18:28:22 2020 +0100

    Not allowing multiple bank account with same id.
---
 nexus/src/main/kotlin/tech/libeufin/nexus/Db.kt   | 9 ++++-----
 nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt | 7 +++----
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Db.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Db.kt
index e49f8ef..e28a3b7 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Db.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Db.kt
@@ -56,17 +56,16 @@ const val ID_MAX_LENGTH = 50
 //
 //}
 
-object EbicsAccountsInfoTable : IntIdTable() {
-    val accountId = text("accountId")
+object EbicsAccountsInfoTable : IdTable<String>() {
+    override val id = varchar("id", ID_MAX_LENGTH).entityId().primaryKey()
     val subscriber = reference("subscriber", EbicsSubscribersTable)
     val accountHolder = text("accountHolder").nullable()
     val iban = text("iban")
     val bankCode = text("bankCode")
 }
 
-class EbicsAccountInfoEntity(id: EntityID<Int>) : IntEntity(id) {
-    companion object : 
IntEntityClass<EbicsAccountInfoEntity>(EbicsAccountsInfoTable)
-    var accountId by EbicsAccountsInfoTable.accountId
+class EbicsAccountInfoEntity(id: EntityID<String>) : Entity<String>(id) {
+    companion object : EntityClass<String, 
EbicsAccountInfoEntity>(EbicsAccountsInfoTable)
     var subscriber by EbicsSubscriberEntity referencedOn 
EbicsAccountsInfoTable.subscriber
     var accountHolder by EbicsAccountsInfoTable.accountHolder
     var iban by EbicsAccountsInfoTable.iban
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 4f89c10..94b13dd 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -112,7 +112,7 @@ fun getSubscriberEntityFromId(id: String): 
EbicsSubscriberEntity {
 fun getBankAccountDetailsFromAcctid(id: String): EbicsAccountInfoElement {
     return transaction {
         val bankAccount = EbicsAccountInfoEntity.find {
-            EbicsAccountsInfoTable.accountId eq id
+            EbicsAccountsInfoTable.id eq id
         }.firstOrNull() ?: throw 
BankAccountNotFoundError(HttpStatusCode.NotFound)
         EbicsAccountInfoElement(
             accountId = id,
@@ -329,7 +329,7 @@ fun main() {
                                 accountHolderName = it.accountHolder,
                                 iban = it.iban,
                                 bankCode = it.bankCode,
-                                accountId = it.accountId
+                                accountId = it.id.value
                             )
                         )
                     }
@@ -964,9 +964,8 @@ fun main() {
                         val payload = 
XMLUtil.convertStringToJaxb<HTDResponseOrderData>(response.orderData.toString(Charsets.UTF_8))
                         transaction {
                             payload.value.partnerInfo.accountInfoList?.forEach 
{
-                                EbicsAccountInfoEntity.new {
+                                EbicsAccountInfoEntity.new(id = it.id) {
                                     this.subscriber = 
getSubscriberEntityFromId(customerIdAtNexus)
-                                    accountId = it.id
                                     accountHolder = it.accountHolder
                                     iban = when (it.accountNumberList?.get(0)) 
{
                                         is EbicsTypes.GeneralAccountNumber -> {

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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