导航菜单

页面标题

页面副标题

Crafto v9.3.3 - PaytmPGActivity.java 源代码

正在查看: Crafto v9.3.3 应用的 PaytmPGActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.paytm.pgsdk;

import android.R;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.http.SslError;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.paytmpayments.customuisdk.common.Constants.SDKConstants;
import easypay.appinvoke.listeners.AppCallbacks;
import easypay.appinvoke.listeners.WebClientListener;
import easypay.appinvoke.manager.EasypayWebViewClient;
import easypay.appinvoke.manager.PaytmAssist;
import easypay.appinvoke.utils.AssistLogs;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import mi.e;
import mi.g;
import mi.h;
import mi.i;
import mi.k;
import mi.m;
import mi.n;

public class PaytmPGActivity extends AppCompatActivity implements WebClientListener, AppCallbacks {
    public static final int n = 0;
    public volatile FrameLayout a;
    public volatile ProgressBar b;
    public volatile PaytmWebView c;
    public volatile LinearLayout d;
    public volatile Bundle e;
    public AlertDialog f;
    public boolean g;
    public PaytmAssist h;
    public String i;
    public String j;
    public EasypayWebViewClient k;
    public e l;
    public boolean m;

    public class a implements View.OnClickListener {
        public a() {
        }

        @Override
        public final void onClick(View view) {
            n.c("User pressed back button which is present in Header Bar.");
            int i = PaytmPGActivity.n;
            PaytmPGActivity.this.G();
        }
    }

    public class b implements Runnable {
        public b() {
        }

        @Override
        public final void run() {
            PaytmPGActivity.this.c.setVisibility(0);
            PaytmPGActivity.this.d.setVisibility(8);
        }
    }

    public class c implements Runnable {
        public c() {
        }

        @Override
        public final void run() {
            PaytmPGActivity.this.c.setVisibility(0);
        }
    }

    public final synchronized void G() {
        n.c("Displaying Confirmation Dialog");
        AlertDialog.Builder builder = new AlertDialog.Builder(this, h.CancelDialogeTheme);
        builder.setTitle("Cancel Transaction");
        builder.setMessage("Are you sure you want to cancel transaction");
        builder.setPositiveButton(SDKConstants.VALUE_YES, new mi.a(this));
        builder.setNegativeButton(SDKConstants.VALUE_NO, new mi.b(this));
        AlertDialog create = builder.create();
        this.f = create;
        create.show();
    }

    public final String H(String str) {
        if (str == null || str.isEmpty()) {
            AssistLogs.printLog("Message received is either null or empty", this);
        } else {
            Matcher matcher = Pattern.compile("\\d{6}").matcher(str);
            if (matcher.find()) {
                Matcher matcher2 = Pattern.compile("\\d{6}").matcher(matcher.group(0));
                if (matcher2.find()) {
                    String group = matcher2.group(0);
                    AssistLogs.printLog("OTP found: " + group, this);
                    return group;
                }
            }
        }
        return "";
    }

