[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Sandbox testing.
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Sandbox testing. |
Date: |
Wed, 20 May 2020 18:54:56 +0200 |
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 79a76c0 Sandbox testing.
79a76c0 is described below
commit 79a76c0dcf4395d3d015d81e3f1014a1288a2a93
Author: MS <address@hidden>
AuthorDate: Wed May 20 18:54:22 2020 +0200
Sandbox testing.
Add service printing all the payments that
exist in the system.
---
integration-tests/test-sandbox.py | 25 ++++++++++++++--------
.../src/main/kotlin/tech/libeufin/sandbox/JSON.kt | 11 ++++++++--
.../src/main/kotlin/tech/libeufin/sandbox/Main.kt | 20 +++++++++++++++++
3 files changed, 45 insertions(+), 11 deletions(-)
diff --git a/integration-tests/test-sandbox.py
b/integration-tests/test-sandbox.py
index 47bcab5..1671e08 100755
--- a/integration-tests/test-sandbox.py
+++ b/integration-tests/test-sandbox.py
@@ -106,17 +106,24 @@ assertResponse(
)
# Generate a few payments related to such account.
-assertResponse(
- post(
- "http://localhost:5000/admin/payments",
- json=dict(
- creditorIban="ES9121000418450200051332",
- debitorIban="GB33BUKB20201555555555",
- amount="EUR:0.99",
- subject="test service"
+for i in range(1, 3):
+ assertResponse(
+ post(
+ "http://localhost:5000/admin/payments",
+ json=dict(
+ creditorIban="ES9121000418450200051332",
+ debitorIban="GB33BUKB20201555555555",
+ amount="EUR:0.99",
+ subject="test service #{}".format(i)
+ )
)
)
+
+resp = assertResponse(
+ get("http://localhost:5000/admin/payments")
)
+print(resp.text)
+
sandbox.terminate()
-print("Test passed!")
+print("\nTest passed!")
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
index 092b022..eeb7578 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/JSON.kt
@@ -19,8 +19,7 @@
package tech.libeufin.sandbox
-import io.ktor.http.HttpStatusCode
-import java.lang.Exception
+import tech.libeufin.util.RawPayment
/**
* Used to show the list of Ebics hosts that exist
@@ -44,6 +43,14 @@ data class EbicsHostCreateRequest(
val ebicsVersion: String
)
+/**
+ * List type that show all the payments existing in the system.
+ */
+data class PaymentsResponse(
+ val payments: MutableList<RawPayment> = mutableListOf()
+)
+
+
/**
* Used to create AND show one Ebics subscriber in the system.
*/
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
index f7650e7..f8c7ec9 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Main.kt
@@ -60,6 +60,7 @@ import
com.fasterxml.jackson.databind.exc.MismatchedInputException
import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.fasterxml.jackson.module.kotlin.MissingKotlinParameterException
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
+import io.ktor.http.toHttpDateString
import java.time.Instant
import java.time.LocalDate
import java.time.LocalDateTime
@@ -160,6 +161,25 @@ fun main() {
get("/") {
call.respondText("Hello Sandbox!\n", ContentType.Text.Plain)
}
+ get("/admin/payments") {
+ val ret = PaymentsResponse()
+ transaction {
+ PaymentEntity.all().forEach {
+ ret.payments.add(
+ RawPayment(
+ creditorIban = it.creditorIban,
+ debitorIban = it.debitorIban,
+ subject = it.subject,
+ date = it.date.toHttpDateString(),
+ amount = it.amount
+ )
+ )
+ }
+ }
+ call.respond(ret)
+ return@get
+ }
+
/**
* Adds a new payment to the book.
*/
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: Sandbox testing.,
gnunet <=