Skip to content

Commit 528dbd1

Browse files
committed
SDK-2467: [AB] Allow the brand ID to be set at session creation (as part of the sdk_config)
1 parent d5da728 commit 528dbd1

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public class SdkConfig {
4242
@JsonProperty(Property.ATTEMPTS_CONFIGURATION)
4343
private final AttemptsConfiguration attemptsConfiguration;
4444

45+
@JsonProperty(Property.BRAND_ID)
46+
private final String brandId;
47+
4548
SdkConfig(String allowedCaptureMethods,
4649
String primaryColour,
4750
String secondaryColour,
@@ -52,7 +55,7 @@ public class SdkConfig {
5255
String errorUrl,
5356
String privacyPolicyUrl,
5457
Boolean allowHandoff,
55-
AttemptsConfiguration attemptsConfiguration) {
58+
AttemptsConfiguration attemptsConfiguration, String brandId) {
5659
this.allowedCaptureMethods = allowedCaptureMethods;
5760
this.primaryColour = primaryColour;
5861
this.secondaryColour = secondaryColour;
@@ -64,6 +67,7 @@ public class SdkConfig {
6467
this.privacyPolicyUrl = privacyPolicyUrl;
6568
this.allowHandoff = allowHandoff;
6669
this.attemptsConfiguration = attemptsConfiguration;
70+
this.brandId = brandId;
6771
}
6872

6973
public static SdkConfig.Builder builder() {
@@ -169,6 +173,15 @@ public AttemptsConfiguration getAttemptsConfiguration() {
169173
return attemptsConfiguration;
170174
}
171175

176+
/**
177+
* The Brand ID to use for the session
178+
*
179+
* @return the configured brand ID
180+
*/
181+
public String getBrandId() {
182+
return brandId;
183+
}
184+
172185
/**
173186
* Builder to assist in the creation of {@link SdkConfig}.
174187
*/
@@ -185,6 +198,7 @@ public static class Builder {
185198
private String privacyPolicyUrl;
186199
private Boolean allowHandoff;
187200
private AttemptsConfiguration attemptsConfiguration;
201+
private String brandId;
188202

189203
private Builder() {}
190204

@@ -327,6 +341,17 @@ public Builder withAttemptsConfiguration(AttemptsConfiguration attemptsConfigura
327341
return this;
328342
}
329343

344+
/**
345+
* Sets the brand ID to be used for the session
346+
*
347+
* @param brandId the brand ID
348+
* @return the builder
349+
*/
350+
public Builder withBrandId(String brandId) {
351+
this.brandId = brandId;
352+
return this;
353+
}
354+
330355
/**
331356
* Builds the {@link SdkConfig} using the values supplied to the builder
332357
*
@@ -344,7 +369,8 @@ public SdkConfig build() {
344369
errorUrl,
345370
privacyPolicyUrl,
346371
allowHandoff,
347-
attemptsConfiguration
372+
attemptsConfiguration,
373+
brandId
348374
);
349375
}
350376
}
@@ -362,6 +388,7 @@ private static final class Property {
362388
private static final String PRIVACY_POLICY_URL = "privacy_policy_url";
363389
private static final String ALLOW_HANDOFF = "allow_handoff";
364390
private static final String ATTEMPTS_CONFIGURATION = "attempts_configuration";
391+
private static final String BRAND_ID = "brand_id";
365392

366393
private Property() {}
367394

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class SdkConfigTest {
1717
private static final String SOME_FONT_COLOUR = "#b40c12";
1818
private static final String SOME_LOCALE = "en";
1919
private static final String SOME_PRESET_ISSUING_COUNTRY = "USA";
20+
private static final String SOME_BRAND_ID = "someBrandId";
2021

2122
private static final String SOME_SUCCESS_URL = "https://yourdomain.com/some/success/endpoint";
2223
private static final String SOME_ERROR_URL = "https://yourdomain.com/some/error/endpoint";
@@ -38,6 +39,7 @@ public void shouldBuildSimpleSdkConfigWithAllOptions() {
3839
.withPrivacyPolicyUrl(SOME_PRIVACY_POLICY_URL)
3940
.withAllowHandoff(true)
4041
.withAttemptsConfiguration(attemptsConfigurationMock)
42+
.withBrandId(SOME_BRAND_ID)
4143
.build();
4244

4345
assertThat(result, is(instanceOf(SdkConfig.class)));
@@ -53,6 +55,7 @@ public void shouldBuildSimpleSdkConfigWithAllOptions() {
5355
assertThat(result.getPrivacyPolicyUrl(), is(SOME_PRIVACY_POLICY_URL));
5456
assertThat(result.getAllowHandoff(), is(true));
5557
assertThat(result.getAttemptsConfiguration(), is(attemptsConfigurationMock));
58+
assertThat(result.getBrandId(), is(SOME_BRAND_ID));
5659
}
5760

5861
@Test

0 commit comments

Comments
 (0)