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

Collect phone and email in PaymentSheet's Google Pay #7683

Merged
merged 10 commits into from
Dec 7, 2023

Conversation

tillh-stripe
Copy link
Collaborator

@tillh-stripe tillh-stripe commented Nov 29, 2023

Summary

This pull request updates Google Pay to take the phone and email collection configuration into account. When collection mode is set to Always, we now set the correct isEmailRequired and isPhoneNumberRequired value.

The collected values are eventually accessible via the Charge’s billing_details.email and billing_details.phone fields:

  • Before this change: pi_3OHzrSLu5o3P18Zp1p1Zn1qP
  • After this change: pi_3OHztFLu5o3P18Zp0cZBwYwz

Motivation

Resolves #7662

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

Copy link
Contributor

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.6 MiB │   3.6 MiB │ +1.7 KiB │   7.8 MiB │   7.8 MiB │   -184 B 
     arsc │   2.3 MiB │   2.3 MiB │      0 B │   2.3 MiB │   2.3 MiB │      0 B 
 manifest │   5.1 KiB │   5.1 KiB │      0 B │  25.4 KiB │  25.4 KiB │      0 B 
      res │ 905.6 KiB │ 905.6 KiB │      0 B │   1.4 MiB │   1.4 MiB │      0 B 
   native │   2.6 MiB │   2.6 MiB │      0 B │     6 MiB │     6 MiB │      0 B 
    asset │     3 MiB │     3 MiB │ -1.3 KiB │     3 MiB │     3 MiB │ -1.3 KiB 
    other │ 204.5 KiB │ 204.5 KiB │    +17 B │ 460.3 KiB │ 460.3 KiB │      0 B 
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼──────────
    total │  12.5 MiB │  12.5 MiB │   +432 B │  20.9 MiB │  20.9 MiB │ -1.5 KiB 

 DEX     │ old   │ new   │ diff              
─────────┼───────┼───────┼───────────────────
   files │     1 │     1 │   0               
 strings │ 38604 │ 38555 │ -49 (+81 -130)    
   types │ 12699 │ 12699 │   0 (+78 -78)     
 classes │ 10680 │ 10680 │   0 (+61 -61)     
 methods │ 55617 │ 55616 │  -1 (+2676 -2677) 
  fields │ 35787 │ 35788 │  +1 (+1185 -1184) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  292 │  292 │  0   
 entries │ 6937 │ 6937 │  0
APK
     compressed      │     uncompressed     │                                
