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: TradPlus #3361

Closed
wants to merge 2 commits into from
Closed

New Adapter: TradPlus #3361

wants to merge 2 commits into from

Conversation

tradplus
Copy link

@tradplus tradplus commented Aug 7, 2024

TradPlus is a leading, stable, and reliable ad monetization platform that is committed to providing global developers with fair, transparent and efficient monetization solutions. We also provide ADX and Saas ADX services. We serve 2,000+ global developers. Moreover, Our SDK has been certified by IAB Tech Lab and also joins Google Play SDK Index. And we have Information Security Management Certification.

Our advertising business spans the world. This is our official website: https://tradplusad.com/en. You can get more details about TradPlus.

this is TradPlus adapter version 1.0.

Thank!

Comment on lines +71 to +82
private ExtImpTradPlus parseAndValidateImpExt(ObjectNode extNode) {
final ExtImpTradPlus extImpTradPlus;
try {
extImpTradPlus = mapper.mapper().convertValue(extNode, EXT_TYPE_REFERENCE).getBidder();
} catch (IllegalArgumentException e) {
throw new PreBidException(e.getMessage());
}
if (StringUtils.isBlank(extImpTradPlus.getAccountId())) {
throw new PreBidException("Invalid/Missing AccountID");
}

return extImpTradPlus;
Copy link
Collaborator

Choose a reason for hiding this comment

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

please split into two methods: parseImpExt and validateImpExt

final ExtImpTradPlus extImpTradPlus = parseAndValidateImpExt(imp.getExt());
extToImps.computeIfAbsent(extImpTradPlus, ext -> new ArrayList<>()).add(imp);
} catch (PreBidException e) {
return Result.withError(BidderError.badInput(e.getMessage()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

in order to confirm: is it required to fail all the requests because of a single one invalid extImp?

.map(entry -> makeHttpRequest(entry.getKey(), entry.getValue(), bidRequest))
.toList();

return Result.of(httpRequests, Collections.emptyList());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Result.withValues(...)

Comment on lines +96 to +102
private static List<Imp> removeFirstImpExt(List<Imp> imps) {
return IntStream.range(0, imps.size())
.mapToObj(impIndex -> impIndex == 0
? imps.get(impIndex).toBuilder().ext(null).build()
: imps.get(impIndex))
.toList();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

imps.set(0, imps.getFirst().toBuilder().ext(null).build()

Comment on lines +71 to +83
@Test
public void makeHttpRequestsShouldReturnErrorWhenSourceIdIsNull() {
// given
final BidRequest bidRequest = givenBidRequest(ExtImpTradPlus.of(null, "zoneId"));

// when
final Result<List<HttpRequest<BidRequest>>> result = target.makeHttpRequests(bidRequest);

// then
assertThat(result.getValue()).isEmpty();
assertThat(result.getErrors()).hasSize(1)
.containsOnly(BidderError.badInput("Invalid/Missing AccountID"));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

accoding to the json scheme null is impossible as an accountId value, so it make sense to check when accountId is blank " "


private final TradPlusBidder target = new TradPlusBidder(ENDPOINT_TEMPLATE, jacksonMapper);

@Test
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • check also headers, impIds
  • Also the payload of the requests is never checked
  • Also the imps grouping logic is not covered, as well as the clean-up of the very first impExt for the request

BidRequest.builder()
.imp(singletonList(Imp.builder().id("123").build()))
.build(),
mapper.writeValueAsString(
Copy link
Collaborator

Choose a reason for hiding this comment

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

hide the mapper.writeValueAsString inside the givenBidResponse since it's the duplicate code

@Test
public void openrtb2AuctionShouldRespondWithBidsFromTradPlus() throws IOException, JSONException {
// given
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/tradplus-exchange"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

please chech here that the marcos replacement for the url is working

@SerhiiNahornyi
Copy link
Collaborator

@tradplus, could you please address the comments mentioned above?

@Compile-Ninja
Copy link
Collaborator

@tradplus There are conflicts in this PR. In addition to addressing the comments above, could you please merge the master branch as well?

@And1sS
Copy link
Member

And1sS commented Sep 12, 2024

PR is inactive for more than 3-4 weeks. Therefore, closing this PR.

@tradplus, reopen this PR after addressing open comments or making code changes.

@And1sS And1sS closed this Sep 12, 2024
@tradplus
Copy link
Author

the issue has been fixed, please reopen this PR.

@tradplus
Copy link
Author

A PR has been recreated:#3508.

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.

5 participants