diff --git a/packages/sdk-client/src/index.ts b/packages/sdk-client/src/index.ts index e89ddebf..b07842dd 100644 --- a/packages/sdk-client/src/index.ts +++ b/packages/sdk-client/src/index.ts @@ -1,5 +1,6 @@ export * from './api'; export * from './client'; export * from './domain'; +export * from './model'; export * from './plugins'; export * from './utils'; diff --git a/packages/sdk-client/src/model/index.ts b/packages/sdk-client/src/model/index.ts new file mode 100644 index 00000000..8b2cd2f9 --- /dev/null +++ b/packages/sdk-client/src/model/index.ts @@ -0,0 +1 @@ +export type { WithAdditionalProperties } from './withAdditionalProperties'; diff --git a/packages/sdk-client/src/model/withAdditionalProperties.ts b/packages/sdk-client/src/model/withAdditionalProperties.ts new file mode 100644 index 00000000..947038db --- /dev/null +++ b/packages/sdk-client/src/model/withAdditionalProperties.ts @@ -0,0 +1,3 @@ +export interface WithAdditionalProperties { + [key: string]: any; +} diff --git a/packages/verification/src/models/v1/enums.ts b/packages/verification/src/models/v1/enums.ts index 0eaefb88..602984c1 100644 --- a/packages/verification/src/models/v1/enums.ts +++ b/packages/verification/src/models/v1/enums.ts @@ -1,5 +1,8 @@ export type ActionEnum = 'allow' | 'deny'; +/** Selects type of code which will be sent to customer */ +export type CodeType = 'Numeric' | 'Alpha' | 'Alphanumeric' | string; + export type VerificationStatusEnum = 'PENDING' | 'SUCCESSFUL' | 'FAIL' diff --git a/packages/verification/src/models/v1/helper.ts b/packages/verification/src/models/v1/helper.ts index 1972bc85..b8180239 100644 --- a/packages/verification/src/models/v1/helper.ts +++ b/packages/verification/src/models/v1/helper.ts @@ -51,12 +51,14 @@ export const startVerificationHelper = { * @param {string} phoneNumber - The phone number to which the verification call should be made. * @param {string} [reference] - An optional reference identifier used to pass your own reference in the request for tracking purposes. * @param {string} [locale] - An optional language-region identifier to use for the verification call. + * @param {Record} [additionalOptions] - An optional object for any additional phone call options. * @return {StartPhoneCallVerificationRequestData} The request data object for initiating the phone call verification. */ buildPhoneCallRequest: ( phoneNumber: string, reference?: string, locale?: string, + additionalOptions?: Record, ): StartPhoneCallVerificationRequestData => { return { startVerificationWithPhoneCallRequestBody: { @@ -65,13 +67,14 @@ export const startVerificationHelper = { endpoint: phoneNumber, }, reference, - ...(locale !== undefined) ? { + ...(locale !== undefined || additionalOptions !== undefined ? { phoneCallOptions: { - speech: { - locale, - }, + ...(locale !== undefined ? { + speech: { locale }, + } : {}), + ...(additionalOptions ?? {}), }, - } : {}, + } : {}), }, }; }, @@ -96,13 +99,13 @@ export const startVerificationHelper = { endpoint: phoneNumber, }, reference, - ...(locale !== undefined) ? { + ...(locale !== undefined ? { calloutOptions: { speech: { locale, }, }, - } : {}, + } : {}), }, }; }, @@ -112,12 +115,17 @@ export const startVerificationHelper = { * @param {string} phoneNumber - The phone number to which the flash call verification should be made. * @param {string} [reference] - An optional reference identifier used to pass your own reference in the request for tracking purposes. * @param {number} [dialTimeout] - An optional timeout value in seconds for how long to wait for the flash call to be answered. + * @param {number} [interceptionTimeout] - An optional timeout value in seconds for the maximum time that a phone call verification will be active and can be completed. If the phone number hasn't been verified successfully during this time, then the verification request will fail. By default, the Sinch dashboard will automatically optimize dial time out during a phone call. + * @param {Record} [additionalOptions] - An optional object for any additional flash call options. * @return {StartFlashCallVerificationRequestData} The request data object for initiating the flash call verification. + * TODO V2: limit the number of parameters by introducing a FlashCallOptions object */ buildFlashCallRequest: ( phoneNumber: string, reference?: string, dialTimeout?: number, + interceptionTimeout?: number, + additionalOptions?: Record, ): StartFlashCallVerificationRequestData => { return { startVerificationWithFlashCallRequestBody: { @@ -126,11 +134,13 @@ export const startVerificationHelper = { endpoint: phoneNumber, }, reference, - ...(dialTimeout !== undefined) ? { + ...(dialTimeout !== undefined || interceptionTimeout !== undefined || additionalOptions !== undefined ? { flashCallOptions: { - dialTimeout, + ...(dialTimeout !== undefined ? { dialTimeout } : {}), + ...(interceptionTimeout !== undefined ? { interceptionTimeout } : {}), + ...(additionalOptions ?? {}), }, - } : {}, + } : {}), }, }; }, diff --git a/packages/verification/src/models/v1/mod-callbacks/flashcall-request-event-response/flashcall-request-event-response.ts b/packages/verification/src/models/v1/mod-callbacks/flashcall-request-event-response/flashcall-request-event-response.ts index 645d2f91..87724d9e 100644 --- a/packages/verification/src/models/v1/mod-callbacks/flashcall-request-event-response/flashcall-request-event-response.ts +++ b/packages/verification/src/models/v1/mod-callbacks/flashcall-request-event-response/flashcall-request-event-response.ts @@ -1,4 +1,5 @@ import { ActionEnum } from '../../enums'; +import { WithAdditionalProperties } from '@sinch/sdk-client'; export interface FlashCallRequestEventResponse { /** Determines whether the verification can be executed. */ @@ -10,9 +11,11 @@ export interface FlashCallRequestEventResponse { /** @deprecated Use FlashCallProperties instead */ export type FlashCallContent = FlashCallProperties; -export interface FlashCallProperties { - /** The phone number that will be displayed to the user when the flashcall is received on the user\'s phone. By default, the Sinch dashboard will randomly select the CLI that will be displayed during a flashcall from a pool of numbers. If you want to set your own CLI, you can specify it in the response to the Verification Request Event. */ +export interface FlashCallProperties extends WithAdditionalProperties { + /** The phone number that will be displayed to the user when the flash call is received on the user's phone. By default, the Sinch dashboard will randomly select the CLI that will be displayed during a phone call from a pool of numbers. If you want to set your own CLI, you can specify it in the response to the Verification Request Event. */ cli?: string; - /** The maximum time that a flashcall verification will be active and can be completed. If the phone number hasn\'t been verified successfully during this time, then the verification request will fail. By default, the Sinch dashboard will automatically optimize dial time out during a flashcall. If you want to set your own dial time out for the flashcall, you can specify it in the response to the Verification Request Event. */ + /** The amount of time that a phone will ring. */ dialTimeout?: number; + /** The maximum time that a phone call verification will be active and can be completed. If the phone number hasn't been verified successfully during this time, then the verification request will fail. By default, the Sinch dashboard will automatically optimize dial time out during a phone call. */ + interceptionTimeout?: number; } diff --git a/packages/verification/src/models/v1/mod-callbacks/phonecall-request-event-response/phonecall-request-event-response.ts b/packages/verification/src/models/v1/mod-callbacks/phonecall-request-event-response/phonecall-request-event-response.ts index 4d451644..bf801378 100644 --- a/packages/verification/src/models/v1/mod-callbacks/phonecall-request-event-response/phonecall-request-event-response.ts +++ b/packages/verification/src/models/v1/mod-callbacks/phonecall-request-event-response/phonecall-request-event-response.ts @@ -1,4 +1,5 @@ import { ActionEnum } from '../../enums'; +import { WithAdditionalProperties } from '@sinch/sdk-client'; /** @deprecated Use PhoneCallRequestEventResponse instead */ export type CalloutRequestEventResponse = PhoneCallRequestEventResponse; @@ -13,7 +14,7 @@ export interface PhoneCallRequestEventResponse { /** @deprecated Use PhoneCallProperties instead */ export type CalloutProperties = PhoneCallProperties; -export interface PhoneCallProperties { +export interface PhoneCallProperties extends WithAdditionalProperties { /** The Phone Call PIN that should be entered by the user. Sinch servers automatically generate PIN codes for Phone Call verification. If you want to set your own code, you can specify it in the response to the Verification Request Event. */ code?: string; /** @see SpeechProperties */ diff --git a/packages/verification/src/models/v1/mod-callbacks/sms-request-event-response/sms-request-event-response.ts b/packages/verification/src/models/v1/mod-callbacks/sms-request-event-response/sms-request-event-response.ts index 21d9bd55..2112d572 100644 --- a/packages/verification/src/models/v1/mod-callbacks/sms-request-event-response/sms-request-event-response.ts +++ b/packages/verification/src/models/v1/mod-callbacks/sms-request-event-response/sms-request-event-response.ts @@ -1,4 +1,5 @@ -import { ActionEnum } from '../../enums'; +import { ActionEnum, CodeType } from '../../enums'; +import { WithAdditionalProperties } from '@sinch/sdk-client'; export interface SmsRequestEventResponse { /** Determines whether the verification can be executed. */ @@ -7,11 +8,15 @@ export interface SmsRequestEventResponse { sms?: SmsProperties; } -export interface SmsProperties { +export interface SmsProperties extends WithAdditionalProperties { /** The SMS OTP that should be used. By default, the Sinch dashboard will automatically generate OTP codes for SMS verification. If you want to set your own OTP, you can specify it in the response to the Verification Request Event. */ code?: string; /** List of strings */ acceptLanguage?: string[]; + /** Accepted values for the type of code to be generated are `Numeric`, `Alpha`, and `Alphanumeric`. Default is `Numeric`. */ + codeType?: CodeType; + /** The expiration time for a verification process is represented in the format `HH:MM:SS`. */ + expiry?: string; } /** @deprecated Use SmsRequestEventResponse instead */ diff --git a/packages/verification/src/models/v1/mod-callbacks/verification-request-event-response/verification-request-event-response.ts b/packages/verification/src/models/v1/mod-callbacks/verification-request-event-response/verification-request-event-response.ts index fe380dd7..6c68e314 100644 --- a/packages/verification/src/models/v1/mod-callbacks/verification-request-event-response/verification-request-event-response.ts +++ b/packages/verification/src/models/v1/mod-callbacks/verification-request-event-response/verification-request-event-response.ts @@ -1,7 +1,7 @@ import { SmsRequestEventResponse } from '../sms-request-event-response'; import { FlashCallRequestEventResponse } from '../flashcall-request-event-response'; -import { CalloutRequestEventResponse } from '../phonecall-request-event-response'; +import { PhoneCallRequestEventResponse } from '../phonecall-request-event-response'; export type VerificationRequestEventResponse = SmsRequestEventResponse | FlashCallRequestEventResponse - | CalloutRequestEventResponse; + | PhoneCallRequestEventResponse; diff --git a/packages/verification/src/models/v1/start-flashcall-verification-response/start-flashcall-verification-response.ts b/packages/verification/src/models/v1/start-flashcall-verification-response/start-flashcall-verification-response.ts index 33431089..666f8f07 100644 --- a/packages/verification/src/models/v1/start-flashcall-verification-response/start-flashcall-verification-response.ts +++ b/packages/verification/src/models/v1/start-flashcall-verification-response/start-flashcall-verification-response.ts @@ -1,4 +1,5 @@ import { LinksObject } from '../links-object'; +import { WithAdditionalProperties } from '@sinch/sdk-client'; export interface StartFlashCallVerificationResponse { @@ -12,14 +13,14 @@ export interface StartFlashCallVerificationResponse { _links?: LinksObject[]; } -interface FlashCallContent { +interface FlashCallContent extends WithAdditionalProperties { - /** Filter that should be applied for incoming calls to intercept the Flashcall. */ + /** Filter that should be applied for incoming calls to intercept the flash call. */ cliFilter: string; - /** Amount of seconds client should wait for the Flashcall. */ + /** Amount of seconds client should wait for the flash call. */ interceptionTimeout: number; /** The time in seconds allowed for reporting the code after which the verification will expire. */ reportTimeout?: number; - /** Used by the SDKs, this setting makes the handset deny the flashcall after the set time in seconds. */ + /** Used by the mobile SDKs, this setting makes the handset deny the flash call after the set time in seconds. */ denyCallAfter?: number; } diff --git a/packages/verification/src/models/v1/start-sms-verification-response/start-sms-verification-response.ts b/packages/verification/src/models/v1/start-sms-verification-response/start-sms-verification-response.ts index 9b4cb776..d264f8ab 100644 --- a/packages/verification/src/models/v1/start-sms-verification-response/start-sms-verification-response.ts +++ b/packages/verification/src/models/v1/start-sms-verification-response/start-sms-verification-response.ts @@ -1,4 +1,6 @@ import { LinksObject } from '../links-object'; +import { WithAdditionalProperties } from '@sinch/sdk-client'; +import { CodeType } from '../enums'; export interface StartSmsVerificationResponse { @@ -12,10 +14,12 @@ export interface StartSmsVerificationResponse { _links?: LinksObject[]; } -interface SmsContent { +interface SmsContent extends WithAdditionalProperties { /** The expected template for the SMS response. */ template?: string; /** The amount of time in seconds that the client should wait for the SMS. */ interceptionTimeout?: number; + /** Accepted values for the type of code to be generated are `Numeric`, `Alpha`, and `Alphanumeric`. Default is `Numeric`. */ + codeType?: CodeType; } diff --git a/packages/verification/src/models/v1/start-verification-request/index.ts b/packages/verification/src/models/v1/start-verification-request/index.ts index 90fb96f1..e03eb94f 100644 --- a/packages/verification/src/models/v1/start-verification-request/index.ts +++ b/packages/verification/src/models/v1/start-verification-request/index.ts @@ -8,7 +8,6 @@ export type { StartDataVerification, StartSeamlessVerification, SmsOptions, - CodeType, PhoneCallOptions, CalloutOptions, PhoneCallOptionsSpeech, diff --git a/packages/verification/src/models/v1/start-verification-request/start-verification-request.ts b/packages/verification/src/models/v1/start-verification-request/start-verification-request.ts index 1158705f..66e00318 100644 --- a/packages/verification/src/models/v1/start-verification-request/start-verification-request.ts +++ b/packages/verification/src/models/v1/start-verification-request/start-verification-request.ts @@ -1,4 +1,6 @@ import { Identity } from '../identity'; +import { WithAdditionalProperties } from '@sinch/sdk-client'; +import { CodeType } from '../enums'; export interface StartVerificationWithSms extends StartVerificationBase { /** @see SmsOptions */ @@ -43,7 +45,7 @@ export interface StartVerificationBase { /** * An optional object for SMS Verification, with default values assumed for all contained values if not provided. */ -export interface SmsOptions { +export interface SmsOptions extends WithAdditionalProperties { /** The expiration time for a verification process is represented in the format `HH:MM:SS`. */ expiry?: Date | string; /** Accepted values for the type of code to be generated are `Numeric`, `Alpha`, and `Alphanumeric`. Default is `Numeric`. */ @@ -54,14 +56,14 @@ export interface SmsOptions { locale?: string; } -export type CodeType = 'Numeric' | 'Alpha' | 'Alphanumeric'; - /** - * An optional object for Flash Call Verification, considered only when the verification request originates from your backend (not an SDK client) via an [Application signed request](https://developers.sinch.com/docs/voice/api-reference/authentication/signed-request). + * An optional configuration for Flash Call Verification, should be used only when the verification request originates from your backend (not an end user device) and request is signed via an [Application signed request](https://developers.sinch.com/docs/voice/api-reference/authentication/signed-request). */ -export interface FlashCallOptions { - /** The dial timeout in seconds. */ +export interface FlashCallOptions extends WithAdditionalProperties { + /** The amount of time that a phone will ring. */ dialTimeout?: number; + /** The maximum time that a phone call verification will be active and can be completed. If the phone number hasn't been verified successfully during this time, then the verification request will fail. By default, the Sinch dashboard will automatically optimize dial time out during a phone call. */ + interceptionTimeout?: number; } /** @deprecated Use PhoneCallOptions instead */ @@ -70,7 +72,7 @@ export type CalloutOptions = PhoneCallOptions; /** * An optional object for Phone Call Verification, with default values assumed for all contained values if not provided. */ -export interface PhoneCallOptions { +export interface PhoneCallOptions extends WithAdditionalProperties { /** @see PhoneCallOptionsSpeech */ speech?: PhoneCallOptionsSpeech; } diff --git a/packages/verification/src/models/v1/verification-report-request/verification-report-request.ts b/packages/verification/src/models/v1/verification-report-request/verification-report-request.ts index c6aee798..bdf74978 100644 --- a/packages/verification/src/models/v1/verification-report-request/verification-report-request.ts +++ b/packages/verification/src/models/v1/verification-report-request/verification-report-request.ts @@ -6,7 +6,7 @@ export interface SmsVerificationReportRequest { interface SmsContent { /** The code which was received by the user submitting the SMS verification. */ code: string; - /** The sender ID of the SMS. */ + /** @deprecated The sender ID of the SMS. */ cli?: string; } diff --git a/packages/verification/tests/models/v1/helper.test.ts b/packages/verification/tests/models/v1/helper.test.ts index 4ee244aa..b5c592ee 100644 --- a/packages/verification/tests/models/v1/helper.test.ts +++ b/packages/verification/tests/models/v1/helper.test.ts @@ -9,6 +9,9 @@ const VERIFICATION_ID = 'a_verification_id'; const VERIFICATION_CODE = '0000'; const VERIFICATION_CLI = '+46000000000'; const CALLOUT_LANGUAGE = 'en'; +const additionalProperties = { + hiddenOption: 'hiddenValue' , +}; const identity: Verification.StartVerificationBase = { identity: { @@ -32,6 +35,7 @@ const identityWithFlashCall: Verification.StartVerificationWithFlashCall = { }, flashCallOptions: { dialTimeout: DIAL_TIMEOUT, + ...additionalProperties, }, }; @@ -39,12 +43,14 @@ const smsOptions: Verification.SmsOptions = { expiry: '15:15:15', codeType: 'Numeric', template: 'Your verification code is {{CODE}}. Verified by Sinch', + ...additionalProperties, }; -const calloutOptions: Verification.CalloutOptions = { +const calloutOptions: Verification.PhoneCallOptions = { speech: { locale: CALLOUT_LANGUAGE, }, + ...additionalProperties, }; describe('Verification models helper', () => { @@ -80,28 +86,40 @@ describe('Verification models helper', () => { }); it('should build a startCallout request', () => { - const buildRequest = Verification.startVerificationHelper.buildCalloutRequest(PHONE_NUMBER); - const startRequest: Verification.StartCalloutVerificationRequestData = { - startVerificationWithCalloutRequestBody: identity, + const buildRequest = Verification.startVerificationHelper.buildPhoneCallRequest( + PHONE_NUMBER, undefined, undefined, additionalProperties); + const startRequest: Verification.StartPhoneCallVerificationRequestData = { + startVerificationWithPhoneCallRequestBody: { + ...identity, + phoneCallOptions: { + ...additionalProperties, + }, + }, }; expect(buildRequest).toEqual(startRequest); }); it('should build a startCallout request with a reference', () => { - const buildRequest = Verification.startVerificationHelper.buildCalloutRequest(PHONE_NUMBER, REFERENCE); - const startRequest: Verification.StartCalloutVerificationRequestData = { - startVerificationWithCalloutRequestBody: identityWithReference, + const buildRequest = Verification.startVerificationHelper.buildPhoneCallRequest( + PHONE_NUMBER, REFERENCE, undefined, additionalProperties); + const startRequest: Verification.StartPhoneCallVerificationRequestData = { + startVerificationWithPhoneCallRequestBody: { + ...identityWithReference, + phoneCallOptions: { + ...additionalProperties, + }, + }, }; expect(buildRequest).toEqual(startRequest); }); it('should build a startCallout request with some calloutOptions', () => { - const buildRequest = Verification.startVerificationHelper.buildCalloutRequest( - PHONE_NUMBER, undefined, CALLOUT_LANGUAGE); - const startRequest: Verification.StartCalloutVerificationRequestData = { - startVerificationWithCalloutRequestBody: { + const buildRequest = Verification.startVerificationHelper.buildPhoneCallRequest( + PHONE_NUMBER, undefined, CALLOUT_LANGUAGE, additionalProperties); + const startRequest: Verification.StartPhoneCallVerificationRequestData = { + startVerificationWithPhoneCallRequestBody: { ...identity, - calloutOptions: { + phoneCallOptions: { ...calloutOptions, }, }, @@ -109,41 +127,53 @@ describe('Verification models helper', () => { expect(buildRequest).toEqual(startRequest); }); - it('should build a startSeamless request', () => { - const buildRequest = Verification.startVerificationHelper.buildSeamlessRequest(PHONE_NUMBER); - const startRequest: Verification.StartSeamlessVerificationRequestData = { - startSeamlessVerificationRequestBody: identity, + it('should build a startData request', () => { + const buildRequest = Verification.startVerificationHelper.buildDataRequest(PHONE_NUMBER); + const startRequest: Verification.StartDataVerificationRequestData = { + startDataVerificationRequestBody: identity, }; expect(buildRequest).toEqual(startRequest); }); - it('should build a startSeamless request with a reference', () => { - const buildRequest = Verification.startVerificationHelper.buildSeamlessRequest(PHONE_NUMBER, REFERENCE); - const startRequest: Verification.StartSeamlessVerificationRequestData = { - startSeamlessVerificationRequestBody: identityWithReference, + it('should build a startData request with a reference', () => { + const buildRequest = Verification.startVerificationHelper.buildDataRequest(PHONE_NUMBER, REFERENCE); + const startRequest: Verification.StartDataVerificationRequestData = { + startDataVerificationRequestBody: identityWithReference, }; expect(buildRequest).toEqual(startRequest); }); it('should build a startFlashCall request', () => { - const buildRequest = Verification.startVerificationHelper.buildFlashCallRequest(PHONE_NUMBER); + const buildRequest = Verification.startVerificationHelper.buildFlashCallRequest( + PHONE_NUMBER, undefined, undefined, undefined, additionalProperties); const startRequest: Verification.StartFlashCallVerificationRequestData = { - startVerificationWithFlashCallRequestBody: identity, + startVerificationWithFlashCallRequestBody: { + ...identity, + flashCallOptions: { + ...additionalProperties, + }, + }, }; expect(buildRequest).toEqual(startRequest); }); it('should build a startFlashCall request with a reference', () => { - const buildRequest = Verification.startVerificationHelper.buildFlashCallRequest(PHONE_NUMBER, REFERENCE); + const buildRequest = Verification.startVerificationHelper.buildFlashCallRequest( + PHONE_NUMBER, REFERENCE, undefined, undefined, additionalProperties); const startRequest: Verification.StartFlashCallVerificationRequestData = { - startVerificationWithFlashCallRequestBody: identityWithReference, + startVerificationWithFlashCallRequestBody: { + ...identityWithReference, + flashCallOptions: { + ...additionalProperties, + }, + }, }; expect(buildRequest).toEqual(startRequest); }); it('should build a startFlashCall request with a flashCall option', () => { - const buildRequest - = Verification.startVerificationHelper.buildFlashCallRequest(PHONE_NUMBER, undefined, DIAL_TIMEOUT); + const buildRequest= Verification.startVerificationHelper.buildFlashCallRequest( + PHONE_NUMBER, undefined, DIAL_TIMEOUT, undefined, additionalProperties); const startRequest: Verification.StartFlashCallVerificationRequestData = { startVerificationWithFlashCallRequestBody: identityWithFlashCall, }; diff --git a/packages/verification/tests/rest/v1/verifications/start.steps.ts b/packages/verification/tests/rest/v1/verifications/start.steps.ts index f811b864..27273378 100644 --- a/packages/verification/tests/rest/v1/verifications/start.steps.ts +++ b/packages/verification/tests/rest/v1/verifications/start.steps.ts @@ -103,6 +103,7 @@ Then('the response contains the details of a verification started with a Flash C assert.equal(startFlashCallVerificationResponse.flashCall.interceptionTimeout, 45); assert.equal(startFlashCallVerificationResponse.flashCall.reportTimeout, 75); assert.equal(startFlashCallVerificationResponse.flashCall.denyCallAfter, 0); + assert.equal(startFlashCallVerificationResponse.flashCall.callId, '1ce0ffee-c0de-5eed-d22d-f00dfeed1337'); assert.ok(startFlashCallVerificationResponse._links); const statusLink = startFlashCallVerificationResponse._links[0]; assert.equal(statusLink.rel, 'status'); diff --git a/packages/verification/tests/rest/v1/verifications/verifications-api.test.ts b/packages/verification/tests/rest/v1/verifications/verifications-api.test.ts index 055c96fc..d816bd90 100644 --- a/packages/verification/tests/rest/v1/verifications/verifications-api.test.ts +++ b/packages/verification/tests/rest/v1/verifications/verifications-api.test.ts @@ -37,6 +37,7 @@ describe('VerificationsApi', () => { // Given const smsOptions: Verification.SmsOptions = { locale: 'sv-SE', + hiddenOption: 'hiddenValue', }; const requestData = Verification.startVerificationHelper.buildSmsRequest('+46700000000', undefined, smsOptions); const expectedResponse: Verification.StartSmsVerificationResponse = { @@ -45,6 +46,7 @@ describe('VerificationsApi', () => { sms: { template: 'Din verifieringskod är {{CODE}}.', interceptionTimeout: 298, + hiddenOption: 'hiddenValue', }, _links, }; @@ -61,7 +63,14 @@ describe('VerificationsApi', () => { it('should make a POST request to start a verification with a FlashCall', async () => { // Given - const requestData = Verification.startVerificationHelper.buildFlashCallRequest('+46700000000', undefined, 30); + const requestData = Verification.startVerificationHelper.buildFlashCallRequest( + '+46700000000', + undefined, + 30, + 60, + { + hiddenOption: 'hiddenValue', + }); const expectedResponse: Verification.StartFlashCallVerificationResponse = { id: 'some_verification_id', method: 'flashcall', @@ -70,6 +79,7 @@ describe('VerificationsApi', () => { interceptionTimeout: 60, reportTimeout: 120, denyCallAfter: 120, + hiddenOption: 'hiddenValue', }, _links, }; @@ -86,7 +96,13 @@ describe('VerificationsApi', () => { it('should make a POST request to start a verification with a PhoneCall', async () => { // Given - const requestData = Verification.startVerificationHelper.buildPhoneCallRequest('+46700000000'); + const requestData = Verification.startVerificationHelper.buildPhoneCallRequest( + '+46700000000', + undefined, + 'en_US', + { + hiddenOption: 'hiddenValue', + }); const expectedResponse: Verification.StartPhoneCallVerificationResponse = { id: 'some_verification_id', method: 'callout', @@ -107,7 +123,10 @@ describe('VerificationsApi', () => { const requestData = Verification.startVerificationHelper.buildPhoneCallRequest( '+46700000000', undefined, - 'en-US'); + 'en-US', + { + hiddenOption: 'hiddenValue', + }); const expectedResult: Verification.StartVerificationWithPhoneCallServerModel = { identity: { endpoint: '+46700000000', @@ -117,6 +136,7 @@ describe('VerificationsApi', () => { speech: { locale: 'en-US', }, + hiddenOption: 'hiddenValue', }, }; const formattedRequestData = verificationsApi.performStartPhoneCallRequestBodyTransformation(