-
Notifications
You must be signed in to change notification settings - Fork 647
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
Add passive hCaptcha to radar_session #7722
Add passive hCaptcha to radar_session #7722
Conversation
*/ | ||
@UiThread | ||
@JvmOverloads | ||
fun createRadarSession( | ||
stripeAccountId: String? = this.stripeAccountId, | ||
callback: ApiResultCallback<RadarSession> | ||
callback: ApiResultCallback<RadarSession>, | ||
activity: AppCompatActivity? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a new requirement for anyone calling this endpoint. I have some mild FUD with adding this, but it's required by hCaptcha, so we may not have a choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't something we can obtain programmatically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately because we don't know the context in which this method is called, no. I'll revisit how the SDK actually uses this and see if we can omit it.
Diffuse output:
APK
DEX
ARSC
|
Tests coming shortly |
payments-ui-core/src/main/java/com/stripe/android/ui/core/IsStripeCardScanAvailable.kt
Outdated
Show resolved
Hide resolved
payments-ui-core/src/main/java/com/stripe/android/ui/core/IsStripeCardScanAvailable.kt
Outdated
Show resolved
Hide resolved
private val onComplete: (hcaptchaToken: String) -> Unit, | ||
) : HCaptchaProxy { | ||
override fun performPassiveHCaptcha() { | ||
if (BuildConfig.DEBUG) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be false anytime a merchant consumes our SDK (we publish in release mode).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see below comment
) | ||
).flatMap { radarSession -> | ||
val siteKey = radarSession.passiveCaptchaSiteKey | ||
if (activity == null && BuildConfig.DEBUG) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be false anytime a merchant consumes our SDK (we publish in release mode).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is specifically intended for our own test apps, and mirrors the existing StripeCardScanProxy
. In the event I'm trying to track down what went wrong with our test merchant, it'd be nice to have a specific error I can identify within the code.
6d9bea6
to
729258f
Compare
729258f
to
eddad8a
Compare
15ba712
to
bc3f03d
Compare
… to RadarSessionJsonParser
bc3f03d
to
5f70a18
Compare
@@ -5,5 +5,7 @@ import kotlinx.parcelize.Parcelize | |||
|
|||
@Parcelize | |||
data class RadarSession( | |||
val id: String | |||
val id: String, | |||
val passiveCaptchaSiteKey: String?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a public class, with a public constructor, we can't add params here. (at least not without jvmoverloads and defaults.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these new params need to be exposed to merchants? Can we restrict them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense. I've created a new internal RadarSessionWithHCaptcha
object which comes from the repository, and gets converted here.
payments-core/detekt-baseline.xml
Outdated
@@ -25,6 +24,7 @@ | |||
<ID>EmptyFunctionBlock:PaymentSessionViewModel.kt$PaymentSessionViewModel${ }</ID> | |||
<ID>EmptyFunctionBlock:StripeTextWatcher.kt$StripeTextWatcher${ }</ID> | |||
<ID>ExplicitGarbageCollectionCall:WeakMapInjectorRegistryTest.kt$WeakMapInjectorRegistryTest$gc()</ID> | |||
<ID>ImportOrdering:com.stripe.android.googlepaylauncher.GooglePayLauncherViewModelTest.kt:3</ID> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we fix this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦 I fixed the ordering but forgot to update the detekt baseline. will do.
ef1e76e
to
66ec995
Compare
Summary
Add a compile-only passive hCaptcha to radar sessions.
Motivation
Part of
#ir-enthrall-blossom
. See project description here.Testing
Changelog
Added