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

New Adapter: Rise #2815

Merged
merged 1 commit into from
Jun 9, 2023
Merged

Conversation

misha93m
Copy link
Contributor

@misha93m misha93m commented Jun 1, 2023

No description provided.

@misha93m misha93m marked this pull request as draft June 1, 2023 12:45
@SyntaxNode SyntaxNode changed the title TypeA Rise adapter New Adapter: Rise Jun 1, 2023
static/bidder-info/rise.yaml Outdated Show resolved Hide resolved
static/bidder-info/rise.yaml Outdated Show resolved Hide resolved
@gargcreation1992
Copy link
Contributor

@misha93m PR checks are failing. Requesting you to please check.

@onkarvhanumante
Copy link
Contributor

@misha93m PR is created as Draft. Let us know when PR is ready for review

@misha93m misha93m force-pushed the typea-adapter branch 2 times, most recently from 927a112 to ebcc451 Compare June 6, 2023 07:58
adapters/rise/rise.go Show resolved Hide resolved
adapters/rise/rise.go Outdated Show resolved Hide resolved
giditietz
giditietz previously approved these changes Jun 6, 2023
@gargcreation1992
Copy link
Contributor

@misha93m Please let us know if this PR is ready to be reviewed.

@misha93m misha93m marked this pull request as ready for review June 7, 2023 10:49
@misha93m
Copy link
Contributor Author

misha93m commented Jun 7, 2023

Hi @gargcreation1992 @onkarvhanumante
PR is ready for review.

_ *adapters.ExtraRequestInfo) (
requestsToBidder []*adapters.RequestData,
errs []error,
) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick - for consistency in the codebase please use single line for MakeRequests function declaration.

func (a *adapter) MakeRequests(openRTBRequest *openrtb2.BidRequest, _ *adapters.ExtraRequestInfo) (requestsToBidder []*adapters.RequestData, errs []error) {
//your code
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Done.

return "", errors.New("no publisherID supplied")
}

return publisherID, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick - you could combine the above if statement and simply return publisherID, errors.New("no publisherID supplied")

Copy link
Contributor Author

@misha93m misha93m Jun 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this solution will work. Due to your code, err is initialised, and the caller will handle err properly:

	publisherID, err := a.extractPublisherID(openRTBRequest)
	if err != nil {
		errs = append(errs, fmt.Errorf("extractPublisherID: %w", err))
		return nil, errs
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated code a bit. Please check.

)

for _, imp := range openRTBRequest.Imp {
if err := json.Unmarshal(imp.Ext, &bidderExt); err == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should not ignore Unmarshal error here. Please do the error handling properly.

if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
     return "", err
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, updated.


for _, imp := range openRTBRequest.Imp {
if err := json.Unmarshal(imp.Ext, &bidderExt); err == nil {
if err = json.Unmarshal(bidderExt.Bidder, &impExt); err == nil && impExt.PublisherID != "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above. Please do not ignore Unmarshaling error here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, updated.

func (a *adapter) MakeBids(
request *openrtb2.BidRequest,
_ *adapters.RequestData,
responseData *adapters.ResponseData) (*adapters.BidderResponse, []error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting you to please move this to single line for consistency across the codebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, done.

Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info.", responseData.StatusCode),
}
return nil, []error{err}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking response status code this way is correct but you could also make use of the following code -

if httputil.IsResponseStatusCodeNoContent(response) {
		return nil, nil
	}

	if err := httputil.CheckResponseStatusCodeForErrors(response); err != nil {
		return nil, []error{err}
	}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, updated.

return openrtb_ext.BidTypeBanner
} else if imp.Video != nil {
return openrtb_ext.BidTypeVideo
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning - This is an anti-pattern. This code assumes that for multi-format bid request, mediatype will be set to type banner by default. I would recommend to set the mediaType based on bidder response. Your bidder should be able to set openrtb2.Bid.Mtype field and use that field here to get mediaTypeForImp. Even if your bidder does not support multi-format request, I would highly encourage you to make this change. Here is an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, updated.

@@ -0,0 +1,18 @@
endpoint: "https://pbs.yellowblue.io/pbs"
maintainer:
email: rise-prog-dev@risecodes.com
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sent an email confirmation to verify email addresss. Please reply received.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

email verified. thanks!

- video
userSync:
iframe:
url: https://pbs-cs.yellowblue.io/pbs-iframe?gdpr={{.GDPR}}&gdpr_consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User sync URL works. 👍

Copy link
Contributor

@gargcreation1992 gargcreation1992 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting few changes.

@misha93m
Copy link
Contributor Author

misha93m commented Jun 8, 2023

Hi @gargcreation1992 @onkarvhanumante
Many thanks for review!
Please check changes I did.

@onkarvhanumante
Copy link
Contributor

@misha93m tests are failing with following error:

Error: adapters/rise/rise.go:55:14: undefined: httputil.IsResponseStatusCodeNoContent
Error: adapters/rise/rise.go:59:21: undefined: httputil.CheckResponseStatusCodeForErrors

IsResponseStatusCodeNoContent and CheckResponseStatusCodeForErrors were moved to adapters package. Could you sync PR branch with master branch updates

return openrtb_ext.BidTypeAudio, nil
case openrtb2.MarkupNative:
return openrtb_ext.BidTypeNative, nil
default:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In rise.yaml, you have defined that your bidder will be supporting just Banner and Video. I believe you might wanna error out if bidder response returns Audio or Native as bid type. So here is the code -

switch bid.MType {
	case openrtb2.MarkupBanner:
		return openrtb_ext.BidTypeBanner, nil
	case openrtb2.MarkupVideo:
		return openrtb_ext.BidTypeVideo, nil
	default:
                 return "", fmt.Errorf("unsupported MType %d", bid.MType)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants