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

Add ability to set on_behalf_of for CBC elements #8344

Merged
merged 10 commits into from May 15, 2024

Conversation

tjclawson-stripe
Copy link
Contributor

@tjclawson-stripe tjclawson-stripe commented Apr 24, 2024

Summary

Adds ability for merchant to set onBehalfOf for CardInputWidget, CardFormView, and CardMultilineWidget

Motivation

MOBILESDK-1969
API REVIEW

Testing

  • Added tests
  • Modified tests
  • Manually verified

Changelog

See CHANGELOG.md

Copy link
Contributor

github-actions bot commented Apr 24, 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 │ +474 B │   8.6 MiB │   8.6 MiB │ +368 B 
     arsc │   2.2 MiB │   2.2 MiB │    0 B │   2.2 MiB │   2.2 MiB │    0 B 
 manifest │     5 KiB │     5 KiB │    0 B │  25.4 KiB │  25.4 KiB │    0 B 
      res │ 910.2 KiB │ 910.2 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 │   2.9 MiB │   2.9 MiB │  +26 B │   2.9 MiB │   2.9 MiB │  +26 B 
    other │ 194.3 KiB │ 194.3 KiB │   +2 B │ 424.7 KiB │ 424.7 KiB │    0 B 
──────────┼───────────┼───────────┼────────┼───────────┼───────────┼────────
    total │  12.7 MiB │  12.7 MiB │ +502 B │  21.6 MiB │  21.6 MiB │ +394 B 

 DEX     │ old   │ new   │ diff         
─────────┼───────┼───────┼──────────────
   files │     1 │     1 │  0           
 strings │ 43123 │ 43125 │ +2 (+3 -1)   
   types │ 14773 │ 14773 │  0 (+0 -0)   
 classes │ 12471 │ 12471 │  0 (+0 -0)   
 methods │ 61105 │ 61107 │ +2 (+10 -8)  
  fields │ 40315 │ 40319 │ +4 (+16 -12) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6031 │ 6031 │  0
APK
    compressed     │    uncompressed    │                               
──────────┬────────┼───────────┬────────┤                               
 size     │ diff   │ size      │ diff   │ path                          
──────────┼────────┼───────────┼────────┼───────────────────────────────
  3.9 MiB │ +474 B │   8.6 MiB │ +368 B │ ∆ classes.dex                 
  7.4 KiB │  +26 B │   7.2 KiB │  +26 B │ ∆ assets/dexopt/baseline.prof 
 52.8 KiB │   +3 B │ 116.9 KiB │    0 B │ ∆ META-INF/CERT.SF            
 49.5 KiB │   -2 B │ 116.8 KiB │    0 B │ ∆ META-INF/MANIFEST.MF        
  1.2 KiB │   +1 B │   1.2 KiB │    0 B │ ∆ META-INF/CERT.RSA           
──────────┼────────┼───────────┼────────┼───────────────────────────────
    4 MiB │ +502 B │   8.8 MiB │ +394 B │ (total)
DEX
STRINGS:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   43123 │ 43125 │ +2 (+3 -1) 
  
  + getOnBehalfOf
  + setOnBehalfOf
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:13403cf,r8-mode:full,version:8.3.37}
  
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:c5ba34a,r8-mode:full,version:8.3.37}
  

METHODS:

   old   │ new   │ diff        
  ───────┼───────┼─────────────
   61105 │ 61107 │ +2 (+10 -8) 
  
  + com.stripe.android.view.CardMultilineWidget getOnBehalfOf() → String
  + com.stripe.android.view.CardMultilineWidget setOnBehalfOf(String)
  + m8.p0 create(Class) → w0
  + m8.p0 create(Class, c) → w0
  + m8.q0 <init>(s0, e)
  + m8.q0 h(Object) → Object
  + m8.r0 F(Object, Object) → Object
  + m8.r0 f(Object, e) → e
  + m8.s0 <init>(h, W, o0)
  + s6.W F(m, Map, e) → Object
  
  - m8.p0 <init>(s0, e)
  - m8.p0 F(Object, Object) → Object
  - m8.p0 f(Object, e) → e
  - m8.p0 h(Object) → Object
  - m8.q0 create(Class) → w0
  - m8.q0 create(Class, c) → w0
  - m8.s0 <init>(h, W)
  - s6.W F(m, e) → Object
  

FIELDS:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   40315 │ 40319 │ +4 (+16 -12) 
  
  + com.stripe.android.view.CardMultilineWidget o0: String
  + com.stripe.android.view.CardMultilineWidget p0: boolean
  + com.stripe.android.view.CardMultilineWidget q0: d0
  + com.stripe.android.view.CardMultilineWidget r0: boolean
  + com.stripe.android.view.CardMultilineWidget v0: d0
  + com.stripe.android.view.CardMultilineWidget w0: g[]
  + m8.q0 U: Object
  + m8.q0 V: s0
  + m8.q0 W: int
  + m8.r0 V: o0
  + m8.r0 X: s0
  + m8.s0 c: x
  + m8.s0 d: o0
  + m8.s0 e: o0
  + m8.s0 f: o0
  + m8.s0 g: String
  
  - com.stripe.android.view.CardMultilineWidget o0: boolean
  - com.stripe.android.view.CardMultilineWidget p0: d0
  - com.stripe.android.view.CardMultilineWidget q0: boolean
  - com.stripe.android.view.CardMultilineWidget r0: d0
  - com.stripe.android.view.CardMultilineWidget v0: g[]
  - m8.p0 V: o0
  - m8.p0 W: int
  - m8.p0 X: s0
  - m8.r0 U: Object
  - m8.r0 V: s0
  - m8.s0 c: o0
  - m8.s0 d: o0

) : ViewModel() {

private val _isCbcEligible = MutableStateFlow(false)
val isCbcEligible: StateFlow<Boolean> = _isCbcEligible
var onBehalfOf: String? = null
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should set this in savedStateHandle too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 👍

@tjclawson-stripe tjclawson-stripe marked this pull request as ready for review April 25, 2024 18:25
@tjclawson-stripe tjclawson-stripe requested review from a team as code owners April 25, 2024 18:25
@@ -61,6 +64,7 @@ class CardWidgetViewModelTest {
paymentConfigProvider = { paymentConfig },
stripeRepository = stripeRepository,
dispatcher = testDispatcher,
handle = SavedStateHandle()
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add a test to ensure it's saving to the handle?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done 👍

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.

Please link the API review.

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.

Could you add some tests for the new functionality?

CHANGELOG.md Show resolved Hide resolved
samer-stripe
samer-stripe previously approved these changes May 10, 2024
@tjclawson-stripe tjclawson-stripe merged commit fc8f499 into master May 15, 2024
15 checks passed
@tjclawson-stripe tjclawson-stripe deleted the tyler/mobilesdk-1969 branch May 15, 2024 18:47
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.

None yet

3 participants