[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 05/08: address validation issues
From: |
gnunet |
Subject: |
[libeufin] 05/08: address validation issues |
Date: |
Fri, 04 Dec 2020 15:00:08 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
commit d96b782536063342602cc32abef7195bad508c4a
Author: MS <ms@taler.net>
AuthorDate: Fri Dec 4 12:46:10 2020 +0100
address validation issues
---
integration-tests/tests.py | 33 ++++++++++++++--------
.../tech/libeufin/sandbox/EbicsProtocolBackend.kt | 9 +++---
.../src/main/kotlin/tech/libeufin/sandbox/Main.kt | 3 +-
3 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index 5ee3d1c..c866545 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -360,20 +360,29 @@ def test_ingestion_camt53():
assert not dd(resp.json(), json.loads(expected_txs), ignore_order=True)
def test_sandbox_camt():
+ payment_instruction = dict(
+ # NOTE: this format is very outdated in the docs repo.
+ creditorIban="GB33BUKB20201555555555",
+ creditorBic="BUKBGB22",
+ creditorName="Oliver Smith",
+ debitorIban="FR00000000000000000000",
+ debitorBic="BUKBGB22",
+ debitorName="Max Mustermann",
+ amount=5,
+ currency="EUR",
+ subject="Reimbursement",
+ direction="CRDT"
+ )
assertResponse(
post(
f"{S}/admin/payments/",
- json=dict(
- creditorIban="GB33BUKB20201555555555",
- creditorBic="ABCXYZ",
- creditorName="Oliver Smith",
- debitorIban="FR00000000000000000000",
- debitorBic="ABCXYZ",
- debitorName="Max Mustermann",
- amount=5,
- currency="EUR",
- subject="Reimbursement",
- direction="CRDT"
- )
+ json=payment_instruction
+ )
+ )
+ resp = assertResponse(
+ post(
+ f"{S}/admin/payments/camt/53",
+ data="GB33BUKB20201555555555"
)
)
+ print(resp.text)
diff --git
a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
index 321572b..08c7242 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/EbicsProtocolBackend.kt
@@ -172,7 +172,7 @@ private fun getRelatedParty(branch: XmlElementBuilder,
payment: RawPayment) {
var namePath = "Cdtr/Nm"
var iban = payment.creditorIban
var name = payment.creditorName
- var bicPath = "CdtrAgt"
+ var bicPath = "CdtrAgt/FinInstnId/BIC"
var bic = payment.creditorBic
}
if (payment.direction == "CRDT") {
@@ -181,14 +181,15 @@ private fun getRelatedParty(branch: XmlElementBuilder,
payment: RawPayment) {
otherParty.namePath = "Dbtr/Nm"
otherParty.name = payment.debitorName
otherParty.bic = payment.debitorBic
+ otherParty.bicPath = "DbtrAgt/FinInstnId/BIC"
}
branch.element("RltdPties") {
- element(otherParty.ibanPath) {
- text(otherParty.iban)
- }
element(otherParty.namePath) {
text(otherParty.name)
}
+ element(otherParty.ibanPath) {
+ text(otherParty.iban)
+ }
}
branch.element("RltdAgts") {
element(otherParty.bicPath) {
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index 15c8e4c..823a853 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -71,6 +71,7 @@ import tech.libeufin.sandbox.BankAccountTransactionsTable.date
import tech.libeufin.sandbox.BankAccountTransactionsTable.debitorBic
import tech.libeufin.sandbox.BankAccountTransactionsTable.debitorIban
import tech.libeufin.sandbox.BankAccountTransactionsTable.debitorName
+import tech.libeufin.sandbox.BankAccountTransactionsTable.direction
import tech.libeufin.util.*
import tech.libeufin.util.ebics_h004.EbicsResponse
import tech.libeufin.util.ebics_h004.EbicsTypes
@@ -257,7 +258,7 @@ fun serverMain(dbName: String) {
debitorBic = it[debitorBic],
debitorName = it[debitorName],
currency = it[currency],
- direction = "FIXME"
+ direction = it[direction]
)
)
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libeufin] branch master updated (c8bcfc1 -> ae7897d), gnunet, 2020/12/04
- [libeufin] 02/08: more abstraction at sandbox, gnunet, 2020/12/04
- [libeufin] 01/08: evolving sandbox, gnunet, 2020/12/04
- [libeufin] 03/08: Refactoring Camt generation., gnunet, 2020/12/04
- [libeufin] 07/08: prefer wrapping lists into JSON field, gnunet, 2020/12/04
- [libeufin] 06/08: Get unit tests from Sandbox to pass., gnunet, 2020/12/04
- [libeufin] 08/08: abstract over Camt type, gnunet, 2020/12/04
- [libeufin] 04/08: sandbox payment API: ask the payment direction too, gnunet, 2020/12/04
- [libeufin] 05/08: address validation issues,
gnunet <=