diff options
author | Antoine A <> | 2024-03-06 17:07:27 +0100 |
---|---|---|
committer | Antoine A <> | 2024-03-06 20:51:07 +0100 |
commit | 509c14f45fcbeb1eb09da1e16fa0ba4958db6854 (patch) | |
tree | 560ff9625ba5e232886b1eab9f08de55bc28de46 /nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics2.kt | |
parent | c5f106ddc3335ef63080ab4ebe4868f1f8917520 (diff) | |
download | libeufin-509c14f45fcbeb1eb09da1e16fa0ba4958db6854.tar.gz libeufin-509c14f45fcbeb1eb09da1e16fa0ba4958db6854.tar.bz2 libeufin-509c14f45fcbeb1eb09da1e16fa0ba4958db6854.zip |
Ebics3 HAC
Diffstat (limited to 'nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics2.kt')
-rw-r--r-- | nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics2.kt | 114 |
1 files changed, 0 insertions, 114 deletions
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics2.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics2.kt index b561be8d..1c791886 100644 --- a/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics2.kt +++ b/nexus/src/main/kotlin/tech/libeufin/nexus/ebics/Ebics2.kt @@ -43,120 +43,6 @@ import javax.xml.datatype.DatatypeFactory private val logger: Logger = LoggerFactory.getLogger("libeufin-nexus-ebics2") /** - * Creates a EBICS 2.5 download init. message. So far only used - * to fetch the PostFinance bank accounts. - */ -fun createEbics25DownloadInit( - cfg: EbicsSetupConfig, - clientKeys: ClientPrivateKeysFile, - bankKeys: BankPublicKeysFile, - whichDoc: SupportedDocument, - startDate: Instant? = null, - endDate: Instant? = null, -): ByteArray { - val orderType = when(whichDoc) { - SupportedDocument.PAIN_002 -> "Z01" - SupportedDocument.CAMT_052 -> "Z52" - SupportedDocument.CAMT_053 -> "Z53" - SupportedDocument.CAMT_054 -> "Z54" - SupportedDocument.PAIN_002_LOGS -> "HAC" - } - val nonce = getNonce(128) - val req = EbicsRequest.createForDownloadInitializationPhase( - cfg.ebicsUserId, - cfg.ebicsPartnerId, - cfg.ebicsHostId, - nonce, - DatatypeFactory.newInstance().newXMLGregorianCalendar( - GregorianCalendar( - TimeZone.getTimeZone(ZoneId.systemDefault()) - ) - ), - bankKeys.bank_encryption_public_key, - bankKeys.bank_authentication_public_key, - orderType, - EbicsRequest.StandardOrderParams().apply { - if (startDate != null) { - val r = EbicsDateRange(startDate, endDate ?: Instant.now()) - dateRange = EbicsRequest.DateRange().apply { - start = getXmlDate(r.start) - end = getXmlDate(r.end) - } - } - } - ) - val doc = XMLUtil.convertJaxbToDocument(req) - XMLUtil.signEbicsDocument( - doc, - clientKeys.authentication_private_key, - withEbics3 = false - ) - return XMLUtil.convertDomToBytes(doc) -} - -/** - * Creates raw XML for an EBICS receipt phase. - * - * @param cfg configuration handle. - * @param clientKeys user EBICS private keys. - * @param transactionId transaction ID of the EBICS communication that - * should receive this receipt. - * @param success was the download successfully processed - * @return receipt request in XML. - */ -fun createEbics25DownloadReceiptPhase( - cfg: EbicsSetupConfig, - clientKeys: ClientPrivateKeysFile, - transactionId: String, - success: Boolean -): ByteArray { - val req = EbicsRequest.createForDownloadReceiptPhase( - transactionId, - cfg.ebicsHostId, - success - ) - val doc = XMLUtil.convertJaxbToDocument(req) - XMLUtil.signEbicsDocument( - doc, - clientKeys.authentication_private_key, - withEbics3 = false - ) - return XMLUtil.convertDomToBytes(doc) -} - -/** - * Creates raw XML for an EBICS transfer phase. - * - * @param cfg configuration handle. - * @param clientKeys user EBICS private keys. - * @param segNumber which segment we ask the bank. - * @param totalSegments how many segments compose the whole EBICS transaction. - * @param transactionId ID of the EBICS transaction that transports all the segments. - * @return raw XML string of the request. - */ -fun createEbics25DownloadTransferPhase( - cfg: EbicsSetupConfig, - clientKeys: ClientPrivateKeysFile, - segNumber: Int, - totalSegments: Int, - transactionId: String -): ByteArray { - val req = EbicsRequest.createForDownloadTransferPhase( - hostID = cfg.ebicsHostId, - segmentNumber = segNumber, - numSegments = totalSegments, - transactionID = transactionId - ) - val doc = XMLUtil.convertJaxbToDocument(req) - XMLUtil.signEbicsDocument( - doc, - clientKeys.authentication_private_key, - withEbics3 = false - ) - return XMLUtil.convertDomToBytes(doc) -} - -/** * Parses the raw XML that came from the bank into the Nexus representation. * * @param clientEncryptionKey client private encryption key, used to decrypt |