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

Tappx: new bidder params #1931

Merged
merged 39 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9dbf8a2
Tappx - new optional parameters
agrandes-tappx Jul 16, 2021
4897151
Tappx - new properties in the json
agrandes-tappx Jul 16, 2021
ecea259
New invalid params test
agrandes-tappx Jul 16, 2021
b5022b2
Change status version
agrandes-tappx Jul 16, 2021
976d51a
Tappx - make gofmt
agrandes-tappx Jul 16, 2021
8de8cb9
Tappx - Hotfix in test
agrandes-tappx Jul 16, 2021
52db924
Tappx - make gofmt
agrandes-tappx Jul 16, 2021
769bfc5
Suplemental v.1.3
agrandes-tappx Jul 16, 2021
d62d1b4
Tappx - Remove PrintLn
agrandes-tappx Jul 16, 2021
89eeb8b
Tappx - Add test changes + new test
agrandes-tappx Jul 16, 2021
3a1b181
Tappx - Repairing some test error
agrandes-tappx Jul 16, 2021
36690a3
Tappx - more test repaired - suplemental
agrandes-tappx Jul 16, 2021
cc4e7ff
Tappx - test easy hotfix
agrandes-tappx Jul 16, 2021
09a7622
Tappx - rewarded is tested in the other json
agrandes-tappx Jul 16, 2021
fc098a6
Tappx - Moved ext to correct site
agrandes-tappx Jul 16, 2021
f8d0ccf
Tappx - hotfix
agrandes-tappx Jul 16, 2021
e85a5ca
New try to test problem
agrandes-tappx Jul 16, 2021
d28663d
Tappx - try again
agrandes-tappx Jul 16, 2021
cb143be
Tappx - Try if this is the origin of problem
agrandes-tappx Jul 16, 2021
9cbdcd0
Tappx - clean and test
agrandes-tappx Jul 16, 2021
a2ddc1f
Tappx - deleting rewarded bidder param (useless)
agrandes-tappx Jul 19, 2021
a18bf78
Tappx - make gofmt
agrandes-tappx Jul 19, 2021
4cf8eb0
Tappx - Add valid params for test : )
agrandes-tappx Jul 19, 2021
1208cdf
Tappx - cleaning mistake, useless code
agrandes-tappx Jul 19, 2021
3148486
Tappx - test hotfix plus more lines of test : )
agrandes-tappx Jul 19, 2021
ddd2d10
Tappx - hotfix
agrandes-tappx Jul 19, 2021
89cfb84
Tappx - somplify Bidder parameters to ext
agrandes-tappx Jul 19, 2021
06a898d
Tappx - Error control
agrandes-tappx Jul 19, 2021
3c1a308
Tappx - move structs outside function
agrandes-tappx Jul 22, 2021
b1a6fc6
Tappx - Add items string & remove useless prop
agrandes-tappx Jul 22, 2021
2b45efd
Tappx - Solve duplicate and improve params_test
agrandes-tappx Jul 22, 2021
09ad06d
Tappx - Add params to test
agrandes-tappx Jul 22, 2021
e88cf1c
Prebid - proposed change
agrandes-tappx Jul 23, 2021
9e3aff2
Tappx - Add more invalid case test
agrandes-tappx Jul 29, 2021
9636101
Tappx - More specific error test
agrandes-tappx Jul 29, 2021
c140289
Tappx - Prebid recomendation implemented
agrandes-tappx Jul 29, 2021
d79a916
Tappx - make gofmt
agrandes-tappx Jul 29, 2021
56c585f
Tappx - hotfix
agrandes-tappx Jul 29, 2021
8d09494
Tappx - Improves in invalidParams
agrandes-tappx Jul 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions adapters/tappx/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ 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}`,
`{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5, "mktag":"txmk-xxxxx-xxx-xxxx"}`,
`{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5, "bcid":["123"]}`,
`{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5, "bcrid":["245"]}`,
`{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5, "bcrid":["245", "321"]}`,
`{"tappxkey":"pub-12345-android-9876", "endpoint":"ZZ1INTERNALTEST149147915", "host":"test.tappx.com", "bidfloor":0.5, "bcid":["123", "654"], "bcrid":["245", "321"]}`,
}

var invalidParams = []string{
Expand All @@ -60,4 +65,14 @@ var invalidParams = []string{
`{"tappxkey": 1, "endpoint":"ZZ1INTERNALTEST149147915", "host":""}`,
`{"tappxkey":"pub-12345-android-9876", "endpoint": 1, "host":""}`,
`{"tappxkey": 1, "endpoint": 1, "host": 123}`,
`{"tappxkey": "1", "endpoint": 1}`,
`{"tappxkey": "1", "endpoint": "ZZ1INTERNALTEST149147915", "host":[]]}`,
`{"tappxkey": "1", "endpoint": 1, "host":"host"}`,
`{"tappxkey": "1", "endpoint": "1", "host":"host", "mktag":1}`,
`{"tappxkey": "1", "endpoint": "1", "host":"host", "mktag":[1,2]}`,
`{"tappxkey": "1", "endpoint": "1", "host":"host", "bcid":""}`,
`{"tappxkey": "1", "endpoint": "1", "host":"host", "bcid":"123", bcrid: ["123"]}`,
`{"tappxkey": "1", "endpoint": "1", "host":"host", "bcid":["123"], bcrid: 123}`,
prebidtappx marked this conversation as resolved.
Show resolved Hide resolved
`{"tappxkey": "1", "endpoint": "1", "host":"host", "bcid":["123"], bcrid: [123]}`,
`{"tappxkey": "1", "endpoint": "1", "host":"host", "bcid":[123], bcrid: ["123"]}`,
}
prebidtappx marked this conversation as resolved.
Show resolved Hide resolved
31 changes: 29 additions & 2 deletions adapters/tappx/tappx.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,24 @@ import (
"github.com/prebid/prebid-server/openrtb_ext"
)

const TAPPX_BIDDER_VERSION = "1.2"
const TAPPX_BIDDER_VERSION = "1.3"
const TYPE_CNN = "prebid"

type TappxAdapter struct {
endpointTemplate template.Template
}

type Bidder struct {
Tappxkey string `json:"tappxkey"`
Mktag string `json:"mktag,omitempty"`
Bcid []string `json:"bcid,omitempty"`
Bcrid []string `json:"bcrid,omitempty"`
}

type Ext struct {
Bidder `json:"bidder"`
}

// Builder builds a new instance of the Tappx adapter for the given bidder with the given config.
func Builder(bidderName openrtb_ext.BidderName, config config.Adapter) (adapters.Bidder, error) {
template, err := template.New("endpointTemplate").Parse(config.Endpoint)
Expand All @@ -51,14 +62,30 @@ func (a *TappxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapt
Message: "Error parsing bidderExt object",
}}
}

var tappxExt openrtb_ext.ExtImpTappx
if err := json.Unmarshal(bidderExt.Bidder, &tappxExt); err != nil {
return nil, []error{&errortypes.BadInput{
Message: "Error parsing tappxExt parameters",
}}
}

ext := Ext{
Bidder: Bidder{
Tappxkey: tappxExt.TappxKey,
SyntaxNode marked this conversation as resolved.
Show resolved Hide resolved
Mktag: tappxExt.Mktag,
Bcid: tappxExt.Bcid,
Bcrid: tappxExt.Bcrid,
},
}

if jsonext, err := json.Marshal(ext); err == nil {
request.Ext = jsonext
} else {
return nil, []error{&errortypes.FailedToRequestBids{
Message: "Error marshaling tappxExt parameters",
}}
prebidtappx marked this conversation as resolved.
Show resolved Hide resolved
}
prebidtappx marked this conversation as resolved.
Show resolved Hide resolved

var test int
test = int(request.Test)

Expand Down
2 changes: 1 addition & 1 deletion adapters/tappx/tappx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func TestTsValue(t *testing.T) {

url, err := bidderTappx.buildEndpointURL(&tappxExt, test)

match, err := regexp.MatchString(`http://example\.host\.tappx\.com/DUMMYENDPOINT\?tappxkey=dummy-tappx-key&ts=[0-9]{13}&type_cnn=prebid&v=1\.2`, url)
match, err := regexp.MatchString(`http://example\.host\.tappx\.com/DUMMYENDPOINT\?tappxkey=dummy-tappx-key&ts=[0-9]{13}&type_cnn=prebid&v=1\.3`, url)
if err != nil {
t.Errorf("Error while running regex validation: %s", err.Error())
return
Expand Down
130 changes: 130 additions & 0 deletions adapters/tappx/tappxtest/exemplary/single-banner-impression-extra.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"mockBidRequest": {
"id": "0000000000001",
"test": 1,
"imp": [
{
"id": "adunit-1",
"banner": {
"w": 300,
"h": 250
},
"ext": {
"bidder": {
"tappxkey": "pub-12345-android-9876",
"endpoint": "ZZ123456PS",
"host": "testing.ssp.tappx.com/rtb/v2/",
"mktag": "mktag-12345-android-9876",
"bcid": ["1","2","3"],
"bcrid": ["4","5","6"]
}
}
}
],
"app": {
"id": "app_001",
"bundle": "com.rovio.angrybirds",
"publisher": {
"id": "2"
}
},
"user": {
"buyeruid": "A-38327932832"
}
},

"httpCalls": [
{
"expectedRequest": {
"uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3",
"body": {
"id": "0000000000001",
"test": 1,
"imp": [
{
"id": "adunit-1",
"banner": {
"w": 300,
"h": 250
},
"ext": {
"bidder": {
"tappxkey": "pub-12345-android-9876",
"endpoint": "ZZ123456PS",
"host": "testing.ssp.tappx.com/rtb/v2/",
"mktag": "mktag-12345-android-9876",
"bcid": ["1","2","3"],
"bcrid": ["4","5","6"]
}
}
}
],
"app": {
"bundle": "com.rovio.angrybirds",
"id": "app_001",
"publisher": {
"id": "2"
}
},
"user": {
"buyeruid": "A-38327932832"
},
"ext": {
"bidder": {
"tappxkey": "pub-12345-android-9876",
"mktag": "mktag-12345-android-9876",
"bcid": ["1","2","3"],
"bcrid": ["4","5","6"]
}
}
}
},
"mockResponse": {
"status": 200,
"body": {
"id": "75472df2-1cb3-4f8e-9a28-10cb95fe05a4",
"seatbid": [{
"bid": [{
"id": "wehM-93KGr0_0_0",
"impid": "adunit-1",
"price": 0.5,
"cid": "3706",
"crid": "19005",
"adid": "19005",
"adm": "<!-- admarkup -->",
"cat": ["IAB2"],
"adomain": ["test.com"],
"h": 250,
"w": 300
}]
}],
"bidid": "wehM-93KGr0"
}
}
}
],

"expectedBidResponses": [
{
"currency": "USD",
"bids": [
{
"bid": {
"id": "wehM-93KGr0_0_0",
"impid": "adunit-1",
"price": 0.5,
"adm": "<!-- admarkup -->",
prebidtappx marked this conversation as resolved.
Show resolved Hide resolved
"adid": "19005",
"adomain": ["test.com"],
"cid": "3706",
"crid": "19005",
"w": 300,
"h": 250,
"cat": ["IAB2"]
},
"type": "banner"
}
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://ZZ123456PS.ssp.tappx.com/rtb/?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2",
"uri": "http://ZZ123456PS.ssp.tappx.com/rtb/?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3",
"body": {
"id": "0000000000001",
"test": 1,
Expand All @@ -48,7 +48,7 @@
"bidder": {
"tappxkey": "pub-12345-android-9876",
"endpoint": "ZZ123456PS",
"host": "ZZ123456PS.ssp.tappx.com/rtb/"
"host": "ZZ123456PS.ssp.tappx.com/rtb/"
}
}
}
Expand All @@ -62,6 +62,11 @@
},
"user": {
"buyeruid": "A-38327932832"
},
"ext": {
"bidder": {
"tappxkey": "pub-12345-android-9876"
}
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2",
"uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3",
"body": {
"id": "0000000000001",
"test": 1,
Expand Down Expand Up @@ -62,6 +62,11 @@
},
"user": {
"buyeruid": "A-38327932832"
},
"ext":{
"bidder": {
"tappxkey": "pub-12345-android-9876"
}
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion adapters/tappx/tappxtest/exemplary/single-banner-site.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.2",
"uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.3",
"body": {
"id": "0000000000001",
"test": 1,
Expand Down Expand Up @@ -70,6 +70,11 @@
},
"user": {
"buyeruid": "A-38327932832"
},
"ext":{
"bidder": {
"tappxkey": "pub-12345-site-9876"
}
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2",
"uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3",
"body": {
"id": "0000000000001",
"test": 1,
Expand Down Expand Up @@ -67,6 +67,11 @@
},
"user": {
"buyeruid": "A-38327932832"
},
"ext":{
"bidder": {
"tappxkey": "pub-12345-android-9876"
}
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion adapters/tappx/tappxtest/exemplary/single-video-site.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.2",
"uri": "http://testing.ssp.tappx.com/rtb/v2/VZ123456PS?tappxkey=pub-12345-site-9876&type_cnn=prebid&v=1.3",
"body": {
"id": "0000000000001",
"test": 1,
Expand Down Expand Up @@ -75,6 +75,11 @@
},
"user": {
"buyeruid": "A-38327932832"
},
"ext":{
"bidder": {
"tappxkey": "pub-12345-site-9876"
}
}
}
},
Expand Down
7 changes: 6 additions & 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": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2",
"uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3",
"body": {
"id": "0000000000001",
"test": 1,
Expand All @@ -56,6 +56,11 @@
"publisher": {
"id": "2"
}
},
"ext": {
"bidder": {
"tappxkey": "pub-12345-android-9876"
}
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion adapters/tappx/tappxtest/supplemental/bidfloor.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.2",
"uri": "http://testing.ssp.tappx.com/rtb/v2/ZZ123456PS?tappxkey=pub-12345-android-9876&type_cnn=prebid&v=1.3",
"body": {
"id": "0000000000001",
"test": 1,
Expand Down Expand Up @@ -65,6 +65,11 @@
},
"user": {
"buyeruid": "A-38327932832"
},
"ext": {
"bidder": {
"tappxkey": "pub-12345-android-9876"
}
}
}
},
Expand Down
Loading