APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:IntelliInvest
版本号:3.0.40
包名称:com.intelli.intelliinvest

MD5 校验值:8d01bad3385dcb060a6dcda2da0f8dbf

反编译源代码说明

v.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.razorpay;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;
import android.util.Base64;
import android.webkit.WebView;
import com.google.android.gms.tasks.Task;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import org.json.JSONException;
import org.json.JSONObject;

public class v implements r, s {

    protected Activity f10944a;

    protected u f10945b;

    String f10946c;

    n0 f10947d;

    private String f10948e;

    private JSONObject f10949f;

    private String f10950g;

    private boolean f10953j;

    private long f10956m;

    private long f10957n;

    private long f10958o;

    private Task<Void> f10968y;

    private Task<Void> f10969z;

    private String f10951h = "{}";

    private int f10952i = 0;

    private boolean f10954k = false;

    private boolean f10955l = false;

    private boolean f10959p = false;

    private boolean f10960q = false;

    private int f10961r = 0;

    private boolean f10962s = false;

    private boolean f10963t = false;

    private boolean f10964u = false;

    private String f10965v = "";

    private String f10966w = null;

    private boolean f10967x = false;
    private Boolean A = Boolean.FALSE;
    BroadcastReceiver B = new r0(this);
    Queue<String> C = new LinkedList();
    private boolean D = false;
    private boolean E = false;

    public v(Activity activity, u uVar) {
        this.f10944a = activity;
        this.f10945b = uVar;
    }

    public void f0(int i10, p pVar) {
        u uVar;
        int i11 = 1;
        if (i10 == 1) {
            uVar = this.f10945b;
        } else {
            uVar = this.f10945b;
            i11 = 2;
        }
        try {
            String host = new URL(uVar.h(i11).getTag().toString()).getHost();
            if (host == null || !(host.endsWith("razorpay.com") || host.endsWith("razorpay.in"))) {
                pVar.b();
            } else {
                pVar.a();
            }
        } catch (Exception e10) {
            d.v("CxPsntrImpl", "S0", e10.getLocalizedMessage());
            pVar.b();
        }
    }

    public String g0() {
        return String.format("javascript: handleMessage(%s)", h0().toString());
    }

    private JSONObject i0() {
        String str;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("framework", d.f());
        jSONObject.put("type", g0.M);
        jSONObject.put("name", g0.M + "_android_" + d.f());
        jSONObject.put("version", "1.6.40");
        jSONObject.put("platform", "android");
        String callingPackage = this.f10944a.getCallingPackage();
        if (callingPackage == null) {
            callingPackage = this.f10944a.getPackageName();
            str = "getPackageName";
        } else {
            str = "getCallingPackage";
        }
        if (callingPackage == null) {
            callingPackage = this.f10944a.getApplicationContext().getPackageName();
            str = "getApplicationContext.getPackageName";
        }
        if (callingPackage == null) {
            callingPackage = this.f10944a.getApplication().getPackageName();
            str = "getApplication.getPackageName";
        }
        if (callingPackage == null) {
            str = "null";
        }
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.put("function_name", str);
        d.E(a.CHECKOUT_PACKAGE_NAME_FUNC_USED, jSONObject2);
        jSONObject.put("package_name", callingPackage);
        return jSONObject;
    }

    public void j0(String str) {
        int i10 = this.f10952i;
        int R = g0.H().R();
        if (!(g0.H().Q() && (R == -1 || R >= i10))) {
            n(0, str);
            return;
        }
        try {
            if (str == null) {
                n(0, "");
                return;
            }
            JSONObject jSONObject = new JSONObject(str);
            if (jSONObject.has("error")) {
                StringBuilder sb2 = new StringBuilder();
                sb2.append(str);
                sb2.append(this.f10950g.contains("?") ? "&" : "?");
                str = sb2.toString();
                if (jSONObject.get("error") instanceof JSONObject) {
                    str = str + "error=" + ((JSONObject) jSONObject.get("error")).toString();
                }
            }
            k0();
            F(str);
        } catch (Exception e10) {
            n(0, "");
            d.v("CxPsntrImpl", "S0", e10.getMessage());
        }
    }

    private void l0(String str) {
        this.f10945b.i(1, String.format("javascript: %s", str));
    }

