Skip to content

Commit

Permalink
Cnvr Adapter: code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwier committed Apr 10, 2024
1 parent 8a4168b commit 922c620
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
7 changes: 3 additions & 4 deletions adapters/conversant/conversant.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type ConversantAdapter struct {
func (c *ConversantAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
cnvrRequest := *request
//Backend needs USD or it will reject the request
if cnvrRequest.Cur != nil && len(cnvrRequest.Cur) > 0 && cnvrRequest.Cur[0] != "USD" {
if len(cnvrRequest.Cur) > 0 && cnvrRequest.Cur[0] != "USD" {
cnvrRequest.Cur = []string{"USD"}
}
for i := 0; i < len(request.Imp); i++ {
Expand Down Expand Up @@ -145,10 +145,9 @@ func parseCnvrParams(imp *openrtb2.Imp, cnvrExt openrtb_ext.ExtImpConversant, re
return []error{&errortypes.BadInput{
Message: fmt.Sprintf("Unable to convert provided bid floor currency from %s to USD", imp.BidFloorCur),
}}
} else if floor > 0 {
imp.BidFloorCur = "USD"
imp.BidFloor = floor
}
imp.BidFloorCur = "USD"
imp.BidFloor = floor
}
return nil
}
Expand Down
27 changes: 24 additions & 3 deletions adapters/conversant/conversanttest/exemplary/video.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{
"mockBidRequest": {
"id": "testauction",
"cur": ["EUR"],
"imp": [
{
"id": "1",
"video": {
"w": 300,
"h": 250
},
"bidfloor": 2.00,
"bidfloorcur": "EUR",
"ext": {
"bidder": {
"site_id": "108060",
"bidfloor": 0.01,
"tag_id": "mytag",
"secure": 1,
"mimes": ["video/mp4", "video/x-flv"],
Expand All @@ -31,6 +33,15 @@
},
"site": {
"domain": "www.mypage.com"
},
"ext": {
"prebid": {
"currency": {
"rates": {
"USD": {"EUR": 0.08}
}
}
}
}
},
"httpCalls": [
Expand All @@ -39,6 +50,7 @@
"uri": "",
"body": {
"id": "testauction",
"cur": ["USD"],
"site": {
"id": "108060",
"domain": "www.mypage.com"
Expand All @@ -48,7 +60,8 @@
"id": "1",
"tagid": "mytag",
"secure": 1,
"bidfloor": 0.01,
"bidfloor": 25.0,
"bidfloorcur": "USD",
"displaymanager": "prebid-s2s",
"displaymanagerver": "2.0.0",
"video": {
Expand All @@ -66,7 +79,6 @@
"ext": {
"bidder": {
"site_id": "108060",
"bidfloor": 0.01,
"tag_id": "mytag",
"secure": 1,
"mimes": [
Expand All @@ -86,6 +98,15 @@
"ua": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36",
"ip": "192.168.1.1",
"dnt": 1
},
"ext": {
"prebid": {
"currency": {
"rates": {
"USD": {"EUR": 0.08}
}
}
}
}
}
},
Expand Down

0 comments on commit 922c620

Please sign in to comment.