Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simulated bluetooth proximity returns a p400 reader #94

Closed
jdivock-stripe opened this issue Feb 22, 2022 · 6 comments · Fixed by #111 or #187
Closed

simulated bluetooth proximity returns a p400 reader #94

jdivock-stripe opened this issue Feb 22, 2022 · 6 comments · Fixed by #111 or #187
Labels

Comments

@jdivock-stripe
Copy link
Contributor

from @tomas-stripe 's feedback

I changed discover method to “Bluetooth proximity”, then tapped discover readers. I got a “SimulatorID - verifoneP400” reader back, which doesn’t seem right. I’d expect to get a simulated Chipper or M2 device.

Selecting “Bluetooth scan” as the discovery method returns the proper list of Bluetooth readers: “SimulatorID - chipper2X”, “SimulatorID - stripeM2” and “SimulatorID - wisePad3”.

@arekkubaczkowski
Copy link
Contributor

@jdivock-stripe I've investigated this issue and it only occurs on Android but this is what Android SDK returns so it should be reported there.

@jdivock-stripe
Copy link
Contributor Author

ack, assigning to @dhenry-stripe to confirm. If so we can just close his out and assume the fix will trickle down here

@dhenry-stripe
Copy link
Contributor

@arekkubaczkowski The Android SDK doesn't support bluetooth proximity so this switch statement is failing to find a valid match and defaulting (incorrectly) to INTERNET when bluetoothProximity is passed in:

https://github.com/stripe/stripe-terminal-react-native/blob/main/android/src/main/java/com/stripeterminalreactnative/Mappers.kt#L114-L121

We should instead do something like:

internal fun mapToDiscoveryMethod(method: String?): DiscoveryMethod {
  return when (method) {
    "bluetoothScan" -> DiscoveryMethod.BLUETOOTH_SCAN
    "internet" -> DiscoveryMethod.INTERNET
    "embedded" -> DiscoveryMethod.EMBEDDED
    "localMobile" -> DiscoveryMethod.LOCAL_MOBILE
    "handoff" -> DiscoveryMethod.HANDOFF
    else -> throw TerminalException(TerminalException.TerminalErrorCode.UNSUPPORTED_OPERATION, "discoveryMethod:$method is not supported by Stripe Terminal Android")
  }
}

@arekkubaczkowski
Copy link
Contributor

@dhenry-stripe is there any way to test localMobile, handoff or embedded connection methods? @jdivock-stripe Should it be accessible within react native SDK?

@jdivock-stripe
Copy link
Contributor Author

I'm not sure on the current state, I'll defer to @dhenry-stripe on that

@dhenry-stripe
Copy link
Contributor

@arekkubaczkowski we should just focus on the core connection methods (bluetooth and internet) for this iteration. Can you have the connection methods you mentioned return not supported exceptions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants