[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 02/03: comments
From: |
gnunet |
Subject: |
[libeufin] 02/03: comments |
Date: |
Fri, 29 Sep 2023 09:55:13 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
commit cbdabfad8102bc93179591fd6dfe10c153d00b1d
Author: MS <ms@taler.net>
AuthorDate: Fri Sep 29 08:00:09 2023 +0200
comments
---
.../src/main/kotlin/tech/libeufin/bank/Database.kt | 44 +++++++++++++++++++---
bank/src/test/kotlin/LibeuFinApiTest.kt | 1 +
2 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/bank/src/main/kotlin/tech/libeufin/bank/Database.kt
b/bank/src/main/kotlin/tech/libeufin/bank/Database.kt
index 6ee99a05..d77c89a9 100644
--- a/bank/src/main/kotlin/tech/libeufin/bank/Database.kt
+++ b/bank/src/main/kotlin/tech/libeufin/bank/Database.kt
@@ -810,7 +810,8 @@ class Database(private val dbConfig: String, private val
bankCurrency: String) {
}
/**
- *
+ * Confirms a Taler withdrawal: flags the operation as
+ * confirmed and performs the related wire transfer.
*/
fun talerWithdrawalConfirm(
opUuid: UUID,
@@ -846,6 +847,9 @@ class Database(private val dbConfig: String, private val
bankCurrency: String) {
return WithdrawalConfirmationResult.SUCCESS
}
+ /**
+ * Creates a cashout operation in the database.
+ */
fun cashoutCreate(op: Cashout): Boolean {
reconnect()
val stmt = prepare("""
@@ -903,6 +907,11 @@ class Database(private val dbConfig: String, private val
bankCurrency: String) {
return myExecute(stmt)
}
+ /**
+ * Flags one cashout operation as confirmed. The backing
+ * payment should already have taken place, before calling
+ * this function.
+ */
fun cashoutConfirm(
opUuid: UUID,
tanConfirmationTimestamp: Long,
@@ -919,11 +928,18 @@ class Database(private val dbConfig: String, private val
bankCurrency: String) {
stmt.setObject(3, opUuid)
return myExecute(stmt)
}
- // used by /abort
+
+ /**
+ * This type is used by the cashout /abort handler.
+ */
enum class CashoutDeleteResult {
SUCCESS,
CONFLICT_ALREADY_CONFIRMED
}
+
+ /**
+ * Deletes a cashout operation from the database.
+ */
fun cashoutDelete(opUuid: UUID): CashoutDeleteResult {
val stmt = prepare("""
SELECT out_already_confirmed
@@ -938,6 +954,11 @@ class Database(private val dbConfig: String, private val
bankCurrency: String) {
return CashoutDeleteResult.SUCCESS
}
}
+
+ /**
+ * Gets a cashout operation from the database, according
+ * to its uuid.
+ */
fun cashoutGetFromUuid(opUuid: UUID): Cashout? {
val stmt = prepare("""
SELECT
@@ -1012,8 +1033,12 @@ class Database(private val dbConfig: String, private val
bankCurrency: String) {
)
}
}
+
+ /**
+ * Represents the database row related to one payment
+ * that was requested by the Taler exchange.
+ */
data class TalerTransferFromDb(
- // Only used when this type if defined from a DB record
val timestamp: Long,
val debitTxRowId: Long,
val requestUid: String,
@@ -1022,7 +1047,9 @@ class Database(private val dbConfig: String, private val
bankCurrency: String) {
val wtid: String,
val creditAccount: String
)
- // Gets a Taler transfer request, given its UID.
+ /**
+ * Gets a Taler transfer request, given its UID.
+ */
fun talerTransferGetFromUid(requestUid: String): TalerTransferFromDb? {
reconnect()
val stmt = prepare("""
@@ -1059,10 +1086,15 @@ class Database(private val dbConfig: String, private
val bankCurrency: String) {
}
}
+ /**
+ * Holds the result of inserting a Taler transfer request
+ * into the database.
+ */
data class TalerTransferCreationResult(
val txResult: BankTransactionResult,
- // Row ID of the debit bank transaction
- // of a successful case. Null upon errors
+ /**
+ * bank transaction that backs this Taler transfer request.
+ */
val txRowId: Long? = null
)
/**
diff --git a/bank/src/test/kotlin/LibeuFinApiTest.kt
b/bank/src/test/kotlin/LibeuFinApiTest.kt
index 77ced5d5..4eb0349e 100644
--- a/bank/src/test/kotlin/LibeuFinApiTest.kt
+++ b/bank/src/test/kotlin/LibeuFinApiTest.kt
@@ -155,6 +155,7 @@ class LibeuFinApiTest {
assert(newTokObj.expiration.t_s == Instant.MAX)
}
}
+
// Checking the POST /token handling.
@Test
fun tokenTest() {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.