    private void n0(JSONObject jSONObject, String str) {
        HashMap hashMap = new HashMap();
        hashMap.put("result", jSONObject);
        d.E(a.NATIVE_INTENT_ONACTIVITY_RESULT, d.h(hashMap));
        if (this.D) {
            this.f10945b.i(1, str);
            return;
        }
        if (this.C == null) {
            this.C = new LinkedList();
        }
        this.C.add(str);
    }

    public void o0() {
        if (this.f10966w == null || this.f10954k) {
            return;
        }
        try {
            String e10 = l.e(this.f10946c);
            HashMap hashMap = new HashMap();
            hashMap.put("Authorization", "Basic " + e10);
            m0.b("https://api.razorpay.com/v1/payments/" + this.f10966w + "/cancel?platform=android_sdk", hashMap, new r3(this));
            this.f10966w = null;
        } catch (Exception e11) {
            d.v("CxPsntrImpl", "S0", e11.getLocalizedMessage());
        }
    }

    private void s0(JSONObject jSONObject) {
        try {
            if (jSONObject.has("contact")) {
                x.k(this.f10944a, jSONObject.getString("contact"));
                this.f10947d.c("contact", jSONObject.getString("contact"));
            }
            if (jSONObject.has("email")) {
                x.g(this.f10944a, jSONObject.getString("email"));
                this.f10947d.c("email", jSONObject.getString("email"));
            }
        } catch (JSONException e10) {
            t2.a("Error parsing JSON", e10);
        }
    }

    private void t0() {
        Queue<String> queue = this.C;
        if (queue == null || queue.isEmpty()) {
            return;
        }
        Iterator<String> it = this.C.iterator();
        while (it.hasNext()) {
            this.f10945b.i(1, it.next());
        }
        this.C.clear();
    }

    private void u0() {
        this.f10968y = u7.a.a(this.f10944a).startSmsRetriever();
        this.f10969z = u7.a.a(this.f10944a).startSmsUserConsent(null);
    }

    public void A(int i10, int i11) {
        if (i10 != 1) {
            return;
        }
        this.f10945b.e(i11);
    }

    public void B() {
        try {
            o0();
            v0();
            y2.b();
        } catch (Exception e10) {
            d.v("CxPsntrImpl", "S2", e10.getLocalizedMessage());
        }
    }

    @Override
    public void C(String str) {
        s0.c(this.f10944a, str);
    }

    public void D(boolean z10) {
        this.f10944a.runOnUiThread(new h(this, z10));
    }

    @Override
    public void E(int i10, p pVar) {
        this.f10944a.runOnUiThread(new y0(this, i10, pVar));
    }

    public void F(String str) {
        if (this.f10952i != 0) {
            d.t();
        }
        int i10 = this.f10952i + 1;
        this.f10952i = i10;
        d.b("payment_attempt", new c(i10, b.ORDER));
        this.f10953j = true;
        this.f10945b.i(1, (this.f10950g + str).replace(" ", "%20"));
    }

    public void G(Bundle bundle) {
        if (this.f10961r != 0) {
            bundle.putString("OPTIONS", this.f10947d.n());
            bundle.putInt("IMAGE", this.f10961r);
        } else {
            bundle.putString("OPTIONS", this.f10947d.k());
        }
        bundle.putString("DASH_OPTIONS", this.f10948e);
        if (this.f10944a.getIntent() != null) {
            bundle.putBoolean("DISABLE_FULL_SCREEN", this.f10944a.getIntent().getBooleanExtra("DISABLE_FULL_SCREEN", false));
        }
    }

    public void H() {
        if (this.E && this.f10945b.c(1)) {
            try {
                this.f10945b.i(1, String.format("javascript: window.externalSDKResponse(%s)", new JSONObject().put("provider", "truecaller")));
                this.E = false;
            } catch (JSONException e10) {
                throw new RuntimeException(e10);
            }
        }
    }

    @Override
    public void I(String str) {
        u3.e(this.f10944a).putString("rzp_app_token", str).apply();
    }

