Public Sub RequestSalesPayment (sessionId As String, terminal_id1 As String, cashregister_id As String, amount As Int, currencyCode As Int, merchantnotes As String, customernotes As String, preauthbool As String, maxInstalments As Int, tipamount As Int) As ResumableSub
Dim success As Boolean
If gottoken = False Then
Log($"Sorry, not having "access_token" to continue at RequestSalesPayment..."$)
Return False
End If
Dim m As Map = CreateMap("sessionId": sessionId, "terminalId": terminal_id1, "cashRegisterId": cashregister_id, "amount": amount, "currencyCode": currencyCode, "merchantReference": merchantnotes, "customerTrns": customernotes, "preauth": preauthbool, "maxInstalments": maxInstalments, "tipAmount": tipamount)
Dim json As String = m.As(JSON).ToString
Dim j As HttpJob
j.Initialize("", Me)
'j.postString(usingurl & "transactions:sale",$"{"sessionId": "${sessionId}","terminalId": ${terminal_id1},"cashRegisterId": "${cashregister_id}","amount": ${amount.As(String)},"currencyCode": ${currencyCode.as(String)},"merchantReference": "${merchantnotes}","customerTrns": "${customernotes}","preauth": ${preauthbool},"maxInstalments": ${maxInstalments.as(String)},"tipAmount": ${tipamount.as(String)}}"$) 'amount 0.30...
j.PostString(usingurl & "transactions:sale", json)
j.GetRequest.SetHeader("Authorization", "Bearer " & access_token)
'j.GetRequest.Setheader("Accept", "application/json")
'J.GetRequest.SetContentType("application/json")
Wait For (j) JobDone (j As HttpJob)
If j.Success Then
Log(j.GetString)
If j.GetString.Contains("detail") Then
Log("This SessionID already used, use other and try again.")
Else
Log("Now you will probably check your POS after a while (because of cloud) - asking for credit/debit card.")
success = True
End If
Else
Log(j.ErrorMessage)
End If
j.Release
Return success
End Sub