OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046
以下内容为反编译后的 a.java 源代码,内容仅作参考
package com.excelliance.kxqp.payer.ali;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import com.alipay.sdk.packet.e;
import com.excelliance.kxqp.gs.ui.share.core.config.SharePlatformConfig;
import com.excelliance.kxqp.payer.Payer;
import com.umeng.analytics.pro.am;
import com.umeng.analytics.pro.d;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import org.apache.http.cookie.ClientCookie;
import org.json.JSONObject;
class a {
private static String f12685a = "RSA2";
private static String f12686b = "SHA256WithRSA";
private static String n = "paycfg";
private final Context c;
private String d = "开通畅享会员";
private String e = "开启会员可享有更多体验";
private String f = "https://sdk.ourplay.com.cn/alipay/v2/aliaid.php";
private String g = "https://sdk.ourplay.com.cn/alipay/v2/orderinfo.php";
private String h = "https://sdk.ourplay.com.cn/alipay/v2/alipay_rsasign.php";
private String i = "";
private String j;
private String k;
private String l;
private int m;
private SharedPreferences.Editor o;
private SharedPreferences p;
private Payer.PayerCallback q;
public void a(Object obj) {
}
public a(Context context) {
this.c = context;
this.o = context.getSharedPreferences("alipay", Build.VERSION.SDK_INT < 11 ? 0 : 4).edit();
this.p = context.getSharedPreferences("alipay", Build.VERSION.SDK_INT < 11 ? 0 : 4);
}
public void a() {
new Thread(new Runnable() {
@Override
public void run() {
try {
HttpURLConnection a2 = com.excelliance.kxqp.payer.a.a(a.this.f);
if (a2 != null) {
String d = a.this.d();
DataOutputStream dataOutputStream = new DataOutputStream(a2.getOutputStream());
dataOutputStream.writeBytes(d);
dataOutputStream.flush();
dataOutputStream.close();
if (a2.getResponseCode() == 200) {
String str = "";
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(a2.getInputStream()));
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
str = str + readLine;
}
bufferedReader.close();
if (a.this.k(str)) {
a.this.o.putString(a.n, str).commit();
} else {
a.this.a((Object) "cfg is empty...");
}
} else {
Log.d("lyl", "cfg net read error...");
}
} else {
Log.d("lyl", "cfg net error...");
}
if (!a.this.k(a.this.p.getString(a.n, ""))) {
a.this.a((Object) "cfg is empty again...");
}
Map c = a.this.c();
a.this.a((Object) ("orderParam: charge = " + a.this.j));
if (c != null && c.size() != 0) {
String b2 = com.excelliance.kxqp.payer.a.b((Map<String, String>) c);
String a3 = com.excelliance.kxqp.payer.a.a((Map<String, String>) c);
a.this.a((Object) ("orderParam: " + a3));
String b3 = com.excelliance.kxqp.payer.a.b(a3);
a.this.a((Object) ("encodeOrderParam: " + b3));
HttpURLConnection a4 = com.excelliance.kxqp.payer.a.a(a.this.h);
if (a4 != null) {
if (b3 != null) {
DataOutputStream dataOutputStream2 = new DataOutputStream(a4.getOutputStream());
a.this.a((Object) ("out: " + dataOutputStream2));
dataOutputStream2.writeBytes(b3);
dataOutputStream2.flush();
dataOutputStream2.close();
}
if (a4.getResponseCode() == 200) {
String str2 = "";
BufferedReader bufferedReader2 = new BufferedReader(new InputStreamReader(a4.getInputStream()));
while (true) {
String readLine2 = bufferedReader2.readLine();
if (readLine2 == null) {
break;
}
str2 = str2 + readLine2;
}
a.this.a((Object) ("run result: " + str2));
bufferedReader2.close();
if (!TextUtils.isEmpty(str2)) {
a.this.a("sign=" + URLEncoder.encode(com.excelliance.kxqp.payer.a.b(str2, "base64"), "UTF-8"), b2);
return;
}
throw new b("sign error");
}
throw new b("net error");
}
throw new b("net error");
}
a.this.a((Object) ("orderParam: error params = " + c));
} catch (Exception e) {
Log.e("AliController", "e:" + e);
a.this.a(e);
}
}
}).start();
}
public void a(Exception exc) {
b bVar;
if (this.q != null) {
if (exc instanceof b) {
bVar = (b) exc;
} else {
bVar = new b(d.O);
}
this.q.onFail(bVar);
}
}
public void a(String str, String str2) {
try {
if (this.q != null) {
this.q.onStartPay();
}
a((Object) ("sign: " + str));
a((Object) ("orderParamUTF: " + str2));
String str3 = str2 + com.alipay.sdk.sys.a.f472b + str;
Object a2 = a(new Class[]{Activity.class}, new Object[]{this.c}, "com.alipay.sdk.app.PayTask");
a((Object) ("payTask:" + a2));
Map<String, String> map = (Map) a(new Class[]{String.class, Boolean.TYPE}, new Object[]{str3, true}, "payV2", a2);
a((Object) ("result:" + map));
if (this.q != null) {
this.q.onSuccess(map);
}
} catch (Exception e) {
e.printStackTrace();
a((Object) ("e:" + e));
a(e);
}
}
public void a(String str) {
try {
if (this.q != null) {
this.q.onStartPay();
}
a((Object) ("orderParamUTF: " + str));
Object a2 = a(new Class[]{Activity.class}, new Object[]{this.c}, "com.alipay.sdk.app.PayTask");
a((Object) ("payTask:" + a2));
Map<String, String> map = (Map) a(new Class[]{String.class, Boolean.TYPE}, new Object[]{str, true}, "payV2", a2);
a((Object) ("result:" + map));
if (this.q != null) {
this.q.onSuccess(map);
}
} catch (Exception e) {
e.printStackTrace();
a((Object) ("e:" + e));
a(e);
}
}
private Object a(Class[] clsArr, Object[] objArr, String str) throws Exception {
return Class.forName(str, false, this.c.getApplicationContext().getClassLoader()).getDeclaredConstructor(clsArr).newInstance(objArr);
}
private Object a(Class[] clsArr, Object[] objArr, String str, Object obj) throws Exception {
return obj.getClass().getMethod(str, clsArr).invoke(obj, objArr);
}
public Map<String, String> c() {
HashMap hashMap = new HashMap();
try {
if (!TextUtils.isEmpty(this.j)) {
if (Double.parseDouble(this.j) > 0.0d) {
Float.parseFloat(this.j);
hashMap.put(SharePlatformConfig.APP_ID, this.i);
hashMap.put("biz_content", "{\"timeout_express\":\"30m\",\"product_code\":\"QUICK_MSECURITY_PAY\",\"total_amount\":\"" + this.j + "\",\"subject\":\"" + this.d + "\",\"body\":\"" + this.e + "\",\"out_trade_no\":\"" + d() + "\"}");
hashMap.put("charset", "utf-8");
hashMap.put(e.q, "alipay.trade.app.pay");
hashMap.put(com.alipay.sdk.tid.b.f, com.excelliance.kxqp.payer.a.a(System.currentTimeMillis()));
hashMap.put(ClientCookie.VERSION_ATTR, "1.0");
String str = this.g;
String string = this.p.getString("paycfg", "");
String str2 = null;
String str3 = f12685a;
String str4 = f12686b;
if (!TextUtils.isEmpty(string)) {
try {
JSONObject jSONObject = new JSONObject(new JSONObject(new String(Base64.decode(string.getBytes(), 0))).optString("ali"));
String optString = jSONObject.optString("nurl");
if (optString != null && optString.length() > 0) {
str2 = optString;
}
String optString2 = jSONObject.optString("stype");
if (optString2 != null && optString2.length() > 0) {
str3 = optString2;
}
String optString3 = jSONObject.optString("salg");
if (optString3 != null) {
if (optString3.length() > 0) {
str4 = optString3;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (str3 != null && str3.length() > 0) {
if (str3.equalsIgnoreCase("RSA")) {
f12685a = "RSA";
} else {
f12685a = str3;
}
hashMap.put("sign_type", str3);
}
if (str4 != null && str4.length() > 0) {
f12686b = str4;
}
if (str2 != null && str2.length() > 0) {
str = str2;
}
hashMap.put("notify_url", str);
return hashMap;
}
}
return hashMap;
} catch (NumberFormatException unused) {
return hashMap;
}
}
public String d() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(com.excelliance.kxqp.payer.a.c(com.excelliance.kxqp.payer.a.a(this.c, "VersionCode")));
stringBuffer.append("_");
stringBuffer.append(com.excelliance.kxqp.payer.a.c(com.excelliance.kxqp.payer.a.a(this.c, "MainChId")));
stringBuffer.append("_");
stringBuffer.append(com.excelliance.kxqp.payer.a.c(com.excelliance.kxqp.payer.a.a(this.c, "SubChId")));
stringBuffer.append("_");
stringBuffer.append(com.excelliance.kxqp.payer.a.a(this.c));
stringBuffer.append("_");
stringBuffer.append(com.excelliance.kxqp.payer.a.c(this.l));
stringBuffer.append("_");
stringBuffer.append(am.aC);
stringBuffer.append("_");
stringBuffer.append(com.excelliance.kxqp.payer.a.c(this.k));
stringBuffer.append("_");
stringBuffer.append(com.excelliance.kxqp.payer.a.c(String.valueOf(this.m)));
stringBuffer.append("_");
stringBuffer.append(new Random().nextInt());
String stringBuffer2 = stringBuffer.toString();
a((Object) ("getOutTradeNo key: " + stringBuffer2 + " flag: " + this.m));
return stringBuffer2.length() > 64 ? stringBuffer2.substring(0, 64) : stringBuffer2;
}
public boolean k(String str) {
if (!TextUtils.isEmpty(str)) {
String str2 = new String(Base64.decode(str.getBytes(), 0));
a((Object) ("fetchSignResult: decode cfg = " + str2));
try {
JSONObject jSONObject = new JSONObject(new JSONObject(str2).optString("ali"));
String optString = jSONObject.optString("appid");
String optString2 = jSONObject.optString("surl");
String optString3 = jSONObject.optString("nurl");
if (optString != null && optString.length() > 0) {
this.i = optString;
}
if (optString2 != null && optString2.length() > 0) {
this.h = optString2;
}
if (optString3 == null || optString3.length() <= 0) {
return true;
}
this.g = optString3;
return true;
} catch (Exception e) {
e.printStackTrace();
}
}
return false;
}
public void b(String str) {
this.d = str;
}
public void c(String str) {
this.e = str;
}
public void d(String str) {
this.f = str;
}
public void e(String str) {
this.g = str;
}
public void f(String str) {
this.h = str;
}
public void g(String str) {
this.i = str;
}
public void h(String str) {
this.j = str;
}
public void i(String str) {
this.k = str;
}
public void j(String str) {
this.l = str;
}
public void a(int i) {
this.m = i;
}
public static class C0496a {
public final Context f12688a;
public String f12689b;
public String c;
public String d;
public String e;
public String f;
public String g;
public String h;
public String i;
public String j;
public int k;
public Payer.PayerCallback l;
public C0496a(Context context) {
this.f12688a = context;
}
public void a(a aVar) {
if (this.f12689b != null) {
aVar.d = this.f12689b;
}
if (this.c != null) {
aVar.e = this.c;
}
if (this.d != null) {
aVar.f = this.d;
}
if (this.e != null) {
aVar.g = this.e;
}
if (this.f != null) {
aVar.h = this.f;
}
if (this.g != null) {
aVar.i = this.g;
}
if (this.i != null) {
aVar.k = this.i;
}
if (this.j != null) {
aVar.l = this.j;
}
if (this.l != null) {
aVar.q = this.l;
}
aVar.h(this.h);
aVar.a(this.k);
}
}
}