Artikelstamm, EZA Vorlagen XLS, WiseApi
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Web
|
||||
Imports System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel
|
||||
Imports Newtonsoft.Json
|
||||
Imports VERAG_PROG_ALLGEMEIN.cATEZ_Tariff
|
||||
@@ -27,6 +28,75 @@ Public Class cATEZ_Tariff
|
||||
Public Property description As String
|
||||
End Class
|
||||
|
||||
Public Shared Function GetFullTariff_Only1Result(commodityCode As String, fromCountry As String, Optional toCountry As String = "EU", Optional languageCode As String = "DE") As String
|
||||
Dim list As New List(Of String)
|
||||
list.Add(commodityCode)
|
||||
|
||||
Dim COMM_TARIFF = VERAG_PROG_ALLGEMEIN.cATEZ_Tariff.GetTariffInfo(list, fromCountry, toCountry)
|
||||
|
||||
Dim result = COMM_TARIFF.Find(Function(x) x.code = commodityCode)
|
||||
Dim found = False
|
||||
|
||||
If result IsNot Nothing Then
|
||||
If result.error <> "" Then
|
||||
'Error bei der Abfrage der TNR
|
||||
' MsgBox(result.error)
|
||||
|
||||
Else
|
||||
''Bei einem Ergebnis -> Treffer
|
||||
|
||||
If result.mappings.Count > 0 Then
|
||||
If result.mappings.Count = 1 Then
|
||||
found = True
|
||||
Return result.mappings(0).commodity_code
|
||||
Else
|
||||
|
||||
found = True
|
||||
Return "" ' -> problem
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
Public Shared Function GetFullTariff(commodityCode As String, fromCountry As String, Optional toCountry As String = "EU", Optional languageCode As String = "DE") As List(Of String)
|
||||
Dim Resultlist As New List(Of String)
|
||||
Dim list As New List(Of String)
|
||||
list.Add(commodityCode)
|
||||
|
||||
Dim COMM_TARIFF = VERAG_PROG_ALLGEMEIN.cATEZ_Tariff.GetTariffInfo(list, fromCountry, toCountry)
|
||||
|
||||
Dim result = COMM_TARIFF.Find(Function(x) x.code = commodityCode)
|
||||
Dim found = False
|
||||
|
||||
If result IsNot Nothing Then
|
||||
If result.error <> "" Then
|
||||
'Error bei der Abfrage der TNR
|
||||
' MsgBox(result.error)
|
||||
|
||||
Else
|
||||
''Bei einem Ergebnis -> Treffer
|
||||
|
||||
If result.mappings.Count > 0 Then
|
||||
If result.mappings.Count = 1 Then
|
||||
found = True
|
||||
Resultlist.Add(result.mappings(0).commodity_code)
|
||||
Else
|
||||
For Each item In result.mappings.OfType(Of VERAG_PROG_ALLGEMEIN.cATEZ_Tariff.cATEZ_TariffItem_Mapping)()
|
||||
If item.commodity_code IsNot Nothing AndAlso item.commodity_code <> "" Then
|
||||
Resultlist.Add(item.commodity_code)
|
||||
End If
|
||||
Next
|
||||
|
||||
found = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Return Resultlist
|
||||
End Function
|
||||
|
||||
Public Shared Function GetTariffInfo(commodities As List(Of String), fromCountry As String, Optional toCountry As String = "EU", Optional languageCode As String = "DE") As List(Of cATEZ_TariffItem_RootItem)
|
||||
Try
|
||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||
|
||||
46
VERAG_PROG_ALLGEMEIN/Schnittstellen/WISE/cWiseBankApi.vb
Normal file
46
VERAG_PROG_ALLGEMEIN/Schnittstellen/WISE/cWiseBankApi.vb
Normal file
@@ -0,0 +1,46 @@
|
||||
Imports System.Net
|
||||
Imports System.IO
|
||||
Imports System.Text
|
||||
Imports Newtonsoft.Json
|
||||
|
||||
Public Class cWiseBankApi
|
||||
|
||||
Private ReadOnly apiToken As String
|
||||
Private ReadOnly profileId As String
|
||||
Private ReadOnly balanceId As String
|
||||
|
||||
Public Sub New(token As String, profile As String, balance As String)
|
||||
apiToken = token
|
||||
profileId = profile
|
||||
balanceId = balance
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Ruft die Kontoumsätze der letzten 7 Tage ab.
|
||||
''' </summary>
|
||||
Public Function GetLast7DaysStatement() As String
|
||||
Dim fromDate As String = DateTime.UtcNow.AddDays(-7).ToString("yyyy-MM-dd")
|
||||
Dim toDate As String = DateTime.UtcNow.ToString("yyyy-MM-dd")
|
||||
|
||||
Dim url As String =
|
||||
$"https://api.wise.com/v4/profiles/{profileId}/balance-statements/{balanceId}/statement.json?intervalStart={fromDate}&intervalEnd={toDate}"
|
||||
|
||||
Dim request As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
|
||||
request.Method = "GET"
|
||||
request.Headers.Add("Authorization", "Bearer " & apiToken)
|
||||
|
||||
Try
|
||||
Using response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
|
||||
Using reader As New StreamReader(response.GetResponseStream())
|
||||
Return reader.ReadToEnd()
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As WebException
|
||||
Using sr As New StreamReader(ex.Response.GetResponseStream())
|
||||
Dim errorText = sr.ReadToEnd()
|
||||
Throw New Exception("Wise API Fehler: " & errorText)
|
||||
End Using
|
||||
End Try
|
||||
End Function
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user