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

Show blocked brands as disabled in CBC drop down #9979

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

porter-stripe
Copy link
Contributor

Summary

  • For card brand filtering, we now want to show blocked brands in the CBC dropdown as disabled rather than just hide them from the drop down.
  • This now shows blocked card brand as "not available"
  • Context here

Motivation

https://jira.corp.stripe.com/browse/MOBILESDK-3036

Testing

  • Manual
  • E2E test updated
  • New unit test

Screenshots

CleanShot 2025-01-24 at 10 07 54
CleanShot 2025-01-24 at 09 38 30

Changelog

N/A

Copy link
Contributor

github-actions bot commented Jan 24, 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 MiB │     4 MiB │   +496 B │  8.7 MiB │  8.7 MiB │   +388 B 
     arsc │   2.3 MiB │   2.3 MiB │   +728 B │  2.3 MiB │  2.3 MiB │   +728 B 
 manifest │   5.1 KiB │   5.1 KiB │      0 B │ 25.7 KiB │ 25.7 KiB │      0 B 
      res │ 910.3 KiB │ 910.3 KiB │     -3 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 │    -17 B │  1.6 MiB │  1.6 MiB │    -17 B 
    other │   1.4 MiB │   1.4 MiB │    -13 B │  1.6 MiB │  1.6 MiB │      0 B 
──────────┼───────────┼───────────┼──────────┼──────────┼──────────┼──────────
    total │  12.7 MiB │  12.7 MiB │ +1.2 KiB │ 21.6 MiB │ 21.6 MiB │ +1.1 KiB 

 DEX     │ old   │ new   │ diff         
─────────┼───────┼───────┼──────────────
   files │     1 │     1 │  0           
 strings │ 40955 │ 40956 │ +1 (+4 -3)   
   types │ 14144 │ 14144 │  0 (+0 -0)   
 classes │ 11805 │ 11805 │  0 (+0 -0)   
 methods │ 60127 │ 60129 │ +2 (+34 -32) 
  fields │ 40226 │ 40228 │ +2 (+9 -7)   

 ARSC    │ old  │ new  │ diff       
─────────┼──────┼──────┼────────────
 configs │  243 │  243 │  0         
 entries │ 6211 │ 6212 │ +1 (+1 -0)
APK
     compressed      │     uncompressed     │                                           
──────────┬──────────┼───────────┬──────────┤                                           
 size     │ diff     │ size      │ diff     │ path                                      
──────────┼──────────┼───────────┼──────────┼───────────────────────────────────────────
  2.3 MiB │   +728 B │   2.3 MiB │   +728 B │ ∆ resources.arsc                          
    4 MiB │   +496 B │   8.7 MiB │   +388 B │ ∆ classes.dex                             
  7.7 KiB │    -17 B │   7.6 KiB │    -17 B │ ∆ assets/dexopt/baseline.prof             
 53.6 KiB │     -8 B │ 118.8 KiB │      0 B │ ∆ META-INF/CERT.SF                        
 50.4 KiB │     -3 B │ 118.8 KiB │      0 B │ ∆ META-INF/MANIFEST.MF                    
    271 B │     -1 B │     120 B │      0 B │ ∆ META-INF/version-control-info.textproto 
  1.2 KiB │     -1 B │   3.9 KiB │      0 B │ ∆ res/2d.xml                              
  1.2 KiB │     -1 B │   3.7 KiB │      0 B │ ∆ res/BH.xml                              
  1.1 KiB │     -1 B │   3.2 KiB │      0 B │ ∆ res/nn.xml                              
  1.2 KiB │     -1 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA                       
──────────┼──────────┼───────────┼──────────┼───────────────────────────────────────────
  6.3 MiB │ +1.2 KiB │  11.2 MiB │ +1.1 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   40955 │ 40956 │ +1 (+4 -3) 
  
  + VLLZJZLI
  + VLLZJZLLI
  + allChoices
  + ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"2434e62","r8-mode":"full","version":"8.7.14"}
  
  - VLLZJLI
  - VLLZJLLI
  - ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"7feffa3","r8-mode":"full","version":"8.7.14"}
  

METHODS:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   60127 │ 60129 │ +2 (+34 -32) 
  
  + N.L0 h() → P0
  + N.L0 i()
  + N.L0 j(Object, Object) → boolean
  + N.L0 k(Object)
  + N.L0 l(List)
  + P3.e i()
  + Q2.g i()
  + Q2.g k(Context)
  + R4.d l(List)
  + R4.h <init>(c, i, i, v, d, a)
  + R6.m e(String, Integer, boolean, long, boolean, a, p, int)
  + X8.R0 a() → boolean
  + X8.T0 <init>(String, Integer, boolean, long, boolean, a, int)
  + X8.X0 <init>(String, c, int, boolean)
  + X8.X0 a() → boolean
  + c2.g h(l)
  + c2.g i()
  + c2.g k(int, float)
  + c2.g l(List)
  + d8.h <init>(i, boolean)
  + d8.h a() → boolean
  + f2.e i()
  + h.F h(l)
  + h.N h(l)
  + h.T h(l)
  + h.T i()
  + h.t i(F)
  + m.b i()
  + m.e h(l)
  + m.e i()
  + n.j h(l)
  + o.Y0 h(l)
  + o.Y k(int, float)
  + o.a0 k(int, float)
  
  - N.L0 h(ArrayList)
  - N.L0 i() → P0
  - N.L0 j()
  - N.L0 k(Object, Object) → boolean
  - N.L0 l(Object)
  - P3.e k()
  - Q2.g i(Context)
  - Q2.g k()
  - R4.d h(ArrayList)
  - R4.h <init>(c, i, i, v, d, a, a)
  - R4.h d(List)
  - R6.m e(String, Integer, boolean, long, a, p, int)
  - X8.T0 <init>(String, Integer, boolean, long, a, int)
  - X8.X0 <init>(String, c, int)
  - c2.g h(ArrayList)
  - c2.g i(l)
  - c2.g k()
  - c2.g l(int, float)
  - d8.h <init>(i)
  - f2.e k()
  - h.F i(l)
  - h.N i(l)
  - h.T h()
  - h.T i(l)
  - h.t h(F)
  - m.b h()
  - m.e h()
  - m.e i(l)
  - n.j i(l)
  - o.Y0 i(l)
  - o.Y l(int, float)
  - o.a0 l(int, float)
  

