From bb3ff3f07735654fc2fe7a1f96375c2d6a64dff1 Mon Sep 17 00:00:00 2001 From: "d.breimaier" Date: Fri, 16 Jun 2023 13:08:49 +0200 Subject: [PATCH] API norsware --- SDL/SDL.vbproj | 2 +- .../Schnittstellen/cNorsware.vb | 86 ++++++++++++++++++- 2 files changed, 85 insertions(+), 3 deletions(-) diff --git a/SDL/SDL.vbproj b/SDL/SDL.vbproj index b3e4d7d1..680da2b5 100644 --- a/SDL/SDL.vbproj +++ b/SDL/SDL.vbproj @@ -90,7 +90,7 @@ false - SDL_TemporaryKey.pfx + Test.pfx diff --git a/VERAG_PROG_ALLGEMEIN/Schnittstellen/cNorsware.vb b/VERAG_PROG_ALLGEMEIN/Schnittstellen/cNorsware.vb index 6c0e8bfb..e5d03c80 100644 --- a/VERAG_PROG_ALLGEMEIN/Schnittstellen/cNorsware.vb +++ b/VERAG_PROG_ALLGEMEIN/Schnittstellen/cNorsware.vb @@ -1,6 +1,8 @@ Imports System.Net +Imports Chilkat Imports iTextSharp.text.pdf.codec.wmf Imports Newtonsoft.Json.Linq +Imports VERAG_PROG_ALLGEMEIN.cCreditSafeAPI Public Class cNorsware @@ -237,14 +239,14 @@ Public Class cNorsware End Function - Shared Function getData(authenticationToken As String, acceptContentType As String, ByRef groupID As String) As String + Shared Function getData(authenticationToken As String, acceptContentType As String, ByRef groupID As String, ByRef doc As digitDocumnent) As String VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat() Dim rest As New Chilkat.Rest Dim success As Boolean - Dim json As Chilkat.JsonObject + Dim bTls As Boolean = False @@ -270,8 +272,63 @@ Public Class cNorsware Return rest.LastErrorText End If + 'Dim doc = New digitDocumnent() + Dim json As New Chilkat.JsonObject + success = json.Load(jsonResponseStr) + If (success <> True) Then + Debug.WriteLine(json.LastErrorText) + Return "Verbindungsfehler" + End If + + doc.abs = json.StringOf("gondericiUnvan") + doc.absNr = json.StringOf("gondericiVergiNo") + doc.absAdresse = json.StringOf("gondericiAdres") + doc.absStadt = json.StringOf("gondericiSehirUlke") + + doc.empf = json.StringOf("aliciUnvan") + 'doc.empfNr = json.StringOf("gondericiVergiNo") + doc.empfAdresse = json.StringOf("aliciAdres") + doc.empfStadt = json.StringOf("aliciSehirUlke") + + doc.MRN = json.StringOf("ihracatBeyanNumarasi") + doc.pos = json.StringOf("kalemSayisi") + doc.pkgSum = json.StringOf("toplamKapAdet") + doc.mass = json.StringOf("toplamBrut") + doc.totalAmount = json.StringOf("toplamFaturaBedeli") + + + Dim positions As Chilkat.JsonArray = json.ArrayOf("entityIslenmisVeriEk") + If (json.LastMethodSuccess = False) Then + 'Return "positions not found." + End If + + Dim numPositions As Integer = positions.Size + + Dim j As Integer = 0 + While j < numPositions + + Dim posObj As Chilkat.JsonObject = positions.ObjectAt(j) + + Dim R As DataRow = doc.positonTable.NewRow + R("esyaTanim") = posObj.StringOf("esyaTanim") + R("gtip") = posObj.StringOf("gtip") + R("kapAdet") = posObj.IntOf("kapAdet") + R("kalemFiyati") = posObj.StringOf("kalemFiyati") + R("brut") = posObj.IntOf("brut") + R("net") = posObj.StringOf("net") + R("parcalimi") = posObj.BoolOf("parcalimi") + R("id") = posObj.StringOf("id") + R("kayitTarihi") = posObj.StringOf("kayitTarihi") + + doc.positonTable.Rows.Add(R) + + j = j + 1 + + + End While + Return jsonResponseStr End Function @@ -281,3 +338,28 @@ Public Class cNorsware End Class + +Public Class digitDocumnent + + Public Property abs As String + Public Property absNr As String + Public Property absAdresse As String + Public Property absStadt As String + Public Property empf As String + Public Property empfNr As String + Public Property empfAdresse As String + Public Property empfStadt As String + Public Property MRN As String + Public Property pos As Integer + Public Property pkgSum As Integer + Public Property mass As Double + Public Property totalAmount As String + Public Property positonTable As DataTable + + + Public Sub New(dt As DataTable) + positonTable = dt + End Sub +End Class + +