Skip to content

Commit e5c0b03

Browse files
committed
SDK-2309: Add support for setting biometric consent flow for a session
1 parent 528dbd1 commit e5c0b03

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed

yoti-sdk-api/src/main/java/com/yoti/api/client/docs/DocScanConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,7 @@ private DocScanConstants() { }
8383

8484
public static final String GBP = "GBP";
8585

86+
public static final String EAGER = "EAGER";
87+
public static final String JUST_IN_TIME = "JUST_IN_TIME";
88+
8689
}

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

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public class SdkConfig {
4545
@JsonProperty(Property.BRAND_ID)
4646
private final String brandId;
4747

48+
@JsonProperty(Property.BIOMETRIC_CONSENT_FLOW)
49+
private final String biometricConsentFlow;
50+
4851
SdkConfig(String allowedCaptureMethods,
4952
String primaryColour,
5053
String secondaryColour,
@@ -55,7 +58,9 @@ public class SdkConfig {
5558
String errorUrl,
5659
String privacyPolicyUrl,
5760
Boolean allowHandoff,
58-
AttemptsConfiguration attemptsConfiguration, String brandId) {
61+
AttemptsConfiguration attemptsConfiguration,
62+
String brandId,
63+
String biometricConsentFlow) {
5964
this.allowedCaptureMethods = allowedCaptureMethods;
6065
this.primaryColour = primaryColour;
6166
this.secondaryColour = secondaryColour;
@@ -68,6 +73,7 @@ public class SdkConfig {
6873
this.allowHandoff = allowHandoff;
6974
this.attemptsConfiguration = attemptsConfiguration;
7075
this.brandId = brandId;
76+
this.biometricConsentFlow = biometricConsentFlow;
7177
}
7278

7379
public static SdkConfig.Builder builder() {
@@ -182,6 +188,15 @@ public String getBrandId() {
182188
return brandId;
183189
}
184190

191+
/**
192+
* The configured biometric consent flow for the session
193+
*
194+
* @return the configured biometric consent flow
195+
*/
196+
public String getBiometricConsentFlow() {
197+
return biometricConsentFlow;
198+
}
199+
185200
/**
186201
* Builder to assist in the creation of {@link SdkConfig}.
187202
*/
@@ -199,6 +214,7 @@ public static class Builder {
199214
private Boolean allowHandoff;
200215
private AttemptsConfiguration attemptsConfiguration;
201216
private String brandId;
217+
private String biometricConsentFlow;
202218

203219
private Builder() {}
204220

@@ -352,6 +368,35 @@ public Builder withBrandId(String brandId) {
352368
return this;
353369
}
354370

371+
/**
372+
* Sets the Biometric Consent Flow for the session
373+
*
374+
* @param biometricConsentFlow the biometric consent flow
375+
* @return the builder
376+
*/
377+
public Builder withBiometricConsentFlow(String biometricConsentFlow) {
378+
this.biometricConsentFlow = biometricConsentFlow;
379+
return this;
380+
}
381+
382+
/**
383+
* Sets the biometric consent flow to EAGER for the session
384+
*
385+
* @return the builder
386+
*/
387+
public Builder withBiometricConsentFlowEager() {
388+
return withBiometricConsentFlow(DocScanConstants.EAGER);
389+
}
390+
391+
/**
392+
* Sets the biometric consent flow to JUST_IN_TIME for the session
393+
*
394+
* @return the builder
395+
*/
396+
public Builder withBiometricConsentFlowJustInTime() {
397+
return withBiometricConsentFlow(DocScanConstants.JUST_IN_TIME);
398+
}
399+
355400
/**
356401
* Builds the {@link SdkConfig} using the values supplied to the builder
357402
*
@@ -370,7 +415,8 @@ public SdkConfig build() {
370415
privacyPolicyUrl,
371416
allowHandoff,
372417
attemptsConfiguration,
373-
brandId
418+
brandId,
419+
biometricConsentFlow
374420
);
375421
}
376422
}
@@ -389,6 +435,7 @@ private static final class Property {
389435
private static final String ALLOW_HANDOFF = "allow_handoff";
390436
private static final String ATTEMPTS_CONFIGURATION = "attempts_configuration";
391437
private static final String BRAND_ID = "brand_id";
438+
private static final String BIOMETRIC_CONSENT_FLOW = "biometric_consent_flow";
392439

393440
private Property() {}
394441

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ public void shouldBuildSimpleSdkConfigWithCameraAndUpload() {
8484
assertThat(result.getAllowedCaptureMethods(), is("CAMERA_AND_UPLOAD"));
8585
}
8686

87+
@Test
88+
public void shouldBuildSimpleSdkConfigWithBiometricConsentFlowEager() {
89+
SdkConfig result = SdkConfig.builder()
90+
.withBiometricConsentFlowEager()
91+
.build();
92+
93+
assertThat(result.getBiometricConsentFlow(), is("EAGER"));
94+
}
95+
96+
@Test
97+
public void shouldBuildSimpleSdkConfigWithBiometricConsentFlowJustInTime() {
98+
SdkConfig result = SdkConfig.builder()
99+
.withBiometricConsentFlowJustInTime()
100+
.build();
101+
102+
assertThat(result.getBiometricConsentFlow(), is("JUST_IN_TIME"));
103+
}
104+
87105
@Test
88106
public void shouldOverridePreviousAllowedCaptureMethods() {
89107
SdkConfig result = SdkConfig.builder()

0 commit comments

Comments
 (0)