braintree_android icon indicating copy to clipboard operation
braintree_android copied to clipboard

3DS result not being delivered in `braintreeClient.deliverBrowserSwitchResult`

Open matejhacin opened this issue 4 years ago • 1 comments

General information

  • SDK/Library version: 4.7.0
  • Environment: Sandbox
  • Android Version and Device: Android 12
  • Braintree dependencies: com.braintreepayments.api:three-d-secure:4.7.0

Issue description

While upgrading Braintree SDK from v3 to v4, I've run into an issue with 3DS integration. When I call braintreeClient.deliverBrowserSwitchResult(activity) inside my Fragment.onResume method, the result is always null.

If I set the deep link configuration in my manifest and then check for 3DS result inside onActivityResult of the parent Activity it actually does work and the result seems to be there.

But, I have trouble understanding this logic. The migration guide clearly says that BrowserSwitchResult should be used when app switch does not happen, or with the use of ThreeDSecureClient, which is the case here. The 3DS browser is opened within the app, or at least it seems like it.

If this is the only way to implement this, it complicates things for my project, as the app uses multiple different activities, each with multiple different fragments, where payment can happen. With the v3, I was able to decouple the 3DS logic into a separate class which received a FragmentActivity as a reference, and the whole process was handled in there, making the 3DS code easily reusable and maintainable. Having to handle these results in multiple different activities and making sure the data makes its' way into the correct Fragment and then into the correct ViewModel is not ideal and actually complicates things a lot.

To me, this seems like a downgrade in the SDK flexibility and I don't quite understand it. Is there a way around this?

It seems like I am not the only person bothered by this, as I noticed someone running into the same issue (#475).

matejhacin avatar Dec 14 '21 09:12 matejhacin

@matejhacin we're discussing possible solutions internally. If you'd like to contribute check out the discussion on Developer Experience we created.

sshropshire avatar Jan 19 '22 22:01 sshropshire

Hi @matejhacin we've made some enhancements over the past year. I would recommend migrating to the latest 4.26.1 version. Here's a migration guide detailing what we've changed.

Also thank you for raising this concern it helps us to make our SDK better. If you have suggestions or a "dream" integration that you would like us to build, feel free to open up a discussion in our repo. We're prioritizing some next major version work at the moment, and we'd love to get some additional feedback from the community to offer the best possible developer experience.

sshropshire avatar Mar 01 '23 18:03 sshropshire