Code: Select all
Dim sBuffer As String
Dim Request As HttpClient = HttpClient.Create(Global.PS_URL & "/terminals/" & Global.TerminalIDNumber)
Dim credentials As String = Base64$(Global.PS_USER & ":" & Global.PS_PASS)
With Request
.Proxy = Null
.Headers = Format("Basic {0}", credentials)
.UserAgent = Global.PS_USER
End With
If Request.Status < 0 Then
Print "ERROR"
Else
' Success - read the data
If Lof(Request) Then sBuffer = Read #Request, Lof(Request)
Print sBuffer
End If
'If responseFromServer = "0" Then
' MsgBox("Retreal of Status Failed")
'Else
' Dim json As String = responseFromServer
' Dim ser As JObject = JObject.Parse(json)
' Dim data As List( Of JToken) = ser.Children().ToList
' For Each item As JProperty In data
' item.CreateReader()
' Select Case item.Name
' Case "status"
' Select Case item.Value
' Case "AVAILABLE"
' GetStatus = 1
' If DontSendDataToPoS = 0 Then SendToPoSterminal("TerminalOnLine|")
' Me.ListBox1.Items.Clear
' addtoStatusList("Terminal Ready")
'
' Case "BUSY"
' If DontSendDataToPoS = 0 Then SendToPoSterminal("TerminalBusy|")
' addtoStatusList("Terminal busy please wait 10 seconds and try again")
'
' Case "Offline", "OFFLINE", "offline"
' If DontSendDataToPoS = 0 Then SendToPoSterminal("offline|")
' addtoStatusList("Terminal OFFLINE NO Card processing Possible - Please check with Payment Sense")
' End Select
' End Select
' Next
' End If
I have now spent 2 days trying to convert this simple function to Gambas (once I can get this done I should be able to get the other more complicated function converted)
but no matter what I tried to do or google i get nothing zip sod all (and I get errors on the Dim Request As HttpClient line)
can someone more smarter then me help me convert this so it works?
I will need to get the JSON support working as well as that is the format the data is returned from the Web request.
Thank-you in advice for any help
Andy