[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: return list of initiated payments (API
From: |
gnunet |
Subject: |
[libeufin] branch master updated: return list of initiated payments (API) |
Date: |
Wed, 08 Jul 2020 12:07:38 +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 b06d03f return list of initiated payments (API)
b06d03f is described below
commit b06d03ffa1409f0043fe29c26fdbd9548a19d69b
Author: MS <ms@taler.net>
AuthorDate: Wed Jul 8 12:07:11 2020 +0200
return list of initiated payments (API)
---
.../kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt | 13 ++++++++++++-
nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt | 4 ++++
.../main/kotlin/tech/libeufin/nexus/server/NexusServer.kt | 12 ++++++++++++
3 files changed, 28 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 11644c2..59e4189 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/bankaccount/BankAccount.kt
@@ -39,6 +39,18 @@ import java.time.Instant
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter
+fun requireBankAccount(call: ApplicationCall, parameterKey: String):
NexusBankAccountEntity {
+ val name = call.parameters[parameterKey]
+ if (name == null) {
+ throw NexusError(HttpStatusCode.InternalServerError, "no parameter for
bank account")
+ }
+ val account = transaction { NexusBankAccountEntity.findById(name) }
+ if (account == null) {
+ throw NexusError(HttpStatusCode.NotFound, "bank connection '$name' not
found")
+ }
+ return account
+}
+
suspend fun submitPaymentInitiation(httpClient: HttpClient,
paymentInitiationId: Long) {
val r = transaction {
@@ -337,7 +349,6 @@ fun importBankAccount(call: ApplicationCall,
offeredBankAccountId: String, nexus
newImportedAccount
}
}
- // importedAccount could be now-or-earlier imported.
OfferedBankAccountsTable.update(
{OfferedBankAccountsTable.offeredAccountId eq
offeredBankAccountId and
(OfferedBankAccountsTable.bankConnection eq
conn.id.value) }
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
index 4e8e6ab..7a74ef6 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
@@ -398,3 +398,7 @@ data class AccountEntryItemJson(
val entryAmount: CurrencyAmount,
val status: EntryStatus
)
+
+data class InitiatedPayments(
+ val initiatedPayments: MutableList<String> = mutableListOf()
+)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index dcd3af2..4267439 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -477,6 +477,18 @@ fun serverMain(dbName: String, host: String) {
return@post
}
+ get("/bank-accounts/{accountid}/payment-initiations") {
+ val ret = InitiatedPayments()
+ transaction {
+ val bankAccount = requireBankAccount(call, "accountid")
+ PaymentInitiationEntity.find {
+ PaymentInitiationsTable.bankAccount eq
bankAccount.id.value
+ }.forEach { ret.initiatedPayments.add(it.id.toString()) }
+ }
+ call.respond(ret)
+ return@get
+ }
+
// Shows information about one particular payment initiation.
get("/bank-accounts/{accountid}/payment-initiations/{uuid}") {
val res = transaction {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: return list of initiated payments (API),
gnunet <=