4
4
import com .fasterxml .jackson .core .JsonProcessingException ;
5
5
import com .fasterxml .jackson .core .type .TypeReference ;
6
6
import com .fasterxml .jackson .databind .JsonNode ;
7
- import com .fasterxml .jackson .databind .node .ArrayNode ;
8
7
import com .fasterxml .jackson .databind .node .ObjectNode ;
9
8
import com .iab .openrtb .request .BidRequest ;
10
9
import com .iab .openrtb .request .Imp ;
11
- import com .iab .openrtb .request .User ;
12
10
import com .iab .openrtb .response .Bid ;
13
11
import com .iab .openrtb .response .BidResponse ;
14
12
import com .iab .openrtb .response .SeatBid ;
26
24
import org .prebid .server .json .DecodeException ;
27
25
import org .prebid .server .json .JacksonMapper ;
28
26
import org .prebid .server .proto .openrtb .ext .ExtPrebid ;
29
- import org .prebid .server .proto .openrtb .ext .request .ConsentedProvidersSettings ;
30
- import org .prebid .server .proto .openrtb .ext .request .ExtUser ;
31
27
import org .prebid .server .proto .openrtb .ext .request .improvedigital .ExtImpImprovedigital ;
32
28
import org .prebid .server .proto .openrtb .ext .response .BidType ;
33
29
import org .prebid .server .util .BidderUtil ;
34
30
import org .prebid .server .util .HttpUtil ;
35
- import org .prebid .server .util .ObjectUtil ;
36
31
37
32
import java .util .ArrayList ;
38
33
import java .util .Collection ;
@@ -50,10 +45,6 @@ public class ImprovedigitalBidder implements Bidder<BidRequest> {
50
45
private static final TypeReference <ExtPrebid <?, ExtImpImprovedigital >> IMPROVEDIGITAL_EXT_TYPE_REFERENCE =
51
46
new TypeReference <>() {
52
47
};
53
- private static final String CONSENT_PROVIDERS_SETTINGS_OUT_KEY = "consented_providers_settings" ;
54
- private static final String CONSENTED_PROVIDERS_KEY = "consented_providers" ;
55
- private static final String REGEX_SPLIT_STRING_BY_DOT = "\\ ." ;
56
-
57
48
private static final String IS_REWARDED_INVENTORY_FIELD = "is_rewarded_inventory" ;
58
49
private static final JsonPointer IS_REWARDED_INVENTORY_POINTER
59
50
= JsonPointer .valueOf ("/prebid/" + IS_REWARDED_INVENTORY_FIELD );
@@ -89,46 +80,6 @@ public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest request
89
80
return Result .withValues (httpRequests );
90
81
}
91
82
92
- private ExtUser getAdditionalConsentProvidersUserExt (ExtUser extUser ) {
93
- final String consentedProviders = ObjectUtil .getIfNotNull (
94
- ObjectUtil .getIfNotNull (extUser , ExtUser ::getConsentedProvidersSettings ),
95
- ConsentedProvidersSettings ::getConsentedProviders );
96
-
97
- if (StringUtils .isBlank (consentedProviders )) {
98
- return extUser ;
99
- }
100
-
101
- final String [] consentedProvidersParts = StringUtils .split (consentedProviders , "~" );
102
- final String consentedProvidersPart = consentedProvidersParts .length > 1 ? consentedProvidersParts [1 ] : null ;
103
- if (StringUtils .isBlank (consentedProvidersPart )) {
104
- return extUser ;
105
- }
106
-
107
- return fillExtUser (extUser , consentedProvidersPart .split (REGEX_SPLIT_STRING_BY_DOT ));
108
- }
109
-
110
- private ExtUser fillExtUser (ExtUser extUser , String [] arrayOfSplitString ) {
111
- final JsonNode consentProviderSettingJsonNode ;
112
- try {
113
- consentProviderSettingJsonNode = customJsonNode (arrayOfSplitString );
114
- } catch (IllegalArgumentException e ) {
115
- throw new PreBidException (e .getMessage ());
116
- }
117
-
118
- return mapper .fillExtension (extUser , consentProviderSettingJsonNode );
119
- }
120
-
121
- private JsonNode customJsonNode (String [] arrayOfSplitString ) {
122
- final Integer [] integers = mapper .mapper ().convertValue (arrayOfSplitString , Integer [].class );
123
- final ArrayNode arrayNode = mapper .mapper ().createArrayNode ();
124
- for (Integer integer : integers ) {
125
- arrayNode .add (integer );
126
- }
127
-
128
- return mapper .mapper ().createObjectNode ().set (CONSENT_PROVIDERS_SETTINGS_OUT_KEY ,
129
- mapper .mapper ().createObjectNode ().set (CONSENTED_PROVIDERS_KEY , arrayNode ));
130
- }
131
-
132
83
private ExtImpImprovedigital parseImpExt (Imp imp ) {
133
84
try {
134
85
return mapper .mapper ().convertValue (imp .getExt (), IMPROVEDIGITAL_EXT_TYPE_REFERENCE ).getBidder ();
@@ -149,12 +100,8 @@ private static Imp updateImp(Imp imp) {
149
100
}
150
101
151
102
private HttpRequest <BidRequest > resolveRequest (BidRequest bidRequest , Imp imp , Integer publisherId ) {
152
- final User user = bidRequest .getUser ();
153
103
final BidRequest modifiedRequest = bidRequest .toBuilder ()
154
104
.imp (Collections .singletonList (updateImp (imp )))
155
- .user (user != null
156
- ? user .toBuilder ().ext (getAdditionalConsentProvidersUserExt (user .getExt ())).build ()
157
- : null )
158
105
.build ();
159
106
160
107
final String pathPrefix = publisherId != null && publisherId > 0
0 commit comments