    public void J(int i10, int i11, Intent intent) {
        Intent intent2;
        if (i10 == 77) {
            if (i11 != -1 || intent.getData() == null) {
                return;
            }
            Uri data = intent.getData();
            try {
                try {
                    ParcelFileDescriptor openFileDescriptor = this.f10944a.getContentResolver().openFileDescriptor(data, "w");
                    FileOutputStream fileOutputStream = new FileOutputStream(openFileDescriptor.getFileDescriptor());
                    fileOutputStream.write(Base64.decode(this.f10965v, 0));
                    fileOutputStream.close();
                    openFileDescriptor.close();
                    intent2 = new Intent("android.intent.action.VIEW");
                } catch (IOException e10) {
                    e10.printStackTrace();
                    intent2 = new Intent("android.intent.action.VIEW");
                }
                intent2.setDataAndType(data, "application/pdf");
                intent2.addFlags(1);
                data = this.f10944a;
                data.startActivity(intent2);
                return;
            } catch (Throwable th) {
                Intent intent3 = new Intent("android.intent.action.VIEW");
                intent3.setDataAndType(data, "application/pdf");
                intent3.addFlags(1);
                this.f10944a.startActivity(intent3);
                throw th;
            }
        }
        if (i10 == 1001) {
            if (i11 == -1) {
                d.D(a.AUTO_READ_OTP_SMS_RETRIEVER_API_RECEIVED_SMS);
                String stringExtra = intent.getStringExtra("com.google.android.gms.auth.api.phone.EXTRA_SMS_MESSAGE");
                if (this.D) {
                    try {
                        JSONObject jSONObject = new JSONObject();
                        jSONObject.put("sender", "razorpay");
                        jSONObject.put("message", stringExtra);
                        l0(String.format("OTPElf.showOTP('%s','%s')", stringExtra, "razorpay"));
                        d.D(a.AUTO_READ_OTP_SMS_RETRIEVER_API_OTP_POPULATION_JS);
                    } catch (JSONException e11) {
                        d.v("CxPsntrImpl", "S0", e11.getLocalizedMessage());
                        e11.printStackTrace();
                    }
                }
            } else {
                d.D(a.AUTO_READ_OTP_SMS_RETRIEVER_API_CONSENT_DECLINED);
            }
            Task<Void> task = this.f10969z;
            if (task == null || task.isSuccessful()) {
                return;
            }
            u0();
            return;
        }
        if (i10 == 99) {
            JSONObject x10 = l.x(intent);
            if (x10.toString().contains("\"from\":\"razorpay\"") && d.i().equalsIgnoreCase("test") && this.A.booleanValue()) {
                n(0, "");
                return;
            } else {
                n0(x10, String.format("javascript: upiIntentResponse(%s)", x10.toString()));
                return;
            }
        }
        if (i10 == 20) {
            try {
                JSONObject jSONObject2 = new JSONObject("{'data':" + i11 + "}");
                jSONObject2.put("provider", "CRED");
                n0(jSONObject2, String.format("javascript:externalAppResponse(%s)", jSONObject2.toString()));
            } catch (JSONException e12) {
                d.v("CxPsntrImpl", "S0", e12.getMessage());
            }
        }
    }

    public void K(int i10, String str) {
        this.f10945b.i(1, "about:blank");
        if (this.f10944a.isFinishing()) {
            return;
        }
        AlertDialog create = new AlertDialog.Builder(this.f10944a).create();
        create.setCancelable(false);
        create.setTitle("Trouble Connecting");
        create.setMessage("Unable to connect to Razorpay.\n\nPlease check your internet connection and/or disconnect from VPN if connected and hit Try Again");
        create.setButton(-1, "Try again", new e0(this));
        create.setButton(-2, "Cancel Payment", new x3(this, create, i10, str));
        create.show();
    }

    @Override
    public boolean L(String str) {
        return l.c(this.f10944a, str);
    }

    public void M() {
        String p10 = this.f10947d.p();
        if (!TextUtils.isEmpty(p10)) {
            d.b("email", new c(p10, b.ORDER));
        }
        String o10 = this.f10947d.o();
        if (TextUtils.isEmpty(o10)) {
            return;
        }
        d.b("contact", new c(o10, b.ORDER));
    }

    @Override
    public void N() {
        v0();
    }

