CBAM Auswertung; Verzollungspreise; T2 aus EXG manuell
This commit is contained in:
@@ -78,7 +78,7 @@ Public Class cHMRC_ENS
|
||||
|
||||
Return False
|
||||
End Function
|
||||
Shared Function insertENS(ENS_CC315A As CC315AType, ByVal responseStr As String) As Boolean
|
||||
Shared Function insertENS(ENS_CC315A As CC315AType, ByVal responseStr As String, Optional forceRefrehtoken As Boolean = False) As Boolean
|
||||
Try
|
||||
' Chilkat-Objekt initialisieren
|
||||
' Dim http As New Chilkat.Http()
|
||||
@@ -128,7 +128,7 @@ Public Class cHMRC_ENS
|
||||
|
||||
|
||||
|
||||
Dim TOKEN = cHMRC.getTOKEN("ENS")
|
||||
Dim TOKEN = cHMRC.getTOKEN("ENS", forceRefrehtoken)
|
||||
|
||||
If TOKEN.hasEntry Then
|
||||
|
||||
@@ -143,13 +143,22 @@ Public Class cHMRC_ENS
|
||||
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
||||
|
||||
' Setzen des Content-Type-Headers für die Anfrage
|
||||
|
||||
If cHMRC_ENS.TEST Then
|
||||
Dim mode = "Accept"
|
||||
http.SetRequestHeader("simulateRiskingResponse", mode)
|
||||
http.SetRequestHeader("simulateInterventionResponse", True)
|
||||
|
||||
|
||||
|
||||
End If
|
||||
http.SetRequestHeader("Content-Type", "application/xml; charset=UTF-8")
|
||||
|
||||
' Definieren Sie die URL für die POST-Anfrage
|
||||
Dim urlHTTP As String = url & "/customs/imports/declarations"
|
||||
Dim xmlContent As String = ENS_CC315A.Serialize
|
||||
|
||||
' xmlContent = File.ReadAllText("D:\Andreas\TMP\CC315A_Example1.xml")
|
||||
xmlContent = File.ReadAllText("D:\Andreas\TMP\CC315A_Example1.xml")
|
||||
|
||||
MsgBox(xmlContent)
|
||||
' Senden Sie die POST-Anfrage mit dem XML-Inhalt
|
||||
@@ -275,31 +284,46 @@ Public Class cHMRC_ENS
|
||||
|
||||
|
||||
' Erstellen Sie eine Instanz des Http-Objekts
|
||||
Dim http As New Chilkat.Http()
|
||||
Dim http As New Chilkat.Http
|
||||
|
||||
' Authentifizierung: Setzen des Bearer-Tokens
|
||||
http.AuthToken = TOKEN.token_BEARER_TOKEN
|
||||
|
||||
' Token hinzufügen (z. B. Bearer Token für Authentifizierung)
|
||||
http.SetRequestHeader("Authorization", "Bearer " & TOKEN.token_BEARER_TOKEN)
|
||||
|
||||
' Setzen des Accept-Headers für die erwartete Antwort im XML-Format
|
||||
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
||||
|
||||
' Setzen des Content-Type-Headers (kann erforderlich sein)
|
||||
http.SetRequestHeader("Content-Type", "application/xml")
|
||||
http.SetRequestHeader("Content-Type", "application/xml; charset=UTF-8")
|
||||
|
||||
If cHMRC_ENS.TEST Then
|
||||
Dim mode = "Accept"
|
||||
http.SetRequestHeader("simulateRiskingResponse", mode)
|
||||
End If
|
||||
|
||||
' Definieren Sie die URL für die PUT-Anfrage
|
||||
Dim urlHttp As String = url & "/customs/imports/declarations/{" & MRN & "}"
|
||||
Dim urlHttp As String = url & "/customs/imports/declarations/" & MRN & ""
|
||||
|
||||
' Senden Sie die PUT-Anfrage ohne Body
|
||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("PUT", urlHttp)
|
||||
Dim xmlContent = File.ReadAllText("D:\Andreas\TMP\example_Amend.xml")
|
||||
|
||||
MsgBox(xmlContent)
|
||||
' Senden Sie die POST-Anfrage mit dem XML-Inhalt
|
||||
|
||||
|
||||
' Sende die PUT-Anfrage mit XML-Daten
|
||||
|
||||
Dim response As Chilkat.HttpResponse = http.PText("PUT", urlHttp, xmlContent, "utf-8", "application/xml", False, False)
|
||||
' Dim response As Chilkat.HttpResponse = http.QuickRequest("PUT", urlHttp)
|
||||
|
||||
If (http.LastMethodSuccess = False) Then
|
||||
Console.WriteLine("❌ Fehler bei der Anfrage: " & http.LastErrorText)
|
||||
Console.WriteLine("Fehler bei der Anfrage: " & http.LastErrorText)
|
||||
Return False
|
||||
End If
|
||||
|
||||
' Überprüfen Sie den HTTP-Statuscode der Antwort
|
||||
If (response.StatusCode = 200) Then
|
||||
Console.WriteLine("✅ Entry Summary Declaration erfolgreich geändert.")
|
||||
Console.WriteLine("Entry Summary Declaration erfolgreich geändert.")
|
||||
Console.WriteLine("Antwort:")
|
||||
Console.WriteLine(response.BodyStr) ' XML-Ausgabe der Antwort
|
||||
|
||||
@@ -432,8 +456,15 @@ Public Class cHMRC_ENS
|
||||
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
||||
|
||||
' Definieren Sie die URL für die GET-Anfrage
|
||||
Dim urlHttp As String = url & "/customs/imports/outcomes/{" & correlationId & "}"
|
||||
|
||||
'If cHMRC_ENS.TEST Then
|
||||
' Dim mode = "Accept"
|
||||
' http.SetRequestHeader("simulateRiskingResponse", mode)
|
||||
'End If
|
||||
|
||||
|
||||
Dim urlHttp As String = url & "/customs/imports/outcomes/" & correlationId & ""
|
||||
MsgBox(urlHttp)
|
||||
' Senden Sie die GET-Anfrage
|
||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("GET", urlHttp)
|
||||
|
||||
@@ -572,10 +603,10 @@ Public Class cHMRC_ENS
|
||||
' Setzen des Content-Type-Headers für die Anfrage
|
||||
http.SetRequestHeader("Content-Type", "application/xml")
|
||||
|
||||
' Definieren Sie die URL für die POST-Anfrage
|
||||
Dim urlHttp As String = url & "/customs/imports/outcomes/{" & correlationId & "}"
|
||||
' Definieren Sie die URL für die POST-Anfrage
|
||||
Dim urlHttp As String = url & "/customs/imports/outcomes/" & correlationId & ""
|
||||
' Senden Sie die POST-Anfrage ohne Body
|
||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("POST", urlHttp)
|
||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("DELETE", urlHttp)
|
||||
|
||||
If (http.LastMethodSuccess = False) Then
|
||||
Console.WriteLine("Fehler bei der Anfrage: " & http.LastErrorText)
|
||||
@@ -583,7 +614,7 @@ Public Class cHMRC_ENS
|
||||
End If
|
||||
|
||||
' Überprüfen Sie den HTTP-Statuscode der Antwort
|
||||
If (response.StatusCode = 204) Then
|
||||
If (response.StatusCode = 200) Then
|
||||
Console.WriteLine("✅ Benachrichtigung erfolgreich bestätigt.")
|
||||
Return True
|
||||
Else
|
||||
@@ -746,10 +777,10 @@ Public Class cHMRC_ENS
|
||||
' Setzen des Content-Type-Headers für die Anfrage
|
||||
http.SetRequestHeader("Content-Type", "application/xml")
|
||||
|
||||
' Definieren Sie die URL für die POST-Anfrage
|
||||
Dim urlHttp As String = url & "/customs/imports/notifications/{" & notificationID & "}/acknowledge"
|
||||
' Definieren Sie die URL für die POST-Anfrage
|
||||
Dim urlHttp As String = url & "/customs/imports/notifications/" & notificationID & ""
|
||||
' Senden Sie die POST-Anfrage ohne Body
|
||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("POST", urlHttp)
|
||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("DELETE", urlHttp)
|
||||
|
||||
If (http.LastMethodSuccess = False) Then
|
||||
Console.WriteLine("Fehler bei der Anfrage: " & http.LastErrorText)
|
||||
@@ -803,7 +834,8 @@ Public Class cHMRC_ENS
|
||||
http.SetRequestHeader("Accept", "application/vnd.hmrc.1.0+xml")
|
||||
|
||||
' Definieren Sie die URL für die GET-Anfrage
|
||||
Dim urlHttp As String = url & "/customs/imports/notifications/{" & notificationID & "}"
|
||||
|
||||
Dim urlHttp As String = url & "/customs/imports/notifications/" & notificationID & ""
|
||||
|
||||
' Senden Sie die GET-Anfrage
|
||||
Dim response As Chilkat.HttpResponse = http.QuickRequest("GET", urlHttp)
|
||||
|
||||
Reference in New Issue
Block a user