导航菜单

页面标题

页面副标题

Credmex v3.12.2 - BindNewBankcardActivity.java 源代码

正在查看: Credmex v3.12.2 应用的 BindNewBankcardActivity.java JAVA 源代码文件

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


package com.credmex.activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.OnClick;
import com.credmex.IdentityCheckActivity;
import com.credmex.VerificationMethodConfig;
import com.credmex.authentication.helper.AutoJumpHelper;
import com.credmex.helper.TrackBindCardChannelHelper;
import com.credmex.models.BankCardInfo;
import com.credmex.models.SendVerificationTypeBean;
import com.credmex.models.TrackBindCardChannelInfo;
import com.credmex.models.YqdMobileVerificationPurpose;
import com.credmex.models.bank.BankNameAndCodeRelationResponse;
import com.credmex.models.response.AddBankAccountResponse;
import com.credmex.models.response.BankCodeAndVerificationMethodInfoResponse;
import com.credmex.models.response.VerificationMethodInfoResponse;
import com.credmex.net.CredMexBaseResult;
import com.credmex.net.CredMexObserver;
import com.credmex.net.IApiRoutes;
import com.open.mx.ui.model.LabelBean;
import com.veda.android.bananalibrary.infrastructure.BaseActivity;
import com.veda.supertoolkit.lifecycle.LifecycleEvent;
import com.veda.supertoolkit.utils.FormatUtil;
import com.veda.supertoolkit.widgets.BaseUtils;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import java.util.HashMap;
import java.util.List;

public class BindNewBankcardActivity extends BindBankCardBaseActivity {
    public static final String BIND_CARD_INFO = "BIND_CARD_INFO";
    public static final String CHANNEL = "CHANNEL";
    public static final String IS_AUTO_CREATE_ORDER_AFTER_BIND_CARD = "IS_AUTO_CREATE_ORDER_AFTER_BIND_CARD";
    public static final String START_TIME = "START_TIME";
    private String S;
    private final SendVerificationTypeBean T = new SendVerificationTypeBean();
    private boolean U;
    private String V;
    private long W;
    private ActivityResultLauncher<Intent> X;

    @BindView(2131362438)
    public LinearLayout llContent;

    public void I0(BankCardInfo bankCardInfo) {
        Intent intent = new Intent();
        intent.putExtra(IS_AUTO_CREATE_ORDER_AFTER_BIND_CARD, this.U);
        intent.putExtra(BIND_CARD_INFO, bankCardInfo);
        setResult(2001, intent);
        finish();
    }

    public HashMap<String, Object> J0() {
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("cardNumber", this.bankNumberComponent.getTrimmedResult());
        hashMap.put("bankCode", ((LabelBean) ((List) this.bankNamePickComponent.getResult()).get(0)).value);
        hashMap.put("bankAccountType", this.bankTypeComponent.v0().value);
        return hashMap;
    }

