Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK-2470 add brand_id to IDV SDK config #487

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/idv_service/session/create/sdk.config.builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,19 @@ class SdkConfigBuilder {
);
}

/**
* Sets the brandID on the builder
*
* @param {string} brandId
*
* @returns {this}
*/
withBrandId(brandId) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about what we want:

.withBrandID()
// or
.withBrandId()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.withBrandId() 👍

Validation.isString(brandId, 'brandId');
this.brandId = brandId;
return this;
}

/**
* Builds the {@link SdkConfig} using the values supplied to the builder
*
Expand All @@ -269,7 +282,8 @@ class SdkConfigBuilder {
this.privacyPolicyUrl,
this.biometricConsentFlow,
this.allowHandoff,
this.attemptsConfiguration
this.attemptsConfiguration,
this.brandId
);
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/idv_service/session/create/sdk.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class SdkConfig {
* Allows user to handoff to mobile during session
* @param {object} attemptsConfiguration
* The attempts configuration
* @param {string} brandId
* The brandID for the client
*/
constructor(
allowedCaptureMethods,
Expand All @@ -41,7 +43,8 @@ class SdkConfig {
privacyPolicyUrl,
biometricConsentFlow,
allowHandoff,
attemptsConfiguration
attemptsConfiguration,
brandId
) {
Validation.isString(allowedCaptureMethods, 'allowedCaptureMethods', true);
/** @private */
Expand Down Expand Up @@ -92,6 +95,10 @@ class SdkConfig {
/** @private */
this.attemptsConfiguration = attemptsConfiguration;
}

Validation.isString(brandId, 'brandId', true);
/** @private */
this.brandId = brandId;
}

/**
Expand All @@ -111,6 +118,7 @@ class SdkConfig {
biometric_consent_flow: this.biometricConsentFlow,
allow_handoff: this.allowHandoff,
attempts_configuration: this.attemptsConfiguration,
brand_id: this.brandId,
};
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/idv_service/session/create/sdk.config.builder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('SdkConfigBuilder', () => {
.withPrivacyPolicyUrl('some-privacy-policy-url')
.withBiometricConsentFlow('some-flow')
.withAllowHandoff(true)
.withBrandId('some-brand-identifier')
.build();

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

expect(JSON.stringify(sdkConfig)).toBe(expectedJson);
Expand Down
9 changes: 9 additions & 0 deletions types/src/idv_service/session/create/sdk.config.builder.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ declare class SdkConfigBuilder {
* @returns {this}
*/
withIdDocumentTextExtractionGenericRetries(retries: number): this;
/**
* Sets the brandID on the builder
*
* @param {string} brandId
*
* @returns {this}
*/
withBrandId(brandId: string): this;
brandId: string;
/**
* Builds the {@link SdkConfig} using the values supplied to the builder
*
Expand Down
7 changes: 6 additions & 1 deletion types/src/idv_service/session/create/sdk.config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ declare class SdkConfig {
* Allows user to handoff to mobile during session
* @param {object} attemptsConfiguration
* The attempts configuration
* @param {string} brandId
* The brandID for the client
*/
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);
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);
/** @private */
private allowedCaptureMethods;
/** @private */
Expand All @@ -51,6 +53,8 @@ declare class SdkConfig {
private allowHandoff;
/** @private */
private attemptsConfiguration;
/** @private */
private brandId;
/**
* Returns serialized data for JSON.stringify()
*/
Expand All @@ -67,5 +71,6 @@ declare class SdkConfig {
biometric_consent_flow: string;
allow_handoff: boolean;
attempts_configuration: any;
brand_id: string;
};
}