    @Override
    public void O(String str) {
        String string;
        if (this.f10952i > 1) {
            d.u();
        }
        try {
            JSONObject jSONObject = new JSONObject(str);
            this.f10951h = str;
            d0(jSONObject);
            s0(jSONObject);
            if (jSONObject.has("method")) {
                String string2 = jSONObject.getString("method");
                if (!string2.equalsIgnoreCase("netbanking") && !string2.equalsIgnoreCase("card")) {
                    N();
                    if (string2.equals("wallet") && jSONObject.has("wallet")) {
                        string = jSONObject.getString("wallet");
                        if (this.f10947d.g(string)) {
                            JSONObject jSONObject2 = new JSONObject();
                            jSONObject2.put("external_wallet", string);
                            d.b("external_wallet", new c(string, b.ORDER));
                            d.D(a.EXTERNAL_WALLET_SELECTED);
                            p0(jSONObject2);
                        }
                    }
                }
                if (!this.f10955l) {
                    Q();
                }
                if (string2.equals("wallet")) {
                    string = jSONObject.getString("wallet");
                    if (this.f10947d.g(string)) {
                    }
                }
            }
            d.D(a.CHECKOUT_SUBMIT);
            d.t();
        } catch (Exception e10) {
            d.v("CxPsntrImpl", "S0", e10.getMessage());
            t2.a("Error in submit", e10);
        }
    }

    public boolean P(Bundle bundle, boolean z10) {
        this.f10962s = z10;
        if (bundle == null) {
            n(0, this.f10944a.getResources().getString(t1.activity_result_invalid_parameters));
            return false;
        }
        n0 n0Var = new n0(bundle.getString("OPTIONS"));
        this.f10947d = n0Var;
        JSONObject j10 = n0Var.j();
        if (j10.has("retry")) {
            g0.H().K(j10);
        }
        this.f10946c = this.f10947d.a();
        this.f10963t = this.f10947d.f();
        this.f10964u = this.f10947d.i();
        int i10 = bundle.getInt("IMAGE", 0);
        this.f10961r = i10;
        this.f10947d.b(this.f10944a, i10);
        d.B(this.f10944a, this.f10946c, g0.M, g0.O, g0.N);
        j10.has("ep");
        n0 n0Var2 = this.f10947d;
        String a10 = x.a("https://api.razorpay.com/v1/checkout/public", "version", g0.N);
        Map<String, String> S = g0.H().S();
        for (String str : S.keySet()) {
            a10 = x.a(a10, str, S.get(str));
        }
        Iterator<String> it = g0.H().T().iterator();
        while (it.hasNext()) {
            String next = it.next();
            if (n0Var2.d(next)) {
                a10 = x.a(a10, next, (String) n0Var2.h(next));
            }
        }
        this.f10950g = a10;
        if (a10 == null) {
            n(3, this.f10944a.getResources().getString(t1.activity_result_invalid_url));
        }
        if (z10) {
            this.f10948e = bundle.getString("DASH_OPTIONS");
            if (!bundle.getBoolean("DISABLE_FULL_SCREEN", false)) {
                return true;
            }
            x.f(this.f10944a);
            return true;
        }
        this.f10947d.m();
        String c10 = u3.c(this.f10944a, "pref_merchant_options_" + this.f10946c, null);
        this.f10948e = c10;
        if (c10 != null) {
            try {
                this.f10949f = new JSONObject(this.f10948e);
            } catch (Exception e10) {
                d.v("CxPsntrImpl", "S0", e10.getLocalizedMessage());
            }
        }
        String string = bundle.getString("FRAMEWORK");
        if (string != null) {
            d.b("framework", new c(string, b.ORDER));
        }
        d.A(string);
        String string2 = bundle.getString("FRAMEWORK_VERSION");
        if (string2 != null) {
            d.b("frameworkVersion", new c(string2, b.ORDER));
        }
        if (bundle.getBoolean("DISABLE_FULL_SCREEN", false)) {
            x.f(this.f10944a);
        }
        if (bundle.containsKey("PRELOAD_COMPLETE_DURATION")) {
            this.f10956m = bundle.getLong("PRELOAD_COMPLETE_DURATION");
        }
        if (!bundle.containsKey("PRELOAD_ABORT_DURATION")) {
            return true;
        }
        this.f10957n = bundle.getLong("PRELOAD_ABORT_DURATION");
        return true;
    }

    @Override
    @SuppressLint({"UnspecifiedRegisterReceiverFlag"})
    public void Q() {
        try {
            IntentFilter intentFilter = new IntentFilter("com.google.android.gms.auth.api.phone.SMS_RETRIEVED");
            if (Build.VERSION.SDK_INT >= 33) {
                this.f10944a.registerReceiver(this.B, intentFilter, "com.google.android.gms.auth.api.phone.permission.SEND", null, 2);
            } else {
                this.f10944a.registerReceiver(this.B, intentFilter, "com.google.android.gms.auth.api.phone.permission.SEND", null);
            }
            this.f10955l = true;
        } catch (Exception unused) {
            this.f10955l = false;
        }
    }

