正在查看: OLX India v19.42.007 应用的 b.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: OLX India v19.42.007 应用的 b.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.payu.gpay.utils;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;
import android.view.View;
import android.view.WindowManager;
import android.webkit.CookieManager;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import com.payu.checkoutpro.utils.PayUCheckoutProConstants;
import com.payu.gpay.GPay;
import com.payu.gpay.f;
import com.payu.otpassist.utils.Constants;
import com.payu.socketverification.widgets.PayUProgressDialog;
import com.payu.ui.model.utils.AnalyticsConstant;
import com.payu.upisdk.util.UpiConstant;
import java.lang.ref.WeakReference;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.StringTokenizer;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class b {
public static PayUProgressDialog a;
public static AlertDialog.Builder a(Activity activity, DialogInterface.OnClickListener onClickListener, String str, String str2, String str3, String str4) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity, f.payu_network_dialog);
if (onClickListener != null) {
if (str3 != null) {
builder.setTitle(str3);
}
if (str4 != null) {
builder.setMessage(str4);
}
if (str != null) {
builder.setPositiveButton(str, onClickListener);
}
if (str2 != null) {
builder.setNegativeButton(str2, onClickListener);
}
}
return builder;
}
private static Long b(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
return Long.valueOf(memoryInfo.availMem / 1048576);
}
private static String c() {
StackTraceElement stackTraceElement = null;
for (StackTraceElement stackTraceElement2 : Thread.currentThread().getStackTrace()) {
if (stackTraceElement2.getClassName().startsWith("com.payu")) {
stackTraceElement = stackTraceElement2;
}
}
if (stackTraceElement != null) {
return stackTraceElement.getClassName();
}
return null;
}
public static String e(Context context, String str, String str2, String str3, String str4, String str5) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("txnid", str4);
jSONObject.put("merchant_key", str3);
jSONObject.put("event_key", str);
jSONObject.put("event_value", URLEncoder.encode(str2, "UTF-8"));
jSONObject.put("package_name", context.getPackageName());
jSONObject.put("ts", p());
jSONObject.put("gpay_sdk_version", "3.1.5");
jSONObject.put("application_version", q(context));
jSONObject.put("event_severity", "low");
jSONObject.put("sdk_name", "gpay");
jSONObject.put("platform", "android");
jSONObject.put("event_type", str5);
if (!TextUtils.isEmpty(GPay.cb_version_name)) {
jSONObject.put(UpiConstant.CB_VERSION_NAME, GPay.cb_version_name);
}
if (!TextUtils.isEmpty(GPay.upi_sdk_version)) {
jSONObject.put(UpiConstant.SDK_VERSION_NAME, GPay.upi_sdk_version + "");
}
jSONObject.put("application_version", q(context));
jSONObject.put("sdkIntegration", c());
jSONObject.put("originSDK", m());
jSONObject.put(AnalyticsConstant.CP_DEVICE_DETAILS, (Build.MANUFACTURER.toUpperCase() + "(" + Build.MODEL + ")") + "_Android(" + Build.VERSION.SDK_INT + ")_Memory(" + Long.valueOf((b(context).longValue() * 100) / l(context).longValue()) + "% Free)");
c.a(jSONObject.toString());
return jSONObject.toString();
} catch (Exception e) {
e.printStackTrace();
return "{}";
}
}
private String f(HashMap hashMap) {
StringBuilder sb = new StringBuilder();
for (String str : hashMap.keySet()) {
sb.append(str);
sb.append(Constants.EQUALS);
sb.append((String) hashMap.get(str));
sb.append(Constants.AMPERSAND);
}
return sb.toString().substring(0, sb.lastIndexOf(Constants.AMPERSAND));
}
public static ArrayList g(String str) {
if (str == null || str.length() <= 0) {
return null;
}
ArrayList arrayList = new ArrayList(Arrays.asList(str.split(",")));
for (int i = 0; i < arrayList.size(); i++) {
c.a("Value " + arrayList.get(i));
}
return arrayList;
}
public static void i(Activity activity) {
PayUProgressDialog payUProgressDialog;
WeakReference weakReference = new WeakReference(activity);
if (weakReference.get() == null || ((Activity) weakReference.get()).isFinishing() || ((Activity) weakReference.get()).isDestroyed() || (payUProgressDialog = a) == null || !payUProgressDialog.isShowing()) {
return;
}
try {
a.dismiss();
a = null;
} catch (WindowManager.BadTokenException | IllegalArgumentException e) {
if (e.getMessage() != null) {
c.a("Catched Exception " + e.getMessage());
}
}
}
public static void j(Activity activity, View view) {
WeakReference weakReference = new WeakReference(activity);
if (weakReference.get() == null || ((Activity) weakReference.get()).isFinishing() || ((Activity) weakReference.get()).isDestroyed()) {
return;
}
if (a == null) {
a = new PayUProgressDialog((Context) weakReference.get(), view);
}
if (view == null) {
a.setPayUDialogSettings((Context) weakReference.get());
}
a.setCancelable(false);
try {
a.show();
} catch (WindowManager.BadTokenException | IllegalStateException e) {
if (e.getMessage() != null) {
c.a("Catched Exception " + e.getMessage());
}
}
}
public static boolean k(com.payu.gpay.c cVar) {
if (cVar != null) {
return cVar.g().booleanValue();
}
return false;
}
private static Long l(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo);
return Long.valueOf(memoryInfo.totalMem / 1048576);
}
private static String m() {
StackTraceElement stackTraceElement;
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
int i = 0;
while (true) {
if (i >= stackTrace.length) {
stackTraceElement = null;
break;
}
stackTraceElement = stackTrace[i];
if (stackTraceElement.getClassName().startsWith("com.payu")) {
break;
}
i++;
}
if (stackTraceElement != null) {
return stackTraceElement.getClassName();
}
return null;
}
public static void o(Activity activity) {
try {
Bundle bundle = activity.getPackageManager().getApplicationInfo(activity.getPackageName(), 128).metaData;
String str = bundle.getString(UpiConstant.PAYU_WEB_SERVICE_URL, UpiConstant.PRODUCTION_FETCH_DATA_URL) + UpiConstant.MERCHANT_POST_SERVICE_FORM;
String str2 = bundle.getString(UpiConstant.PAYU_POST_URL, "https://secure.payu.in") + UpiConstant._PAYMENT;
a aVar = a.SINGLETON;
aVar.setWebServiceUrl(str);
aVar.setPostUrl(str2);
} catch (PackageManager.NameNotFoundException e) {
c.a("Exception metadata " + e.getMessage());
e.printStackTrace();
}
}
public static String p() {
try {
return new SimpleDateFormat(PayUCheckoutProConstants.CP_TIME_FORMAT).format(new Date(System.currentTimeMillis()));
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
private static String q(Context context) {
try {
return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return "";
}
}
public static String r(String str) {
try {
return new String(Base64.decode(str, 0));
} catch (IllegalArgumentException unused) {
return null;
}
}
public static HashMap s(String str) {
String str2;
HashMap hashMap = new HashMap();
if (str != null) {
StringTokenizer stringTokenizer = new StringTokenizer(str, Constants.AMPERSAND);
c.a("Tokens count " + stringTokenizer.countTokens());
while (stringTokenizer.hasMoreTokens()) {
String[] split = stringTokenizer.nextToken().split(Constants.EQUALS);
if (split != null && split.length > 0 && (str2 = split[0]) != null) {
hashMap.put(str2, split.length > 1 ? split[1] : "");
}
}
}
return hashMap;
}
public static boolean t(Context context) {
try {
context.getPackageManager().getPackageInfo("com.google.android.apps.nbu.paisa.user", 0);
return true;
} catch (PackageManager.NameNotFoundException unused) {
return false;
}
}
public static String u(String str) {
if (str != null && !str.isEmpty()) {
try {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("result")) {
JSONObject jSONObject2 = jSONObject.getJSONObject("result");
if (jSONObject2.has(AnalyticsConstant.CP_GV_STATUS.toLowerCase())) {
return jSONObject2.getString(AnalyticsConstant.CP_GV_STATUS.toLowerCase());
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
return "failure";
}
public static boolean v(String str) {
try {
c.a("Json response " + str);
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("ibiboCodes")) {
JSONObject jSONObject2 = jSONObject.getJSONObject("ibiboCodes");
if (jSONObject2.has("upi")) {
if (jSONObject2.getJSONObject("upi").has("TEZ".toUpperCase())) {
return true;
}
}
}
} catch (JSONException unused) {
}
return false;
}
public String d(Context context, String str) {
StringBuilder sb = new StringBuilder();
try {
String cookie = CookieManager.getInstance().getCookie(str);
if (cookie != null) {
for (String str2 : cookie.split(";")) {
String[] split = str2.split(Constants.EQUALS);
sb.append(split[0]);
sb.append(Constants.EQUALS);
sb.append(split[1]);
sb.append(";");
}
}
if (sb.length() > 0) {
sb = new StringBuilder(sb.substring(0, sb.length() - 1));
}
} catch (Exception e) {
e.printStackTrace();
}
return sb.toString();
}
public HttpsURLConnection h(String str, String str2, int i, String str3) {
try {
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(new URL(str).openConnection()));
httpsURLConnection.setRequestMethod("POST");
if (i != -1) {
httpsURLConnection.setConnectTimeout(i);
}
httpsURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
if (str2 != null) {
httpsURLConnection.setRequestProperty("Content-Length", String.valueOf(str2.length()));
}
if (str3 != null) {
httpsURLConnection.setRequestProperty("Cookie", str3);
}
httpsURLConnection.setDoOutput(true);
if (str2 != null) {
httpsURLConnection.getOutputStream().write(str2.getBytes());
}
return httpsURLConnection;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public String n(String str) {
HashMap s = s(str);
String str2 = s.containsKey("sdk_platform") ? (String) s.get("sdk_platform") : "";
try {
JSONArray jSONArray = !TextUtils.isEmpty(str2) ? new JSONArray(str2) : new JSONArray();
JSONObject jSONObject = new JSONObject();
jSONObject.put("platform", "android");
jSONObject.put("name", "gpay");
jSONObject.put("version", "3.1.5");
jSONArray.put(jSONObject);
s.put("sdk_platform", jSONArray.toString());
return f(s);
} catch (JSONException unused) {
return f(s);
}
}
}