aboutsummaryrefslogtreecommitdiff
path: root/sandbox/src/main/kotlin/tech/libeufin
diff options
context:
space:
mode:
authorMS <ms@taler.net>2020-12-11 23:20:58 +0100
committerMS <ms@taler.net>2020-12-11 23:20:58 +0100
commit236b6d7e0948121efe52fdbed4c108c9e5903fb5 (patch)
treec713ec6f5068a45e91bb978c4f7c1a8594e9baf8 /sandbox/src/main/kotlin/tech/libeufin
parentd9d3db1b094f412c85ddbe52480df6289a144f33 (diff)
downloadlibeufin-236b6d7e0948121efe52fdbed4c108c9e5903fb5.tar.gz
libeufin-236b6d7e0948121efe52fdbed4c108c9e5903fb5.tar.bz2
libeufin-236b6d7e0948121efe52fdbed4c108c9e5903fb5.zip
Taler facade.
Getting to the point where one payment issued via the Taler Wire Gateway shows up in a Camt53 report, and is subsequently returned along the /outgoing endpoint offered by the Taler facade.
Diffstat (limited to 'sandbox/src/main/kotlin/tech/libeufin')
-rw-r--r--sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt1
-rw-r--r--sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt15
-rw-r--r--sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt1
-rw-r--r--sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt4
4 files changed, 9 insertions, 12 deletions
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index aaa09fe3..82124f93 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -323,7 +323,6 @@ fun dbCreateTables(dbConnectionString: String) {
Database.connect("${dbConnectionString}")
TransactionManager.manager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE
transaction {
- addLogger(StdOutSqlLogger)
SchemaUtils.create(
EbicsSubscribersTable,
EbicsHostsTable,
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index fc369a1b..5c31ba28 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -200,11 +200,7 @@ private fun getRelatedParty(branch: XmlElementBuilder, payment: RawPayment) {
}
}
-fun buildCamtString(
- type: Int,
- subscriberIban: String,
- history: List<RawPayment>
-): String {
+fun buildCamtString(type: Int, subscriberIban: String, history: List<RawPayment>): String {
/**
* ID types required:
*
@@ -387,10 +383,10 @@ fun buildCamtString(
element("NtryDtls/TxDtls") {
element("Refs") {
element("MsgId") {
- text("0")
+ text(it.msgId ?: "NOTPROVIDED")
}
element("PmtInfId") {
- text("0")
+ text(it.pmtInfId ?: "NOTPROVIDED")
}
element("EndToEndId") {
text("NOTPROVIDED")
@@ -556,6 +552,8 @@ private fun parsePain001(paymentRequest: String, initiatorName: String): PainPar
* Process a payment request in the pain.001 format.
*/
private fun handleCct(paymentRequest: String, initiatorName: String, ctx: RequestContext) {
+ LOGGER.debug("Handling CCT")
+ LOGGER.debug("Pain.001: $paymentRequest")
val parseResult = parsePain001(paymentRequest, initiatorName)
transaction {
try {
@@ -586,7 +584,7 @@ private fun handleCct(paymentRequest: String, initiatorName: String, ctx: Reques
}
private fun handleEbicsC53(requestContext: RequestContext): ByteArray {
- logger.debug("Handling C53 request")
+ LOGGER.debug("Handling C53 request")
val camt = constructCamtResponse(
53,
requestContext.requestObject.header,
@@ -757,7 +755,6 @@ private suspend fun ApplicationCall.handleEbicsHpb(
*/
private fun ApplicationCall.ensureEbicsHost(requestHostID: String): EbicsHostPublicInfo {
return transaction {
- addLogger(StdOutSqlLogger)
val ebicsHost =
EbicsHostEntity.find { EbicsHostsTable.hostID.upperCase() eq requestHostID.toUpperCase() }.firstOrNull()
if (ebicsHost == null) {
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 907f77e0..99f196b4 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -392,7 +392,6 @@ fun serverMain(dbName: String) {
val pairB = CryptoUtil.generateRsaKeyPair(2048)
val pairC = CryptoUtil.generateRsaKeyPair(2048)
transaction {
- addLogger(StdOutSqlLogger)
EbicsHostEntity.new {
this.ebicsVersion = req.ebicsVersion
this.hostId = req.hostID
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt
index 50ff3661..eb0e6585 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/bankAccount.kt
@@ -41,7 +41,9 @@ fun historyForAccount(iban: String): List<RawPayment> {
// and it makes the document invalid!
// uid = "${it[pmtInfId]}-${it[msgId]}"
uid = "${it[BankAccountTransactionsTable.pmtInfId]}",
- direction = it[BankAccountTransactionsTable.direction]
+ direction = it[BankAccountTransactionsTable.direction],
+ pmtInfId = it[BankAccountTransactionsTable.pmtInfId],
+ msgId = it[BankAccountTransactionsTable.msgId]
)
)
}