正在查看: Oolka v2.4.42 应用的 TrackerFallback.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Oolka v2.4.42 应用的 TrackerFallback.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package in.juspay.hypersdk.utils;
import in.juspay.hyper.constants.LogCategory;
import in.juspay.hyper.core.ExecutorManager;
import in.juspay.hypersdk.core.JuspayServices;
import in.juspay.hypersdk.core.PaymentConstants;
import in.juspay.hypersdk.utils.network.NetUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import okhttp3.Response;
import org.json.JSONObject;
public class TrackerFallback {
private int count;
private boolean enableTrackerFallback;
private NetUtils netUtils;
private List<String> requiredKeysList;
public TrackerFallback(JSONObject jSONObject) {
this.count = 3;
if (jSONObject == null || !jSONObject.has("enableTrackerFallback")) {
return;
}
try {
this.netUtils = new NetUtils(0, 0);
this.enableTrackerFallback = jSONObject.optBoolean("enableTrackerFallback", true);
this.count = jSONObject.optInt("trackerFallbackAttempts", 3);
this.requiredKeysList = Arrays.asList(LogCategory.ACTION, PaymentConstants.ORDER_ID_CAMEL, PaymentConstants.CLIENT_ID_CAMEL, PaymentConstants.MERCHANT_ID_CAMEL, "customerId", "os", "os_version", "app_version", "requestId");
} catch (Exception unused) {
}
}
private HashMap<String, String> getQueryParams(JuspayServices juspayServices, JSONObject jSONObject, LogType logType) {
ArrayList arrayList = new ArrayList();
LogType logType2 = LogType.PROCESS_END;
if (logType == logType2) {
arrayList.add("errorMessage");
arrayList.add("errorCode");
}
if (logType == LogType.INITIATE_RESULT || logType == logType2) {
arrayList.add(PaymentConstants.CLIENT_ID);
arrayList.add(PaymentConstants.MERCHANT_ID);
}
JSONObject optJSONObject = jSONObject.optJSONObject(PaymentConstants.PAYLOAD);
JSONObject sessionData = juspayServices.getSessionInfo().getSessionData();
HashMap<String, String> hashMap = new HashMap<>();
List<String> list = this.requiredKeysList;
if (list != null) {
for (String str : list) {
if (optJSONObject != null && optJSONObject.has(str)) {
hashMap.put(str, optJSONObject.optString(str, ""));
} else if (sessionData.has(str)) {
hashMap.put(str, sessionData.optString(str, ""));
} else if (jSONObject.has(str)) {
hashMap.put(str, jSONObject.optString(str, ""));
}
}
}
Iterator it = arrayList.iterator();
while (it.hasNext()) {
String str2 = (String) it.next();
if (optJSONObject != null && optJSONObject.has(str2)) {
hashMap.put(str2, optJSONObject.optString(str2, ""));
} else if (jSONObject.has(str2)) {
hashMap.put(str2, jSONObject.optString(str2, ""));
}
}
hashMap.put("sessionId", juspayServices.getSessionInfo().getSessionId());
hashMap.put("logtype", logType.name());
return hashMap;
}
public void lambda$log$0(JuspayServices juspayServices, JSONObject jSONObject, LogType logType) {
try {
if (!this.enableTrackerFallback || this.netUtils == null) {
return;
}
for (int i = 0; i < this.count; i++) {
Response doGet = this.netUtils.doGet("https://assets.juspay.in/a.html", new HashMap(), getQueryParams(juspayServices, jSONObject, logType), new JSONObject(), null);
try {
if (doGet.code() == 200) {
doGet.close();
return;
}
doGet.close();
} finally {
}
}
} catch (Exception unused) {
}
}
public void log(final JSONObject jSONObject, final JuspayServices juspayServices, final LogType logType) {
ExecutorManager.runOnBackgroundThread(new Runnable() {
@Override
public final void run() {
TrackerFallback.this.lambda$log$0(juspayServices, jSONObject, logType);
}
});
}
}