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

Support Expiration Date Changes #10568

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

Conversation

toluo-stripe
Copy link
Contributor

@toluo-stripe toluo-stripe commented Apr 4, 2025

Summary

Support expiry date changes. This feature is controlled by a local feature flag.

Motivation

JIRA

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Screen.Recording.2025-04-07.at.12.22.37.PM.mov

Changelog

Copy link
Contributor

github-actions bot commented Apr 4, 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.1 MiB │   4.1 MiB │ +1.6 KiB │  9.1 MiB │  9.1 MiB │ +4.8 KiB 
     arsc │   2.4 MiB │   2.4 MiB │      0 B │  2.4 MiB │  2.4 MiB │      0 B 
 manifest │   5.3 KiB │   5.3 KiB │      0 B │ 26.9 KiB │ 26.9 KiB │      0 B 
      res │ 910.6 KiB │ 910.6 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 │    +25 B │  1.6 MiB │  1.6 MiB │    +25 B 
    other │   1.4 MiB │   1.4 MiB │     +2 B │  1.6 MiB │  1.6 MiB │      0 B 
──────────┼───────────┼───────────┼──────────┼──────────┼──────────┼──────────
    total │    13 MiB │    13 MiB │ +1.7 KiB │ 22.3 MiB │ 22.3 MiB │ +4.8 KiB 

 DEX     │ old   │ new   │ diff              
─────────┼───────┼───────┼───────────────────
   files │     1 │     1 │   0               
 strings │ 43099 │ 43111 │ +12 (+55 -43)     
   types │ 15486 │ 15493 │  +7 (+40 -33)     
 classes │ 13075 │ 13082 │  +7 (+8 -1)       
 methods │ 63246 │ 63270 │ +24 (+1655 -1631) 
  fields │ 42136 │ 42166 │ +30 (+1149 -1119) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  243 │  243 │  0   
 entries │ 6291 │ 6291 │  0
APK
     compressed      │     uncompressed     │                                
──────────┬──────────┼───────────┬──────────┤                                
 size     │ diff     │ size      │ diff     │ path                           
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
  4.1 MiB │ +1.6 KiB │   9.1 MiB │ +4.8 KiB │ ∆ classes.dex                  
  8.1 KiB │    +30 B │     8 KiB │    +30 B │ ∆ assets/dexopt/baseline.prof  
    1 KiB │     -5 B │     931 B │     -5 B │ ∆ assets/dexopt/baseline.profm 
 54.1 KiB │     +4 B │ 120.2 KiB │      0 B │ ∆ META-INF/CERT.SF             
 50.7 KiB │     -2 B │ 120.1 KiB │      0 B │ ∆ META-INF/MANIFEST.MF         
──────────┼──────────┼───────────┼──────────┼────────────────────────────────
  4.2 MiB │ +1.7 KiB │   9.4 MiB │ +4.8 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff          
  ───────┼───────┼───────────────
   43099 │ 43111 │ +12 (+55 -43) 
  
  + , dateConfig=
  + , expiryDateState=
  + BrandChoiceChanged(cardBrandChoice=
  + CardUpdateParams(expiryMonth=
  + DateChanged(text=
  + ExpiryDateState(text=
  + Lf9/Z1;
  + Lf9/a2;
  + Lt8/d2;
  + Lt8/e2;
  + Lt8/f2;
  + Lt8/g2;
  + Lt8/h2;
  + Lt8/i2;
  + VLLIZLL
  + VLLLLLZZLLLII
  + VLLLLLZZLLLLII
  + VLLLZILLLL
  + VZLLLLILLI
  + VZLLLLILLLI
  + [Lf9/D0;
  + [Lf9/E1;
  + [Lf9/F0;
  + [Lf9/H1;
  + [Lf9/J0;
  + [Lf9/N0;
  + [Lf9/O1;
  + [Lf9/U1;
  + [Lf9/Y0;
  + [Lf9/a2;
  + [Lf9/b1;
  + [Lf9/e1;
  + [Lf9/f0;
  + [Lf9/i0;
  + [Lf9/l1;
  + [Lf9/p1;
  + [Lf9/q1;
  + [Lf9/t0;
  + [Lf9/t1;
  + [Lf9/w0;
  + [Lf9/x1;
  + [Lf9/y1;
  + [Lf9/z0;
  + [Lo9/M0;
  + [Lo9/Q0;
  + [Lo9/T0;
  + [Lo9/z0;
  + [Lt8/W1;
  + [Lt8/X1;
  + [Lt8/Y1;
  + [Lt8/c2;
  + [Lt8/z0;
  + card_edit_ui_error_message
  + ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"9dc478c","r8-mode":"full","version":"8.8.34"}
  + •• / ••
  
  - CardUpdateParams(expiryMonth=null, expiryYear=null, cardBrand=
  - Lp6/m;
  - VLLIZL
  - VLLLLZLII
  - VLLLLZLLII
  - VLLLZILZL
  - VZLLZLILI
  - VZLLZLILLI
  - [Lf9/C0;
  - [Lf9/C1;
  - [Lf9/E0;
  - [Lf9/F1;
  - [Lf9/I0;
  - [Lf9/M0;
  - [Lf9/M1;
  - [Lf9/S1;
  - [Lf9/U0;
  - [Lf9/W1;
  - [Lf9/Z0;
  - [Lf9/c1;
  - [Lf9/e0;
  - [Lf9/h0;
  - [Lf9/j1;
  - [Lf9/n1;
  - [Lf9/o1;
  - [Lf9/r1;
  - [Lf9/s0;
  - [Lf9/v0;
  - [Lf9/v1;
  - [Lf9/w1;
  - [Lf9/y0;
  - [Lo9/A0;
  - [Lo9/N0;
  - [Lo9/R0;
  - [Lo9/U0;
  - [Lt8/P1;
  - [Lt8/Q1;
  - [Lt8/R1;
  - [Lt8/V1;
  - [Lt8/t0;
  - selectedCardBrand
  - ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"8460c01","r8-mode":"full","version":"8.8.34"}
  - ••/••
  

TYPES:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   15486 │ 15493 │ +7 (+40 -33) 
  
  + Lf9/Z1;
  + Lf9/a2;
  + Lt8/d2;
  + Lt8/e2;
  + Lt8/f2;
  + Lt8/g2;
  + Lt8/h2;
  + Lt8/i2;
  + [Lf9/D0;
  + [Lf9/E1;
  + [Lf9/F0;
  + [Lf9/H1;
  + [Lf9/J0;
  + [Lf9/N0;
  + [Lf9/O1;
  + [Lf9/U1;
  + [Lf9/Y0;
  + [Lf9/a2;
  + [Lf9/b1;
  + [Lf9/e1;
  + [Lf9/f0;
  + [Lf9/i0;
  + [Lf9/l1;
  + [Lf9/p1;
  + [Lf9/q1;
  + [Lf9/t0;
  + [Lf9/t1;
  + [Lf9/w0;
  + [Lf9/x1;
  + [Lf9/y1;
  + [Lf9/z0;
  + [Lo9/M0;
  + [Lo9/Q0;
  + [Lo9/T0;
  + [Lo9/z0;
  + [Lt8/W1;
  + [Lt8/X1;
  + [Lt8/Y1;
  + [Lt8/c2;
  + [Lt8/z0;
  
  - Lp6/m;
  - [Lf9/C0;
  - [Lf9/C1;
  - [Lf9/E0;
  - [Lf9/F1;
  - [Lf9/I0;
  - [Lf9/M0;
  - [Lf9/M1;
  - [Lf9/S1;
  - [Lf9/U0;
  - [Lf9/W1;
  - [Lf9/Z0;
  - [Lf9/c1;
  - [Lf9/e0;
  - [Lf9/h0;
  - [Lf9/j1;
  - [Lf9/n1;
  - [Lf9/o1;
  - [Lf9/r1;
  - [Lf9/s0;
  - [Lf9/v0;
  - [Lf9/v1;
  - [Lf9/w1;
  - [Lf9/y0;
  - [Lo9/A0;
  - [Lo9/N0;
  - [Lo9/R0;
  - [Lo9/U0;
  - [Lt8/P1;
  - [Lt8/Q1;
  - [Lt8/R1;
  - [Lt8/V1;
  - [Lt8/t0;
  

METHODS:

   old   │ new   │ diff              
  ───────┼───────┼───────────────────
   63246 │ 63270 │ +24 (+1655 -1631) 
  
  + D0.c b(f1, d, p, p, int)
  + D0.c g(k0, f1, d, Function0, p, int)
  + D0.c h(f1, k0, f1, d, Function0, p, int)
  + E2.b u(String) → l1
  + H7.a <init>(Integer, Integer, i)
  + I7.S <init>(f1, X)
  + I7.d <init>(b, I0, Map)
  + K0.e i() → G0
  + K8.a C(LayoutWeightElement, v, boolean, f1, k0, Function1, Function1, Function0, Function1, Function1, Function1, Function0, p, int, int)
  + K8.a N(v, f1, k0, Function1, Function1, Function0, Function0, Function0, Function0, Function1, Function1, Function1, Function0, p, int, int)
  + K8.a g(w, f1, k0, boolean, m, p, int)
  + K8.a u(Integer, f1, k0, f1, e, boolean, boolean, boolean, String, boolean, Function0, m, p, p, p, p, int, int, int)
  + L0.d i() → G0
  + L0.g0 B0(s, Q1)
  + L5.b <init>(Object, Object, Function1, Object, int, int)
  + M5.F <init>(p, boolean, f1, a0)
  + M5.J <init>(boolean, h, s1, d0, List, int, Function1, Function1, int)
  + M5.X s(boolean, boolean, e, boolean, String, M, f1, k0, f1, p, p, int)
  + M5.X u(String, M, f1, k0, f1, e, boolean, boolean, boolean, String, Function0, p, p, int, int, int)
  + N6.G <init>(H, p, int, int)
  + O6.D <init>(boolean, J0, Set, U, p, int, int, int)
  + O6.D <init>(boolean, f1, e, int, p, a, int, int)
  + O6.G <init>(c, f1, boolean, p, p, p, boolean, Continuation)
  + O6.p <init>(Integer, f1, k0, f1, e, boolean, boolean, boolean, String, boolean, Function0, m, p, p, p, int, int, int)
  + O6.r <init>(Function0, boolean, boolean, f1, e, boolean, p, k0, p
...✂

@toluo-stripe toluo-stripe force-pushed the tolu/uspm/card_edit_handler_expiryDate branch 2 times, most recently from 41d38df to 0d35066 Compare April 7, 2025 16:31
@toluo-stripe toluo-stripe changed the title Tolu/uspm/card edit handler expiry date Support Expiration Date Changes Apr 7, 2025
@toluo-stripe toluo-stripe force-pushed the tolu/uspm/card_edit_handler_expiryDate branch from 0d35066 to 6742926 Compare April 7, 2025 18:39
@toluo-stripe toluo-stripe marked this pull request as ready for review April 7, 2025 19:19
@toluo-stripe toluo-stripe requested review from a team as code owners April 7, 2025 19:19
@toluo-stripe toluo-stripe force-pushed the tolu/uspm/card_edit_handler_expiryDate branch from f648308 to 905245b Compare April 7, 2025 21:43
val availableNetworks: List<CardBrandChoice>
val expiryDateEditEnabled: Boolean,
val availableNetworks: List<CardBrandChoice>,
val dateValidator: (String) -> TextFieldState
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer if we avoid passing functions through the state unless necessary. Validating the date within the UI feels like the wrong solution.

@@ -9,6 +10,8 @@ import com.stripe.android.paymentsheet.CardUpdateParams
*/
internal data class CardDetailsEntry(
val cardBrandChoice: CardBrandChoice,
val expMonth: Int? = null,
val expYear: Int? = null,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rather than nullable parameters, can we make a ExpiryDateState that encompassed the DateConfig? You build something similar for Cvc Recollection for CvcState that I think works better.

expMonth = map[IdentifierSpec.CardExpMonth]?.value?.toIntOrNull()?.takeIf { it > 0 },
)
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

From the comment above, can the state itself parse out the string and digest this?

# Conflicts:
#	paymentsheet/src/test/java/com/stripe/android/model/PaymentMethodFixtures.kt
� Conflicts:
�	paymentsheet/src/main/java/com/stripe/android/paymentsheet/ui/EditCardDetailsInteractor.kt
�	paymentsheet/src/test/java/com/stripe/android/paymentsheet/ui/DefaultEditCardDetailsInteractorTest.kt
Update EditCardDetailsInteractor.kt

Remove callback from interface

rename factory

Update UpdatePaymentMethodInteractor.kt

Update UpdatePaymentMethodInteractor.kt

Update FakeEditCardDetailsInteractor.kt

Refactor factory

Fix tests

Update UpdatePaymentMethodInteractor.kt

Fix tests

Fix factory

Update FakeEditCardDetailsInteractor.kt

Update DefaultEditCardDetailsInteractorTest.kt

temp

more tests
Update ExpiryDateState.kt
@toluo-stripe toluo-stripe force-pushed the tolu/uspm/card_edit_handler_expiryDate branch from 3cef83e to a6b1cab Compare April 9, 2025 01:29
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