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

Improve prefill in bank flows #9518

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

tillh-stripe
Copy link
Collaborator

@tillh-stripe tillh-stripe commented Oct 25, 2024

Summary

This pull request adds PrefillDetails to ElementsSessionContext, which helps us prefill the form in the bank auth flow — both in the native and in the web flow.

This is irrespective of #9446, which is about the billing details we use when we construct the PaymentMethod object.

Motivation

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

@tillh-stripe tillh-stripe changed the title Prefill email and phone number in bank flows Improve prefill in bank flows Oct 25, 2024
Copy link
Contributor

github-actions bot commented Oct 25, 2024

Diffuse output:

OLD: identity-example-release-base.apk (signature: V1, V2)
NEW: identity-example-release-pr.apk (signature: V1, V2)

          │          compressed          │         uncompressed         
          ├───────────┬───────────┬──────┼───────────┬───────────┬──────
 APK      │ old       │ new       │ diff │ old       │ new       │ diff 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
      dex │     2 MiB │     2 MiB │  0 B │   4.1 MiB │   4.1 MiB │  0 B 
     arsc │     1 MiB │     1 MiB │  0 B │     1 MiB │     1 MiB │  0 B 
 manifest │   2.3 KiB │   2.3 KiB │  0 B │     8 KiB │     8 KiB │  0 B 
      res │ 301.8 KiB │ 301.8 KiB │  0 B │ 455.5 KiB │ 455.5 KiB │  0 B 
   native │   6.2 MiB │   6.2 MiB │  0 B │  15.8 MiB │  15.8 MiB │  0 B 
    asset │   7.1 KiB │   7.1 KiB │  0 B │   6.9 KiB │   6.9 KiB │  0 B 
    other │  90.2 KiB │  90.2 KiB │ +2 B │ 170.3 KiB │ 170.3 KiB │  0 B 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
    total │   9.6 MiB │   9.6 MiB │ +2 B │  21.5 MiB │  21.5 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 19992 │ 19992 │ 0 (+0 -0) 
   types │  6203 │  6203 │ 0 (+0 -0) 
 classes │  4994 │  4994 │ 0 (+0 -0) 
 methods │ 29803 │ 29803 │ 0 (+0 -0) 
  fields │ 17570 │ 17570 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3622 │ 3622 │  0
APK
   compressed    │   uncompressed   │                                           
──────────┬──────┼───────────┬──────┤                                           
 size     │ diff │ size      │ diff │ path                                      
──────────┼──────┼───────────┼──────┼───────────────────────────────────────────
 28.4 KiB │ +3 B │  62.9 KiB │  0 B │ ∆ META-INF/CERT.SF                        
  1.2 KiB │ -2 B │   1.2 KiB │  0 B │ ∆ META-INF/CERT.RSA                       
 25.3 KiB │ +2 B │  62.8 KiB │  0 B │ ∆ META-INF/MANIFEST.MF                    
    271 B │ -1 B │     120 B │  0 B │ ∆ META-INF/version-control-info.textproto 
──────────┼──────┼───────────┼──────┼───────────────────────────────────────────
 55.2 KiB │ +2 B │ 127.1 KiB │  0 B │ (total)

@tillh-stripe tillh-stripe force-pushed the tillh/instant-debits-billing-details-prefill branch from 4251f7a to 80d5a57 Compare October 25, 2024 16:46
@@ -151,7 +151,9 @@ private fun NetworkingLinkSignupLoaded(
LaunchedEffect(showFullForm) {
if (showFullForm) {
scrollState.animateScrollToBottom()
phoneNumberFocusRequester.requestFocus()
if (payload.focusPhoneFieldOnShow) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to focus the phone field if there’s already a value.

@tillh-stripe tillh-stripe force-pushed the tillh/instant-debits-billing-details-prefill branch 4 times, most recently from 53de145 to af00802 Compare October 28, 2024 14:55

private fun makePrefillDetails(): ElementsSessionContext.PrefillDetails {
return ElementsSessionContext.PrefillDetails(
email = email.value ?: defaultBillingDetails?.email,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to fall back to any billing details that the merchant has passed in, even if it’s not being attached to the PaymentMethod.

Comment on lines 192 to 194
email?.let { queryParams.add("email=$it") }
phone?.let { queryParams.add("linkMobilePhone=$it") }
phoneCountry?.let { queryParams.add("linkMobilePhoneCountry=$it") }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing this outside of Instant Debits, as this also applies to the Networking flow.

@tillh-stripe tillh-stripe marked this pull request as ready for review October 28, 2024 17:13
@tillh-stripe tillh-stripe requested review from a team as code owners October 28, 2024 17:13
samer-stripe
samer-stripe previously approved these changes Oct 28, 2024
@tillh-stripe tillh-stripe force-pushed the tillh/instant-debits-billing-details-prefill branch from af00802 to c3ebcef Compare October 28, 2024 21:32
Copy link
Collaborator

@carlosmuvi-stripe carlosmuvi-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

val linkMode = elementsSessionContext?.linkMode

val prefillDetails = elementsSessionContext?.prefillDetails
val email = prefillDetails?.email
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - we can likely inline this when adding query params (unless it makes them 2-liners)

@tillh-stripe tillh-stripe merged commit 64142f2 into master Oct 29, 2024
13 checks passed
@tillh-stripe tillh-stripe deleted the tillh/instant-debits-billing-details-prefill branch October 29, 2024 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants