Skip to content

Introduce form validation #11382

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Conversation

samer-stripe
Copy link
Collaborator

@samer-stripe samer-stripe commented Aug 18, 2025

Summary

Introduce form validation

Motivation

Merchant ask, upon clicking the disabled Continue button, should show all validation errors.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Copy link
Contributor

github-actions bot commented Aug 18, 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.8 MiB │   4.8 MiB │ +3.9 KiB │  10.5 MiB │  10.5 MiB │ +10.3 KiB 
     arsc │   2.6 MiB │   2.6 MiB │      0 B │   2.6 MiB │   2.6 MiB │       0 B 
 manifest │   5.8 KiB │   5.8 KiB │      0 B │  30.1 KiB │  30.1 KiB │       0 B 
      res │ 924.5 KiB │ 924.5 KiB │      0 B │   1.5 MiB │   1.5 MiB │       0 B 
   native │   3.5 MiB │   3.5 MiB │      0 B │   8.5 MiB │   8.5 MiB │       0 B 
    asset │   1.6 MiB │   1.6 MiB │     -1 B │   1.6 MiB │   1.6 MiB │      -1 B 
    other │ 198.5 KiB │ 198.5 KiB │    +16 B │ 374.9 KiB │ 374.9 KiB │       0 B 
──────────┼───────────┼───────────┼──────────┼───────────┼───────────┼───────────
    total │  13.6 MiB │  13.6 MiB │ +3.9 KiB │  25.1 MiB │  25.1 MiB │ +10.3 KiB 

         │         raw          │              unique               
         ├───────┬───────┬──────┼───────┬───────┬───────────────────
 DEX     │ old   │ new   │ diff │ old   │ new   │ diff              
─────────┼───────┼───────┼──────┼───────┼───────┼───────────────────
   files │     2 │     2 │    0 │       │       │                   
 strings │ 53316 │ 53342 │  +26 │ 49691 │ 49717 │ +26 (+106 -80)    
   types │ 19006 │ 19014 │   +8 │ 17292 │ 17300 │  +8 (+81 -73)     
 classes │ 14591 │ 14599 │   +8 │ 14591 │ 14599 │  +8 (+18 -10)     
 methods │ 74296 │ 74368 │  +72 │ 71485 │ 71557 │ +72 (+3363 -3291) 
  fields │ 48385 │ 48434 │  +49 │ 47429 │ 47478 │ +49 (+3029 -2980) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6355 │ 6355 │  0
APK
      compressed      │     uncompressed      │                                           
───────────┬──────────┼───────────┬───────────┤                                           
 size      │ diff     │ size      │ diff      │ path                                      
───────────┼──────────┼───────────┼───────────┼───────────────────────────────────────────
   4.3 MiB │ +3.9 KiB │   9.4 MiB │ +10.3 KiB │ ∆ classes.dex                             
 472.2 KiB │    +15 B │   1.1 MiB │       0 B │ ∆ classes2.dex                            
  55.1 KiB │    +12 B │ 122.2 KiB │       0 B │ ∆ META-INF/CERT.SF                        
  51.6 KiB │     +4 B │ 122.1 KiB │       0 B │ ∆ META-INF/MANIFEST.MF                    
     270 B │     -2 B │     120 B │       0 B │ ∆ META-INF/version-control-info.textproto 
   9.3 KiB │     -2 B │   9.2 KiB │      -2 B │ ∆ assets/dexopt/baseline.prof             
   1.2 KiB │     +2 B │   1.2 KiB │       0 B │ ∆ META-INF/CERT.RSA                       
   1.1 KiB │     +1 B │     1 KiB │      +1 B │ ∆ assets/dexopt/baseline.profm            