    @Override
    public void R() {
        d.D(a.CHECKOUT_RENDERED_COMPLETE);
    }

    @Override
    public void S(String str) {
        this.f10959p = true;
        try {
            this.f10944a.runOnUiThread(new j3(this, str));
        } catch (Exception e10) {
            d.v("CxPsntrImpl", "S0", e10.getLocalizedMessage());
            e10.printStackTrace();
        }
    }

    @Override
    public void T(String str, int i10) {
        this.f10944a.runOnUiThread(new w0(this, str, i10));
    }

    @Override
    public void U(String str) {
        try {
            n(3, new JSONObject(str).toString());
        } catch (JSONException unused) {
            n(3, l.v(str, l.w().C()));
        }
    }

    @Override
    public void V(String str) {
        this.f10948e = str;
        if (str != null) {
            try {
            } catch (Exception e10) {
                t2.a("Error parsing merchant dash options JSON", e10);
                this.f10949f = null;
                d.v("CxPsntrImpl", "S0", e10.getMessage());
            }
            if (!str.equalsIgnoreCase("undefined")) {
                this.f10949f = new JSONObject(this.f10948e);
                if (this.f10949f != null) {
                    x.h(this.f10944a, this.f10946c, null);
                    return;
                } else {
                    x.h(this.f10944a, this.f10946c, str);
                    return;
                }
            }
        }
        this.f10949f = null;
        if (this.f10949f != null) {
        }
    }

    @Override
    public void a(String str) {
        try {
            q0(new JSONObject(str));
        } catch (Exception e10) {
            d.v("CxPsntrImpl", "S0", e10.getMessage());
            this.f10944a.runOnUiThread(new h3(this));
        }
    }

    @Override
    public void b(String str) {
        this.f10966w = str;
        l.w().S(str);
        if (this.f10947d.l() != null) {
            l.w().R(this.f10947d.l());
        }
        d.b("payment_id", new c(str, b.PAYMENT));
        d.D(a.PAYMENT_ID_ATTACHED);
    }

    public void c(int i10, WebView webView, String str) {
        if (i10 != 1) {
            return;
        }
        r0(str, webView);
    }

    @Override
    public void d(String str) {
        try {
            n(0, new JSONObject(str).toString());
        } catch (JSONException unused) {
            n(0, l.v(str, l.w().C()));
        }
    }

    public void d0(JSONObject jSONObject) {
        d.a(jSONObject);
    }

    @Override
    public void e(int i10, int i11) {
        if (c3.b(this.f10944a)) {
            this.f10944a.runOnUiThread(new e4(this, i11, i10));
        }
    }

    public void e0(JSONObject jSONObject) {
        try {
            if (jSONObject.has("magic")) {
                boolean z10 = jSONObject.getBoolean("magic");
                this.f10960q = z10;
                d.b("is_magic", new c(z10, b.PAYMENT));
            }
        } catch (JSONException e10) {
            d.v("CxPsntrImpl", "S0", e10.getLocalizedMessage());
            e10.printStackTrace();
        }
    }

    @Override
    public void f(String str, String str2) {
        if (str.contains("truecallersdk://truesdk")) {
            this.E = true;
        }
        l.V(str, str2, this.f10944a);
        HashMap hashMap = new HashMap();
        hashMap.put("url", str);
        if (str2 == null) {
            str2 = "null";
        }
        hashMap.put("package_name", str2);
        d.E(a.NATIVE_INTENT_CALLED, d.h(hashMap));
    }

    @Override
    public void h(int i10, p pVar) {
        f0(i10, pVar);
    }

