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

Use locale in PopupPayload #8147

Merged
merged 1 commit into from
Mar 22, 2024
Merged

Conversation

samer-stripe
Copy link
Collaborator

@samer-stripe samer-stripe commented Mar 22, 2024

Summary

In PopupPayload, we currently use the customer's provided info to fetch their billing country. If the customer does not have a provided billing country, then we use the merchant's billing country.

There's a good chance the merchant and customer do not have the same billing country. Using the device's locale gives us a more accurate result of the customer's billing country.

Motivation

Resolves MOBILESDK-1852

iOS also uses the intent's billing country as a third backup but on Android we have a guaranteed locale returned.

Testing

  • Added tests
  • Modified tests
  • Manually verified

@samer-stripe samer-stripe marked this pull request as ready for review March 22, 2024 16:47
@samer-stripe samer-stripe requested review from a team as code owners March 22, 2024 16:47
Copy link
Contributor

github-actions bot commented Mar 22, 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.9 MiB │   3.9 MiB │ +63 B │  8.6 MiB │  8.6 MiB │ +20 B 
     arsc │   2.5 MiB │   2.5 MiB │   0 B │  2.5 MiB │  2.5 MiB │   0 B 
 manifest │   5.1 KiB │   5.1 KiB │   0 B │ 25.4 KiB │ 25.4 KiB │   0 B 
      res │ 935.7 KiB │ 935.7 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 │     3 MiB │     3 MiB │ -17 B │    3 MiB │    3 MiB │ -17 B 
    other │ 210.8 KiB │ 210.8 KiB │  -4 B │  471 KiB │  471 KiB │   0 B 
──────────┼───────────┼───────────┼───────┼──────────┼──────────┼───────
    total │  13.1 MiB │  13.1 MiB │ +42 B │   22 MiB │   22 MiB │  +3 B 

 DEX     │ old   │ new   │ diff       
─────────┼───────┼───────┼────────────
   files │     1 │     1 │  0         
 strings │ 42710 │ 42710 │  0 (+1 -1) 
   types │ 14590 │ 14590 │  0 (+0 -0) 
 classes │ 12341 │ 12341 │  0 (+0 -0) 
 methods │ 61050 │ 61051 │ +1 (+1 -0) 
  fields │ 40046 │ 40046 │  0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  328 │  328 │  0   
 entries │ 7262 │ 7262 │  0
APK
    compressed    │   uncompressed    │                               
──────────┬───────┼───────────┬───────┤                               
 size     │ diff  │ size      │ diff  │ path                          
──────────┼───────┼───────────┼───────┼───────────────────────────────
  3.9 MiB │ +63 B │   8.6 MiB │ +20 B │ ∆ classes.dex                 
  7.2 KiB │ -17 B │     7 KiB │ -17 B │ ∆ assets/dexopt/baseline.prof 
 54.3 KiB │  -4 B │ 152.8 KiB │   0 B │ ∆ META-INF/MANIFEST.MF        
 67.8 KiB │  +2 B │ 152.9 KiB │   0 B │ ∆ META-INF/CERT.SF            
  1.2 KiB │  -2 B │   1.2 KiB │   0 B │ ∆ META-INF/CERT.RSA           
──────────┼───────┼───────────┼───────┼───────────────────────────────
    4 MiB │ +42 B │   8.9 MiB │  +3 B │ (total)
DEX
STRINGS:

   old   │ new   │ diff      
  ───────┼───────┼───────────
   42710 │ 42710 │ 0 (+1 -1) 
  
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:0b4bc0a,r8-mode:full,version:8.2.47}
  
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:8b7a685,r8-mode:full,version:8.2.47}
  

METHODS:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   61050 │ 61051 │ +1 (+1 -0) 
  
  + ed.c a(p) → String

customerCountryCode: String?
): LinkConfiguration {
return LinkConfiguration(
merchantName = "Jay's Taco Stand",
Copy link
Collaborator

Choose a reason for hiding this comment

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

😆

@@ -58,4 +111,16 @@ internal class PopupPayloadTest {
"link_passthrough_mode_enabled" to true,
),
)

private fun getContext(locale: Locale): Context {
Copy link
Collaborator

Choose a reason for hiding this comment

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

this seems useful! Do we have test utils or anything like that? It'd be nice to have an easy way to find functions like this if I ever wanted to use one. Not necessary for this PR just an idea :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could add a test util for this as part of the new testing module @tjclawson-stripe will be adding.

@amk-stripe amk-stripe merged commit ee658a8 into master Mar 22, 2024
15 checks passed
@amk-stripe amk-stripe deleted the samer/use-locale-in-popup-payload branch March 22, 2024 18:56
samer-stripe added a commit that referenced this pull request Mar 25, 2024
samer-stripe added a commit that referenced this pull request Mar 25, 2024
* Update release notes for 20.41.0

* Update `CHANGELOG` with new `Link` items.

* Remove log item for PR #8148

* Update log items for PR #8117 & #8147
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