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

[Android] Replicate other platforms polling logic across the AuthFlow #6919

Conversation

carlosmuvi-stripe
Copy link
Collaborator

@carlosmuvi-stripe carlosmuvi-stripe commented Jun 23, 2023

Summary

Replicates polling logic from iOS / Web:

Aditionally, throws a retryable, known StripeException, PollingReachedMaxRetriesException, instead of java.concurrent.TimeoutException. There's code in place to allow user to try again on known exceptions.

Before, the user would just be able to close the flow. Now the user will be able to try again or select another bank.

polling.mp4

Motivation

📔  [Android] Replicate other platforms' polling logic across the AuthFlow
🌐  BANKCON-7171

Testing

  • Added tests
  • Modified tests
  • Manually verified

@carlosmuvi-stripe carlosmuvi-stripe added the work-cli Added to pull requests created with #work-cli for usage tracking. label Jun 23, 2023
@carlosmuvi-stripe carlosmuvi-stripe self-assigned this Jun 23, 2023
@carlosmuvi-stripe carlosmuvi-stripe changed the title [Android] Replicate other platforms' polling logic across the AuthFlow [Android] Replicate other platforms polling logic across the AuthFlow Jun 23, 2023
Comment on lines +8 to +11
internal class FetchNetworkedAccounts @Inject constructor(
private val repository: FinancialConnectionsAccountsRepository,
private val configuration: FinancialConnectionsSheet.Configuration
) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just renamed from PollNetworkedAccounts. No polling needed here.

@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/BANKCON-7171/android-replicate-other-platforms-polling-logic-ac branch from 33bc8fc to 114f16c Compare June 23, 2023 18:24
@carlosmuvi-stripe carlosmuvi-stripe marked this pull request as ready for review June 23, 2023 20:59
@carlosmuvi-stripe carlosmuvi-stripe requested review from a team as code owners June 23, 2023 20:59
@carlosmuvi-stripe carlosmuvi-stripe requested review from awush-stripe and ccen-stripe and removed request for awush-stripe June 23, 2023 20:59
Comment on lines +91 to +107
private fun FinancialConnectionsAuthorizationSession.Flow?.toPollIntervalMs(): Long {
val defaultInitialPollDelay: Long = 1.75.seconds.inWholeMilliseconds
return when (this) {
FinancialConnectionsAuthorizationSession.Flow.TESTMODE,
FinancialConnectionsAuthorizationSession.Flow.TESTMODE_OAUTH,
FinancialConnectionsAuthorizationSession.Flow.TESTMODE_OAUTH_WEBVIEW,
FinancialConnectionsAuthorizationSession.Flow.FINICITY_CONNECT_V2_LITE -> {
// Post auth flow, Finicity non-OAuth account retrieval latency is extremely quick - p90 < 1sec.
0
}

FinancialConnectionsAuthorizationSession.Flow.MX_CONNECT -> {
// 10 account retrieval latency on MX non-OAuth sessions is currently 460 ms
0.5.seconds.inWholeMilliseconds
}

private companion object {
private const val POLLING_TIME_MS = 2000L
private const val MAX_TRIES = 10
else -> defaultInitialPollDelay
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

replicated from iOS. Each flow has an optimal initial delay.

@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/BANKCON-7171/android-replicate-other-platforms-polling-logic-ac branch from 7570ec0 to 3517bb5 Compare June 23, 2023 21:52
return retryOnException(
times = MAX_TRIES,
delayMilliseconds = POLLING_TIME_MS,
): PartnerAccountsList = try {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

try now wraps the retryOnException execution, so that toDomainException also maps retry exceptions.

CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Till Hellmund <tillh@stripe.com>
@carlosmuvi-stripe carlosmuvi-stripe enabled auto-merge (squash) June 26, 2023 17:31
@carlosmuvi-stripe carlosmuvi-stripe merged commit 95f91ed into master Jun 26, 2023
@carlosmuvi-stripe carlosmuvi-stripe deleted the carlosmuvi/BANKCON-7171/android-replicate-other-platforms-polling-logic-ac branch June 26, 2023 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work-cli Added to pull requests created with #work-cli for usage tracking.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants