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

Bid floor #1085

Merged
merged 11 commits into from
Nov 13, 2019
4 changes: 2 additions & 2 deletions adapters/tappx/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package tappx

import (
"encoding/json"
"testing"

"github.com/prebid/prebid-server/openrtb_ext"
"testing"
)

func TestValidParams(t *testing.T) {
Expand Down Expand Up @@ -35,6 +34,7 @@ func TestInvalidParams(t *testing.T) {

var validParams = []string{
`{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com/"}`,
`{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com/", "bidfloor":0.5}`,
}

var invalidParams = []string{
Expand Down
9 changes: 7 additions & 2 deletions adapters/tappx/tappx.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"time"
)

const TAPPX_BIDDER_VERSION = "1.0"
const TAPPX_BIDDER_VERSION = "1.1"

type TappxAdapter struct {
http *adapters.HTTPAdapter
Expand All @@ -39,6 +39,7 @@ type tappxParams struct {
Host string `json:"host"`
TappxKey string `json:"tappxkey"`
Endpoint string `json:"endpoint"`
BidFloor string `json:"bidfloor"`
}
ah-tappx marked this conversation as resolved.
Show resolved Hide resolved

func (a *TappxAdapter) Name() string {
Expand Down Expand Up @@ -78,6 +79,10 @@ func (a *TappxAdapter) MakeRequests(request *openrtb.BidRequest, reqInfo *adapte
return nil, []error{err}
}

if tappxExt.BidFloor > 0 {
request.Imp[0].BidFloor = tappxExt.BidFloor
}

ah-tappx marked this conversation as resolved.
Show resolved Hide resolved
reqJSON, err := json.Marshal(request)
if err != nil {
return nil, []error{&errortypes.BadInput{
Expand Down Expand Up @@ -143,7 +148,7 @@ func (a *TappxAdapter) buildEndpointURL(params *openrtb_ext.ExtImpTappx, test in
thisURI = thisURI + "&ts=" + strconv.Itoa(int(t))
ah-tappx marked this conversation as resolved.
Show resolved Hide resolved
}

thisURI = thisURI + "&v=" + TAPPX_BIDDER_VERSION
thisURI = thisURI + "&v=" + TAPPX_BIDDER_VERSION + "&type_cnn=prebid"

ah-tappx marked this conversation as resolved.
Show resolved Hide resolved
return thisURI, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&v=1.0",
"uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&v=1.1&type_cnn=prebid",
"body": {
"id": "0000000000001",
"test": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&v=1.0",
"uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&v=1.1&type_cnn=prebid",
"body": {
"id": "0000000000001",
"test": 1,
Expand Down
2 changes: 1 addition & 1 deletion adapters/tappx/tappxtest/supplemental/204status.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&v=1.0",
"uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&v=1.1&type_cnn=prebid",
"body": {
"id": "0000000000001",
"test": 1,
Expand Down
2 changes: 1 addition & 1 deletion adapters/tappx/tappxtest/supplemental/http-err-status.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&v=1.0",
"uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&v=1.1&type_cnn=prebid",
"body": {
"id": "0000000000001",
"test": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&v=1.0",
"uri": "https://test.tappx.com/PREBIDTEMPLATE?tappxkey=pub-12345-android-9876&v=1.1&type_cnn=prebid",
"body": {
"id": "0000000000001",
"test": 1,
Expand Down
7 changes: 4 additions & 3 deletions openrtb_ext/imp_tappx.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package openrtb_ext

type ExtImpTappx struct {
Host string `json:"host"`
TappxKey string `json:"tappxkey"`
Endpoint string `json:"endpoint"`
Host string `json:"host"`
TappxKey string `json:"tappxkey"`
Endpoint string `json:"endpoint"`
BidFloor float64 `json:"bidfloor"`
}
4 changes: 4 additions & 0 deletions static/bidder-params/tappx.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"endpoint": {
"type": "string",
"description": "Endpoint provided to publisher"
},
"bidfloor": {
"type": "number",
"description": "Minimum bid for this impression expressed in CPM (USD)"
}
},
"required": ["host","tappxkey","endpoint"]
Expand Down