stripe / stripe-android

Stripe Android SDK
https://stripe.com/docs/mobile/android
MIT License
1.29k stars 647 forks source link

Fix decoding issue in `ElementsSessionJsonParser` #9289

Closed tillh-stripe closed 2 months ago

tillh-stripe commented 2 months ago

Summary

This pull request fixes an issue where the ElementsSessionJsonParser wouldn’t correctly parse unactivated_payment_method_types.

This happened because of some weird JSON manipulation where the unactivated payment method types were put into the JSONObject as a List. The subsequent attempt to retrieve them as a JSONArray thus failed, meaning they were always empty.

Motivation

Testing

Screenshots

Before After
before screenshot after screenshot

Changelog

github-actions[bot] commented 2 months ago

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.9 MiB │   3.9 MiB │ +574 B │   8.6 MiB │   8.6 MiB │ +728 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.6 KiB │  25.6 KiB │    0 B 
      res │ 932.5 KiB │ 932.5 KiB │    0 B │   1.5 MiB │   1.5 MiB │    0 B 
   native │   2.6 MiB │   2.6 MiB │    0 B │     6 MiB │     6 MiB │    0 B 
    asset │   2.9 MiB │   2.9 MiB │    0 B │   2.9 MiB │   2.9 MiB │    0 B 
    other │ 195.8 KiB │ 195.8 KiB │   +1 B │ 430.3 KiB │ 430.3 KiB │    0 B 
──────────┼───────────┼───────────┼────────┼───────────┼───────────┼────────
    total │  12.8 MiB │  12.8 MiB │ +575 B │  21.7 MiB │  21.7 MiB │ +728 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 42586 │ 42586 │ 0 (+1 -1) 
   types │ 14109 │ 14109 │ 0 (+0 -0) 
 classes │ 11751 │ 11751 │ 0 (+0 -0) 
 methods │ 60304 │ 60304 │ 0 (+0 -0) 
  fields │ 39986 │ 39986 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6245 │ 6245 │  0
APK ``` compressed │ uncompressed │ ──────────┬────────┼───────────┬────────┤ size │ diff │ size │ diff │ path ──────────┼────────┼───────────┼────────┼──────────────────────── 3.9 MiB │ +574 B │ 8.6 MiB │ +728 B │ ∆ classes.dex 53.3 KiB │ +3 B │ 118.1 KiB │ 0 B │ ∆ META-INF/CERT.SF 1.2 KiB │ -1 B │ 1.2 KiB │ 0 B │ ∆ META-INF/CERT.RSA 50 KiB │ -1 B │ 118.1 KiB │ 0 B │ ∆ META-INF/MANIFEST.MF ──────────┼────────┼───────────┼────────┼──────────────────────── 4 MiB │ +575 B │ 8.8 MiB │ +728 B │ (total) ```
DEX ``` STRINGS: old │ new │ diff ───────┼───────┼─────────── 42586 │ 42586 │ 0 (+1 -1) + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:6f4684a,r8-mode:full,version:8.5.35} - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:cb3635f,r8-mode:full,version:8.5.35} ```