diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt index 071b07291e1..01146f0a3df 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/FinancialConnectionsSheetViewModel.kt @@ -114,8 +114,11 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor( private fun fetchManifest() { viewModelScope.launch { kotlin.runCatching { - prepareStandardRequestManager() - getOrFetchSync(refetchCondition = Always) + val attestationInitialized = prepareStandardRequestManager() + getOrFetchSync( + refetchCondition = Always, + attestationInitialized = attestationInitialized + ) }.onFailure { finishWithResult(stateFlow.value, Failed(it)) }.onSuccess { diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/GetOrFetchSync.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/GetOrFetchSync.kt index 14675925814..20efec7b002 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/GetOrFetchSync.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/domain/GetOrFetchSync.kt @@ -18,12 +18,14 @@ internal class GetOrFetchSync @Inject constructor( ) { suspend operator fun invoke( - refetchCondition: RefetchCondition = RefetchCondition.None + refetchCondition: RefetchCondition = RefetchCondition.None, + attestationInitialized: Boolean? = null ): SynchronizeSessionResponse { return repository.getOrSynchronizeFinancialConnectionsSession( clientSecret = configuration.financialConnectionsSessionClientSecret, applicationId = applicationId, reFetchCondition = refetchCondition::shouldReFetch, + attestationInitialized = attestationInitialized ) } diff --git a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsManifestRepository.kt b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsManifestRepository.kt index a7d99acb296..934867cca18 100644 --- a/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsManifestRepository.kt +++ b/financial-connections/src/main/java/com/stripe/android/financialconnections/repository/FinancialConnectionsManifestRepository.kt @@ -40,6 +40,7 @@ internal interface FinancialConnectionsManifestRepository { suspend fun getOrSynchronizeFinancialConnectionsSession( clientSecret: String, applicationId: String, + attestationInitialized: Boolean?, reFetchCondition: (SynchronizeSessionResponse) -> Boolean ): SynchronizeSessionResponse @@ -206,15 +207,17 @@ private class FinancialConnectionsManifestRepositoryImpl( override suspend fun getOrSynchronizeFinancialConnectionsSession( clientSecret: String, applicationId: String, + attestationInitialized: Boolean?, reFetchCondition: (SynchronizeSessionResponse) -> Boolean ): SynchronizeSessionResponse = mutex.withLock { val cachedSync = cachedSynchronizeSessionResponse?.takeUnless(reFetchCondition) - return cachedSync ?: synchronize(applicationId, clientSecret) + return cachedSync ?: synchronize(applicationId, clientSecret, attestationInitialized) } private suspend fun synchronize( applicationId: String, clientSecret: String, + attestationInitialized: Boolean?, ): SynchronizeSessionResponse = requestExecutor.execute( apiRequestFactory.createPost( url = synchronizeSessionUrl, @@ -228,6 +231,8 @@ private class FinancialConnectionsManifestRepositoryImpl( "forced_authflow_version" to "v3", PARAMS_FULLSCREEN to true, PARAMS_HIDE_CLOSE_BUTTON to true, + PARAMS_SUPPORT_APP_VERIFICATION to attestationInitialized, + PARAMS_VERIFY_APP_ID to applicationId.takeIf { attestationInitialized == true }, NetworkConstants.PARAMS_APPLICATION_ID to applicationId ), NetworkConstants.PARAMS_CLIENT_SECRET to clientSecret @@ -523,6 +528,8 @@ private class FinancialConnectionsManifestRepositoryImpl( companion object { internal const val PARAMS_FULLSCREEN = "fullscreen" internal const val PARAMS_HIDE_CLOSE_BUTTON = "hide_close_button" + internal const val PARAMS_SUPPORT_APP_VERIFICATION = "supports_app_verification" + internal const val PARAMS_VERIFY_APP_ID = "verified_app_id" internal const val synchronizeSessionUrl: String = "${ApiRequest.API_HOST}/v1/financial_connections/sessions/synchronize"