───────────┼──────────┼───────────┼───────────┼───────────────────────────────────────────
   4.9 MiB │ +3.9 KiB │  10.8 MiB │ +10.3 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   49691 │ 49717 │ +26 (+106 -80) 
  
  + , canClickWhileDisabled=
  + , isValidating=
  + , onDisabledClick=
  + , validating=
  + LLLZLLI
  + LX9/h2;
  + LX9/i2;
  + LX9/j2;
  + LZJJJJLII
  + Le8/y;
  + Lg7/n1;
  + Lh9/S2;
  + Lh9/T2;
  + Lj6/i;
  + Lk9/f;
  + Ls8/G2;
  + Ls8/H2;
  + Ls8/I2;
  + Lsa/r0;
  + Lt8/B0;
  + Lv7/e;
  + Lv7/f;
  + Lw6/x;
  + Lw6/y;
  + VLLLLLLLLLLLLLLZ
  + VLLLLLLLZLLLL
  + VLLLLLZZLL
  + VLLLLZLLLII
  + VLLZLLLZ
  + VLZLJZZI
  + VLZLJZZLI
  + VLZLLLLLLLL
  + VLZLLZZ
  + VLZLZLZL
  + VLZZLLLL
  + [LX9/A1;
  + [LX9/E1;
  + [LX9/F1;
  + [LX9/L0;
  + [LX9/M1;
  + [LX9/N0;
  + [LX9/P1;
  + [LX9/R0;
  + [LX9/V0;
  + [LX9/W1;
  + [LX9/d2;
  + [LX9/e1;
  + [LX9/h2;
  + [LX9/j0;
  + [LX9/j2;
  + [LX9/m0;
  + [LX9/m1;
  + [LX9/s1;
  + [LX9/w1;
  + [Le8/w;
  + [Lf8/w;
  + [Lg7/I0;
  + [Lg7/L0;
  + [Lg7/N;
  + [Lg7/P0;
  + [Lg7/R0;
  + [Lg7/T;
  + [Lg7/a0;
  + [Lg7/c1;
  + [Lg7/f0;
  + [Lg7/n0;
  + [Lg7/p;
  + [Lg7/t;
  + [Lga/h1;
  + [Lga/k1;
  + [Lh9/r2;
  + [Lh9/s2;
  + [Lh9/w2;
  + [Ls7/L;
  + [Ls8/A0;
  + [Ls8/C0;
  + [Ls8/H0;
  + [Ls8/H2;
  + [Ls8/I2;
  + [Ls8/J0;
  + [Ls8/K1;
  + [Ls8/N1;
  + [Ls8/Q0;
  + [Ls8/S1;
  + [Ls8/V0;
  + [Ls8/Z0;
  + [Ls8/m0;
  + [Ls8/p1;
  + [Ls8/t0;
  + [Ls8/z1;
  + [Lsa/F;
  + [Lsa/O;
  + [Lsa/e0;
  + [Lsa/g0;
  + [Lsa/p0;
  + [Lsa/z;
  + [Lw7/d;
  + [Ly7/s;
  + onDisabledClick
  + onDisabledClick()V
  + onDisabledPayClicked
  + onDisabledPayClicked()V
  + validate
  + validate()V
  + validationRequested
  + ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"13e418b","r8-mode":"full","version":"8.8.34"}
  
  - LZJJJLII
  - Lea/r;
  - Lf8/D;
  - Lga/Z1;
  - Lga/a2;
  - Lv6/v;
  - Lw7/q;
  - Lw7/r;
  - Lx7/e;
  - Ly7/t;
  - Lz7/g0;
  - VLLJZZI
  - VLLJZZLI
  - VLLLLLLLZLLL
  - VLLLZLLZ
  - VLZLZL
  - [LX9/B1;
  - [LX9/C1;
  - [LX9/I1;
  - [LX9/K0;
  - [LX9/L1;
  - [LX9/O0;
  - [LX9/S0;
  - [LX9/T1;
  - [LX9/a2;
  - [LX9/b1;
  - [LX9/d1;
  - [LX9/e2;
  - [LX9/g2;
  - [LX9/h0;
  - [LX9/k0;
  - [LX9/p1;
  - [LX9/t1;
  - [LX9/u1;
  - [LX9/z0;
  - [Le8/t;
  - [Lf8/y;
  - [Lg7/D0;
  - [Lg7/G;
  - [Lg7/J0;
  - [Lg7/N0;
  - [Lg7/Q0;
  - [Lg7/S;
  - [Lg7/Z;
  - [Lg7/b1;
  - [Lg7/e0;
  - [Lg7/m0;
  - [Lg7/n;
  - [Lg7/q;
  - [Lga/j1;
  - [Lga/o1;
  - [Lh9/o2;
  - [Lh9/p2;
  - [Lh9/u2;
  - [Ls7/K;
  - [Ls8/B0;
  - [Ls8/D0;
  - [Ls8/E2;
  - [Ls8/F1;
  - [Ls8/F2;
  - [Ls8/G1;
  - [Ls8/I0;
  - [Ls8/M0;
  - [Ls8/Q1;
  - [Ls8/R0;
  - [Ls8/W0;
  - [Ls8/a1;
  - [Ls8/e0;
  - [Ls8/n0;
  - [Ls8/q1;
  - [Ls8/u0;
  - [Lsa/E;
  - [Lsa/N;
  - [Lsa/d0;
  - [Lsa/f0;
  - [Lsa/o0;
  - [Lsa/y;
  - [Lw7/f;
  - [Ly7/t;
  - ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"10609ac","r8-mode":"full","version":"8.8.34"}
  

TYPES:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   17292 │ 17300 │ +8 (+81 -73) 
  
  + LX9/h2;
  + LX9/i2;
  + LX9/j2;
  + Le8/y;
  + Lg7/n1;
  + Lh9/S2;
  + Lh9/T2;
  + Lj6/i;
  + Lk9/f;
  + Ls8/G2;
  + Ls8/H2;
  + Ls8/I2;
  + Lsa/r0;
  + Lt8/B0;
  + Lv7/e;
  + Lv7/f;
  + Lw6/x;
  + Lw6/y;
  + [LX9/A1;
  + [LX9/E1;
  + [LX9/F1;
  + [LX9/L0;
  + [LX9/M1;
  + [LX9/N0;
  + [LX9/P1;
  + [LX9/R0;
  + [LX9/V0;
  + [LX9/W1;
  + [LX9/d2;
  + [LX9/e1;
  + [LX9/h2;
  + [LX9/j0;
  + [LX9/j2;
  + [LX9/m0;
  + [LX9/m1;
  + [LX9/s1;
  + [LX9/w1;
  + [Le8/w;
  + [Lf8/w;
  + [Lg7/I0;
  + [Lg7/L0;
  + [Lg7/N;
  + [Lg7/P0;
  + [Lg7/R0;
  + [Lg7/T;
  + [Lg7/a0;
  + [Lg7/c1;
  + [Lg7/f0;
  + [Lg7/n0;
  + [Lg7/p;
  + [Lg7/t;
  + [Lga/h1;
  + [Lga/k1;
  + [Lh9/r2;
  + [Lh9/s2;
  + [Lh9/w2;
  + [Ls7/L;
  + [Ls8/A0;
  + [Ls8/C0;
  + [Ls8/H0;
  + [Ls8/H2;
  + [Ls8/I2;
  + [Ls8/J0;
  + [Ls8/K1;
  + [Ls8/N1;
  + [Ls8/Q0;
  + [Ls8/S1;
  + [Ls8/V0;
  + [Ls8/Z0;
  + [Ls8/m0;
  + [Ls8/p1;
  + [Ls8/t0;
  + [Ls8/z1;
  + [Lsa/F;
  + [Lsa/O;
  + [Lsa/e0;
  + [Lsa/g0;
  + [Lsa/p0;
  + [Lsa/z;
  + [Lw7/d;
  + [Ly7/s;
  
  - Lea/r;
  - Lf8/D;
  - Lga/Z1;
  - Lga/a2;
  - Lv6/v;
  - Lw7/q;
  - Lw7/r;
  - Lx7/e;
  - Ly7/t;
  - Lz7/g0;
  - [LX9/B1;
  - [LX9/C1;
  - [LX9/I1;
  - [LX9/K0;
  - [LX9/L1;
  - [LX9/O0;
  - [LX9/S0;
  - [LX9/T1;
  - [LX9/a2;
  - [LX9/b1;
  - [LX9/d1;
  - [LX9/e2;
  - [LX9/g2;
  - [LX9/h0;
  - [LX9/k0;
  - [LX9/p1;
  - [LX9/t1;
  - [LX9/u1;
  - [LX9/z0;
  - [Le8/t;
  - [Lf8/y;
  - [Lg7/D0;
  - [Lg7/G;
  - [Lg7/J0;
  - [Lg7/N0;
  - [Lg7/Q0;
  - [Lg7/S;
  - [Lg7/Z;
  - [Lg7/b1;
  - [Lg7/e0;
  - [Lg7/
...✂

@samer-stripe samer-stripe force-pushed the samer/validation-errors branch from 954a611 to 698405e Compare August 19, 2025 00:55
@samer-stripe samer-stripe changed the title Form Validation Introduce validation to various form controllers Aug 19, 2025
@samer-stripe samer-stripe force-pushed the samer/validation-errors branch 3 times, most recently from f896c15 to 76779ee Compare August 19, 2025 02:17
MaterialTheme.colors.error
} else {
Color.Transparent
},
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This adds support for underlining the dropdown.

@@ -406,7 +407,7 @@ fun TextFieldColors(
placeholderColor = MaterialTheme.stripeColors.placeholderText,
backgroundColor = backgroundColor,
focusedIndicatorColor = Color.Transparent,
disabledIndicatorColor = Color.Transparent,
disabledIndicatorColor = disabledIndicatorColor,
unfocusedIndicatorColor = Color.Transparent,
cursorColor = MaterialTheme.stripeColors.textCursor
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This allows for the indicator to have a color when disabled (used for dropdown

phoneNumberMinimumLength
) { value, minLength ->
value to (value.length >= (minLength ?: 0) || acceptAnyInput)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Helps stop a double value emit

@samer-stripe samer-stripe force-pushed the samer/validation-errors branch from 76779ee to a6724a3 Compare August 19, 2025 02:25
@samer-stripe samer-stripe changed the title Introduce validation to various form controllers Introduce form validation Aug 19, 2025
@samer-stripe samer-stripe force-pushed the samer/validation-errors branch 2 times, most recently from 6d282f7 to e254fdc Compare August 20, 2025 05:05
@samer-stripe samer-stripe force-pushed the samer/validation-errors branch from fa52ba8 to 64f9044 Compare August 20, 2025 22:30
Copy link
Collaborator

@carlosmuvi-stripe carlosmuvi-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 on the Link side. Tested new card and bank additions to the Link wallet.

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