Creditsafe Verbesserungen, Mehrfach-UID-Verwendung eingebaut.

This commit is contained in:
2023-04-24 13:14:35 +02:00
parent 9519d0612a
commit b4bb2a04a6
6 changed files with 2155 additions and 2128 deletions

View File

@@ -206,13 +206,23 @@ Public Class cCreditSafeAPI
End Function
Shared Function getReport(ByRef company As Company, withPDF As Boolean, ByRef bytes As Byte()) As String
Dim myUrl As String = API_STRING & "/v1/companies/" & company.creditSafeId
myUrl &= "/?language=DE"
myUrl &= "&?template=full"
Dim myUrl As String = API_STRING & "/v1/companies/" & company.creditSafeId & "/"
If company.country = "DE" Then
'Abfragen für DE benötigen einen Reason-Code
myUrl &= "?customData=de_reason_code::2"
myUrl &= "&?language=DE&?template=full"
Else
myUrl &= "?language=DE&?template=full"
End If
Dim acceptContentType = "application/json"
If withPDF Then
acceptContentType &= "+pdf"
End If
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, Nothing, acceptContentType, "GET", token)
Dim json As New Chilkat.JsonObject
@@ -244,14 +254,14 @@ Public Class cCreditSafeAPI
If (json.LastMethodSuccess = True) Then
Dim companyIDObj As Chilkat.JsonObject = reportObj.ObjectOf("companyIdentification")
If (json.LastMethodSuccess = True) Then
If (reportObj.LastMethodSuccess = True) Then
Dim basicInfoObj As Chilkat.JsonObject = companyIDObj.ObjectOf("basicInformation")
If (json.LastMethodSuccess = True) Then
If (companyIDObj.LastMethodSuccess = True) Then
Dim dateTime As New Chilkat.CkDateTime
Dim getAsLocal As Boolean = False
basicInfoObj.DateOf("companyRegistrationDate", DateTime)
basicInfoObj.DateOf("companyRegistrationDate", dateTime)
company.csDFoundingDate = dateTime.GetAsTimestamp(getAsLocal)
Debug.WriteLine(dateTime)
@@ -266,23 +276,23 @@ Public Class cCreditSafeAPI
Dim creditScoreObj As Chilkat.JsonObject = reportObj.ObjectOf("creditScore")
If (json.LastMethodSuccess = True) Then
If (reportObj.LastMethodSuccess = True) Then
Dim creditRatingObj As Chilkat.JsonObject = creditScoreObj.ObjectOf("currentCreditRating")
If (json.LastMethodSuccess = True) Then
If (creditScoreObj.LastMethodSuccess = True) Then
company.csRiskclass = creditRatingObj.StringOf("commonValue")
Dim creditLimitObj As Chilkat.JsonObject = creditRatingObj.ObjectOf("creditLimit")
If (json.LastMethodSuccess = True) Then
If (creditRatingObj.LastMethodSuccess = True) Then
company.csMaxCreditAmount = creditLimitObj.StringOf("value")
Else
Debug.WriteLine("creditRating object not found.")
End If
Dim providerValueObj As Chilkat.JsonObject = creditRatingObj.ObjectOf("providerValue")
If (json.LastMethodSuccess = True) Then
If (creditRatingObj.LastMethodSuccess = True) Then
company.csIndex = providerValueObj.StringOf("value")
Else
Debug.WriteLine("providerValue object not found.")
@@ -301,8 +311,7 @@ Public Class cCreditSafeAPI
End If
Else
Debug.WriteLine("report object not found.")
Return "report object not found"
company.csFailure = json.StringOf("details")
End If
If withPDF Then
@@ -399,9 +408,10 @@ Public Class cCreditSafeAPI
Public Property lastChecked As Date
Public Property csIndex As String
Public Property csRiskclass As String
Public Property csMaxCreditAmount As Double
Public Property csMaxCreditAmount As String
Public Property csDFoundingDate As Date
Public Property csPDF As String
Public Property csFailure As String
Public Sub New(_name As String, _vatNo As String, _country As String, _creditsafeNo As String, _creditSafeId As String, _lastChecked As Date)