导航菜单

页面标题

页面副标题

RummyCircle v11000.89 - CFDropSeamlessActivity.java 源代码

正在查看: RummyCircle v11000.89 应用的 CFDropSeamlessActivity.java JAVA 源代码文件

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


package com.cashfree.pg.ui.hidden.seamless;

import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Build;
import android.os.Bundle;
import android.widget.ProgressBar;
import androidx.appcompat.widget.V;
import androidx.camera.camera2.internal.RunnableC0220l;
import androidx.camera.camera2.internal.RunnableC0237u;
import androidx.camera.camera2.internal.RunnableC0238u0;
import androidx.camera.camera2.internal.X0;
import androidx.camera.core.RunnableC0264h0;
import androidx.camera.core.impl.C0270b0;
import androidx.camera.extensions.internal.sessionprocessor.j;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.cashfree.pg.core.api.CFCorePaymentGatewayService;
import com.cashfree.pg.core.api.CFTheme;
import com.cashfree.pg.core.api.base.CFPayment;
import com.cashfree.pg.core.api.exception.CFException;
import com.cashfree.pg.core.api.ui.PaymentInitiationData;
import com.cashfree.pg.core.api.utils.CFErrorResponse;
import com.cashfree.pg.core.api.utils.CFUPIApp;
import com.cashfree.pg.core.api.utils.CFUPIUtil;
import com.cashfree.pg.core.api.utils.CFUtil;
import com.cashfree.pg.core.api.utils.ThreadUtil;
import com.cashfree.pg.core.hidden.network.response.models.ConfigResponse;
import com.cashfree.pg.core.hidden.network.response.models.config.MerchantInfo;
import com.cashfree.pg.core.hidden.network.response.models.config.OrderDetails;
import com.cashfree.pg.core.hidden.utils.CFPaymentModes;
import com.cashfree.pg.network.NetworkConnectivityUtil;
import com.cashfree.pg.ui.R;
import com.cashfree.pg.ui.api.CFDropCheckoutPayment;
import com.cashfree.pg.ui.hidden.activity.base.BaseActivity;
import com.cashfree.pg.ui.hidden.channel.CFNativeCallbackEventBus;
import com.cashfree.pg.ui.hidden.channel.CFNativeCallbackEventBus$CFPaymentCallbackEvent;
import com.cashfree.pg.ui.hidden.channel.CFNativeCallbackEvents;
import com.cashfree.pg.ui.hidden.seamless.CFDropSeamlessActivity;
import com.cashfree.pg.ui.hidden.seamless.callbacks.CFSeamlessCallbacks;
import com.cashfree.pg.ui.hidden.seamless.dialog.UPISeamlessBottomSheetDialog;
import com.cashfree.pg.ui.hidden.viewModel.BaseViewModel;
import com.cashfree.pg.ui.hidden.viewModel.CFDropSeamlessViewModel;
import com.google.android.material.bottomsheet.d;
import java.util.ArrayList;
import java.util.List;

public class CFDropSeamlessActivity extends BaseActivity implements UPISeamlessBottomSheetDialog.UPIPayListener, CFDropSeamlessViewModel.DataFetch, CFDropSeamlessViewModel.DropSeamlessCallbacks {
    private List<String> blacklistedUPIAppList;
    private CFDropSeamlessViewModel cfDropSeamlessViewModel;
    private CFTheme cfTheme;
    private CoordinatorLayout loader;
    private MerchantInfo merchantInfo;
    private OrderDetails orderDetails;
    private List<String> orderedUPIAppList;
    private ArrayList<CFUPIApp> upiAppList;
    private UPISeamlessBottomSheetDialog upiDialog;
    private boolean isResponseSent = false;
    private boolean isFresh = true;
    private final CFSeamlessCallbacks cfNativeCoreCallbacks = new AnonymousClass1();

    private void getUPIApps(CFUPIUtil.UPIAppsCallback uPIAppsCallback) {
        CFUPIUtil.getInstalledUPIApps(this, uPIAppsCallback);
    }

    public void handleError(CFErrorResponse cFErrorResponse) {
        sendError(cFErrorResponse);
    }

    private void hideUPIDialog() {
        d dVar = this.upiDialog;
        if (dVar == null || !dVar.isShowing()) {
            return;
        }
        this.upiDialog.dismiss();
    }

    public void lambda$hideLoader$2() {
        this.loader.setVisibility(8);
    }

    public boolean lambda$onCreate$0() {
        return NetworkConnectivityUtil.isNetworkConnected(getApplicationContext());
    }

    public void lambda$onPaymentInitiate$7(CFPayment cFPayment) {
        try {
            showLoader();
            CFCorePaymentGatewayService.getInstance().doPayment(this, cFPayment);
        } catch (CFException e) {
            e.printStackTrace();
        }
    }

    public static void lambda$sendError$4(String str, CFErrorResponse cFErrorResponse) {
        CFNativeCallbackEventBus.getInstance().publishEvent(new CFNativeCallbackEventBus$CFPaymentCallbackEvent(CFNativeCallbackEvents.onFailure, str, cFErrorResponse));
    }

    public static void lambda$sendVerify$3(String str) {
        CFNativeCallbackEventBus.getInstance().publishEvent(new CFNativeCallbackEventBus$CFPaymentCallbackEvent(CFNativeCallbackEvents.onVerify, str, null));
    }

    public void lambda$showLoader$1() {
        this.loader.setVisibility(0);
    }

    public void lambda$showUPIDialog$5(DialogInterface dialogInterface) {
        sendError(CFUtil.getResponseFromError(CFUtil.getCancelledResponse()));
    }

