-
Notifications
You must be signed in to change notification settings - Fork 762
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: Сointraffic #3647
New Adapter: Сointraffic #3647
Conversation
adapters/cointraffic/cointraffic.go
Outdated
var bidExt openrtb_ext.ExtBid | ||
err := json.Unmarshal(bid.Ext, &bidExt) | ||
if err == nil && bidExt.Prebid != nil { | ||
return openrtb_ext.ParseBidType(string(bidExt.Prebid.Type)) |
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.
Consider this as a suggestion. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, recommends implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.
adapters/cointraffic/cointraffic.go
Outdated
endpoint string | ||
} | ||
|
||
// Builder builds a new instance of the Foo adapter for the given bidder with the given config. |
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.
Thanks for using the template from the docs. Please rename "Foo" to "Cointraffic" for your adapter.
openrtb_ext/imp_cointraffic.go
Outdated
package openrtb_ext | ||
|
||
type ExtImpCointraffic struct { | ||
PlacementId string `json:"PlacementId"` |
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.
Please consider using all lower case "placementid" or snake case "placementId" for bidder parameters.
Code coverage summaryNote:
cointrafficRefer here for heat map coverage report
|
Code coverage summaryNote:
cointrafficRefer here for heat map coverage report
|
Code coverage summaryNote:
cointrafficRefer here for heat map coverage report
|
adapters/cointraffic/cointraffic.go
Outdated
if len(request.Imp) == 0 { | ||
return nil, []error{&errortypes.BadInput{ | ||
Message: "No impression in the bid request", | ||
}} | ||
} |
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.
should exclude this check from adapter PR. Prebid server core framework checks for impression length before invoking adapter code
adapters/cointraffic/cointraffic.go
Outdated
if responseData.StatusCode == http.StatusNoContent { | ||
return nil, nil | ||
} | ||
|
||
if responseData.StatusCode == http.StatusBadRequest { | ||
err := &errortypes.BadInput{ | ||
Message: fmt.Sprintf("Unexpected code: %d. Run with request.debug = 1 for more info.", responseData.StatusCode), | ||
} | ||
return nil, []error{err} | ||
} | ||
|
||
if responseData.StatusCode != http.StatusOK { | ||
err := &errortypes.BadServerResponse{ | ||
Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info.", responseData.StatusCode), | ||
} | ||
return nil, []error{err} | ||
} | ||
|
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.
could make use of response utils
prebid-server/adapters/response.go
Lines 10 to 28 in ec729e6
func CheckResponseStatusCodeForErrors(response *ResponseData) error { | |
if response.StatusCode == http.StatusBadRequest { | |
return &errortypes.BadInput{ | |
Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), | |
} | |
} | |
if response.StatusCode != http.StatusOK { | |
return &errortypes.BadServerResponse{ | |
Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), | |
} | |
} | |
return nil | |
} | |
func IsResponseStatusCodeNoContent(response *ResponseData) bool { | |
return response.StatusCode == http.StatusNoContent | |
} |
adapters/cointraffic/cointraffic.go
Outdated
|
||
bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(response.SeatBid[0].Bid)) | ||
bidResponse.Currency = response.Cur |
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.
adapters.NewBidderResponseWithBidsCapacity
initialises bidResponse.Currency
with USD
value
consider scenario where bidResponse.Currency
is empty, assigning response.Cur
directly may set bidResponse.Currency
to empty value
consider implementing following changes:
bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(response.SeatBid[0].Bid))
if response.Cur != "" {
bidResponse.Currency = response.Cur
}
@@ -0,0 +1,10 @@ | |||
endpoint: "https://apps.adsgravity.io/pbs/v1/request" |
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.
% curl -i --location --request POST 'https://apps.adsgravity.io/pbs/v1/request'
HTTP/2 400
date: Wed, 05 Jun 2024 11:16:14 GMT
content-type: text/javascript;charset=UTF-8
endpoint is reachable
maintainer: | ||
email: [email protected] |
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.
Prebid team has sent email to verify above maintainers email. Requesting to responding back on email thread
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.
@sergeykcointraffic Please reply to email sent from us.
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.
@gargcreation1992 We replied to this email a few weeks ago.
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.
We have not received it yet. Please send it again. Is the email bouncing? @stsepelin
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.
@gargcreation1992 Replied.
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.
@stsepelin We have not received it. Could you please check the outbox? Also please check if your email policies allows you to send email outside your org.
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.
@gargcreation1992 Everything seems fine. Could you also check the spam folder/filters?
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.
I see your responses in the spam folder.
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.
I will check if there is anything we can do with this.
"imp": [ | ||
{ | ||
"id": "testImpressionId", |
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.
should update json test where request has multiple imp
Code coverage summaryNote:
cointrafficRefer here for heat map coverage report
|
Hey @onkarvhanumante! Could you review this pull request again? |
adapters/cointraffic/cointraffic.go
Outdated
return []*adapters.RequestData{requestData}, nil | ||
} | ||
|
||
func (a *adapter) buildRequest(request *openrtb2.BidRequest) (*adapters.RequestData, error) { |
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.
buildRequest
only builds headers and marshals request. This logic can be moved inside MakeRequests
function
good to merge after addressing #3647 (comment) |
Code coverage summaryNote:
cointrafficRefer here for heat map coverage report
|
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.
This is looking good; I have just two nitpicks.
@@ -80,6 +80,7 @@ var coreBidderNames []BidderName = []BidderName{ | |||
BidderCadentApertureMX, | |||
BidderCcx, | |||
BidderCoinzilla, | |||
BidderCointraffic, |
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.
Super nitpick: please move this above BidderCoinzilla
to maintain alphabetical order.
@@ -368,6 +369,7 @@ const ( | |||
BidderCadentApertureMX BidderName = "cadent_aperture_mx" | |||
BidderCcx BidderName = "ccx" | |||
BidderCoinzilla BidderName = "coinzilla" | |||
BidderCointraffic BidderName = "cointraffic" |
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.
Super nitpick: please move this above BidderCoinzilla
to maintain alphabetical order.
Code coverage summaryNote:
cointrafficRefer here for heat map coverage report
|
@bsardo Thanks for the review. Those two nitpicks are fixed now :) |
Co-authored-by: Aleksandr Štšepelin <[email protected]>
Adds Prebid Server support.
🏷 Type of documentation
🏷 Description of change
official adapter submission
Contact email of the adapter's maintainer [email protected]
A link to a PR on the docs repo at Update Cointraffic for Prebid-Server support prebid.github.io#5323