Skip to content

Commit

Permalink
Add ThreeDSecureRequest.requestorAppUrl (#1232)
Browse files Browse the repository at this point in the history
* add ThreeDSecureRequest threeDSRequestorAppUrl
* pass in new cardinalConfigurationParameters.threeDSRequestorAppURL
* add CHANGELOG entry
* PR feedback: update name to requestorAppUrl
* update CHANGELOG property name
* add unit test
jaxdesmarais authored Dec 6, 2024
1 parent 15db334 commit f23e353
Showing 4 changed files with 27 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,10 +4,11 @@

* PayPal
* Add `deepLinkFallbackUrlScheme` to `PayPalClient` constructor params for supporting deep link fallback
* Send `url` in `event_params` for App Switch events to PayPal's analytics service (FPTI)
* LocalPayment
* Make LocalPaymentAuthRequestParams public (fixes #1207)
* PayPal
* Send `url` in `event_params` for App Switch events to PayPal's analytics service (FPTI)
* ThreeDSecure
* Add `ThreeDSecureRequest.requestorAppUrl`

## 5.2.0 (2024-10-30)

Original file line number Diff line number Diff line change
@@ -109,6 +109,9 @@ internal class CardinalClient {
cardinalConfigurationParameters.uiCustomization = it.cardinalUiCustomization
}

request.requestorAppUrl?.let {
cardinalConfigurationParameters.threeDSRequestorAppURL = it
}
try {
Cardinal.getInstance().configure(context, cardinalConfigurationParameters)
} catch (e: RuntimeException) {
Original file line number Diff line number Diff line change
@@ -49,6 +49,9 @@ import org.json.JSONObject
* @property customFields Optional. Object where each key is the name of a custom field which has
* been configured in the Control Panel. In the Control Panel you can configure 3D Secure Rules
* which trigger on certain values.
* @property requestorAppUrl Optional. Three DS Requester APP URL Merchant app declaring their
* URL within the CReq message so that the Authentication app can call the Merchant app after
* OOB authentication has occurred.
*/
@Parcelize
data class ThreeDSecureRequest @JvmOverloads constructor(
@@ -68,7 +71,8 @@ data class ThreeDSecureRequest @JvmOverloads constructor(
var v2UiCustomization: ThreeDSecureV2UiCustomization? = null,
var uiType: ThreeDSecureUiType = ThreeDSecureUiType.BOTH,
var renderTypes: List<ThreeDSecureRenderType>? = null,
var customFields: Map<String, String>? = null
var customFields: Map<String, String>? = null,
var requestorAppUrl: String? = null
) : Parcelable {

/**
Original file line number Diff line number Diff line change
@@ -185,6 +185,22 @@ class CardinalClientUnitTest {
assertEquals(exceptionSlot.captured.message, "consumer session id not available")
}

@Test
fun `when cardinal configuration is called with a requestorAppUrl, sets threeDSRequestorAppURL`() {
every { Cardinal.getInstance() } returns cardinalInstance

val sut = CardinalClient()
val request = ThreeDSecureRequest()
request.requestorAppUrl = "www.paypal.com"
sut.initialize(context, configuration, request, cardinalInitializeCallback)

val parametersSlot = slot<CardinalConfigurationParameters>()
verify { cardinalInstance.configure(context, capture(parametersSlot)) }

val parameters = parametersSlot.captured
assertEquals("www.paypal.com", parameters.threeDSRequestorAppURL)
}

@Test
fun initialize_onCardinalConfigureRuntimeException_throwsError() {
every { Cardinal.getInstance() } returns cardinalInstance

0 comments on commit f23e353

Please sign in to comment.