-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates lookup call to use mobile endpoint on verified flows
- Loading branch information
1 parent
60ad1f8
commit 8886acf
Showing
16 changed files
with
172 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 24 additions & 7 deletions
31
...connections/src/main/java/com/stripe/android/financialconnections/domain/LookupAccount.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
package com.stripe.android.financialconnections.domain | ||
|
||
import android.app.Application | ||
import com.stripe.android.financialconnections.FinancialConnectionsSheet | ||
import com.stripe.android.financialconnections.repository.FinancialConnectionsConsumerSessionRepository | ||
import com.stripe.android.model.ConsumerSessionLookup | ||
import com.stripe.attestation.IntegrityRequestManager | ||
import javax.inject.Inject | ||
|
||
internal class LookupAccount @Inject constructor( | ||
private val application: Application, | ||
private val integrityRequestManager: IntegrityRequestManager, | ||
private val consumerSessionRepository: FinancialConnectionsConsumerSessionRepository, | ||
val configuration: FinancialConnectionsSheet.Configuration, | ||
) { | ||
|
||
suspend operator fun invoke( | ||
email: String | ||
): ConsumerSessionLookup = requireNotNull( | ||
consumerSessionRepository.lookupConsumerSession( | ||
email = email.lowercase().trim(), | ||
clientSecret = configuration.financialConnectionsSessionClientSecret | ||
) | ||
) | ||
email: String, | ||
verifiedFlow: Boolean | ||
): ConsumerSessionLookup { | ||
return if (verifiedFlow) { | ||
requireNotNull( | ||
consumerSessionRepository.mobileLookupConsumerSession( | ||
email = email.lowercase().trim(), | ||
verificationToken = integrityRequestManager.requestToken().getOrThrow(), | ||
appId = application.packageName | ||
) | ||
) | ||
} else { | ||
requireNotNull( | ||
consumerSessionRepository.postConsumerSession( | ||
email = email.lowercase().trim(), | ||
clientSecret = configuration.financialConnectionsSessionClientSecret | ||
) | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...nections/src/main/java/com/stripe/android/financialconnections/features/error/ErrorExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.stripe.android.financialconnections.features.error | ||
|
||
import com.stripe.android.core.exception.APIException | ||
|
||
internal fun Throwable.isAttestationError(): Boolean { | ||
return this is APIException && stripeError?.code == "link_failed_to_attest_request" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.