gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] 04/10: Nexus DB helper to get bank accounts.


From: gnunet
Subject: [libeufin] 04/10: Nexus DB helper to get bank accounts.
Date: Sat, 07 Jan 2023 13:49:03 +0100

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

ms pushed a commit to branch master
in repository libeufin.

commit 95d4c8e64fd20c3b35ed1c4cc53e7f7697eb2570
Author: MS <ms@taler.net>
AuthorDate: Sat Jan 7 13:18:09 2023 +0100

    Nexus DB helper to get bank accounts.
---
 .../kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
index 6cd21c62..af72ab1f 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
@@ -352,7 +352,20 @@ fun getPaymentInitiation(uuid: Long): 
PaymentInitiationEntity {
         "Payment '$uuid' not found"
     )
 }
-
+fun getBankAccount(label: String): NexusBankAccountEntity {
+    val maybeBankAccount = transaction {
+        NexusBankAccountEntity.findByName(label)
+    }
+    return maybeBankAccount ?:
+    throw NexusError(
+        HttpStatusCode.NotFound,
+        "Account $label not found"
+    )
+}
+fun addPaymentInitiation(paymentData: Pain001Data, debtorAccount: String): 
PaymentInitiationEntity {
+    val bankAccount = getBankAccount(debtorAccount)
+    return addPaymentInitiation(paymentData, bankAccount)
+}
 
 /**
  * Insert one row in the database, and leaves it marked as non-submitted.

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