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

Sovrn: Accept Imp.ext Bidfloor either as a number or string #3484

Merged
merged 2 commits into from
Oct 15, 2024

Conversation

ikagotso
Copy link
Contributor

@ikagotso ikagotso commented Oct 4, 2024

🔧 Type of changes

  • new bid adapter
  • update bid adapter
  • new feature
  • new analytics adapter
  • new module
  • bugfix
  • documentation
  • configuration
  • tech debt (test coverage, refactorings, etc.)

✨ What's the context?

purpose of this commit is to fix this issue : prebid/prebid-server#3514

🧠 Rationale behind the change

🧪 Test plan

🏎 Quality check

  • Are your changes following our code style guidelines?
  • Are there any breaking changes in your code?
  • Does your test coverage exceed 90%?
  • Are there any erroneous console logs, debuggers or leftover code in your changes?

Comment on lines 107 to 124
private static BigDecimal resolveBidFloor(BigDecimal impBidFloor, JsonNode extBidFloor) {
final BigDecimal fromExt = parseBidFloor(extBidFloor);
return !BidderUtil.isValidPrice(impBidFloor) && BidderUtil.isValidPrice(fromExt) ? fromExt : impBidFloor;
}

private static BigDecimal parseBidFloor(JsonNode extBidFloor) {
if (extBidFloor != null) {
if (extBidFloor.isNumber()) {
return extBidFloor.decimalValue();
} else if (extBidFloor.isTextual()) {
try {
return new BigDecimal(extBidFloor.textValue());
} catch (NumberFormatException e) {
return BigDecimal.ZERO;
}
}
}
return BigDecimal.ZERO;
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can revert this entirely as well as reverting the type change in the ExtImpSovrn, since both a string and a number will be successfully deserialized to BigDecimal

the only change you need is changing the json scheme, everything else should work fine

in order to test whether it works you can play with the integration test SovrnTest by changing values in the request json to double-check it works as intended

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you for making it simpler.

@@ -16,7 +15,7 @@ public class ExtImpSovrn {
@JsonProperty("tagId")
String legacyTagId;

BigDecimal bidfloor;
JsonNode bidfloor;
Copy link
Collaborator

Choose a reason for hiding this comment

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

revert

@Compile-Ninja Compile-Ninja merged commit f02440b into prebid:master Oct 15, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants