Skip to content

Commit cd9570c

Browse files
committed
SDK-2470 add brand_id to IDV SDK config (#487)
Update idv_service to expose a `withBrandId` in the SDK config builder. (#487)
1 parent 0b29021 commit cd9570c

File tree

5 files changed

+41
-3
lines changed

5 files changed

+41
-3
lines changed

src/idv_service/session/create/sdk.config.builder.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,19 @@ class SdkConfigBuilder {
251251
);
252252
}
253253

254+
/**
255+
* Sets the brandID on the builder
256+
*
257+
* @param {string} brandId
258+
*
259+
* @returns {this}
260+
*/
261+
withBrandId(brandId) {
262+
Validation.isString(brandId, 'brandId');
263+
this.brandId = brandId;
264+
return this;
265+
}
266+
254267
/**
255268
* Builds the {@link SdkConfig} using the values supplied to the builder
256269
*
@@ -269,7 +282,8 @@ class SdkConfigBuilder {
269282
this.privacyPolicyUrl,
270283
this.biometricConsentFlow,
271284
this.allowHandoff,
272-
this.attemptsConfiguration
285+
this.attemptsConfiguration,
286+
this.brandId
273287
);
274288
}
275289
}

src/idv_service/session/create/sdk.config.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class SdkConfig {
2828
* Allows user to handoff to mobile during session
2929
* @param {object} attemptsConfiguration
3030
* The attempts configuration
31+
* @param {string} brandId
32+
* The brandID for the client
3133
*/
3234
constructor(
3335
allowedCaptureMethods,
@@ -41,7 +43,8 @@ class SdkConfig {
4143
privacyPolicyUrl,
4244
biometricConsentFlow,
4345
allowHandoff,
44-
attemptsConfiguration
46+
attemptsConfiguration,
47+
brandId
4548
) {
4649
Validation.isString(allowedCaptureMethods, 'allowedCaptureMethods', true);
4750
/** @private */
@@ -92,6 +95,10 @@ class SdkConfig {
9295
/** @private */
9396
this.attemptsConfiguration = attemptsConfiguration;
9497
}
98+
99+
Validation.isString(brandId, 'brandId', true);
100+
/** @private */
101+
this.brandId = brandId;
95102
}
96103

97104
/**
@@ -111,6 +118,7 @@ class SdkConfig {
111118
biometric_consent_flow: this.biometricConsentFlow,
112119
allow_handoff: this.allowHandoff,
113120
attempts_configuration: this.attemptsConfiguration,
121+
brand_id: this.brandId,
114122
};
115123
}
116124
}

tests/idv_service/session/create/sdk.config.builder.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('SdkConfigBuilder', () => {
1616
.withPrivacyPolicyUrl('some-privacy-policy-url')
1717
.withBiometricConsentFlow('some-flow')
1818
.withAllowHandoff(true)
19+
.withBrandId('some-brand-identifier')
1920
.build();
2021

2122
const expectedJson = JSON.stringify({
@@ -30,6 +31,7 @@ describe('SdkConfigBuilder', () => {
3031
privacy_policy_url: 'some-privacy-policy-url',
3132
biometric_consent_flow: 'some-flow',
3233
allow_handoff: true,
34+
brand_id: 'some-brand-identifier',
3335
});
3436

3537
expect(JSON.stringify(sdkConfig)).toBe(expectedJson);

types/src/idv_service/session/create/sdk.config.builder.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,15 @@ declare class SdkConfigBuilder {
163163
* @returns {this}
164164
*/
165165
withIdDocumentTextExtractionGenericRetries(retries: number): this;
166+
/**
167+
* Sets the brandID on the builder
168+
*
169+
* @param {string} brandId
170+
*
171+
* @returns {this}
172+
*/
173+
withBrandId(brandId: string): this;
174+
brandId: string;
166175
/**
167176
* Builds the {@link SdkConfig} using the values supplied to the builder
168177
*

types/src/idv_service/session/create/sdk.config.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ declare class SdkConfig {
2525
* Allows user to handoff to mobile during session
2626
* @param {object} attemptsConfiguration
2727
* The attempts configuration
28+
* @param {string} brandId
29+
* The brandID for the client
2830
*/
29-
constructor(allowedCaptureMethods: string, primaryColour: string, secondaryColour: string, fontColour: string, locale: string, presetIssuingCountry: string, successUrl: string, errorUrl: string, privacyPolicyUrl: string, biometricConsentFlow: string, allowHandoff: boolean, attemptsConfiguration: object);
31+
constructor(allowedCaptureMethods: string, primaryColour: string, secondaryColour: string, fontColour: string, locale: string, presetIssuingCountry: string, successUrl: string, errorUrl: string, privacyPolicyUrl: string, biometricConsentFlow: string, allowHandoff: boolean, attemptsConfiguration: object, brandId: string);
3032
/** @private */
3133
private allowedCaptureMethods;
3234
/** @private */
@@ -51,6 +53,8 @@ declare class SdkConfig {
5153
private allowHandoff;
5254
/** @private */
5355
private attemptsConfiguration;
56+
/** @private */
57+
private brandId;
5458
/**
5559
* Returns serialized data for JSON.stringify()
5660
*/
@@ -67,5 +71,6 @@ declare class SdkConfig {
6771
biometric_consent_flow: string;
6872
allow_handoff: boolean;
6973
attempts_configuration: any;
74+
brand_id: string;
7075
};
7176
}

0 commit comments

Comments
 (0)