#zishaansunderji-terminal

1 messages · Page 1 of 1 (latest)

chilly tiger
#

Hello 👋
Catching up here
Give me a moment and I'll respond as soon as I can 🙂 Thanks

quasi island
#

Perfect! Thank you!!

#

Btw these are the logs:

2022-07-05 15:26:25.925 9948-10031/com.paywithtango.tangotablet D/StripeTerminal: class=Terminal message=discoverReaders
2022-07-05 15:26:26.030 9948-10220/com.paywithtango.tangotablet I/StripeTerminal: class=TransactionStateMachine message="onStateChanged: null -> EMPTY: null"
2022-07-05 15:26:26.031 9948-10228/com.paywithtango.tangotablet I/StripeTerminal: class=TransactionManager message="handleCardStatus NO_CARD"
2022-07-05 15:26:26.032 9948-10220/com.paywithtango.tangotablet D/StripeTerminal: class=BbposAdapterLegacy message=discoverReaders
2022-07-05 15:26:26.033 9948-10220/com.paywithtango.tangotablet I/StripeTerminal: class=TransactionStateMachine message="onStateChanged: EMPTY -> DISCOVER: Discovery requested"
2022-07-05 15:26:26.033 9948-10220/com.paywithtango.tangotablet D/StripeTerminal: class=BbposProxyDiscoveryController message=discover
2022-07-05 15:27:04.277 9948-10082/com.paywithtango.tangotablet I/StripeTerminal: class=CrpcClient message="GatorService.reportTrace request=null"
2022-07-05 15:27:04.592 9948-10082/com.paywithtango.tangotablet I/StripeTerminal: class=CrpcClient message="GatorService.reportTrace response={}"
2022-07-05 15:27:04.597 9948-10082/com.paywithtango.tangotablet I/StripeTerminal: class=CrpcClient message="GatorService.reportEvent request=null"
2022-07-05 15:27:04.674 9948-10082/com.paywithtango.tangotablet I/StripeTerminal: class=CrpcClient message="GatorService.reportEvent response={}"
chilly tiger
#

I'm digging but I see a bunch of following errors in our logs Unable to resolve host "armada.stripe.com": No address associated with hostname
which mostly means some kind of firewall is preventing the reader from talking to our domain

quasi island
#

Hmm give me 2 minutes to check something

#

So I'm not sure if that's the issue

#

I just tried connecting my reader to another business by re-registering it and it worked

#

So this issue is weirdly happening with this specific location (not only for me locally at home) but at the business' location as well

#

Btw I had to move somethings around so this is the new location ID (tml_EsFeZAeeICws1O) and readerID (tmr_EsFeZAAFXKVOV7) - I'll delete the old location

chilly tiger
#

If it works with a different business/integration and doesn't with current one, mostly something with the code then 🤔

quasi island
#