    public void lambda$startPayment$6(ArrayList arrayList) {
        this.upiAppList = arrayList;
        ThreadUtil.runOnUIThread(new V(this, 6));
    }

    private void sendError(CFErrorResponse cFErrorResponse) {
        finish();
        if (this.isResponseSent) {
            return;
        }
        this.isResponseSent = true;
        String orderId = this.cfDropSeamlessViewModel.getOrderId();
        if (orderId != null) {
            ThreadUtil.runOnUIThread(new RunnableC0220l(orderId, cFErrorResponse, 4));
        }
    }

    public void sendVerify(String str) {
        finish();
        if (this.isResponseSent) {
            return;
        }
        this.isResponseSent = true;
        if (str != null) {
            ThreadUtil.runOnUIThread(new j(str, 5));
        }
    }

    private void setTheme() {
        ((ProgressBar) findViewById(R.id.progress_bar)).getIndeterminateDrawable().setColorFilter(Color.parseColor(this.cfTheme.getNavigationBarBackgroundColor()), PorterDuff.Mode.MULTIPLY);
    }

    public void showUPIDialog() {
        if (isDestroyed()) {
            return;
        }
        hideLoader();
        hideUPIDialog();
        ?? uPISeamlessBottomSheetDialog = new UPISeamlessBottomSheetDialog(this, this.upiAppList, this.orderedUPIAppList, this.blacklistedUPIAppList, this.orderDetails, this.merchantInfo, this.cfTheme, this);
        this.upiDialog = uPISeamlessBottomSheetDialog;
        uPISeamlessBottomSheetDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
            @Override
            public final void onCancel(DialogInterface dialogInterface) {
                CFDropSeamlessActivity.this.lambda$showUPIDialog$5(dialogInterface);
            }
        });
        this.upiDialog.show();
    }

    private void startPayment() {
        if (this.upiAppList == null) {
            getUPIApps(new C0270b0(this, 5));
        } else {
            showUPIDialog();
        }
    }

    @Override
    public BaseViewModel getViewModel() {
        return this.cfDropSeamlessViewModel;
    }

    public void hideLoader() {
        runOnUiThread(new RunnableC0237u(this, 3));
    }

    @Override
    @SuppressLint({"SourceLockedOrientationActivity"})
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_cf_ui_modal);
        CFCorePaymentGatewayService.getInstance().setCheckoutCallback(this.cfNativeCoreCallbacks);
        CFCorePaymentGatewayService.getInstance().setQRCallback(this.cfNativeCoreCallbacks);
        this.loader = (CoordinatorLayout) findViewById(R.id.cf_loader);
        this.cfDropSeamlessViewModel = new CFDropSeamlessViewModel(new X0(this, 3), this, this);
        if (Build.VERSION.SDK_INT != 26) {
            setRequestedOrientation(1);
        }
        this.cfTheme = this.cfDropSeamlessViewModel.getTheme();
        setTheme();
        showLoader();
        this.cfDropSeamlessViewModel.fetchData();
    }

    @Override
    public void onDataFetchFailed(CFErrorResponse cFErrorResponse) {
        sendError(cFErrorResponse);
    }

    @Override
    public void onDataFetched(ConfigResponse configResponse, List<CFPaymentModes> list, CFDropCheckoutPayment cFDropCheckoutPayment) {
        this.orderDetails = configResponse.getOrderDetails();
        this.merchantInfo = configResponse.getMerchantInfo();
        this.orderedUPIAppList = configResponse.getFeatureConfig().getPaymentModeConfig().getUpiPriorityApps();
        this.blacklistedUPIAppList = configResponse.getFeatureConfig().getPaymentModeConfig().getUpiBlacklistedApps();
        if (list.contains(CFPaymentModes.UPI)) {
            startPayment();
        } else {
            sendError(CFUtil.getResponseFromError(CFUtil.getFailedResponse("UPI is not enabled for this order.")));
        }
    }

    public void onNewIntent(Intent intent) {
        super/*androidx.fragment.app.FragmentActivity*/.onNewIntent(intent);
    }

    @Override
    public void onPayInitiate(PaymentInitiationData paymentInitiationData) {
        this.cfDropSeamlessViewModel.buildUPIPayment(paymentInitiationData);
    }

    @Override
    public void onPaymentInitiate(CFPayment cFPayment) {
        ThreadUtil.runOnUIThread(new RunnableC0264h0(this, cFPayment, 8));
    }

    @Override
    public void onResume() {
        super.onResume();
        if (this.isFresh) {
            this.isFresh = false;
        } else {
            this.cfDropSeamlessViewModel.getOrderStatus();
        }
    }

    public void showLoader() {
        runOnUiThread(new RunnableC0238u0(this, 7));
    }

    public class AnonymousClass1 extends CFSeamlessCallbacks {
        public AnonymousClass1() {
        }

        public void lambda$onPaymentFailure$0(CFErrorResponse cFErrorResponse) {
            CFDropSeamlessActivity.this.hideLoader();
            CFDropSeamlessActivity.this.handleError(cFErrorResponse);
        }

        @Override
        public void onPaymentFailure(final CFErrorResponse cFErrorResponse, String str) {
            ThreadUtil.runOnUIThread(new Runnable() {
                @Override
                public final void run() {
                    CFDropSeamlessActivity.AnonymousClass1.this.lambda$onPaymentFailure$0(cFErrorResponse);
                }
            });
        }

        @Override
        public void onPaymentVerify(String str) {
            CFDropSeamlessActivity.this.sendVerify(str);
        }

        @Override
        public void onQRFetched(String str) {
        }
    }
}