-
Notifications
You must be signed in to change notification settings - Fork 744
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
New Adapter: Zentotem #3866
Closed
Closed
New Adapter: Zentotem #3866
Changes from 12 commits
Commits
Show all changes
89 commits
Select commit
Hold shift + click to select a range
9aef1ae
zentotem: add adapter
GermanBogatov 6fdcc11
zentotem: add adapter
GermanBogatov 3edd765
zentotem: add adapter
GermanBogatov 9ec095a
zentotem: add adapter
GermanBogatov a7d9462
zentotem: add adapter
GermanBogatov 36a4b0f
zentotem: add adapter
GermanBogatov 9c6b5e3
zentotem: add adapter
GermanBogatov b3caeaa
Merge branch 'prebid:master' into master
zentotem e4bd6d3
ADTS-455 remove video validations (#3842)
gg-natalia 153ebf5
zentotem: add adapter
GermanBogatov f075a67
Merge remote-tracking branch 'origin/master'
GermanBogatov 6f3f47c
zentotem: add adapter
GermanBogatov 6be7244
Update Vidazoo bidder info for GPP support (#3869)
saar120 e8509e6
declare support for ORTB 2.6 (#3872)
bretg d161712
new adapter (#3833)
Pubrise a556e2d
Fix currency conversion bug. (#3867)
CTMBNara 59a5b07
freewheel-adapter: support 2.6 (#3873)
mwang-sticky 54f8759
Update mobilefuse.yaml to indicate support for OpenRTB 2.6 and GPP (#…
dtbarne bd85ba4
specifies ortb 2.6 support (#3) (#3876)
nickllerandi 84a8162
PulsePoint: ortb 2.6 version and gpp support (#3874)
anand-venkatraman 536f118
zentotem: fix after review
GermanBogatov b5cb591
zentotem: fix after review
GermanBogatov 8d7117d
Revert "New Module: 51Degrees (#3650)" (#3888)
bsardo 4ea0e33
New Adapter: Copper6SSP (#3755)
Copper6SSP 2e2b49f
New Adapter: Escalax (#3798)
escalax e825553
New Adapter: Oraki (#3839)
BenOraki f7caea5
OpenX: indicate support for OpenRTB 2.6 (#3879)
bwschmidt 8237f7f
Refactor Bid Splitter Privacy Functions (#3645)
SyntaxNode ec6a45d
Agma: Allow app.bundle to be used as selector for apps (#3780)
steffenmllr 6a011ed
Update github.com/rs/cors to v1.11.0 (#3884)
ccorbo b920cca
Playdigo: Add tcfeu support (#3890)
Yanivplaydigo e0a21d0
QT: Add tcfeu support (#3892)
qt-io 6cbedf0
Smartx: Declare OpenRTB 2.6 support (#3896)
schubert-sc 7613ff5
Update adapter json test framework to validate BidVideo (#3835)
laurb9 c02ee8c
Update exchange json tests with correct hb_pb_cat_dur (#3836)
laurb9 ffdd75f
New Adapter: AdTonos (#3853)
rkaw92 3e24be7
New Adapter: TGM (#3848)
apykhteyev 640b97c
LemmaDigital: change endpoint (#3862)
lm-ved 3c4527e
Adnuntius: Return DSA in bid response (#3777)
mikael-lundin 905b3a5
Log non bid reasons in bidder framework (#2891)
ShriprasadM 93368cc
ConnectAd: String/int fix (#3925)
rtuschkany 11b6546
Rubicon: Pass PBS host info to XAPI (#3903)
And1sS 4462fce
51degrees module (#3893)
justadreamer 8b1b96e
Add docs build readme (#3930)
bsardo c42fe53
InMobi: mtype support (#3921)
bkaneyama 53f51a6
GPC: Set extension based on header (#3895)
przemkaczmarek 6c154e0
New Adapter: Streamlyn (#3900)
apykhteyev f27bcef
New Adapter: Bidmatic (#3731)
dkornet-ad 8689e0d
Sonobi: native and currency conversion support (#3889)
bansawbanchee d54c3ed
New Adapter: Missena (#3761)
ysfbsf 64584f6
Refactor: Remove getAuctionBidderRequests (#3957)
bsardo 87d4412
Refactor: Move privacy init up (#3958)
bsardo 9bb9b3d
Unruly: Indicate Support for OpenRTB 2.6 (#3984)
bhainesnexxen c37951a
update yieldmo.yaml to indicate support for ortb 2.6 (#3968)
ym-winston 5fcbbbf
Triplelift: Adding flag for 2.6 support (#3966)
patrickloughrey cbe9876
enable gzip (#3946)
ikagotso b56923c
RTB House: Resolve AUCTION_PRICE macro (#3901)
piotrj-rtbh 8134328
Displayio: Make imp.bidfloor optional (#3959)
xdevel 451bc44
BlueSea: Add site capability (#3910)
blueseasx bcf6491
GumGum: Declare ORTB 2.6 support (#3985)
sindhuja-sridharan 18f6798
Bump Go version to 1.22 in dev containers config (#3983)
sebhtml 03a4abd
Sample: Fix prebid js loading bug on sample html page (#3792)
And1sS a23380f
ImproveDigital: Remove placementKey & addtlconsent parsing (#3728)
ishihanvcs ddf897c
Update Cookie Sync Chooser Debug Message to match Java (#3558)
AlexBVolcy 1419761
Rename Blacklisted Apps to Blocked Apps (#3620)
SyntaxNode db2a872
ORTB 2.6: Full support with down convert for 2.5 adapters (#4019)
bsardo df58baf
Cookie Sync: Use max when limit is 0 (#4022)
bsardo 3907f1a
Remove Default Request Hardcoded Aliases (#4020)
SyntaxNode 5b11f59
Adapters: Update to use jsonutil unmarshal (#4021)
bsardo 6e150f3
Increment Package Version To v3 (#4029)
SyntaxNode a788661
GumGum: Override the default currency (#3928)
MartinGumGum 3403544
PgamSSP: Add currency converter (#3907)
PGAMSSP 106f6e4
IQzone: Add user sync (#3971)
IQZoneAdx 181d523
Fix: Delete user.ext.prebid.buyeruids after extraction (#4049)
bsardo 24ba83b
Krushmedia: Update user sync urls (#3979)
Krushmedia 63af8af
New Adapter: Nativo (#3790)
rafataveira 573c59e
zentotem: add adapter
GermanBogatov f8ee4ed
zentotem: add adapter
GermanBogatov 4bee7d9
zentotem: add adapter
GermanBogatov 5cb43d2
zentotem: add adapter
GermanBogatov b6bc533
zentotem: add adapter
GermanBogatov 39567ab
zentotem: add adapter
GermanBogatov 93e3969
zentotem: add adapter
GermanBogatov bd22820
zentotem: add adapter
GermanBogatov 2b0b9b1
zentotem: add adapter
GermanBogatov 7a2144a
zentotem: fix after review
GermanBogatov d4290d3
zentotem: fix after review
GermanBogatov 764f48a
zentotem: replace v2 to v3
GermanBogatov dc73050
Merge remote-tracking branch 'origin/master'
GermanBogatov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package zentotem | ||
|
||
import ( | ||
"encoding/json" | ||
"github.com/prebid/prebid-server/v2/openrtb_ext" | ||
"testing" | ||
) | ||
|
||
//Zentotem doesn't currently require any custom fields. This file is included for conformity only | ||
//We do include an unused, non-required custom param in static/bidder-params/zentotem.json, but only to hinder the prebid server from crashing by looking for at least 1 custom param | ||
|
||
// This file actually intends to test static/bidder-params/zentotem.json | ||
// | ||
// These also validate the format of the external API: request.imp[i].ext.prebid.bidder.zentotem | ||
// TestValidParams makes sure that the Zentotem schema accepts all imp.ext fields which we intend to support. | ||
func TestValidParams(t *testing.T) { | ||
validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") | ||
if err != nil { | ||
t.Fatalf("Failed to fetch the json-schemas. %v", err) | ||
} | ||
|
||
for _, validParam := range validParams { | ||
if err := validator.Validate(openrtb_ext.BidderZentotem, json.RawMessage(validParam)); err != nil { | ||
t.Errorf("Schema rejected Zentotem params: %s", validParam) | ||
} | ||
} | ||
} | ||
|
||
// TestInvalidParams makes sure that the Zentotem schema rejects all the imp.ext fields we don't support. | ||
func TestInvalidParams(t *testing.T) { | ||
validator, err := openrtb_ext.NewBidderParamsValidator("../../static/bidder-params") | ||
if err != nil { | ||
t.Fatalf("Failed to fetch the json-schemas. %v", err) | ||
} | ||
|
||
for _, invalidParam := range invalidParams { | ||
if err := validator.Validate(openrtb_ext.BidderZentotem, json.RawMessage(invalidParam)); err == nil { | ||
t.Errorf("Schema allowed unexpected params: %s", invalidParam) | ||
} | ||
} | ||
} | ||
|
||
var validParams = []string{} | ||
|
||
var invalidParams = []string{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package zentotem | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"github.com/prebid/openrtb/v20/openrtb2" | ||
"github.com/prebid/prebid-server/v2/adapters" | ||
"github.com/prebid/prebid-server/v2/config" | ||
"github.com/prebid/prebid-server/v2/openrtb_ext" | ||
) | ||
|
||
type adapter struct { | ||
endpoint string | ||
} | ||
|
||
// Builder builds a new instance of the {bidder} adapter for the given bidder with the given config. | ||
func Builder(bidderName openrtb_ext.BidderName, config config.Adapter, server config.Server) (adapters.Bidder, error) { | ||
bidder := &adapter{ | ||
endpoint: config.Endpoint, | ||
} | ||
return bidder, nil | ||
} | ||
|
||
func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { | ||
requests := make([]*adapters.RequestData, 0, len(request.Imp)) | ||
var errors []error | ||
|
||
requestCopy := *request | ||
for _, imp := range request.Imp { | ||
requestCopy.Imp = []openrtb2.Imp{imp} | ||
|
||
requestJSON, err := json.Marshal(request) | ||
if err != nil { | ||
errors = append(errors, err) | ||
continue | ||
} | ||
|
||
requestData := &adapters.RequestData{ | ||
Method: "POST", | ||
Uri: a.endpoint, | ||
Body: requestJSON, | ||
ImpIDs: []string{imp.ID}, | ||
} | ||
requests = append(requests, requestData) | ||
} | ||
return requests, errors | ||
} | ||
|
||
func getMediaTypeForBid(bid openrtb2.Bid) (openrtb_ext.BidType, error) { | ||
switch bid.MType { | ||
case openrtb2.MarkupBanner: | ||
return openrtb_ext.BidTypeBanner, nil | ||
case openrtb2.MarkupVideo: | ||
return openrtb_ext.BidTypeVideo, nil | ||
case openrtb2.MarkupNative: | ||
return openrtb_ext.BidTypeNative, nil | ||
} | ||
|
||
return "", fmt.Errorf("could not define media type for impression: %s", bid.ImpID) | ||
} | ||
|
||
func (a *adapter) MakeBids(request *openrtb2.BidRequest, requestData *adapters.RequestData, responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) { | ||
if adapters.IsResponseStatusCodeNoContent(responseData) { | ||
return nil, nil | ||
} | ||
|
||
if err := adapters.CheckResponseStatusCodeForErrors(responseData); err != nil { | ||
return nil, []error{err} | ||
} | ||
var response openrtb2.BidResponse | ||
if err := json.Unmarshal(responseData.Body, &response); err != nil { | ||
return nil, []error{err} | ||
} | ||
|
||
bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(request.Imp)) | ||
bidResponse.Currency = response.Cur | ||
var errors []error | ||
for _, seatBid := range response.SeatBid { | ||
for _, bid := range seatBid.Bid { | ||
bidType, err := getMediaTypeForBid(bid) | ||
if err != nil { | ||
errors = append(errors, err) | ||
continue | ||
} | ||
|
||
bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{ | ||
Bid: &bid, | ||
BidType: bidType, | ||
}) | ||
} | ||
} | ||
return bidResponse, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package zentotem | ||
|
||
import ( | ||
"github.com/prebid/openrtb/v20/openrtb2" | ||
"github.com/prebid/prebid-server/v2/adapters/adapterstest" | ||
"github.com/prebid/prebid-server/v2/config" | ||
"github.com/prebid/prebid-server/v2/openrtb_ext" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestJsonSamples(t *testing.T) { | ||
bidder, buildErr := Builder(openrtb_ext.BidderZentotem, config.Adapter{ | ||
Endpoint: "https://rtb.zentotem.net/bid?sspuid=cqlnvfk00bhs0b6rci6g"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) | ||
|
||
if buildErr != nil { | ||
t.Fatalf("Builder returned unexpected error %v", buildErr) | ||
} | ||
|
||
adapterstest.RunJSONBidderTest(t, "zentotemtest", bidder) | ||
} | ||
|
||
func TestGetMediaTypeForBid(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
bid openrtb2.Bid | ||
wantType openrtb_ext.BidType | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "get bid native type", | ||
bid: openrtb2.Bid{ | ||
MType: 4, | ||
}, | ||
wantType: openrtb_ext.BidTypeNative, | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "get bid banner type", | ||
bid: openrtb2.Bid{ | ||
MType: 1, | ||
}, | ||
wantType: openrtb_ext.BidTypeBanner, | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "get bid video type", | ||
bid: openrtb2.Bid{ | ||
MType: 2, | ||
}, | ||
wantType: openrtb_ext.BidTypeVideo, | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "fail", | ||
wantType: "", | ||
wantErr: true, | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
bType, err := getMediaTypeForBid(tt.bid) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("getMediaTypeForBid error = %v, wantErr %v", err, tt.wantErr) | ||
} | ||
|
||
assert.Equal(t, bType, tt.wantType) | ||
}) | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found incorrect assignment made to Bid. bid variable receives a new value in each iteration of range loop. Assigning the address of bid
(&bid)
to Bid will result in a pointer that always points to the same memory address with the value of the last iteration. This can lead to unexpected behavior or incorrect results. Refer https://go.dev/play/p/9ZS1f-5h4qSConsider using an index variable in the seatBids.Bid loop as shown below