CBAM kafka, NCTS Fremd(Tobb), realyhub

This commit is contained in:
2025-10-23 11:33:14 +02:00
parent e0c06d3c2f
commit 6d1e68157d
22 changed files with 1973 additions and 23 deletions

View File

@@ -62,7 +62,7 @@ Public Class cRelayHub
Public Class cRelayHubAddress
Public Property addressType As String
Public Property participantEORI As String
Public Property participantSubsidiaryNumber As String
Public Property participantSubsidiaryNumber As Integer
Public Property companyName As String
Public Property streetAndNumber As String
Public Property countryCode As String
@@ -131,7 +131,21 @@ Public Class cRelayHub
Try
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
Dim jsonPayload As String = JsonConvert.SerializeObject(request)
Dim sanitized = Sanitize(request)
Dim settings As New JsonSerializerSettings With {
.NullValueHandling = NullValueHandling.Ignore,
.ContractResolver = New Newtonsoft.Json.Serialization.DefaultContractResolver With {
.NamingStrategy = New Newtonsoft.Json.Serialization.CamelCaseNamingStrategy()
}
}
Dim jsonPayload As String = JsonConvert.SerializeObject(sanitized, settings)
Console.WriteLine("JSON → " & jsonPayload)
'Dim jsonPayload As String = JsonConvert.SerializeObject(request)
' 1. Versuch
Dim response As Chilkat.HttpResponse = SendJobOrder(jsonPayload)
@@ -208,6 +222,26 @@ Public Class cRelayHub
End Try
End Function
Private Shared Function Sanitize(req As cRelayHub.cRelayHubJobOrderRequest) As cRelayHub.cRelayHubJobOrderRequest
req.outputApplication = If(req.outputApplication, "").Trim()
req.dispatchCountry = If(req.dispatchCountry, "").Trim().ToUpperInvariant()
req.destinationCountry = If(req.destinationCountry, "").Trim().ToUpperInvariant()
' lokale Fail-fast Checks
If req.dispatchCountry.Length <> 2 Then Throw New ApplicationException("dispatchCountry ISO-2 erforderlich.")
If req.destinationCountry.Length <> 2 Then Throw New ApplicationException("destinationCountry ISO-2 erforderlich.")
Dim allowed = New HashSet(Of String)(StringComparer.Ordinal) From {
"test", "dakosy/sftp/vera", "evrim/excel", "sec/import/integration"
}
If Not allowed.Contains(req.outputApplication) Then
Throw New ApplicationException("outputApplication muss 'test' | 'dakosy/sftp/vera' | 'evrim/excel' | 'sec/import/integration' sein.")
End If
If req.regimeType <> "IMPORT" AndAlso req.regimeType <> "EXPORT" Then
Throw New ApplicationException("regimeType muss 'IMPORT' oder 'EXPORT' sein.")
End If
Return req
End Function
' Beispielfall
Function CreateSampleJobOrderRequest() As cRelayHubJobOrderRequest
Dim req As New cRelayHubJobOrderRequest With {