Skip to content

Conversation

@cttsai-stripe
Copy link
Contributor

Summary

Refactor the two main usage:

  1. configuration validation
  2. customer sheet test mode tag

Motivation

#11902 (comment)

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

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 │   4.6 MiB │   4.6 MiB │   -647 B │ 10.2 MiB │ 10.2 MiB │   -2 KiB 
     arsc │   2.7 MiB │   2.7 MiB │      0 B │  2.7 MiB │  2.7 MiB │      0 B 
 manifest │   5.5 KiB │   5.5 KiB │      0 B │ 29.2 KiB │ 29.2 KiB │      0 B 
      res │ 928.5 KiB │ 928.5 KiB │      0 B │  1.5 MiB │  1.5 MiB │      0 B 
   native │ 949.9 KiB │ 949.9 KiB │      0 B │  2.5 MiB │  2.5 MiB │      0 B 
    asset │  23.2 KiB │  24.8 KiB │ +1.6 KiB │ 43.4 KiB │ 45.1 KiB │ +1.6 KiB 
    other │ 193.9 KiB │ 193.9 KiB │     -3 B │  366 KiB │  366 KiB │      0 B 
──────────┼───────────┼───────────┼──────────┼──────────┼──────────┼──────────
    total │   9.4 MiB │   9.4 MiB │ +1,012 B │ 17.3 MiB │ 17.3 MiB │   -382 B 

         │         raw          │             unique              
         ├───────┬───────┬──────┼───────┬───────┬─────────────────
 DEX     │ old   │ new   │ diff │ old   │ new   │ diff            
─────────┼───────┼───────┼──────┼───────┼───────┼─────────────────
   files │     2 │     2 │    0 │       │       │                 
 strings │ 50809 │ 50795 │  -14 │ 47959 │ 47953 │  -6 (+8 -14)    
   types │ 18320 │ 18310 │  -10 │ 16955 │ 16951 │  -4 (+7 -11)    
 classes │ 14307 │ 14303 │   -4 │ 14307 │ 14303 │  -4 (+0 -4)     
 methods │ 71464 │ 71457 │   -7 │ 69503 │ 69497 │  -6 (+282 -288) 
  fields │ 47702 │ 47667 │  -35 │ 46707 │ 46676 │ -31 (+451 -482) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6245 │ 6245 │  0
APK
      compressed      │     uncompressed     │                                           
───────────┬──────────┼───────────┬──────────┤                                           
 size      │ diff     │ size      │ diff     │ path                                      
───────────┼──────────┼───────────┼──────────┼───────────────────────────────────────────
   8.7 KiB │ +1.6 KiB │   8.6 KiB │ +1.6 KiB │ ∆ assets/dexopt/baseline.prof             
 288.5 KiB │   -595 B │ 695.1 KiB │ -1.2 KiB │ ∆ classes2.dex                            
   4.3 MiB │    -52 B │   9.5 MiB │   -848 B │ ∆ classes.dex                             
  50.4 KiB │     -6 B │ 118.5 KiB │      0 B │ ∆ META-INF/MANIFEST.MF                    
   1.1 KiB │     -4 B │     961 B │     -4 B │ ∆ assets/dexopt/baseline.profm            
     272 B │     +1 B │     120 B │      0 B │ ∆ META-INF/version-control-info.textproto 
  53.6 KiB │     +1 B │ 118.6 KiB │      0 B │ ∆ META-INF/CERT.SF                        
   1.2 KiB │     +1 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA                       
───────────┼──────────┼───────────┼──────────┼───────────────────────────────────────────
   4.7 MiB │ +1,012 B │  10.5 MiB │   -382 B │ (total)
