Skip to content

Commit

Permalink
Grid bid adapter: call data deletion request c2s endpoint (#10732)
Browse files Browse the repository at this point in the history
Co-authored-by: v.raybaud <v.raybaud@criteo.com>
  • Loading branch information
vraybaud and v.raybaud authored Nov 28, 2023
1 parent d21fb7d commit 6a0c7f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 41 deletions.
13 changes: 2 additions & 11 deletions modules/gridBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { getStorageManager } from '../src/storageManager.js';

const BIDDER_CODE = 'grid';
const ENDPOINT_URL = 'https://grid.bidswitch.net/hbjson';
const USP_DELETE_DATA_HANDLER = 'https://media.grid.bidswitch.net/uspapi_delete'
const USP_DELETE_DATA_HANDLER = 'https://media.grid.bidswitch.net/uspapi_delete_c2s'

const SYNC_URL = 'https://x.bidswitch.net/sync?ssp=themediagrid';
const TIME_TO_LIVE = 360;
Expand Down Expand Up @@ -464,16 +464,7 @@ export const spec = {
},

onDataDeletionRequest: function(data) {
const uids = [];
const aliases = [spec.code, ...spec.aliases.map((alias) => alias.code || alias)];
data.forEach(({ bids }) => bids && bids.forEach(({ bidder, params }) => {
if (aliases.includes(bidder) && params && params.uid) {
uids.push(params.uid);
}
}));
if (uids.length) {
spec.ajaxCall(USP_DELETE_DATA_HANDLER, () => {}, JSON.stringify({ uids }), {contentType: 'application/json', method: 'POST'});
}
spec.ajaxCall(USP_DELETE_DATA_HANDLER, null, null, {method: 'GET'});
}
};

Expand Down
32 changes: 2 additions & 30 deletions test/spec/modules/gridBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1559,37 +1559,9 @@ describe('TheMediaGrid Adapter', function () {
});

it('should send right request on onDataDeletionRequest call', function() {
spec.onDataDeletionRequest([{
bids: [
{
bidder: 'grid',
params: {
uid: 1
}
},
{
bidder: 'grid',
params: {
uid: 2
}
},
{
bidder: 'another',
params: {
uid: 3
}
},
{
bidder: 'gridNM',
params: {
uid: 4
}
}
],
}]);
spec.onDataDeletionRequest([{}]);
expect(ajaxStub.calledOnce).to.equal(true);
expect(ajaxStub.firstCall.args[0]).to.equal('https://media.grid.bidswitch.net/uspapi_delete');
expect(ajaxStub.firstCall.args[2]).to.equal('{"uids":[1,2,4]}');
expect(ajaxStub.firstCall.args[0]).to.equal('https://media.grid.bidswitch.net/uspapi_delete_c2s');
});
});

Expand Down

0 comments on commit 6a0c7f0

Please sign in to comment.