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 bidder bidmyadz #1352

Merged
merged 11 commits into from
Jul 7, 2021
Merged

New bidder bidmyadz #1352

merged 11 commits into from
Jul 7, 2021

Conversation

nickluck9
Copy link

No description provided.

@nickluck9 nickluck9 requested a review from SerhiiNahornyi July 5, 2021 09:39
- video
- native
supported-vendors:
vendor-id: 724
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is between vendor id. BidMyAdz id is not present in go PR, and also 79.json does not contain it, so set it as zero,
Also pls fix it for bidmachine which id is 736

}
}

private boolean isValidRequest(BidRequest request, List<BidderError> errors) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be static
And actually we can a bit update this method, not to check device for null

  private static boolean isValidRequest(BidRequest request, List<BidderError> errors) {
        if (request.getImp().size() > 1) {
            errors.add(BidderError.badInput("Bidder does not support multi impression"));
        }

        final Device device = request.getDevice();
        final String ip = device != null ? device.getIp() : null;
        final String ipv6 = device != null ? device.getIpv6() : null;

        if (StringUtils.isEmpty(ip) && StringUtils.isEmpty(ipv6)) {
            errors.add(BidderError.badInput("IP/IPv6 is a required field"));
        }

        final String userAgent = device != null ? device.getUa() : null;

        if (StringUtils.isEmpty(userAgent)) {
            errors.add(BidderError.badInput("User-Agent is a required field"));
        }

        return errors.isEmpty();
    }

Then hasValidIp() method can be removed

.payload(request)
.body(mapper.encode(request))
.build());
} catch (EncodeException e) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This try/catch can be omitted

return Result.withValue(HttpRequest.<BidRequest>builder()
.method(HttpMethod.POST)
.uri(endpointUrl)
.headers(HttpUtil.headers().add(HttpUtil.X_OPENRTB_VERSION_HEADER, "2.5"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add method createHeaders()


private static List<BidderBid> bidsFromResponse(BidRequest bidRequest, BidResponse bidResponse) {
final SeatBid seatBid = bidResponse.getSeatbid().get(0);
return seatBid.getBid().stream()
Copy link
Collaborator

Choose a reason for hiding this comment

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

From Go they also have error for empty bids


// then
assertThat(result.getErrors())
.hasSize(1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be omitted

.extracting(HttpRequest::getHeaders)
.flatExtracting(MultiMap::entries)
.extracting(Map.Entry::getKey, Map.Entry::getValue)
.contains(tuple(HttpUtil.X_OPENRTB_VERSION_HEADER.toString(), "2.5"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's add check for every header

@AllArgsConstructor(staticName = "of")
public class ExtImpBidmyadz {

String placementId;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems here @JsonProperty should be used

.bidderCreator(config -> new BidmyadzBidder(config.getEndpoint(), mapper))
.assemble();
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Redundant \n

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

Copy link
Collaborator

@SerhiiNahornyi SerhiiNahornyi Jul 5, 2021

Choose a reason for hiding this comment

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

/**
 * BidMyAdz {@link Bidder} implementation.
 */

}

@Test
public void makeBidsShouldReturnBannerBidIfBannerIsPresent() throws JsonProcessingException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

IfMediaTypeEqualsBanner

}

@Test
public void makeHttpRequestsShouldReturnErrorsIfBidRequestHasMoreThan() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

HasMoreThan...

}

@Test
public void makeHttpRequestsShouldReturnErrorsIfBidRequestDoesNotHaveUa() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

DeviceDoesNotHaveUserAgent

}

@Test
public void makeHttpRequestsShouldReturnErrorsIfBidRequestDoesNotHaveIp() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

DeviceDoesNotHaveIpOrIpV6

}

private static BidType getBidType(JsonNode ext) {
final JsonNode mediaTypeNode = ext.get("mediaType");
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should check that ext is not null to prevent NPE

@rpanchyk rpanchyk merged commit 9929432 into master Jul 7, 2021
@rpanchyk rpanchyk deleted the new_bidder_bidmyadz branch July 7, 2021 11:23
nickluck9 pushed a commit that referenced this pull request Jul 8, 2021
nickluck9 pushed a commit that referenced this pull request Aug 9, 2021
nickluck9 pushed a commit that referenced this pull request Aug 10, 2021
nickluck9 pushed a commit that referenced this pull request Aug 10, 2021
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.

3 participants