    public JSONObject h0() {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("options", this.f10947d.j());
            jSONObject.put("data", this.f10951h);
            jSONObject.put("id", d.k());
            jSONObject.put("pdf_download_supported", true);
            jSONObject.put("key_id", this.f10946c);
            jSONObject.put("externalSDKs", new JSONObject());
            if (this.f10947d.f()) {
                jSONObject.put("sms_hash", new e(this.f10944a).a().get(0));
            }
            jSONObject.put("upi_intents_data", x.b(this.f10944a));
            jSONObject.put("uri_data", x.j(this.f10944a));
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("openedAt", System.currentTimeMillis());
            jSONObject.put("metadata", jSONObject2);
            jSONObject.put("sdk", i0());
            String d10 = s0.d(this.f10944a.getApplicationContext());
            if (!TextUtils.isEmpty(d10)) {
                jSONObject.put("device_token", d10);
            }
            jSONObject.put("sdk_popup", true);
            jSONObject.put("magic", true);
            jSONObject.put("network_type", l.D(this.f10944a));
            jSONObject.put("activity_recreated", this.f10962s);
        } catch (JSONException e10) {
            d.v("CxPsntrImpl", "S2", e10.getLocalizedMessage());
        }
        return jSONObject;
    }

    @Override
    public void j(String str, String str2) {
        if (TextUtils.isEmpty(str2) || !str2.contains("base64,")) {
            return;
        }
        String str3 = str2.split("base64,")[1];
        this.f10965v = str3;
        l.O(this.f10944a, str, str3);
    }

    @Override
    public void k() {
        d.D(a.CHECKOUT_SOFT_BACK_PRESSED);
        n(0, l.E(l.w().C()));
    }

    public void k0() {
    }

    public boolean l() {
        return this.f10964u;
    }

    @Override
    public boolean m(String str) {
        return l.b(this.f10944a, str);
    }

    public boolean m0() {
        return false;
    }

    public void n(int i10, String str) {
        String valueOf = String.valueOf(i10);
        b bVar = b.ORDER;
        d.b("destroy_resultCode", new c(valueOf, bVar));
        d.b("destroy_result", new c(str, bVar));
        d.D(a.INTERNAL_DESTROY_METHOD_CALLED);
        B();
        this.f10945b.j(i10, str);
    }

    @Override
    public String o() {
        HashMap<String, String> g10 = l.g(this.f10944a);
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("isAmazonPluginIntegrated", false);
            jSONObject.put("isGooglePayPluginIntegrated", false);
        } catch (JSONException e10) {
            d.v("CxPsntrImpl", "S0", e10.getLocalizedMessage());
        }
        if (g10 != null && g10.size() != 0) {
            for (String str : g10.values()) {
                if (g10.size() > 0 && str.equalsIgnoreCase("com.razorpay.RazorpayAmazon")) {
                    jSONObject.put("isAmazonPluginIntegrated", true);
                }
                if (g10.size() > 0 && str.equalsIgnoreCase("com.razorpay.RzpGpayMerged")) {
                    jSONObject.put("isGooglePayPluginIntegrated", true);
                }
            }
            return jSONObject.toString();
        }
        return jSONObject.toString();
    }

    @Override
    public void onDismiss() {
        n(0, l.E(l.w().C()));
    }

    public void onRequestPermissionsResult(int i10, String[] strArr, int[] iArr) {
    }

    public void p(int i10, WebView webView, String str) {
        if (i10 != 1) {
            return;
        }
        x.l(this.f10944a);
    }

    public void p0(JSONObject jSONObject) {
        String jSONObject2;
        try {
            if (jSONObject.has("error")) {
                b bVar = b.PAYMENT;
                d.b("payment_status", new c("fail", bVar));
                d.b("payload", new c(jSONObject.toString(), bVar));
                d.D(a.CHECKOUT_PAYMENT_COMPLETE);
                if (this.f10959p) {
                    this.f10945b.g(1);
                }
                q0(jSONObject);
            } else {
                if (jSONObject.has("razorpay_fund_account_id")) {
                    jSONObject2 = jSONObject.toString();
                } else if (jSONObject.has("razorpay_payment_id")) {
                    String string = jSONObject.getString("razorpay_payment_id");
                    this.f10966w = string;
                    b bVar2 = b.PAYMENT;
                    d.b("payment_id", new c(string, bVar2));
                    d.b("payment_status", new c("success", bVar2));
                    d.b("payload", new c(jSONObject.toString(), bVar2));
                    d.D(a.CHECKOUT_PAYMENT_COMPLETE);
                    this.f10954k = true;
                    jSONObject2 = jSONObject.toString();
                } else if (jSONObject.has("external_wallet")) {
                    n(4, jSONObject.toString());
                } else {
                    n(0, "Post payment parsing error");
                }
                n(1, jSONObject2);
            }
        } catch (Exception e10) {
            d.v("CxPsntrImpl", "S0", e10.getMessage());
            n(0, e10.getMessage());
        }
        this.f10959p = false;
    }

    public void q() {
        g0.R = m0();
        g0.J(this.f10944a, this.f10946c);
    }

    public void q0(JSONObject jSONObject) {
        if (this.f10959p) {
            this.f10945b.i(1, String.format("javascript: window.onComplete(%s)", jSONObject.toString()));
        } else {
            this.f10944a.runOnUiThread(new h0(this, jSONObject));
        }
    }

    @Override
    public void r() {
        this.f10944a.runOnUiThread(new m2(this, d.e()));
    }

    public void r0(String str, WebView webView) {
        long j10;
        long j11;
        long nanoTime = System.nanoTime();
        x.e();
        this.f10945b.a();
        if (str.contains("https://api.razorpay.com") && str.contains("android") && str.contains("1.6.40")) {
            if (this.f10952i == 1) {
                this.D = true;
                t0();
                HashMap hashMap = new HashMap();
                long j12 = nanoTime - this.f10958o;
                hashMap.put("checkout_load_duration", Long.valueOf(j12));
                l.N(j12, 2);
                long j13 = this.f10956m;
                if (j13 > 0) {
                    hashMap.put("preload_finish_duration", Long.valueOf(j13));
                    j10 = this.f10956m;
                } else {
                    long j14 = this.f10957n;
                    if (j14 > 0) {
                        hashMap.put("preload_abort_duration", Long.valueOf(j14));
                        j10 = this.f10957n;
                    }
                    j11 = this.f10956m - j12;
                    if (j11 > 0) {
                        hashMap.put("time_shaved_off", Long.valueOf(j11));
                        l.N(j11, 2);
                    }
                    d.E(a.CHECKOUT_LOADED, d.h(hashMap));
                }
                l.N(j10, 2);
                j11 = this.f10956m - j12;
                if (j11 > 0) {
                }
                d.E(a.CHECKOUT_LOADED, d.h(hashMap));
            }
            if (this.f10953j) {
                this.f10945b.f(1);
                this.f10953j = false;
            }
        }
    }

    public void s(Map<String, Object> map) {
        d.E(a.CHECKOUT_HARD_BACK_PRESSED, d.h(map));
        WebView h10 = this.f10945b.h(1);
        if ((h10.getTag() == null ? "" : h10.getTag().toString()).contains(g0.H().f()) && !this.f10945b.c(2)) {
            this.f10945b.i(1, "javascript: window.backPressed ? window.backPressed('onCheckoutBackPress') : CheckoutBridge.onCheckoutBackPress();");
            map.put("in_checkout", "true");
        } else if (g0.H().W()) {
            x.i(this.f10944a, g0.H().X(), g0.H().V(), g0.H().U(), new t3(this, map));
        } else {
            n(0, "BackPressed");
        }
    }

    public void t() {
        this.f10958o = System.nanoTime();
    }

    public void u() {
        d.D(a.CARD_SAVING_START);
        s0.b(this.f10944a.getApplicationContext());
    }

    @Override
    public void v(int i10, String str) {
        this.f10944a.runOnUiThread(new u2(this, i10, str));
    }

    public void v0() {
        try {
            BroadcastReceiver broadcastReceiver = this.B;
            if (broadcastReceiver != null) {
                this.f10944a.unregisterReceiver(broadcastReceiver);
                this.f10955l = false;
            }
        } catch (Exception e10) {
            this.f10955l = false;
            d.v("CxPrntrImpl", "S2", e10.getMessage());
        }
    }

    public String w() {
        JSONObject jSONObject;
        String str = null;
        try {
            if (this.f10947d.j() == null) {
                throw new Exception("No options defined");
            }
            String string = this.f10947d.j().getJSONObject("theme").getString("color");
            Color.parseColor(string);
            return string;
        } catch (Exception e10) {
            try {
                jSONObject = this.f10949f;
            } catch (Exception e11) {
                d.v("CxPsntrImpl", "S2", e11.getMessage());
            }
            if (jSONObject == null) {
                throw new Exception("No dash options defined");
            }
            str = jSONObject.getJSONObject("theme").getString("color");
            Color.parseColor(str);
            d.v("CxPsntrImpl", "S2", e10.getMessage());
            return str;
        }
    }

    @Override
    public void x(String str, String str2, String str3) {
        this.f10944a.runOnUiThread(new r2(this, str, str3, str2));
    }

    @Override
    public void y() {
        this.f10944a.runOnUiThread(new c2(this));
        u0();
    }

    @Override
    public void z(String str) {
        this.f10944a.runOnUiThread(new o0(this, str));
    }
}