导航菜单

页面标题

页面副标题

Minits v4.9.3.32 - DirectPaymentActivity.java 源代码

正在查看: Minits v4.9.3.32 应用的 DirectPaymentActivity.java JAVA 源代码文件

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


package com.redsys.tpvvinapplibrary.directPayment;

import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.google.android.material.textfield.TextInputLayout;
import com.redsys.tpvvinapplibrary.BaseActivity;
import com.redsys.tpvvinapplibrary.ErrorResponse;
import com.redsys.tpvvinapplibrary.R;
import com.redsys.tpvvinapplibrary.TPVV;
import com.redsys.tpvvinapplibrary.TPVVConfiguration;
import com.redsys.tpvvinapplibrary.TPVVConstants;
import com.redsys.tpvvinapplibrary.UIDirectPaymentConfig;
import java.util.Calendar;
import java.util.regex.Pattern;

public class DirectPaymentActivity extends BaseActivity implements com.redsys.tpvvinapplibrary.h.a {

    public TextView f22break;

    public ImageView f23case;

    public TextView f24catch;

    public com.redsys.tpvvinapplibrary.h.b f26const;

    public TextInputLayout f27do;

    public ConstraintLayout f28else;

    public TextInputLayout f30for;

    public ImageView f31goto;

    public TextInputLayout f32if;

    public Button f33new;

    public LinearLayout f35this;

    public ProgressBar f37try;

    public boolean f25class = false;

    public Boolean f29final = Boolean.FALSE;

    public String f34super = "";

    public String f36throw = "";

    public class a implements TextWatcher {
        public a() {
        }

        @Override
        public final void afterTextChanged(Editable editable) {
        }

        @Override
        public final void beforeTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
        }