In terms of the code, the discovery configuration is pasted at the top, and I tried logging within the statusCallback like this:

            val statusCallback = object : com.stripe.stripeterminal.external.callable.Callback {
                override fun onSuccess() {
                    Log.wtf("Stripe reader connection: ", "Success")
                    pendingDiscoverReaders = null
                    val readerCompletionResponse = Arguments.createMap()
                    sendEvent(constants.EVENT_READER_DISCOVERY_COMPLETION, readerCompletionResponse)
                }

                override fun onFailure(@Nonnull e: TerminalException) {
                    Log.wtf("Stripe reader connection: ", "Failure")
                    pendingDiscoverReaders = null
                    val errorMap = Arguments.createMap()
                    errorMap.putString(constants.ERROR, e.errorMessage)
                    sendEvent(constants.EVENT_READER_DISCOVERY_COMPLETION, errorMap)
                }

and it didn't log either

#

yeah it's weird this is the first time this issue has happened - we have several businesses using this exact logic for the connection step - and today's the first day we're having trouble with the readers connecting

#

and it pretty much only gets stuck at the discoverReaders method

#

are there any indications that there's something with the locationID that's generated?

#

The location is in Port Carling which is in a remote area in Central Ontario - so potentially, that location is not well known

chilly tiger
#

hmm not seeing any indication of this being related to location at the moment

quasi island
#

I see - is there a chance you can see if there was an attempt at a connection? with some error message?

chilly tiger
#

are you caching connection tokens by any chance?

quasi island
#

not really, there's a method called fetchConnectionToken which the reader requests from time to time - and we generate and supply a token to it when requested

chilly tiger
#

Gotcha. Just trying to rule out common suspects

quasi island
#

Kind of like this:

    override fun fetchConnectionToken(connectionTokenCallback: ConnectionTokenCallback) {
        // If we get a request to fetch the connection token we should do it immediately
        pendingConnectionTokenCallback = connectionTokenCallback
        Log.wtf("Stripe Connection", "Requesting connection token...")
        if (allowConnectionTokenRequest) {
            Log.wtf("Stripe Connection","We got a connection token")

            var country = ""
            if (isCanada) {
                country = "CA"
            } else {
                country = "US"
            }

            val token = sendPostRequest(country, isTest)
            // If no service is established let's find a way to
            // manually re-establish service.
            Log.wtf("Stripe Connection request: ", token)
            if (token.isNotEmpty()) {
                setConnectionToken(token, null)
            }

            // There's a chance that when a new connection token is
            // being generated that there's a brief disconnect so
            // we should check the connection status and reconnect to
           // the reader if it had been disconnected
            val connectionStatus = Terminal.getInstance().connectionStatus
            if (connectionStatus == ConnectionStatus.NOT_CONNECTED) {
                if (connectedReaderSerialNumber != null) {
                    this.connectReader(connectedReaderSerialNumber)
                }
            }
        }
        sendConnectionTokenRequest = true
        tokenCallback = connectionTokenCallback
    }
#

Oh gotcha haha cool

#

Also one quick thing, Port Carling is in this place called Muskoka, and I'm in Toronto, does the distance from the location play a role in this circumstance. I've managed to configure my reader to locations in Burlington and Hamilton (which are 2 other cities that aren't in Toronto) - so I'd imagine not really, and as long as it's the same State or Province, right?

chilly tiger
#

As far as I know, it shouldn't.

quasi island
#

Okay awesome!

chilly tiger
#

Does this only happen in livemode or is it the same behavior in test mode too? or vice versa?

quasi island
#

So this issue is currently only with the live mode for this business

#

I know the readers are independent of the connect accounts and all lol

#

But we currently do have readers in live mode processing payments that seem to be connecting fine for some reason

chilly tiger
#

gotcha, so works fine in test mode?

quasi island
#

yeppp!

#

I tried it in test mode - and it connected perfectly!

#

Oh it just hit the exception:

2022-07-05 16:36:41.986 19076-19341/com.paywithtango.tangotablet E/StripeTerminal: DiscoverReaders was canceled by the user
    com.stripe.stripeterminal.external.models.TerminalException: DiscoverReaders was canceled by the user
        at com.stripe.stripeterminal.adapter.BbposBluetoothAdapterLegacy$DiscoverBluetoothReadersOperation.cancel(BbposBluetoothAdapterLegacy.kt:305)
        at com.stripe.stripeterminal.adapter.BbposAdapterLegacy.cancelDiscoverReaders(BbposAdapterLegacy.kt:182)
        at com.stripe.stripeterminal.adapter.ProxyAdapter.cancelDiscoverReaders(ProxyAdapter.kt:106)
        at com.stripe.stripeterminal.TerminalSession$DiscoverReadersOperation.startCancel$core_publish(TerminalSession.kt:1199)
        at com.stripe.stripeterminal.callable.Cancelable.cancel(Cancelable.kt:16)
        at com.paywithtango.tangotablet.StripeService.abortDiscoverReaders(StripeService.kt:771)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)
        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
        at android.os.Looper.loop(Looper.java:223)
        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
        at java.lang.Thread.run(Thread.java:923)
2022-07-05 16:36:41.988 19076-19341/com.paywithtango.tangotablet E/Stripe reader connection:: Failure
#

So i think the first line means that the timeout got hit

#

when it says, "DiscoverReaders was canceled by the user"

#

now what's weird is that it says: BbposBluetoothAdapterLegacy - but I'm not using bluetooth

#

Btw my logs are in Eastern Time - 16:36 was 2 minutes ago

chilly tiger
#

I wonder if the SDK is just stuck in discovery reader phase

quasi island
#

Yupp let me give it a shot

#

So what's weird is onStop isn't an override like the documentation says

#

Is that true?

chilly tiger
#

I'm not sure (my android skills aren't great :p)
As far as I can tell, I believe its trying to override Activity's onStop method

quasi island
#

hahaha fair

#

i think that'll be tricky - because actually our app is mostly ReactNative and we're using Native Modules to interact with the readers

