[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] branch master updated: HTD order type JAXB and test
From: |
gnunet |
Subject: |
[libeufin] branch master updated: HTD order type JAXB and test |
Date: |
Tue, 05 Nov 2019 22:22:18 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository libeufin.
The following commit(s) were added to refs/heads/master by this push:
new 8868572 HTD order type JAXB and test
8868572 is described below
commit 886857244fa220352d9f9745a2e3401a2436a770
Author: Florian Dold <address@hidden>
AuthorDate: Tue Nov 5 22:22:01 2019 +0100
HTD order type JAXB and test
---
.../tech/libeufin/schema/ebics_h004/EbicsTypes.kt | 28 ++++
.../schema/ebics_h004/HTDResponseOrderData.kt | 180 ++++++++++++++++++++-
sandbox/src/test/kotlin/EbicsMessagesTest.kt | 58 +++++++
3 files changed, 260 insertions(+), 6 deletions(-)
diff --git
a/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsTypes.kt
b/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsTypes.kt
index d3fc016..3c3ea9d 100644
--- a/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsTypes.kt
+++ b/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/EbicsTypes.kt
@@ -179,4 +179,32 @@ class EbicsTypes private constructor() {
@get:XmlSchemaType(name = "token")
lateinit var encryptionVersion: String
}
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ class FileFormatType {
+ @get:XmlAttribute(name = "CountryCode")
+ @get:XmlJavaTypeAdapter(CollapsedStringAdapter::class)
+ lateinit var language: String
+
+ @get:XmlValue
+ @get:XmlJavaTypeAdapter(NormalizedStringAdapter::class)
+ lateinit var value: String
+ }
+
+ /**
+ * Generic key-value pair.
+ */
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = ["name", "value"])
+ class Parameter {
+ @get:XmlAttribute(name = "Type", required = true)
+ lateinit var type: String
+
+ @get:XmlElement(name = "Name", required = true)
+ lateinit var name: String
+
+ @get:XmlElement(name = "Value", required = true)
+ lateinit var value: String
+
+ }
}
\ No newline at end of file
diff --git
a/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/HTDResponseOrderData.kt
b/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/HTDResponseOrderData.kt
index 64ea996..8928071 100644
---
a/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/HTDResponseOrderData.kt
+++
b/sandbox/src/main/kotlin/tech/libeufin/schema/ebics_h004/HTDResponseOrderData.kt
@@ -1,5 +1,6 @@
package tech.libeufin.schema.ebics_h004
+import java.security.Permission
import javax.xml.bind.annotation.*
@XmlAccessorType(XmlAccessType.NONE)
@@ -13,21 +14,188 @@ class HTDResponseOrderData {
lateinit var userInfo: UserInfo
@XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = ["addressInfo", "bankInfo",
"accountInfoList", "orderInfoList"])
class PartnerInfo {
+ @get:XmlElement(name = "AddressInfo", required = true)
+ lateinit var addressInfo: AddressInfo
+
+ @get:XmlElement(name = "BankInfo", required = true)
+ lateinit var bankInfo: BankInfo
+
+ @get:XmlElement(name = "AccountInfo", required = true)
+ var accountInfoList: List<AccountInfo>? = null
+
+ @get:XmlElement(name = "OrderInfo")
+ lateinit var orderInfoList: List<AuthOrderInfoType>
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(
+ name = "",
+ propOrder = ["orderType", "fileFormat", "transferType", "orderFormat",
"description", "numSigRequired"]
+ )
+ class AuthOrderInfoType {
+ @get:XmlElement(name = "OrderType")
+ lateinit var orderType: String
+
+ @get:XmlElement(name = "FileFormat")
+ val fileFormat: EbicsTypes.FileFormatType? = null
+
+ @get:XmlElement(name = "TransferType")
+ lateinit var transferType: String
+
+ @get:XmlElement(name = "OrderFormat", required = false)
+ var orderFormat: String? = null
+
+ @get:XmlElement(name = "Description")
+ lateinit var description: String
+
+ @get:XmlElement(name = "NumSigRequired")
+ var numSigRequired: Int? = null
+
+ }
+ @XmlAccessorType(XmlAccessType.NONE)
+ class UserIDType {
+ @get:XmlValue
+ lateinit var value: String;
+
+ @get:XmlAttribute(name = "Status")
+ var status: Int? = null
}
@XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = ["userID", "name", "permissionList"])
class UserInfo {
+ @get:XmlElement(name = "UserID", required = true)
+ lateinit var userID: UserIDType
- @get:XmlElement(name = "AddressInfo", required = true)
- lateinit var addressInfo: AddressInfo
+ @get:XmlElement(name = "Name")
+ var name: String? = null
- @get:XmlElement(name = "BankInfo", required = true)
- lateinit var bankInfo: BankInfo
+ @get:XmlElement(name = "Permission", type = UserPermission::class)
+ var permissionList: List<UserPermission>? = null
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = ["orderTypes", "fileFormat", "accountID",
"maxAmount"])
+ class UserPermission {
+ @get:XmlAttribute(name = "AuthorizationLevel")
+ var authorizationLevel: String? = null
+
+ @get:XmlElement(name = "OrderTypes")
+ var orderTypes: String? = null
+
+ @get:XmlElement(name = "FileFormat")
+ val fileFormat: EbicsTypes.FileFormatType? = null
+
+ @get:XmlElement(name = "AccountID")
+ val accountID: String? = null
+
+ @get:XmlElement(name = "MaxAmount")
+ val maxAmount: String? = null
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = ["name", "street", "postCode", "city",
"region", "country"])
+ class AddressInfo {
+ @get:XmlElement(name = "Name")
+ var name: String? = null
+
+ @get:XmlElement(name = "Street")
+ var street: String? = null
- class AddressInfo
- class BankInfo
+ @get:XmlElement(name = "PostCode")
+ var postCode: String? = null
+
+ @get:XmlElement(name = "City")
+ var city: String? = null
+
+ @get:XmlElement(name = "Region")
+ var region: String? = null
+
+ @get:XmlElement(name = "Country")
+ var country: String? = null
+ }
+
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ class BankInfo {
+ @get:XmlElement(name = "HostID")
+ lateinit var hostID: String
+
+ @get:XmlElement(type = EbicsTypes.Parameter::class)
+ var parameters: List<EbicsTypes.Parameter>? = null
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ @XmlType(name = "", propOrder = ["accountNumberList", "bankCodeList",
"accountHolder"])
+ class AccountInfo {
+ @get:XmlAttribute(name = "Currency")
+ var currency: String? = null
+
+ @get:XmlAttribute(name = "ID")
+ lateinit var id: String
+
+ @get:XmlAttribute(name = "Description")
+ var description: String? = null
+
+ @get:XmlElements(
+ XmlElement(name = "AccountNumber", type =
GeneralAccountNumber::class),
+ XmlElement(name = "NationalAccountNumber", type =
NationalAccountNumber::class)
+ )
+ var accountNumberList: List<AbstractAccountNumber>? = null
+
+ @get:XmlElements(
+ XmlElement(name = "BankCode", type = GeneralBankCode::class),
+ XmlElement(name = "NationalBankCode", type =
NationalBankCode::class)
+ )
+ var bankCodeList: List<AbstractBankCode>? = null
+
+ @get:XmlElement(name = "AccountHolder")
+ var accountHolder: String? = null
+ }
+
+ interface AbstractAccountNumber
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ class GeneralAccountNumber : AbstractAccountNumber {
+ @get:XmlAttribute(name = "international")
+ var international: Boolean = false
+
+ @get:XmlValue
+ lateinit var value: String
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ class NationalAccountNumber : AbstractAccountNumber {
+ @get:XmlAttribute(name = "format")
+ lateinit var format: String
+
+ @get:XmlValue
+ lateinit var value: String
+ }
+
+ interface AbstractBankCode
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ class GeneralBankCode : AbstractBankCode {
+ @get:XmlAttribute(name = "prefix")
+ var prefix: String? = null
+
+ @get:XmlAttribute(name = "international")
+ var international: Boolean = false
+
+ @get:XmlValue
+ lateinit var value: String
+ }
+
+ @XmlAccessorType(XmlAccessType.NONE)
+ class NationalBankCode : AbstractBankCode {
+ @get:XmlValue
+ lateinit var value: String
+ @get:XmlAttribute(name = "format")
+ lateinit var format: String
}
}
diff --git a/sandbox/src/test/kotlin/EbicsMessagesTest.kt
b/sandbox/src/test/kotlin/EbicsMessagesTest.kt
index e47f932..2c28630 100644
--- a/sandbox/src/test/kotlin/EbicsMessagesTest.kt
+++ b/sandbox/src/test/kotlin/EbicsMessagesTest.kt
@@ -172,4 +172,62 @@ class EbicsMessagesTest {
val text = classLoader.getResource("hpb_request.xml")!!.readText()
XMLUtil.convertStringToJaxb<EbicsNpkdRequest>(text)
}
+
+ @Test
+ fun testHtd() {
+ val htd = HTDResponseOrderData().apply {
+ this.partnerInfo = HTDResponseOrderData.PartnerInfo().apply {
+ this.accountInfoList = listOf(
+ HTDResponseOrderData.AccountInfo().apply {
+ this.id = "acctid1"
+ this.accountHolder = "Mina Musterfrau"
+ this.accountNumberList = listOf(
+ HTDResponseOrderData.GeneralAccountNumber().apply {
+ this.international = true
+ this.value = "AT411100000237571500"
+ }
+ )
+ this.currency = "EUR"
+ this.description = "some account"
+ this.bankCodeList = listOf(
+ HTDResponseOrderData.GeneralBankCode().apply {
+ this.international = true
+ this.value = "ABAGATWWXXX"
+ }
+ )
+ }
+ )
+ this.addressInfo = HTDResponseOrderData.AddressInfo().apply {
+ this.name = "Foo"
+ }
+ this.bankInfo = HTDResponseOrderData.BankInfo().apply {
+ this.hostID = "MYHOST"
+ }
+ this.orderInfoList = listOf(
+ HTDResponseOrderData.AuthOrderInfoType().apply {
+ this.description = "foo"
+ this.orderType = "CCC"
+ this.orderFormat = "foo"
+ this.transferType = "Upload"
+ }
+ )
+ }
+ this.userInfo = HTDResponseOrderData.UserInfo().apply {
+ this.name = "Some User"
+ this.userID = HTDResponseOrderData.UserIDType().apply {
+ this.status = 2
+ this.value = "myuserid"
+ }
+ this.permissionList = listOf(
+ HTDResponseOrderData.UserPermission().apply {
+ this.orderTypes = "CCC ABC"
+ }
+ )
+ }
+ }
+
+ val str = XMLUtil.convertJaxbToString(htd)
+ println(str)
+ assert(XMLUtil.validateFromString(str))
+ }
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
address@hidden.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [libeufin] branch master updated: HTD order type JAXB and test,
gnunet <=