gnunet-svn
[Top][All Lists]
Advanced

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

[libeufin] branch master updated: Not ingesting outgoing payments at the


From: gnunet
Subject: [libeufin] branch master updated: Not ingesting outgoing payments at the TWG level.
Date: Thu, 18 Jun 2020 17:11:22 +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 b540026  Not ingesting outgoing payments at the TWG level.
b540026 is described below

commit b540026026e0f37996c73073429d024c08be97d1
Author: MS <ms@taler.net>
AuthorDate: Thu Jun 18 17:10:23 2020 +0200

    Not ingesting outgoing payments at the TWG level.
---
 nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt    |  8 ---
 nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt | 61 +---------------------
 2 files changed, 1 insertion(+), 68 deletions(-)

diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
index cd2e2d5..9528839 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -41,11 +41,6 @@ import java.sql.Connection
  * in the PAIN-table.
  */
 object TalerRequestedPayments : LongIdTable() {
-    // this id gets assigned when the bank confirms the
-    // corresponding outgoing payment.  It is "abstract"
-    // in the sense that a "early" prepared payment might
-    // get a "high" id because the bank confirmed it "late".
-    val abstractId = long("abstractId").nullable()
     val preparedPayment = reference("payment", PaymentInitiationsTable)
     val requestUId = text("request_uid")
     val amount = text("amount")
@@ -56,7 +51,6 @@ object TalerRequestedPayments : LongIdTable() {
 
 class TalerRequestedPaymentEntity(id: EntityID<Long>) : LongEntity(id) {
     companion object : 
LongEntityClass<TalerRequestedPaymentEntity>(TalerRequestedPayments)
-    var abstractId by TalerRequestedPayments.abstractId
     var preparedPayment by PaymentInitiationEntity referencedOn 
TalerRequestedPayments.preparedPayment
     var requestUId by TalerRequestedPayments.requestUId
     var amount by TalerRequestedPayments.amount
@@ -321,7 +315,6 @@ object TalerFacadeStateTable : IntIdTable() {
     val facade = reference("facade", FacadesTable)
     // highest ID seen in the raw transactions table.
     val highestSeenMsgID = long("highestSeenMsgID").default(0)
-    val highestOutgoingAbstractID = 
long("highestOutgoingAbstractID").default(0)
 }
 
 class TalerFacadeStateEntity(id: EntityID<Int>) : IntEntity(id) {
@@ -335,7 +328,6 @@ class TalerFacadeStateEntity(id: EntityID<Int>) : 
IntEntity(id) {
     var intervalIncrement by TalerFacadeStateTable.intervalIncrement
     var facade by FacadeEntity referencedOn TalerFacadeStateTable.facade
     var highestSeenMsgID by TalerFacadeStateTable.highestSeenMsgID
-    var highestOutgoingAbstractID by 
TalerFacadeStateTable.highestOutgoingAbstractID
 }
 
 fun dbCreateTables(dbName: String) {
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt 
b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
index c2d9050..4741ecb 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
@@ -39,7 +39,6 @@ import org.jetbrains.exposed.dao.id.IdTable
 import org.jetbrains.exposed.sql.*
 import org.jetbrains.exposed.sql.transactions.transaction
 import tech.libeufin.nexus.bankaccount.addPreparedPayment
-import tech.libeufin.nexus.ebics.doEbicsUploadTransaction
 import tech.libeufin.util.*
 import kotlin.math.abs
 import kotlin.math.min
@@ -118,36 +117,6 @@ data class Payto(
     val bic: String = "NOTGIVEN"
 )
 
-fun parsePayto(paytoUri: String): Payto {
-    /**
-     * First try to parse a "iban"-type payto URI.  If that fails,
-     * then assume a test is being run under the "x-taler-bank" type.
-     * If that one fails too, throw exception.
-     *
-     * Note: since the Nexus doesn't have the notion of "x-taler-bank",
-     * such URIs must yield a iban-compatible tuple of values.  Therefore,
-     * the plain bank account number maps to a "iban", and the <bank hostname>
-     * maps to a "bic".
-     */
-
-    /**
-     * payto://iban/BIC/IBAN?name=<name>
-     * payto://x-taler-bank/<bank hostname>/<plain account number>
-     */
-    val ibanMatch = 
Regex("payto://iban/([A-Z0-9]+)/([A-Z0-9]+)\\?receiver-name=(\\w+)").find(paytoUri)
-    if (ibanMatch != null) {
-        val (bic, iban, name) = ibanMatch.destructured
-        return Payto(name, iban, bic.replace("/", ""))
-    }
-    val xTalerBankMatch = 
Regex("payto://x-taler-bank/localhost/([0-9]+)").find(paytoUri)
-    if (xTalerBankMatch != null) {
-        val xTalerBankAcctNo = xTalerBankMatch.destructured.component1()
-        return Payto("Taler Exchange", xTalerBankAcctNo, "localhost")
-    }
-
-    throw NexusError(HttpStatusCode.BadRequest, "invalid payto URI 
($paytoUri)")
-}
-
 /** Sort query results in descending order for negative deltas, and ascending 
otherwise.  */
 fun <T : Entity<Long>> SizedIterable<T>.orderTaler(delta: Int): List<T> {
     return if (delta < 0) {
@@ -425,29 +394,6 @@ private fun ingestIncoming(payment: 
RawBankTransactionEntity, txDtls: Transactio
     return
 }
 
-private fun ingestOutgoing(
-    txDtls: TransactionDetails,
-    fcid: String) {
-    val subject = txDtls.unstructuredRemittanceInformation
-    logger.debug("Ingesting outgoing payment: subject")
-    val wtid = extractWtidFromSubject(subject)
-    if (wtid == null) {
-        logger.warn("did not find wire transfer ID in outgoing payment")
-        return
-    }
-    val talerRequested = TalerRequestedPaymentEntity.find {
-        TalerRequestedPayments.wtid eq subject
-    }.firstOrNull()
-    if (talerRequested == null) {
-        logger.info("Payment '${subject}' shows in history, but was never 
requested!")
-        return
-    }
-    logger.debug("Payment: ${subject} was requested, and gets now marked as 
'confirmed'")
-    val fs = getTalerFacadeState(fcid)
-    fs.highestOutgoingAbstractID++
-    talerRequested.abstractId = fs.highestOutgoingAbstractID
-}
-
 /**
  * Crawls the database to find ALL the users that have a Taler
  * facade and process their histories respecting the TWG policy.
@@ -476,9 +422,6 @@ fun ingestTalerTransactions() {
                 logger.warn("batch transactions not supported")
             } else {
                 when (tx.creditDebitIndicator) {
-                    CreditDebitIndicator.DBIT -> ingestOutgoing(
-                        txDtls = tx.details[0], fcid = facade.id.value
-                    )
                     CreditDebitIndicator.CRDT -> ingestIncoming(it, txDtls = 
tx.details[0])
                 }
             }
@@ -518,9 +461,7 @@ private suspend fun historyOutgoing(call: ApplicationCall) {
         val subscriberBankAccount = 
getTalerFacadeBankAccount(expectNonNull(call.parameters["fcid"]))
         val reqPayments = mutableListOf<TalerRequestedPaymentEntity>()
         val reqPaymentsWithUnconfirmed = TalerRequestedPaymentEntity.find {
-            if (delta < 0) {
-                TalerRequestedPayments.abstractId less start
-            } else TalerRequestedPayments.abstractId greater start
+            startCmpOp
         }.orderTaler(delta)
         reqPaymentsWithUnconfirmed.forEach {
             if (it.preparedPayment.rawConfirmation != null) {

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