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

Don't filter countries when they're not supported from Locale.getISOCountries on older Android versions. #6611

Merged
merged 4 commits into from
Apr 27, 2023

Conversation

jaynewstrom-stripe
Copy link
Collaborator

@jaynewstrom-stripe jaynewstrom-stripe commented Apr 27, 2023

Fixes #6501

Summary

This change no longer uses Locale.getISOCountries, but rather our hardcoded set of supported countries.

Locale.getISOCountries provided an easy way to get the country codes, but was out of sync with what Stripe supported. Now we only filter countries by our hardcoded list, rather than also filtering implicitly via the Android platform.

Motivation

#6501

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Screenshot 2023-04-27 at 10 18 48 AM

Notice the missing icon! This is because we use emojis for the flag, and that emoji isn't support on that version of Android.

Changelog

  • [FIXED]6611 Fixed an issue where countries might be filtered out on old Android versions (notably Kosovo).

@github-actions
Copy link
Contributor

github-actions bot commented Apr 27, 2023

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.3 MiB │   3.3 MiB │ -30 B │   7.3 MiB │   7.3 MiB │ -108 B 
     arsc │   2.1 MiB │   2.1 MiB │   0 B │   2.1 MiB │   2.1 MiB │    0 B 
 manifest │   4.6 KiB │   4.6 KiB │   0 B │  22.3 KiB │  22.3 KiB │    0 B 
      res │ 866.9 KiB │ 866.9 KiB │   0 B │   1.3 MiB │   1.3 MiB │    0 B 
   native │   2.6 MiB │   2.6 MiB │   0 B │     6 MiB │     6 MiB │    0 B 
    asset │     3 MiB │     3 MiB │ +11 B │     3 MiB │     3 MiB │  +11 B 
    other │ 199.5 KiB │ 199.5 KiB │  +2 B │ 446.8 KiB │ 446.8 KiB │    0 B 
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼────────
    total │    12 MiB │    12 MiB │ -17 B │  20.2 MiB │  20.2 MiB │  -97 B 

 DEX     │ old   │ new   │ diff           
─────────┼───────┼───────┼────────────────
   files │     1 │     1 │  0             
 strings │ 35776 │ 35775 │ -1 (+6 -7)     
   types │ 11812 │ 11811 │ -1 (+5 -6)     
 classes │  9924 │  9923 │ -1 (+0 -1)     
 methods │ 52687 │ 52686 │ -1 (+576 -577) 
  fields │ 33486 │ 33486 │  0 (+425 -425) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  291 │  291 │  0   
 entries │ 6915 │ 6915 │  0
APK
    compressed    │    uncompressed    │                                
──────────┬───────┼───────────┬────────┤                                
 size     │ diff  │ size      │ diff   │ path                           
──────────┼───────┼───────────┼────────┼────────────────────────────────
  3.3 MiB │ -30 B │   7.3 MiB │ -108 B │ ∆ classes.dex                  
  6.4 KiB │ +12 B │   6.3 KiB │  +12 B │ ∆ assets/dexopt/baseline.prof  
 62.7 KiB │  +2 B │ 140.9 KiB │    0 B │ ∆ META-INF/CERT.SF             
    735 B │  -1 B │     603 B │   -1 B │ ∆ assets/dexopt/baseline.profm 
  1.2 KiB │  +1 B │   1.2 KiB │    0 B │ ∆ META-INF/CERT.RSA            
 48.3 KiB │  -1 B │ 140.8 KiB │    0 B │ ∆ META-INF/MANIFEST.MF         
──────────┼───────┼───────────┼────────┼────────────────────────────────
  3.4 MiB │ -17 B │   7.6 MiB │  -97 B │ (total)
