[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: Ack of HTD download order.
From: |
gnunet |
Subject: |
[libeufin] branch master updated: Ack of HTD download order. |
Date: |
Mon, 11 Nov 2019 21:14:08 +0100 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 4bcafa4 Ack of HTD download order.
4bcafa4 is described below
commit 4bcafa4eb29eceec465edeaa2f4ec80681c529fd
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Nov 11 21:13:26 2019 +0100
Ack of HTD download order.
Extraction of actual data still missing.
---
nexus/src/main/kotlin/Main.kt | 51 ++++++++++++++++++++--
.../libeufin/schema/ebics_h004/EbicsRequest.kt | 2 +-
2 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/nexus/src/main/kotlin/Main.kt b/nexus/src/main/kotlin/Main.kt
index e1275ad..b9b45bd 100644
--- a/nexus/src/main/kotlin/Main.kt
+++ b/nexus/src/main/kotlin/Main.kt
@@ -263,7 +263,7 @@ fun main() {
get("/ebics/subscribers/{id}/sendHtd") {
val id = expectId(call.parameters["id"])
- val (url, body, encPrivBlob) = transaction {
+ val (url, requestDoc, encPrivBlob) = transaction {
val subscriber = EbicsSubscriberEntity.findById(id) ?:
throw SubscriberNotFoundError(HttpStatusCode.NotFound)
val request = EbicsRequest().apply {
version = "H004"
@@ -323,8 +323,53 @@ fun main() {
Triple(subscriber.ebicsURL, hpbDoc,
subscriber.encryptionPrivateKey.toByteArray())
}
- val response = client.postToBank<EbicsResponse>(url, body)
- print("HTD response: " +
XMLUtil.convertJaxbToString<EbicsResponse>(response.value))
+ val response = client.postToBank<EbicsResponse>(url,
requestDoc)
+ logger.debug("HTD response: " +
XMLUtil.convertJaxbToString<EbicsResponse>(response.value))
+
+ if (response.value.body.returnCode.value != "000000") {
+ throw EbicsError(response.value.body.returnCode.value)
+ }
+
+ val ackRequestDoc = transaction {
+ val subscriber = EbicsSubscriberEntity.findById(id) ?:
throw SubscriberNotFoundError(HttpStatusCode.NotFound)
+
+ val ackRequest = EbicsRequest().apply {
+ header = EbicsRequest.Header().apply {
+ version = "H004"
+ revision = 1
+ authenticate = true
+ static = EbicsRequest.StaticHeaderType().apply {
+ hostID = subscriber.hostID
+ transactionID =
response.value.header._static.transactionID
+ }
+ mutable = EbicsRequest.MutableHeader().apply {
+ transactionPhase =
EbicsTypes.TransactionPhaseType.RECEIPT
+ }
+ authSignature = SignatureType()
+ }
+ body = EbicsRequest.Body().apply {
+ transferReceipt =
EbicsRequest.TransferReceipt().apply {
+ authenticate = true
+ receiptCode = 0 // always true at this point.
+ }
+ }
+ }
+
+ val ackRequestDoc =
XMLUtil.convertJaxbToDocument(ackRequest)
+ XMLUtil.signEbicsDocument(
+ ackRequestDoc,
+
CryptoUtil.loadRsaPrivateKey(subscriber.authenticationPrivateKey.toByteArray())
+ )
+
+ ackRequestDoc
+ }
+
+ val ackResponse = client.postToBank<EbicsResponse>(url,
ackRequestDoc)
+ logger.debug("HTD final response: " +
XMLUtil.convertJaxbToString<EbicsResponse>(response.value))
+
+ if (ackResponse.value.body.returnCode.value != "000000") {
+ throw EbicsError(response.value.body.returnCode.value)
+ }
call.respond(
HttpStatusCode.NotImplemented,
diff --git
a/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsRequest.kt
b/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsRequest.kt
index ded67e2..786fa98 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsRequest.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsRequest.kt
@@ -61,7 +61,7 @@ class EbicsRequest {
@get:XmlElement(name = "Nonce", type = String::class)
@get:XmlJavaTypeAdapter(HexBinaryAdapter::class)
@get:XmlSchemaType(name = "hexBinary")
- lateinit var nonce: ByteArray
+ var nonce: ByteArray? = null
/**
* Present only in the initialization phase.
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: Ack of HTD download order.,
gnunet <=