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 FPX offline status endpoint #1422

Merged
merged 9 commits into from
Oct 24, 2019
Merged

Conversation

davidme-stripe
Copy link
Contributor

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.

#pragma mark - FPX

- (void)retrieveFPXBankStatusWithCompletion:(STPFPXBankStatusCompletionBlock)completion {
[STPAPIRequest<STPFPXBankStatusResponse *> getWithAPIClient:self
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

@davidme-stripe davidme-stripe Oct 23, 2019

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.

Stripe/STPBankSelectionTableViewCell.m Outdated Show resolved Hide resolved
Stripe/STPBankSelectionViewController.m Outdated Show resolved Hide resolved
#pragma mark - FPX

- (void)retrieveFPXBankStatusWithCompletion:(STPFPXBankStatusCompletionBlock)completion {
[STPAPIRequest<STPFPXBankStatusResponse *> getWithAPIClient:self
Copy link
Contributor

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)];
Copy link
Contributor

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:]?

Copy link
Contributor Author

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.

Stripe/STPBankSelectionViewController.m Outdated Show resolved Hide resolved
Stripe/STPBankSelectionViewController.m Outdated Show resolved Hide resolved
Stripe/STPBankSelectionViewController.m Outdated Show resolved Hide resolved
@davidme-stripe davidme-stripe merged commit 7152797 into master Oct 24, 2019
@davidme-stripe davidme-stripe deleted the davidme/fpx-offline-status branch January 7, 2021 00:19
davidme-stripe pushed a commit that referenced this pull request Sep 12, 2022
* Fix test

* Set allowsDelayedPaymentMethods to fix test

* Allow `testPaymentSheetCustomSaveAndRemoveCard` to work when Link is enabled.

* Disable Link when testing shipping + custom flow controller
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.

4 participants