credtisafe -> korrekter bericht wird nun als pdf angefügt
This commit is contained in:
@@ -107,15 +107,32 @@ Public Class cCreditSafeAPI
|
||||
rest.AddHeader("Accept", acceptContentType)
|
||||
|
||||
|
||||
Dim responseJson As String
|
||||
Dim pdfData As New Chilkat.BinData
|
||||
|
||||
Dim responseJson As String = rest.FullRequestNoBody(method, url)
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
MsgBox(rest.LastErrorText)
|
||||
If acceptContentType.Contains("application/pdf") Then
|
||||
|
||||
responseJson = rest.FullRequestNoBodyBd(method, url, pdfData)
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
MsgBox(rest.LastErrorText)
|
||||
Else
|
||||
Return pdfData.ToString
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
responseJson = rest.FullRequestNoBody(method, url)
|
||||
If (rest.LastMethodSuccess <> True) Then
|
||||
Debug.WriteLine(rest.LastErrorText)
|
||||
MsgBox(rest.LastErrorText)
|
||||
|
||||
Else
|
||||
Return responseJson
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Return responseJson
|
||||
|
||||
Catch ex As WebException
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
@@ -205,7 +222,7 @@ Public Class cCreditSafeAPI
|
||||
|
||||
End Function
|
||||
|
||||
Shared Function getReport(ByRef company As Company, withPDF As Boolean, ByRef bytes As Byte()) As String
|
||||
Shared Function getReport(ByRef company As Company, withPDF As Boolean) As String '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 & "/"
|
||||
If company.country = "DE" Then
|
||||
'Abfragen für DE benötigen einen Reason-Code
|
||||
@@ -217,9 +234,9 @@ Public Class cCreditSafeAPI
|
||||
End If
|
||||
|
||||
Dim acceptContentType = "application/json"
|
||||
If withPDF Then
|
||||
acceptContentType &= "+pdf"
|
||||
End If
|
||||
'If withPDF Then
|
||||
' acceptContentType &= "+pdf"
|
||||
'End If
|
||||
|
||||
|
||||
|
||||
@@ -314,23 +331,61 @@ Public Class cCreditSafeAPI
|
||||
company.csFailure = json.StringOf("details")
|
||||
End If
|
||||
|
||||
If withPDF Then
|
||||
Dim sb As New Chilkat.StringBuilder
|
||||
json.StringOfSb("pdfReportStream", sb)
|
||||
'If withPDF Then
|
||||
' Dim sb As New Chilkat.StringBuilder
|
||||
' json.StringOfSb("pdfReportStream", sb)
|
||||
|
||||
Dim bd As New Chilkat.BinData
|
||||
bd.AppendEncodedSb(sb, "base64")
|
||||
' Dim bd As New Chilkat.BinData
|
||||
' bd.AppendEncodedSb(sb, "base64")
|
||||
|
||||
bytes = Convert.FromBase64String(sb.ToString)
|
||||
' bytes = Convert.FromBase64String(sb.ToString)
|
||||
|
||||
Return "mitPDF"
|
||||
' Return "mitPDF"
|
||||
|
||||
End If
|
||||
'End If
|
||||
|
||||
Return "ohnePDF"
|
||||
|
||||
End Function
|
||||
|
||||
Shared Function getPDF(ByRef company As Company) As Byte()
|
||||
|
||||
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"
|
||||
Else
|
||||
|
||||
myUrl &= "?language=DE"
|
||||
End If
|
||||
|
||||
Dim acceptContentType = "application/pdf"
|
||||
|
||||
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, Nothing, acceptContentType, "GET", token)
|
||||
|
||||
'Dim json As New Chilkat.JsonObject
|
||||
'Dim success As Boolean = json.Load(jsonRespString)
|
||||
'If (success <> True) Then
|
||||
' Debug.WriteLine(json.LastErrorText)
|
||||
|
||||
'End If
|
||||
|
||||
'Dim sb As New Chilkat.StringBuilder
|
||||
'json.StringOfSb("pdfReportStream", sb)
|
||||
|
||||
'Dim bd As New Chilkat.BinData
|
||||
'bd.AppendEncodedSb(sb, "base64")
|
||||
|
||||
'Return Convert.FromBase64String(sb.ToString)
|
||||
If jsonRespString IsNot Nothing Then
|
||||
Return Convert.FromBase64String(jsonRespString)
|
||||
End If
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Shared Sub setSearchParam(ByRef rest As Chilkat.Rest, ByRef company As Company)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user