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

[🚫DO NOT MERGE 🚫] Cimb 1 FA oauth flow #348

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

guillaumedebavelaere
Copy link
Contributor

No description provided.

@guillaumedebavelaere guillaumedebavelaere changed the title [WIP] Cimb 1 FA oauth flow [DNM] Cimb 1 FA oauth flow May 31, 2018
@guillaumedebavelaere guillaumedebavelaere changed the title [DNM] Cimb 1 FA oauth flow [🚫DO NOT MERGE 🚫] Cimb 1 FA oauth flow May 31, 2018

private func handleExampleVerify1FA(verify1FACallbackUrl: URL, host: String) {
let VERIFY_1FA = "complete1FA"
let YAHOO_HOST = "completeYahoo1FA"
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are there Yahoo changes as part of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yahoo has his own launcher (line 240).

Copy link
Contributor

Choose a reason for hiding this comment

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

Right but is CIMB ever going to launch with Yahoo?

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 so. I implemented the full feature because the trade service returns now a "complete1FA" closure.
In that case, we could ignore and do nothing here or return an error ? :

if let navController = topViewController as? UINavigationController,
let navTopViewController = navController.topViewController {
topViewController = navTopViewController
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we do this calculation somewhere else? Maybe we should create a function for it instead of duplicating

_ onCancelSecurityQuestion: @escaping () -> Void
onVerifyUrl: @escaping (
URL,
_ complete1FA: @escaping () -> Void
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation looks incorrect here. Also why was the onSecurityQuestion removed? Was that only used by CIMB?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes security question was added specifically for CIMB

guard let oAuthUrl = verifyOAuthURLResult.oAuthUrl() else {
onFailure(
TradeItErrorResult(
title: "Received empty OAuth verify popup URL"
Copy link
Contributor

Choose a reason for hiding this comment

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

This message will be displayed to the user. Should make it user friendly.

onAnswerSecurityQuestion: answerSecurityQuestion,
onCancelSecurityQuestion: cancelSecurityQuestion
)
onVerifyUrl: { url, complete1FA in
Copy link
Contributor

Choose a reason for hiding this comment

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

The 1FA naming is a little jarring - challenge seems a little clearer. This can totally wait for a follow up when we look to merge though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe completeTradeChallenge because if you add just challenge1FA or completeChallenge to the SDK configuration then it's not clear what it's for.

cancelOrderSecurityHandler()
} else {
return self.alertManager.showError(
TradeItErrorResult.error(withSystemMessage: "Canceling order could not be submitted please try again."),
Copy link
Contributor

Choose a reason for hiding this comment

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

This will show the default error message to the user. systemMessage is logged to console. Re-word to something like: Your cancel order request could not be submitted. Please try again.

tradeSecurityHandler()
} else {
return self.alertManager.showError(
TradeItErrorResult.tradeError(withSystemMessage: "Trade could not be submitted please try again."),
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as for cancel

originalViewController = topMostViewController.presentingViewController
}

if let tradeItYahooTradePreviewViewController = originalViewController?.childViewControllers.last as? TradeItYahooTradePreviewViewController {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these 1FA changes need to be made to Yahoo?

@@ -240,7 +237,20 @@ class TradeItYahooTradePreviewViewController: TradeItYahooViewController, UITabl
}

// MARK: Private


private var tradeSecurityHandler: (() -> Void)?
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these 1FA changes need to be made to Yahoo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fully implemented the feature, but we could ignore and do nothing here or return an error:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants