@@ -193,13 +193,6 @@ private static boolean isCodeValid(MediasquareCode code) {
193193 mediaTypes .getBanner (), mediaTypes .getVideo (), mediaTypes .getNativeRequest ());
194194 }
195195
196- private static ExtRegsDsa getDsa (Regs regs ) {
197- return Optional .ofNullable (regs )
198- .map (Regs ::getExt )
199- .map (ExtRegs ::getDsa )
200- .orElse (null );
201- }
202-
203196 private MediasquareRequest makeRequest (BidRequest bidRequest , List <MediasquareCode > codes ) {
204197 final User user = bidRequest .getUser ();
205198 final Regs regs = bidRequest .getRegs ();
@@ -214,6 +207,13 @@ private MediasquareRequest makeRequest(BidRequest bidRequest, List<MediasquareCo
214207 .build ();
215208 }
216209
210+ private static ExtRegsDsa getDsa (Regs regs ) {
211+ return Optional .ofNullable (regs )
212+ .map (Regs ::getExt )
213+ .map (ExtRegs ::getDsa )
214+ .orElse (null );
215+ }
216+
217217 private static MediasquareGdpr makeGdpr (User user , Regs regs ) {
218218 final boolean gdprApplies = Optional .ofNullable (regs )
219219 .map (Regs ::getGdpr )
@@ -251,6 +251,16 @@ private BidderBid makeBidderBid(MediasquareBid bid) {
251251 return BidderBid .of (makeBid (bid , bidType ), bidType , bid .getCurrency ());
252252 }
253253
254+ private static BidType getBidType (MediasquareBid bid ) {
255+ if (bid .getVideo () != null ) {
256+ return BidType .video ;
257+ }
258+ if (bid .getNativeResponse () != null ) {
259+ return BidType .xNative ;
260+ }
261+ return BidType .banner ;
262+ }
263+
254264 private Bid makeBid (MediasquareBid bid , BidType bidType ) {
255265 return Bid .builder ()
256266 .id (bid .getId ())
@@ -263,14 +273,14 @@ private Bid makeBid(MediasquareBid bid, BidType bidType) {
263273 .crid (bid .getCreativeId ())
264274 .mtype (bidType .ordinal () + 1 )
265275 .burl (bid .getBurl ())
266- .ext (getBidExt (bid ))
276+ .ext (getBidExt (bid , bidType ))
267277 .build ();
268278 }
269279
270- private ObjectNode getBidExt (MediasquareBid bid ) {
280+ private ObjectNode getBidExt (MediasquareBid bid , BidType bidType ) {
271281 final ExtBidPrebidMeta meta = ExtBidPrebidMeta .builder ()
272282 .advertiserDomains (bid .getAdomain () != null ? bid .getAdomain () : null )
273- .mediaType (getBidType ( bid ) .getName ())
283+ .mediaType (bidType .getName ())
274284 .build ();
275285
276286 final ExtBidPrebid prebid = ExtBidPrebid .builder ().meta (meta ).build ();
@@ -283,14 +293,4 @@ private ObjectNode getBidExt(MediasquareBid bid) {
283293
284294 return bidExt ;
285295 }
286-
287- private static BidType getBidType (MediasquareBid bid ) {
288- if (bid .getVideo () != null ) {
289- return BidType .video ;
290- }
291- if (bid .getNativeResponse () != null ) {
292- return BidType .xNative ;
293- }
294- return BidType .banner ;
295- }
296296}
0 commit comments