-
Notifications
You must be signed in to change notification settings - Fork 997
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 FPX offline status endpoint #1422
Conversation
#pragma mark - FPX | ||
|
||
- (void)retrieveFPXBankStatusWithCompletion:(STPFPXBankStatusCompletionBlock)completion { | ||
[STPAPIRequest<STPFPXBankStatusResponse *> getWithAPIClient:self |
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.
ooc, does this handle errors/exceptions?
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.
No, I don't think there's anything useful we could do with such an error. We could log them to the console, I guess.
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.
it does in the sense that we will generate an error if the response is not parseable for instance
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 can't determine if we have any standardized way to communicate these sort of errors up to developers. retrieveFPXBankStatusWithCompletion
will return an error to the completion block if the response isn't parseable, but the BankSelectionViewController can't do anything sensible with that other than silently failing. We could NSLog()
a warning, but we don't have any precedent for that.
#pragma mark - FPX | ||
|
||
- (void)retrieveFPXBankStatusWithCompletion:(STPFPXBankStatusCompletionBlock)completion { | ||
[STPAPIRequest<STPFPXBankStatusResponse *> getWithAPIClient:self |
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.
it does in the sense that we will generate an error if the response is not parseable for instance
@@ -95,6 +96,10 @@ - (void)configureWithBank:(STPFPXBankBrand)bankBrand theme:(STPTheme *)theme sel | |||
// Title label | |||
self.titleLabel.font = theme.font; | |||
self.titleLabel.text = STPStringFromFPXBankBrand(self.bank); | |||
if (offline) { | |||
NSString *format = STPLocalizedString(@"%@ - Offline", @"Bank name when bank is offline for maintenance."); | |||
self.titleLabel.text = [NSString stringWithFormat:format, STPStringFromFPXBankBrand(self.bank)]; |
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 you think it's worthwhile to just always use [NSString localizedStringWithFormat:]
?
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.
STPLocalizedString does some bundle searching logic to allow for users to override our localizations. We'd want a similar macro for localizedStringWithFormat:
if we wanted to start using that.
Co-Authored-By: Cameron <[email protected]>
Co-Authored-By: Cameron <[email protected]>
…-ios into davidme/fpx-offline-status
* Fix test * Set allowsDelayedPaymentMethods to fix test * Allow `testPaymentSheetCustomSaveAndRemoveCard` to work when Link is enabled. * Disable Link when testing shipping + custom flow controller
Summary
Our FPX implementation offers a status endpoint that we should use to inform the user that specific banks are offline. The FPX team says we should handle this by appending "Offline" to the bank's name: We shouldn't grey out the label or prevent a user from selecting it.
The endpoint is a little unreliable, so we should default to assuming the bank is online unless we hear otherwise.
Motivation
Matches the behavior of the FPX Element.
Testing
Tested in simulator.