导航菜单

页面标题

页面副标题

Easycash v3.75.13 - ECQuickRepayPayingAct.java 源代码

正在查看: Easycash v3.75.13 应用的 ECQuickRepayPayingAct.java JAVA 源代码文件

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


package com.lingyue.easycash.business.quickrepay;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.AppCompatTextView;
import androidx.constraintlayout.widget.Group;
import androidx.core.content.ContextCompat;
import butterknife.BindView;
import com.lingyue.easycash.R;
import com.lingyue.easycash.activity.EasyCashRepaymentActivity;
import com.lingyue.easycash.business.webevent.WebEvent;
import com.lingyue.easycash.business.webevent.WebEventManager;
import com.lingyue.easycash.commom.EasyCashCommonActivity;
import com.lingyue.easycash.models.DirectDebitEnableAccount;
import com.lingyue.easycash.models.event.QuickRepayResultEvent;
import com.lingyue.easycash.models.response.DirectDebitRepayCreateResponse;
import com.lingyue.easycash.widget.EasycashStatusView;
import com.lingyue.idnbaselib.framework.lifecycle.LifecycleEvent;
import com.lingyue.idnbaselib.model.IdnObserver;
import com.lingyue.idnbaselib.utils.EcFormatUtil;
import com.lingyue.supertoolkit.widgets.BaseUtils;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.veda.android.imageloaderlib.Imager;
import com.yangqianguan.statistics.AutoTrackHelper;
import io.reactivex.disposables.Disposable;
import java.math.BigDecimal;
import org.greenrobot.eventbus.EventBus;

public class ECQuickRepayPayingAct extends EasyCashCommonActivity {
    private DirectDebitEnableAccount B;
    private BigDecimal C;
    private DirectDebitRepayCreateResponse.STATUS D;
    private String E;
    private Runnable I;

    @BindView(R.id.group_transaction_number)
    Group groupTransactionNumber;

    @BindView(R.id.group_transaction_time)
    Group groupTransactionTime;

    @BindView(R.id.iv_bankcard_logo)
    AppCompatImageView ivBankcardLogo;

    @BindView(R.id.status_view)
    EasycashStatusView statusView;

    @BindView(R.id.tv_bank)
    AppCompatTextView tvBank;

    @BindView(R.id.tv_bankcard_number)
    AppCompatTextView tvBankcardNumber;

    @BindView(R.id.tv_repayment_amount)
    AppCompatTextView tvRepaymentAmount;

    @BindView(R.id.tv_transaction_number)
    AppCompatTextView tvTransactionNumber;

    @BindView(R.id.tv_transaction_time)
    AppCompatTextView tvTransactionTime;
    private int F = 0;
    private int G = 2000;
    private Handler H = new Handler();
    private final int J = 5;
    private final int K = 10;

    static class AnonymousClass3 {
        static final int[] a;