#

so the entire app is running on the same Fragment

#

it was just a decision made long before I joined this project lol

#

but I do understand the point to onStop

#

so we have this thing called abortDiscoverReaders which shares a similar implementation

#
    fun abortDiscoverReaders() {
        if (pendingDiscoverReaders != null && !pendingDiscoverReaders!!.isCompleted) {
            pendingDiscoverReaders!!.cancel(object : com.stripe.stripeterminal.external.callable.Callback {
                override fun onSuccess() {
                    pendingDiscoverReaders = null
                    sendEvent(constants.EVENT_ABORT_DISCOVER_READER_COMPLETION, Arguments.createMap())
                }

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

and before we discoverReaders we do this:

    fun discoverReaders(location: String?) {
        ...

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

                override fun onFailure(@Nonnull e: TerminalException) {
                    Log.wtf("Stripe reader connection: ", "Failure")
                    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) {
            Log.wtf("Stripe reader error: ", e.toString())
            e.printStackTrace()
            if (e.message != null) {
                val writableMap = Arguments.createMap()
                writableMap.putString(constants.ERROR, e.message)
                sendEvent(constants.EVENT_READER_DISCOVERY_COMPLETION, writableMap)
            }
        }
    }
#

where we call abortDiscovery before trying to attempt a new discover readers connection

chilly tiger
#

ah I see. Can you check if that's hitting onSuccess ?

#

I mean abortDiscoverReaders()

quasi island
#

Yepp for sure! I'll log it and see if it hits it

#

Yepp so it does that successfully:

2022-07-05 16:57:38.141 29352-29425/com.paywithtango.tangotablet E/Stripe reader abort discover success:: Successfully aborted discovery.
2022-07-05 16:57:38.141 29352-29607/com.paywithtango.tangotablet E/StripeTerminal: DiscoverReaders was canceled by the user
    com.stripe.stripeterminal.external.models.TerminalException: DiscoverReaders was canceled by the user
#

The first one is my log

chilly tiger
#

and that triggers DiscoverReaders was canceled by the user so that makes sense

quasi island
#

I do have a strong feeling this is causing the issue:

at com.stripe.stripeterminal.adapter.BbposBluetoothAdapterLegacy$DiscoverBluetoothReadersOperation.cancel(BbposBluetoothAdapterLegacy.kt:305)
#

it doesn't even attempt at stopping the internet reader discovery - just the bluetooth one

#

but it's all compiled code so it's not possible for me to check

#

Yeppp exactly!

chilly tiger
#

I'm assuming you use isTestMode as a boolean for isSimulated ? like if its test mode, use simulated reader?

quasi island
#

yepp that's true

#

but maybe it's assuming there's a bluetooth connection as opposed to an internet one somehow

chilly tiger
#

can you print out this before you call discoverReaders ?

quasi island
#

yuppp!

chilly tiger
#

Is this an object of DiscoveryListener?

quasi island
#

Yeah it is!

chilly tiger
#

gotcha. can you try logging readers in onUpdateDiscoveredReaders(...) ?

#

or just check if that's even getting called at all?

quasi island
#

oh dude!

#

it weirdly worked

#

i just logged it

#

and got this:

022-07-05 17:08:07.980 32367-32640/com.paywithtango.tangotablet E/Stripe connection new reader:: Location(id=tml_EsFeZAeeICws1O, address=Address(city=Port Carling, country=CA, line1=119 Medora St, line2=WSC513104000905, postalCode=P0B 1J0, state=ON), displayName=The Coop Port Carling - WSC513104000905, livemode=true, metadata=null)
2022-07-05 17:08:07.981 32367-32640/com.paywithtango.tangotablet E/Stripe connection new reader:: UNKNOWN
#

it says connection new reader UNKNOWN

#

but it did connect

chilly tiger
#

ah nice

quasi island
#

hahaha yeah

#

this is weird but i'm cool with it LOL

#

thanks for your help!!

chilly tiger
#

as long as it works 🤫
Happy to help 🙂

quasi island
#

hahaha yuppp 😜

#

and thanks for letting me know about the whitelisting thing too

#

I'm going to ask the integrity team to whitelist those domains for our clients moving forward

chilly tiger
#

Awesome! 🙂 Good luck

#

I need to step away now but @tall ginkgo can help in case you have any follow ups

quasi island
#

Thanks a ton!!!

#

And I think I'll be solid going forward!!