imToken v2.9.3版本的 MD5 值为:42af1a08a3f01f69d2f3782d81007b3c

以下内容为反编译后的 JDPayWebView.java 源代码,内容仅作参考


package com.pingplusplus.android.wap;

import android.app.Activity;
import android.graphics.Bitmap;
import android.text.TextUtils;
import android.webkit.WebView;
import com.brentvatne.react.ReactVideoView;
import com.pingplusplus.android.PingppLog;
import com.pingplusplus.android.PingppWebView;
import com.pingplusplus.android.WebViewEx;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Iterator;
import kotlin.Metadata;
import kotlin.TypeCastException;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import kotlin.text.StringsKt;
import org.json.JSONObject;

@Metadata(bv = {1, 0, 3}, d1 = {"\u0000(\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010\u0002\n\u0002\b\u0005\u0018\u0000 \u000f2\u00020\u0001:\u0002\u000f\u0010B\u0019\u0012\b\u0010\u0002\u001a\u0004\u0018\u00010\u0003\u0012\b\u0010\u0004\u001a\u0004\u0018\u00010\u0005¢\u0006\u0002\u0010\u0006J\u0010\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u0005H\u0014J\b\u0010\u000e\u001a\u00020\fH\u0014R\u0010\u0010\u0007\u001a\u0004\u0018\u00010\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\t\u001a\u0004\u0018\u00010\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\bX\u0082D¢\u0006\u0002\n\u0000¨\u0006\u0011"}, d2 = {"Lcom/pingplusplus/android/wap/JDPayWebView;", "Lcom/pingplusplus/android/PingppWebView;", "activity", "Landroid/app/Activity;", "credential", "Lorg/json/JSONObject;", "(Landroid/app/Activity;Lorg/json/JSONObject;)V", "fail_url", "", "jdpayResultUrl", "jdpayResultUrl2", "initData", "", "chargeJson", "initWebView", "Companion", "WebViewClientInner", "pingpp-android_release"}, k = 1, mv = {1, 1, 16})
public final class JDPayWebView extends PingppWebView {
    private String p;
    private final String q;
    private String r;

    public static final class a {
        private a() {
        }

        public a(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    public final class b extends WebViewEx.c {
        public b() {
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            Intrinsics.checkParameterIsNotNull(view, "view");
            Intrinsics.checkParameterIsNotNull(url, "url");
            super.onPageFinished(view, url);
            JDPayWebView.this.c().setVisibility(8);
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap bitmap) {
            Intrinsics.checkParameterIsNotNull(view, "view");
            Intrinsics.checkParameterIsNotNull(url, "url");
            super.onPageStarted(view, url, bitmap);
            if (JDPayWebView.this.p != null) {
                String str = JDPayWebView.this.p;
                if (str == null) {
                    Intrinsics.throwNpe();
                }
                if (StringsKt.startsWith$default(url, str, false, 2, (Object) null)) {
                    if (((PingppWebView) JDPayWebView.this).h) {
                        ((PingppWebView) JDPayWebView.this).b.a("success");
                    } else {
                        ((PingppWebView) JDPayWebView.this).b.e = "success";
                        ((PingppWebView) JDPayWebView.this).j = true;
                    }
                }
            }
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            String str;
            Intrinsics.checkParameterIsNotNull(view, "view");
            Intrinsics.checkParameterIsNotNull(url, "url");
            String str2 = JDPayWebView.this.p;
            if (str2 == null) {
                Intrinsics.throwNpe();
            }
            if (StringsKt.startsWith$default(url, str2, false, 2, (Object) null)) {
                ((PingppWebView) JDPayWebView.this).b.a("success");
                WebViewEx webViewEx = ((PingppWebView) JDPayWebView.this).f1588a;
                if (webViewEx == null) {
                    Intrinsics.throwNpe();
                }
                webViewEx.destroy();
                ((PingppWebView) JDPayWebView.this).f1588a = null;
                str = "jdPay success";
            } else {
                if (!url.equals(JDPayWebView.this.r)) {
                    if ("https://www.jdpay.com/".equals(url)) {
                        JDPayWebView.this.a(url);
                    } else if (StringsKt.startsWith$default(url, JDPayWebView.this.q, false, 2, (Object) null)) {
                        ((PingppWebView) JDPayWebView.this).k = false;
                    }
                    return super.shouldOverrideUrlLoading(view, url);
                }
                ((PingppWebView) JDPayWebView.this).b.a("fail");
                WebViewEx webViewEx2 = ((PingppWebView) JDPayWebView.this).f1588a;
                if (webViewEx2 == null) {
                    Intrinsics.throwNpe();
                }
                webViewEx2.destroy();
                ((PingppWebView) JDPayWebView.this).f1588a = null;
                str = "jdPay fail";
            }
            PingppLog.d(str);
            return true;
        }
    }

    static {
        new a(null);
    }

    public JDPayWebView(Activity activity, JSONObject jSONObject) {
        super(activity, jSONObject);
        if (activity == null) {
            Intrinsics.throwNpe();
        }
        if (jSONObject == null) {
            Intrinsics.throwNpe();
        }
        this.q = "https://h5pay.jd.com/jdpay/payResult?";
    }

    @Override
    protected void a(JSONObject chargeJson) {
        Intrinsics.checkParameterIsNotNull(chargeJson, "chargeJson");
        JSONObject optJSONObject = chargeJson.optJSONObject(ReactVideoView.EVENT_PROP_EXTRA);
        this.p = optJSONObject.optString("success_url");
        this.r = optJSONObject.optString("fail_url");
        JSONObject jSONObject = chargeJson.getJSONObject("credential");
        JSONObject jSONObject2 = jSONObject.getJSONObject("jdpay_wap");
        PingppLog.d("PaymentActivity start jdpay_wap credential : " + jSONObject);
        ArrayList arrayList = new ArrayList();
        Iterator<String> keys = jSONObject2.keys();
        String str = "https://m.jdpay.com/wepay/web/pay";
        while (keys.hasNext()) {
            String next = keys.next();
            if (Intrinsics.areEqual("channelUrl", next)) {
                str = jSONObject2.getString(next);
            } else {
                ArrayList arrayList2 = new ArrayList();
                arrayList2.add(next);
                try {
                    arrayList2.add(URLEncoder.encode(jSONObject2.getString(next), "UTF-8"));
                } catch (UnsupportedEncodingException e) {
                    e.printStackTrace();
                }
                arrayList.add(TextUtils.join("=", arrayList2));
            }
        }
        if (arrayList.size() == 0) {
            this.b.a("fail", "invalid_credential");
            return;
        }
        String orderInfo = TextUtils.join(com.alipay.sdk.sys.a.b, arrayList);
        Intrinsics.checkExpressionValueIsNotNull(orderInfo, "orderInfo");
        Charset charset = Charsets.UTF_8;
        if (orderInfo == null) {
            throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
        }
        byte[] bytes = orderInfo.getBytes(charset);
        Intrinsics.checkExpressionValueIsNotNull(bytes, "(this as java.lang.String).getBytes(charset)");
        a(str, bytes);
    }

    @Override
    protected void f() {
        WebViewEx webViewEx = this.f1588a;
        if (webViewEx == null) {
            Intrinsics.throwNpe();
        }
        webViewEx.setWebViewClient(new b());
    }
}