gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] 02/02: Taler wire gateways test.


From: gnunet
Subject: [libeufin] 02/02: Taler wire gateways test.
Date: Tue, 15 Dec 2020 01:38:10 +0100

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

ms pushed a commit to branch master
in repository libeufin.

commit 68616ce589dce8e1983f3b8e51591e714c60609f
Author: MS <ms@taler.net>
AuthorDate: Tue Dec 15 01:36:54 2020 +0100

    Taler wire gateways test.
    
    Getting /taler/history/incoming to show the
    payment generated via /taler/admin/add-incoming.
---
 integration-tests/tests.py                         |  1 -
 nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt    |  7 +++---
 nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt | 27 ++++++++++++++--------
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index fe15cf8..3eba263 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -282,7 +282,6 @@ def test_taler_facade_incoming(make_taler_facade):
             "taler/history/incoming?delta=5"]),
         auth=PERSONA.nexus.auth
     ))
-    print(resp.json().get("incoming_transactions"))
     assert len(resp.json().get("incoming_transactions")) == 1
 
 def test_taler_facade_outgoing(make_taler_facade):
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index 465b59e..1e69bd3 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -66,7 +66,7 @@ object TalerIncomingPayments : LongIdTable() {
     val payment = reference("payment", NexusBankTransactionsTable)
     val reservePublicKey = text("reservePublicKey")
     val timestampMs = long("timestampMs")
-    val incomingPaytoUri = text("incomingPaytoUri")
+    val debtorPaytoUri = text("incomingPaytoUri")
 }
 
 class TalerIncomingPaymentEntity(id: EntityID<Long>) : LongEntity(id) {
@@ -75,7 +75,7 @@ class TalerIncomingPaymentEntity(id: EntityID<Long>) : 
LongEntity(id) {
     var payment by NexusBankTransactionEntity referencedOn 
TalerIncomingPayments.payment
     var reservePublicKey by TalerIncomingPayments.reservePublicKey
     var timestampMs by TalerIncomingPayments.timestampMs
-    var incomingPaytoUri by TalerIncomingPayments.incomingPaytoUri
+    var debtorPaytoUri by TalerIncomingPayments.debtorPaytoUri
 }
 
 /**
@@ -423,7 +423,8 @@ fun dbCreateTables(dbConnectionString: String) {
             FacadesTable,
             TalerFacadeStateTable,
             NexusScheduledTasksTable,
-            OfferedBankAccountsTable
+            OfferedBankAccountsTable,
+            NexusScheduledTasksTable
         )
     }
 }
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
index 7f07be3..52a6edd 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/Taler.kt
@@ -138,12 +138,11 @@ fun <T : Entity<Long>> SizedIterable<T>.orderTaler(delta: 
Int): List<T> {
 /**
  * Build an IBAN payto URI.
  */
-fun buildIbanPaytoUri(iban: String, bic: String?, name: String): String {
-    if (bic != null) {
-        return "payto://iban/$bic/$iban?receiver-name=$name"
-    } else {
-        return "payto://iban/$iban?receiver-name=$name"
-    }
+fun buildIbanPaytoUri(
+    iban: String, bic: String, name: String, direction: String
+): String {
+    val nameParam = if (direction == "DBIT") "sender-name" else "receiver-name"
+    return "payto://iban/$bic/$iban?$nameParam=$name"
 }
 
 /** Builds the comparison operator for history entries based on the sign of 
'delta'  */
@@ -396,11 +395,17 @@ private fun ingestIncoming(payment: 
NexusBankTransactionEntity, txDtls: Transact
         logger.warn("invalid public key")
         return
     }
+    if (debtorAgent.bic == null) {
+        logger.warn("Not allowing transactions missing the BIC.  IBAN and 
name: ${debtorIban}, ${debtorName}")
+        return
+    }
     TalerIncomingPaymentEntity.new {
         this.payment = payment
         reservePublicKey = reservePub
         timestampMs = System.currentTimeMillis()
-        incomingPaytoUri = buildIbanPaytoUri(debtorIban, debtorAgent.bic, 
debtorName)
+        debtorPaytoUri = buildIbanPaytoUri(
+            debtorIban, debtorAgent.bic, debtorName, "DBIT"
+        )
     }
     return
 }
@@ -494,7 +499,8 @@ private suspend fun historyOutgoing(call: ApplicationCall) {
                         debit_account = buildIbanPaytoUri(
                             subscriberBankAccount.iban,
                             subscriberBankAccount.bankCode,
-                            subscriberBankAccount.accountHolder
+                            subscriberBankAccount.accountHolder,
+                            "DBIT"
                         ),
                         exchange_base_url = 
"FIXME-to-request-along-subscriber-registration"
                     )
@@ -534,9 +540,10 @@ private suspend fun historyIncoming(call: 
ApplicationCall): Unit {
                         credit_account = buildIbanPaytoUri(
                             it.payment.bankAccount.iban,
                             it.payment.bankAccount.bankCode,
-                            it.payment.bankAccount.accountHolder
+                            it.payment.bankAccount.accountHolder,
+                            "CRDT"
                         ),
-                        debit_account = it.incomingPaytoUri
+                        debit_account = it.debtorPaytoUri
                     )
                 )
             }

-- 
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]