#aquiroz-terminal
1 messages ยท Page 1 of 1 (latest)
hi! hmm, to be clear and restate things, the actual problem is your callback to terminal.discoverReaders is called with an empty list of discovered readers, would that be accurate?
If it is correct, no reader can be found when there are more than 1 in my location.
that's not true, it should definitely work
what's the location tml_xxx you're passing to the code?
this is the location code tml_ErajRwUGslkbJj
can you share the full code you're using? specifically including where you call terminal.discoverReaders
what is the value of discoverResult when you log that?
like presumably else if (discoverResult.discoveredReaders.length === 0) is not being executed right, which means there are some readers being returned?
I don't understand what that AJAX call to your backend is for also , can you explain that and what it does?
I'd overall suggest adding some logs and breakpoints, my guess is our terminal.discoverReaders() function correctly returns some readers, but you're losing the values in your own code and your global discoveredReaders variable gets set to undefined/null somewhere in your code
With that ajax, what I do is that when I receive the payment as a success, I save this data in my database.
not sure what you mean, I mean the AJAX to discover_readers.php"
ok I understand this file is used to determine if it is online or not the reader returns a status
hmm why does that need to be a PHP script on the server? ๐ you could just do that directly in Javascript
Well, believe me, I had no idea.
anyway that's probably not directly relevant , like I said, I assume terminal.discoverReaders() is giving you the right result but you're losing the state elsewhere in the code so you'd need to add some logging and breakpoints to trace what's happening
form what I can see, for tml_ErajRwUGslkbJj you have one reader registered now, and you're calling the API correctly, there's no reason for discoverReaders to not be returning that reader
I understand, if it is correct it gives me the result but when I enter more than one it does not work for me and the truth is that I have no idea.
The problem is that if I add another reader, it doesn't work for me.
The problem is that if I add another reader, it doesn't work for me.
what is the value ofdiscoverResultin your code (line 38, after callingterminal.discoverReaders) in that case? please add a console.log and check.