-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Make STPSource
conform to STPPaymentMethod
, exposing labels & images
#976
Conversation
We originally made it a private implementation because the `STPPaymentMethod` protocol implementations don't return anything useful for `label` and `image` but we're going to improve on that next.
4583ba8
to
5922603
Compare
5922603
to
15f81a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've left some comments with questions/suggestions.
Also, I think you have a typo in the Pull Request description. I think this is enabling source.label
, not source.length
.
PS: is there a reason you didn't use the Pull Request template with Summary/Motivation/Testing?
Stripe/STPSource.m
Outdated
case STPSourceTypeEPS: | ||
return @"EPS"; | ||
case STPSourceTypeMultibanco: | ||
return @"Multibanco"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do any of these need to be localizable strings?
My first thought was no, because they're brand/product names. On the other hand, I suspect it'd be weird to see "Alipay" instead of "支付宝" (according to wikipedia) in an app localized to Chinese.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, we should probably wrap them in NSLocalizedString calls in case users want to localize it themselves in a particular way.
Stripe/STPSource.m
Outdated
case STPSourceTypeMultibanco: | ||
return @"Multibanco"; | ||
case STPSourceTypeUnknown: | ||
return [STPCard stringFromBrand:STPCardBrandUnknown]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about using @"Unknown"
here instead of this layer of indirection with STPCardBrandUnknown
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah why not. I first put this here because I was focused on card source types but it is a little out of place in the STPSourceTypeUnknown
block.
CHANGELOG.md
Outdated
@@ -1,3 +1,5 @@ | |||
* Adds `STPPaymentMethod` protocol implementation for `STPSource` [#976](https://github.com/stripe/stripe-ios/pull/976) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about: mentioning what this accomplishes? I suspect this won't mean much to our users
Stripe/STPSource.m
Outdated
case STPSourceTypeSofort: | ||
return @"SOFORT"; | ||
case STPSourceTypeThreeDSecure: | ||
return @"3D Secure"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider including more details from the source in the label strings?
3DS is an obvious one: it's wrapping a card, and the customer is probably more likely to recognize the card that's used in the Source than the fact that it was charged through 3DS. It'd also be hard for them to disambiguate if they had more than one.
I suspect the STPSourceParam
factory methods are good references for what fields might be interesting on a per-SourceType basis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I did want to include more information if available but it looks like we don't make API Version guarantees on what information is included in the source specific blocks. If I'm wrong about the guarantees, then yeah we should add them appropriately.
2151761
to
a9458b7
Compare
/* Title for Payment Method screen */ | ||
"Payment Method" = "Payment Method"; | ||
|
||
/* Caption for Phone field on address form */ | ||
"Phone" = "Phone"; | ||
|
||
/* Short string for postal code (text used in non-US countries). Please keep to 8 characters or less if possible. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Were these character count suggestions removed because you re-ran genstrings
? I wonder if we need to move them into the STPLocalizedString
call
…eSource Conflicts: CHANGELOG.md Tests/Tests/STPFixtures.h Tests/Tests/STPFixtures.m
Also, fixing `testPaymentMethodTemplateImage()` for non-Card sources. It was missing the assertion
STPSource
STPSource
conform to STPPaymentMethod
, exposing labels & images
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@@ -1,3 +1,6 @@ | |||
## XX.Y.Z |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is just a placeholder for when we make the next release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I think it's better for us to update the CHANGELOG during the release process, to avoid conflicts while merging PRs, but sometimes we do it during the PR.
Release version 22.1.1
Summary
Adds
STPPaymentMethod
protocol implementation forSTPSource
. In particular, it enablessource.label
,source.image
, andsource.templateImage
.There's potentially room to improve the labels & images - right now non-cards just mirror whatever the Source type is.
Motivation
Issue originally raised after extensive investigation between Joey & Fred. See individual commits. More details in IOS-816.
Testing
Automated tests added for the new functionality.