DEX
STRINGS:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   35776 │ 35775 │ -1 (+6 -7) 
  + [Llf/m0;
  + [Llf/m2;
  + [Llf/r0;
  + [Llf/r2;
  + [Llf/t1;
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:b1f1ab6,r8-mode:full,version:4.0.52}
  
  - Llf/d4;
  - [Llf/n0;
  - [Llf/n2;
  - [Llf/s0;
  - [Llf/s2;
  - [Llf/u1;
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:88c08a7,r8-mode:full,version:4.0.52}
  

TYPES:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   11812 │ 11811 │ -1 (+5 -6) 
  + [Llf/m0;
  + [Llf/m2;
  + [Llf/r0;
  + [Llf/r2;
  + [Llf/t1;
  
  - Llf/d4;
  - [Llf/n0;
  - [Llf/n2;
  - [Llf/s0;
  - [Llf/s2;
  - [Llf/u1;
  

METHODS:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   52687 │ 52686 │ -1 (+576 -577) 
  + b8.m M(e3, boolean, m2, l, Set, r0, int, int, i, int)
  + cb.c <init>(String, boolean, x0, int, e, l, boolean, y0, int)
  + cb.c <init>(x0, int, c1, boolean, k, e, boolean, y0, int)
  + df.a1 d(boolean, m2, l, Set, r0, int, int, i, int)
  + df.a3 a() → r0
  + df.a4 <init>(r0, int, String)
  + df.a4 a() → r0
  + df.b2 <init>(int, boolean, boolean, boolean, r0)
  + df.b6 <init>(r0, f0)
  + df.b6 a() → r0
  + df.b6 g() → s0
  + df.c <init>(int, r0, Set, Set, boolean)
  + df.c <init>(r0, Set, Set, boolean, c, boolean)
  + df.d4 <init>(int, r0, int)
  + df.d4 <init>(r0, int)
  + df.d <init>(r0)
  + df.d a() → r0
  + df.e2 <init>(int, r0, Set)
  + df.e3 a(e3, r2) → j2
  + df.e6 <init>(int, r0, int, d0, p3, boolean)
  + df.e6 <init>(r0, int)
  + df.e6 b(Map) → j2
  + df.f0 <init>(r0, Map, c, Set, h2, Map, b)
  + df.f6 <init>(r0, int)
  + df.f6 a() → r0
  + df.g <init>(int, r0)
  + df.h1 p(String) → i3
  + df.h4 <init>(int, r0, m6)
  + df.h <init>(r0, a)
  + df.h a() → r0
  + df.i0 <init>(int, r0, Set, b)
  + df.i1 <init>(r0, a1)
  + df.i1 g() → s0
  + df.i3 k(String) → i3
  + df.j0 d(boolean, m2, l, Set, r0, int, int, i, int)
  + df.j3 <init>(r0, c3)
  + df.j3 a() → r0
  + df.j3 g() → s0
  + df.j5 <init>(r0, h5, String)
  + df.j5 a() → r0
  + df.j6 <init>(int, r0, int)
  + df.k1 p(String) → i3
  + df.k <init>(int, r0)
  + df.l2 d(boolean, m2, l, Set, r0, int, int, i, int)
  + df.l2 p(String) → i3
  + df.l k(String) → i3
  + df.m2 <init>(r0, l2)
  + df.m2 g() → s0
  + df.m3 <init>(int, r0)
  + df.m5 <init>(int, r0)
  + df.n6 k(String) → i3
  + df.o <init>(int, r0)
  + df.p4 <init>(int, r0)
  + df.p6 <init>(r0)
  + df.p6 a() → r0
  + df.p6 g() → s0
  + df.p <init>(r0, String)
  + df.p a() → r0
  + df.s0 <init>(r0, Context, Map, Set, boolean)
  + df.s0 f() → o2
  + df.s3 <init>(int, r0)
  + df.s5 <init>(int, r0, int)
  + df.s6 <init>(int, r0)
  + df.s <init>(int, r0)
  + df.t k(String) → i3
  + df.u0 <init>(Context, Map, Set, boolean, r0)
  + df.u0 a() → r0
  + df.v2 <init>(int, r0, m6, List)
  + df.v3 <init>(int, r0)
  + df.v4 <init>(int, r0, u4)
  + df.v <init>(r0, List, String)
  + df.v a() → r0
  + df.w2 <init>(r0, String, int)
  + df.w2 a() → r0
  + df.w2 g() → s0
  + df.w <init>(v, boolean, r0, int)
  + df.w <init>(boolean, v, r0, int)
  + df.y0 <init>(int, r0, boolean)
  + df.y0 <init>(r0, boolean, int)
  + df.z2 <init>(int, r0)
  + df.z <init>(int, r0)
  + f0.t <init>(e3, l2, boolean, l, int, int)
  + f0.t <init>(e3, boolean, int, l, c, int)
  + f0.t <init>(boolean, e3, g, k, int, int)
  + h0.y <init>(String, e3, f1, e3, g, boolean, boolean, boolean, p, a, l, int, int, int)
  + h6.f K(String, boolean, c, i, Set, List, r0, l, i, int, int)
  + h6.f X(int, int, boolean, String, String, x0, boolean, boolean, p, k, a, a, a, i, int, int)
  + h6.f b0(y, String, e3, l2, c, c, a, c, c, c, a, a, c, i, int, int)
  + h6.f o(e3, l2, boolean, l, i, int, int)
  + j4.j U(Integer, List) → j2
  + j4.j q(String, String) → f1
  + j4.j w(String) → q1
  + jd.s m(i3, boolean, d) → Object
  + jd.s p(boolean, i3, d) → Object
  + je.a n(boolean, x0, l, y0, k, i, int, int)
  + je.a v(String, boolean, x0, int, e, l, boolean, y0, i, int)
  + kf.e c(String, t0) → boolean
  + kf.p <init>(String, int, r0, int)
  + kf.u a(r0) → boolean
  + lf.a0 b() → int
  + lf.a0 e(int) → String
  + lf.a0 f() → boolean
  + lf.a0 g() → List
  + lf.a0 h() → ArrayList
  + lf.a0 i() → boolean
  + lf.a1 <init>(e, int)
  + lf.a1 a(x0)
  + lf.a2 <init>(x1)
  + lf.a2 a(e) → q0
  + lf.a3 <init>(y2, d)
  + lf.a3 k(Object) → Object
  + lf.a4 <init>(e3, int, boolean, l, Integer,
...✂

@jaynewstrom-stripe jaynewstrom-stripe requested review from a team and jameswoo-stripe and removed request for a team April 27, 2023 15:49
@jaynewstrom-stripe jaynewstrom-stripe marked this pull request as ready for review April 27, 2023 15:49
@jaynewstrom-stripe jaynewstrom-stripe requested review from a team as code owners April 27, 2023 15:49
Copy link
Contributor

@jameswoo-stripe jameswoo-stripe left a comment

Choose a reason for hiding this comment

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

Does this mean that only API 33+ will see Kosovo emoji?

@@ -79,10 +80,10 @@ class CountryConfigTest {

assertThat(
defaultCountries.size
).isEqualTo(249)
).isEqualTo(235)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the size change due to us not updating the list of supported countries?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Definitely a behavior change! Before we default was the Locale.getISOCountries, and filtered by supportedBillingCountries. No it's always just supportedBillingCountries.

@jaynewstrom-stripe jaynewstrom-stripe merged commit 0938b56 into master Apr 27, 2023
14 checks passed
@jaynewstrom-stripe jaynewstrom-stripe deleted the jaynewstrom/supported-countries branch April 27, 2023 17:06
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.

[BUG] Stripe Android SDK does not support Kosovo on billing information
3 participants