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

Add autofill in payment sheet #5672

Merged
merged 4 commits into from
Mar 8, 2023
Merged

Conversation

jameswoo-stripe
Copy link
Contributor

@jameswoo-stripe jameswoo-stripe commented Oct 5, 2022

Summary

  • Add support for credit card autofill in PaymentSheet. Supports card number, card expiration, and card cvc.
  • Move DateConfig to stripe-ui-core

Motivation

Better user experience when a user has a saved credit card on their device. CardFormView, CardInputWidget, CardMultilineWidget all support autofill, so we should also support this feature in PaymentSheet.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Suggestion Confirmation Autofill

Changelog

  • [ADDED] Added support for credit card autofill.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2022

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │            compressed            │           uncompressed           
          ├───────────┬───────────┬──────────┼───────────┬───────────┬──────────
 APK      │ old       │ new       │ diff     │ old       │ new       │ diff     
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
      dex │   3.2 MiB │   3.2 MiB │   +2 KiB │   7.1 MiB │   7.1 MiB │ +8.4 KiB 
     arsc │   2.1 MiB │   2.1 MiB │   +544 B │   2.1 MiB │   2.1 MiB │   +544 B 
 manifest │   4.4 KiB │   4.4 KiB │     -1 B │    21 KiB │    21 KiB │      0 B 
      res │     1 MiB │     1 MiB │     -3 B │   1.8 MiB │   1.8 MiB │      0 B 
   native │   2.6 MiB │   2.6 MiB │      0 B │     6 MiB │     6 MiB │      0 B 
    asset │     3 MiB │     3 MiB │     -8 B │     3 MiB │     3 MiB │     -8 B 
    other │ 200.1 KiB │ 200.1 KiB │     +4 B │ 453.7 KiB │ 453.7 KiB │      0 B 
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
    total │  12.2 MiB │  12.2 MiB │ +2.6 KiB │  20.4 MiB │  20.4 MiB │ +8.9 KiB 

 DEX     │ old   │ new   │ diff              
─────────┼───────┼───────┼───────────────────
   files │     1 │     1 │   0               
 strings │ 35031 │ 35093 │ +62 (+114 -52)    
   types │ 11476 │ 11485 │  +9 (+34 -25)     
 classes │  9617 │  9625 │  +8 (+17 -9)      
 methods │ 51551 │ 51582 │ +31 (+3817 -3786) 
  fields │ 32458 │ 32521 │ +63 (+1908 -1845) 

 ARSC    │ old  │ new  │ diff       
─────────┼──────┼──────┼────────────
 configs │  333 │  333 │  0         
 entries │ 6873 │ 6874 │ +1 (+1 -0)
APK
     compressed      │     uncompressed     │                                
