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

StripeSourceTypeModel is not public #616

Closed
Huulivoide opened this issue Jul 27, 2018 · 8 comments
Closed

StripeSourceTypeModel is not public #616

Huulivoide opened this issue Jul 27, 2018 · 8 comments
Assignees

Comments

@Huulivoide
Copy link

Source.getSourceTypeModel() return the source model as type StripeSourceTypeModel, which is not public. Sure to use it one must cast it to one of public classes that actually implement it, but still Android studio will issue a warning about it.

@ksun-stripe
Copy link

@Huulivoide can you show a screenshot of the warning so we can figure out what to do about it?

@Huulivoide
Copy link
Author

Android Studio gives the following warning.

warning

@osrl
Copy link

osrl commented Nov 2, 2018

+1 to this issue. Is there a workaround for this @Huulivoide ?

@mshafrir-stripe
Copy link
Collaborator

@Huulivoide @osrl can you help me understand what information you need to access on StripeSourceTypeModel?

@osrl
Copy link

osrl commented Feb 9, 2019

I needed to display some information about customers' sources:

val cardData = source.sourceTypeModel as SourceCardData

val icon = Card.BRAND_RESOURCE_MAP[cardData.brand]!!
paymentIconImageView.setImageResource(icon)
paymentTypeTextView.text = cardData.brand
paymentNumberTextView.text = cardData.last4

I get the same warning like @Huulivoide

@Huulivoide
Copy link
Author

Huulivoide commented Feb 11, 2019

@mshafrir-stripe Like osrl, I am not trying to access StripeSourceTypeModel directly at all. Instead, like osrl, I cast it to SourceCardData, to access the some of the cad details (brand, last 4 digits).

Still the problem is that you have a public API method, that returns a instance of package private class.

@osrl
Copy link

osrl commented Feb 11, 2019

Maybe something like source.sourceCardData would be a solution.

mshafrir-stripe added a commit that referenced this issue Feb 13, 2019
**Summary**
- Make `StripeSourceTypeModel` public
- Clean up the internal structure of `StripeSourceTypeModel`

**Motivation**
`Source#getSourceTypeModel()` is a public method, but it returns
a type (`StripeSourceTypeModel`) that is package-private, causing
warnings in the IDE. This is a safe change, because the methods in
`StripeSourceTypeModel` that should not be accessed publicly are
still package-private. In addition, `StripeSourceTypeModel` extends
`StripeJsonModel`, which itself is public.

Fixes #616
mshafrir-stripe added a commit that referenced this issue Feb 13, 2019
**Summary**
- Make `StripeSourceTypeModel` public
- Clean up the internal structure of `StripeSourceTypeModel`

**Motivation**
`Source#getSourceTypeModel()` is a public method, but it returns
a type (`StripeSourceTypeModel`) that is package-private, causing
warnings in the IDE. This is a safe change, because the methods in
`StripeSourceTypeModel` that should not be accessed publicly are
still package-private. In addition, `StripeSourceTypeModel` extends
`StripeJsonModel`, which itself is public.

Fixes #616
mshafrir-stripe added a commit that referenced this issue Feb 14, 2019
**Summary**
- Make `StripeSourceTypeModel` public
- Clean up the internal structure of `StripeSourceTypeModel`

**Motivation**
`Source#getSourceTypeModel()` is a public method, but it returns
a type (`StripeSourceTypeModel`) that is package-private, causing
warnings in the IDE. This is a safe change, because the methods in
`StripeSourceTypeModel` that should not be accessed publicly are
still package-private. In addition, `StripeSourceTypeModel` extends
`StripeJsonModel`, which itself is public.

Fixes #616
mshafrir-stripe added a commit that referenced this issue Feb 26, 2019
**Summary**
- Make `StripeSourceTypeModel` public
- Clean up the internal structure of `StripeSourceTypeModel`

**Motivation**
`Source#getSourceTypeModel()` is a public method, but it returns
a type (`StripeSourceTypeModel`) that is package-private, causing
warnings in the IDE. This is a safe change, because the methods in
`StripeSourceTypeModel` that should not be accessed publicly are
still package-private. In addition, `StripeSourceTypeModel` extends
`StripeJsonModel`, which itself is public.

Fixes #616
@mshafrir-stripe
Copy link
Collaborator

This is now available in stripe-android:8.5.0

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

No branches or pull requests

4 participants