Skip to content

Commit 66538a3

Browse files
committed
SDK-2579: Add support for suppressing certain screens on the end-user flow
1 parent 214f98b commit 66538a3

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

yoti-sdk-api/src/main/java/com/yoti/api/client/docs/session/create/SdkConfig.java

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.yoti.api.client.docs.session.create;
22

3+
import java.util.ArrayList;
4+
import java.util.List;
5+
36
import com.yoti.api.client.docs.DocScanConstants;
47

58
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -54,6 +57,9 @@ public class SdkConfig {
5457
@JsonProperty(Property.BIOMETRIC_CONSENT_FLOW)
5558
private final String biometricConsentFlow;
5659

60+
@JsonProperty(Property.SUPPRESSED_SCREENS)
61+
private final List<String> suppressedScreens;
62+
5763
SdkConfig(String allowedCaptureMethods,
5864
String primaryColour,
5965
String primaryColourDarkMode,
@@ -68,7 +74,7 @@ public class SdkConfig {
6874
Boolean allowHandoff,
6975
AttemptsConfiguration attemptsConfiguration,
7076
String brandId,
71-
String biometricConsentFlow) {
77+
String biometricConsentFlow, List<String> suppressedScreens) {
7278
this.allowedCaptureMethods = allowedCaptureMethods;
7379
this.primaryColour = primaryColour;
7480
this.primaryColourDarkMode = primaryColourDarkMode;
@@ -84,6 +90,7 @@ public class SdkConfig {
8490
this.attemptsConfiguration = attemptsConfiguration;
8591
this.brandId = brandId;
8692
this.biometricConsentFlow = biometricConsentFlow;
93+
this.suppressedScreens = suppressedScreens;
8794
}
8895

8996
public static SdkConfig.Builder builder() {
@@ -225,6 +232,15 @@ public String getBiometricConsentFlow() {
225232
return biometricConsentFlow;
226233
}
227234

235+
/**
236+
* The list of screens to suppress in the end-user flow
237+
*
238+
* @return the list of suppressed screens
239+
*/
240+
public List<String> getSuppressedScreens() {
241+
return suppressedScreens;
242+
}
243+
228244
/**
229245
* Builder to assist in the creation of {@link SdkConfig}.
230246
*/
@@ -245,8 +261,10 @@ public static class Builder {
245261
private AttemptsConfiguration attemptsConfiguration;
246262
private String brandId;
247263
private String biometricConsentFlow;
264+
private List<String> suppressedScreens;
248265

249-
private Builder() {}
266+
private Builder() {
267+
}
250268

251269
/**
252270
* Sets the allowed capture method to "CAMERA"
@@ -476,6 +494,20 @@ public Builder withBiometricConsentFlowJustInTime() {
476494
return withBiometricConsentFlow(DocScanConstants.JUST_IN_TIME);
477495
}
478496

497+
/**
498+
* Add a named screen to the list of suppressed screen in the end-user flow
499+
*
500+
* @param suppressedScreen the name of the screen to suppress
501+
* @return the builder
502+
*/
503+
public Builder withSuppressedScreen(String suppressedScreen) {
504+
if (suppressedScreens == null) {
505+
suppressedScreens = new ArrayList<>();
506+
}
507+
suppressedScreens.add(suppressedScreen);
508+
return this;
509+
}
510+
479511
/**
480512
* Builds the {@link SdkConfig} using the values supplied to the builder
481513
*
@@ -497,7 +529,8 @@ public SdkConfig build() {
497529
allowHandoff,
498530
attemptsConfiguration,
499531
brandId,
500-
biometricConsentFlow
532+
biometricConsentFlow,
533+
suppressedScreens
501534
);
502535
}
503536
}
@@ -519,8 +552,10 @@ private static final class Property {
519552
private static final String ATTEMPTS_CONFIGURATION = "attempts_configuration";
520553
private static final String BRAND_ID = "brand_id";
521554
private static final String BIOMETRIC_CONSENT_FLOW = "biometric_consent_flow";
555+
private static final String SUPPRESSED_SCREENS = "suppressed_screens";
522556

523-
private Property() {}
557+
private Property() {
558+
}
524559

525560
}
526561

yoti-sdk-api/src/test/java/com/yoti/api/client/docs/session/create/SdkConfigTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class SdkConfigTest {
2020
private static final String SOME_DARK_MODE = "ON";
2121
private static final String SOME_PRESET_ISSUING_COUNTRY = "USA";
2222
private static final String SOME_BRAND_ID = "someBrandId";
23+
private static final String SOME_SUPPRESSED_SCREEN = "someSuppressedScreen";
24+
private static final String SOME_OTHER_SUPPRESSED_SCREEN = "someOtherSuppressedScreen";
2325

2426
private static final String SOME_SUCCESS_URL = "https://yourdomain.com/some/success/endpoint";
2527
private static final String SOME_ERROR_URL = "https://yourdomain.com/some/error/endpoint";
@@ -44,6 +46,8 @@ public void shouldBuildSimpleSdkConfigWithAllOptions() {
4446
.withAllowHandoff(true)
4547
.withAttemptsConfiguration(attemptsConfigurationMock)
4648
.withBrandId(SOME_BRAND_ID)
49+
.withSuppressedScreen(SOME_SUPPRESSED_SCREEN)
50+
.withSuppressedScreen(SOME_OTHER_SUPPRESSED_SCREEN)
4751
.build();
4852

4953
assertThat(result, is(instanceOf(SdkConfig.class)));
@@ -62,6 +66,8 @@ public void shouldBuildSimpleSdkConfigWithAllOptions() {
6266
assertThat(result.getAllowHandoff(), is(true));
6367
assertThat(result.getAttemptsConfiguration(), is(attemptsConfigurationMock));
6468
assertThat(result.getBrandId(), is(SOME_BRAND_ID));
69+
assertThat(result.getSuppressedScreens(), hasSize(2));
70+
assertThat(result.getSuppressedScreens(), hasItems(SOME_SUPPRESSED_SCREEN, SOME_OTHER_SUPPRESSED_SCREEN));
6571
}
6672

6773
@Test
@@ -145,4 +151,12 @@ public void shouldSetDarkModeToAuto() {
145151
assertThat(result.getDarkMode(), is("AUTO"));
146152
}
147153

154+
@Test
155+
public void suppressedScreens_shouldBeNullIfNotSet() {
156+
SdkConfig result = SdkConfig.builder()
157+
.build();
158+
159+
assertThat(result.getSuppressedScreens(), is(nullValue()));
160+
}
161+
148162
}

0 commit comments

Comments
 (0)