-
Notifications
You must be signed in to change notification settings - Fork 224
MobileFuse Adapter: Remove tagid_src and pub_id params #3915
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
Merged
CTMBNara
merged 10 commits into
prebid:master
from
tomaszbmf:mobilefuse-remove-tagid-src-ext
Jul 1, 2025
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
76a61bb
Remove tagid_src ext from MobileFuse Adapter
tomaszbmf 9d48692
remove pub_id query param
tomaszbmf 64b827f
fix unit tests
tomaszbmf 695d694
clean up redundant code which obtains endpoint url
tomaszbmf 2c22211
remove impExt null check
tomaszbmf 185fc06
Merge branch 'prebid:master' into mobilefuse-remove-tagid-src-ext
tomaszbmf 3033451
Restore validation for missing ExtImpMobilefuse
tomaszbmf 9d59b8a
Merge branch 'prebid:master' into mobilefuse-remove-tagid-src-ext
tomaszbmf 5d4c0d6
Align with Golang implementation
tomaszbmf 14153c4
remove throws and reorder methods
tomaszbmf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| import org.prebid.server.util.BidderUtil; | ||
| import org.prebid.server.util.HttpUtil; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.Collection; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
|
|
@@ -45,64 +46,62 @@ public MobilefuseBidder(String endpointUrl, JacksonMapper mapper) { | |
|
|
||
| @Override | ||
| public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest request) { | ||
| final String endpoint = request.getImp().stream() | ||
| .map(this::parseImpExt) | ||
| .filter(Objects::nonNull) | ||
| .findFirst() | ||
| .map(this::makeUrl) | ||
| .orElse(null); | ||
|
|
||
| if (endpoint == null) { | ||
| return Result.withError(BidderError.badInput("Invalid ExtImpMobilefuse value")); | ||
| final List<Imp> modifiedImps = new ArrayList<>(); | ||
| final List<BidderError> errors = new ArrayList<>(); | ||
|
|
||
| for (Imp imp : request.getImp()) { | ||
| try { | ||
| if (!isValidImp(imp)) { | ||
| continue; | ||
| } | ||
|
|
||
| final ExtImpMobilefuse extImp = parseImpExt(imp); | ||
| modifiedImps.add(modifyImp(imp, extImp)); | ||
| } catch (PreBidException e) { | ||
| errors.add(BidderError.badInput(e.getMessage())); | ||
| } | ||
| } | ||
|
|
||
| final List<Imp> modifiedImps = request.getImp().stream() | ||
| .map(this::modifyImp) | ||
| .filter(Objects::nonNull) | ||
| .toList(); | ||
| if (!errors.isEmpty()) { | ||
| return Result.withErrors(errors); | ||
| } | ||
|
|
||
| if (modifiedImps.isEmpty()) { | ||
| return Result.withError(BidderError.badInput("No valid imps")); | ||
| } | ||
|
|
||
| final BidRequest modifiedRequest = request.toBuilder().imp(modifiedImps).build(); | ||
| return Result.withValue(BidderUtil.defaultRequest(modifiedRequest, endpoint, mapper)); | ||
| return Result.withValue(BidderUtil.defaultRequest(modifiedRequest, endpointUrl, mapper)); | ||
| } | ||
|
|
||
| private Imp modifyImp(Imp imp) { | ||
| if (imp.getBanner() == null && imp.getVideo() == null && imp.getXNative() == null) { | ||
| return null; | ||
| } | ||
| private static boolean isValidImp(Imp imp) { | ||
| return imp.getBanner() != null || imp.getVideo() != null || imp.getXNative() != null; | ||
| } | ||
|
|
||
| final ExtImpMobilefuse impExt = parseImpExt(imp); | ||
| private Imp modifyImp(Imp imp, ExtImpMobilefuse extImp) { | ||
| final ObjectNode skadn = parseSkadn(imp.getExt()); | ||
| return imp.toBuilder() | ||
| .tagid(Objects.toString(impExt != null ? impExt.getPlacementId() : null, "0")) | ||
| .tagid(Objects.toString(extImp.getPlacementId(), "0")) | ||
| .ext(skadn != null ? mapper.mapper().createObjectNode().set(SKADN_PROPERTY_NAME, skadn) : null) | ||
| .build(); | ||
| } | ||
|
|
||
| private ExtImpMobilefuse parseImpExt(Imp imp) { | ||
| private ExtImpMobilefuse parseImpExt(Imp imp) throws PreBidException { | ||
|
||
| try { | ||
| return mapper.mapper().convertValue(imp.getExt(), MOBILEFUSE_EXT_TYPE_REFERENCE).getBidder(); | ||
| } catch (IllegalArgumentException e) { | ||
| return null; | ||
| throw new PreBidException("Error parsing ExtImpMobilefuse value: %s".formatted(e.getMessage())); | ||
| } | ||
| } | ||
|
|
||
| private ObjectNode parseSkadn(ObjectNode impExt) { | ||
| private ObjectNode parseSkadn(ObjectNode impExt) throws PreBidException { | ||
|
||
| try { | ||
| return mapper.mapper().convertValue(impExt.get(SKADN_PROPERTY_NAME), ObjectNode.class); | ||
| } catch (IllegalArgumentException e) { | ||
| return null; | ||
| throw new PreBidException(e.getMessage()); | ||
| } | ||
| } | ||
|
|
||
| private String makeUrl(ExtImpMobilefuse extImp) { | ||
| final String baseUrl = endpointUrl + Objects.toString(extImp.getPublisherId(), "0"); | ||
| return "ext".equals(extImp.getTagidSrc()) ? baseUrl + "&tagid_src=ext" : baseUrl; | ||
| } | ||
|
|
||
| @Override | ||
| public final Result<List<BidderBid>> makeBids(BidderCall<BidRequest> httpCall, BidRequest bidRequest) { | ||
| try { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Reorder the methods so that they are placed in the order they are called
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.
I applied both changes