    public final synchronized boolean I() {
        try {
            try {
                if (getIntent() != null) {
                    this.g = getIntent().getBooleanExtra("HIDE_HEADER", false);
                    getIntent().getBooleanExtra("SEND_ALL_CHECKSUM_RESPONSE_PARAMETERS_TO_PG_SERVER", false);
                    this.i = getIntent().getStringExtra("mid");
                    this.j = getIntent().getStringExtra("orderId");
                    this.m = getIntent().getBooleanExtra(SDKConstants.IS_ENABLE_ASSIST, true);
                    n.c("Assist Enabled");
                }
                n.c("Hide Header " + this.g);
                n.c("Initializing the UI of Transaction Page...");
                RelativeLayout relativeLayout = new RelativeLayout(this);
                relativeLayout.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
                this.d = new LinearLayout(this);
                RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-2, -2);
                layoutParams.addRule(13);
                this.d.setLayoutParams(layoutParams);
                this.d.setOrientation(1);
                TextView textView = new TextView(this);
                textView.setText("Please wait");
                textView.setTypeface(textView.getTypeface(), 1);
                textView.setTextSize(0, getResources().getDimension(g.dimen_24sp));
                textView.setTextColor(-16777216);
                LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(-2, -2);
                layoutParams2.topMargin = getResources().getDimensionPixelSize(g.dimen_7dp);
                layoutParams2.bottomMargin = getResources().getDimensionPixelSize(g.dimen_10dp);
                layoutParams2.gravity = 17;
                textView.setLayoutParams(layoutParams2);
                TextView textView2 = new TextView(this);
                textView2.setText("Loading...");
                textView2.setTextColor(-7829368);
                textView2.setTextSize(0, getResources().getDimension(g.dimen_18sp));
                LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams(-2, -2);
                layoutParams3.gravity = 17;
                textView2.setLayoutParams(layoutParams3);
                relativeLayout.setBackgroundColor(-1);
                this.d.addView(textView);
                this.d.addView(textView2);
                RelativeLayout relativeLayout2 = new RelativeLayout(this);
                relativeLayout2.setLayoutParams(new RelativeLayout.LayoutParams(-1, -2));
                relativeLayout2.setId(1);
                relativeLayout2.setBackgroundColor(Color.parseColor("#bdbdbd"));
                Button button = new Button(this, null, R.attr.buttonStyleSmall);
                RelativeLayout.LayoutParams layoutParams4 = new RelativeLayout.LayoutParams(-2, -2);
                layoutParams4.addRule(15);
                layoutParams4.leftMargin = (int) (getResources().getDisplayMetrics().density * 5.0f);
                button.setOnClickListener(new a());
                button.setLayoutParams(layoutParams4);
                button.setText("Cancel");
                TextView textView3 = new TextView(this);
                RelativeLayout.LayoutParams layoutParams5 = new RelativeLayout.LayoutParams(-2, -2);
                layoutParams5.addRule(13);
                textView3.setLayoutParams(layoutParams5);
                textView3.setTextColor(-16777216);
                textView3.setText("Paytm Payments");
                relativeLayout2.addView(button);
                relativeLayout2.addView(textView3);
                RelativeLayout relativeLayout3 = new RelativeLayout(this);
                RelativeLayout.LayoutParams layoutParams6 = new RelativeLayout.LayoutParams(-1, -1);
                layoutParams6.addRule(3, relativeLayout2.getId());
                relativeLayout3.setLayoutParams(layoutParams6);
                relativeLayout3.setBackgroundColor(-1);
                this.c = new PaytmWebView(this);
                this.h = PaytmAssist.getAssistInstance();
                this.a = new FrameLayout(this, null);
                this.c.setVisibility(8);
                this.c.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
                this.b = new ProgressBar(this, null, R.attr.progressBarStyleSmall);
                RelativeLayout.LayoutParams layoutParams7 = new RelativeLayout.LayoutParams(-2, -2);
                layoutParams7.addRule(13);
                this.b.setLayoutParams(layoutParams7);
                RelativeLayout.LayoutParams layoutParams8 = new RelativeLayout.LayoutParams(-1, -2);
                layoutParams8.addRule(12);
                this.a.setId(101);
                this.a.setLayoutParams(layoutParams8);
                relativeLayout3.addView(this.c);
                relativeLayout3.addView(this.d);
                relativeLayout3.addView(this.a);
                relativeLayout.addView(relativeLayout2);
                relativeLayout.addView(relativeLayout3);
                if (this.g) {
                    relativeLayout2.setVisibility(8);
                }
                setContentView(relativeLayout);
                J();
                n.c("Initialized UI of Transaction Page.");
            } catch (Exception e) {
                i.c().b("Redirection", e.getMessage());
                n.c("Some exception occurred while initializing UI.");
                n.b(e);
                return false;
            }
        } catch (Throwable th2) {
            throw th2;
        }
        return true;
    }

    public final void J() {
        if (!TextUtils.isEmpty(this.i) && !TextUtils.isEmpty(this.j)) {
            this.h.startConfigAssist(this, Boolean.valueOf(this.m), Boolean.valueOf(this.m), Integer.valueOf(this.a.getId()), this.c, this, this.j, this.i);
            this.c.setWebCLientCallBacks();
            this.h.startAssist();
        }
        EasypayWebViewClient webClientInstance = this.h.getWebClientInstance();
        this.k = webClientInstance;
        if (webClientInstance == null) {
            n.c("EasyPayWebView Client:mwebViewClient Null");
        } else {
            n.c("EasyPayWebView Client:mwebViewClient");
            this.k.addAssistWebClientListener(this);
        }
    }

    public final synchronized void K() {
        PaytmPaymentTransactionCallback f;
        String str;
        try {
            n.c("Starting the Process...");
        } catch (Throwable th2) {
            throw th2;
        }
        if (getIntent() != null && getIntent().getBundleExtra(SDKConstants.PARAMETERS) != null) {
            this.e = getIntent().getBundleExtra(SDKConstants.PARAMETERS);
            if (this.e != null && this.e.size() > 0) {
                if (k.e() != null && this.c != null) {
                    this.c.setId(121);
                    this.c.postUrl(k.e().b, n.a(this.e).getBytes());
                    this.c.requestFocus(130);
                    if (k.e().a != null) {
                        if (k.e().a.getRequestParamMap() == null) {
                        }
                    }
                    f = k.e().f();
                    if (f != null) {
                        str = "Transaction failed due to invaild parameters";
                        f.onTransactionCancel(str, null);
                    }
                    finish();
                } else if (this.c == null) {
                    f = k.e().f();
                    if (f != null) {
                        str = "Transaction failed because of values becoming null";
                        f.onTransactionCancel(str, null);
                    }
                    finish();
                }
                throw th2;
            }
        }
    }

    public final void OnWcPageFinish(WebView webView, String str) {
        View view;
        Runnable cVar;
        if (this.d == null || this.d.getVisibility() != 0) {
            if (this.c != null && this.c.getVisibility() == 8) {
                view = this.c;
                cVar = new c();
            }
            n.c("Pg Activity:OnWcPageFinish");
        }
        view = this.d;
        cVar = new b();
        view.post(cVar);
        n.c("Pg Activity:OnWcPageFinish");
    }

    public final void OnWcPageStart(WebView webView, String str, Bitmap bitmap) {
        n.c("Pg Activity:OnWcPageStart");
    }

    public final void OnWcSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
        n.c("Pg Activity:OnWcSslError");
    }

    public final boolean WcshouldOverrideUrlLoading(WebView webView, Object obj) {
        return false;
    }

    public final void onActivityResult(int i, int i2, Intent intent) {
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
        if (i != 105) {
            return;
        }
        String b2 = L6.a.b(i2, "javascript:window.upiIntent.intentAppClosed(", ");");
        this.c.loadUrl(b2);
        n.c("Js for acknowldgement" + b2);
    }

    public final void onBackPressed() {
        G();
    }

    public final synchronized void onCreate(Bundle bundle) {
        try {
            requestWindowFeature(1);
            super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
            if (bundle != null) {
                if (k.e() != null && k.e().f() != null) {
                    k.e().f().onErrorProceed("Please retry with valid parameters");
                }
                finish();
            }
            if (this.m && J1.a.checkSelfPermission(this, "android.permission.RECEIVE_SMS") == 0 && J1.a.checkSelfPermission(this, "android.permission.READ_SMS") == 0) {
                this.l = new e(this);
                registerReceiver(this.l, new IntentFilter("android.provider.Telephony.SMS_RECEIVED"));
            }
            if (I()) {
                K();
            } else {
                finish();
                PaytmPaymentTransactionCallback f = k.e().f();
                if (f != null) {
                    f.someUIErrorOccurred("Some error occured while initializing UI of Payment Gateway Activity");
                }
            }
        } catch (Throwable th2) {
            throw th2;
        }
    }

    public final synchronized void onDestroy() {
        e eVar;
        try {
            try {
                if (this.m && (eVar = this.l) != null) {
                    unregisterReceiver(eVar);
                }
                k.e().g();
                m.a = null;
                PaytmAssist paytmAssist = this.h;
                if (paytmAssist != null) {
                    paytmAssist.removeAssist();
                }
            } catch (Exception e) {
                i.c().b("Redirection", e.getMessage());
                k.e().g();
                n.c("Some exception occurred while destroying the PaytmPGActivity.");
                n.b(e);
            }
            super.onDestroy();
            if (i.e != null) {
                i.e = null;
            }
        } catch (Throwable th2) {
            throw th2;
        }
    }

    public final void onResume() {
        super/*androidx.fragment.app.FragmentActivity*/.onResume();
    }

    public final void smsReceivedCallback(String str) {
        n.c("SMS received:" + str);
    }

    public final void WcshouldInterceptRequest(WebView webView, String str) {
    }
}