API Creditsafe
This commit is contained in:
@@ -101,7 +101,7 @@ Public Class usrcntlCreditsafe
|
||||
dataTable.Columns.Add("postCode", GetType(String))
|
||||
dataTable.Columns.Add("status", GetType(String))
|
||||
dataTable.Columns.Add("phoneNo", GetType(String))
|
||||
dataTable.Columns.Add("dateOfLatestChange", GetType(String))
|
||||
dataTable.Columns.Add("dateOfLatestChange", GetType(DateTime))
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -114,26 +114,27 @@ Public Class usrcntlCreditsafe
|
||||
With dgvCreditsafe
|
||||
.RowHeadersWidth = 10
|
||||
.Columns("id").Visible = False
|
||||
.Columns("country").Visible = True
|
||||
.Columns("country").Visible = False
|
||||
.Columns("name").HeaderText = "Name"
|
||||
.Columns("name").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
|
||||
.Columns("safeNo").Width = 100
|
||||
.Columns("safeNo").HeaderText = "Nr"
|
||||
.Columns("safeNo").Visible = False
|
||||
.Columns("vatNo").Width = 100
|
||||
.Columns("vatNo").HeaderText = "UID"
|
||||
.Columns("regNo").Width = 100
|
||||
.Columns("regNo").HeaderText = "FN-Nr."
|
||||
.Columns("regNo").HeaderText = "FB-Nr."
|
||||
.Columns("street").Width = 100
|
||||
.Columns("street").HeaderText = "Strasse"
|
||||
.Columns("city").Width = 100
|
||||
.Columns("city").HeaderText = "Ort"
|
||||
.Columns("postCode").Width = 100
|
||||
.Columns("postCode").Width = 75
|
||||
.Columns("postCode").HeaderText = "PLZ"
|
||||
.Columns("phoneNo").Width = 100
|
||||
.Columns("phoneNo").HeaderText = "Tel-Nr"
|
||||
.Columns("status").Width = 100
|
||||
.Columns("status").HeaderText = "Status"
|
||||
.Columns("dateOfLatestChange").Width = 50
|
||||
.Columns("dateOfLatestChange").Width = 100
|
||||
.Columns("dateOfLatestChange").HeaderText = "letzte Änderung"
|
||||
End With
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>SDL_TemporaryKey.pfx</AssemblyOriginatorKeyFile>
|
||||
<AssemblyOriginatorKeyFile>Test.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Accessibility" />
|
||||
|
||||
@@ -2720,7 +2720,7 @@ Public Class usrCntlKundenuebersicht
|
||||
Using tmpForm As Form = New Form()
|
||||
tmpForm.Width = UserControl1.Width
|
||||
tmpForm.Height = UserControl1.Height + 40
|
||||
tmpForm.Text = "Creditsafe-Prüfung"
|
||||
tmpForm.Text = "Creditsafe-Firmensuche"
|
||||
tmpForm.StartPosition = tmpForm.StartPosition.CenterParent
|
||||
tmpForm.Controls.Add(UserControl1)
|
||||
If tmpForm.ShowDialog() = DialogResult.OK Then
|
||||
|
||||
@@ -1472,7 +1472,7 @@ Public Class usrcntlKundeBearbeitenFull
|
||||
Using tmpForm As Form = New Form()
|
||||
tmpForm.Width = UserControl1.Width
|
||||
tmpForm.Height = UserControl1.Height + 40
|
||||
tmpForm.Text = "Creditsafe-Prüfung"
|
||||
tmpForm.Text = "Creditsafe-Firmensuche"
|
||||
tmpForm.StartPosition = tmpForm.StartPosition.CenterParent
|
||||
tmpForm.Controls.Add(UserControl1)
|
||||
If tmpForm.ShowDialog() = DialogResult.OK Then
|
||||
|
||||
@@ -75,7 +75,7 @@ Public Class cCreditSafeAPI
|
||||
|
||||
|
||||
|
||||
Shared Function SendGetRequestWithAuthHeader(url As String, company As Company, method As String, authenticationToken As String) As String
|
||||
Shared Function SendGetRequestWithAuthHeader(url As String, company As Company, acceptContentType As String, method As String, authenticationToken As String) As String
|
||||
Try
|
||||
|
||||
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
|
||||
@@ -113,11 +113,8 @@ Public Class cCreditSafeAPI
|
||||
|
||||
rest.AddHeader("Content-Type", "application/json")
|
||||
rest.AddHeader("Authorization", "Bearer " & authenticationToken)
|
||||
If company IsNot Nothing Then
|
||||
rest.AddHeader("Accept", "application/vnd.hmrc.1.0+json")
|
||||
Else
|
||||
rest.AddHeader("Accept", "application/json+pdf")
|
||||
End If
|
||||
rest.AddHeader("Accept", acceptContentType)
|
||||
|
||||
|
||||
|
||||
Dim responseJson As String = rest.FullRequestNoBody(method, url)
|
||||
@@ -155,7 +152,7 @@ Public Class cCreditSafeAPI
|
||||
|
||||
Dim myUrl As String = API_STRING & "/v1/companies"
|
||||
Dim company = New Company(conpanyname, vatNo, country)
|
||||
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "GET", token)
|
||||
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "application/json", "GET", token)
|
||||
|
||||
|
||||
'Dim test As String = "{""correlationId"":""9194edd0-1a4a-4520-a332-7306b7c027ca"",""totalSize"":1,""companies"":[{""id"":""AT-X-7256130"",""country"":""AT"",""regNo"":""FN 410356 s"",""vatNo"":[""ATU 68490714""],""safeNo"":""AT05607514"",""name"":""Imex Customs Service GmbH"",""address"":{""simpleValue"":""Autobahngrenze 15, 4975, Suben"",""street"":""Autobahngrenze 15"",""city"":""Suben"",""postCode"":""4975""},""status"":""active"",""officeType"":""headOffice"",""type"":""Ltd"",""dateOfLatestAccounts"":""2021-12-31T00:00:00.000000Z"",""dateOfLatestChange"":""2023-03-03T02:38:30.000Z""}]}"
|
||||
@@ -188,8 +185,15 @@ Public Class cCreditSafeAPI
|
||||
Dim index = companies.FindString("address", False)
|
||||
Dim adressObj As Chilkat.JsonObject = compObj.ObjectOf("address")
|
||||
|
||||
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))
|
||||
|
||||
'Debug.WriteLine(adressObj.StringOf("simpleValue"))
|
||||
Debug.WriteLine(compObj.StringOf("id") & " " & compObj.StringOf("phoneNo") & " " & compObj.StringOf("phoneNumbers[0]"))
|
||||
'Debug.WriteLine(compObj.StringOf("id") & " " & compObj.StringOf("phoneNo") & " " & compObj.StringOf("phoneNumbers[0]"))
|
||||
|
||||
Dim R As DataRow = dataTable.NewRow
|
||||
R("id") = compObj.StringOf("id")
|
||||
@@ -202,7 +206,7 @@ Public Class cCreditSafeAPI
|
||||
R("city") = adressObj.StringOf("city")
|
||||
R("postCode") = adressObj.StringOf("postCode")
|
||||
R("status") = compObj.StringOf("status")
|
||||
R("dateOfLatestChange") = compObj.StringOf("dateOfLatestChange")
|
||||
R("dateOfLatestChange") = dateTime.GetAsTimestamp(getAsLocal)
|
||||
R("phoneNo") = compObj.StringOf("phoneNumbers[0]")
|
||||
|
||||
dataTable.Rows.Add(R)
|
||||
@@ -214,9 +218,13 @@ Public Class cCreditSafeAPI
|
||||
|
||||
End Function
|
||||
|
||||
Shared Function companyCreditreport(id As String) As String
|
||||
Shared Function companyCreditreport(id As String, Optional withPDF As Boolean = False) As String
|
||||
Dim myUrl As String = API_STRING & "/v1/companies/" & id
|
||||
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, Nothing, "GET", token)
|
||||
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
|
||||
Dim success As Boolean = json.Load(jsonRespString)
|
||||
|
||||
Reference in New Issue
Block a user