导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - QRPayActivity.java 源代码

正在查看: SpeedCash v6.5.1482 应用的 QRPayActivity.java JAVA 源代码文件

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


package com.bm.sc.bebasbayar.ui.activity.cash;

import android.app.AlertDialog;
import android.graphics.PorterDuff;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import com.bm.sc.bebasbayar.R;
import com.bm.sc.bebasbayar.handler.MessageComposer;
import com.bm.sc.bebasbayar.handler.MessageSender;
import com.bm.sc.bebasbayar.helper.Affinity;
import com.bm.sc.bebasbayar.iface.BBCallback;
import com.bm.sc.bebasbayar.iface.MessageProcess;
import com.bm.sc.bebasbayar.message.BaseMessage;
import com.bm.sc.bebasbayar.message.BusMessage;
import com.bm.sc.bebasbayar.message.MPMessage;
import com.bm.sc.bebasbayar.message.QRMessage;
import com.bm.sc.bebasbayar.message.mp.QRISMessage;
import com.bm.sc.bebasbayar.message.mp.ReportingMessage;
import com.bm.sc.bebasbayar.message.qr.DataMessage;
import com.bm.sc.bebasbayar.message.qr.TCICOQRMessage;
import com.bm.sc.bebasbayar.setting.ApiConfig;
import com.bm.sc.bebasbayar.setting.session.AppSession;
import com.bm.sc.bebasbayar.setting.session.ConfigSession;
import com.bm.sc.bebasbayar.ui.BaseActivity;
import com.bm.sc.bebasbayar.ui.activity.cash.QRPayActivity;
import com.bm.sc.bebasbayar.ui.fragment.BaseDialogFragment;
import com.bm.sc.bebasbayar.ui.fragment.dialog.TransactionReceiptProgressFragment;
import com.bm.sc.util.android.Compat;
import com.bm.sc.util.android.Device;
import com.bm.sc.util.common.Var;
import com.bm.sc.util.format.DateTime;
import com.bm.sc.util.format.Locales;
import com.bm.sc.util.format.Mapper;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.google.firebase.crashlytics.FirebaseCrashlytics;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

public class QRPayActivity extends BaseActivity implements BaseDialogFragment.OnDialogClosingListener {
    public static final String BODY = "bundle:body";
    public double A;
    public boolean B;
    public QRMessage C;
    public TCICOQRMessage D;
    public TextView E;
    public TextView F;
    public TextView G;
    public TextView H;
    public TextView I;
    public TextView J;
    public TextView K;
    public TextView L;
    public TextView M;
    public ImageView N;
    public LinearLayout O;
    public Button P;
    public Button Q;
    public View R;
    public View S;
    public EditText T;
    public AlertDialog U;
    public String V;
    public String W;
    public String X;
    public ArrayList<String> Y;
    public boolean c;
    public String d;
    public String e;
    public String f;
    public String g;
    public String h;
    public String i;
    public String j;
    public String k;
    public String l;
    public String m;
    public String n;
    public String o;
    public String p;
    public String q;
    public String r;
    public String s;
    public String t;
    public String u;
    public String v;
    public String w;
    public String x;
    public String y;
    public String z;

    public class a implements TextWatcher {
        public final TextView a;

        public a(TextView textView) {
            this.a = textView;
        }

        @Override
        public void afterTextChanged(Editable editable) {
            if (editable.toString().isEmpty() && editable.toString().equals("")) {
                this.a.setText(Locales.money(QRPayActivity.this.A));
            } else {
                this.a.setText(Locales.money(Double.valueOf(editable.toString().replaceAll("[^0-9]", "")).doubleValue() + QRPayActivity.this.A));
            }
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }
    }

    public class b implements TextWatcher {
        public final EditText a;
        public final TextView b;
        public final double c;

        public b(EditText editText, TextView textView, double d) {
            this.a = editText;
            this.b = textView;
            this.c = d;
        }