──────────┬──────────┼───────────┬──────────┤                                
 size     │ diff     │ size      │ diff     │ path                           
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
  3.6 MiB │ +1.7 KiB │   7.8 MiB │   -184 B │ ∆ classes.dex                  
  5.2 KiB │ -1.3 KiB │     5 KiB │ -1.3 KiB │ ∆ assets/dexopt/baseline.prof  
 65.6 KiB │    +10 B │ 147.1 KiB │      0 B │ ∆ META-INF/CERT.SF             
 49.8 KiB │     +5 B │ 147.1 KiB │      0 B │ ∆ META-INF/MANIFEST.MF         
  1.2 KiB │     +2 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA            
    768 B │     +1 B │     636 B │     +1 B │ ∆ assets/dexopt/baseline.profm 
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
  3.7 MiB │   +432 B │   8.1 MiB │ -1.5 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   38604 │ 38555 │ -49 (+81 -130) 
  + , isPhoneRequired=
  + Lej/b;
  + Lfj/c;
  + Lfj/d;
  + Lgj/e;
  + Lgj/f;
  + Lgj/g;
  + Lgj/h;
  + Lgj/i;
  + Lgj/j;
  + Lgj/k;
  + Lgj/l;
  + Lgj/m;
  + Lgj/n;
  + Lgj/o;
  + Lgj/p;
  + Lgj/q;
  + Lgj/r;
  + Lgj/s;
  + Lgj/t;
  + Lgj/u;
  + Lgj/v;
  + Lgj/w;
  + Lgj/x;
  + Lij/b;
  + Lij/c;
  + Ljj/d;
  + Lod/a4;
  + Loj/c;
  + Loj/d;
  + Lqj/c;
  + Lqj/d;
  + Lqj/e;
  + Lqj/f;
  + Lsi/a;
  + Luj/a;
  + Luj/b;
  + Lwi/b;
  + Lwi/c;
  + Lxi/d;
  + Lxi/e;
  + Lxi/f;
  + Lxi/g;
  + Lxi/h;
  + Lxi/i;
  + Lxi/j;
  + Lxi/k;
  + Lxi/l;
  + Lxi/m;
  + Lxi/n;
  + Lyi/a;
  + Lyi/b;
  + Lyi/c;
  + Lyi/d;
  + Lyi/e;
  + Lyi/f;
  + Lyi/g;
  + Lyi/h;
  + Lyi/i;
  + Lyi/j;
  + Lyi/k;
  + Lyi/l;
  + VLLLZLZZZ
  + [Lcj/a;
  + [Lgj/s;
  + [Lod/a2;
  + [Lod/c3;
  + [Lod/g2;
  + [Lod/h3;
  + [Lod/i2;
  + [Lod/k2;
  + [Lod/n1;
  + [Lod/q0;
  + [Lod/s2;
  + [Lod/u0;
  + [Lod/x1;
  + [Lqj/e;
  + [Luj/a;
  + [Lx/e;
  + [Lyi/h;
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:a715141,r8-mode:full,version:8.1.65}
  
  - A3
  - B3
  - C3
  - D3
  - E3
  - F3
  - G2
  - G3
  - H2
  - I2
  - J2
  - K2
  - L2
  - Laj/c;
  - Laj/d;
  - Laj/e;
  - Laj/f;
  - Laj/g;
  - Laj/h;
  - Laj/i;
  - Laj/j;
  - Laj/k;
  - Laj/l;
  - Lbj/c;
  - Lbj/d;
  - Lbj/e;
  - Lcj/b;
  - Ldj/a;
  - Ldj/b;
  - Lhj/b;
  - Lhj/c;
  - Lhj/d;
  - Lhj/e;
  - Lhj/f;
  - Lhj/g;
  - Lhj/h;
  - Lhj/i;
  - Lhj/j;
  - Lhj/k;
  - Lhj/l;
  - Lhj/m;
  - Lhj/n;
  - Lhj/o;
  - Lhj/p;
  - Lhj/q;
  - Lhj/r;
  - Lhj/s;
  - Lhj/t;
  - Lhj/u;
  - Lhj/v;
  - Lhj/w;
  - Lhj/x;
  - Lkj/c;
  - Lkj/d;
  - Lpd/s0;
  - Lpj/c;
  - Lpj/d;
  - Lsj/c;
  - Lsj/d;
  - Lsj/e;
  - Lsj/f;
  - Ltj/a;
  - Ltj/b;
  - Lvj/a;
  - Lvj/b;
  - Lzi/f;
  - Lzi/g;
  - Lzi/h;
  - Lzi/i;
  - Lzi/j;
  - Lzi/k;
  - Lzi/l;
  - Lzi/m;
  - Lzi/n;
  - M2
  - N2
  - O2
  - P2
  - Q2
  - R2
  - S2
  - T2
  - U2
  - V2
  - W2
  - X2
  - Y2
  - Z2
  - [La0/p;
  - [Laj/h;
  - [Lej/a;
  - [Lhj/s;
  - [Lod/a3;
  - [Lod/c2;
  - [Lod/e3;
  - [Lod/h2;
  - [Lod/j2;
  - [Lod/l1;
  - [Lod/l2;
  - [Lod/p0;
  - [Lod/q1;
  - [Lod/r0;
  - [Lod/y1;
  - [Lrj/e;
  - [Lvj/a;
  - a3
  - b3
  - c3
  - d3
  - e3
  - f3
  - g3
  - i3
  - j3
  - k3
  - l3
  - m3
  - n3
  - o3
  - q3
  - r3
  - s3
  - t3
  - u3
  - v3
  - w3
  - x3
  - y3
  - z3
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:0aef74d,r8-mode:full,version:8.1.65}
  

TYPES:

   old   │ new   │ diff        
  ───────┼───────┼─────────────
   12699 │ 12699 │ 0 (+78 -78) 
  + Lej/b;
  + Lfj/c;
  + Lfj/d;
  + Lgj/e;
  + Lgj/f;
  + Lgj/g;
  + Lgj/h;
  + Lgj/i;
  + Lgj/j;
  + Lgj/k;
  + Lgj/l;
  + Lgj/m;
  + Lgj/n;
  + Lgj/o;
  + Lgj/p;
  + Lgj/q;
  + Lgj/r;
  + Lgj/s;
  + Lgj/t;
  + Lgj/u;
  + Lgj/v;
  + Lgj/w;
  + Lgj/x;
  + Lij/b;
  + Lij/c;
  + Ljj/d;
  + Lod/a4;
  + Loj/c;
  + Loj/d;
  + Lqj/c;
  + Lqj/d;
  + Lqj/e;
  + Lqj/f;
  + Lsi/a;
  + Luj/a;
  + Luj/b;
  + Lwi/b;
  + Lwi/c;
  + Lxi/d;
  + Lxi/e;
  + Lxi/f;
  + Lxi/g;
  + Lxi/h;
  + Lxi/i;
  + Lxi/j;
  + Lxi/k;
  + Lxi/l;
  + Lxi/m;
  + Lxi/n;
  + Lyi/a;
  + Lyi/b;
  + Lyi/c;
  + Lyi/d;
  + Lyi/e;
  + Lyi/f;
  + Lyi/g;
  + Lyi/h;
  + Lyi/i;
  + Lyi/j;
  + Lyi/k;
  + Lyi/l;
  + [Lcj/a;
  + [Lgj/s;
  + [Lod/a2;
  + [Lod/c3;
  + [Lod/g2;
  + [Lod/h3;
  + [Lod/i2;
  + [Lod/k2;
  + [Lod/n1;
  + [Lod/q0;
  + [Lod/s2;
  + [Lod/u0;
  + [Lod/x1;
  + [Lqj/e;
  + [Luj/a;
  + [Lx/e;
  + [Lyi/h;
  
  - Laj/c;
  - Laj/d;
  - Laj/e;
  - Laj/f;
  - Laj/g;
  - Laj/h;
  - Laj/i;
  - Laj/j;
  - Laj/k;
  - Laj/l;
  - Lbj/c;
  - Lbj/d;
  - Lbj/e;
  - Lcj/b;
  - Ldj/a;
  - Ldj/b;
  - Lhj/b;
  - Lhj/c;
  - Lhj/d;
  - Lhj/e;
  - Lhj/f;
  - Lhj/g;
  - Lhj/h;
  - Lhj/i;
  - Lhj/j;
  - Lhj/k;
  - Lhj/l;
  - Lhj/m;
  - Lhj/n;
  - Lhj/o;
  - Lhj/p;
  - Lhj/q;
  - Lhj/r;
  - Lhj/s;
  - Lhj/t;
  - Lhj/u;
  - Lhj/v;
  - Lhj/w;
  - Lhj/x;
  - Lkj/c;
  - Lkj/d;
  - Lpd/s0;
  - Lpj/c;
  - Lpj/d;
  - Lsj/c;
  - Lsj/d;
  - Lsj/e;
  - Lsj/f;
  - Ltj/a;
  - Ltj/b;
  - Lvj/a;
  - Lvj/b;
  - Lzi/f;
  - Lzi/g;
  - Lzi/h;
  - Lzi/i;
  - Lzi/j;
  - Lzi/k;
  - Lzi/l;
  - Lzi/m;
  - Lzi/n;
  - [La0/p;
  - [Laj/h;
  - [Lej/a;
  - [Lhj/s;
  - [Lod/a3;
  - [Lod/c2;
  - [Lod/e3;
  - [Lod/h2;
  - [Lod/j2;
  - [Lod/l1;
  - [Lod/l2;
  - [Lod/p0;
  - [Lod/q1;
  - [Lod/r0;
  - [Lod/y1;
  - [Lrj/e;
  - [Lvj/a;
  

METHODS:

   old   │ new   │ di
...✂

@tillh-stripe tillh-stripe force-pushed the tillh/collect-phone-and-email-in-google-pay branch 2 times, most recently from d786cd0 to 74959e5 Compare November 29, 2023 23:26
@tillh-stripe tillh-stripe marked this pull request as ready for review November 30, 2023 02:28
@tillh-stripe tillh-stripe requested review from a team as code owners November 30, 2023 02:28
samer-stripe
samer-stripe previously approved these changes Nov 30, 2023
samer-stripe
samer-stripe previously approved these changes Nov 30, 2023
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.

I think this would be helpful to document what it looks like (as a gif) too.

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, but I think we need one more test with address collection.

@tillh-stripe tillh-stripe marked this pull request as draft November 30, 2023 19:42
@tillh-stripe tillh-stripe marked this pull request as ready for review December 7, 2023 14:41
@tillh-stripe tillh-stripe force-pushed the tillh/collect-phone-and-email-in-google-pay branch from 16aaa1b to f1db248 Compare December 7, 2023 14:42
@tillh-stripe tillh-stripe force-pushed the tillh/collect-phone-and-email-in-google-pay branch from f1db248 to 3bed4b6 Compare December 7, 2023 18:35
@tillh-stripe tillh-stripe merged commit 2055316 into master Dec 7, 2023
8 checks passed
@tillh-stripe tillh-stripe deleted the tillh/collect-phone-and-email-in-google-pay branch December 7, 2023 19:21
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.

Add emailAddressRequired option on PaymentSheet.Configuration.googlePay
3 participants