[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Untie Ebics from the payments' book.
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Untie Ebics from the payments' book. |
Date: |
Mon, 18 May 2020 11:19:56 +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 113a526 Untie Ebics from the payments' book.
113a526 is described below
commit 113a5265519b5c2c8873cd1f86fef7c751780fb1
Author: MS <address@hidden>
AuthorDate: Mon May 18 11:19:34 2020 +0200
Untie Ebics from the payments' book.
---
sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt | 3 ---
.../kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt | 12 ++++++------
sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt | 1 -
sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 12 ++++++++++++
util/src/main/kotlin/JSON.kt | 2 +-
5 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index a870c09..0a635a7 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -233,7 +233,6 @@ object PaymentsTable : IntIdTable() {
val subject = text("subject")
val amount = text("amount")
val date = long("date")
- val ebicsSubscriber = reference("ebicsSubscriber", EbicsSubscribersTable)
}
class PaymentEntity(id: EntityID<Int>) : IntEntity(id) {
companion object : IntEntityClass<PaymentEntity>(PaymentsTable)
@@ -242,8 +241,6 @@ class PaymentEntity(id: EntityID<Int>) : IntEntity(id) {
var subject by PaymentsTable.subject
var amount by PaymentsTable.amount
var date by PaymentsTable.date /** Date when the payment was persisted in
this system. */
- /* Subscirber involved in the payment */
- var ebicsSubscriber by EbicsSubscriberEntity referencedOn
PaymentsTable.ebicsSubscriber
}
/**
diff --git
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index f6f9801..23fb407 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -413,9 +413,12 @@ private fun constructCamtResponse(
Pair(DateTime(dateRange.start.toGregorianCalendar().time),
DateTime(dateRange.end.toGregorianCalendar().time))
} else Pair(DateTime(0), DateTime.now())
val history = mutableListOf<RawPayment>()
+ val bankAccount = getBankAccountFromSubscriber(subscriber)
transaction {
PaymentEntity.find {
- PaymentsTable.ebicsSubscriber eq subscriber.id.value
+ PaymentsTable.creditorIban eq bankAccount.iban or
+ (PaymentsTable.debitorIban eq bankAccount.iban) and
+ (PaymentsTable.date.between(start.millis, end.millis))
}.forEach {
history.add(
RawPayment(
@@ -443,7 +446,7 @@ private fun handleEbicsPTK(requestContext: RequestContext):
ByteArray {
/**
* Process a payment request in the pain.001 format.
*/
-private fun handleCct(paymentRequest: String, ebicsSubscriber:
EbicsSubscriberEntity) {
+private fun handleCct(paymentRequest: String) {
/**
* NOTE: this function is ONLY required to store some details
* to put then in the camt report. IBANs / amount / subject / names?
@@ -460,7 +463,6 @@ private fun handleCct(paymentRequest: String,
ebicsSubscriber: EbicsSubscriberEn
this.debitorIban = debitorIban
this.subject = subject
this.amount = amount
- this.ebicsSubscriber = ebicsSubscriber
this.date = DateTime.now().millis
}
}
@@ -701,7 +703,6 @@ private fun makePartnerInfo(subscriber:
EbicsSubscriberEntity): EbicsTypes.Partn
}
private fun handleEbicsHtd(requestContext: RequestContext): ByteArray {
- val bankAccount = getBankAccountFromSubscriber(requestContext.subscriber)
val htd = HTDResponseOrderData().apply {
this.partnerInfo = makePartnerInfo(requestContext.subscriber)
this.userInfo = EbicsTypes.UserInfo().apply {
@@ -717,7 +718,6 @@ private fun handleEbicsHtd(requestContext: RequestContext):
ByteArray {
)
}
}
-
val str = XMLUtil.convertJaxbToString(htd)
return str.toByteArray()
}
@@ -901,7 +901,7 @@ private fun
handleEbicsUploadTransactionTransmission(requestContext: RequestCont
if (getOrderTypeFromTransactionId(requestTransactionID) == "CCT") {
logger.debug("Attempting a payment.")
- handleCct(unzippedData.toString(Charsets.UTF_8),
requestContext.subscriber)
+ handleCct(unzippedData.toString(Charsets.UTF_8))
}
return EbicsResponse.createForUploadTransferPhase(
requestTransactionID,
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
index 5338b89..860db55 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt
@@ -5,7 +5,6 @@ import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
import org.jetbrains.exposed.sql.and
import org.jetbrains.exposed.sql.transactions.transaction
-
fun getOrderTypeFromTransactionId(transactionID: String): String {
val uploadTransaction = transaction {
EbicsUploadTransactionEntity.findById(transactionID)
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index a1d1ae5..68b494f 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -47,6 +47,7 @@ import org.slf4j.event.Level
import org.w3c.dom.Document
import tech.libeufin.util.Amount
import tech.libeufin.util.CryptoUtil
+import tech.libeufin.util.RawPayment
import java.lang.ArithmeticException
import java.math.BigDecimal
import java.security.interfaces.RSAPublicKey
@@ -145,6 +146,17 @@ fun main() {
get("/") {
call.respondText("Hello Sandbox!\n", ContentType.Text.Plain)
}
+ /**
+ * Adds a new payment to the book.
+ */
+ post("/admin/payments") {
+ val body = call.receive<RawPayment>()
+ transaction {
+
+ }
+ call.respondText("Payment created")
+ return@post
+ }
/**
* Associates a new bank account with an existing Ebics subscriber.
*/
diff --git a/util/src/main/kotlin/JSON.kt b/util/src/main/kotlin/JSON.kt
index db420d8..62fb992 100644
--- a/util/src/main/kotlin/JSON.kt
+++ b/util/src/main/kotlin/JSON.kt
@@ -10,5 +10,5 @@ data class RawPayment(
val debitorIban: String,
val amount: String,
val subject: String,
- val date: String
+ val date: String?
)
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: Untie Ebics from the payments' book.,
gnunet <=