37
37
import com .jacamars .dsp .rtb .pojo .BidResponse ;
38
38
import com .jacamars .dsp .rtb .pojo .Impression ;
39
39
import com .jacamars .dsp .rtb .pojo .Video ;
40
+ import com .jacamars .dsp .rtb .tools .GeoPatch ;
40
41
41
42
interface Command {
42
43
void runCommand (BidRequest br , RealtimeBidding .BidRequest x , ObjectNode root , Map db , String key ) throws Exception ;
@@ -49,7 +50,7 @@ public class AdxBidRequest extends BidRequest {
49
50
50
51
static Map <String , Command > methodMap = new HashMap <String , Command >();
51
52
52
- static AdxGeoCodes lookingGlass = (AdxGeoCodes ) LookingGlass .symbols .get ("@ADXGEO" );
53
+ public static AdxGeoCodes lookingGlass = (AdxGeoCodes ) LookingGlass .symbols .get ("@ADXGEO" );
53
54
54
55
static {
55
56
@@ -173,15 +174,19 @@ public void runCommand(BidRequest br, RealtimeBidding.BidRequest x, ObjectNode r
173
174
AdxGeoCode item = lookingGlass .query (geoKey );
174
175
if (item != null ) {
175
176
String type = item .type .toLowerCase ();
176
- if (type .equals ("city" ) == false ) {
177
+ if (type .equals ("city" )) {
177
178
LookingGlass cz = (LookingGlass ) LookingGlass .symbols .get ("@ZIPCODES" );
178
179
179
- if (cz != null ) {
180
+ if (cz != null && postal != null ) {
180
181
String [] parts = (String []) cz .query (postal );
181
182
if (parts != null ) {
182
183
geo .put ("city" , parts [3 ]);
183
184
geo .put ("state" , parts [4 ]);
184
- geo .put ("county" , parts [5 ]);
185
+ geo .put ("region" , parts [5 ]);
186
+ }
187
+ } else {
188
+ if (GeoPatch .getInstance () != null ) {
189
+ GeoPatch .getInstance ().patch (device );
185
190
}
186
191
}
187
192
} else {
@@ -199,6 +204,15 @@ public void runCommand(BidRequest br, RealtimeBidding.BidRequest x, ObjectNode r
199
204
}
200
205
}
201
206
geo .put ("country" , item .iso3 );
207
+ if (geo .get ("city" )==null ) {
208
+ if (GeoPatch .getInstance () != null ) {
209
+ GeoPatch .getInstance ().patch (device );
210
+ }
211
+ }
212
+ }
213
+ } else {
214
+ if (GeoPatch .getInstance () != null ) {
215
+ GeoPatch .getInstance ().patch (device );
202
216
}
203
217
}
204
218
@@ -939,6 +953,11 @@ protected static String convertToHex(ByteString ip) {
939
953
}
940
954
return sb .toString ();
941
955
}
956
+
957
+ public static void setCrypto (String ekey , String ikey ) {
958
+ AdxWinObject .encryptionKeyBytes = e_key = javax .xml .bind .DatatypeConverter .parseBase64Binary (ekey );
959
+ AdxWinObject .integrityKeyBytes = i_key = javax .xml .bind .DatatypeConverter .parseBase64Binary (ikey );
960
+ }
942
961
943
962
@ Override
944
963
public void handleConfigExtensions (Map extension ) {
@@ -950,7 +969,6 @@ public void handleConfigExtensions(Map extension) {
950
969
}
951
970
952
971
AdxWinObject .encryptionKeyBytes = e_key = javax .xml .bind .DatatypeConverter .parseBase64Binary (ekey );
953
-
954
972
AdxWinObject .integrityKeyBytes = i_key = javax .xml .bind .DatatypeConverter .parseBase64Binary (ikey );
955
973
}
956
974
0 commit comments