Compare commits

...

2 Commits

3 changed files with 100 additions and 18 deletions

View File

@@ -26,7 +26,17 @@ Public Class cFiskaltrustClient
Public Async Function SignReceiptAsync(amount As Double, vat As Double, POS As List(Of EABelegPositionen)) As Task(Of String) Public Async Function SignReceiptAsync(amount As Double, vat As Double, POS As List(Of EABelegPositionen)) As Task(Of String)
Dim payload = BuildPayload(amount, vat, POS) Dim payload = BuildPayload(amount, vat, POS)
Dim endpoint = GetEndpoint() Dim endpoint = GetEndpoint("payment")
Return Await SendAsync(endpoint, payload)
End Function
Public Async Function Echo() As Task(Of String)
Dim payload = "TEST"
Dim endpoint = GetEndpoint("test")
Return Await SendAsync(endpoint, payload) Return Await SendAsync(endpoint, payload)
@@ -44,7 +54,7 @@ Public Class cFiskaltrustClient
.ftReceiptCase = 4919338172267102210 ' Storno .ftReceiptCase = 4919338172267102210 ' Storno
} }
Return Await SendAsync(GetEndpoint(), payload) Return Await SendAsync(GetEndpoint("payment"), payload)
End Function End Function
@@ -69,7 +79,12 @@ Public Class cFiskaltrustClient
request.Headers.Add("cashboxid", _cashboxId) request.Headers.Add("cashboxid", _cashboxId)
request.Headers.Add("accesstoken", _accessToken) request.Headers.Add("accesstoken", _accessToken)
request.Content = New StringContent(json, Encoding.UTF8, "application/json") Select Case _country
Case "AT"
request.Content = New StringContent(json, Encoding.UTF8, "text/xml")
Case Else
request.Content = New StringContent(json, Encoding.UTF8, "application/json")
End Select
Dim response = Await _httpClient.SendAsync(request) Dim response = Await _httpClient.SendAsync(request)
Dim result = Await response.Content.ReadAsStringAsync() Dim result = Await response.Content.ReadAsStringAsync()
@@ -101,17 +116,22 @@ Public Class cFiskaltrustClient
End Try End Try
If exToThrow IsNot Nothing Then
Await Task.Delay(1000) ' ✅ jetzt OK
Throw exToThrow
End If
Next Next
If exToThrow IsNot Nothing Then
Await Task.Delay(1000) ' ✅ jetzt OK
Throw exToThrow
End If
Throw New Exception("Unexpected error") Throw New Exception("Unexpected error")
End Function End Function
' ================================ ' ================================
' PAYLOAD BUILDER ' PAYLOAD BUILDER
' ================================ ' ================================
@@ -156,15 +176,37 @@ Public Class cFiskaltrustClient
' ================================ ' ================================
' ENDPOINT SWITCH ' ENDPOINT SWITCH
' ================================ ' ================================
Private Function GetEndpoint() As String Private Function GetEndpoint(type As String) As String
Select Case _country
Case "DE" If type = "payment" Then
Return "/json/v1/Sign"
Case "AT"
Return "/json/Sign" Select Case _country
Case Else Case "DE"
Throw New Exception("Unsupported country") Return "/json/v1/Sign"
End Select Case "AT"
Return "/json/Sign"
Case Else
Throw New Exception("Unsupported country")
End Select
ElseIf type = "test" Then
Select Case _country
Case "DE"
Return "/json/v1/Echo"
Case "AT"
Return "/json/Echo"
Case Else
Throw New Exception("Unsupported country")
End Select
End If
End Function End Function
' ================================ ' ================================

View File