        static {
            int[] iArr = new int[DirectDebitRepayCreateResponse.STATUS.values().length];
            a = iArr;
            try {
                iArr[DirectDebitRepayCreateResponse.STATUS.SUCCESS.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[DirectDebitRepayCreateResponse.STATUS.PENDING.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[DirectDebitRepayCreateResponse.STATUS.FAILED.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    private void e0() {
        this.a.setVisibility(this.userSession.f().showCustomerService ? 0 : 8);
        this.a.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                ECQuickRepayPayingAct.this.f0(view);
            }
        });
    }

    @SensorsDataInstrumented
    public void f0(View view) {
        if (BaseUtils.l()) {
            SensorsDataAutoTrackHelper.trackViewOnClick(view);
            AutoTrackHelper.trackViewOnClick(view);
        } else {
            openCustomerService();
            SensorsDataAutoTrackHelper.trackViewOnClick(view);
            AutoTrackHelper.trackViewOnClick(view);
        }
    }

    private void i0(@NonNull final String str) {
        this.H.removeCallbacksAndMessages(null);
        Runnable runnable = new Runnable() {
            @Override
            public final void run() {
                ECQuickRepayPayingAct.this.g0(str);
            }
        };
        this.I = runnable;
        this.H.postDelayed(runnable, this.G);
    }

    public void j0(DirectDebitRepayCreateResponse directDebitRepayCreateResponse) {
        DirectDebitRepayCreateResponse.Body body = directDebitRepayCreateResponse.body;
        this.E = body.transNo;
        if (TextUtils.isEmpty(body.transTime)) {
            this.groupTransactionTime.setVisibility(8);
        } else {
            this.tvTransactionTime.setText(directDebitRepayCreateResponse.body.transTime);
            this.groupTransactionTime.setVisibility(0);
        }
        int i = this.F + 1;
        this.F = i;
        DirectDebitRepayCreateResponse.STATUS status = DirectDebitRepayCreateResponse.STATUS.SUCCESS;
        DirectDebitRepayCreateResponse.STATUS status2 = this.D;
        if (status == status2) {
            m0();
            return;
        }
        if (DirectDebitRepayCreateResponse.STATUS.FAILED == status2) {
            l0(directDebitRepayCreateResponse.body.failedReasonContent);
        } else if (i >= 5) {
            k0();
        } else {
            i0(directDebitRepayCreateResponse.body.transNo);
        }
    }

    private void k0() {
        this.F = 0;
    }

    public void l0(String str) {
        this.F = 0;
        if (TextUtils.isEmpty(str)) {
            str = getString(R.string.repay_failed);
        }
        this.statusView.c(false, ContextCompat.getDrawable(this, R.drawable.easycash_quick_repay_failed), str);
    }

    public void m0() {
        this.F = 0;
        this.statusView.c(false, ContextCompat.getDrawable(this, R.drawable.easycash_quick_repay_successful), getString(R.string.repay_successed));
    }

    public void n0() {
        if (TextUtils.isEmpty(this.E)) {
            this.groupTransactionNumber.setVisibility(8);
        } else {
            this.tvTransactionNumber.setText(this.E);
            this.groupTransactionNumber.setVisibility(0);
        }
    }

    private void o0() {
        this.apiHelper.a().a0(this.B.accountId, this.C).a(new IdnObserver<DirectDebitRepayCreateResponse>(this) {
            @Override
            public void onError(Throwable th, DirectDebitRepayCreateResponse directDebitRepayCreateResponse) {
                super.onError(th, (Throwable) directDebitRepayCreateResponse);
                ECQuickRepayPayingAct.this.finish();
            }

            @Override
            public void onSuccess(DirectDebitRepayCreateResponse directDebitRepayCreateResponse) {
                ECQuickRepayPayingAct.this.D = DirectDebitRepayCreateResponse.STATUS.fromName(directDebitRepayCreateResponse.body.status);
                ECQuickRepayPayingAct.this.E = directDebitRepayCreateResponse.body.transNo;
                if (TextUtils.isEmpty(directDebitRepayCreateResponse.body.transTime)) {
                    ECQuickRepayPayingAct.this.groupTransactionTime.setVisibility(8);
                } else {
                    ECQuickRepayPayingAct.this.tvTransactionTime.setText(directDebitRepayCreateResponse.body.transTime);
                    ECQuickRepayPayingAct.this.groupTransactionTime.setVisibility(0);
                }
                ECQuickRepayPayingAct.this.n0();
                int i = AnonymousClass3.a[ECQuickRepayPayingAct.this.D.ordinal()];
                if (i == 1) {
                    ECQuickRepayPayingAct.this.m0();
                    return;
                }
                if (i != 2) {
                    if (i != 3) {
                        return;
                    }
                    ECQuickRepayPayingAct.this.l0(directDebitRepayCreateResponse.body.failedReasonContent);
                    return;
                }
                DirectDebitRepayCreateResponse.NEXT_STEP fromName = DirectDebitRepayCreateResponse.NEXT_STEP.fromName(directDebitRepayCreateResponse.body.nextStep);
                if (fromName == DirectDebitRepayCreateResponse.NEXT_STEP.INPUT_OTP) {
                    ?? r0 = ECQuickRepayPayingAct.this;
                    DirectDebitEnableAccount directDebitEnableAccount = ((ECQuickRepayPayingAct) r0).B;
                    DirectDebitRepayCreateResponse.Body body = directDebitRepayCreateResponse.body;
                    ECQuickPayingOtpAct.startQuickPayingOtpForResult(r0, directDebitEnableAccount, body.amount, body.transNo);
                    return;
                }
                if (fromName == DirectDebitRepayCreateResponse.NEXT_STEP.WAITING_FOR_RESULT) {
                    ECQuickRepayPayingAct.this.q0(10);
                    ECQuickRepayPayingAct eCQuickRepayPayingAct = ECQuickRepayPayingAct.this;
                    eCQuickRepayPayingAct.g0(eCQuickRepayPayingAct.E);
                }
            }
        });
    }

    public void g0(String str) {
        this.apiHelper.a().j1(str).a(new IdnObserver<DirectDebitRepayCreateResponse>(this) {
            @Override
            public void onSuccess(DirectDebitRepayCreateResponse directDebitRepayCreateResponse) {
                ECQuickRepayPayingAct.this.D = DirectDebitRepayCreateResponse.STATUS.fromName(directDebitRepayCreateResponse.body.status);
                ECQuickRepayPayingAct.this.j0(directDebitRepayCreateResponse);
            }
        });
    }

    public void q0(int i) {
        this.statusView.d(i, getString(R.string.easycash_default_quick_repay_loading), new EasycashStatusView.AfterCountDownListener() {
            @Override
            public final void a() {
                ECQuickRepayPayingAct.h0();
            }
        });
    }

    public static void startQuickRepayPaying(Activity activity, DirectDebitEnableAccount directDebitEnableAccount, BigDecimal bigDecimal) {
        Intent intent = new Intent(activity, (Class<?>) ECQuickRepayPayingAct.class);
        intent.putExtra("debitEnableAccount", directDebitEnableAccount);
        intent.putExtra(EasyCashRepaymentActivity.INTENT_KEY_REPAYMENT_AMOUNT, bigDecimal);
        activity.startActivity(intent);
    }

    @Override
    protected void B(@NonNull Bundle bundle) {
        super.B(bundle);
        this.B = (DirectDebitEnableAccount) bundle.getSerializable("debitEnableAccount");
        this.C = (BigDecimal) bundle.getSerializable(EasyCashRepaymentActivity.INTENT_KEY_REPAYMENT_AMOUNT);
        this.E = bundle.getString("transNo");
    }

    @Override
    protected void D() {
        super.D();
        e0();
        this.tvRepaymentAmount.setText(EcFormatUtil.n(this.C));
        Imager.a().b(this, this.B.bankBasicInfo.logoUrl, this.ivBankcardLogo);
        this.tvBank.setText(this.B.bankBasicInfo.bankLabel);
        this.tvBankcardNumber.setText(this.B.maskedAccountNumber);
    }

    @Override
    protected void N(@NonNull Bundle bundle) {
        super.N(bundle);
        bundle.putSerializable("debitEnableAccount", this.B);
        bundle.putSerializable(EasyCashRepaymentActivity.INTENT_KEY_REPAYMENT_AMOUNT, this.C);
        bundle.putString("transNo", this.E);
    }

    @Override
    public int getLayoutID() {
        return R.layout.easycash_activity_quick_repay_paying;
    }

    @Override
    protected void onActivityResult(int i, int i2, Intent intent) {
        if (i == 1000) {
            if (i2 == -1) {
                q0(10);
                g0(this.E);
            } else {
                finish();
            }
        }
        super.onActivityResult(i, i2, intent);
    }

    public void onBackPressed() {
        if (DirectDebitRepayCreateResponse.STATUS.SUCCESS != this.D) {
            super/*androidx.activity.ComponentActivity*/.onBackPressed();
            return;
        }
        EventBus.c().k(new QuickRepayResultEvent(true));
        WebEventManager.e().h(new WebEvent("Native", "quickRepaymentEvent", "true", false));
        finish();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        this.H.removeCallbacksAndMessages(null);
        this.H = null;
    }

    @Override
    public Disposable runOnActiveEvent(Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.a(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnCreated(@NonNull Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.b(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnDestroy(@NonNull Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.c(this, runnable);
    }

    @Override
    @SuppressLint({"CheckResult"})
    public Disposable runOnEvent(@NonNull LifecycleEvent lifecycleEvent, @Nullable Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.d(this, lifecycleEvent, runnable);
    }

    @Override
    public Disposable runOnEvents(@NonNull LifecycleEvent[] lifecycleEventArr, @Nullable Runnable runnable) {
        return com.lingyue.idnbaselib.framework.lifecycle.m.e(this, lifecycleEventArr, runnable);
    }

    @Override
    protected void z() {
        super.z();
        this.statusView.c(true, ContextCompat.getDrawable(this, R.drawable.easycash_quick_repay_loading), getString(R.string.easycash_default_quick_repay_loading));
        o0();
    }

    public static void h0() {
    }
}