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

symitriDapRtdProvider - Enable X2 Tokenize endpoint #12636

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
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);
patmmccann marked this conversation as resolved.
Show resolved Hide resolved
});

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
Loading