S T G SuperAPPS v9.99.99版本的 MD5 值为:ec866d8c695a659ed10459d6bd169615
以下内容为反编译后的 AFValidateInAppPurchase.java 源代码,内容仅作参考
package com.appsflyer;
import android.content.Context;
import com.appsflyer.internal.aa;
import com.appsflyer.internal.model.event.Purchase;
import com.appsflyer.internal.model.event.SdkServices;
import com.appsflyer.internal.model.event.Validate;
import com.appsflyer.internal.referrer.Payload;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
public class AFValidateInAppPurchase implements Runnable {
private static String f62 = null;
private static String f63 = "https://%ssdk-services.%s/validate-android-signature";
private String f64;
private String f65;
private WeakReference<Context> f66;
private Map<String, String> f67;
private String f68;
private String f69;
private String f70;
private String f71;
static {
StringBuilder sb2 = new StringBuilder("https://%svalidate.%s/api/v");
sb2.append(AppsFlyerLibCore.SERVER_BUILD_NUMBER);
sb2.append("/androidevent?buildnumber=6.1.1&app_id=");
f62 = sb2.toString();
}
public AFValidateInAppPurchase(Context context, String str, String str2, String str3, String str4, String str5, String str6, Map<String, String> map) {
this.f66 = new WeakReference<>(context);
this.f65 = str;
this.f68 = str2;
this.f64 = str4;
this.f71 = str5;
this.f69 = str6;
this.f67 = map;
this.f70 = str3;
}
public static void setUrl(Map<String, String> map) {
for (Map.Entry<String, String> entry : map.entrySet()) {
String value = entry.getValue();
String key = entry.getKey();
char c10 = 65535;
int hashCode = key.hashCode();
if (hashCode != -1421272810) {
if (hashCode == 454162577 && key.equals("sdk-services")) {
c10 = 0;
}
} else if (key.equals("validate")) {
c10 = 1;
}
if (c10 == 0) {
f63 = value;
} else if (c10 == 1) {
f62 = value;
}
}
}
static void m43(AFValidateInAppPurchase aFValidateInAppPurchase, Map map, Map map2, WeakReference weakReference) {
if (weakReference.get() != null) {
StringBuilder sb2 = new StringBuilder();
sb2.append(ServerConfigHandler.getUrl(f62));
sb2.append(((Context) weakReference.get()).getPackageName());
String obj = sb2.toString();
String string = AppsFlyerLibCore.getSharedPreferences((Context) weakReference.get()).getString(Payload.RFR, "");
AFEvent key = new Validate((Context) weakReference.get()).key(aFValidateInAppPurchase.f65);
key.f15 = string;
AFEvent aFEvent = (Validate) key;
Map<String, Object> m117 = AppsFlyerLibCore.getInstance().m117(aFEvent);
m117.put("price", aFValidateInAppPurchase.f71);
m117.put("currency", aFValidateInAppPurchase.f69);
m117.put("receipt_data", map);
if (map2 != null) {
m117.put("extra_prms", map2);
}
aa.m150().m159("server_request", obj, new JSONObject(m117).toString());
HttpURLConnection httpURLConnection = null;
try {
httpURLConnection = m40((Purchase) aFEvent.addParams(m117).urlString(obj));
int responseCode = httpURLConnection != null ? httpURLConnection.getResponseCode() : -1;
String readServerResponse = AppsFlyerLibCore.getInstance().readServerResponse(httpURLConnection);
aa.m150().m159("server_response", obj, String.valueOf(responseCode), readServerResponse);
StringBuilder sb3 = new StringBuilder("Validate-WH response - ");
sb3.append(responseCode);
sb3.append(": ");
sb3.append(new JSONObject(readServerResponse).toString());
AFLogger.afInfoLog(sb3.toString());
} catch (Throwable th2) {
try {
AFLogger.afErrorLog(th2.getMessage(), th2);
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
} finally {
if (httpURLConnection != null) {
httpURLConnection.disconnect();
}
}
}
}
}
@Override
public void run() {
String str = this.f65;
if (str == null || str.length() == 0 || AppsFlyerLib.getInstance().isStopped()) {
return;
}
HttpURLConnection httpURLConnection = null;
try {
Context context = this.f66.get();
if (context == null) {
return;
}
HashMap hashMap = new HashMap();
hashMap.put("public-key", this.f68);
hashMap.put("sig-data", this.f64);
hashMap.put("signature", this.f70);
final HashMap hashMap2 = new HashMap(hashMap);
new Thread(new Runnable() {
@Override
public final void run() {
AFValidateInAppPurchase aFValidateInAppPurchase = AFValidateInAppPurchase.this;
AFValidateInAppPurchase.m43(aFValidateInAppPurchase, hashMap2, aFValidateInAppPurchase.f67, AFValidateInAppPurchase.this.f66);
}
}).start();
hashMap.put("dev_key", this.f65);
hashMap.put(ServerParameters.APP_ID, context.getPackageName());
hashMap.put(ServerParameters.AF_USER_ID, AppsFlyerLib.getInstance().getAppsFlyerUID(context));
hashMap.put(ServerParameters.ADVERTISING_ID_PARAM, AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM));
String jSONObject = new JSONObject(hashMap).toString();
String url = ServerConfigHandler.getUrl(f63);
aa.m150().m159("server_request", url, jSONObject);
HttpURLConnection m40 = m40((Purchase) new SdkServices().addParams(hashMap).urlString(url));
int responseCode = m40 != null ? m40.getResponseCode() : -1;
String readServerResponse = AppsFlyerLibCore.getInstance().readServerResponse(m40);
aa.m150().m159("server_response", url, String.valueOf(responseCode), readServerResponse);
JSONObject jSONObject2 = new JSONObject(readServerResponse);
jSONObject2.put("code", responseCode);
if (responseCode == 200) {
StringBuilder sb2 = new StringBuilder("Validate response 200 ok: ");
sb2.append(jSONObject2.toString());
AFLogger.afInfoLog(sb2.toString());
m42(jSONObject2.optBoolean("result"), this.f64, this.f71, this.f69, jSONObject2.toString());
} else {
AFLogger.afInfoLog("Failed Validate request");
m42(false, this.f64, this.f71, this.f69, jSONObject2.toString());
}
if (m40 != null) {
m40.disconnect();
}
} catch (Throwable th2) {
try {
if (AppsFlyerLibCore.f79 != null) {
AFLogger.afErrorLog("Failed Validate request + ex", th2);
m42(false, this.f64, this.f71, this.f69, th2.getMessage());
}
AFLogger.afErrorLog(th2.getMessage(), th2);
} finally {
if (0 != 0) {
httpURLConnection.disconnect();
}
}
}
}
private static HttpURLConnection m40(Purchase purchase) {
StringBuilder sb2 = new StringBuilder("Calling ");
sb2.append(purchase.urlString());
AFLogger.afDebugLog(sb2.toString());
return new BackgroundHttpTask(purchase.trackingStopped(AppsFlyerLib.getInstance().isStopped())).doInBackground();
}
private static void m42(boolean z10, String str, String str2, String str3, String str4) {
if (AppsFlyerLibCore.f79 != null) {
StringBuilder sb2 = new StringBuilder("Validate callback parameters: ");
sb2.append(str);
sb2.append(" ");
sb2.append(str2);
sb2.append(" ");
sb2.append(str3);
AFLogger.afDebugLog(sb2.toString());
if (z10) {
AFLogger.afDebugLog("Validate in app purchase success: ".concat(String.valueOf(str4)));
AppsFlyerLibCore.f79.onValidateInApp();
return;
}
AFLogger.afDebugLog("Validate in app purchase failed: ".concat(String.valueOf(str4)));
AppsFlyerInAppPurchaseValidatorListener appsFlyerInAppPurchaseValidatorListener = AppsFlyerLibCore.f79;
if (str4 == null) {
str4 = "Failed validating";
}
appsFlyerInAppPurchaseValidatorListener.onValidateInAppFailure(str4);
}
}
}