libeufin

Integration and sandbox testing for FinTech APIs and data formats
Log | Files | Refs | Submodules | README | LICENSE

commit 722e2cf66c171ba97b8e9fb24cbbff174dad174b
parent 338960bbc8965df12e1e76d24f2a3103d792f134
Author: MS <ms@taler.net>
Date:   Fri,  4 Dec 2020 12:10:43 +0100

sandbox payment API: ask the payment direction too

This makes easier to understand which IBAN is the one
managed by the Sandbox.

Diffstat:
Mintegration-tests/tests.py | 19+++++++++++++++++++
Msandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt | 5+++--
2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/integration-tests/tests.py b/integration-tests/tests.py @@ -358,3 +358,22 @@ def test_ingestion_camt53(): with open("camt53-gls-style-0.json") as f: expected_txs = f.read() assert not dd(resp.json(), json.loads(expected_txs), ignore_order=True) + +def test_sandbox_camt(): + 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" + ) + ) + ) diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt @@ -273,7 +273,7 @@ fun serverMain(dbName: String) { val body = call.receive<RawPayment>() val random = Random.nextLong() transaction { - val debitorBankAccount = getBankAccountFromIban(body.debitorIban).id + val localIban = if (body.direction == "DBIT") body.debitorIban else body.creditorIban BankAccountTransactionsTable.insert { it[creditorIban] = body.creditorIban it[creditorBic] = body.creditorBic @@ -287,7 +287,8 @@ fun serverMain(dbName: String) { it[date] = Instant.now().toEpochMilli() it[pmtInfId] = random.toString() it[msgId] = random.toString() - it[account] = debitorBankAccount + it[account] = getBankAccountFromIban(localIban).id + it[direction] = body.direction } } call.respondText("Payment created")