[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: nexus: helper to submit EBICS 3 paymen
From: |
gnunet |
Subject: |
[libeufin] branch master updated: nexus: helper to submit EBICS 3 payments. |
Date: |
Wed, 25 Oct 2023 15:42:15 +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 47070ef9 nexus: helper to submit EBICS 3 payments.
47070ef9 is described below
commit 47070ef9e1fa32703203447abb772d638b1191be
Author: MS <ms@taler.net>
AuthorDate: Wed Oct 25 15:41:28 2023 +0200
nexus: helper to submit EBICS 3 payments.
---
.../kotlin/tech/libeufin/nexus/ebics/Ebics3.kt | 44 ++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics3.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics3.kt
index 406eb9f4..7bd34a9a 100644
--- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics3.kt
+++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics3.kt
@@ -1,8 +1,10 @@
package tech.libeufin.nexus.ebics
+import io.ktor.client.*
import tech.libeufin.nexus.BankPublicKeysFile
import tech.libeufin.nexus.ClientPrivateKeysFile
import tech.libeufin.nexus.EbicsSetupConfig
+import tech.libeufin.nexus.logger
import tech.libeufin.util.PreparedUploadData
import tech.libeufin.util.XMLUtil
import tech.libeufin.util.ebics_h005.Ebics3Request
@@ -90,4 +92,46 @@ fun createEbics3RequestForUploadTransferPhase(
withEbics3 = true
)
return XMLUtil.convertDomToString(doc)
+}
+
+/**
+ * Collects all the steps to prepare the submission of a pain.001
+ * document to the bank, and finally send it.
+ *
+ * @param pain001xml pain.001 document in XML. The caller should
+ * ensure its validity.
+ * @param cfg configuration handle.
+ * @param clientKeys client private keys.
+ * @param bankkeys bank public keys.
+ * @param httpClient HTTP client to connect to the bank.
+ * @return true on success, false otherwise.
+ */
+suspend fun submitPayment(
+ pain001xml: String,
+ cfg: EbicsSetupConfig,
+ clientKeys: ClientPrivateKeysFile,
+ bankkeys: BankPublicKeysFile,
+ httpClient: HttpClient
+): Boolean {
+ val orderService: Ebics3Request.OrderDetails.Service =
Ebics3Request.OrderDetails.Service().apply {
+ serviceName = "MCT"
+ scope = "CH"
+ messageName = Ebics3Request.OrderDetails.Service.MessageName().apply {
+ value = "pain.001"
+ version = "09"
+ }
+ }
+ val maybeUploaded = doEbicsUpload(
+ httpClient,
+ cfg,
+ clientKeys,
+ bankkeys,
+ orderService,
+ pain001xml.toByteArray(Charsets.UTF_8)
+ )
+ if (maybeUploaded == null) {
+ logger.error("Could not send the pain.001 document to the bank.")
+ return false
+ }
+ return true
}
\ No newline at end of file
--
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: helper to submit EBICS 3 payments.,
gnunet <=