Skip to content

Commit

Permalink
GumGum: passes bid response's currency unit (prebid#4757)
Browse files Browse the repository at this point in the history
* pass us privacy consent string to request

* passes bid response currency

* adds test for passing bid response currency
  • Loading branch information
susyt authored and hellsingblack committed Mar 5, 2020
1 parent ea5c922 commit d957637
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
5 changes: 3 additions & 2 deletions modules/gumgumBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ function interpretResponse (serverResponse, bidRequest) {
ad: {
price: cpm,
id: creativeId,
markup
markup,
cur
},
cw: wrapper,
pag: {
Expand Down Expand Up @@ -273,7 +274,7 @@ function interpretResponse (serverResponse, bidRequest) {
ad: wrapper ? getWrapperCode(wrapper, Object.assign({}, serverResponseBody, { bidRequest })) : markup,
cpm: isTestUnit ? 0.1 : cpm,
creativeId,
currency: 'USD',
currency: cur || 'USD',
height,
netRevenue: true,
requestId: bidRequest.id,
Expand Down
35 changes: 22 additions & 13 deletions test/spec/modules/gumgumBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,24 +230,33 @@ describe('gumgumAdapter', function () {
method: 'GET',
pi: 3
}
let expectedResponse = {
'ad': '<html><h3>I am an ad</h3></html>',
'cpm': 0,
'creativeId': 29593,
'currency': 'USD',
'height': '250',
'netRevenue': true,
'requestId': 12345,
'width': '300',
// dealId: DEAL_ID,
// referrer: REFERER,
ttl: 60
};

it('should get correct bid response', function () {
let expectedResponse = {
'ad': '<html><h3>I am an ad</h3></html>',
'cpm': 0,
'creativeId': 29593,
'currency': 'USD',
'height': '250',
'netRevenue': true,
'requestId': 12345,
'width': '300',
// dealId: DEAL_ID,
// referrer: REFERER,
ttl: 60
};
expect(spec.interpretResponse({ body: serverResponse }, bidRequest)).to.deep.equal([expectedResponse]);
});

it('should pass correct currency if found in bid response', function () {
const cur = 'EURO';
let response = Object.assign({}, serverResponse);
let expected = Object.assign({}, expectedResponse);
response.ad.cur = cur;
expected.currency = cur;
expect(spec.interpretResponse({ body: response }, bidRequest)).to.deep.equal([expected]);
});

it('handles nobid responses', function () {
let response = {
'ad': {},
Expand Down

0 comments on commit d957637

Please sign in to comment.