──────────┬──────────┼───────────┬──────────┤                                
 size     │ diff     │ size      │ diff     │ path                           
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
  3.2 MiB │   +2 KiB │   7.1 MiB │ +8.4 KiB │ ∆ classes.dex                  
  2.1 MiB │   +544 B │   2.1 MiB │   +544 B │ ∆ resources.arsc               
 65.3 KiB │    +17 B │ 146.5 KiB │      0 B │ ∆ META-INF/CERT.SF             
 50.5 KiB │    -15 B │ 146.4 KiB │      0 B │ ∆ META-INF/MANIFEST.MF         
  6.3 KiB │     -6 B │   6.2 KiB │     -6 B │ ∆ assets/dexopt/baseline.prof  
  1,000 B │     +3 B │   2.8 KiB │      0 B │ ∆ res/AE.xml                   
    722 B │     -2 B │     590 B │     -2 B │ ∆ assets/dexopt/baseline.profm 
    978 B │     -2 B │   2.6 KiB │      0 B │ ∆ res/R5.xml                   
  2.8 KiB │     -2 B │  16.6 KiB │      0 B │ ∆ res/dn.xml                   
    807 B │     +2 B │   2.3 KiB │      0 B │ ∆ res/yn.xml                   
  1.2 KiB │     +2 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA            
  4.4 KiB │     -1 B │    21 KiB │      0 B │ ∆ AndroidManifest.xml          
    378 B │     -1 B │     724 B │      0 B │ ∆ res/3n.xml                   
    948 B │     -1 B │   2.5 KiB │      0 B │ ∆ res/5d.xml                   
    397 B │     +1 B │     612 B │      0 B │ ∆ res/CG.xml                   
    615 B │     -1 B │   1.1 KiB │      0 B │ ∆ res/EF.xml                   
    599 B │     -1 B │   1.1 KiB │      0 B │ ∆ res/MP1.xml                  
    537 B │     -1 B │     984 B │      0 B │ ∆ res/WT.xml                   
    463 B │     +1 B │     728 B │      0 B │ ∆ res/ZI.xml                   
    381 B │     -1 B │     724 B │      0 B │ ∆ res/cR1.xml                  
    503 B │     +1 B │     984 B │      0 B │ ∆ res/cS.xml                   
    829 B │     +1 B │   2.4 KiB │      0 B │ ∆ res/dI.xml                   
    407 B │     -1 B │     592 B │      0 B │ ∆ res/iV.xml                   
    617 B │     -1 B │   1.1 KiB │      0 B │ ∆ res/ib1.xml                  
    620 B │     -1 B │   1.2 KiB │      0 B │ ∆ res/jH.xml                   
    597 B │     -1 B │   1.1 KiB │      0 B │ ∆ res/rZ.xml                   
    475 B │     +1 B │     904 B │      0 B │ ∆ res/th.xml                   
    802 B │     +1 B │   1.7 KiB │      0 B │ ∆ res/wf.xml                   
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
  5.5 MiB │ +2.6 KiB │   9.6 MiB │ +8.9 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   35031 │ 35093 │ +62 (+114 -52) 
  +  event not reported
  + (?<=.)(?=\p{Upper})
  + AddressAuxiliaryDetails
  + AddressCountry
  + AddressLocality
  + AddressRegion
  + AddressStreet
  + Autofill Warning
  + BirthDateDay
  + BirthDateFull
  + BirthDateMonth
  + BirthDateYear
  + Bounding box not set.
                          Did you call perform autofillTree before the component was positioned? 
  + CreditCardExpirationDate
  + CreditCardExpirationDay
  + CreditCardExpirationMonth
  + CreditCardExpirationYear
  + CreditCardNumber
  + CreditCardSecurityCode
  + EmailAddress
  + Gender
  + Landroidx/lifecycle/y1;
  + Lc5/z;
  + Lf1/g;
  + Lf1/h;
  + Lf1/i;
  + Lj2/q0;
  + Lmd/f1;
  + LocalAutofillEventReporter 
  + Lp3/q2;
  + Lrc/l;
  + Lsb/y;
  + Lze/a4;
  + Lze/b4;
  + Lze/c4;
  + Lze/w3;
  + Lze/x3;
  + Lze/y3;
  + Lze/z3;
  + NewPassword
  + NewUsername
  + PersonFirstName
  + PersonFullName
  + PersonLastName
  + PersonMiddleInitial
  + PersonMiddleName
  + PersonNamePrefix
  + PersonNameSuffix
  + PhoneCountryCode
  + PhoneNumber
  + PhoneNumberDevice
  + PhoneNumberNational
  + PostalAddress
  + PostalCodeExtended
  + SmsOtpCode
  + Unsupported autofill type
  + Username
  + VLLZLLLLLLL
  + [Lf1/i;
  + [Lgc/c;
  + [Lh4/e;
  + [Lh4/k;
  + [Lh4/o0;
  + [Lh4/u;
  + [Lo7/z;
  + [Lpc/b;
  + [Lre/g2;
  + [Lre/h3;
  + [Lre/v2;
  + [Lre/v5;
  + [Lxd/i;
  + [Lze/n0;
  + [Lze/r2;
  + [Lze/s0;
  + [Lze/u1;
  + addressCountry
  + addressLocality
  + addressRegion
  + autofillNode
  + autofillType
  + autofill_
  + birthDateDay
  + birthDateFull
  + birthDateMonth
  + birthDateYear
  + creditCardExpirationDay
  + creditCardExpirationMonth
  + creditCardExpirationYear
  + defaultAutofillEventReporter
  + defaultAutofillEventReporter()Lkotlin/jvm/functions/Function1;
  + extendedAddress
  + extendedPostalCode
  + gender
  + newPassword
  + newUsername
  + notifyViewEntered
  + notifyViewExited
  + onAutofill
  + onAutofill(Ljava/lang/String;)V
  + personFamilyName
  + personGivenName
  + personMiddleInitial
  + personMiddleName
  + personName
  + personNamePrefix
  + personNameSuffix
  + phoneCountryCode
  + phoneNational
  + phoneNumberDevice
  + requestAutofill called before onChildPositioned()
  + smsOTPCode
  + streetAddress
  + username
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:c0bc40f,r8-mode:full,version:4.0.52}
  
  - F2
  - G2
  - H2
  - I2
  - J2
  - K2
  - L2
  - Lf5/l;
  - Lh4/r0;
  - Lo7/a0;
  - Lq3/u;
  - Lre/c6;
  - Lre/d6;
  - Lre/e6;
  - Lre/f6;
  - Lxb/p0;
  - M2
  - N2
  - O2
  - P2
  - Q2
  - R2
  - S2
  - T2
  - U2
  - V2
  - W2
  - X2
  - Y2
  - Z2
  - [Lgc/a;
  - [Lh4/f;
  - [Lh4/m;
  - [Lh4/p0;
  - [Lh4/v;
  - [Lo7/a0;
  - [Lpc/a;
  - [Lre/h2;
  - [Lre/k3;
  - [Lre/y2;
  - [Lre/z5;
  - [Lxd/h;
  - [Lze/j2;
  - [Lze/k0;
  - [Lze/p0;
  - [Lze/q1;
  - a3
  - b3
  - c3
  - d3
  - e3
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:f461fa9,r8-mode:full,version:4.0.52}
  

TYPES:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   11476 │ 11485 │ +9 (+34 -25) 
  + Landroidx/lifecycle/y1;
  + Lc5/z;
  + Lf1/g;
  + Lf1/h;
  + Lf1/i;
  + Lj2/q0;
  + Lmd/f1;
  + Lp3/q2;
  + Lrc/l;
  + Lsb/y;
  + Lze/a4;
  + Lze/b4;
  + Lze/c4;
  + Lze/w3;
  + Lze/x3;
  + Lze/y3;
  + Lze/z3;
  + [Lf1/i;
  + [Lgc/c;
  + [Lh4/e;
  + [Lh4/k;
  + [Lh4/o0;
  + [Lh4/u;
  + [Lo7/z;
  + [Lpc/b;
  + [Lre/g2;
  + [Lre/h3;
  + [Lre/v2;
  + [Lre/v5;
  + [Lxd/i;
  + [Lze/n0;
  + [Lze/r2;
  + [Lze/s0;
  + [Lze/u1;
  
  - Lf5/l;
  - Lh4/r0;
  - Lo7/a0;
  - Lq3/u;
  - Lre/c6;
  - Lre/d6;
  - Lre/e6;
  - Lre/f6;
  - Lxb/p0;
  - [Lgc/a;
  - [Lh4/f;
  - [Lh4/m;
  - [Lh4/p0;
  - [Lh4/v;
  - [Lo7/a0;
  - [Lpc/a;
  - [Lre/h2;
  - [Lre/k3;
  - [Lre/y2;
  - [Lre/z5;
  - [Lxd/h;
  - [Lze/j2;
  - [Lze/k0;
  - [Lze/p0;
  - [Lze/q1;
  

METHODS:

   old   │ new   │ diff              
  ───────┼───────┼───────────────────
   51551 │ 51582 │ +31 (+3817 -3786) 
  + a0.k0 <init>(a0, String, k, String, c, int, int)
  + a3.p A(float, float) → long
  + a3.p A0(h)
  + a3.p A1(a, m, r1, boolean, g, a) → k
  + a3.p B(b1, k, i, int, int)
  + a3.p B0(int, int, boolean, boolean) → long
  + a3.p B1(String) → String
  + a3.p C(b1, k, i, int, int)
  + a3.p C0(p, Map) → l
  + a3.p C1(Number, String, String) → String
  + a3.p D(k, i, int, int)
  
...✂
ARSC
ENTRIES:

   old  │ new  │ diff       
  ──────┼──────┼────────────
   6873 │ 6874 │ +1 (+1 -0) 
  + string/expiration_date_hint

@jameswoo-stripe jameswoo-stripe force-pushed the paymentsheet-autofill branch 2 times, most recently from a34b865 to 632549e Compare March 4, 2023 01:02
@jameswoo-stripe jameswoo-stripe marked this pull request as ready for review March 4, 2023 01:09
@jameswoo-stripe jameswoo-stripe force-pushed the paymentsheet-autofill branch from 632549e to a54e8a7 Compare March 4, 2023 01:16
Copy link
Collaborator

@jaynewstrom-stripe jaynewstrom-stripe left a comment

Choose a reason for hiding this comment

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

Is it possible to test this?

@jameswoo-stripe jameswoo-stripe force-pushed the paymentsheet-autofill branch 2 times, most recently from 38a0229 to 8f9bca1 Compare March 6, 2023 18:15
@jameswoo-stripe jameswoo-stripe requested review from a team as code owners March 7, 2023 21:10
Co-authored-by: Till Hellmund <[email protected]>
@jameswoo-stripe jameswoo-stripe force-pushed the paymentsheet-autofill branch 2 times, most recently from d51b188 to 7d5920d Compare March 7, 2023 21:32
stripe-ui-core/api/stripe-ui-core.api Outdated Show resolved Hide resolved
@@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<string name="stripe_paymentsheet_address_element_same_as_shipping">Billing address is same as shipping</string>

<string name="expiration_date_hint">MM / YY</string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have a process to translate these? Should we do it as part of this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add this in a later PR

@jameswoo-stripe jameswoo-stripe force-pushed the paymentsheet-autofill branch from 7d5920d to 1ff90f1 Compare March 8, 2023 00:11
Copy link
Collaborator

@jaynewstrom-stripe jaynewstrom-stripe left a comment

Choose a reason for hiding this comment

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

LGTM

CHANGELOG.md Outdated Show resolved Hide resolved
stripe-ui-core/api/stripe-ui-core.api Outdated Show resolved Hide resolved
@jameswoo-stripe jameswoo-stripe enabled auto-merge (squash) March 8, 2023 18:38
@jameswoo-stripe jameswoo-stripe force-pushed the paymentsheet-autofill branch from 8b997f9 to 750192f Compare March 8, 2023 21:06
@jameswoo-stripe jameswoo-stripe merged commit 20a1a2d into master Mar 8, 2023
@jameswoo-stripe jameswoo-stripe deleted the paymentsheet-autofill branch March 8, 2023 21:26
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.

2 participants