commit 6c8535070332feafd1b3eb32d686ca7b0a30e487
parent e3315e0bd654d11e98226aac5fa9b69e3391dfd1
Author: Marcello Stanisci <ms@taler.net>
Date: Mon, 27 Apr 2020 17:34:18 +0200
Rename DB tables.
Use a EBICS-agnostic name scheme.
Diffstat:
3 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -27,7 +27,7 @@ object TalerRequestedPayments: LongIdTable() {
* This column gets a value only after the bank acknowledges the payment via
* a camt.05x entry. The "crunch" logic is responsible for assigning such value.
*/
- val rawConfirmed = reference("raw_confirmed", EbicsRawBankTransactionsTable).nullable()
+ val rawConfirmed = reference("raw_confirmed", RawBankTransactionsTable).nullable()
}
class TalerRequestedPaymentEntity(id: EntityID<Long>) : LongEntity(id) {
@@ -38,7 +38,7 @@ class TalerRequestedPaymentEntity(id: EntityID<Long>) : LongEntity(id) {
var exchangeBaseUrl by TalerRequestedPayments.exchangeBaseUrl
var wtid by TalerRequestedPayments.wtid
var creditAccount by TalerRequestedPayments.creditAccount
- var rawConfirmed by EbicsRawBankTransactionEntity optionalReferencedOn TalerRequestedPayments.rawConfirmed
+ var rawConfirmed by RawBankTransactionEntity optionalReferencedOn TalerRequestedPayments.rawConfirmed
}
/**
@@ -47,7 +47,7 @@ class TalerRequestedPaymentEntity(id: EntityID<Long>) : LongEntity(id) {
* the table whose ("clean") IDs the exchange will base its history requests on.
*/
object TalerIncomingPayments: LongIdTable() {
- val payment = reference("payment", EbicsRawBankTransactionsTable)
+ val payment = reference("payment", RawBankTransactionsTable)
val valid = bool("valid")
// avoid refunding twice!
val refunded = bool("refunded").default(false)
@@ -74,16 +74,16 @@ class TalerIncomingPaymentEntity(id: EntityID<Long>) : LongEntity(id) {
return newRow
}
}
- var payment by EbicsRawBankTransactionEntity referencedOn TalerIncomingPayments.payment
+ var payment by RawBankTransactionEntity referencedOn TalerIncomingPayments.payment
var valid by TalerIncomingPayments.valid
var refunded by TalerIncomingPayments.refunded
}
/**
* This table contains history "elements" as returned by the bank from a
- * CAMT message. Therefore, any row could come from a C52/3/4 message response.
+ * CAMT message.
*/
-object EbicsRawBankTransactionsTable : LongIdTable() {
+object RawBankTransactionsTable : LongIdTable() {
val nexusSubscriber = reference("subscriber", EbicsSubscribersTable)
val sourceFileName = text("sourceFileName") /* ZIP entry's name */
val unstructuredRemittanceInformation = text("unstructuredRemittanceInformation")
@@ -99,21 +99,21 @@ object EbicsRawBankTransactionsTable : LongIdTable() {
val status = text("status") // BOOK or other.
}
-class EbicsRawBankTransactionEntity(id: EntityID<Long>) : LongEntity(id) {
- companion object : LongEntityClass<EbicsRawBankTransactionEntity>(EbicsRawBankTransactionsTable)
- var sourceFileName by EbicsRawBankTransactionsTable.sourceFileName
- var unstructuredRemittanceInformation by EbicsRawBankTransactionsTable.unstructuredRemittanceInformation
- var transactionType by EbicsRawBankTransactionsTable.transactionType
- var currency by EbicsRawBankTransactionsTable.currency
- var amount by EbicsRawBankTransactionsTable.amount
- var debitorIban by EbicsRawBankTransactionsTable.debitorIban
- var debitorName by EbicsRawBankTransactionsTable.debitorName
- var creditorName by EbicsRawBankTransactionsTable.creditorName
- var creditorIban by EbicsRawBankTransactionsTable.creditorIban
- var counterpartBic by EbicsRawBankTransactionsTable.counterpartBic
- var bookingDate by EbicsRawBankTransactionsTable.bookingDate
- var nexusSubscriber by EbicsSubscriberEntity referencedOn EbicsRawBankTransactionsTable.nexusSubscriber
- var status by EbicsRawBankTransactionsTable.status
+class RawBankTransactionEntity(id: EntityID<Long>) : LongEntity(id) {
+ companion object : LongEntityClass<RawBankTransactionEntity>(RawBankTransactionsTable)
+ var sourceFileName by RawBankTransactionsTable.sourceFileName
+ var unstructuredRemittanceInformation by RawBankTransactionsTable.unstructuredRemittanceInformation
+ var transactionType by RawBankTransactionsTable.transactionType
+ var currency by RawBankTransactionsTable.currency
+ var amount by RawBankTransactionsTable.amount
+ var debitorIban by RawBankTransactionsTable.debitorIban
+ var debitorName by RawBankTransactionsTable.debitorName
+ var creditorName by RawBankTransactionsTable.creditorName
+ var creditorIban by RawBankTransactionsTable.creditorIban
+ var counterpartBic by RawBankTransactionsTable.counterpartBic
+ var bookingDate by RawBankTransactionsTable.bookingDate
+ var nexusSubscriber by EbicsSubscriberEntity referencedOn RawBankTransactionsTable.nexusSubscriber
+ var status by RawBankTransactionsTable.status
}
/**
@@ -217,7 +217,7 @@ fun dbCreateTables() {
Pain001Table,
EbicsSubscribersTable,
EbicsAccountsInfoTable,
- EbicsRawBankTransactionsTable,
+ RawBankTransactionsTable,
TalerIncomingPayments,
TalerRequestedPayments
)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/Main.kt
@@ -663,8 +663,8 @@ fun main() {
var ret = ""
transaction {
val subscriber: EbicsSubscriberEntity = getSubscriberEntityFromId(id)
- EbicsRawBankTransactionEntity.find {
- EbicsRawBankTransactionsTable.nexusSubscriber eq subscriber.id.value
+ RawBankTransactionEntity.find {
+ RawBankTransactionsTable.nexusSubscriber eq subscriber.id.value
}.forEach {
ret += "###\nDebitor: ${it.debitorIban}\nCreditor: ${it.creditorIban}\nAmount: ${it.currency}:${it.amount}\nDate: ${it.bookingDate}\n"
}
@@ -699,7 +699,7 @@ fun main() {
val fileName = it.first
val camt53doc = XMLUtil.parseStringIntoDom(it.second)
transaction {
- EbicsRawBankTransactionEntity.new {
+ RawBankTransactionEntity.new {
sourceFileName = fileName
unstructuredRemittanceInformation = camt53doc.pickString("//*[local-name()='Ntry']//*[local-name()='Amt']/@Ccy")
transactionType = camt53doc.pickString("//*[local-name()='Ntry']//*[local-name()='CdtDbtInd']")
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/taler.kt
@@ -212,7 +212,7 @@ class Taler(app: Route) {
* @param entry a new raw payment to be checked.
* @return true if the payment was already "seen" by the Taler layer, false otherwise.
*/
- private fun duplicatePayment(entry: EbicsRawBankTransactionEntity): Boolean {
+ private fun duplicatePayment(entry: RawBankTransactionEntity): Boolean {
return false
}
@@ -222,7 +222,7 @@ class Taler(app: Route) {
* @param entry the raw entry to check
* @return true if the payment failed, false if it was successful.
*/
- private fun paymentFailed(entry: EbicsRawBankTransactionEntity): Boolean {
+ private fun paymentFailed(entry: RawBankTransactionEntity): Boolean {
return false
}
@@ -271,7 +271,7 @@ class Taler(app: Route) {
)
val rawEbics = if (!isProduction()) {
- EbicsRawBankTransactionEntity.new {
+ RawBankTransactionEntity.new {
sourceFileName = "test"
unstructuredRemittanceInformation = transferRequest.wtid
transactionType = "DBIT"
@@ -326,7 +326,7 @@ class Taler(app: Route) {
val amount = parseAmount(addIncomingData.amount)
val (bookingDate, opaque_row_id) = transaction {
val exchangeBankAccount = getBankAccountsInfoFromId(exchangeId).first()
- val rawPayment = EbicsRawBankTransactionEntity.new {
+ val rawPayment = RawBankTransactionEntity.new {
sourceFileName = "test"
unstructuredRemittanceInformation = addIncomingData.reserve_pub
transactionType = "CRDT"
@@ -412,12 +412,12 @@ class Taler(app: Route) {
* from the Taler incoming payments table to the found fresh payments.
*/
val latestIncomingPaymentId: Long = TalerIncomingPaymentEntity.getLast()
- EbicsRawBankTransactionEntity.find {
+ RawBankTransactionEntity.find {
/** select payments having the exchange as the credited party */
- EbicsRawBankTransactionsTable.creditorIban eq subscriberAccount.iban and
- (EbicsRawBankTransactionsTable.status eq "BOOK") and
+ RawBankTransactionsTable.creditorIban eq subscriberAccount.iban and
+ (RawBankTransactionsTable.status eq "BOOK") and
/** avoid processing old payments from the raw table */
- (EbicsRawBankTransactionsTable.id.greater(latestIncomingPaymentId))
+ (RawBankTransactionsTable.id.greater(latestIncomingPaymentId))
}.forEach {
if (duplicatePayment(it)) {
logger.warn("Incomint payment already seen")
@@ -444,9 +444,9 @@ class Taler(app: Route) {
* be really unexpected here.
*/
val latestOutgoingPaymentId = TalerRequestedPaymentEntity.getLast()
- EbicsRawBankTransactionEntity.find {
- EbicsRawBankTransactionsTable.id greater latestOutgoingPaymentId and
- ( EbicsRawBankTransactionsTable.debitorIban eq subscriberAccount.iban)
+ RawBankTransactionEntity.find {
+ RawBankTransactionsTable.id greater latestOutgoingPaymentId and
+ ( RawBankTransactionsTable.debitorIban eq subscriberAccount.iban)
}.forEach {
if (paymentFailed(it)) {
logger.error("Bank didn't accept one payment from the exchange")