Skip to content

Commit

Permalink
Adding deal id to bid response (#1252)
Browse files Browse the repository at this point in the history
* Adding deal id to bid response

* Added unit test for deal id
  • Loading branch information
jaiminpanchal27 authored and Nate Cozi committed May 31, 2017
1 parent 9b66380 commit de09a97
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/adapters/prebidServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ function PrebidServer() {
bidObject.ad = bidObj.adm;
bidObject.width = bidObj.width;
bidObject.height = bidObj.height;
if (bidObj.deal_id) {
bidObject.dealId = bidObj.deal_id;
}

bidmanager.addBidResponse(bidObj.code, bidObject);
});
Expand Down
13 changes: 12 additions & 1 deletion test/spec/adapters/prebidServer_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ const RESPONSE = {
'price': 0.5,
'adm': '<script type="application/javascript" src="http://nym1-ib.adnxs.com/ab?e=wqT_3QL_Baj_AgAAAwDWAAUBCO-s38cFEJG-p6iRgOfvdhivtLWVpomhsWUgASotCQAAAQII4D8RAQc0AADgPxkAAACA61HgPyEREgApEQmgMPLm_AQ4vgdAvgdIAlDWy5MOWOGASGAAaJFAeP3PBIABAYoBA1VTRJIFBvBSmAGsAqAB-gGoAQGwAQC4AQLAAQPIAQLQAQnYAQDgAQHwAQCKAjp1ZignYScsIDQ5NDQ3MiwgMTQ5MjYzNzI5NSk7dWYoJ3InLCAyOTY4MTExMCwyHgDwnJIC7QEhcHpUNkZ3aTYwSWNFRU5iTGt3NFlBQ0RoZ0Vnd0FEZ0FRQVJJdmdkUTh1YjhCRmdBWVBfX19fOFBhQUJ3QVhnQmdBRUJpQUVCa0FFQm1BRUJvQUVCcUFFRHNBRUF1UUVwaTRpREFBRGdQOEVCS1l1SWd3QUE0RF9KQWQ0V2JVTnJmUEVfMlFFQUFBQUFBQUR3UC1BQkFQVUIFD0BKZ0Npb2FvcEFtZ0FnQzFBZwEWBEM5CQjoREFBZ0hJQWdIUUFnSFlBZ0hnQWdEb0FnRDRBZ0NBQXdHUUF3Q1lBd0dvQTdyUWh3US6aAjEhRXduSHU68AAcNFlCSUlBUW8JbARreAFmDQHwui7YAugH4ALH0wHqAg93d3cubnl0aW1lcy5jb23yAhEKBkNQR19JRBIHMTk3NzkzM_ICEAoFQ1BfSUQSBzg1MTM1OTSAAwGIAwGQAwCYAxSgAwGqAwDAA6wCyAMA2APjBuADAOgDAPgDA4AEAJIECS9vcGVucnRiMpgEAKIECzEwLjI0NC4wLjIyqAQAsgQKCAAQABgAIAAwALgEAMAEAMgEANIEDDEwLjMuMTM4LjE0ONoEAggB4AQA8ARBXyCIBQGYBQCgBf8RAZwBqgUkNDM3ZmJiZjUtMzNmNS00ODdhLThlMTYtYTcxMTI5MDNjZmU1&s=b52bf8a6265a78a5969444bc846cc6d0f9f3b489&test=1&referrer=www.nytimes.com&pp=${AUCTION_PRICE}&"></script>',
'width': 300,
'height': 250
'height': 250,
'deal_id': 'test-dealid'
}
]
};
Expand Down Expand Up @@ -218,5 +219,15 @@ describe('S2S Adapter', () => {
const response = bidmanager.addBidResponse.firstCall.args[1];
expect(response).to.have.property('statusMessage', 'Bid returned empty or error response');
});

it('should have dealId in bidObject', () => {
server.respondWith(JSON.stringify(RESPONSE));

adapter.setConfig(CONFIG);
adapter.callBids(REQUEST);
server.respond();
const response = bidmanager.addBidResponse.firstCall.args[1];
expect(response).to.have.property('dealId', 'test-dealid');
});
});
});

0 comments on commit de09a97

Please sign in to comment.