Skip to content

Commit

Permalink
Add usePaymentRule param to AN bidders (#1778)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Kendall authored and jaiminpanchal27 committed Oct 30, 2017
1 parent 8420558 commit 4701948
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/appnexusAstBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ function bidToTag(bid) {
tag.code = bid.params.invCode;
}
tag.allow_smaller_sizes = bid.params.allowSmallerSizes || false;
tag.use_pmt_rule = bid.params.usePaymentRule || false
tag.prebid = true;
tag.disable_psa = true;
if (bid.params.reserve) {
Expand Down
4 changes: 4 additions & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,15 @@ AppNexusAdapter = function AppNexusAdapter() {
var query = utils.getBidIdParameter('query', bid.params);
var referrer = utils.getBidIdParameter('referrer', bid.params);
var altReferrer = utils.getBidIdParameter('alt_referrer', bid.params);
let usePaymentRule = utils.getBidIdParameter('usePaymentRule', bid.params);
var jptCall = '//ib.adnxs.com/jpt?';

jptCall = utils.tryAppendQueryString(jptCall, 'callback', '$$PREBID_GLOBAL$$.handleAnCB');
jptCall = utils.tryAppendQueryString(jptCall, 'callback_uid', callbackId);
jptCall = utils.tryAppendQueryString(jptCall, 'psa', '0');
jptCall = utils.tryAppendQueryString(jptCall, 'id', placementId);
jptCall = utils.tryAppendQueryString(jptCall, 'use_pmt_rule', usePaymentRule);

if (member) {
jptCall = utils.tryAppendQueryString(jptCall, 'member', member);
} else if (memberId) {
Expand Down Expand Up @@ -106,6 +109,7 @@ AppNexusAdapter = function AppNexusAdapter() {
delete paramsCopy.referrer;
delete paramsCopy.alt_referrer;
delete paramsCopy.member;
delete paramsCopy.usePaymentRule;

// get the reminder
var queryParams = utils.parseQueryStringParameters(paramsCopy);
Expand Down
17 changes: 17 additions & 0 deletions test/spec/modules/appnexusAstBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,23 @@ describe('AppNexusAdapter', () => {
'value': ['123']
}]);
});

it('should should add payment rules to the request', () => {
let bidRequest = Object.assign({},
bidRequests[0],
{
params: {
placementId: '10433394',
usePaymentRule: true
}
}
);

const request = spec.buildRequests([bidRequest]);
const payload = JSON.parse(request.data);

expect(payload.tags[0].use_pmt_rule).to.equal(true);
});
})

describe('interpretResponse', () => {
Expand Down

0 comments on commit 4701948

Please sign in to comment.