[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 08/11: Integration test.
From: |
gnunet |
Subject: |
[libeufin] 08/11: Integration test. |
Date: |
Thu, 30 Apr 2020 21:46:51 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
commit 5005d9eb5a0dc893fb7bb451f0625950f86bd11d
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Apr 30 17:48:35 2020 +0200
Integration test.
Ask C53 after one payment is made, and check the result.
---
integration-tests/test-ebics.py | 13 +++++++
.../src/main/kotlin/tech/libeufin/sandbox/DB.kt | 1 +
.../tech/libeufin/sandbox/EbicsProtocolBackend.kt | 42 +++++++++++-----------
3 files changed, 35 insertions(+), 21 deletions(-)
diff --git a/integration-tests/test-ebics.py b/integration-tests/test-ebics.py
index 78187d7..10c873d 100755
--- a/integration-tests/test-ebics.py
+++ b/integration-tests/test-ebics.py
@@ -168,3 +168,16 @@ resp = post("http://localhost:5001/ebics/execute-payments")
assert(resp.status_code == 200)
#6
+resp = post(
+
"http://localhost:5001/ebics/subscribers/{}/collect-transactions-c53".format(USERNAME),
+ json=dict()
+)
+assert(resp.status_code == 200)
+
+resp = get(
+ "http://localhost:5001/users/{}/history".format(USERNAME)
+)
+assert(resp.status_code == 200)
+assert(len(resp.json().get("payments")) == 1)
+
+
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
index dff869c..a870c09 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/DB.kt
@@ -242,6 +242,7 @@ 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 7123e9b..e31b44d 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -160,9 +160,10 @@ fun buildCamtString(type: Int, history:
MutableList<RawPayment>): MutableList<St
* - Proprietary code of the bank transaction
* - Id of the servicer (Issuer and Code)
*/
- val now = DateTime.now()
val ret = mutableListOf<String>()
history.forEach {
+ val dashedDate = DateTime.parse(it.date).toDashedDate()
+ val zonedDateTime = DateTime.now().toZonedString()
ret.add(
constructXml(indent = true) {
root("Document") {
@@ -175,7 +176,7 @@ fun buildCamtString(type: Int, history:
MutableList<RawPayment>): MutableList<St
text("0")
}
element("CreDtTm") {
- text(now.toZonedString())
+ text(zonedDateTime)
}
element("MsgPgntn") {
element("PgNb") {
@@ -197,23 +198,23 @@ fun buildCamtString(type: Int, history:
MutableList<RawPayment>): MutableList<St
text("0")
}
element("CreDtTm") {
- text(now.toZonedString())
+ text(zonedDateTime)
}
element("Acct") {
// mandatory account identifier
element("Id/IBAN") {
- text("GB33BUKB20201555555555")
+ text("Owner IBAN")
}
element("Ccy") {
text("EUR")
}
element("Ownr/Nm") {
- text("Max Mustermann")
+ text("Debitor/Owner Name")
}
element("Svcr/FinInstnId") {
element("BIC") {
- text("GENODEM1GLS")
+ text("Owner Bic")
}
element("Nm") {
text("Libeufin Bank")
@@ -239,15 +240,14 @@ fun buildCamtString(type: Int, history:
MutableList<RawPayment>): MutableList<St
}
element("Amt") {
attribute("Ccy", "EUR")
- text(Amount(1).toPlainString())
+ text(Amount(0).toPlainString())
}
element("CdtDbtInd") {
text("DBIT")
- // CRDT or DBIT here
}
element("Dt/Dt") {
// date of this balance
- text(now.toDashedDate())
+ text(dashedDate)
}
}
element("Bal") {
@@ -259,14 +259,14 @@ fun buildCamtString(type: Int, history:
MutableList<RawPayment>): MutableList<St
}
element("Amt") {
attribute("Ccy", "EUR")
- text(Amount(1).toPlainString())
+ text(Amount(0).toPlainString())
}
element("CdtDbtInd") {
// CRDT or DBIT here
text("DBIT")
}
element("Dt/Dt") {
- text(now.toDashedDate())
+ text(dashedDate)
}
}
/**
@@ -276,7 +276,7 @@ fun buildCamtString(type: Int, history:
MutableList<RawPayment>): MutableList<St
element("Ntry") {
element("Amt") {
attribute("Ccy", "EUR")
- text(Amount(1).toPlainString())
+ text(it.amount)
}
element("CdtDbtInd") {
text("DBIT")
@@ -288,10 +288,10 @@ fun buildCamtString(type: Int, history:
MutableList<RawPayment>): MutableList<St
text("BOOK")
}
element("BookgDt/Dt") {
- text(now.toDashedDate())
+ text(dashedDate)
} // date of the booking
element("ValDt/Dt") {
- text(now.toDashedDate())
+ text(dashedDate)
} // date of assets' actual
(un)availability
element("AcctSvcrRef") {
text("0")
@@ -335,7 +335,7 @@ fun buildCamtString(type: Int, history:
MutableList<RawPayment>): MutableList<St
}
element("AmtDtls/TxAmt/Amt") {
attribute("Ccy", "EUR")
- text(Amount(1).toPlainString())
+ text(it.amount)
}
element("BkTxCd") {
element("Domn") {
@@ -362,25 +362,25 @@ fun buildCamtString(type: Int, history:
MutableList<RawPayment>): MutableList<St
}
element("RltdPties") {
element("Dbtr/Nm") {
- text("Max Mustermann")
+ text("Debitor Name")
}
element("DbtrAcct/Id/IBAN") {
- text("GB33BUKB20201555555555")
+ text(it.debitorIban)
}
element("Cdtr/Nm") {
- text("Lina Musterfrau")
+ text("Creditor Name")
}
element("CdtrAcct/Id/IBAN") {
- text("DE75512108001245126199")
+ text(it.creditorIban)
}
}
element("RltdAgts") {
element("CdtrAgt/FinInstnId/BIC") {
- text("GENODEM1GLS")
+ text("Creditor Bic")
}
}
element("RmtInf/Ustrd") {
- text("made up subject")
+ text(it.subject)
}
}
element("AddtlNtryInf") {
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [libeufin] 04/11: Integration test., (continued)
- [libeufin] 04/11: Integration test., gnunet, 2020/04/30
- [libeufin] 01/11: Sandbox admin., gnunet, 2020/04/30
- [libeufin] 03/11: fix db problem in test, gnunet, 2020/04/30
- [libeufin] 02/11: HTD response content comes from DB now., gnunet, 2020/04/30
- [libeufin] 06/11: Integration test., gnunet, 2020/04/30
- [libeufin] 07/11: Fix CCT handling., gnunet, 2020/04/30
- [libeufin] 09/11: fix time parser, gnunet, 2020/04/30
- [libeufin] 11/11: Fix amount format., gnunet, 2020/04/30
- [libeufin] 05/11: Reducing code., gnunet, 2020/04/30
- [libeufin] 10/11: Move more generic helpers to util package., gnunet, 2020/04/30
- [libeufin] 08/11: Integration test.,
gnunet <=