FIELDS:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   40226 │ 40228 │ +2 (+9 -7) 
  
  + R4.h g: d0
  + R4.h h: a
  + R4.h i: List
  + R4.h j: q0
  + X8.T0 h: boolean
  + X8.T0 i: a
  + X8.T0 j: int
  + X8.X0 d: boolean
  + d8.h b: boolean
  
  - R4.h g: a
  - R4.h h: d0
  - R4.h i: a
  - R4.h j: Object
  - R4.h k: q0
  - X8.T0 h: a
  - X8.T0 i: int
ARSC
ENTRIES:

   old  │ new  │ diff       
  ──────┼──────┼────────────
   6211 │ 6212 │ +1 (+1 -0) 
  + string/stripe_card_brand_not_accepted_with_brand

@porter-stripe porter-stripe changed the title Porter/mobilesdk 3036 Show blocked brands as disabled in CBC drop down Jan 24, 2025
@@ -222,4 +222,6 @@
<!-- A text notice shown when the user selects an expired card. -->
<string name="stripe_wallet_update_expired_card_error">This card has expired. Update your card info or choose a different payment method.</string>
<string name="stripe_wallet_expand_accessibility">Change selection</string>
<!-- Shown in a dropdown picker next to a card brand that is not accepted by a merchant. E.g. "Visa (not accepted)" -->
<string name="stripe_card_brand_not_accepted">(not accepted)</string>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there one file where I can put these rather than in two strings.xml files?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can access the one in payments-core-ui in paymentsheet module. It'll just require a different import.

@porter-stripe porter-stripe marked this pull request as ready for review January 24, 2025 20:12
@porter-stripe porter-stripe requested review from a team as code owners January 24, 2025 20:12
@porter-stripe porter-stripe requested review from amk-stripe and jaynewstrom-stripe and removed request for amk-stripe January 24, 2025 20:12
@@ -105,4 +105,6 @@
<string name="stripe_setup_button_label">Set up</string>
<!-- Label for UPI ID number field on form -->
<string name="stripe_upi_id_label">UPI ID</string>
<!-- Shown in a dropdown picker next to a card brand that is not accepted by a merchant. E.g. "Visa (not accepted)" -->
<string name="stripe_card_brand_not_accepted">(not accepted)</string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be a parameterized string (I know some languages won't have the same ordering as english).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, that's a good idea. I should do this on iOS too.

label = if (enabled) {
brand.displayName.resolvableString
} else {
brand.displayName.resolvableString +
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be pretty easy to parameterize, let me know if you want to pair on it!

@@ -222,4 +222,6 @@
<!-- A text notice shown when the user selects an expired card. -->
<string name="stripe_wallet_update_expired_card_error">This card has expired. Update your card info or choose a different payment method.</string>
<string name="stripe_wallet_expand_accessibility">Change selection</string>
<!-- Shown in a dropdown picker next to a card brand that is not accepted by a merchant. E.g. "Visa (not accepted)" -->
<string name="stripe_card_brand_not_accepted">(not accepted)</string>
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can access the one in payments-core-ui in paymentsheet module. It'll just require a different import.

@@ -446,6 +446,7 @@ internal class VerticalModePaymentSheetActivityTest {
// Verify that the error message appears
formPage.assertErrorExists("American Express is not accepted")
verticalModePage.assertPrimaryButton(isNotEnabled())
formPage.fillCardNumber("")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this necessary?

Copy link
Contributor Author

@porter-stripe porter-stripe Jan 24, 2025

Choose a reason for hiding this comment

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

I notice some flaks occasionally, where when entering an Amex the CVC field changing from CVC to CVV, then "pasting" in an entire card doesn't update it back to CVC. Seems like an unrelated bug/test quirk.

The solution here is probably to just remove CVV usage for Amex, we did this on iOS and web no longer uses CVV.

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.

Overall this looks good to me. But I do worry about the test changes.

@@ -481,7 +481,8 @@ internal class CardNumberControllerTest {
val secondReported = awaitItem()
assertEquals(CardBrand.MasterCard, secondReported, "MasterCard should be reported once")

// Simulate entering an invalid card number
// Simulate clearing the input and entering an invalid card number
cardNumberController.onValueChange("")
Copy link
Collaborator

Choose a reason for hiding this comment

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

These test changes do worry me a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants