导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - InvoiceActivity.java 源代码

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

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


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

import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.webkit.URLUtil;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import androidx.annotation.NonNull;
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.handler.QRISO;
import com.bm.sc.bebasbayar.helper.Affinity;
import com.bm.sc.bebasbayar.helper.Buttonizer;
import com.bm.sc.bebasbayar.iface.BBCallback;
import com.bm.sc.bebasbayar.iface.MessageProcess;
import com.bm.sc.bebasbayar.iface.ShowcaseInterface;
import com.bm.sc.bebasbayar.message.BaseMessage;
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.qr.DataMessage;
import com.bm.sc.bebasbayar.message.qr.SCTIMessage;
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.SuperActivity;
import com.bm.sc.bebasbayar.ui.activity.account.MyQrCodeActivity;
import com.bm.sc.bebasbayar.ui.activity.cash.InvoiceActivity;
import com.bm.sc.bebasbayar.ui.fragment.cash.InvoiceHelpFragment;
import com.bm.sc.bebasbayar.ui.widget.AbstractFormattedEditText;
import com.bm.sc.bebasbayar.ui.widget.MessageProgressDialog;
import com.bm.sc.util.common.Var;
import com.bm.sc.util.format.Mapper;
import com.bm.sc.util.format.RSA;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.ResultPoint;
import com.journeyapps.barcodescanner.BarcodeCallback;
import com.journeyapps.barcodescanner.BarcodeResult;
import com.journeyapps.barcodescanner.CaptureManager;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
import com.journeyapps.barcodescanner.DefaultDecoderFactory;
import com.rabbitmq.client.Connection;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
import org.jetbrains.annotations.NotNull;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseView;

public class InvoiceActivity extends SuperActivity implements DecoratedBarcodeView.TorchListener, ShowcaseInterface, View.OnClickListener, View.OnTouchListener {
    public CaptureManager b;
    public DecoratedBarcodeView c;
    public Connection d;
    public MessageProgressDialog e;
    public ImageView f;
    public MenuItem g;
    public AbstractFormattedEditText h;
    public AbstractFormattedEditText i;
    public EditText j;
    public BottomSheetBehavior k;
    public Button l;
    public boolean 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 class a extends BottomSheetBehavior.BottomSheetCallback {
        public a() {
        }

        public void onSlide(@NonNull View view, float f) {
        }

        public void onStateChanged(@NonNull View view, int i) {
            if (i == 4) {
                InvoiceActivity.this.K();
            }
        }
    }

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

        public void c(int i, Boolean bool) {
            InvoiceActivity.this.c.resume();
        }

        public void d(int i, Boolean bool) {
            InvoiceActivity.this.c.resume();
        }

        public void barcodeResult(BarcodeResult barcodeResult) {
            String text = barcodeResult.getText();
            StringBuilder sb = new StringBuilder();
            sb.append("barcodeResult: ");
            sb.append(text);
            if (ApiConfig.isLoggable()) {
                Affinity.toast(InvoiceActivity.this, text);
            }
            InvoiceActivity.this.c.pauseAndWait();
            if (text.isEmpty()) {
                Affinity.info(InvoiceActivity.this, -1, "Informasi", "Kode QR tidak valid", new BBCallback() {
                    @Override
                    public final void do_callback(int i, Object obj) {
                        InvoiceActivity.b.this.d(i, (Boolean) obj);
                    }
                });
                return;
            }
            try {
                String[] split = new RSA(InvoiceActivity.this).decrypt(text).split(":");
                if (split.length >= 4) {
                    String ignoreBound = Var.getIgnoreBound(split, 3, "");
                    String ignoreBound2 = Var.getIgnoreBound(split, 2, "");
                    if (ignoreBound.isEmpty() || ignoreBound2.isEmpty()) {
                        Affinity.info(InvoiceActivity.this, -1, "Informasi", "Merchant/member tujuan tidak valid", new BBCallback() {
                            @Override
                            public final void do_callback(int i, Object obj) {
                                InvoiceActivity.b.this.c(i, (Boolean) obj);
                            }
                        });
                    }
                } else {
                    InvoiceActivity.this.O(text);
                }
            } catch (Exception unused) {
                InvoiceActivity.this.O(text);
            }
        }

        public void possibleResultPoints(List<ResultPoint> list) {
        }
    }

    public class c implements MessageProcess {
        public final String a;

        public c(String str) {
            this.a = str;
        }

        @Override
        public void afterProcess(BaseMessage baseMessage) {
            QRISMessage qRISMessage = new QRISMessage(baseMessage);
            if (!qRISMessage.isOK()) {
                InvoiceActivity.this.I(qRISMessage.getMessageDescription());
                return;
            }
            double d = Var.toDouble(qRISMessage.getValueFromAdditional_data(QRISMessage.NOMINAL), 0.0d);
            double d2 = Var.toDouble(qRISMessage.getValueFromAdditional_data(QRISMessage.NOMINAL_ADMIN), 0.0d);
            InvoiceActivity.this.n = Var.toString(qRISMessage.getValueFromAdditional_data(QRISMessage.AQUIRER_ID), "");
            InvoiceActivity.this.o = Var.toString(qRISMessage.getValueFromAdditional_data(QRISMessage.TERMINAL_ID), "");
            InvoiceActivity.this.p = Var.toString(qRISMessage.getValueFromAdditional_data(QRISMessage.MERCHANT_PAN), "");
            InvoiceActivity invoiceActivity = InvoiceActivity.this;
            int i = QRISMessage.ADDITIONAL_DATA_NATIONAL;
            invoiceActivity.q = Var.toString(qRISMessage.getValueFromAdditional_data(i), "");
            InvoiceActivity.this.r = Var.toString(qRISMessage.getValueFromAdditional_data(QRISMessage.MERCHANT_CITY), "");
            InvoiceActivity.this.s = Var.toString(qRISMessage.getValueFromIncludes(MPMessage.IncludeMessage.REFF_ID), "");
            InvoiceActivity.this.t = Var.toString(qRISMessage.getOutlet_id(), "");
            InvoiceActivity.this.u = Var.toString(qRISMessage.getTransmission_datetime(), "");
            InvoiceActivity.this.v = Var.toString(qRISMessage.getValueFromAdditional_data(QRISMessage.CALL_CENTER), "");
            InvoiceActivity.this.w = Var.toString(qRISMessage.getValueFromAdditional_data(QRISMessage.MERCHANT_ID_QRIS), "");
            String valueFromAdditional_data = qRISMessage.getValueFromAdditional_data(QRISMessage.MERCHANT_PROFILE_URL);
            SCTIMessage sCTIMessage = new SCTIMessage();
            if (d > 0.0d) {
                sCTIMessage.put(DataMessage.ACTION, "CHECK_BUY");
            } else {
                sCTIMessage.put(DataMessage.ACTION, "CHECK");
            }
            sCTIMessage.put("search_id", qRISMessage.getValueFromAdditional_data(QRISMessage.MEMBER_ID_TUJUAN));
            sCTIMessage.put(DataMessage.ID_TRANSAKSI, qRISMessage.getValueFromIncludes(MPMessage.IncludeMessage.REFF_ID));
            int i2 = QRISMessage.MERCHANT_NAME;
            sCTIMessage.put("search_name", qRISMessage.getValueFromAdditional_data(i2));
            if (URLUtil.isValidUrl(valueFromAdditional_data)) {
                sCTIMessage.put("image", valueFromAdditional_data);
                sCTIMessage.put("image_logo", valueFromAdditional_data);
            }
            sCTIMessage.put("customer_info", "");
            sCTIMessage.put("note", qRISMessage.getValueFromAdditional_data(QRISMessage.DESC_KIRIM));
            sCTIMessage.put("nominal", Double.valueOf(d));
            sCTIMessage.put("fee", Double.valueOf(d2));
            sCTIMessage.put("acquirer_id", InvoiceActivity.this.n);
            sCTIMessage.put("terminal_id", InvoiceActivity.this.o);
            sCTIMessage.put("merchant_pan", InvoiceActivity.this.p);
            sCTIMessage.put("customer_pan", Var.toString(qRISMessage.getValueFromAdditional_data(i), ""));
            sCTIMessage.put("terminal_location", InvoiceActivity.this.r);
            sCTIMessage.put("receipt_number", InvoiceActivity.this.s);
            sCTIMessage.put("source_of_fund", InvoiceActivity.this.t);
            sCTIMessage.put("transaction_date_time", InvoiceActivity.this.u);
            sCTIMessage.put("call_center", InvoiceActivity.this.v);
            sCTIMessage.put("merchant_id_qris", InvoiceActivity.this.w);
            sCTIMessage.put("balance", qRISMessage.getValueFromIncludes("balance"));
            sCTIMessage.put("RAW", this.a);
            QRMessage qRMessage = new QRMessage();
            qRMessage.put("rc", qRISMessage.getResponse_code());
            qRMessage.put("rd", "BAYAR " + qRISMessage.getValueFromAdditional_data(i2));
            qRMessage.put("data", sCTIMessage);
            qRMessage.put(QRMessage.USERCODE, "QRIS");
            String jSONObject = Mapper.mapToJSON(qRMessage).toString();
            Bundle bundle = new Bundle();
            bundle.putString("bundle:body", jSONObject);
            Affinity.listen(InvoiceActivity.this, QRPay2Activity.class, 101, bundle);
        }

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

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

    public void L() {
        if (!this.m) {
            Button button = this.l;
            if (button != null) {
                Buttonizer.reset(button);
                return;
            }
            return;
        }
        MessageProgressDialog messageProgressDialog = this.e;
        if (messageProgressDialog == null || !messageProgressDialog.isShowing()) {
            return;
        }
        this.e.hide();
    }

    public void M(int i, Boolean bool) {
        this.c.resume();
    }

    public void N(DialogInterface dialogInterface) {
        try {
            Connection connection = this.d;
            if (connection != null) {
                connection.close();
            }
        } catch (Exception unused) {
        }
    }

    public final void I(String str) {
        runOnUiThread(new Runnable() {
            @Override
            public final void run() {
                InvoiceActivity.this.L();
            }
        });
        Affinity.info(this, -1, "Informasi", str, new BBCallback() {
            @Override
            public final void do_callback(int i, Object obj) {
                InvoiceActivity.this.M(i, (Boolean) obj);
            }
        });
    }

    public final boolean J() {
        return getApplicationContext().getPackageManager().hasSystemFeature("android.hardware.camera.flash");
    }

    public final void K() {
        View currentFocus = getCurrentFocus();
        InputMethodManager inputMethodManager = (InputMethodManager) getSystemService("input_method");
        if (inputMethodManager == null || currentFocus == null) {
            return;
        }
        inputMethodManager.hideSoftInputFromWindow(currentFocus.getWindowToken(), 0);
    }

    public final void O(String str) {
        if (str.contains(QRISO.GUID_BBPAY) && str.contains("QR:PAY:")) {
            Q(str);
        } else {
            P(str);
        }
    }

    public final void P(String str) {
        String str2;
        String str3;
        HashMap<String, String> retrieveByPrefix = new ConfigSession(this).retrieveByPrefix(ConfigSession.PROPERTY_MAP_QR_MERCHANT);
        Iterator<String> it = retrieveByPrefix.keySet().iterator();
        while (true) {
            str2 = "";
            if (!it.hasNext()) {
                str3 = "";
                break;
            }
            String next = it.next();
            String str4 = retrieveByPrefix.get(next);
            Objects.requireNonNull(str4);
            if (Pattern.compile(str4).matcher(str).matches()) {
                str3 = next.replace("prop:conf:map:qr:merchant:", "");
                str2 = str;
                break;
            }
        }
        if (str2.isEmpty() || str3.isEmpty()) {
            Q(str);
        }
    }

    public final void Q(String str) {
        AppSession appSession = new AppSession(this);
        QRISMessage qRISMessage = new QRISMessage(appSession.retrieve(AppSession.PROPERTY_MERCHANT_ID), appSession.retrieve(AppSession.PROPERTY_MERCHANT_PIN), appSession.retrieve(AppSession.PROPERTY_AUTH_TOKEN));
        qRISMessage.setIsPayment(false);
        qRISMessage.setRawData(str);
        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(str));
        MessageSender messageSender = new MessageSender(this, messageComposer);
        messageSender.setRequestMessage(qRISMessage);
        messageSender.execute();
    }

    @Override
    public int getContentResource() {
        return R.layout.layout_invoice_pay;
    }

    @Override
    public int getMenuResource() {
        return R.menu.qr;
    }

    @Override
    public Activity getShowcaseInvoker() {
        return this;
    }

    @Override
    public int getToolbarIconResource() {
        return R.drawable.ic_action_arrow_back;
    }

    @Override
    public View getViewForShowCase(String str, int i) {
        return this.g.getActionView();
    }

    public void onActivityResult(int i, int i2, Intent intent) {
        if (i != 101 && i != 102) {
            super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
            return;
        }
        if (this.k.getState() == 3) {
            this.k.setState(4);
        }
        if (i == 102 && i2 == -1) {
            this.h.setText("");
            this.i.setText("");
            this.j.setText("");
        }
        this.c.resume();
    }

    public void onBackPressed() {
        if (this.k.getState() == 3) {
            this.k.setState(4);
        } else {
            super/*androidx.activity.ComponentActivity*/.onBackPressed();
        }
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == 2131365336) {
            if (this.f.getContentDescription().equals("off")) {
                this.c.setTorchOn();
                return;
            } else {
                this.c.setTorchOff();
                return;
            }
        }
        if (view.getId() == 2131365332) {
            Affinity.launch(this, MyQrCodeActivity.class);
            return;
        }
        if (view.getId() == 2131362426) {
            String value = this.h.getValue();
            int i = Var.toInt(this.i.getValue(), 0);
            if (value.isEmpty()) {
                Affinity.info(this, false, "Mohon isi nomor HP tujuan pembayaran");
            } else if (i <= 0) {
                Affinity.info(this, false, "Nominal harus lebih dari 0");
            }
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().permitAll().build());
        new AppSession(this);
        new ConfigSession(this);
        this.c = findViewById(R.id.qr_barcode_scanner);
        this.c.getBarcodeView().setDecoderFactory(new DefaultDecoderFactory(Arrays.asList(BarcodeFormat.QR_CODE, BarcodeFormat.CODE_39)));
        ImageView imageView = (ImageView) findViewById(R.id.qr_switch_flash);
        this.f = imageView;
        imageView.setContentDescription("off");
        if (J()) {
            this.f.setOnClickListener(this);
            this.c.setTorchListener(this);
        } else {
            this.f.setVisibility(8);
        }
        ?? r0 = (AbstractFormattedEditText) findViewById(R.id.input_handphone);
        this.h = r0;
        r0.setOnTouchListener(this);
        this.i = (AbstractFormattedEditText) findViewById(R.id.input_nominal);
        this.j = (EditText) findViewById(R.id.input_note);
        findViewById(R.id.qr_mine).setOnClickListener(this);
        Button button = (Button) findViewById(R.id.btn_submit);
        this.l = button;
        button.setOnClickListener(this);
        BottomSheetBehavior from = BottomSheetBehavior.from(findViewById(R.id.bottom_sheet));
        this.k = from;
        from.setBottomSheetCallback(new a());
        CaptureManager captureManager = new CaptureManager(this, this.c);
        this.b = captureManager;
        captureManager.initializeFromIntent(getIntent(), bundle);
        this.e = new MessageProgressDialog(this, new DialogInterface.OnCancelListener() {
            @Override
            public final void onCancel(DialogInterface dialogInterface) {
                InvoiceActivity.this.N(dialogInterface);
            }
        });
        hideKeyboard();
        onShowcaseDismiss("", null, 0);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        boolean onCreateOptionsMenu = super.onCreateOptionsMenu(menu);
        this.g = menu.findItem(R.id.menu_item_help);
        return onCreateOptionsMenu;
    }

    public void onDestroy() {
        super.onDestroy();
        this.b.onDestroy();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() == 16908332) {
            onBackPressed();
            return true;
        }
        if (menuItem.getItemId() != 2131364822) {
            return super.onOptionsItemSelected(menuItem);
        }
        InvoiceHelpFragment invoiceHelpFragment = new InvoiceHelpFragment();
        invoiceHelpFragment.setArguments(invoiceHelpFragment.setupDefaultBundle("bb_panduan_qrcode_payment"));
        invoiceHelpFragment.show(getSupportFragmentManager(), "Cara Bayar pakai QR Code");
        return true;
    }

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

    public void onRequestPermissionsResult(int i, @NonNull String[] strArr, @NonNull int[] iArr) {
        super/*androidx.fragment.app.FragmentActivity*/.onRequestPermissionsResult(i, strArr, iArr);
        if (i == CaptureManager.getCameraPermissionReqCode()) {
            if (iArr.length <= 0 || iArr[0] != 0) {
                Affinity.info(this, false, "Ijin penggunaan kamera tidak diijinkan");
            } else {
                this.b.onResume();
            }
        }
    }

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

    public void onSaveInstanceState(@NotNull Bundle bundle) {
        super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
        this.b.onSaveInstanceState(bundle);
    }

    @Override
    public void onShowcaseDismiss(String str, MaterialShowcaseView materialShowcaseView, int i) {
        this.c.decodeContinuous(new b());
    }

    public void onTorchOff() {
        this.f.setImageResource(R.drawable.ic_flash_off_black_24dp);
        this.f.setContentDescription("off");
    }

    public void onTorchOn() {
        this.f.setImageResource(R.drawable.ic_flash_on_black_24dp);
        this.f.setContentDescription("on");
    }

    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        if (view.getId() != 2131364028 || motionEvent.getAction() != 0 || this.k.getState() != 4) {
            return false;
        }
        this.k.setState(3);
        view.performClick();
        view.requestFocus();
        return false;
    }
}