stripe / stripe-android

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

Updates duplicate removal logic and moves it into `CustomerRepository` #8709

Open samer-stripe opened 3 days ago

samer-stripe commented 3 days ago

Summary

Updates duplicate removal logic to remove all duplicates first then remove provided payment method last. Also moves duplicate removal into CustomerRepository definition with an added parameter called canRemoveDuplicates.

Motivation

We only care for the result of the provided PaymentMethod but want to also ensure that the other payment methods are removed as well. With this change, we can guarantee that all duplicates are removed alongside the requested one without having to worry about a duplicate removal failure after the requested one has been removed.

Moving into CustomerRepository for ease of access as well.

Testing

github-actions[bot] commented 3 days ago

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.2 MiB │     4.2 MiB │  0 B 
     arsc │ 1,023.8 KiB │ 1,023.8 KiB │  0 B │ 1,023.7 KiB │ 1,023.7 KiB │  0 B 
 manifest │     2.3 KiB │     2.3 KiB │  0 B │       8 KiB │       8 KiB │  0 B 
      res │   301.5 KiB │   301.5 KiB │  0 B │     455 KiB │     455 KiB │  0 B 
   native │     6.2 MiB │     6.2 MiB │  0 B │    15.8 MiB │    15.8 MiB │  0 B 
    asset │     6.7 KiB │     6.7 KiB │  0 B │     6.5 KiB │     6.5 KiB │  0 B 
    other │    85.5 KiB │    85.5 KiB │  0 B │   158.7 KiB │   158.7 KiB │  0 B 
──────────┼─────────────┼─────────────┼──────┼─────────────┼─────────────┼──────
    total │     9.6 MiB │     9.6 MiB │  0 B │    21.6 MiB │    21.6 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 21305 │ 21305 │ 0 (+0 -0) 
   types │  6770 │  6770 │ 0 (+0 -0) 
 classes │  5559 │  5559 │ 0 (+0 -0) 
 methods │ 31121 │ 31121 │ 0 (+0 -0) 
  fields │ 18141 │ 18141 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3392 │ 3392 │  0
APK ``` compressed │ uncompressed │ ─────────┬──────┼─────────┬──────┤ size │ diff │ size │ diff │ path ─────────┼──────┼─────────┼──────┼─────────────────────────────────────────── 271 B │ -1 B │ 120 B │ 0 B │ ∆ META-INF/version-control-info.textproto 1.2 KiB │ +1 B │ 1.2 KiB │ 0 B │ ∆ META-INF/CERT.RSA ─────────┼──────┼─────────┼──────┼─────────────────────────────────────────── 1.4 KiB │ 0 B │ 1.3 KiB │ 0 B │ (total) ```