Hi there.....
I have here my code:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
and this the code of vb .net created from a partner (based ony my code):
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
My code works ok when POS is not having locked keyboard (ticking at EFTPOS Greek IRS AADE) - not working when tick
Code of friend works ok when POS anytime (ticking at EFTPOS Greek IRS AADE) <---that i need to do with my code too...
Running the code taking the same responses... but the value/price going at locked machine when using .NET code... with my code not...
Am i having some encoding problem or something can't found - any idea ?
Going to be crazy !!!
My class is here...
	
	
		
			
			
				
					
						
							 www.b4x.com
						
					
					www.b4x.com
				
			
		
	
			
			I have here my code:
			
				B4X:
			
		
		
		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 Suband this the code of vb .net created from a partner (based ony my code):
			
				B4X:
			
		
		
		        Public Async Function RequestSalesPayment(sessionId As String, terminalId1 As String, cashRegisterId As String, amount As Integer, currencyCode As Integer, merchantNotes As String, customerNotes As String, preauthBool As String, maxInstallments As Integer, tipAmount As Integer) As Task(Of Boolean)
            If Not _gotToken Then
                Debug.WriteLine("Sorry, not having access_token to continue at RequestSalesPayment...")
                Return False
            End If
            Dim jsonContent As String = $"{{""sessionId"": ""{sessionId}"",""terminalId"": ""{terminalId1}"",""cashRegisterId"": ""{cashRegisterId}"",""amount"": {amount},""currencyCode"": {currencyCode},""merchantReference"": ""{merchantNotes}"",""customerTrns"": ""{customerNotes}"",""preauth"": {preauthBool},""maxInstallments"": {maxInstallments},""tipAmount"": {tipAmount}}}"
            Dim content As New StringContent(jsonContent, Encoding.UTF8, "application/json")
            httpClient.DefaultRequestHeaders.Authorization = New Headers.AuthenticationHeaderValue("Bearer", AccessToken)
            Dim response = Await httpClient.PostAsync(_usingUrl & "transactions:sale", content)
            Dim result = Await response.Content.ReadAsStringAsync()
            If response.IsSuccessStatusCode Then
                If result.Contains("detail") Then
                    Debug.WriteLine("This SessionID already used, use another and try again.")
                    Return False
                Else
                    Debug.WriteLine("Now you will probably check your POS after a while (because of cloud) - asking for credit/debit card.")
                    Return True
                End If
            Else
                Return False
            End If
        End FunctionMy code works ok when POS is not having locked keyboard (ticking at EFTPOS Greek IRS AADE) - not working when tick
Code of friend works ok when POS anytime (ticking at EFTPOS Greek IRS AADE) <---that i need to do with my code too...
Running the code taking the same responses... but the value/price going at locked machine when using .NET code... with my code not...
Am i having some encoding problem or something can't found - any idea ?
Going to be crazy !!!
My class is here...
VivaWallet / VivaPayment Class using CLOUD API
Hi there,  I am sharing a Class created for using CLOUD API and sending "request" for paying from EFT-POS connected to VivaPayments (Viva Terminal)...  For those who know - who is Viva (Virtual Bank at Greece, offers Wallet, POS, Payments, etc)... need to have Business Account... For those not...
				 www.b4x.com
						
					
					www.b4x.com
				
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
	
								
							
							 
				 
 
		 
 
		 
 
		 
 
		 
 
		 
			 
 
		 
 
		 
 
		 
 
		