    private void K0() {
        this.X = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
            public final void onActivityResult(Object obj) {
                BindNewBankcardActivity.this.L0((ActivityResult) obj);
            }
        });
    }

    public void L0(ActivityResult activityResult) {
        Intent data;
        if (2001 != activityResult.getResultCode() || (data = activityResult.getData()) == null) {
            return;
        }
        N0(data.getStringExtra("verificationId"));
    }

    public void M0() {
        this.T.initData();
        this.R = true;
        j0();
    }

    private void N0(String str) {
        showLoadingDialog();
        HashMap J0 = J0();
        J0.put("verificationId", str);
        TrackBindCardChannelInfo a = TrackBindCardChannelHelper.a(this);
        a.startTime = this.W;
        a.channel = this.V;
        a.endTime = System.currentTimeMillis();
        J0.put("trackBindCardChannelInfo", a);
        ((IApiRoutes) this.apiHelper.a()).W0(J0).a(new CredMexObserver<AddBankAccountResponse>(this) {
            @Override
            public void onError(Throwable th, AddBankAccountResponse addBankAccountResponse) {
                super.onError(th, (Throwable) addBankAccountResponse);
            }

            public void onSuccess(AddBankAccountResponse addBankAccountResponse) {
                if (BankCardInfo.BankStatusEnum.valueForName(addBankAccountResponse.body.status) == BankCardInfo.BankStatusEnum.AVAILABLE) {
                    BindNewBankcardActivity.this.I0(addBankAccountResponse.body);
                } else {
                    BindNewBankcardActivity.this.showErrorToast(2131820750);
                }
                BindNewBankcardActivity.this.dismissLoadingDialog();
            }
        });
    }

    private void O0() {
        showLoadingDialog();
        ((IApiRoutes) this.apiHelper.a()).Q0(J0()).a(new CredMexObserver<CredMexBaseResult>(this) {
            public void onSuccess(CredMexBaseResult credMexBaseResult) {
                BindNewBankcardActivity.this.dismissLoadingDialog();
                ?? r4 = BindNewBankcardActivity.this;
                IdentityCheckActivity.startIdentityCheckActivity((Activity) r4, YqdMobileVerificationPurpose.BANK, ((BindNewBankcardActivity) r4).X, BindNewBankcardActivity.this.J0());
            }
        });
    }

    private void P0() {
        showLoadingDialog();
        ((IApiRoutes) this.apiHelper.a()).g1().a(new CredMexObserver<BankNameAndCodeRelationResponse>(this) {
            @Override
            public void onError(Throwable th, BankNameAndCodeRelationResponse bankNameAndCodeRelationResponse) {
                super.onError(th, (Throwable) bankNameAndCodeRelationResponse);
                BindNewBankcardActivity.this.M0();
            }

            public void onSuccess(BankNameAndCodeRelationResponse bankNameAndCodeRelationResponse) {
                BindNewBankcardActivity.this.dismissLoadingDialog();
                BindNewBankcardActivity.this.u0(bankNameAndCodeRelationResponse.body);
                BindNewBankcardActivity.this.M0();
            }
        });
    }

    public void onZipRequestError() {
        dismissLoadingDialog();
        BaseUtils.e(this, getString(2131821037));
        M0();
    }

    public static void startBindNewBankcardActivity(Activity activity, int i2, String str) {
        Intent intent = new Intent(activity, (Class<?>) BindNewBankcardActivity.class);
        intent.putExtra(CHANNEL, str);
        activity.startActivityForResult(intent, i2);
    }

    @Override
    protected void D() {
        super.D();
        P0();
    }

    @Override
    protected void G(@NonNull Bundle bundle) {
        super.G(bundle);
        this.U = bundle.getBoolean(IS_AUTO_CREATE_ORDER_AFTER_BIND_CARD, false);
        this.V = bundle.getString(CHANNEL, "");
        this.W = bundle.getLong(START_TIME, 0L);
    }

    @Override
    protected void X(@NonNull Bundle bundle) {
        super.X(bundle);
        bundle.putBoolean(IS_AUTO_CREATE_ORDER_AFTER_BIND_CARD, this.U);
        bundle.putString(CHANNEL, this.V);
        bundle.putLong(START_TIME, this.W);
    }

    @OnClick({2131361939})
    public void clickBtnContinue() {
        if (BaseUtils.b()) {
            return;
        }
        O0();
    }

    @Override
    protected void e0() {
        this.H = new AutoJumpHelper(this) {
            @Override
            public boolean a() {
                return BindNewBankcardActivity.this.bankTypeComponent.k();
            }

            @Override
            public void g() {
                BindNewBankcardActivity.this.bankTypeComponent.b0();
            }
        };
        this.I = new AutoJumpHelper(this) {
            @Override
            public boolean a() {
                return BindNewBankcardActivity.this.bankNumberComponent.k();
            }

            @Override
            public void g() {
                BindNewBankcardActivity.this.bankNumberComponent.b0();
            }
        };
        this.J = new AutoJumpHelper(this) {
            @Override
            public boolean a() {
                return BindNewBankcardActivity.this.bankNamePickComponent.k();
            }

            @Override
            protected void g() {
                BindNewBankcardActivity.this.bankNamePickComponent.b0();
            }
        };
        this.H.f(this.I);
        this.I.f(this.J);
    }

    @Override
    public View getContentView() {
        return this.llContent;
    }

    @Override
    public int getLayoutID() {
        return 2131558430;
    }

    @Override
    protected void h0() {
        ((BaseActivity) this).a.setVisibility(8);
    }

    @Override
    protected void init() {
        super.init();
        this.W = System.currentTimeMillis();
        this.S = this.userSession.d().getMobileNumber();
        K0();
    }

    @Override
    protected void j0() {
        AutoJumpHelper autoJumpHelper;
        if (i0() && this.R && this.F && (autoJumpHelper = this.H) != null) {
            autoJumpHelper.run();
        }
    }

    @Override
    protected boolean q0() {
        return this.bankTypeComponent.k() && FormatUtil.v(this.bankNumberComponent.getTrimmedResult()) && this.bankNamePickComponent.k();
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnCreated(@NonNull Runnable runnable) {
        return com.veda.supertoolkit.lifecycle.i.a(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnDestroy(@NonNull Runnable runnable) {
        return com.veda.supertoolkit.lifecycle.i.b(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
        return com.veda.supertoolkit.lifecycle.i.c(this, lifecycleEvent, runnable);
    }

    class AnonymousClass5 implements Observer<BankCodeAndVerificationMethodInfoResponse> {
        final BindNewBankcardActivity a;

        public void onNext(@io.reactivex.annotations.NonNull BankCodeAndVerificationMethodInfoResponse bankCodeAndVerificationMethodInfoResponse) {
            if (bankCodeAndVerificationMethodInfoResponse == null) {
                this.a.onZipRequestError();
                return;
            }
            BankNameAndCodeRelationResponse bankNameAndCodeRelationResponse = bankCodeAndVerificationMethodInfoResponse.bankCodeRelationResponse;
            if (bankNameAndCodeRelationResponse == null || !bankNameAndCodeRelationResponse.isSuccess()) {
                BindNewBankcardActivity.super.errorResponse(bankCodeAndVerificationMethodInfoResponse.bankCodeRelationResponse);
            } else {
                this.a.u0(bankCodeAndVerificationMethodInfoResponse.bankCodeRelationResponse.body);
            }
            VerificationMethodInfoResponse verificationMethodInfoResponse = bankCodeAndVerificationMethodInfoResponse.verificationMethodInfoResponse;
            if (verificationMethodInfoResponse == null || !verificationMethodInfoResponse.isSuccess()) {
                BindNewBankcardActivity.super.errorResponse(bankCodeAndVerificationMethodInfoResponse.verificationMethodInfoResponse);
            } else {
                VerificationMethodConfig.b().g(bankCodeAndVerificationMethodInfoResponse.verificationMethodInfoResponse);
            }
            this.a.M0();
            this.a.dismissLoadingDialog();
        }

        public void onError(@io.reactivex.annotations.NonNull Throwable th) {
            this.a.onZipRequestError();
        }

        public void onSubscribe(@io.reactivex.annotations.NonNull Disposable disposable) {
            BindNewBankcardActivity.super.onSubscribe(disposable);
        }

        public void onComplete() {
        }
    }
}