package com.tencent.kinda.framework.module.impl; import a74.f; import a74.r; import android.app.Activity; import android.content.ComponentName; import android.content.Intent; import android.content.pm.PackageInfo; import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.util.Base64; import com.google.android.gms.common.util.AndroidUtilsLight; import com.google.android.gms.dynamite.ProviderConstants; import com.tencent.cso.CsoLoader; import com.tencent.kinda.framework.widget.tools.KindaContext; import com.tencent.kinda.gen.ITransmitKvData; import com.tencent.kinda.gen.KThirdPayService; import com.tencent.kinda.gen.VoidITransmitKvDataCallback; import com.tencent.mm.framework.app.UIPageFragmentActivity; import com.tencent.mm.framework.app.modal.DCEPHandler$startDCEPPay$observer$1; import com.tencent.mm.pluginsdk.model.app.j0; import com.tencent.mm.sdk.platformtools.Log; import com.tencent.mm.sdk.platformtools.MMApplicationContext; import com.tencent.mm.ui.MMActivity; import com.tencent.mm.ui.MMFragmentActivity; import com.unionpay.UPPayWapActivity; import com.unionpay.a; import com.unionpay.utils.UPUtils; import ie1.h; import java.lang.ref.WeakReference; import java.util.HashMap; import java.util.concurrent.Executors; import k30.c; import kotlin.Metadata; import lh4.h; import lh4.m; import mg4.e; import org.json.JSONArray; import org.json.JSONObject; import q20.b; import yz3.j; @Metadata(bv = {}, d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\t\u0018\u0000 \u00132\u00020\u0001:\u0001\u0013B\u0007¢\u0006\u0004\b\u0011\u0010\u0012J\u001c\u0010\u0007\u001a\u00020\u00062\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016J\b\u0010\t\u001a\u00020\bH\u0016J0\u0010\r\u001a\u00020\u00062\b\u0010\u0003\u001a\u0004\u0018\u00010\u00022\b\u0010\n\u001a\u0004\u0018\u00010\u00022\b\u0010\f\u001a\u0004\u0018\u00010\u000b2\b\u0010\u0005\u001a\u0004\u0018\u00010\u0004H\u0016J\b\u0010\u000e\u001a\u00020\bH\u0016R\u0016\u0010\u000f\u001a\u00020\b8\u0002@\u0002X\u000e¢\u0006\u0006\n\u0004\b\u000f\u0010\u0010¨\u0006\u0014"}, d2 = {"Lcom/tencent/kinda/framework/module/impl/KindaThirdPayService;", "Lcom/tencent/kinda/gen/KThirdPayService;", "", "tn", "Lcom/tencent/kinda/gen/VoidITransmitKvDataCallback;", "resultCallback", "Lwg4/b0;", "startYunShanFuPayImpl", "", "isYunShanFuAppInstalled", "requestUrl", "Lcom/tencent/kinda/gen/ITransmitKvData;", "extra", "startDcepPayImpl", "isDcepAppInstalled", "hasCallbacked", "Z", "<init>", "()V", "Companion", "kinda-framework-lib_release"}, k = 1, mv = {1, 7, 1}) public final class KindaThirdPayService implements KThirdPayService { public static final Companion Companion = new Companion(null); private static final int REQUEST_YUNSHANFU = 10; private static final String TAG = "MicroMsg.KindaThirdPayService"; private boolean hasCallbacked; @Metadata(d1 = {"\u0000\u0018\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002R\u000e\u0010\u0003\u001a\u00020\u0004XT¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006XT¢\u0006\u0002\n\u0000¨\u0006\u0007"}, d2 = {"Lcom/tencent/kinda/framework/module/impl/KindaThirdPayService$Companion;", "", "()V", "REQUEST_YUNSHANFU", "", "TAG", "", "kinda-framework-lib_release"}, k = 1, mv = {1, 7, 1}, xi = 48) public static final class Companion { private Companion() { } public /* synthetic */ Companion(h hVar) { this(); } } @Override // com.tencent.kinda.gen.KThirdPayService public boolean isDcepAppInstalled() { HashMap<String, VoidITransmitKvDataCallback> hashMap = b.f286530a; return j0.f(MMApplicationContext.getContext(), "cn.gov.pbc.dcep"); } @Override // com.tencent.kinda.gen.KThirdPayService public boolean isYunShanFuAppInstalled() { if (!((ie1.h) j.c(ie1.h.class)).Lk0(h.c.f231810dg, false)) { return a.e(MMApplicationContext.getContext()); } Log.i(TAG, "wechat check isYunShanFuAppInstalled"); return j0.f(MMApplicationContext.getContext(), "com.unionpay"); } @Override // com.tencent.kinda.gen.KThirdPayService public void startDcepPayImpl(String str, String str2, ITransmitKvData iTransmitKvData, VoidITransmitKvDataCallback voidITransmitKvDataCallback) { HashMap<String, VoidITransmitKvDataCallback> hashMap = b.f286530a; j0.f(MMApplicationContext.getContext(), "cn.gov.pbc.dcep"); boolean z15 = true; if (!(str == null || str.length() == 0)) { if (!(str2 == null || str2.length() == 0)) { z15 = false; } if (!z15 && voidITransmitKvDataCallback != null) { if (!j0.f(MMApplicationContext.getContext(), "cn.gov.pbc.dcep")) { Log.w("MicroMsg.DCEPHandler", "not installed decp app"); return; } Uri parse = Uri.parse(str2); Intent intent = new Intent("android.intent.action.VIEW"); intent.setData(parse); ComponentName resolveActivity = intent.resolveActivity(MMApplicationContext.getContext().getPackageManager()); if (resolveActivity == null || !m.b(resolveActivity.getPackageName(), "cn.gov.pbc.dcep")) { Log.w("MicroMsg.DCEPHandler", "can't find resolve activity: " + resolveActivity); } Activity topOrUIPageFragmentActivity = KindaContext.getTopOrUIPageFragmentActivity(); if (!(topOrUIPageFragmentActivity instanceof UIPageFragmentActivity)) { Log.w("MicroMsg.DCEPHandler", "current activity is not kinda activity: " + topOrUIPageFragmentActivity); return; } b.f286531b = new WeakReference<>(topOrUIPageFragmentActivity); ((MMFragmentActivity) topOrUIPageFragmentActivity).getLifecycle().addObserver(new DCEPHandler$startDCEPPay$observer$1(str, topOrUIPageFragmentActivity)); ((UIPageFragmentActivity) topOrUIPageFragmentActivity).mmSetOnActivityResultCallback(new q20.a(str)); if (str != null) { b.f286530a.put(str, voidITransmitKvDataCallback); } k30.a aVar = new k30.a(); aVar.c(intent); j30.a.d(topOrUIPageFragmentActivity, aVar.b(), "com/tencent/mm/framework/app/modal/DCEPHandler", "startDCEPPay", "(Ljava/lang/String;Ljava/lang/String;Lcom/tencent/kinda/gen/VoidITransmitKvDataCallback;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V"); topOrUIPageFragmentActivity.startActivity((Intent) aVar.a(0)); j30.a.e(topOrUIPageFragmentActivity, "com/tencent/mm/framework/app/modal/DCEPHandler", "startDCEPPay", "(Ljava/lang/String;Ljava/lang/String;Lcom/tencent/kinda/gen/VoidITransmitKvDataCallback;)V", "Undefined", "startActivity", "(Landroid/content/Intent;)V"); } } } /* JADX WARNING: Can't wrap try/catch for region: R(26:0|(1:2)|3|(1:5)(1:6)|7|(1:9)|10|(10:16|17|18|19|22|(1:24)(1:25)|26|(1:28)|29|(18:33|36|(3:38|39|(2:43|44)(1:45))|46|47|(7:(2:52|(3:54|(8:56|(1:58)(1:59)|(6:61|62|66|(2:68|(1:(1:137)(3:70|(2:72|(5:76|(3:78|79|(3:81|84|(8:86|87|88|89|90|91|92|95)(1:141)))|82|84|(0)(0)))(1:138)|97)))(0)|99|(1:136))|65|66|(0)(0)|99|(0))(2:101|(1:103)(2:105|(3:107|108|109)(1:135)))|124))|125|126|129|(1:131)|132|(2:134|142)(1:143))|111|113|(4:115|116|117|120)|121|122|123|125|126|129|(0)|132|(0)(0)))|34|36|(0)|46|47|(10:50|52|(0)|125|126|129|(0)|132|(0)(0)|124)|111|113|(0)|121|122|123|125|126|129|(0)|132|(0)(0)) */ /* JADX WARNING: Code restructure failed: missing block: B:104:?, code lost: r2 = (java.lang.String) r2.get("url"); */ /* JADX WARNING: Code restructure failed: missing block: B:127:0x0302, code lost: r13 = 0; */ /* JADX WARNING: Failed to process nested try/catch */ /* JADX WARNING: Missing exception handler attribute for start block: B:125:0x02fb */ /* JADX WARNING: Removed duplicated region for block: B:115:0x027e */ /* JADX WARNING: Removed duplicated region for block: B:131:0x0321 */ /* JADX WARNING: Removed duplicated region for block: B:134:0x0338 */ /* JADX WARNING: Removed duplicated region for block: B:136:0x02ec A[SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:141:0x0241 A[SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:143:? A[RETURN, SYNTHETIC] */ /* JADX WARNING: Removed duplicated region for block: B:38:0x010f A[SYNTHETIC, Splitter:B:38:0x010f] */ /* JADX WARNING: Removed duplicated region for block: B:54:0x0140 */ /* JADX WARNING: Removed duplicated region for block: B:68:0x0181 */ /* JADX WARNING: Removed duplicated region for block: B:86:0x01d2 A[SYNTHETIC, Splitter:B:86:0x01d2] */ @Override // com.tencent.kinda.gen.KThirdPayService public void startYunShanFuPayImpl(String str, VoidITransmitKvDataCallback voidITransmitKvDataCallback) { String str2; JSONArray jSONArray; String str3; JSONArray jSONArray2; int i15; String a15; Object a16; String str4; String str5; int i16; JSONArray jSONArray3; JSONArray b15; boolean z15; String str6; int i17; int i18; Log.i(TAG, "start yunshanfu " + str); Activity topOrUIPageFragmentActivity = KindaContext.getTopOrUIPageFragmentActivity(); if (!(topOrUIPageFragmentActivity instanceof UIPageFragmentActivity)) { Log.w(TAG, "current activity is not kinda activity"); } KindaThirdPayService$startYunShanFuPayImpl$observer$1 kindaThirdPayService$startYunShanFuPayImpl$observer$1 = new KindaThirdPayService$startYunShanFuPayImpl$observer$1(topOrUIPageFragmentActivity, this, voidITransmitKvDataCallback); m.e(topOrUIPageFragmentActivity, "null cannot be cast to non-null type com.tencent.mm.ui.MMActivity"); MMActivity mMActivity = (MMActivity) topOrUIPageFragmentActivity; mMActivity.getLifecycle().addObserver(kindaThirdPayService$startYunShanFuPayImpl$observer$1); mMActivity.mmSetOnActivityResultCallback(new KindaThirdPayService$startYunShanFuPayImpl$1(topOrUIPageFragmentActivity, kindaThirdPayService$startYunShanFuPayImpl$observer$1, this, voidITransmitKvDataCallback)); int i19 = 0; int i25 = 1; if (r.f1567a.e(f.f1534w2, 0) == 1) { str2 = "01"; } else { str2 = "00"; } boolean z16 = topOrUIPageFragmentActivity instanceof UIPageFragmentActivity; if (z16) { ((UIPageFragmentActivity) topOrUIPageFragmentActivity).f75566u = true; } a.f191804a = str; JSONArray jSONArray4 = null; a.f191805b = null; a.f191806c = null; a.f191807d = str2; a.f191808e = 0; CsoLoader.e("entryexpro"); String a17 = UPUtils.a(topOrUIPageFragmentActivity, "configs"); String a18 = UPUtils.a(topOrUIPageFragmentActivity, "mode"); String a19 = UPUtils.a(topOrUIPageFragmentActivity, "or"); String str7 = ""; if (!TextUtils.isEmpty(a17) && !TextUtils.isEmpty(a18) && !TextUtils.isEmpty(a19)) { try { JSONObject jSONObject = new JSONObject(a17); String b16 = e.b(jSONObject, "sign"); try { i18 = Integer.parseInt(a18); } catch (Exception unused) { i18 = 0; } String str8 = new String(Base64.decode(jSONObject.getString("configs"), 2)); String str9 = jSONObject.has("sePayConf") ? new String(Base64.decode(jSONObject.getString("sePayConf"), 2)) : str7; if (TextUtils.isEmpty(str9)) { str9 = str7; } String g15 = mg4.b.g(UPUtils.b(str8 + str9 + a19)); String forConfig = UPUtils.forConfig(i18, b16); if (!TextUtils.isEmpty(forConfig) && forConfig.equals(g15)) { jSONArray = new JSONArray(str8); str3 = "sort"; if (jSONArray == null) { try { i17 = Integer.parseInt(a.f191807d); } catch (Exception unused2) { i17 = 0; } if (i17 == 2) { try { jSONArray = new JSONArray("[{\"type\":\"app\",\"sort\":100,\"package_info\":[{\"schema\":\"com.unionpay\",\"version\":\".*\",\"sign\":\"236758F99B958C76AFA4634A55F6CDB37FA89A73\",\"sort\":101}],\"md5\":\"D75BB2802E61738A9A03BF014F927D9A\"},{\"sort\": 200,\"type\": \"link\",\"url\": \"https://youhui.95516.com/hybrid_v4/html/help/download.html\"}]"); } catch (Exception unused3) { } } else { jSONArray = new JSONArray("[{\"package_info\":[{\"schema\":\"com.unionpay\",\"sign\":\"536C79B93ACFBEA950AE365D8CE1AEF91FEA9535\",\"sort\":102,\"version\":\".*\"},{\"schema\":\"com.cmbc.cc.mbank\",\"sign\":\"812F343676D89E552A4820B2B52DB82D72E5119E\",\"sort\":101,\"version\":\"((9|1).*)|(8\\\\.[2-9].*)\"}],\"sort\":100,\"type\":\"app\"},{\"sort\":200,\"type\":\"link\",\"url\":\"https://youhui.95516.com/hybrid_v4/html/help/download.html\"}]"); } } a.f191810g = a.b(jSONArray, str3); jSONArray2 = a.f191810g; i15 = a.f191808e; while (true) { if (jSONArray2 != null && i15 < jSONArray2.length()) { a16 = e.a(jSONArray2, i15); if (a16 != null) { JSONObject jSONObject2 = (JSONObject) a16; String b17 = e.b(jSONObject2, "type"); if ("app".equals(b17)) { if ((jSONObject2.has("package_info") ? i25 : i19) != 0) { try { jSONArray3 = jSONObject2.getJSONArray("package_info"); } catch (Exception unused4) { e.class.toString(); } String b18 = e.b(jSONObject2, "app_server"); b15 = a.b(jSONArray3, str3); if (b15.length() > 0) { int length = b15.length(); int i26 = i19; while (true) { if (i26 >= length) { break; } Object a25 = e.a(b15, i26); if (a25 != null) { JSONObject jSONObject3 = (JSONObject) a25; String b19 = e.b(jSONObject3, "schema"); String b25 = e.b(jSONObject3, "sign"); String b26 = e.b(jSONObject3, ProviderConstants.API_COLNAME_FEATURE_VERSION); if (mg4.b.f(topOrUIPageFragmentActivity, b19) && b25.equalsIgnoreCase(mg4.b.c(topOrUIPageFragmentActivity, b19, AndroidUtilsLight.DIGEST_ALGORITHM_SHA1))) { if (!TextUtils.isEmpty(b19)) { try { PackageInfo packageInfo = topOrUIPageFragmentActivity.getPackageManager().getPackageInfo(b19, 0); if (packageInfo != null) { str6 = packageInfo.versionName; if (!str6.matches(b26)) { try { Bundle bundle = new Bundle(); a.c(a.f191804a, bundle, a.f191807d); bundle.putString("SpId", a.f191805b); bundle.putString("SysProvide", a.f191806c); bundle.putString("paydata", a.f191804a); bundle.putBoolean("dlgstyle", false); bundle.putString("server", b18); bundle.putString("SecurityChipType", null); bundle.putInt("reqOriginalId", 0); Intent intent = new Intent(); intent.putExtras(bundle); intent.setClassName(b19, "com.unionpay.uppay.PayActivity"); try { k30.a aVar = new k30.a(); ThreadLocal<k30.a> threadLocal = c.f244265a; aVar.c(10); aVar.c(intent); str4 = str3; try { j30.a.j(topOrUIPageFragmentActivity, aVar.b(), "com/unionpay/UPPayAssistEx", "a", "(Landroid/content/Context;Lorg/json/JSONArray;I)V", "android/app/Activity", "startActivityForResult", "(Landroid/content/Intent;I)V"); } catch (Exception unused5) { } } catch (Exception unused6) { str4 = str3; } z15 = true; break; } catch (Exception unused7) { continue; } } else { continue; } } } catch (Exception unused8) { } } str6 = str7; if (!str6.matches(b26)) { } } } i26++; str3 = str3; } } str4 = str3; z15 = false; if (!z15) { } } jSONArray3 = jSONArray4; String b182 = e.b(jSONObject2, "app_server"); b15 = a.b(jSONArray3, str3); if (b15.length() > 0) { } str4 = str3; z15 = false; if (!z15) { } } else { str4 = str3; str5 = "wap"; if (str5.equals(b17)) { try { break; } catch (Exception unused9) { } } else if ("link".equals(b17)) { try { str7 = jSONObject2.getString("url"); } catch (Exception unused10) { } str5 = "link"; break; } } jSONArray2 = a.f191810g; int i27 = a.f191808e + 1; a.f191808e = i27; str3 = str4; i25 = 1; i19 = 0; i15 = i27; jSONArray4 = null; } } int i28 = Integer.parseInt(a.f191807d); a.f191809f = new lg4.c(UPUtils.forUrl(i28)); a15 = a.a(topOrUIPageFragmentActivity, a.f191807d, a.f191804a, null, null, null); lg4.c cVar = a.f191809f; cVar.getClass(); if (a15 != null) { a15.getBytes(); cVar.f253195b = a15; } Executors.newSingleThreadExecutor().execute(new com.unionpay.c(topOrUIPageFragmentActivity.getApplicationContext())); if (z16) { ((UIPageFragmentActivity) topOrUIPageFragmentActivity).f75566u = false; return; } return; } String str10 = str7; Bundle bundle2 = new Bundle(); if (!"link".equals(str5)) { a.c(a.f191804a, bundle2, a.f191807d); bundle2.putString("SpId", a.f191805b); bundle2.putString("SysProvide", a.f191806c); try { i16 = Integer.parseInt(a.f191807d); } catch (Exception unused11) { i16 = 0; } bundle2.putString("paydata", UPUtils.forWap(i16, mg4.b.g(a.f191804a))); } bundle2.putString("magic_data", "949A1CC"); bundle2.putString("wapurl", str10); bundle2.putString("actionType", str5); Intent intent2 = new Intent(); intent2.putExtras(bundle2); intent2.setClass(topOrUIPageFragmentActivity, UPPayWapActivity.class); k30.a aVar2 = new k30.a(); ThreadLocal<k30.a> threadLocal2 = c.f244265a; aVar2.c(10); aVar2.c(intent2); j30.a.j(topOrUIPageFragmentActivity, aVar2.b(), "com/unionpay/UPPayAssistEx", "a", "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V", "android/app/Activity", "startActivityForResult", "(Landroid/content/Intent;I)V"); int i282 = Integer.parseInt(a.f191807d); a.f191809f = new lg4.c(UPUtils.forUrl(i282)); a15 = a.a(topOrUIPageFragmentActivity, a.f191807d, a.f191804a, null, null, null); lg4.c cVar2 = a.f191809f; cVar2.getClass(); if (a15 != null) { } Executors.newSingleThreadExecutor().execute(new com.unionpay.c(topOrUIPageFragmentActivity.getApplicationContext())); if (z16) { } } } catch (Exception unused12) { } } jSONArray = null; str3 = "sort"; if (jSONArray == null) { } a.f191810g = a.b(jSONArray, str3); jSONArray2 = a.f191810g; i15 = a.f191808e; while (true) { a16 = e.a(jSONArray2, i15); if (a16 != null) { } int i2822 = Integer.parseInt(a.f191807d); a.f191809f = new lg4.c(UPUtils.forUrl(i2822)); a15 = a.a(topOrUIPageFragmentActivity, a.f191807d, a.f191804a, null, null, null); lg4.c cVar22 = a.f191809f; cVar22.getClass(); if (a15 != null) { } Executors.newSingleThreadExecutor().execute(new com.unionpay.c(topOrUIPageFragmentActivity.getApplicationContext())); if (z16) { } jSONArray2 = a.f191810g; int i272 = a.f191808e + 1; a.f191808e = i272; str3 = str4; i25 = 1; i19 = 0; i15 = i272; jSONArray4 = null; } String str102 = str7; Bundle bundle22 = new Bundle(); if (!"link".equals(str5)) { } bundle22.putString("magic_data", "949A1CC"); bundle22.putString("wapurl", str102); bundle22.putString("actionType", str5); Intent intent22 = new Intent(); intent22.putExtras(bundle22); intent22.setClass(topOrUIPageFragmentActivity, UPPayWapActivity.class); k30.a aVar22 = new k30.a(); ThreadLocal<k30.a> threadLocal22 = c.f244265a; aVar22.c(10); aVar22.c(intent22); j30.a.j(topOrUIPageFragmentActivity, aVar22.b(), "com/unionpay/UPPayAssistEx", "a", "(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V", "android/app/Activity", "startActivityForResult", "(Landroid/content/Intent;I)V"); int i28222 = Integer.parseInt(a.f191807d); a.f191809f = new lg4.c(UPUtils.forUrl(i28222)); a15 = a.a(topOrUIPageFragmentActivity, a.f191807d, a.f191804a, null, null, null); lg4.c cVar222 = a.f191809f; cVar222.getClass(); if (a15 != null) { } Executors.newSingleThreadExecutor().execute(new com.unionpay.c(topOrUIPageFragmentActivity.getApplicationContext())); if (z16) { } } }