        @Override
        public final void onTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
            DirectPaymentActivity directPaymentActivity = DirectPaymentActivity.this;
            if (directPaymentActivity.f25class) {
                return;
            }
            if (directPaymentActivity.f27do.getEditText().getText().length() >= 3) {
                DirectPaymentActivity.this.f27do.setError(null);
                return;
            }
            TextInputLayout textInputLayout = DirectPaymentActivity.this.f27do;
            TPVVConfiguration.getUiDirectPaymentConfig();
            textInputLayout.setError(UIDirectPaymentConfig.getCvvTextError());
        }
    }

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

        @Override
        public final void afterTextChanged(Editable editable) {
            DirectPaymentActivity directPaymentActivity = DirectPaymentActivity.this;
            if (directPaymentActivity.f25class) {
                return;
            }
            if (directPaymentActivity.f32if.getEditText().getText().length() == 0 || !DirectPaymentActivity.m12do(DirectPaymentActivity.this.f32if.getEditText().getText().toString().replaceAll("[^\\d.]", "")).booleanValue()) {
                DirectPaymentActivity.this.f32if.setError(null);
            }
            DirectPaymentActivity.m13do(DirectPaymentActivity.this);
            String replaceAll = DirectPaymentActivity.this.f32if.getEditText().getText().toString().replaceAll("[^\\d.]", "");
            String obj = DirectPaymentActivity.this.f32if.getEditText().getText().toString();
            int length = DirectPaymentActivity.this.f32if.getEditText().getText().toString().length();
            if (replaceAll.length() >= 5) {
                int i8 = length - 1;
                if (obj.substring(obj.length() - 5, i8).replaceAll("[^\\d.]", "").length() == 4 && length > DirectPaymentActivity.this.f36throw.length()) {
                    DirectPaymentActivity.this.f32if.getEditText().setText(DirectPaymentActivity.this.f32if.getEditText().getText().toString().substring(0, i8) + "-" + DirectPaymentActivity.this.f32if.getEditText().getText().toString().substring(i8));
                    DirectPaymentActivity.this.f32if.getEditText().setSelection(DirectPaymentActivity.this.f32if.getEditText().getText().length());
                }
            }
            String replaceAll2 = DirectPaymentActivity.this.f32if.getEditText().getText().toString().replaceAll("[^\\d.]", "");
            if (replaceAll2.length() < 13 || replaceAll2.length() > 16) {
                return;
            }
            if (DirectPaymentActivity.m12do(replaceAll2).booleanValue()) {
                DirectPaymentActivity.this.f32if.setError(null);
                return;
            }
            TextInputLayout textInputLayout = DirectPaymentActivity.this.f32if;
            TPVVConfiguration.getUiDirectPaymentConfig();
            textInputLayout.setError(UIDirectPaymentConfig.getCardTextError());
        }

        @Override
        public final void beforeTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
            DirectPaymentActivity directPaymentActivity = DirectPaymentActivity.this;
            directPaymentActivity.f36throw = directPaymentActivity.f32if.getEditText().getText().toString();
        }

        @Override
        public final void onTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
        }
    }

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

        @Override
        public final void afterTextChanged(Editable editable) {
            DirectPaymentActivity directPaymentActivity = DirectPaymentActivity.this;
            if (directPaymentActivity.f25class) {
                return;
            }
            directPaymentActivity.f29final = Boolean.FALSE;
            if (directPaymentActivity.f30for.getEditText().getText().length() == 0) {
                DirectPaymentActivity.this.f30for.setError(null);
            }
            if (DirectPaymentActivity.this.f34super.length() == 2 && DirectPaymentActivity.this.f30for.getEditText().getText().toString().length() == 3 && DirectPaymentActivity.this.f30for.getEditText().getText().toString().replaceAll("[^\\d.]", "").length() == 3) {
                DirectPaymentActivity directPaymentActivity2 = DirectPaymentActivity.this;
                directPaymentActivity2.f29final = Boolean.TRUE;
                directPaymentActivity2.f30for.getEditText().setText(DirectPaymentActivity.this.f30for.getEditText().getText().toString().substring(0, 2) + "/" + DirectPaymentActivity.this.f30for.getEditText().getText().toString().substring(2));
                DirectPaymentActivity.this.f30for.getEditText().setSelection(DirectPaymentActivity.this.f30for.getEditText().getText().length());
            }
            if (DirectPaymentActivity.this.f30for.getEditText().getText().toString().replaceAll("[^\\d.]", "").length() == 2 && !DirectPaymentActivity.this.f29final.booleanValue() && !DirectPaymentActivity.this.f30for.getEditText().getText().toString().toString().contains("/") && DirectPaymentActivity.this.f34super.length() < DirectPaymentActivity.this.f30for.getEditText().getText().toString().length()) {
                DirectPaymentActivity directPaymentActivity3 = DirectPaymentActivity.this;
                directPaymentActivity3.f29final = Boolean.TRUE;
                directPaymentActivity3.f30for.getEditText().setText(((Object) DirectPaymentActivity.this.f30for.getEditText().getText()) + "/");
                DirectPaymentActivity.this.f30for.getEditText().setSelection(DirectPaymentActivity.this.f30for.getEditText().getText().length());
            }
            if (DirectPaymentActivity.this.f30for.getEditText().getText().length() == 5) {
                String substring = DirectPaymentActivity.this.f30for.getEditText().getText().toString().substring(3);
                String substring2 = DirectPaymentActivity.this.f30for.getEditText().getText().toString().substring(0, 2);
                int i8 = Calendar.getInstance().get(1) % 100;
                int i9 = Calendar.getInstance().get(2) + 1;
                if (Integer.parseInt(substring2) >= 1 && Integer.parseInt(substring2) <= 12 && Integer.parseInt(substring) >= i8 && Integer.parseInt(substring) >= i8 && (Integer.parseInt(substring) != i8 || Integer.parseInt(substring2) >= i9)) {
                    DirectPaymentActivity.this.f30for.setError(null);
                    return;
                }
                TextInputLayout textInputLayout = DirectPaymentActivity.this.f30for;
                TPVVConfiguration.getUiDirectPaymentConfig();
                textInputLayout.setError(UIDirectPaymentConfig.getExpiryTextError());
            }
        }

        @Override
        public final void beforeTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
            DirectPaymentActivity directPaymentActivity = DirectPaymentActivity.this;
            directPaymentActivity.f34super = directPaymentActivity.f30for.getEditText().getText().toString();
        }

        @Override
        public final void onTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
        }
    }

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

        @Override
        public final void onClick(View view) {
            DirectPaymentActivity.super.onBackPressed();
            com.redsys.tpvvinapplibrary.h.b bVar = DirectPaymentActivity.this.f26const;
            bVar.getClass();
            try {
                TPVV.mCallback.paymentResultKO(new ErrorResponse(TPVVConstants.CODE_GENERIC_ERROR, "OPERATION_CANCELED_BY_USER"));
            } catch (Exception e8) {
                e8.getMessage();
            }
            ((DirectPaymentActivity) bVar.f58do).finish();
        }
    }

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

        @Override
        public final void onClick(View view) {
            if (DirectPaymentActivity.this.getIntent().getExtras() != null && DirectPaymentActivity.this.getIntent().getExtras().getString(TPVVConstants.WITH_REFERENCE) != null) {
                DirectPaymentActivity.this.f26const.m22do("", "", "");
                return;
            }
            if (DirectPaymentActivity.this.f27do.getEditText().getText().length() >= 3 && DirectPaymentActivity.this.f30for.getEditText().getText().length() >= 5 && DirectPaymentActivity.this.f32if.getEditText().getText().length() >= 13) {
                DirectPaymentActivity directPaymentActivity = DirectPaymentActivity.this;
                directPaymentActivity.f26const.m22do(directPaymentActivity.f32if.getEditText().getText().toString().replaceAll("[^\\d.]", ""), DirectPaymentActivity.this.f27do.getEditText().getText().toString().toString(), DirectPaymentActivity.this.f30for.getEditText().getText().toString().replaceAll("[^\\d.]", "").substring(2) + DirectPaymentActivity.this.f30for.getEditText().getText().toString().replaceAll("[^\\d.]", "").substring(0, 2));
            }
            if (DirectPaymentActivity.this.f27do.getEditText().getText().length() < 3) {
                TextInputLayout textInputLayout = DirectPaymentActivity.this.f27do;
                TPVVConfiguration.getUiDirectPaymentConfig();
                textInputLayout.setError(UIDirectPaymentConfig.getCvvTextError());
            }
            if (DirectPaymentActivity.this.f30for.getEditText().getText().length() < 5) {
                TextInputLayout textInputLayout2 = DirectPaymentActivity.this.f30for;
                TPVVConfiguration.getUiDirectPaymentConfig();
                textInputLayout2.setError(UIDirectPaymentConfig.getExpiryTextError());
            }
            if (DirectPaymentActivity.this.f32if.getEditText().getText().toString().replaceAll("[^\\d.]", "").length() < 13 || DirectPaymentActivity.this.f32if.getEditText().getText().toString().replaceAll("[^\\d.]", "").length() > 16) {
                TextInputLayout textInputLayout3 = DirectPaymentActivity.this.f32if;
                TPVVConfiguration.getUiDirectPaymentConfig();
                textInputLayout3.setError(UIDirectPaymentConfig.getCardTextError());
            }
        }
    }

    public static void m13do(DirectPaymentActivity directPaymentActivity) {
        directPaymentActivity.getClass();
        Pattern compile = Pattern.compile("^(4)\\d*");
        Pattern compile2 = Pattern.compile("^5[1-5]\\d*");
        Pattern compile3 = Pattern.compile("^3(4|7)\\d*");
        Pattern compile4 = Pattern.compile("^6011\\d*");
        Pattern compile5 = Pattern.compile("^30[0-5]\\d*");
        Pattern compile6 = Pattern.compile("^35(2[89]|[3-8][0-9])\\d*");
        String replaceAll = directPaymentActivity.f32if.getEditText().getText().toString().replaceAll("[^\\d.]", "");
        if (compile.matcher(replaceAll).matches()) {
            directPaymentActivity.f32if.getEditText().setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_visa, 0, 0, 0);
            return;
        }
        if (compile2.matcher(replaceAll).matches()) {
            directPaymentActivity.f32if.getEditText().setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_mc, 0, 0, 0);
            return;
        }
        if (compile3.matcher(replaceAll).matches()) {
            directPaymentActivity.f32if.getEditText().setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_amex, 0, 0, 0);
            return;
        }
        if (compile4.matcher(replaceAll).matches()) {
            directPaymentActivity.f32if.getEditText().setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_discovery, 0, 0, 0);
            return;
        }
        if (compile5.matcher(replaceAll).matches()) {
            directPaymentActivity.f32if.getEditText().setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_dinners, 0, 0, 0);
        } else if (compile6.matcher(replaceAll).matches()) {
            directPaymentActivity.f32if.getEditText().setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_jcb, 0, 0, 0);
        } else {
            directPaymentActivity.f32if.getEditText().setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_credit_card_black_24dp, 0, 0, 0);
        }
    }

    @Override
    public final void onBackPressed() {
    }

    @Override
    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        getWindow().setFlags(8192, 8192);
        setContentView(R.layout.activity_direct_payment);
        this.f33new = (Button) findViewById(R.id.btn_accept);
        this.f27do = (TextInputLayout) findViewById(R.id.it_cvv);
        this.f32if = (TextInputLayout) findViewById(R.id.it_cardNumber);
        this.f30for = (TextInputLayout) findViewById(R.id.it_expiryDate);
        this.f37try = (ProgressBar) findViewById(R.id.pb_progressbar);
        this.f28else = (ConstraintLayout) findViewById(R.id.ly_form);
        this.f31goto = (ImageView) findViewById(R.id.iv_logo);
        this.f35this = (LinearLayout) findViewById(R.id.ly_topBar);
        this.f22break = (TextView) findViewById(R.id.tv_title);
        this.f24catch = (TextView) findViewById(R.id.tv_info);
        UIDirectPaymentConfig uiDirectPaymentConfig = TPVVConfiguration.getUiDirectPaymentConfig();
        if (TPVVConfiguration.getProgressBarColor() != null) {
            this.f37try.getIndeterminateDrawable().setColorFilter(Color.parseColor(TPVVConfiguration.getProgressBarColor()), PorterDuff.Mode.MULTIPLY);
        }
        if (uiDirectPaymentConfig != null) {
            if (UIDirectPaymentConfig.getLogo() != null) {
                this.f31goto.setImageBitmap(UIDirectPaymentConfig.getLogo());
            }
            if (UIDirectPaymentConfig.getProgressBarColor() != null) {
                this.f37try.getIndeterminateDrawable().setColorFilter(Color.parseColor(UIDirectPaymentConfig.getProgressBarColor()), PorterDuff.Mode.SRC_IN);
            }
            if (UIDirectPaymentConfig.getTopBarColor() != null) {
                this.f35this.setBackgroundColor(Color.parseColor(UIDirectPaymentConfig.getTopBarColor()));
            }
            if (UIDirectPaymentConfig.getBackgroundColor() != null) {
                this.f28else.setBackground(new ColorDrawable(Color.parseColor(UIDirectPaymentConfig.getBackgroundColor())));
            }
            if (UIDirectPaymentConfig.getCardHeadText() != null) {
                this.f22break.setText(UIDirectPaymentConfig.getCardHeadText());
            }
            if (UIDirectPaymentConfig.getCardHeadTextColor() != null) {
                this.f22break.setTextColor(Color.parseColor(UIDirectPaymentConfig.getCardHeadTextColor()));
            }
            if (UIDirectPaymentConfig.getCardHeadTextBackgroundColor() != null) {
                this.f22break.setBackgroundColor(Color.parseColor(UIDirectPaymentConfig.getCardHeadTextBackgroundColor()));
            }
            if (UIDirectPaymentConfig.getCardText() != null) {
                this.f32if.setHint(UIDirectPaymentConfig.getCardText());
            }
            if (UIDirectPaymentConfig.getCardTextError() != null) {
                UIDirectPaymentConfig.getCardTextError();
            }
            if (UIDirectPaymentConfig.getExpiryText() != null) {
                this.f30for.setHint(UIDirectPaymentConfig.getExpiryText());
            }
            if (UIDirectPaymentConfig.getExpiryTextError() != null) {
                UIDirectPaymentConfig.getExpiryTextError();
            }
            if (UIDirectPaymentConfig.getCvvText() != null) {
                this.f27do.setHint(UIDirectPaymentConfig.getCvvText());
            }
            if (UIDirectPaymentConfig.getCvvTextError() != null) {
                UIDirectPaymentConfig.getCvvTextError();
            }
            if (UIDirectPaymentConfig.getInfoText() != null) {
                this.f24catch.setText(UIDirectPaymentConfig.getInfoText());
            }
            if (UIDirectPaymentConfig.getInfoTextColor() != null) {
                this.f24catch.setTextColor(Color.parseColor(UIDirectPaymentConfig.getInfoTextColor()));
            }
            if (UIDirectPaymentConfig.getBtnText() != null) {
                this.f33new.setText(UIDirectPaymentConfig.getBtnText());
            }
            if (UIDirectPaymentConfig.getBtnTextColor() != null) {
                this.f33new.setTextColor(Color.parseColor(UIDirectPaymentConfig.getBtnTextColor()));
            }
            if (UIDirectPaymentConfig.getBtnBackgroundColor() != null) {
                this.f33new.getBackground().setColorFilter(Color.parseColor(UIDirectPaymentConfig.getBtnBackgroundColor()), PorterDuff.Mode.MULTIPLY);
            }
        }
        this.f27do.getEditText().addTextChangedListener(new a());
        this.f32if.getEditText().addTextChangedListener(new b());
        this.f30for.getEditText().addTextChangedListener(new c());
        ImageView imageView = (ImageView) findViewById(R.id.ic_backButton);
        this.f23case = imageView;
        imageView.setOnClickListener(new d());
        this.f26const = new com.redsys.tpvvinapplibrary.h.b(com.redsys.tpvvinapplibrary.b.m4do(), this, new com.redsys.tpvvinapplibrary.k.b(com.redsys.tpvvinapplibrary.b.d.m8do(com.redsys.tpvvinapplibrary.d.c.m10do(this))));
        if (getIntent().getExtras() != null && getIntent().getExtras().getString(TPVVConstants.WITH_REFERENCE) != null) {
            this.f25class = true;
            this.f32if.getEditText().setText("**** **** **** ****");
            this.f32if.setEnabled(false);
            this.f32if.getEditText().setInputType(0);
            this.f30for.getEditText().setText("**/**");
            this.f30for.getEditText().setEnabled(false);
            this.f30for.getEditText().setInputType(0);
            this.f27do.getEditText().setText("***");
            this.f27do.getEditText().setEnabled(false);
            this.f27do.getEditText().setInputType(0);
        }
        this.f33new.setOnClickListener(new e());
    }

    @Override
    public final void onDestroy() {
        super.onDestroy();
    }

    public static Boolean m12do(String str) {
        if (str.length() <= 19 && str.length() >= 13) {
            int length = str.length();
            int[] iArr = new int[length];
            int i8 = 0;
            while (i8 < str.length()) {
                int i9 = i8 + 1;
                iArr[i8] = Integer.parseInt(str.substring(i8, i9));
                i8 = i9;
            }
            for (int i10 = length - 2; i10 >= 0; i10 -= 2) {
                int i11 = iArr[i10] * 2;
                if (i11 > 9) {
                    i11 = (i11 % 10) + 1;
                }
                iArr[i10] = i11;
            }
            int i12 = 0;
            for (int i13 = 0; i13 < length; i13++) {
                i12 += iArr[i13];
            }
            if (i12 % 10 == 0) {
                return Boolean.TRUE;
            }
            return Boolean.FALSE;
        }
        return Boolean.FALSE;
    }
}