commit d96b782536063342602cc32abef7195bad508c4a
parent 722e2cf66c171ba97b8e9fb24cbbff174dad174b
Author: MS <ms@taler.net>
Date: Fri, 4 Dec 2020 12:46:10 +0100
address validation issues
Diffstat:
3 files changed, 28 insertions(+), 17 deletions(-)
diff --git 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
@@ -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
@@ -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]
)
)
}