I would like some help with the below code
Try
Dim Request As HttpWebRequest = HttpWebRequest.Create(PS_URL & "/terminals/" & TerminalIDNumber)
Dim credentials As String = Convert.ToBase64String(Encoding.ASCII.GetBytes(PS_USER & ":" & PS_PASS))
txtResults.Text = vbNullString
With Request
.Proxy = Nothing
.Headers(HttpRequestHeader.Authorization) = String.Format("Basic {0}", credentials)
.Accept = "application/connect.v2+json"
.Headers.Add("Software-House-Id: SD459T92") ' algPoS ID Number
.Headers.Add("Installer-Id:ABC12319785")
.UserAgent = PS_USER
End With
Dim response As HttpWebResponse = Request.GetResponse()
Dim dataStream As Stream = response.GetResponseStream
Dim reader As New StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
txtResults.Text = responseFromServer
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
Catch ex As Exception
addtoStatusList(ex.ToString)
If DebugActive = "Yes" Then AddToDebugList(ex.ToString)
If DontSendDataToPoS = 0 Then SendToPoSterminal("ProcessingError")
FromPoSTCP.Stop()
FromPoSTCP.Start()
End Try
As you can see this is code I am using in my VB application that talks to one of the card processing servers that I talk to for card processing (this code gets the status of the Terminal as this is the simplest example of what the terminal does I figured this would be the best one to start with)I have tried for weeks to get something to work and I have given up.
could some one please convert this so it would work in Gambas (once i can see what was converted I would have a better understanding of how to do the rest of the code I need to do) I know I am asking a lot of someone to covert the above code but I just can not work it out.