-
Notifications
You must be signed in to change notification settings - Fork 748
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 mabidder #3080
New Adapter mabidder #3080
Conversation
Documentation PR: prebid/prebid.github.io#4848 |
@ecdrsvc feature branch ecdrsvc:master is 22 commits ahead of, 204 commits behind should sync feature master with latest prebid:master updates. |
Code coverage summaryNote:
mabidderRefer here for heat map coverage report
|
@onkarvhanumante, it's synced. |
adapters/mabidder/mabidder_test.go
Outdated
Endpoint: "https://mabidder-test"}, | ||
config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"}) |
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 use https://prebid.ecdrsvc.com/pbs
url as mentioned in bidder-info param
endpoint: "https://prebid.ecdrsvc.com/pbs" |
adapters/mabidder/mabidder.go
Outdated
if responseData.StatusCode == http.StatusNoContent { | ||
return nil, nil | ||
} | ||
|
||
if responseData.StatusCode == http.StatusBadRequest { | ||
err := &errortypes.BadInput{ | ||
Message: fmt.Sprintf("Unexpected status code: %d. Bad request from publisher.", responseData.StatusCode), | ||
} | ||
return nil, []error{err} | ||
} | ||
|
||
if responseData.StatusCode != http.StatusOK { | ||
err := &errortypes.BadServerResponse{ | ||
Message: fmt.Sprintf("Unexpected status code: %d.", 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.
just a suggestion, could make use of utils mentioned below
prebid-server/adapters/response.go
Lines 9 to 26 in 0615109
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 fmt.Errorf("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/mabidder/mabidder.go
Outdated
type maServerResponse struct { | ||
Responses []maBidResponse | ||
PrivateIdStatus string `json:"-"` | ||
} | ||
|
||
type maBidResponse struct { | ||
RequestID string `json:"requestId"` | ||
Currency string `json:"currency"` | ||
Width int32 `json:"width"` | ||
Height int32 `json:"height"` | ||
PlacementId string `json:"creativeId"` | ||
Deal string `json:"dealId,omitempty"` | ||
NetRevenue bool `json:"netRevenue"` | ||
TimeToLiveSeconds int32 `json:"ttl"` | ||
AdTag string `json:"ad"` | ||
MediaType string `json:"mediaType"` | ||
Meta maMeta `json:"meta"` | ||
CPM float32 `json:"cpm"` | ||
} | ||
|
||
type maMeta struct { | ||
AdDomain []string `json:"advertiserDomains"` | ||
} | ||
|
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.
scope of these struct is within mabidder
package. so could ma
prefix from above structs
- type maServerResponse struct {
+ type serverResponse struct {
- type maBidResponse struct {
+ type bidResponse struct {
- type maMeta struct {
+ type meta struct {
adapters/mabidder/mabidder.go
Outdated
if bidResponse.Currency == "" { | ||
bidResponse.Currency = maBidResp.Currency | ||
} |
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.
bidResponse
is initialized by NewBidderResponseWithBidsCapacity()
on line 90
prebid-server/adapters/bidder.go
Lines 72 to 78 in 8ffa1c6
// By default, currency is USD but this behavior might be subject to change. | |
func NewBidderResponseWithBidsCapacity(bidsCapacity int) *BidderResponse { | |
return &BidderResponse{ | |
Currency: "USD", | |
Bids: make([]*TypedBid, 0, bidsCapacity), | |
} | |
} |
Based on code setup, bidResponse.Currency
will always be USD
. Therefore, if
check on line 107 will always be false and maBidResp.Currency
won't be used. Perhaps you would like to make following change.
if maBidResp.Currency != "" {
bidResponse.Currency = maBidResp.Currency
}
@@ -0,0 +1,11 @@ | |||
endpoint: "https://prebid.ecdrsvc.com/pbs" |
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.
endpoint is reachable
@@ -0,0 +1,11 @@ | |||
endpoint: "https://prebid.ecdrsvc.com/pbs" | |||
maintainer: | |||
email: lmprebidadapter@loblaw.ca |
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.
@ecdrsvc , PBS team attempted to verify above maintainer email. However was not able to reach you out on above specified email address.
Note that an working maintainer email is needed to proceed with this PR
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.
sent an email again. Please reply with "received"
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.
g2g after addressing Onkar's comment.
Code coverage summaryNote:
mabidderRefer here for heat map coverage report
|
@onkarvhanumante the code has been updated with all your suggestions. |
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.
g2g after email verification.
adding block label on PR until we get update on working email |
The email issue has been fixed. Please send a verification message and we will reply. Thanks. |
Verification email is being sent to |
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.
g2g after email verification.
Just confirming here that we got the verification email and replied with 'received'. Let me know if any issues. |
received reply from mabidder |
We have an existing Prebid.js adapter and would like to add this new Prebid Server adapter.