DEX
STRINGS:

   old   │ new   │ diff        
  ───────┼───────┼─────────────
   47959 │ 47953 │ -6 (+8 -14) 
  
  + [LK6/L;
  + [LK6/P;
  + [Lx8/E;
  + [Lx8/J;
  + [Lx8/Q;
  + [Lx8/Y;
  + [Lx8/h0;
  + ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"e705f6e","r8-mode":"full","version":"8.8.34"}
  
  - LD6/q;
  - LD6/r;
  - LK6/T;
  - Lx8/q0;
  - [LK6/O;
  - [LK6/S;
  - [Lx8/I;
  - [Lx8/L;
  - [Lx8/V;
  - [Lx8/Z;
  - [Lx8/j0;
  - externalPaymentMethodConfirmHandlerProvider
  - isLiveModeProvider
  - ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"b7e75b7","r8-mode":"full","version":"8.8.34"}
  

TYPES:

   old   │ new   │ diff        
  ───────┼───────┼─────────────
   16955 │ 16951 │ -4 (+7 -11) 
  
  + [LK6/L;
  + [LK6/P;
  + [Lx8/E;
  + [Lx8/J;
  + [Lx8/Q;
  + [Lx8/Y;
  + [Lx8/h0;
  
  - LD6/q;
  - LD6/r;
  - LK6/T;
  - Lx8/q0;
  - [LK6/O;
  - [LK6/S;
  - [Lx8/I;
  - [Lx8/L;
  - [Lx8/V;
  - [Lx8/Z;
  - [Lx8/j0;
  

METHODS:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   69503 │ 69497 │ -6 (+282 -288) 
  
  + D6.h <clinit>()
  + D6.i <init>(int)
  + D6.j <init>(b, int)
  + D6.j get() → Object
  + D6.k <init>(s)
  + D6.k a(s) → e
  + D6.l <clinit>()
  + D6.m <init>(Q, z)
  + D6.m equals(Object) → boolean
  + D6.m hashCode() → int
  + D6.m toString() → String
  + D6.n <init>(Object, int)
  + D6.n <init>(q, c)
  + D6.n get() → Object
  + D6.o <init>(b, h)
  + D6.o <init>(h, int)
  + D6.o a(Application) → h
  + D6.o get() → Object
  + D6.p <init>(a, e, e)
  + D6.p <init>(e, e, int)
  + E7.b <init>(o, o, o, h, g)
  + G0.c L(V, J0)
  + J7.F c(K)
  + J7.O <init>(h0, J0, f, boolean, boolean, Set, String)
  + J7.P1 <init>(V, J0, String, Integer, boolean)
  + J7.g2 <init>(o2, h0, Continuation)
  + J7.o2 <init>(P1, e, B, m, b, CoroutineContext, g0, F, O, b, g, a, F)
  + J7.o2 v(h0, ContinuationImpl) → Object
  + J7.o2 x(h0, ContinuationImpl) → Object
  + J7.p2 <init>(e, b, e, e, d, l, q, e, f, q, e, o)
  + J7.p2 <init>(e, h, h, h, h, h, e, h, e, k, g, h)
  + K6.A <init>(Object, long, int, int)
  + K6.B <init>(p, boolean, t1, D0, boolean, Function0, boolean, t1, f, boolean, String, b0, q, b0)
  + K6.B f(Object, Object, Object) → Object
  + K6.C <init>(b0, Continuation, Function1)
  + K6.C g(Object, Object) → Object
  + K6.C m(Object, Continuation) → Continuation
  + K6.C p(Object) → Object
  + K6.D <init>(i, Z0, b0, Continuation)
  + K6.E <init>(boolean, boolean, q, Continuation)
  + K6.F <init>(c, Continuation)
  + K6.G <init>(long, a)
  + K6.G <init>(String, long)
  + K6.G f(Object, Object, Object) → Object
  + K6.H <init>(c, t1, D0, t1, boolean, f, boolean, boolean, String, p, int)
  + K6.H <init>(boolean, a, boolean, boolean, n1, n1, D0, a, m0, b1, int)
  + K6.H g(Object, Object) → Object
  + K6.I <init>(b0, Continuation, Function1)
  + K6.I m(Object, Continuation) → Continuation
  + K6.I p(Object) → Object
  + K6.J <init>(i, Z0, b0, Continuation)
  + K6.K <init>(c, t1, boolean, q, q, q, boolean, Continuation)
  + K6.L <clinit>()
  + K6.L valueOf(String) → L
  + K6.L values() → L[]
  + K6.O <init>(int)
  + K6.O createFromParcel(Parcel) → Object
  + K6.O newArray(int) → Object[]
  + K6.P <clinit>()
  + K6.P <init>(String)
  + K6.P describeContents() → int
  + K6.P equals(Object) → boolean
  + K6.P hashCode() → int
  + K6.P toString() → String
  + K6.P writeToParcel(Parcel, int)
  + K6.Q <init>(String, String, String, String, N, String)
  + K6.c <init>(M, S, Boolean, b)
  + K6.k <init>(S, M, Boolean, Q, J, c, b)
  + K6.k g(String, String, String, boolean) → Q
  + K6.l <clinit>()
  + K6.m <init>(S, String, M, List, Set, boolean, boolean, boolean, boolean, boolean, f, boolean)
  + K6.m a(m, S, boolean, boolean, f, int) → m
  + K6.m b() → boolean
  + K6.m equals(Object) → boolean
  + K6.m hashCode() → int
  + K6.m toString() → String
  + K6.n <init>(int)
  + K6.n b() → Object
  + K6.o <init>(S, C1, Q, M, boolean, Function1, p, Boolean, int)
  + K6.o <init>(String, boolean, Function1, L, Set, List, m0, p, int)
  + K6.o <init>(List, boolean, t1, Integer, E, Function0, Function0, Function1, int)
  + K6.o <init>(boolean, String, List, a, r, X, Function1, Function0, int)
  + K6.o g(Object, Object) → Object
  + K6.p <init>(Integer, t1, D0, t1, f, boolean, boolean, boolean, boolean, String, boolean, Function0, p, q, q, q, int, int, int)
  + K6.q <init>(String, int)
  + K6.r <init>(Function0, Continuation)
  + K6.r 
...✂

private fun externalPaymentMethodsValidate(isLiveMode: Boolean) {
private fun externalPaymentMethodsValidate() {
externalPaymentMethods.forEach { externalPaymentMethod ->
if (!externalPaymentMethod.startsWith("external_") && isLiveMode.not()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't check isLiveMode in other validation functions. I propose we remove it if we don't have good reasons to keep it. cc. @toluo-stripe

Copy link
Collaborator

Choose a reason for hiding this comment

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

The idea is that this isn't worth failing load for. We can still allow a user to successfully check out with a mis configuration in production. I think it's worth keeping!

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.

3 participants