Imports System Imports System.Collections.Generic Imports System.Globalization Imports System.IO Imports System.Text Imports System.Web.Script.Serialization Imports Chilkat Imports Renci.SshNet Imports sun.swing Public Class cTelotecAPI 'SPI SWAGGER:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 'https://accscustomsapi.teloweb.at/accscustomsapi120/swagger/index.html Public API_KEY = "YlcbZryXuKPSzQTzkGIJK9UdScGuSnhBBji94Z7A8UMoWPR0qDvVOvmlWNuUCMrQ" 'VERAG Public BASE_URL = "https://accscustomsapi.teloweb.at/accscustomsapi120" Dim TELOTEC_JSON As String = "\\datenarchiv\Datenarchiv\TELOTEC\ECHTSYSTEM\Nachrichtendaten_Ablage_JSON" ' <-- Deinen Pfad hier setzen Dim TELOTEC_ATTACHMENT_PATH As String = "\\datenarchiv\Datenarchiv\TELOTEC\ECHTSYSTEM\Nachrichtendaten_Ablage_PDF" ' Sub Main() 'Console.WriteLine("ACCS Customs API Demo") 'Dim taRequest As StoreTADeclarationsRequest = CreateSampleTARequest() 'PostStoreTADeclarations(taRequest) 'Dim messages As List(Of TAMessage) = GetTAMessages() 'Console.WriteLine("Nachrichten: " & messages.Count) End Sub Function getAPIKEY(Firma) As String Select Case Firma Case "DURMAZ" : Return "Kh8FqcBXx26fK65f4KQMQ3ExW2QbkPEPZpT9ZWS3spn6YjpZERd3SmZAY7Vda2SG" ' Durmaz Case "IMEX" : Return "A8V4zAhNHygwApz3b9UPR2dzzdHvsBTGkV4zm8KKewCh7VYbXeKkXmeRBJaFKGcc" 'IMEX Case Else : Return "YlcbZryXuKPSzQTzkGIJK9UdScGuSnhBBji94Z7A8UMoWPR0qDvVOvmlWNuUCMrQ" 'VERAG / ATILLA End Select End Function Function CreateSampleTARequest() As StoreTADeclarationsRequest Dim decl As New TADeclaration() With { .mandant_ID = "DemoMandant", .interfaceReferenceId = "REF123", .ifcCustomerId = "CUST001", .anmeldedatum = DateTime.Now, .lrn = "LRN001", .totNet = 1000D, .totNetSplit_IND = True, .frankatur = "FOB", .flugInfo = "LH123", .fillPackList_IND = True, .memo = "Test", .erstellDatum = DateTime.Now, .erstellPersonalID = "USER001", .declarationType = "T1", .additionalDeclarationType = "A", .presentationOfTheGoodsDateAndTime = DateTime.Now.AddHours(1), .security = 0, .specificCircumstanceIndicator = "S1", .containerIndicator = False, .grossMass = 1500D, .inlandModeOfTransport = 1, .modeOfTransportAtTheBorder = 4, .referenceNumberUCR = "UCR001", .methodOfPayment = "CASH", .customsOfficeOfDeparture = "AT000001", .customsOfficeOfPresentation = "AT000002", .customsOfficeOfDestinationDeclared = "DE000003" } Return New StoreTADeclarationsRequest With { .allowExistingReferenceId = False, .enableGrouping = False, .declarations = New List(Of TADeclaration) From {decl} } End Function Sub PostStoreTADeclarations(request As StoreTADeclarationsRequest) Dim http As New Http() http.SetRequestHeader("X-API-KEY", API_KEY) http.Accept = "application/json" Dim jsonObj As New JsonObject() jsonObj.UpdateBool("allowExistingReferenceId", request.allowExistingReferenceId) jsonObj.UpdateBool("enableGrouping", request.enableGrouping) Dim declArray As JsonArray = jsonObj.AppendArray("declarations") For Each decl In request.declarations Dim serializer As New JavaScriptSerializer() Dim jsonString As String = serializer.Serialize(decl) Dim declJson As New JsonObject() declJson.Load(jsonString) declArray.AddObjectAt(-1) declArray.ObjectAt(declArray.Size - 1).Load(declJson.Emit()) Next Dim url As String = "https://accscustomsapi.teloweb.at/accscustomsapi120/api/Interface/StoreTADeclarations" Dim resp As HttpResponse = http.PostJson3(url, "application/json", jsonObj) If http.LastMethodSuccess = False Then Console.WriteLine("❌ Fehler beim Senden: " & http.LastErrorText) Exit Sub End If Console.WriteLine("✅ StoreTADeclarations Antwort: " & resp.BodyStr) End Sub Sub PostStoreEXDeclarations(request As StoreTADeclarationsRequest) Dim http As New Http() http.SetRequestHeader("X-API-KEY", API_KEY) http.Accept = "application/json" Dim jsonObj As New JsonObject() jsonObj.UpdateBool("allowExistingReferenceId", request.allowExistingReferenceId) jsonObj.UpdateBool("enableGrouping", request.enableGrouping) Dim declArray As JsonArray = jsonObj.AppendArray("declarations") For Each decl In request.declarations Dim serializer As New JavaScriptSerializer() Dim jsonString As String = serializer.Serialize(decl) Dim declJson As New JsonObject() declJson.Load(jsonString) declArray.AddObjectAt(-1) declArray.ObjectAt(declArray.Size - 1).Load(declJson.Emit()) Next Dim url As String = "https://accscustomsapi.teloweb.at/accscustomsapi120/api/Interface/StoreEXDeclarations" Dim resp As HttpResponse = http.PostJson3(url, "application/json", jsonObj) If http.LastMethodSuccess = False Then Console.WriteLine("❌ Fehler beim Senden: " & http.LastErrorText) Exit Sub End If Console.WriteLine("✅ StoreEXDeclarations Antwort: " & resp.BodyStr) End Sub Shared Sub GET_ALL_TELO_Messages(AnhEinlesen As Boolean) Dim TELO As New VERAG_PROG_ALLGEMEIN.cTelotecAPI Dim Company = "ATILLA" For ii As Integer = 0 To 50 Dim messages As List(Of VERAG_PROG_ALLGEMEIN.cTelotecAPI.TAMessage) = TELO.GetTAMessages(Company, AnhEinlesen) Threading.Thread.Sleep(1000) ' Next Company = "IMEX" For ii As Integer = 0 To 50 Dim messages As List(Of VERAG_PROG_ALLGEMEIN.cTelotecAPI.TAMessage) = TELO.GetTAMessages(Company, AnhEinlesen) Threading.Thread.Sleep(1000) ' Next Company = "DURMAZ" For ii As Integer = 0 To 50 Dim messages As List(Of VERAG_PROG_ALLGEMEIN.cTelotecAPI.TAMessage) = TELO.GetTAMessages(Company, AnhEinlesen) Threading.Thread.Sleep(1000) ' Next End Sub Function GetTAMessages(Company, AnhEinlesen) As List(Of TAMessage) Console.WriteLine("-------------LOS-------------") VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat() Dim messages As New List(Of TAMessage)() Dim http As New Http() http.SetRequestHeader("X-API-KEY", getAPIKEY(Company)) ' http.SetRequestHeader("X-API-KEY", http.AuthToken = getAPIKEY("ATILLA")) http.Accept = "application/json" Dim url As String = BASE_URL & "/api/Interface/GetTAMessages" Dim resp As HttpResponse = http.QuickGetObj(url) If http.LastMethodSuccess = False Then Console.WriteLine("❌ HTTP-Anfrage fehlgeschlagen:") Console.WriteLine(http.LastErrorText) Return messages End If Console.WriteLine("📡 HTTP-Statuscode: " & resp.StatusCode) 'If resp.StatusCode <> 200 Then ' Console.WriteLine("❌ Fehler: Erwartet wurde Statuscode 200, erhalten: " & resp.StatusCode) ' Console.WriteLine("Antworttext:") ' Console.WriteLine(resp.BodyStr) ' Return messages 'End If If resp.StatusCode <> 200 Then Console.WriteLine("❌ Fehler: HTTP-Statuscode " & resp.StatusCode) Console.WriteLine(resp.BodyStr) Return New List(Of TAMessage)() End If Dim filePath As String = "" Dim jsonText As String = resp.BodyStr If jsonText = "{""messageCount"":0,""messages"":[]}" Then Console.WriteLine("⚠️ Keine Nachrichten gefunden.") Return messages End If SaveJsonResponseToFile(jsonText, TELOTEC_JSON, filePath) SaveJsonResponseTo_ATEZFTP(filePath) ' Übergabe an Parserfunktion Return ParseTAMessagesJson(jsonText, AnhEinlesen) End Function Public Function ParseTAMessagesFromFile(filePath As String, AnhEinlesen As Boolean) As List(Of TAMessage) Dim messages As New List(Of TAMessage)() If Not File.Exists(filePath) Then Console.WriteLine("❌ Datei nicht gefunden: " & filePath) Return messages End If Try Dim jsonText As String = File.ReadAllText(filePath, Encoding.UTF8) Return ParseTAMessagesJson(jsonText, AnhEinlesen) Catch ex As Exception Console.WriteLine("❌ Fehler beim Lesen/Verarbeiten der Datei: " & ex.Message) End Try Return messages End Function Public Function ParseTAMessagesJson(jsonText As String, AnhEinlesen As Boolean) As List(Of TAMessage) Dim messages As New List(Of TAMessage)() Dim json As New Chilkat.JsonObject() If Not json.Load(jsonText) Then Console.WriteLine("❌ Fehler beim Parsen des JSON.") Return messages End If Dim msgArray As Chilkat.JsonArray = json.ArrayOf("messages") If msgArray Is Nothing Then Return messages For i As Integer = 0 To msgArray.Size - 1 Dim jmsg As Chilkat.JsonObject = msgArray.ObjectAt(i) Dim msg As New TAMessage() msg.mrn = jmsg.StringOf("mrn") msg.lrn = jmsg.StringOf("lrn") msg.externalReference = jmsg.StringOf("externalReference") msg.msgType = jmsg.StringOf("msgType") Dim filePath As String = "" If AnhEinlesen Then ' 💾 Attachment speichern Dim attachmentB64 As String = jmsg.StringOf("attachment") If Not String.IsNullOrWhiteSpace(attachmentB64) AndAlso attachmentB64.ToString <> "null" Then SaveAttachmentBase64(attachmentB64, TELOTEC_ATTACHMENT_PATH, msg.lrn, filePath) End If End If Dim contentObj As Chilkat.JsonObject = jmsg.ObjectOf("declarationContent") If Not contentObj Is Nothing Then Dim decl As New TADeclaration() decl.filePath = filePath decl.mandant_ID = contentObj.StringOf("mandant_ID") decl.interfaceReferenceId = contentObj.StringOf("interfaceReferenceId") decl.ifcCustomerId = contentObj.StringOf("ifcCustomerId") decl.dec2_ID = SafeParseInt(contentObj.StringOf("dec2_ID")) decl.anmeldedatum = SafeParseDate(contentObj.StringOf("anmeldedatum")) decl.lrn = contentObj.StringOf("lrn") decl.mrn = contentObj.StringOf("mrn") decl.totNet = SafeParseDecimal(contentObj.StringOf("totNet")) decl.totNetSplit_IND = contentObj.BoolOf("totNetSplit_IND") decl.frankatur = contentObj.StringOf("frankatur") decl.flugInfo = contentObj.StringOf("flugInfo") decl.fillPackList_IND = contentObj.BoolOf("fillPackList_IND") decl.memo = contentObj.StringOf("memo") decl.erstellDatum = SafeParseDate(contentObj.StringOf("erstellDatum")) decl.erstellPersonalID = contentObj.StringOf("erstellPersonalID") decl.declarationType = contentObj.StringOf("declarationType") decl.additionalDeclarationType = contentObj.StringOf("additionalDeclarationType") decl.tirCarnetNumber = contentObj.StringOf("tirCarnetNumber") decl.presentationOfTheGoodsDateAndTime = SafeParseDate(contentObj.StringOf("presentationOfTheGoodsDateAndTime")) decl.security = SafeParseInt(contentObj.StringOf("security")) decl.reducedDatasetIndicator = contentObj.BoolOf("reducedDatasetIndicator") decl.specificCircumstanceIndicator = contentObj.StringOf("specificCircumstanceIndicator") decl.communicationLanguageAtDeparture = contentObj.StringOf("communicationLanguageAtDeparture") decl.bindingItinerary = contentObj.BoolOf("bindingItinerary") decl.limitDate = SafeParseDate(contentObj.StringOf("limitDate")) decl.declarationAcceptanceDate = SafeParseDate(contentObj.StringOf("declarationAcceptanceDate")) decl.releaseDate = SafeParseDate(contentObj.StringOf("releaseDate")) decl.writeOffDate = SafeParseDate(contentObj.StringOf("writeOffDate")) decl.countryOfDispatch = contentObj.StringOf("countryOfDispatch") decl.countryOfDestination = contentObj.StringOf("countryOfDestination") decl.containerIndicator = contentObj.BoolOf("containerIndicator") decl.inlandModeOfTransport = SafeParseInt(contentObj.StringOf("inlandModeOfTransport")) decl.modeOfTransportAtTheBorder = SafeParseInt(contentObj.StringOf("modeOfTransportAtTheBorder")) decl.grossMass = SafeParseDecimal(contentObj.StringOf("grossMass")) decl.methodOfPayment = contentObj.StringOf("methodOfPayment") decl.referenceNumberUCR = contentObj.StringOf("referenceNumberUCR") decl.locationOfGoods_CustomsOffice = contentObj.StringOf("locationOfGoods_CustomsOffice") decl.locationOfGoods_PlaceOfGoods = contentObj.StringOf("locationOfGoods_PlaceOfGoods") decl.placeOfLoading_UNLocode = contentObj.StringOf("placeOfLoading_UNLocode") decl.placeOfLoading_Country = contentObj.StringOf("placeOfLoading_Country") decl.placeOfLoading_Location = contentObj.StringOf("placeOfLoading_Location") decl.placeOfUnloading_UNLocode = contentObj.StringOf("placeOfUnloading_UNLocode") decl.placeOfUnloading_Country = contentObj.StringOf("placeOfUnloading_Country") decl.placeOfUnloading_Location = contentObj.StringOf("placeOfUnloading_Location") decl.customsOfficeOfDeparture = contentObj.StringOf("customsOfficeOfDeparture") decl.customsOfficeOfDestinationDeclared = contentObj.StringOf("customsOfficeOfDestinationDeclared") decl.customsOfficeOfPresentation = contentObj.StringOf("customsOfficeOfPresentation") decl.controlResult_Date = SafeParseDate(contentObj.StringOf("controlResult_Date")) decl.controlResult_ControlledBy = contentObj.StringOf("controlResult_ControlledBy") decl.controlResult_Text = contentObj.StringOf("controlResult_Text") decl.controlResult_Code = contentObj.StringOf("controlResult_Code") decl.groupId = contentObj.StringOf("groupId") decl.template_ID = SafeParseInt(contentObj.StringOf("template_ID")) ' Parsen von komplexen Objekten Dim arr1 = contentObj.ArrayOf("activeBorderTransportMeans") If arr1 IsNot Nothing Then decl.activeBorderTransportMeans = ParseActiveBorderTransportMeans(arr1) Dim c = contentObj.ObjectOf("carrier") If c IsNot Nothing Then decl.carrier = ParseCarrier(c) Dim arr2 = contentObj.ArrayOf("guarantee") If arr2 IsNot Nothing Then decl.guarantee = ParseGuarantee(arr2) msg.declarationContent = decl 'PARSE TO cTELANMEUNG '------------------------------- Else Console.WriteLine("⚠️ Keine declarationContent für Nachricht: " & msg.lrn) End If messages.Add(msg) Next Return messages End Function Public Sub SaveAttachmentBase64(base64String As String, ByVal TELOTEC_ATTACHMENT_PATH As String, filePrefix As String, ByRef filePath As String) Try If String.IsNullOrWhiteSpace(base64String) Then Exit Sub Dim yearDir As String = Path.Combine(TELOTEC_ATTACHMENT_PATH, Date.Now.Year.ToString()) Dim dayDir As String = Path.Combine(yearDir, Date.Now.ToString("yyyy-MM-dd")) Directory.CreateDirectory(dayDir) ' ❗️Unerlaubte Zeichen im Dateinamen ersetzen Dim invalidChars() As Char = Path.GetInvalidFileNameChars() For Each ch In invalidChars filePrefix = filePrefix.Replace(ch, "_"c) Next Dim fileName As String = filePrefix & "_" & Date.Now.ToString("HHmmss") & ".pdf" filePath = Path.Combine(dayDir, fileName) Dim fileBytes() As Byte = Convert.FromBase64String(base64String) File.WriteAllBytes(filePath, fileBytes) Console.WriteLine("📄 PDF gespeichert unter: " & filePath) Catch ex As Exception Console.WriteLine("❌ Fehler beim Speichern des Attachments: " & ex.Message) End Try End Sub ' FTP-Zugangsdaten Dim host As String = "91.93.197.91" ' Ersetze mit deinem FTP-Server Dim port As Integer = 22 Dim Username As String = "TELOTEC-PROD" Dim Password As String = "T18Y45O1W" 'Username: TELOTEC-TEST 'Password: V15GKM48 'Username: TELOTEC-PROD 'Password: T18Y45O1W Public Sub SaveJsonResponseTo_ATEZFTP(filePath As String) Try Dim remotePath As String = "/" & System.IO.Path.GetFileName(filePath) Using sftp As New SftpClient(host, port, Username, Password) sftp.Connect() Using fileStream As New System.IO.FileStream(filePath, System.IO.FileMode.Open) sftp.UploadFile(fileStream, remotePath) End Using sftp.Disconnect() End Using '' Dateiname aus dem Pfad extrahieren 'Dim fileName As String = System.IO.Path.GetFileName(filePath) 'Console.WriteLine("filePath: " & filePath) '' FTP-Ziel-URL zusammenbauen 'Dim ftpFullPath As String = $"{ftpServer}/{fileName}" '' FtpWebRequest erstellen 'Dim request As System.Net.FtpWebRequest = CType(System.Net.WebRequest.Create(ftpFullPath), System.Net.FtpWebRequest) 'request.Method = System.Net.WebRequestMethods.Ftp.UploadFile 'request.Credentials = New System.Net.NetworkCredential(ftpUsername, ftpPassword) 'request.UseBinary = True 'request.UsePassive = True 'request.KeepAlive = False '' Datei lesen und in Byte-Array umwandeln 'Dim fileContents() As Byte = System.IO.File.ReadAllBytes(filePath) 'request.ContentLength = fileContents.Length '' Stream öffnen und Datei senden 'Using requestStream As System.IO.Stream = request.GetRequestStream() ' requestStream.Write(fileContents, 0, fileContents.Length) 'End Using '' Antwort vom Server holen 'Using response As System.Net.FtpWebResponse = CType(request.GetResponse(), System.Net.FtpWebResponse) ' Console.WriteLine("Upload abgeschlossen, Status: " & response.StatusDescription) 'End Using Catch ex As Exception Console.WriteLine("Fehler beim Upload: " & ex.Message) End Try End Sub Public Sub SaveJsonResponseToFile(jsonText As String, ByVal TELOTEC_JSON As String, ByRef filePath As String) Try Dim yearDir As String = Path.Combine(TELOTEC_JSON, Date.Now.Year.ToString()) Dim dayDir As String = Path.Combine(yearDir, Date.Now.ToString("dd.MM.yyyy")) Directory.CreateDirectory(dayDir) Dim fileName As String = "GetTAMessages_" & Date.Now.ToString("ddMMyyyy_HHmmss_fff") & ".json" filePath = Path.Combine(dayDir, fileName) File.WriteAllText(filePath, jsonText, Encoding.UTF8) Console.WriteLine("📁 JSON gespeichert unter: " & filePath) Catch ex As Exception Console.WriteLine("❌ Fehler beim Speichern des JSON: " & ex.Message) End Try End Sub Function SafeParseDate(value As String) As Date? If String.IsNullOrWhiteSpace(value) OrElse value = "null" Then Return Nothing End If Return Date.Parse(value) End Function Function SafeParseDecimal(value As String) As Decimal Dim result As Decimal If Decimal.TryParse(value, result) Then Return result Else Return 0D End If End Function Function SafeParseInt(value As String) As Integer Dim result As Integer If Integer.TryParse(value, result) Then Return result Else Return 0 End If End Function ' Parser für Liste: activeBorderTransportMeans Function ParseActiveBorderTransportMeans(arr As JsonArray) As List(Of BorderTransportMeans) Dim result As New List(Of BorderTransportMeans)() For i As Integer = 0 To arr.Size - 1 Dim item As JsonObject = arr.ObjectAt(i) Dim obj As New BorderTransportMeans() obj.sequenceNumber = item.IntOf("sequenceNumber") obj.customsOfficeAtBorderReferenceNumber = item.StringOf("customsOfficeAtBorderReferenceNumber") obj.typeOfIdentification = item.IntOf("typeOfIdentification") obj.identificationNumber = item.StringOf("identificationNumber") obj.nationality = item.StringOf("nationality") obj.conveyanceReferenceNumber = item.StringOf("conveyanceReferenceNumber") result.Add(obj) Next Return result End Function ' Parser für carrier (PartyWithContact) Function ParseCarrier(obj As JsonObject) As PartyWithContact If obj Is Nothing Then Return Nothing Dim party As New PartyWithContact() party.identificationNumber = obj.StringOf("identificationNumber") party.contactPersonName = obj.StringOf("contactPersonName") party.phoneNumber = obj.StringOf("phoneNumber") party.eMailAddress = obj.StringOf("eMailAddress") party.customerAddressReference = obj.StringOf("customerAddressReference") party.adressID = obj.IntOf("adressID") Return party End Function ' Parser für guarantee Function ParseGuarantee(arr As JsonArray) As List(Of Guarantee) Dim list As New List(Of Guarantee)() For i As Integer = 0 To arr.Size - 1 Dim obj As JsonObject = arr.ObjectAt(i) Dim g As New Guarantee() g.sequenceNumber = obj.IntOf("sequenceNumber") g.guaranteeType = obj.StringOf("guaranteeType") g.otherGuaranteeReference = obj.StringOf("otherGuaranteeReference") Dim gRefArray As JsonArray = obj.ArrayOf("guaranteeReference") If Not gRefArray Is Nothing Then g.guaranteeReference = New List(Of GuaranteeReference)() For j As Integer = 0 To gRefArray.Size - 1 Dim grefObj As JsonObject = gRefArray.ObjectAt(j) Dim gr As New GuaranteeReference() gr.sequenceNumber = grefObj.IntOf("sequenceNumber") gr.grn = grefObj.StringOf("grn") gr.accessCode = grefObj.StringOf("accessCode") ' gr.amountToBeCovered = grefObj.StringOf("amountToBeCovered") Dim tmp As String = grefObj.StringOf("amountToBeCovered") If Not String.IsNullOrEmpty(tmp) Then gr.amountToBeCovered = Double.Parse(tmp, CultureInfo.InvariantCulture) Else gr.amountToBeCovered = 0 End If gr.currency = grefObj.StringOf("currency") g.guaranteeReference.Add(gr) Next End If list.Add(g) Next Return list End Function Public Class StoreTADeclarationsRequest Public Property allowExistingReferenceId As Boolean Public Property enableGrouping As Boolean Public Property declarations As List(Of TADeclaration) End Class Public Class TADeclaration Public Property filePath As String ' Wenn anhang vorhanden ist, wird der Pfad hier gespeichert Public Property mandant_ID As String Public Property interfaceReferenceId As String Public Property ifcCustomerId As String Public Property dec2_ID As Integer Public Property anmeldedatum As Object Public Property lrn As String Public Property mrn As String Public Property totNet As Decimal Public Property totNetSplit_IND As Boolean Public Property frankatur As String Public Property flugInfo As String Public Property fillPackList_IND As Boolean Public Property memo As String Public Property erstellDatum As Object Public Property erstellPersonalID As String Public Property declarationType As String Public Property additionalDeclarationType As String Public Property tirCarnetNumber As String Public Property presentationOfTheGoodsDateAndTime As Object Public Property security As Integer Public Property reducedDatasetIndicator As Boolean Public Property specificCircumstanceIndicator As String Public Property communicationLanguageAtDeparture As String Public Property bindingItinerary As Boolean Public Property limitDate As Object Public Property declarationAcceptanceDate As Object Public Property releaseDate As Object Public Property writeOffDate As Object Public Property countryOfDispatch As String Public Property countryOfDestination As String Public Property containerIndicator As Boolean Public Property inlandModeOfTransport As Integer Public Property modeOfTransportAtTheBorder As Integer Public Property grossMass As Decimal Public Property methodOfPayment As String Public Property referenceNumberUCR As String Public Property locationOfGoods_CustomsOffice As String Public Property locationOfGoods_PlaceOfGoods As String Public Property placeOfLoading_UNLocode As String Public Property placeOfLoading_Country As String Public Property placeOfLoading_Location As String Public Property placeOfUnloading_UNLocode As String Public Property placeOfUnloading_Country As String Public Property placeOfUnloading_Location As String Public Property customsOfficeOfDeparture As String Public Property customsOfficeOfDestinationDeclared As String Public Property customsOfficeOfPresentation As String Public Property controlResult_Date As Object Public Property controlResult_ControlledBy As String Public Property controlResult_Text As String Public Property controlResult_Code As String Public Property groupId As String Public Property template_ID As Integer ' Nested/Complex Properties Public Property activeBorderTransportMeans As List(Of BorderTransportMeans) Public Property additionalInformation As List(Of AdditionalInformation) Public Property additionalReference As List(Of AdditionalReference) Public Property additionalSupplyChainActor As List(Of SupplyChainActor) Public Property authorisation As List(Of Authorisation) Public Property carrier As PartyWithContact Public Property consignee As PartyWithAddress Public Property consignor As PartyWithContact Public Property countryOfRoutingOfConsignment As List(Of RoutingCountry) Public Property customsOfficeOfExitForTransitDeclared As List(Of SimpleReference) Public Property customsOfficeOfTransitDeclared As List(Of TransitOffice) Public Property departureTransportMeans As List(Of DepartureTransportMeans) Public Property guarantee As List(Of Guarantee) Public Property guarantor As PartyWithAddress Public Property holderOfTheTransitProcedure As PartyWithContact Public Property houseConsignment As List(Of HouseConsignment) Public Property previousDocument As List(Of PreviousDocument) Public Property representative As PartyWithContact Public Property supportingDocument As List(Of SupportingDocument) Public Property transportDocument As List(Of TransportDocument) Public Property transportEquipment As List(Of TransportEquipment) End Class Public Class BorderTransportMeans Public Property sequenceNumber As Integer Public Property customsOfficeAtBorderReferenceNumber As String Public Property typeOfIdentification As Integer Public Property identificationNumber As String Public Property nationality As String Public Property conveyanceReferenceNumber As String End Class Public Class AdditionalInformation Public Property sequenceNumber As Integer Public Property code As String Public Property text As String End Class Public Class AdditionalReference Public Property sequenceNumber As Integer Public Property type As String Public Property referenceNumber As String End Class Public Class SupplyChainActor Public Property sequenceNumber As Integer Public Property role As String Public Property identificationNumber As String Public Property customerAddressReference As String Public Property adressID As Integer End Class Public Class Authorisation Public Property sequenceNumber As Integer Public Property type As String Public Property referenceNumber As String End Class Public Class PartyWithContact Public Property identificationNumber As String Public Property contactPersonName As String Public Property phoneNumber As String Public Property eMailAddress As String Public Property customerAddressReference As String Public Property adressID As Integer End Class Public Class PartyWithAddress Public Property identificationNumber As String Public Property consigneeName As String Public Property streetAndNumber As String Public Property postcode As String Public Property city As String Public Property country As String Public Property customerAddressReference As String Public Property adressID As Integer End Class Public Class RoutingCountry Public Property sequenceNumber As Integer Public Property country As String End Class Public Class SimpleReference Public Property sequenceNumber As Integer Public Property referenceNumber As String End Class Public Class TransitOffice Public Property sequenceNumber As Integer Public Property referenceNumber As String Public Property arrivalDateAndTimeEstimated As Object End Class Public Class DepartureTransportMeans Public Property sequenceNumber As Integer Public Property typeOfIdentification As Integer Public Property identificationNumber As String Public Property nationality As String End Class Public Class Guarantee Public Property sequenceNumber As Integer Public Property guaranteeType As String Public Property otherGuaranteeReference As String Public Property guaranteeReference As List(Of GuaranteeReference) End Class Public Class GuaranteeReference Public Property sequenceNumber As Integer Public Property grn As String Public Property accessCode As String Public Property amountToBeCovered As Decimal Public Property currency As String End Class Public Class HouseConsignment ' This would also need to include full nested structure like consignor, consignee, etc. End Class Public Class PreviousDocument Public Property sequenceNumber As Integer Public Property type As String Public Property referenceNumber As String Public Property complementOfInformation As String End Class Public Class SupportingDocument Public Property sequenceNumber As Integer Public Property type As String Public Property referenceNumber As String Public Property documentLineItemNumber As Integer Public Property complementOfInformation As String End Class Public Class TransportDocument Public Property sequenceNumber As Integer Public Property type As String Public Property referenceNumber As String End Class Public Class TransportEquipment Public Property sequenceNumber As Integer Public Property containerIdentificationNumber As String Public Property numberOfSeals As Integer Public Property goodsReference As List(Of GoodsReference) Public Property seal As List(Of Seal) End Class Public Class GoodsReference Public Property sequenceNumber As Integer Public Property declarationGoodsItemNumber As Integer End Class Public Class Seal Public Property sequenceNumber As Integer Public Property identifier As String End Class Public Class TAMessage Public Property mrn As String Public Property lrn As String Public Property externalReference As String Public Property msgType As String Public Property declarationContent As TADeclaration End Class End Class