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

Fix requirement for phone number not being respected for AddressElement #9577

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

samer-stripe
Copy link
Collaborator

Summary

Fix requirement for phone number not being respected for AddressElement.

Motivation

Ensures AddressElement phone requirements are respected.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Copy link
Contributor

github-actions bot commented Nov 8, 2024

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.8 MiB │   3.8 MiB │ -86 B │   8.4 MiB │   8.4 MiB │ +20 B 
     arsc │   2.3 MiB │   2.3 MiB │   0 B │   2.3 MiB │   2.3 MiB │   0 B 
 manifest │     5 KiB │     5 KiB │   0 B │  24.9 KiB │  24.9 KiB │   0 B 
      res │ 902.3 KiB │ 902.3 KiB │   0 B │   1.4 MiB │   1.4 MiB │   0 B 
   native │   2.6 MiB │   2.6 MiB │   0 B │     6 MiB │     6 MiB │   0 B 
    asset │   1.6 MiB │   1.6 MiB │  +1 B │   1.6 MiB │   1.6 MiB │  +1 B 
    other │ 199.8 KiB │ 199.8 KiB │  -2 B │ 440.1 KiB │ 440.1 KiB │   0 B 
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼───────
    total │  11.4 MiB │  11.4 MiB │ -87 B │  20.2 MiB │  20.2 MiB │ +21 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 39762 │ 39762 │ 0 (+1 -1) 
   types │ 13711 │ 13711 │ 0 (+0 -0) 
 classes │ 11403 │ 11403 │ 0 (+0 -0) 
 methods │ 58604 │ 58604 │ 0 (+0 -0) 
  fields │ 38907 │ 38907 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6190 │ 6190 │  0
APK
    compressed    │   uncompressed    │                               
──────────┬───────┼───────────┬───────┤                               
 size     │ diff  │ size      │ diff  │ path                          
──────────┼───────┼───────────┼───────┼───────────────────────────────
  3.8 MiB │ -86 B │   8.4 MiB │ +20 B │ ∆ classes.dex                 
  1.2 KiB │  -2 B │   1.2 KiB │   0 B │ ∆ META-INF/CERT.RSA           
  7.8 KiB │  +1 B │   7.7 KiB │  +1 B │ ∆ assets/dexopt/baseline.prof 
   53 KiB │  +1 B │ 117.6 KiB │   0 B │ ∆ META-INF/CERT.SF            
 49.7 KiB │  -1 B │ 117.5 KiB │   0 B │ ∆ META-INF/MANIFEST.MF        
──────────┼───────┼───────────┼───────┼───────────────────────────────
    4 MiB │ -87 B │   8.6 MiB │ +21 B │ (total)
DEX
STRINGS:

   old   │ new   │ diff      
  ───────┼───────┼───────────
   39762 │ 39762 │ 0 (+1 -1) 
  
  + ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"4049ae7","r8-mode":"full","version":"8.7.14"}
  
  - ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"fd7e54d","r8-mode":"full","version":"8.7.14"}

@@ -60,7 +60,7 @@ open class AddressElement(
PhoneNumberController.createPhoneNumberController(
initialValue = rawValuesMap[IdentifierSpec.Phone] ?: "",
showOptionalLabel = addressType.phoneNumberState == PhoneNumberState.OPTIONAL,
acceptAnyInput = true,
acceptAnyInput = addressType.phoneNumberState != PhoneNumberState.REQUIRED,
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 won't affect PaymentSheet as it has separate fields for collecting phone numbers and is only required if collectPhone is true in BillingDetailsCollectionConfiguration. Collecting full billing details does not expose the phone number field as it does in the AddressElement product.

@samer-stripe samer-stripe marked this pull request as ready for review November 8, 2024 18:54
@samer-stripe samer-stripe requested review from a team as code owners November 8, 2024 18:54
Copy link
Collaborator

@jaynewstrom-stripe jaynewstrom-stripe left a comment

Choose a reason for hiding this comment

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

Thanks!

@samer-stripe samer-stripe enabled auto-merge (squash) November 11, 2024 18:44
@samer-stripe samer-stripe merged commit a86c9fe into master Nov 11, 2024
16 checks passed
@samer-stripe samer-stripe deleted the samer/fix-address-element-phone-requirement branch November 11, 2024 18:52
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.

2 participants