-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDK-2477 IDV Session retrieve and delete device metadata (#494)
* IDV: added getSessionTrackedDevices to retrieve the devices (includes responses) in service and exposed them in client * IDV: added deleteSessionTrackedDevices in both client and service
- Loading branch information
1 parent
66944e1
commit d6c62a0
Showing
15 changed files
with
936 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
src/idv_service/session/retrieve/devices/device.description.response.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
'use strict'; | ||
|
||
const Validation = require('../../../../yoti_common/validation'); | ||
|
||
class DeviceDescriptionResponse { | ||
constructor(payload) { | ||
Validation.isString(payload.ip_address, 'ip_address', true); | ||
/** @private */ | ||
this.ipAddress = payload.ip_address; | ||
|
||
Validation.isString(payload.ip_iso_country_code, 'ip_iso_country_code', true); | ||
/** @private */ | ||
this.ipISOCountryCode = payload.ip_iso_country_code; | ||
|
||
Validation.isString(payload.manufacture_name, 'manufacture_name', true); | ||
/** @private */ | ||
this.manufactureName = payload.manufacture_name; | ||
|
||
Validation.isString(payload.model_name, 'model_name', true); | ||
/** @private */ | ||
this.modelName = payload.model_name; | ||
|
||
Validation.isString(payload.os_name, 'os_name', true); | ||
/** @private */ | ||
this.osName = payload.os_name; | ||
|
||
Validation.isString(payload.os_version, 'os_version', true); | ||
/** @private */ | ||
this.osVersion = payload.os_version; | ||
|
||
Validation.isString(payload.browser_name, 'browser_name', true); | ||
/** @private */ | ||
this.browserName = payload.browser_name; | ||
|
||
Validation.isString(payload.browser_version, 'browser_version', true); | ||
/** @private */ | ||
this.browserVersion = payload.browser_version; | ||
|
||
Validation.isString(payload.locale, 'locale', true); | ||
/** @private */ | ||
this.locale = payload.locale; | ||
|
||
Validation.isString(payload.client_version, 'client_version'); | ||
/** @private */ | ||
this.clientVersion = payload.client_version; | ||
} | ||
|
||
/** | ||
* Returns the device ip address. | ||
* | ||
* @returns {string | undefined} | ||
*/ | ||
getIpAddress() { | ||
return this.ipAddress; | ||
} | ||
|
||
/** | ||
* Returns the device ip ISO country code. | ||
* | ||
* @returns {string | undefined} | ||
*/ | ||
getIpISOCountryCode() { | ||
return this.ipISOCountryCode; | ||
} | ||
|
||
/** | ||
* Returns the device manufacture name. | ||
* | ||
* @returns {string | undefined} | ||
*/ | ||
getManufactureName() { | ||
return this.manufactureName; | ||
} | ||
|
||
/** | ||
* Returns the device model name. | ||
* | ||
* @returns {string | undefined} | ||
*/ | ||
getModelName() { | ||
return this.modelName; | ||
} | ||
|
||
/** | ||
* Returns the device OS name. | ||
* | ||
* @returns {string | undefined} | ||
*/ | ||
getOSName() { | ||
return this.osName; | ||
} | ||
|
||
/** | ||
* Returns the device OS version. | ||
* | ||
* @returns {string | undefined} | ||
*/ | ||
getOSVersion() { | ||
return this.osVersion; | ||
} | ||
|
||
/** | ||
* Returns the device browser name. | ||
* | ||
* @returns {string | undefined} | ||
*/ | ||
getBrowserName() { | ||
return this.browserName; | ||
} | ||
|
||
/** | ||
* Returns the device browser version. | ||
* | ||
* @returns {string | undefined} | ||
*/ | ||
getBrowserVersion() { | ||
return this.browserVersion; | ||
} | ||
|
||
/** | ||
* Returns the device locale. | ||
* | ||
* @returns {string | undefined} | ||
*/ | ||
getLocale() { | ||
return this.locale; | ||
} | ||
|
||
/** | ||
* Returns the client version. | ||
* | ||
* @returns {string} | ||
*/ | ||
getClientVersion() { | ||
return this.clientVersion; | ||
} | ||
} | ||
|
||
module.exports = DeviceDescriptionResponse; |
26 changes: 26 additions & 0 deletions
26
src/idv_service/session/retrieve/devices/session.tracked.devices.response.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
|
||
const Validation = require('../../../../yoti_common/validation'); | ||
const TrackedDeviceEventResponse = require('./tracked.device.event.response'); | ||
|
||
class TrackedDevicesResponse { | ||
/** | ||
* @param {{}[]} response | ||
*/ | ||
constructor(response) { | ||
Validation.isArray(response, 'tracked devices'); | ||
/** @private */ | ||
this.deviceEvents = response.map((item) => new TrackedDeviceEventResponse(item)); | ||
} | ||
|
||
/** | ||
* Returns the list of tracked device events. | ||
* | ||
* @returns {TrackedDeviceEventResponse[]} | ||
*/ | ||
getDeviceEvents() { | ||
return this.deviceEvents; | ||
} | ||
} | ||
|
||
module.exports = TrackedDevicesResponse; |
49 changes: 49 additions & 0 deletions
49
src/idv_service/session/retrieve/devices/tracked.device.event.response.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
'use strict'; | ||
|
||
const Validation = require('../../../../yoti_common/validation'); | ||
const DeviceDescriptionResponse = require('./device.description.response'); | ||
|
||
class TrackedDeviceEventResponse { | ||
constructor(payload) { | ||
Validation.isString(payload.event, 'event'); | ||
/** @private */ | ||
this.event = payload.event; | ||
|
||
Validation.isStringDate(payload.created, 'created'); | ||
/** @private */ | ||
this.created = new Date(payload.created); | ||
|
||
Validation.isPlainObject(payload.device, 'device'); | ||
/** @private */ | ||
this.device = new DeviceDescriptionResponse(payload.device); | ||
} | ||
|
||
/** | ||
* Returns the event. | ||
* | ||
* @returns {string} | ||
*/ | ||
getEvent() { | ||
return this.event; | ||
} | ||
|
||
/** | ||
* Returns the created date. | ||
* | ||
* @returns {Date} | ||
*/ | ||
getCreated() { | ||
return this.created; | ||
} | ||
|
||
/** | ||
* Returns the device description. | ||
* | ||
* @returns {DeviceDescriptionResponse} | ||
*/ | ||
getDevice() { | ||
return this.device; | ||
} | ||
} | ||
|
||
module.exports = TrackedDeviceEventResponse; |
Oops, something went wrong.