#zishaansunderji-terminal-connectivity

1 messages ยท Page 1 of 1 (latest)

stone juniper
#

Hi there, let me see if I can get someone to take a look at this, as I'm not sure what else to advise

strong jay
#

Thank you!!

old cedar
#

Just to confirm - has connecting to a reader ever worked at this location?

strong jay
#

It hasn't yet - we're trying to set them up today

#

In the dashboard though, the last seen does reflect it been "Last Seen" today but it doesn't fully connect I guess

#

because it won't proceed with allowing to process a transaction and all

old cedar
#

"Last Seen" I believe refers to just when the reader was last online - not the connection process

#

Have they confirmed that they're on the same network?

strong jay
#

I see!

#

Yepp they're definitely on the same network

#

They have a specific internal network setup just for the business' day to day processes

#

like readers, printers, tablets etc.

old cedar
#

Hmmm... Do you have the reader serial number?

strong jay
#

Yeppp it's this: WSC513128044159

#

And the locationId is: tml_ErnAwA4Ucp1qdW

old cedar
#

๐Ÿ‘ let me take a look

strong jay
#

Thanks!!

old cedar
#

What does your discovery code look like?

#

I'm not seeing a ton of helpful information in our logs, so hopefully approaching this from a different angle will help

strong jay
#

Yupp for sure

#

So it looks like this:

    fun discoverReaders(location: String?) {

        // Change the location in the case of internet readers with QR Code linking
        if (location != "") {
            locationId = location
        }

        // We really don't need to run things in simulations
        // val isSimulated = simulated != 0
        var discoveryConfiguration: DiscoveryConfiguration? = null;
        val isTestMode = simulated === 1;
        discoveryConfiguration = if (businessUsesInternetReaders) {
            DiscoveryConfiguration(10, DiscoveryMethod.INTERNET, isTestMode, locationId)
        } else {
            DiscoveryConfiguration(0, DiscoveryMethod.BLUETOOTH_SCAN, isTestMode)
        }

        try {
            val statusCallback = object : com.stripe.stripeterminal.external.callable.Callback {
                override fun onSuccess() {
                    pendingDiscoverReaders = null
                    val readerCompletionResponse = Arguments.createMap()
                    sendEvent(constants.EVENT_READER_DISCOVERY_COMPLETION, readerCompletionResponse)
                }

                override fun onFailure(@Nonnull e: TerminalException) {
                    pendingDiscoverReaders = null
                    val errorMap = Arguments.createMap()
                    errorMap.putString(constants.ERROR, e.errorMessage)
                    sendEvent(constants.EVENT_READER_DISCOVERY_COMPLETION, errorMap)
                }

            }
            abortDiscoverReaders()
            pendingDiscoverReaders = Terminal.getInstance().discoverReaders(discoveryConfiguration, this, statusCallback)

        } catch (e: Exception) {
            e.printStackTrace()
            if (e.message != null) {
                val writableMap = Arguments.createMap()
                writableMap.putString(constants.ERROR, e.message)
                sendEvent(constants.EVENT_READER_DISCOVERY_COMPLETION, writableMap)
            }
        }
    }
#

And then when the readers is discovered - it's this:

    override fun onUpdateDiscoveredReaders(@Nonnull list: List<Reader>) {
        discoveredReadersList = list
        val readersDiscoveredArr = Arguments.createArray()
        for (reader in list) {
            if (reader != null) {
                Log.wtf("Stripe connection new reader: ", reader.location.toString())
                Log.wtf("Stripe connection new reader: ", reader.locationStatus.toString())
                readersDiscoveredArr.pushMap(serializeReader(reader))
            }
        }

        Log.wtf("Stripe connection finished: ", "Readers have been found $list")
        if (businessUsesInternetReaders) {
            Log.wtf("Stripe Connection: ", list.toString())
            if (list.isNotEmpty()) {
                // Internet readers are unique by location and name so we
                // can connect to the first one automatically after discovery
                val reader = list[0]
                Log.wtf("Stripe Connection - pairing with reader: ", reader.toString())
                connectReader(reader.serialNumber)
            }
        }
        sendEvent(constants.EVENT_READERS_DISCOVERED, readersDiscoveredArr)
    }
#

In the logs, is there any way to know if the readers were found - this is live and unfortunately we didn't write a logger for this bit because we haven't come across this issue with any of our clients yet

old cedar
#

Do you happen to know the reader ID as well (tmr_xxx)?

strong jay
#

yepp for sure!

#

It's this: tmr_ErnBAifYrWj7pc

old cedar
#

Thanks! Just wanted to make sure that the reader is associated with that location ID

strong jay
#

Totally!

old cedar
#

I'm not seeing any logs that indicate that discoverReaders was called with location ID tml_ErnAwA4Ucp1qdW - Is it possible that discover readers is accidentally being called with a different location ID?

strong jay
#

Hmm it's not likely - the workflow right now is that we store all the internet readers in our database - with the serial number and location ID and it tries to connect to it

#

The only potential reason I can imagine that could be causing that is if

#

the

    override fun fetchConnectionToken(connectionTokenCallback: ConnectionTokenCallback) { ... }

fails - but I wouldn't imagine a reason why that would fail

#

but in our database the JSON is sort of stored like this:

#

do you happen to see the serial number being referenced anywhere in the logs?

old cedar
#

Yes, I see it in various places in our logs, but that's expected because the reader is online and can communicate with stripe

#

Do you happen to know when specifically they attempted to discover the reader? I can try and find that log on my end if you give me a specific enough time range

strong jay
#

Yeah for sure!

#

So 11:35am to 11:45am Eastern Time had several attempts of the connection process

old cedar
#

I looked (and increased the time range a bit as well) and I'm not seeing any discover requests in that time span - is there a way for you to diagnose whether the discoverReader request is getting through to us correctly?

strong jay
#

I see - there's not exactly a way for me to check that - but this is helpful - I do have a spare reader so I could try setting up and connecting my reader to that location and seeing if I see anything locally

#

If there's an issue in how the discover request is being made and the reader id doesn't show up in the logs - there might be something our steps is overlooking

#

Thanks a ton!!

#

I'll reach out in the discord if I get stuck again haha

old cedar
#

๐Ÿ‘ yeah something strange is definitely going on with the discover reader requests - so that's a good place to dig in

#

let us know if you need anything else

strong jay
#

perfect! thanks for your help!!

#

๐Ÿ’ฏ