From 33ff6a942549651eb36fbe5a1d0aead619e252bb Mon Sep 17 00:00:00 2001 From: Alex Burt Date: Thu, 6 Aug 2026 12:20:24 +0100 Subject: [PATCH] SDK-2749: Add support for setting enforce_handoff when creating an IDV session --- .../client/docs/session/create/SdkConfig.java | 27 +++++++++++++++++++ .../docs/session/create/SdkConfigTest.java | 10 +++++++ 2 files changed, 37 insertions(+) diff --git a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SdkConfig.java b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SdkConfig.java index 4cd26deca..ddb2b3350 100644 --- a/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SdkConfig.java +++ b/yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SdkConfig.java @@ -48,6 +48,9 @@ public class SdkConfig { @JsonProperty("allow_handoff") private final Boolean allowHandoff; + @JsonProperty("enforce_handoff") + private final Boolean enforceHandoff; + @JsonProperty("attempts_configuration") private final AttemptsConfiguration attemptsConfiguration; @@ -72,6 +75,7 @@ private SdkConfig(String allowedCaptureMethods, String errorUrl, String privacyPolicyUrl, Boolean allowHandoff, + Boolean enforceHandoff, AttemptsConfiguration attemptsConfiguration, String brandId, String biometricConsentFlow, @@ -88,6 +92,7 @@ private SdkConfig(String allowedCaptureMethods, this.errorUrl = errorUrl; this.privacyPolicyUrl = privacyPolicyUrl; this.allowHandoff = allowHandoff; + this.enforceHandoff = enforceHandoff; this.attemptsConfiguration = attemptsConfiguration; this.brandId = brandId; this.biometricConsentFlow = biometricConsentFlow; @@ -206,6 +211,15 @@ public Boolean getAllowHandoff() { return allowHandoff; } + /** + * If mobile handoff is enforced in the session + * + * @return if mobile handoff is enforced + */ + public Boolean getEnforceHandoff() { + return enforceHandoff; + } + /** * The number of allowed attempts for certain tasks * @@ -259,6 +273,7 @@ public static class Builder { private String errorUrl; private String privacyPolicyUrl; private Boolean allowHandoff; + private Boolean enforceHandoff; private AttemptsConfiguration attemptsConfiguration; private String brandId; private String biometricConsentFlow; @@ -444,6 +459,17 @@ public Builder withAllowHandoff(boolean allowHandoff) { return this; } + /** + * Sets if the user is required to perform mobile handoff + * + * @param enforceHandoff if mobile handoff is enforced + * @return the builder + */ + public Builder withEnforceHandoff(boolean enforceHandoff) { + this.enforceHandoff = enforceHandoff; + return this; + } + /** * Sets the {@link AttemptsConfiguration} for any Text Extractions Tasks * @@ -528,6 +554,7 @@ public SdkConfig build() { errorUrl, privacyPolicyUrl, allowHandoff, + enforceHandoff, attemptsConfiguration, brandId, biometricConsentFlow, diff --git a/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/SdkConfigTest.java b/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/SdkConfigTest.java index a184e5932..51807723e 100644 --- a/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/SdkConfigTest.java +++ b/yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/SdkConfigTest.java @@ -44,6 +44,7 @@ public void shouldBuildSimpleSdkConfigWithAllOptions() { .withErrorUrl(SOME_ERROR_URL) .withPrivacyPolicyUrl(SOME_PRIVACY_POLICY_URL) .withAllowHandoff(true) + .withEnforceHandoff(true) .withAttemptsConfiguration(attemptsConfigurationMock) .withBrandId(SOME_BRAND_ID) .withSuppressedScreen(SOME_SUPPRESSED_SCREEN) @@ -64,6 +65,7 @@ public void shouldBuildSimpleSdkConfigWithAllOptions() { assertThat(result.getErrorUrl(), is(SOME_ERROR_URL)); assertThat(result.getPrivacyPolicyUrl(), is(SOME_PRIVACY_POLICY_URL)); assertThat(result.getAllowHandoff(), is(true)); + assertThat(result.getEnforceHandoff(), is(true)); assertThat(result.getAttemptsConfiguration(), is(attemptsConfigurationMock)); assertThat(result.getBrandId(), is(SOME_BRAND_ID)); assertThat(result.getSuppressedScreens(), hasSize(2)); @@ -78,6 +80,14 @@ public void allowHandoff_shouldBeNullWhenNotSet() { assertThat(result.getAllowHandoff(), is(nullValue())); } + @Test + public void enforceHandoff_shouldBeNullWhenNotSet() { + SdkConfig result = SdkConfig.builder() + .build(); + + assertThat(result.getEnforceHandoff(), is(nullValue())); + } + @Test public void shouldBuildSimpleSdkConfigWithOnlyCamera() { SdkConfig result = SdkConfig.builder()