gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated (6c85350 -> c4e54a7)


From: gnunet
Subject: [libeufin] branch master updated (6c85350 -> c4e54a7)
Date: Mon, 27 Apr 2020 17:49:42 +0200

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

marcello pushed a change to branch master
in repository libeufin.

    from 6c85350  Rename DB tables.
     new 520a29a  gitignore
     new c4e54a7  DB table names.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore                                         |  1 +
 .idea/misc.xml                                     |  2 +-
 nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt    | 23 +++++++++----------
 .../src/main/kotlin/tech/libeufin/nexus/Helpers.kt |  4 ++--
 nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt  |  6 ++---
 nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt  | 26 +++++++++++-----------
 nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt |  4 ++--
 nexus/src/test/kotlin/PainGeneration.kt            |  4 ++--
 8 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/.gitignore b/.gitignore
index 6429010..054cedf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,4 @@ presentation/*.aux
 presentation/*.out
 presentation/*.snm
 presentation/*.toc
+.idea/misc.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 25d34a4..4bc4fc6 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
   <component name="ExternalStorageConfigurationManager" enabled="true" />
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_11" 
project-jdk-name="11" project-jdk-type="JavaSDK" />
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_11" 
default="true" project-jdk-name="11" project-jdk-type="JavaSDK" />
 </project>
\ No newline at end of file
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 4310e01..7372677 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -42,9 +42,8 @@ class TalerRequestedPaymentEntity(id: EntityID<Long>) : 
LongEntity(id) {
 }
 
 /**
- * This table "augments" the information given in the raw payments table, with 
Taler-related
- * ones.  It tells if a payment is valid and/or it was refunded already.  And 
moreover, it is
- * the table whose ("clean") IDs the exchange will base its history requests 
on.
+ * This is the table of the incoming payments.  Entries are merely "pointers" 
to the
+ * entries from the raw payments table.  Fixme: name should end with "-table".
  */
 object TalerIncomingPayments: LongIdTable() {
     val payment = reference("payment", RawBankTransactionsTable)
@@ -162,20 +161,20 @@ class Pain001Entity(id: EntityID<Int>) : IntEntity(id) {
     var invalid by Pain001Table.invalid
 }
 
-object EbicsAccountsInfoTable : IdTable<String>() {
+object BankAccountsTable : 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")
+    val bankCode = text("bankCode") 
 }
 
-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
-    var bankCode by EbicsAccountsInfoTable.bankCode
+class BankAccountEntity(id: EntityID<String>) : Entity<String>(id) {
+    companion object : EntityClass<String, 
BankAccountEntity>(BankAccountsTable)
+    var subscriber by EbicsSubscriberEntity referencedOn 
BankAccountsTable.subscriber
+    var accountHolder by BankAccountsTable.accountHolder
+    var iban by BankAccountsTable.iban
+    var bankCode by BankAccountsTable.bankCode
 }
 
 object EbicsSubscribersTable : IdTable<String>() {
@@ -216,7 +215,7 @@ fun dbCreateTables() {
          SchemaUtils.create(
              Pain001Table,
              EbicsSubscribersTable,
-             EbicsAccountsInfoTable,
+             BankAccountsTable,
              RawBankTransactionsTable,
              TalerIncomingPayments,
              TalerRequestedPayments
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
index 3e04eed..3c5cfdf 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Helpers.kt
@@ -73,11 +73,11 @@ fun expectLong(param: String?): Long? {
 }
 
 /* Needs a transaction{} block to be called */
-fun expectAcctidTransaction(param: String?): EbicsAccountInfoEntity {
+fun expectAcctidTransaction(param: String?): BankAccountEntity {
     if (param == null) {
         throw NexusError(HttpStatusCode.BadRequest, "Null Acctid given")
     }
-    return EbicsAccountInfoEntity.findById(param) ?: throw 
NexusError(HttpStatusCode.NotFound, "Account: $param not found")
+    return BankAccountEntity.findById(param) ?: throw 
NexusError(HttpStatusCode.NotFound, "Account: $param not found")
 }
 
 /**
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
index 7d7eb28..1a02c9c 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/JSON.kt
@@ -120,15 +120,15 @@ data class EbicsErrorJson(
     val error: EbicsErrorDetailJson
 )
 
-data class EbicsAccountInfoElement(
+data class BankAccountInfoElement(
     var accountHolderName: String? = null,
     var iban: String,
     var bankCode: String,
     var accountId: String
 )
 
-data class EbicsAccountsInfoResponse(
-    var accounts: MutableList<EbicsAccountInfoElement> = mutableListOf()
+data class BankAccountsInfoResponse(
+    var accounts: MutableList<BankAccountInfoElement> = mutableListOf()
 )
 
 data class PaymentInfoElement(
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
index 847cfd5..b85f619 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -142,7 +142,7 @@ fun extractFirstBic(bankCodes: 
List<EbicsTypes.AbstractBankCode>?): String? {
 
 fun getSubscriberDetailsFromBankAccount(bankAccountId: String): 
EbicsClientSubscriberDetails {
     return transaction {
-        val accountInfo = EbicsAccountInfoEntity.findById(bankAccountId) ?: 
throw NexusError(HttpStatusCode.NotFound, "Bank account ($bankAccountId) not 
managed by Nexus")
+        val accountInfo = BankAccountEntity.findById(bankAccountId) ?: throw 
NexusError(HttpStatusCode.NotFound, "Bank account ($bankAccountId) not managed 
by Nexus")
         logger.debug("Mapping bank account: ${bankAccountId}, to customer: 
${accountInfo.subscriber.id.value}")
         getSubscriberDetailsFromId(accountInfo.subscriber.id.value)
     }
@@ -154,11 +154,11 @@ fun getSubscriberDetailsFromBankAccount(bankAccountId: 
String): EbicsClientSubsc
  * @return the query set containing the subscriber's bank accounts.  The result
  * is guaranteed not to be empty.
  */
-fun getBankAccountsInfoFromId(id: String): 
SizedIterable<EbicsAccountInfoEntity> {
+fun getBankAccountsInfoFromId(id: String): SizedIterable<BankAccountEntity> {
     logger.debug("Looking up bank account of user '$id'")
     val list = transaction {
-        EbicsAccountInfoEntity.find {
-            EbicsAccountsInfoTable.subscriber eq id
+        BankAccountEntity.find {
+            BankAccountsTable.subscriber eq id
         }
     }
     if (list.empty()) {
@@ -281,13 +281,13 @@ fun createPain001document(pain001Entity: Pain001Entity): 
String {
                     }
                     element("DbtrAcct/Id/IBAN") {
                         text(transaction {
-                            
EbicsAccountInfoEntity.findById(pain001Entity.debtorAccount)?.iban ?: throw 
NexusError(HttpStatusCode.NotFound,"Debtor IBAN not found in database")
+                            
BankAccountEntity.findById(pain001Entity.debtorAccount)?.iban ?: throw 
NexusError(HttpStatusCode.NotFound,"Debtor IBAN not found in database")
                         })
                     }
                     element("DbtrAgt/FinInstnId/BIC") {
 
                         text(transaction {
-                            
EbicsAccountInfoEntity.findById(pain001Entity.debtorAccount)?.bankCode ?: throw 
NexusError(HttpStatusCode.NotFound,"Debtor BIC not found in database")
+                            
BankAccountEntity.findById(pain001Entity.debtorAccount)?.bankCode ?: throw 
NexusError(HttpStatusCode.NotFound,"Debtor BIC not found in database")
                         })
                     }
                     element("ChrgBr") {
@@ -478,13 +478,13 @@ fun main() {
             get("/ebics/subscribers/{id}/accounts") {
                 // this information is only avaiable *after* HTD or HKD has 
been called
                 val id = expectId(call.parameters["id"])
-                val ret = EbicsAccountsInfoResponse()
+                val ret = BankAccountsInfoResponse()
                 transaction {
-                    EbicsAccountInfoEntity.find {
-                        EbicsAccountsInfoTable.subscriber eq id
+                    BankAccountEntity.find {
+                        BankAccountsTable.subscriber eq id
                     }.forEach {
                         ret.accounts.add(
-                            EbicsAccountInfoElement(
+                            BankAccountInfoElement(
                                 accountHolderName = it.accountHolder,
                                 iban = it.iban,
                                 bankCode = it.bankCode,
@@ -530,8 +530,8 @@ fun main() {
                 val id = expectId(call.parameters["id"])
                 val ret = PaymentsInfo()
                 transaction {
-                    EbicsAccountInfoEntity.find {
-                        EbicsAccountsInfoTable.subscriber eq id
+                    BankAccountEntity.find {
+                        BankAccountsTable.subscriber eq id
                     }.forEach {
                         Pain001Entity.find {
                             Pain001Table.debtorAccount eq it.id.value
@@ -1340,7 +1340,7 @@ fun main() {
                         val payload = 
XMLUtil.convertStringToJaxb<HTDResponseOrderData>(response.orderData.toString(Charsets.UTF_8))
                         transaction {
                             payload.value.partnerInfo.accountInfoList?.forEach 
{
-                                EbicsAccountInfoEntity.new(id = it.id) {
+                                BankAccountEntity.new(id = it.id) {
                                     this.subscriber = 
getSubscriberEntityFromId(customerIdAtNexus)
                                     accountHolder = it.accountHolder
                                     iban = 
extractFirstIban(it.accountNumberList) ?: throw 
NexusError(HttpStatusCode.NotFound, reason = "bank gave no IBAN")
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
index 4e2c779..56c7939 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
@@ -538,8 +538,8 @@ class Taler(app: Route) {
                  */
                 if (! isProduction()) {
                     val EXCHANGE_BANKACCOUNT_ID = "exchange-bankaccount-id"
-                    if 
(EbicsAccountInfoEntity.findById(EXCHANGE_BANKACCOUNT_ID) == null) {
-                        EbicsAccountInfoEntity.new(id = 
EXCHANGE_BANKACCOUNT_ID) {
+                    if (BankAccountEntity.findById(EXCHANGE_BANKACCOUNT_ID) == 
null) {
+                        BankAccountEntity.new(id = EXCHANGE_BANKACCOUNT_ID) {
                             subscriber = getSubscriberEntityFromId(exchangeId)
                             accountHolder = "Test Exchange"
                             iban = "42"
diff --git a/nexus/src/test/kotlin/PainGeneration.kt 
b/nexus/src/test/kotlin/PainGeneration.kt
index 6b25cfb..ad19c76 100644
--- a/nexus/src/test/kotlin/PainGeneration.kt
+++ b/nexus/src/test/kotlin/PainGeneration.kt
@@ -20,7 +20,7 @@ class PainTest {
         Database.connect("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", driver = 
"org.h2.Driver")
         transaction {
             SchemaUtils.create(EbicsSubscribersTable)
-            SchemaUtils.create(EbicsAccountsInfoTable)
+            SchemaUtils.create(BankAccountsTable)
             SchemaUtils.create(Pain001Table)
 
             val subscriberEntity = EbicsSubscriberEntity.new(id = "123asdf-0") 
{
@@ -33,7 +33,7 @@ class PainTest {
                 authenticationPrivateKey = 
SerialBlob("authenticationPrivateKey".toByteArray())
                 encryptionPrivateKey = 
SerialBlob("encryptionPrivateKey".toByteArray())
             }
-            EbicsAccountInfoEntity.new(id = "acctid") {
+            BankAccountEntity.new(id = "acctid") {
                 subscriber = subscriberEntity
                 accountHolder = "Account Holder"
                 iban = "IBAN"

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



reply via email to

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