Skip to content

Commit

Permalink
SDK-2471: Add support for brand ID to be set at sdk config creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Artem Lukyanau committed Sep 20, 2024
1 parent 0ac68c1 commit 5e202ea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public class SdkConfig {
@JsonProperty(Property.PRIVACY_POLICY_URL)
private final String privacyPolicyUrl;

@JsonProperty(Property.BRAND_ID)
private final String brandId;

@JsonProperty(Property.ALLOW_HANDOFF)
private final Boolean allowHandoff;

Expand All @@ -51,6 +54,7 @@ public class SdkConfig {
String successUrl,
String errorUrl,
String privacyPolicyUrl,
String brandId,
Boolean allowHandoff,
AttemptsConfiguration attemptsConfiguration) {
this.allowedCaptureMethods = allowedCaptureMethods;
Expand All @@ -62,6 +66,7 @@ public class SdkConfig {
this.successUrl = successUrl;
this.errorUrl = errorUrl;
this.privacyPolicyUrl = privacyPolicyUrl;
this.brandId = brandId;
this.allowHandoff = allowHandoff;
this.attemptsConfiguration = attemptsConfiguration;
}
Expand Down Expand Up @@ -151,6 +156,15 @@ public String getPrivacyPolicyUrl() {
return privacyPolicyUrl;
}

/**
* The brand ID
*
* @return the brand ID
*/
public String getBrandId() {
return brandId;
}

/**
* If mobile handoff is allowed in the session
*
Expand Down Expand Up @@ -183,6 +197,7 @@ public static class Builder {
private String successUrl;
private String errorUrl;
private String privacyPolicyUrl;
private String brandId;
private Boolean allowHandoff;
private AttemptsConfiguration attemptsConfiguration;

Expand Down Expand Up @@ -305,6 +320,17 @@ public Builder withPrivacyPolicyUrl(String privacyPolicyUrl) {
return this;
}

/**
* Sets the brand ID
*
* @param brandId the brand ID
* @return the builder
*/
public Builder withBrandId(String brandId) {
this.brandId = brandId;
return this;
}

/**
* Sets if the user is allowed to perform mobile handoff
*
Expand Down Expand Up @@ -343,6 +369,7 @@ public SdkConfig build() {
successUrl,
errorUrl,
privacyPolicyUrl,
brandId,
allowHandoff,
attemptsConfiguration
);
Expand All @@ -360,6 +387,7 @@ private static final class Property {
private static final String SUCCESS_URL = "success_url";
private static final String ERROR_URL = "error_url";
private static final String PRIVACY_POLICY_URL = "privacy_policy_url";
private static final String BRAND_ID = "brand_id";
private static final String ALLOW_HANDOFF = "allow_handoff";
private static final String ATTEMPTS_CONFIGURATION = "attempts_configuration";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class SdkConfigTest {
private static final String SOME_FONT_COLOUR = "#b40c12";
private static final String SOME_LOCALE = "en";
private static final String SOME_PRESET_ISSUING_COUNTRY = "USA";
private static final String SOME_BRAND_ID = "someBrandId";

private static final String SOME_SUCCESS_URL = "https://yourdomain.com/some/success/endpoint";
private static final String SOME_ERROR_URL = "https://yourdomain.com/some/error/endpoint";
Expand All @@ -36,6 +37,7 @@ public void shouldBuildSimpleSdkConfigWithAllOptions() {
.withSuccessUrl(SOME_SUCCESS_URL)
.withErrorUrl(SOME_ERROR_URL)
.withPrivacyPolicyUrl(SOME_PRIVACY_POLICY_URL)
.withBrandId(SOME_BRAND_ID)
.withAllowHandoff(true)
.withAttemptsConfiguration(attemptsConfigurationMock)
.build();
Expand All @@ -51,6 +53,7 @@ public void shouldBuildSimpleSdkConfigWithAllOptions() {
assertThat(result.getSuccessUrl(), is(SOME_SUCCESS_URL));
assertThat(result.getErrorUrl(), is(SOME_ERROR_URL));
assertThat(result.getPrivacyPolicyUrl(), is(SOME_PRIVACY_POLICY_URL));
assertThat(result.getBrandId(), is(SOME_BRAND_ID));
assertThat(result.getAllowHandoff(), is(true));
assertThat(result.getAttemptsConfiguration(), is(attemptsConfigurationMock));
}
Expand Down

0 comments on commit 5e202ea

Please sign in to comment.