Skip to content

Commit

Permalink
Merge pull request #1354 from Adyen/fix/3ds2_data_collection
Browse files Browse the repository at this point in the history
Disable phone number collection of 3DS2 SDK
  • Loading branch information
OscarSpruit authored Oct 6, 2023
2 parents b73deed + acb75a8 commit 61ba5a9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ internal class DefaultAdyen3DS2Delegate(
fingerprintToken.directoryServerPublicKey,
// directoryServerRootCertificates
fingerprintToken.directoryServerRootCertificates,
).build()
)
.deviceParameterBlockList(componentParams.deviceParameterBlockList)
.build()

val coroutineExceptionHandler = CoroutineExceptionHandler { _, throwable ->
Logger.e(TAG, "Unexpected uncaught 3DS2 Exception", throwable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ internal data class Adyen3DS2ComponentParams(
override val amount: Amount?,
val uiCustomization: UiCustomization?,
val threeDSRequestorAppURL: String?,
val deviceParameterBlockList: Set<String>?,
) : ComponentParams
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package com.adyen.checkout.adyen3ds2.internal.ui.model

import androidx.annotation.VisibleForTesting
import com.adyen.checkout.adyen3ds2.Adyen3DS2Configuration
import com.adyen.checkout.components.core.internal.ui.model.AnalyticsParams
import com.adyen.checkout.components.core.internal.ui.model.ComponentParams
Expand Down Expand Up @@ -38,6 +39,8 @@ internal class Adyen3DS2ComponentParamsMapper(
amount = amount,
uiCustomization = uiCustomization,
threeDSRequestorAppURL = threeDSRequestorAppURL,
// Hardcoded for now, but in the feature we could make this configurable
deviceParameterBlockList = DEVICE_PARAMETER_BLOCK_LIST,
)
}

Expand All @@ -63,4 +66,11 @@ internal class Adyen3DS2ComponentParamsMapper(
amount = sessionParams.amount ?: amount,
)
}

companion object {
private const val PHONE_NUMBER_PARAMETER = "A005"

@VisibleForTesting
internal val DEVICE_PARAMETER_BLOCK_LIST = setOf(PHONE_NUMBER_PARAMETER)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import com.adyen.threeds2.exception.InvalidInputException
import com.adyen.threeds2.exception.SDKRuntimeException
import com.adyen.threeds2.parameters.ChallengeParameters
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.TestDispatcher
import kotlinx.coroutines.test.runTest
import org.json.JSONException
Expand All @@ -66,7 +65,6 @@ import org.mockito.kotlin.whenever
import java.io.IOException
import java.util.Locale

@OptIn(ExperimentalCoroutinesApi::class)
@ExtendWith(MockitoExtension::class, TestDispatcherExtension::class)
internal class DefaultAdyen3DS2DelegateTest(
@Mock private val submitFingerprintRepository: SubmitFingerprintRepository,
Expand All @@ -89,7 +87,9 @@ internal class DefaultAdyen3DS2DelegateTest(
observerRepository = ActionObserverRepository(),
savedStateHandle = SavedStateHandle(),
componentParams = Adyen3DS2ComponentParamsMapper(null, null)
.mapToParams(configuration, null),
.mapToParams(configuration, null)
// Set it to null to avoid a crash in 3DS2 library (they use Android APIs)
.copy(deviceParameterBlockList = null),
submitFingerprintRepository = submitFingerprintRepository,
paymentDataRepository = paymentDataRepository,
adyen3DS2Serializer = adyen3DS2Serializer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ internal class Adyen3DS2ComponentParamsMapperTest {
amount = amount,
uiCustomization = uiCustomization,
threeDSRequestorAppURL = threeDSRequestorAppURL,
deviceParameterBlockList = Adyen3DS2ComponentParamsMapper.DEVICE_PARAMETER_BLOCK_LIST,
)

companion object {
Expand Down

0 comments on commit 61ba5a9

Please sign in to comment.