@@ -145,6 +145,7 @@ Partial Class frmBelegNeu
Me.DataGridViewTextBoxColumn9 = New System.Windows.Forms.DataGridViewTextBoxColumn() Me.DataGridViewTextBoxColumn9 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.FlowLayoutPanel2 = New System.Windows.Forms.FlowLayoutPanel() Me.FlowLayoutPanel2 = New System.Windows.Forms.FlowLayoutPanel()
Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.Button4 = New System.Windows.Forms.Button()
CType(Me.dgvBelegPos, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.dgvBelegPos, System.ComponentModel.ISupportInitialize).BeginInit()
Me.pnl.SuspendLayout() Me.pnl.SuspendLayout()
Me.pnlData.SuspendLayout() Me.pnlData.SuspendLayout()
@@ -646,6 +647,7 @@ Partial Class frmBelegNeu
'pnlData 'pnlData
' '
Me.pnlData.BackColor = System.Drawing.Color.FromArgb(CType(CType(244, Byte), Integer), CType(CType(244, Byte), Integer), CType(CType(244, Byte), Integer)) Me.pnlData.BackColor = System.Drawing.Color.FromArgb(CType(CType(244, Byte), Integer), CType(CType(244, Byte), Integer), CType(CType(244, Byte), Integer))
Me.pnlData.Controls.Add(Me.Button4)
Me.pnlData.Controls.Add(Me.cboBuchungsoforterzeugen) Me.pnlData.Controls.Add(Me.cboBuchungsoforterzeugen)
Me.pnlData.Controls.Add(Me.lblErr_Fahrer) Me.pnlData.Controls.Add(Me.lblErr_Fahrer)
Me.pnlData.Controls.Add(Me.lblErr_Pass) Me.pnlData.Controls.Add(Me.lblErr_Pass)
@@ -1761,6 +1763,21 @@ Partial Class frmBelegNeu
Me.ContextMenuStrip1.Name = "ContextMenuStrip1" Me.ContextMenuStrip1.Name = "ContextMenuStrip1"
Me.ContextMenuStrip1.Size = New System.Drawing.Size(61, 4) Me.ContextMenuStrip1.Size = New System.Drawing.Size(61, 4)
' '
'Button4
'
Me.Button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button4.ForeColor = System.Drawing.Color.Black
Me.Button4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.Button4.Location = New System.Drawing.Point(340, 6)
Me.Button4.Name = "Button4"
Me.Button4.Padding = New System.Windows.Forms.Padding(0, 0, 5, 0)
Me.Button4.Size = New System.Drawing.Size(60, 30)
Me.Button4.TabIndex = 49
Me.Button4.Text = "TEST"
Me.Button4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.Button4.UseVisualStyleBackColor = True
Me.Button4.Visible = False
'
'frmBelegNeu 'frmBelegNeu
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!)
@@ -1910,4 +1927,5 @@ Partial Class frmBelegNeu
Friend WithEvents lblZahlungsmittel As Label Friend WithEvents lblZahlungsmittel As Label
Friend WithEvents LinkLabel1 As LinkLabel Friend WithEvents LinkLabel1 As LinkLabel
Friend WithEvents cboBuchungsoforterzeugen As CheckBox Friend WithEvents cboBuchungsoforterzeugen As CheckBox
Friend WithEvents Button4 As Button
End Class End Class

View File

@@ -232,6 +232,10 @@ Public Class frmBelegNeu
' Case "WAI" : cboFiliale.changeItem(5103) ' Case "WAI" : cboFiliale.changeItem(5103)
' End Select ' End Select
If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("ADMINFUNCTIONS", "SDL") Then
Button4.Visible = True
End If
AddHandler kdkunde.PropertyChanged, Sub() AddHandler kdkunde.PropertyChanged, Sub()
If kdkunde.KdNr > 0 Then If kdkunde.KdNr > 0 Then
lblKunde_Strasse.Text = kdkunde.KdData_ADRESSEN.Straße lblKunde_Strasse.Text = kdkunde.KdData_ADRESSEN.Straße
@@ -1590,8 +1594,8 @@ Public Class frmBelegNeu
Me.Cursor = Cursors.WaitCursor Me.Cursor = Cursors.WaitCursor
If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
'KASSE.LOAD(6) 'AT-Kasse KASSE.LOAD(6) 'AT-Kasse
KASSE.LOAD(12) 'DE-kasse 'KASSE.LOAD(12) 'DE-kasse
'Laden der Kasse anhand der Auswahlbox 'Laden der Kasse anhand der Auswahlbox
Else Else
KASSE.LOAD(cboKassen._value) 'Laden der Kasse anhand der Auswahlbox KASSE.LOAD(cboKassen._value) 'Laden der Kasse anhand der Auswahlbox
@@ -1875,6 +1879,24 @@ Public Class frmBelegNeu
Process.Start("https://wiki.verag.ag/de/software/aviso/howtos/Bankomat") Process.Start("https://wiki.verag.ag/de/software/aviso/howtos/Bankomat")
End Sub End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
'KASSE.LOAD(6) 'AT-Kasse
KASSE.LOAD(12) 'DE-kasse
If KASSE.rksv_FT_RestServiceURL <> "" Then
Dim client As New cFiskaltrustClient(KASSE.rksv_FT_RestServiceURL, KASSE.rksv_FT_CashboxID, KASSE.rksv_FT_AccessToken, KASSE.rksv_FT_Country)
Dim result = client.Echo()
End If
End Sub
'Private Sub generatePOSUmbuchung() 'Private Sub generatePOSUmbuchung()
' Dim isUmbuchung = True ' Dim isUmbuchung = True
' Dim frmFremdbeleg As New frmFremdbeleg(isUmbuchung) ' Dim frmFremdbeleg As New frmFremdbeleg(isUmbuchung)