CreditsafeAPI erweitert, zusätzlicher Hinweis bei bereits existierender UID-Nr.

This commit is contained in:
2023-03-31 17:15:27 +02:00
parent fcaf27b69c
commit e0e5c2c1bc
9 changed files with 2262 additions and 2157 deletions

View File

@@ -97,18 +97,24 @@ Public Class cCreditSafeAPI
If company IsNot Nothing Then
rest.AddQueryParam("countries", company.country)
If company.creditsafeNo <> "" Then
rest.AddQueryParam("safeNo", company.creditsafeNo)
If company.vatNo <> "" Then
rest.AddQueryParam("vatNo", company.vatNo)
Else
If company.name <> "" Then
rest.AddQueryParam("name", company.name)
If company.vatNo <> "" Then
rest.AddQueryParam("vatNo", company.vatNo)
Else
If company.name <> "" Then
rest.AddQueryParam("name", company.name)
End If
End If
End If
If company.country <> "" Then
rest.AddQueryParam("countries", company.country)
End If
End If
rest.AddHeader("Content-Type", "application/json")
@@ -146,12 +152,11 @@ Public Class cCreditSafeAPI
Shared Function searchCompanies(conpanyname As String, vatNo As String, country As String, ByRef dataTable As DataTable) As String
Shared Function searchCompanies(company As Company, ByRef dataTable As DataTable) As String
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
Dim myUrl As String = API_STRING & "/v1/companies"
Dim company = New Company(conpanyname, vatNo, country)
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "application/json", "GET", token)
@@ -218,8 +223,8 @@ Public Class cCreditSafeAPI
End Function
Shared Function companyCreditreport(id As String, Optional withPDF As Boolean = False) As String
Dim myUrl As String = API_STRING & "/v1/companies/" & id
Shared Function getReport(company As Company, withPDF As Boolean) As String
Dim myUrl As String = API_STRING & "/v1/companies/" & company.creditSafeId
Dim acceptContentType = "application/json"
If withPDF Then
acceptContentType &= "+pdf"
@@ -240,6 +245,33 @@ Public Class cCreditSafeAPI
Return "test"
End Function
Shared Function checkDateOfLastRequest(company As Company) As Date
Dim myUrl As String = API_STRING & "/v1/companies"
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "application/json", "GET", token)
Dim json As New Chilkat.JsonObject
Dim success As Boolean = json.Load(jsonRespString)
If (success <> True) Then
Debug.WriteLine(json.LastErrorText)
Return "Verbindungsfehler"
End If
Dim companies As Chilkat.JsonArray = json.ArrayOf("companies")
Dim compObj As Chilkat.JsonObject = companies.ObjectAt(0)
Dim dateTime As New Chilkat.CkDateTime
Dim dt As New Chilkat.DtObj
Dim getAsLocal As Boolean = False
success = compObj.DateOf("dateOfLatestChange", dateTime)
Debug.WriteLine(dateTime.GetAsTimestamp(getAsLocal))
Return dateTime.GetAsTimestamp(getAsLocal)
End Function
@@ -262,18 +294,25 @@ Public Class cCreditSafeAPI
Public Class Company
Public Property creditSafeId As String
Public Property name As String
Public Property vatNo As String
Public Property country As String
Public Property creditsafeNo As String
Public Property lastChecked As Date
Public Sub New(_name As String, _vatNo As String, _country As String)
Public Sub New(_name As String, _vatNo As String, _country As String, _creditsafeNo As String, _creditSafeId As String, _lastChecked As Date)
creditSafeId = _creditSafeId
name = _name
vatNo = _vatNo
country = _country
creditsafeNo = _creditsafeNo
lastChecked = _lastChecked
End Sub
Public Sub New()
End Sub
End Class
End Class