        @Override
        public void afterTextChanged(Editable editable) {
            double doubleValue;
            if (editable.toString().isEmpty() && editable.toString().equals("")) {
                this.a.setError("Harus diisi");
                this.b.setText(Locales.money("0"));
                return;
            }
            if (Double.valueOf(QRPayActivity.this.k).doubleValue() <= 0.0d || Double.valueOf(QRPayActivity.this.k).doubleValue() >= 1.0d) {
                doubleValue = Double.valueOf(editable.toString().replaceAll("[^0-9]", "")).doubleValue() + Double.valueOf(QRPayActivity.this.k).doubleValue();
                StringBuilder sb = new StringBuilder();
                sb.append("afterTextChanged: ");
                sb.append(doubleValue);
                this.b.setText(Locales.money(doubleValue));
            } else {
                double doubleValue2 = Double.valueOf(editable.toString().replaceAll("[^0-9]", "")).doubleValue();
                double doubleValue3 = Double.valueOf(QRPayActivity.this.k).doubleValue() * doubleValue2;
                doubleValue = doubleValue2 + Double.valueOf(QRPayActivity.this.k).doubleValue() + doubleValue3;
                StringBuilder sb2 = new StringBuilder();
                sb2.append("afterTextChanged: ");
                sb2.append(doubleValue3);
                QRPayActivity.this.M.setText(String.valueOf(doubleValue3));
                this.b.setText(Locales.money(doubleValue));
            }
            if (editable.toString().isEmpty()) {
                QRPayActivity.this.findViewById(R.id.btn_pay).setBackgroundResource(R.drawable.bb_button_grey_inactive_round_25);
                QRPayActivity.this.findViewById(R.id.btn_pay).setEnabled(false);
                return;
            }
            if (this.c >= doubleValue) {
                QRPayActivity.this.findViewById(R.id.btn_pay).setBackgroundResource(R.drawable.bb_background_gradient_round_25);
                QRPayActivity.this.findViewById(R.id.btn_pay).setEnabled(true);
                QRPayActivity.this.findViewById(R.id.btn_pay).setVisibility(0);
                QRPayActivity.this.findViewById(R.id.btn_top_up_form).setVisibility(8);
                return;
            }
            QRPayActivity qRPayActivity = QRPayActivity.this;
            if (qRPayActivity.c) {
                qRPayActivity.findViewById(R.id.btn_pay).setBackgroundResource(R.drawable.bb_background_gradient_round_25);
                QRPayActivity.this.findViewById(R.id.btn_pay).setEnabled(true);
                QRPayActivity.this.findViewById(R.id.btn_pay).setVisibility(0);
                QRPayActivity.this.findViewById(R.id.btn_top_up_form).setVisibility(8);
                return;
            }
            qRPayActivity.findViewById(R.id.btn_pay).setBackgroundResource(R.drawable.bb_button_grey_inactive_round_25);
            QRPayActivity.this.findViewById(R.id.btn_pay).setEnabled(false);
            QRPayActivity.this.findViewById(R.id.btn_pay).setVisibility(8);
            QRPayActivity.this.findViewById(R.id.btn_top_up_form).setVisibility(0);
        }

        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }

        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
        }
    }

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

        @Override
        public void afterProcess(BaseMessage baseMessage) {
            QRISMessage qRISMessage = new QRISMessage(baseMessage);
            if (!qRISMessage.isOK()) {
                if (qRISMessage.getResponse_code().equals("68") || qRISMessage.getResponse_code().equals("01") || qRISMessage.getResponse_code().equals("")) {
                    ReportingMessage reportingMessage = new ReportingMessage(baseMessage);
                    TransactionReceiptProgressFragment transactionReceiptProgressFragment = new TransactionReceiptProgressFragment();
                    transactionReceiptProgressFragment.setArguments(TransactionReceiptProgressFragment.getPaymentBundle(reportingMessage.getStruks(), reportingMessage.getValueFromIncludes(MPMessage.IncludeMessage.REFF_ID), null, null, null, null, 4, reportingMessage.getResponse_code(), qRISMessage.getValueFromIncludes(MPMessage.IncludeMessage.BILLER_PRODUCT_CODE)));
                    transactionReceiptProgressFragment.show(QRPayActivity.this.getSupportFragmentManager(), "PregressCetakUlang");
                    return;
                }
                if (qRISMessage.isNeedSetPin()) {
                    Affinity.dialogSetPin(QRPayActivity.this);
                    return;
                } else {
                    QRPayActivity.this.P(qRISMessage.getMessageDescription());
                    return;
                }
            }
            double d = Var.toDouble(qRISMessage.getValueFromAdditional_data(QRISMessage.NOMINAL), 0.0d);
            QRPayActivity.this.r = Var.toString(qRISMessage.getProcessing_code(), "");
            String valueFromAdditional_data = qRISMessage.getValueFromAdditional_data(QRISMessage.MERCHANT_PROFILE_URL);
            StringBuilder sb = new StringBuilder();
            sb.append("afterProcess: ");
            sb.append(qRISMessage.getValueFromIncludes(MPMessage.IncludeMessage.REFF_ID));
            StringBuilder sb2 = new StringBuilder();
            sb2.append("afterProcess: ");
            sb2.append(QRPayActivity.this.r);
            StringBuilder sb3 = new StringBuilder();
            sb3.append("afterProcess: ");
            sb3.append(Var.toString(qRISMessage.getTransmission_datetime(), ""));
            StringBuilder sb4 = new StringBuilder();
            sb4.append("afterProcess: ");
            sb4.append(Var.toString(qRISMessage.getValueFromAdditional_data(QRISMessage.ISSUER_ID), ""));
            TCICOQRMessage tCICOQRMessage = new TCICOQRMessage();
            tCICOQRMessage.put(DataMessage.ACTION, QRPayActivity.this.h);
            tCICOQRMessage.put("search_id", qRISMessage.getValueFromAdditional_data(QRISMessage.MEMBER_ID_TUJUAN));
            tCICOQRMessage.put(DataMessage.ID_TRANSAKSI, qRISMessage.getValueFromIncludes(MPMessage.IncludeMessage.REFF_ID));
            int i = QRISMessage.MERCHANT_NAME;
            tCICOQRMessage.put("search_name", qRISMessage.getValueFromAdditional_data(i));
            if (URLUtil.isValidUrl(valueFromAdditional_data)) {
                tCICOQRMessage.put("image", valueFromAdditional_data);
                tCICOQRMessage.put("image_logo", valueFromAdditional_data);
            }
            tCICOQRMessage.put("customer_info", "");
            tCICOQRMessage.put("note", qRISMessage.getValueFromAdditional_data(QRISMessage.DESC_KIRIM));
            tCICOQRMessage.put("nominal", Double.valueOf(d));
            tCICOQRMessage.put("fee", QRPayActivity.this.k);
            tCICOQRMessage.put("acquirer_id", QRPayActivity.this.o);
            tCICOQRMessage.put("terminal_id", QRPayActivity.this.p);
            tCICOQRMessage.put("merchant_pan", QRPayActivity.this.q);
            tCICOQRMessage.put("customer_pan", Var.toString(qRISMessage.getValueFromAdditional_data(QRISMessage.ADDITIONAL_DATA_NATIONAL), ""));
            tCICOQRMessage.put("terminal_location", QRPayActivity.this.t);
            tCICOQRMessage.put("receipt_number", QRPayActivity.this.u);
            tCICOQRMessage.put("source_of_fund", QRPayActivity.this.v);
            tCICOQRMessage.put("transaction_date_time", Var.toString(qRISMessage.getTransmission_datetime(), ""));
            tCICOQRMessage.put("call_center", QRPayActivity.this.x);
            tCICOQRMessage.put("balance", qRISMessage.getValueFromIncludes("balance"));
            tCICOQRMessage.put(QRMessage.USERCODE, "QRIS");
            QRPayActivity.this.C = new QRMessage();
            QRPayActivity.this.C.put("rc", qRISMessage.getResponse_code());
            QRPayActivity.this.C.put("rd", "Bayar " + qRISMessage.getValueFromAdditional_data(i));
            QRPayActivity.this.C.put("data", tCICOQRMessage);
            if (!QRPayActivity.this.B) {
                QRPayActivity.this.X();
                return;
            }
            ReportingMessage reportingMessage2 = new ReportingMessage(baseMessage);
            TransactionReceiptProgressFragment transactionReceiptProgressFragment2 = new TransactionReceiptProgressFragment();
            transactionReceiptProgressFragment2.setArguments(TransactionReceiptProgressFragment.getPaymentBundle(reportingMessage2.getStruks(), reportingMessage2.getValueFromIncludes(MPMessage.IncludeMessage.REFF_ID), null, null, null, null, 4, reportingMessage2.getResponse_code(), qRISMessage.getValueFromIncludes(MPMessage.IncludeMessage.BILLER_PRODUCT_CODE)));
            transactionReceiptProgressFragment2.show(QRPayActivity.this.getSupportFragmentManager(), "PregressCetakUlang");
        }

        @Override
        public void backgroundProcess(long j, long j2, boolean z) {
        }

        @Override
        public void preProcess() {
            QRPayActivity.this.hideKeyboard();
        }
    }

    public void R(int i, Boolean bool) {
        finish();
    }

    public void S(int i, Boolean bool) {
        if (this.d.equals("CHECK")) {
            return;
        }
        finish();
    }

    public void T(EditText editText, View view) {
        String var;
        if (Var.toString(editText.getText(), "").matches("")) {
            if (Var.toString(editText.getText(), "").matches("")) {
                Affinity.info(this, false, "Kolom PIN tidak boleh kosong!");
                return;
            } else {
                Affinity.info(this, false, "PIN yg Anda masukkan salah!");
                editText.setText("");
                return;
            }
        }
        String var2 = Var.toString(editText.getText(), "");
        this.l = this.T.getText().toString().replace(".", "");
        this.n = this.M.getText().toString().trim();
        if (this.d.equals("CHECK")) {
            var = ((EditText) this.R.findViewById(R.id.scti_input)).getText().toString().replace(".", "");
            if (var.isEmpty() || Var.toInt(var, 0) < 0) {
                Affinity.info(this, false, "Mohon isikan nilai nominal terlebih dahulu");
                this.U.dismiss();
                return;
            }
        } else {
            var = Var.toString(Double.valueOf(this.A), "0");
        }
        if ((this.l.equals("0") || this.l.equals("")) && Double.valueOf(this.k).doubleValue() > 1.0d) {
            this.m = this.k;
        } else if (Double.valueOf(this.k).doubleValue() >= 1.0d || Double.valueOf(this.k).doubleValue() <= 0.0d) {
            this.m = this.l;
        } else {
            this.m = this.n;
        }
        if (this.j.equals("QRIS")) {
            Y(var, this.m, var2);
            this.U.dismiss();
        } else {
            Affinity.info(this, false, "User Code Not QRIS");
            this.U.dismiss();
        }
    }

    public void U(View view) {
        this.U.dismiss();
    }

    public void V() {
        Affinity.dialogSetPin(this);
    }

    public void W(View view) {
        this.U.dismiss();
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                QRPayActivity.this.V();
            }
        }, 500L);
    }

    public final void O(int i, Exception exc) {
        String str;
        String string = getString(R.string.title_warning);
        StringBuilder sb = new StringBuilder();
        sb.append("Transaksi pembayaran tidak valid #");
        sb.append(i);
        if (!ApiConfig.isLoggable() || exc == null) {
            str = "";
        } else {
            str = ", " + exc.getMessage();
        }
        sb.append(str);
        Affinity.info(this, -1, string, sb.toString(), new BBCallback() {
            @Override
            public final void do_callback(int i2, Object obj) {
                QRPayActivity.this.R(i2, (Boolean) obj);
            }
        });
    }

    public final void P(String str) {
        Affinity.info(this, -1, "Informasi", str, new BBCallback() {
            @Override
            public final void do_callback(int i, Object obj) {
                QRPayActivity.this.S(i, (Boolean) obj);
            }
        });
    }

    public final void Q() {
        this.P = (Button) findViewById(R.id.btn_pay);
        this.Q = (Button) findViewById(R.id.btn_print);
        this.E = (TextView) findViewById(R.id.success_title);
        this.F = (TextView) findViewById(R.id.success_msg);
        this.H = (TextView) findViewById(R.id.merchant_tujuan_label);
        this.G = (TextView) findViewById(R.id.merchant_tujuan);
        this.I = (TextView) findViewById(R.id.merchant_tujuan_sub);
        this.N = (ImageView) findViewById(R.id.merchant_img);
        this.O = (LinearLayout) findViewById(R.id.success_poin_layout);
        this.J = (TextView) findViewById(R.id.success_poin_msg);
        this.T = (EditText) findViewById(R.id.et_fee);
        FrameLayout frameLayout = (FrameLayout) findViewById(R.id.qr_details_persen);
        this.K = (TextView) findViewById(R.id.tv_info_tip);
        this.L = (TextView) findViewById(R.id.nominal_cur);
        RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.rl_info_tip);
        RelativeLayout relativeLayout2 = (RelativeLayout) findViewById(R.id.rl_info_tip_qr);
        RelativeLayout relativeLayout3 = (RelativeLayout) findViewById(R.id.rl_info_tip_qr_persen);
        TextView textView = (TextView) findViewById(R.id.tv_fee_detail);
        this.M = (TextView) findViewById(R.id.tv_fee_persen);
        findViewById(R.id.btn_top_up_form).setVisibility(8);
        findViewById(R.id.btn_top_up).setOnClickListener(this);
        String retrieve = this.appSession.retrieve(AppSession.PROPERTY_BALANCE);
        ArrayList arrayList = new ArrayList(this.configSession.retrieveSet(ConfigSession.PROPERTY_WHITE_LIST_ID));
        this.Y = new ArrayList<>();
        for (int i = 0; i < arrayList.size(); i++) {
            Object obj = ((HashMap) arrayList.get(i)).get(DataMessage.ID_OUTLET);
            Objects.requireNonNull(obj);
            if (!obj.toString().equals("")) {
                ArrayList<String> arrayList2 = this.Y;
                Object obj2 = ((HashMap) arrayList.get(i)).get(DataMessage.ID_OUTLET);
                Objects.requireNonNull(obj2);
                arrayList2.add(obj2.toString());
            }
        }
        this.c = false;
        ArrayList<String> arrayList3 = this.Y;
        if (arrayList3 != null && arrayList3.size() > 0) {
            for (int i2 = 0; i2 < this.Y.size(); i2++) {
                if (this.Y.get(i2).equals(this.appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID))) {
                    this.c = true;
                }
            }
        }
        double d = Var.toDouble(retrieve, 0.0d);
        if (Var.toDouble(this.k, 0.0d) > 0.0d) {
            if (d >= Var.toDouble(this.k, 0.0d)) {
                findViewById(R.id.btn_top_up_form).setVisibility(8);
                findViewById(R.id.btn_pay).setVisibility(0);
            } else if (this.c) {
                findViewById(R.id.btn_top_up_form).setVisibility(8);
                findViewById(R.id.btn_pay).setVisibility(0);
            } else {
                findViewById(R.id.btn_top_up_form).setVisibility(0);
                findViewById(R.id.btn_pay).setVisibility(8);
                findViewById(R.id.btn_pay).setBackgroundResource(R.drawable.bb_button_grey_inactive_round_25);
                findViewById(R.id.btn_pay).setEnabled(false);
            }
        }
        if (Var.toDouble(Double.valueOf(this.A), 0.0d) > 0.0d) {
            if (d >= Var.toDouble(Double.valueOf(this.A), 0.0d)) {
                findViewById(R.id.btn_top_up_form).setVisibility(8);
                findViewById(R.id.btn_pay).setVisibility(0);
            } else if (this.c) {
                findViewById(R.id.btn_top_up_form).setVisibility(8);
                findViewById(R.id.btn_pay).setVisibility(0);
            } else {
                findViewById(R.id.btn_top_up_form).setVisibility(0);
                findViewById(R.id.btn_pay).setVisibility(8);
                findViewById(R.id.btn_pay).setBackgroundResource(R.drawable.bb_button_grey_inactive_round_25);
                findViewById(R.id.btn_pay).setEnabled(false);
            }
        }
        StringBuilder sb = new StringBuilder();
        sb.append("initUI: ");
        sb.append(this.A);
        StringBuilder sb2 = new StringBuilder();
        sb2.append("initUI: ");
        sb2.append(this.k);
        if ((!String.valueOf(this.A).equals("0.0") && !String.valueOf(this.A).equals("")) || (!this.k.equals("0.0") && !this.k.isEmpty())) {
            if (!(String.valueOf(this.A).equals("0.0") && String.valueOf(this.A).equals("")) && (this.k.equals("0.0") || this.k.isEmpty())) {
                relativeLayout2.setVisibility(0);
                this.K.setVisibility(0);
            } else if (!String.valueOf(this.A).equals("0.0")) {
                relativeLayout.setVisibility(0);
                this.K.setVisibility(0);
                textView.setText(Locales.money(this.k).replace("Rp", ""));
            } else if (String.valueOf(this.A).equals("0.0")) {
                frameLayout.setVisibility(0);
                if (Double.valueOf(this.k).doubleValue() >= 1.0d || Double.valueOf(this.k).doubleValue() <= 0.0d) {
                    relativeLayout.setVisibility(0);
                    this.K.setVisibility(0);
                    textView.setText(Locales.money(this.k).replace("Rp", ""));
                } else {
                    relativeLayout3.setVisibility(0);
                    this.K.setVisibility(0);
                    this.M.setText(this.k);
                    StringBuilder sb3 = new StringBuilder();
                    sb3.append("onClick: ");
                    sb3.append(this.m);
                }
            }
        }
        if (!this.V.equals("C")) {
            this.K.setVisibility(8);
            relativeLayout2.setVisibility(8);
            this.T.setEnabled(false);
        } else if (this.k.equals("0.0") || this.k.isEmpty()) {
            this.T.setVisibility(0);
            this.T.setEnabled(true);
        } else {
            this.T.setEnabled(false);
        }
        TextView textView2 = (TextView) findViewById(R.id.qr_pay);
        textView2.setText(this.k);
        this.M.setText(this.k);
        this.T.addTextChangedListener(new a(textView2));
        String str = this.d;
        str.hashCode();
        if (str.equals("CHECK_BUY")) {
            this.h = "BUY";
            this.N.setVisibility(0);
            Glide.with(this).load(this.D.get("image_logo")).apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL).override(this.N.getWidth(), this.N.getHeight())).into(this.N);
            if (this.i.isEmpty()) {
                this.R = View.inflate(this, R.layout.component_qr_buy, (ViewGroup) findViewById(R.id.qr_details));
                View inflate = View.inflate(this, R.layout.component_qr_buy, (ViewGroup) findViewById(R.id.qr_details_persen));
                this.S = inflate;
                inflate.setVisibility(8);
                if (this.o.isEmpty() && this.o.equals("")) {
                    ((TextView) this.R.findViewById(R.id.info_acq_name)).setText("-");
                } else {
                    ((TextView) this.R.findViewById(R.id.info_acq_name)).setText(this.o);
                }
                if (this.p.isEmpty() && this.p.equals("")) {
                    ((TextView) this.R.findViewById(R.id.info_terminal_id)).setText("-");
                } else {
                    ((TextView) this.R.findViewById(R.id.info_terminal_id)).setText(this.p);
                }
                if (this.q.isEmpty() && this.q.equals("")) {
                    ((TextView) this.R.findViewById(R.id.info_merchant_pan)).setText("-");
                } else {
                    ((TextView) this.R.findViewById(R.id.info_merchant_pan)).setText(this.q);
                }
                if (this.s.isEmpty() && this.s.equals("")) {
                    ((TextView) this.R.findViewById(R.id.info_customer_pan)).setText("-");
                } else {
                    ((TextView) this.R.findViewById(R.id.info_customer_pan)).setText(this.s);
                }
                if (this.t.isEmpty() && this.t.equals("")) {
                    ((TextView) this.R.findViewById(R.id.info_terminal_location)).setText("-");
                } else {
                    ((TextView) this.R.findViewById(R.id.info_terminal_location)).setText(this.t);
                }
                if (this.u.isEmpty() && this.u.equals("")) {
                    ((TextView) this.R.findViewById(R.id.info_receipt_number)).setText("-");
                } else {
                    ((TextView) this.R.findViewById(R.id.info_receipt_number)).setText(this.u);
                }
                if (this.v.isEmpty() && this.v.equals("")) {
                    ((TextView) this.R.findViewById(R.id.info_source_of_fund)).setText("-");
                } else {
                    ((TextView) this.R.findViewById(R.id.info_source_of_fund)).setText(this.v);
                }
                if (this.w.isEmpty() && this.w.equals("")) {
                    ((TextView) this.R.findViewById(R.id.info_trans_date_time)).setText("-");
                } else {
                    ((TextView) this.R.findViewById(R.id.info_trans_date_time)).setText(DateTime.dateConverter(this.w, "yyyyMMddHHmmss"));
                }
                if (this.x.isEmpty() && this.x.equals("")) {
                    ((TextView) this.R.findViewById(R.id.info_call_center)).setText(this.x);
                } else {
                    ((TextView) this.R.findViewById(R.id.info_call_center)).setText(this.x);
                }
            } else {
                this.R = View.inflate(this, R.layout.component_qr_spi, (ViewGroup) findViewById(R.id.qr_details));
                View inflate2 = View.inflate(this, R.layout.component_qr_spi, (ViewGroup) findViewById(R.id.qr_details_persen));
                this.S = inflate2;
                inflate2.setVisibility(8);
                ((TextView) this.R.findViewById(R.id.info_spi_buyer)).setText(this.i);
                ((TextView) this.R.findViewById(R.id.info_spi)).setText(this.g);
            }
            double doubleValue = Double.valueOf(this.k).doubleValue() + this.A;
            StringBuilder sb4 = new StringBuilder();
            sb4.append("afterTextChanged: ");
            sb4.append(doubleValue);
            textView2.setText(Locales.money(doubleValue));
        } else if (str.equals("CHECK")) {
            this.h = "TRANSFER";
            String var = Var.toString(this.D.get("image_logo"), "");
            if (URLUtil.isValidUrl(var)) {
                this.N.setVisibility(0);
                Glide.with(this).load(var).apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL).override(this.N.getWidth(), this.N.getHeight())).into(this.N);
            } else {
                this.N.setVisibility(8);
            }
            double doubleValue2 = !this.k.isEmpty() ? Double.valueOf(this.k).doubleValue() + this.A : this.A;
            StringBuilder sb5 = new StringBuilder();
            sb5.append("afterTextChanged: ");
            sb5.append(doubleValue2);
            textView2.setText(Locales.money(doubleValue2));
            this.R = View.inflate(this, R.layout.component_qr_transfer_saldo, (ViewGroup) findViewById(R.id.qr_details));
            View inflate3 = View.inflate(this, R.layout.component_qr_buy, (ViewGroup) findViewById(R.id.qr_details_persen));
            this.S = inflate3;
            inflate3.setVisibility(8);
            if (this.i.isEmpty()) {
                if (this.o.isEmpty() && this.o.equals("")) {
                    ((TextView) this.S.findViewById(R.id.info_acq_name)).setText("-");
                } else {
                    ((TextView) this.S.findViewById(R.id.info_acq_name)).setText(this.o);
                }
                if (this.p.isEmpty() && this.p.equals("")) {
                    ((TextView) this.S.findViewById(R.id.info_terminal_id)).setText("-");
                } else {
                    ((TextView) this.S.findViewById(R.id.info_terminal_id)).setText(this.p);
                }
                if (this.q.isEmpty() && this.q.equals("")) {
                    ((TextView) this.S.findViewById(R.id.info_merchant_pan)).setText("-");
                } else {
                    ((TextView) this.S.findViewById(R.id.info_merchant_pan)).setText(this.q);
                }
                if (this.s.isEmpty() && this.s.equals("")) {
                    ((TextView) this.S.findViewById(R.id.info_customer_pan)).setText("-");
                } else {
                    ((TextView) this.S.findViewById(R.id.info_customer_pan)).setText(this.s);
                }
                if (this.t.isEmpty() && this.t.equals("")) {
                    ((TextView) this.S.findViewById(R.id.info_terminal_location)).setText("-");
                } else {
                    ((TextView) this.S.findViewById(R.id.info_terminal_location)).setText(this.t);
                }
                if (this.u.isEmpty() && this.u.equals("")) {
                    ((TextView) this.S.findViewById(R.id.info_receipt_number)).setText("-");
                } else {
                    ((TextView) this.S.findViewById(R.id.info_receipt_number)).setText(this.u);
                }
                if (this.v.isEmpty() && this.v.equals("")) {
                    ((TextView) this.S.findViewById(R.id.info_source_of_fund)).setText("-");
                } else {
                    ((TextView) this.S.findViewById(R.id.info_source_of_fund)).setText(this.v);
                }
                if (this.w.isEmpty() && this.w.equals("")) {
                    ((TextView) this.S.findViewById(R.id.info_trans_date_time)).setText("-");
                } else {
                    ((TextView) this.S.findViewById(R.id.info_trans_date_time)).setText(DateTime.dateConverter(this.w, "yyyyMMddHHmmss"));
                }
                if (this.x.isEmpty() && this.x.equals("")) {
                    ((TextView) this.S.findViewById(R.id.info_call_center)).setText(this.x);
                } else {
                    ((TextView) this.S.findViewById(R.id.info_call_center)).setText(this.x);
                }
            } else {
                View inflate4 = View.inflate(this, R.layout.component_qr_spi, (ViewGroup) findViewById(R.id.qr_details_persen));
                this.S = inflate4;
                ((TextView) inflate4.findViewById(R.id.info_spi_buyer)).setText(this.i);
                ((TextView) this.S.findViewById(R.id.info_spi)).setText(this.g);
            }
            EditText editText = (EditText) this.R.findViewById(R.id.scti_input);
            editText.addTextChangedListener(new b(editText, textView2, d));
            TextView textView3 = (TextView) findViewById(R.id.merchant_tujuan_sub);
            textView3.setVisibility(0);
            if (this.j.equals("QRIS")) {
                textView3.setText("ID: " + this.y);
            } else {
                textView3.setText("ID: " + this.e);
            }
        } else {
            O(2, null);
        }
        ((TextView) findViewById(R.id.merchant_tujuan)).setText(this.f);
        ((TextView) findViewById(R.id.qr_tujuan)).setText("Bayar " + this.f);
        ((TextView) findViewById(R.id.qr_balance)).setText(Locales.money(this.appSession.retrieve(AppSession.PROPERTY_BALANCE)));
        this.P.setOnClickListener(this);
        this.Q.setOnClickListener(this);
    }

    public final void X() {
        this.U.dismiss();
        this.H.setVisibility(8);
        this.G.setVisibility(8);
        this.I.setVisibility(8);
        this.N.setVisibility(8);
        this.P.setVisibility(8);
        this.T.setVisibility(8);
        this.L.setVisibility(8);
        this.E.setVisibility(0);
        this.F.setVisibility(0);
        this.E.setVisibility(0);
        this.E.setVisibility(0);
        this.O.setVisibility(0);
        this.Q.setVisibility(0);
        TCICOQRMessage tCICOQRMessage = new TCICOQRMessage((Map) this.C.get("data"));
        if (this.d.equals("CHECK")) {
            this.R.setVisibility(8);
            this.S.setVisibility(0);
            String var = Var.toString(tCICOQRMessage.get("transaction_date_time"), "");
            ((TextView) this.S.findViewById(R.id.info_customer_pan)).setText(Var.toString(tCICOQRMessage.get("customer_pan"), ""));
            ((TextView) this.S.findViewById(R.id.info_receipt_number)).setText(this.u);
            ((TextView) this.S.findViewById(R.id.info_trans_date_time)).setText(DateTime.dateConverter(var, "yyyyMMddHHmmss"));
            LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.F.getLayoutParams();
            layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin, layoutParams.rightMargin, (int) (getResources().getDimension(R.dimen.bb_icon_standard) / getResources().getDisplayMetrics().density));
            this.F.setLayoutParams(layoutParams);
            this.F.setText(Compat.Html_fromHtml(getString(R.string.qr_success_msg_transfer, this.f)));
        } else {
            this.K.setVisibility(8);
            this.F.setText(Compat.Html_fromHtml(getString(R.string.qr_success_msg_buy, this.f, tCICOQRMessage.get(DataMessage.ID_TRANSAKSI))));
            String var2 = Var.toString(tCICOQRMessage.get("transaction_date_time"), "");
            ((TextView) this.R.findViewById(R.id.info_customer_pan)).setText(Var.toString(tCICOQRMessage.get("customer_pan"), ""));
            ((TextView) this.R.findViewById(R.id.info_receipt_number)).setText(this.u);
            ((TextView) this.R.findViewById(R.id.info_trans_date_time)).setText(DateTime.dateConverter(var2, "yyyyMMddHHmmss"));
        }
        Compat.setBackground(findViewById(R.id.qr_balance_layout), AppCompatResources.getDrawable(this, R.drawable.border_thin_round_bottom));
        int color = ContextCompat.getColor(this, R.color.Black);
        TextView textView = (TextView) findViewById(R.id.qr_balance_label);
        textView.setTextColor(color);
        textView.setText("Sisa Saldo SpeedCash");
        double d = Var.toDouble(tCICOQRMessage.get("balance"), -1.0d);
        if (d < 0.0d) {
            double d2 = Var.toDouble(tCICOQRMessage.get("nominal"), -1.0d);
            if (d2 < 0.0d) {
                d2 = Var.toDouble(this.D.get("nominal"), 0.0d);
            }
            d = Var.toDouble(this.appSession.retrieve(AppSession.PROPERTY_BALANCE), 0.0d) - d2;
        }
        this.appSession.store(AppSession.PROPERTY_BALANCE, String.valueOf(d));
        TextView textView2 = (TextView) findViewById(R.id.qr_balance);
        textView2.setTextColor(color);
        textView2.setText(Locales.money(d));
        this.J.setText(Compat.Html_fromHtml(getString(R.string.qr_bonus_poin_info, String.valueOf(Var.toInt(tCICOQRMessage.get("point"), 0)))));
        findViewById(R.id.success_poin_layout).setVisibility(8);
    }

    public final void Y(String str, String str2, String str3) {
        AppSession appSession = new AppSession(this);
        QRISMessage qRISMessage = new QRISMessage(appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID), str3, appSession.retrieve(AppSession.PROPERTY_AUTH_TOKEN), this.z);
        qRISMessage.setIsPayment(true);
        qRISMessage.setRawData(Var.toString(this.D.get("RAW"), ""));
        qRISMessage.setNominal(Var.toDouble(str, 0.0d));
        qRISMessage.setNominalAdmin(Var.toDouble(str2, 0.0d));
        qRISMessage.setAdditional_dataValue(QRISMessage.MEMBER_ID_TUJUAN, Var.toString(this.D.get("search_id"), ""));
        qRISMessage.setIncludesValue(MPMessage.IncludeMessage.REFF_ID, Var.toString(this.D.get(DataMessage.ID_TRANSAKSI), ""));
        Device.getAddressLocation(this);
        qRISMessage.setAdditional_dataValue(109, Device.getLogDevice(this));
        MessageComposer messageComposer = new MessageComposer(1, "");
        messageComposer.setRequest_method(MessageComposer.POST);
        messageComposer.setData_type(1);
        messageComposer.setIs_credential(true);
        messageComposer.setIs_encrypted(true);
        messageComposer.setShowProgressRegular(true);
        messageComposer.setMessageProcess(new c());
        MessageSender messageSender = new MessageSender(this, messageComposer);
        messageSender.setRequestMessage(qRISMessage);
        messageSender.execute();
    }

    public void downloadStruk(String str, String str2) {
        Affinity.download_file(this, str, str2);
    }

    @Override
    public int getLayoutResource() {
        return R.layout.activity_qr_pay;
    }

    @Override
    public String getWikiNameSpace() {
        return null;
    }

    @Override
    public boolean isEligibleForFavorit() {
        return false;
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == 2131362377) {
            View inflate = getLayoutInflater().inflate(R.layout.widget_input_pin_dialog, (ViewGroup) null);
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
            builder.setView(inflate);
            AlertDialog create = builder.create();
            this.U = create;
            create.show();
            Button button = (Button) this.U.findViewById(R.id.button_ok);
            Button button2 = (Button) this.U.findViewById(R.id.button_cancel);
            final EditText editText = (EditText) this.U.findViewById(R.id.password_field);
            TextView textView = (TextView) this.U.findViewById(R.id.btn_forgot_pin);
            if (this.d.equals("CHECK")) {
                String replace = ((EditText) this.R.findViewById(R.id.scti_input)).getText().toString().replace(".", "");
                if (replace.isEmpty() || Var.toInt(replace, 0) < 0) {
                    Affinity.info(this, false, "Mohon isikan nilai nominal terlebih dahulu");
                    this.U.dismiss();
                    return;
                } else if (replace.isEmpty() || Var.toInt(replace, 0) == 0) {
                    Affinity.info(this, false, "Mohon isikan nilai nominal terlebih dahulu");
                    this.U.dismiss();
                    return;
                }
            }
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view2) {
                    QRPayActivity.this.T(editText, view2);
                }
            });
            button2.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view2) {
                    QRPayActivity.this.U(view2);
                }
            });
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public final void onClick(View view2) {
                    QRPayActivity.this.W(view2);
                }
            });
            return;
        }
        if (view.getId() != 2131362395) {
            if (view.getId() != 2131362439) {
                super.onClick(view);
                return;
            } else {
                Affinity.launch(this, Deposit2Activity.class);
                finish();
                return;
            }
        }
        String var = Var.toString(new TCICOQRMessage((Map) this.C.get("data")).get(DataMessage.ID_TRANSAKSI), "");
        this.W = "SPEEDCASH - Struk " + var + ".pdf";
        this.X = this.configSession.retrieveMap(ConfigSession.PROPERTY_URL, ConfigSession.KEY_URL_INVOICE) + "?ispdf=pdf&url=" + URLEncoder.encode(this.configSession.retrieveMap(ConfigSession.PROPERTY_URL, ConfigSession.KEY_URL_INVOICE).replace("https", "http") + "invoice/" + (this.j.equals("QRIS") ? "qris" : !this.i.isEmpty() ? "scpibb" : TransferWithdrawActivity.RESULT_SCTI) + "/" + var + "?lite=true");
        if (Build.VERSION.SDK_INT >= 33) {
            if (Affinity.isPermissionGranted(this, "android.permission.READ_MEDIA_IMAGES")) {
                downloadStruk(this.W, this.X);
                return;
            } else {
                ActivityCompat.requestPermissions(this, new String[]{"android.permission.READ_MEDIA_IMAGES", "android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE"}, 446);
                return;
            }
        }
        if (Affinity.isPermissionGranted(this, "android.permission.READ_EXTERNAL_STORAGE") || Affinity.isPermissionGranted(this, "android.permission.WRITE_EXTERNAL_STORAGE")) {
            downloadStruk(this.W, this.X);
        } else {
            ActivityCompat.requestPermissions(this, new String[]{"android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE"}, 446);
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        getToolbar().setBackgroundColor(ContextCompat.getColor(this, R.color.colorBackground));
        if (getToolbar().getNavigationIcon() != null) {
            getToolbar().getNavigationIcon().setColorFilter(ContextCompat.getColor(this, R.color.colorPrimary), PorterDuff.Mode.SRC_IN);
        }
        try {
            Bundle extras = getIntent().getExtras();
            Objects.requireNonNull(extras);
            QRMessage qRMessage = new QRMessage(Mapper.jsonToMap(extras.getString("bundle:body")));
            this.B = extras.getBoolean("isFromShare", false);
            TCICOQRMessage tCICOQRMessage = new TCICOQRMessage((Map) qRMessage.get("data"));
            this.D = tCICOQRMessage;
            this.d = Var.toString(tCICOQRMessage.get(DataMessage.ACTION), "");
            this.e = Var.toString(this.D.get("search_id"), "");
            if (this.d.equals("CHECK_BUY")) {
                this.e = Var.toString(this.D.get(DataMessage.ID_TRANSAKSI), "");
            }
            this.f = Var.toString(this.D.get("search_name"), "");
            Var.toString(this.D.get("image"), "");
            this.i = Var.toString(this.D.get("customer_info"), "");
            this.g = Var.toString(this.D.get("note"), "-");
            this.A = Var.toDouble(this.D.get("nominal"), 0.0d);
            this.j = Var.toString(qRMessage.get(QRMessage.USERCODE), "");
            Var.toString(qRMessage.get("rd"), "Bayar " + this.f);
            this.k = String.valueOf(Var.toDouble(this.D.get("fee"), 0.0d));
            this.o = Var.toString(this.D.get("acquirer_id"), "");
            this.p = Var.toString(this.D.get("terminal_id"), "");
            this.q = Var.toString(this.D.get("merchant_pan"), "");
            this.s = Var.toString(this.D.get("customer_pan"), "");
            this.t = Var.toString(this.D.get("terminal_location"), "");
            this.u = Var.toString(this.D.get("receipt_number"), "");
            this.v = Var.toString(this.D.get("source_of_fund"), "");
            this.w = Var.toString(this.D.get("transaction_date_time"), "");
            this.x = Var.toString(this.D.get("call_center"), "");
            this.y = Var.toString(this.D.get("merchant_id_qris"), "");
            this.z = Var.toString(this.D.get("product_code"), "");
            this.V = Var.toString(this.D.get(TCICOQRMessage.SETTING_TIPS), "");
            Q();
        } catch (Exception e) {
            FirebaseCrashlytics.getInstance().recordException(e);
            if (ApiConfig.isLoggable()) {
                Log.wtf(getClass().getName(), e);
            }
            O(1, e);
        }
    }

    @Override
    public void onDialogClosed(BaseDialogFragment baseDialogFragment) {
        finish();
    }

    @Override
    public void onDialogClosing(BaseDialogFragment baseDialogFragment, Object obj) {
    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onMessageEvent(BusMessage busMessage) {
        if (busMessage.getEventType() == 1) {
            this.appSession.store(AppSession.PROPERTY_BALANCE, Var.toString(Double.valueOf(busMessage.getBalance()), "0"));
            TextView textView = (TextView) findViewById(R.id.qr_balance);
            if (textView != null) {
                textView.setText(Locales.money(this.appSession.retrieve(AppSession.PROPERTY_BALANCE)));
            }
        }
    }

    public void onPause() {
        super/*androidx.fragment.app.FragmentActivity*/.onPause();
        EventBus.getDefault().unregister(this);
    }

    @Override
    public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        if (i == 446 && iArr.length > 0 && iArr[0] == 0) {
            downloadStruk(this.W, this.X);
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        TextView textView = (TextView) findViewById(R.id.qr_balance);
        if (textView != null) {
            textView.setText(Locales.money(this.appSession.retrieve(AppSession.PROPERTY_BALANCE)));
        }
    }

    public void onStart() {
        super.onStart();
        if (EventBus.getDefault().isRegistered(this)) {
            return;
        }
        EventBus.getDefault().register(this);
    }
}