Skip to content

Commit

Permalink
symitriDapRtdProvider - Enable X2 Tokenize endpoint (#12636)
Browse files Browse the repository at this point in the history
* symitriDapRtdProvider - Enable X2 Tokenize endpoint

* Adding test case for X2 Tokenize

---------

Co-authored-by: Jeff Palladino <[email protected]>
  • Loading branch information
jpalladino84 and Jeff Palladino authored Jan 15, 2025
1 parent f499398 commit f1019c1
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 6 deletions.
8 changes: 4 additions & 4 deletions modules/symitriDapRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ export function createRtdProvider(moduleName, moduleCode, headerPrefix) {
switch (config.api_version) {
case 'x1':
case 'x1-dev':
case 'x2':
method = 'POST';
path = '/data-activation/' + config.api_version + '/domain/' + config.domain + '/identity/tokenize';
body = JSON.stringify(apiParams);
Expand All @@ -685,6 +686,7 @@ export function createRtdProvider(moduleName, moduleCode, headerPrefix) {
switch (config.api_version) {
case 'x1':
case 'x1-dev':
case 'x2':
token = request.getResponseHeader(headerPrefix + '-DAP-Token');
break;
}
Expand Down Expand Up @@ -744,8 +746,7 @@ export function createRtdProvider(moduleName, moduleCode, headerPrefix) {
return;
}

let path = '/data-activation/' +
config.api_version +
let path = '/data-activation/x1' +
'/token/' + token +
'/membership';

Expand Down Expand Up @@ -812,8 +813,7 @@ export function createRtdProvider(moduleName, moduleCode, headerPrefix) {
error: (error, request) => { onError(request, request.status, error, onDone); }
};

let path = '/data-activation/' +
config.api_version +
let path = '/data-activation/x1' +
'/token/' + token +
'/membership/encrypt';

Expand Down
4 changes: 2 additions & 2 deletions modules/symitriDapRtdProvider.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pbjs.setConfig({
waitForIt: true,
params: {
apiHostname: '<see your Symitri account rep>',
apiVersion: "x1",
apiVersion: 'x1'|'x2',
apiAuthToken: '<see your Symitri account rep>',
domain: 'your-domain.com',
identityType: 'simpleid'|'compositeid'|'hashedid'|'dap-signature:1.0.0',
Expand All @@ -68,7 +68,7 @@ Please reach out to your Symitri account representative(<[email protected]>) to
| name | String | Symitri Dap Rtd module name | 'symitriDap' always|
| waitForIt | Boolean | Required to ensure that the auction is delayed until prefetch is complete | Optional. Defaults to false |
| apiHostname | String | Hostname provided by Symitri | Please reach out to your Symitri account representative(<[email protected]>) for this value|
| apiVersion | String | This holds the API version | It should be "x1" always |
| apiVersion | String | This holds the API version | Please reach out to your Symitri account representative(<[email protected]>) for this value |
| apiAuthToken | String | Symitri API AuthToken | Please reach out to your Symitri account representative(<[email protected]>) for this value |
| domain | String | The domain name of your webpage | |
| identityType | String | 'simpleid' or 'compositeid' or 'hashedid' or 'dap-signature:1.0.0' | Use 'simpleid' to pass email or other plain text ids and SymitriRTD Module will hash it.
Expand Down
36 changes: 36 additions & 0 deletions test/spec/modules/symitriDapRtdProvider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ describe('symitriDapRtdProvider', function() {
'identity': sampleIdentity
}

const sampleX2Config = {
'api_hostname': 'prebid.dap.akadns.net',
'api_version': 'x2',
'domain': 'prebid.org',
'segtax': 708,
'identity': sampleIdentity
}

const esampleConfig = {
'api_hostname': 'prebid.dap.akadns.net',
'api_version': 'x1',
Expand Down Expand Up @@ -260,6 +268,34 @@ describe('symitriDapRtdProvider', function() {
});
});

describe('dapX2Tokenize', function () {
it('dapX2Tokenize error callback', function () {
let configAsync = JSON.parse(JSON.stringify(sampleX2Config));
let submoduleCallback = dapUtils.dapTokenize(configAsync, sampleIdentity, onDone,
function(token, status, xhr, onDone) {
},
function(xhr, status, error, onDone) {
}
);
let request = server.requests[0];
request.respond(400, responseHeader, JSON.stringify('error'));
expect(submoduleCallback).to.equal(undefined);
});

it('dapX2Tokenize success callback', function () {
let configAsync = JSON.parse(JSON.stringify(sampleX2Config));
let submoduleCallback = dapUtils.dapTokenize(configAsync, sampleIdentity, onDone,
function(token, status, xhr, onDone) {
},
function(xhr, status, error, onDone) {
}
);
let request = server.requests[0];
request.respond(200, responseHeader, JSON.stringify('success'));
expect(submoduleCallback).to.equal(undefined);
});
});

describe('dapTokenize and dapMembership incorrect params', function () {
it('Onerror and config are null', function () {
expect(dapUtils.dapTokenize(null, 'identity', onDone, null, null)).to.be.equal(undefined);
Expand Down

0 comments on commit f1019c1

Please sign in to comment.