[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: nexus offers API to show facades
From: |
gnunet |
Subject: |
[libeufin] branch master updated: nexus offers API to show facades |
Date: |
Wed, 13 Jan 2021 00:06:34 +0100 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 508e2b3 nexus offers API to show facades
508e2b3 is described below
commit 508e2b3a25d167af3b6f751949a6e867bd4f4164
Author: MS <ms@taler.net>
AuthorDate: Wed Jan 13 00:06:02 2021 +0100
nexus offers API to show facades
---
integration-tests/tests.py | 12 ++++++------
.../main/kotlin/tech/libeufin/nexus/server/JSON.kt | 6 ++++++
.../tech/libeufin/nexus/server/NexusServer.kt | 22 +++++++++++++++++++++-
3 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/integration-tests/tests.py b/integration-tests/tests.py
index 1e962c6..0d3bf0e 100755
--- a/integration-tests/tests.py
+++ b/integration-tests/tests.py
@@ -124,7 +124,7 @@ def teardown_function():
dropSandboxTables(DB)
dropNexusTables(DB)
-def test_env(make_crdt_payment):
+def test_env(make_crdt_payment, make_taler_facade):
print("Nexus and Sandbox are up and running!\n")
print(f"Nexus URL: {NEXUS_URL}")
print(f"Sandbox URL: {SANDBOX_URL}")
@@ -332,7 +332,7 @@ def make_taler_facade():
def test_taler_facade_config(make_taler_facade):
resp = assertResponse(
get(
-
f"{PERSONA.nexus.base_url}/facades/{PERSONA.nexus.taler_facade_name}/taler/config",
+
f"{PERSONA.nexus.base_url}/facades/{PERSONA.nexus.taler_facade_name}/taler-wire-gateway/config",
auth=PERSONA.nexus.auth
)
)
@@ -344,7 +344,7 @@ def test_taler_facade_config(make_taler_facade):
def test_taler_facade_incoming(make_taler_facade):
resp = assertResponse(post(
-
f"{PERSONA.nexus.base_url}/facades/{PERSONA.nexus.taler_facade_name}/taler/admin/add-incoming",
+
f"{PERSONA.nexus.base_url}/facades/{PERSONA.nexus.taler_facade_name}/taler-wire-gateway/admin/add-incoming",
json=dict(
amount="EUR:1",
reserve_pub="1BCZ7KA333E3YJBFWT4J173M3E713YGFFGD856KPSGZN1N8ZKZR0",
@@ -363,7 +363,7 @@ def test_taler_facade_incoming(make_taler_facade):
PERSONA.nexus.base_url,
"facades",
PERSONA.nexus.taler_facade_name,
- "taler/history/incoming?delta=5"]),
+ "taler-wire-gateway/history/incoming?delta=5"]),
auth=PERSONA.nexus.auth
))
assert len(resp.json().get("incoming_transactions")) == 1
@@ -371,7 +371,7 @@ def test_taler_facade_incoming(make_taler_facade):
def test_taler_facade_outgoing(make_taler_facade):
assertResponse(
post(
-
f"{PERSONA.nexus.base_url}/facades/{PERSONA.nexus.taler_facade_name}/taler/transfer",
+
f"{PERSONA.nexus.base_url}/facades/{PERSONA.nexus.taler_facade_name}/taler-wire-gateway/transfer",
json=dict(
request_uid="0",
amount="EUR:1",
@@ -398,7 +398,7 @@ def test_taler_facade_outgoing(make_taler_facade):
resp = assertResponse(
get(
-
f"{PERSONA.nexus.base_url}/facades/{PERSONA.nexus.taler_facade_name}/taler/history/outgoing?delta=5",
+
f"{PERSONA.nexus.base_url}/facades/{PERSONA.nexus.taler_facade_name}/taler-wire-gateway/history/outgoing?delta=5",
auth=PERSONA.nexus.auth
)
)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
index ad11b4c..e57ea7c 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/JSON.kt
@@ -319,6 +319,12 @@ data class BankMessageInfo(
val length: Long
)
+data class FacadeShowInfo(
+ val name: String,
+ val type: String,
+ val baseUrl: String
+)
+
data class FacadeInfo(
val name: String,
val type: String,
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
index 4ac9037..20eb16a 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/server/NexusServer.kt
@@ -854,6 +854,26 @@ fun serverMain(dbName: String, host: String, port: Int) {
call.respondBytes(ret.msgContent, ContentType("application",
"xml"))
}
+ get("/facades") {
+ val ret = object { val facades =
mutableListOf<FacadeShowInfo>() }
+ transaction {
+ val user = authenticateRequest(call.request)
+ FacadeEntity.find {
+ FacadesTable.creator eq user.id
+ }.forEach {
+ ret.facades.add(
+ FacadeShowInfo(
+ name = it.id.value,
+ type = it.type,
+ baseUrl =
"http://${host}/facades/${it.id.value}/${it.type}/"
+ )
+ )
+ }
+ }
+ call.respond(ret)
+ return@get
+ }
+
post("/facades") {
val body = call.receive<FacadeInfo>()
if (body.type != "taler-wire-gateway") throw NexusError(
@@ -928,7 +948,7 @@ fun serverMain(dbName: String, host: String, port: Int) {
call.respond(object {})
}
}
- route("/facades/{fcid}/taler") {
+ route("/facades/{fcid}/taler-wire-gateway") {
talerFacadeRoutes(this, client)
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: nexus offers API to show facades,
gnunet <=