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
If gottoken=False Then
Log($"Sorry, not having "access_token" to continue at RequestSalesPayment..."$)
Return False
End If
Private j As HttpJob
j.Initialize("viva",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.GetRequest.SetHeader("Authorization", "Bearer " & access_token)
j.GetRequest.Setheader("Accept", "application/json")
J.GetRequest.SetContentType("application/json")
Wait For (j) JobDone(j As HttpJob)
'Log(j.GetString)
If j.Success=True Then
If j.GetString.Contains("detail")=True Then
j.release
Log("This SessionID already used, use other and try again.")
Return False
Else
Log(j.GetString)
j.release
Log("Now you will probably check your POS after a while (because of cloud) - asking for credit/debit card.")
Return True
End If
Else
j.Release
Return False
End If
End Sub