正在查看: Biko v2.0.23 应用的 CashfreeNativeCheckoutActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Biko v2.0.23 应用的 CashfreeNativeCheckoutActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.cashfree.pg.ui.hidden.checkout;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.nfc.NfcAdapter;
import android.nfc.NfcManager;
import android.nfc.Tag;
import android.os.Build;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.cashfree.pg.base.logger.CFLoggerService;
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.card.vault.DeleteSavedCardResponse;
import com.cashfree.pg.core.api.card.vault.SavedCardsResponse;
import com.cashfree.pg.core.api.exception.CFException;
import com.cashfree.pg.core.api.persistence.CFPersistence;
import com.cashfree.pg.core.api.state.PaymentMode;
import com.cashfree.pg.core.api.ui.PaymentInitiationData;
import com.cashfree.pg.core.api.ui.dialog.PVBottomSheetDialog;
import com.cashfree.pg.core.api.utils.AnalyticsUtil;
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.analytics.UserEvents;
import com.cashfree.pg.core.hidden.network.response.models.ConfigResponse;
import com.cashfree.pg.core.hidden.network.response.models.config.EmiOption;
import com.cashfree.pg.core.hidden.network.response.models.config.OrderDetails;
import com.cashfree.pg.core.hidden.network.response.models.config.PaymentModes;
import com.cashfree.pg.core.hidden.network.response.models.config.PaymentOption;
import com.cashfree.pg.core.hidden.nfc.NfcCardReader;
import com.cashfree.pg.core.hidden.nfc.NfcCardResponse;
import com.cashfree.pg.core.hidden.utils.CFPaymentModes;
import com.cashfree.pg.network.INetworkChecks;
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.INativePaymentCheckoutEvents;
import com.cashfree.pg.ui.hidden.activity.base.BaseActivity;
import com.cashfree.pg.ui.hidden.channel.CFNativeCallbackEventBus;
import com.cashfree.pg.ui.hidden.channel.CFNativeCallbackEvents;
import com.cashfree.pg.ui.hidden.checkout.CashfreeNativeCheckoutActivity;
import com.cashfree.pg.ui.hidden.checkout.callbacks.CFNativeCoreCallbacks;
import com.cashfree.pg.ui.hidden.checkout.dialog.EmiInfoBottomSheetDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.ExitDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.NBAppsBottomSheetDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.QRDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.QuickCheckoutBottomSheetDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.SavedCardDeleteBottomSheetDialog;
import com.cashfree.pg.ui.hidden.checkout.dialog.UPIAppsBottomSheetDialog;
import com.cashfree.pg.ui.hidden.checkout.subview.Action;
import com.cashfree.pg.ui.hidden.checkout.subview.ToolbarView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.CardView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.EMIView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.NetBankingView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.PayLaterView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.PaymentView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.UPIView;
import com.cashfree.pg.ui.hidden.checkout.subview.payment.WalletView;
import com.cashfree.pg.ui.hidden.checkout.subview.savedcards.SavedCardView;
import com.cashfree.pg.ui.hidden.dao.NativeCheckoutDAO;
import com.cashfree.pg.ui.hidden.dao.QuickCheckoutDAO;
import com.cashfree.pg.ui.hidden.persistence.CFUIPersistence;
import com.cashfree.pg.ui.hidden.utils.AnalyticsConstants;
import com.cashfree.pg.ui.hidden.utils.ErrorCode;
import com.cashfree.pg.ui.hidden.viewModel.BaseViewModel;
import com.cashfree.pg.ui.hidden.viewModel.NativeCheckoutViewModel;
import com.facebook.appevents.codeless.internal.Constants;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public class CashfreeNativeCheckoutActivity extends BaseActivity implements INativePaymentCheckoutEvents, UPIView.UPIViewEvents, NetBankingView.NBViewEvents, PVBottomSheetDialog.PaymentVerificationListener, WalletView.WalletViewEvents, PayLaterView.PayLaterViewEvents, CardView.CardViewEvents, QuickCheckoutDAO.QuickCheckoutListener, QuickCheckoutBottomSheetDialog.QuickCheckoutListener, EMIView.EMIViewEvents, NativeCheckoutDAO.FetchSavedCardsResponseListener, SavedCardView.SavedCardViewEvents {
public static final String ANDROID_NFC_ACTION_ADAPTER_STATE_CHANGED = "android.nfc.action.ADAPTER_STATE_CHANGED";
private static final String TAG = "CashfreeNativeCheckoutActivity";
private CardView cardView;
private CFTheme cfTheme;
private EmiInfoBottomSheetDialog emiInfoDialog;
private EMIView emiView;
private AlertDialog exitDialog;
private boolean isCreated;
private LinearLayoutCompat llContentScrolling;
private CoordinatorLayout loader;
private NativeCheckoutViewModel nativeCheckoutViewModel;
private NBAppsBottomSheetDialog nbAppsDialog;
private NetBankingView netBankingView;
private NfcCardManager nfcCardManager;
private NfcCardReader nfcCardReader;
private PayLaterView payLaterView;
private PaymentInitiationData paymentInitiationData;
private QRDialog qrDialog;
private QuickCheckoutBottomSheetDialog quickCheckoutDialog;
private SavedCardDeleteBottomSheetDialog savedCardDeleteDialog;
private SavedCardView savedCardView;
private ToolbarView toolbarView;
private UPIAppsBottomSheetDialog upiAppsDialog;
private UPIView upiView;
private WalletView walletView;
private boolean isResponseSent = false;
private boolean quickCheckoutEnabled = true;
public final CFNativeCoreCallbacks cfNativeCoreCallbacks = new AnonymousClass1();
@Override
public void onPVCancelled() {
}
@Override
public void onSavedCardsFetchFailure(CFErrorResponse cFErrorResponse) {
}
class AnonymousClass1 extends CFNativeCoreCallbacks {
AnonymousClass1() {
}
@Override
public void onVerifyPayment(String str) {
CashfreeNativeCheckoutActivity.this.sendVerify(str);
}
@Override
public void onPaymentFailure(final CFErrorResponse cFErrorResponse, String str) {
ThreadUtil.runOnUIThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.AnonymousClass1.this.m92x986012c9(cFErrorResponse);
}
});
}
void m92x986012c9(CFErrorResponse cFErrorResponse) {
CashfreeNativeCheckoutActivity.this.hideLoader();
CashfreeNativeCheckoutActivity.this.handleError(cFErrorResponse);
}
@Override
public void onQRFetched(final String str) {
ThreadUtil.runOnUIThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.AnonymousClass1.this.m93xce3ec0c6(str);
}
});
}
void m93xce3ec0c6(String str) {
CashfreeNativeCheckoutActivity.this.hideLoader();
CashfreeNativeCheckoutActivity.this.showQRCodeDialog(str);
}
}
public void handleError(CFErrorResponse cFErrorResponse) {
switch (AnonymousClass20.$SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.getCode(cFErrorResponse.getCode()).ordinal()]) {
case 1:
UPIView uPIView = this.upiView;
if (uPIView != null) {
uPIView.setUpiIdInvalid();
}
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new HashMap<String, String>(cFErrorResponse) {
final CFErrorResponse val$cfErrorResponse;
{
this.val$cfErrorResponse = cFErrorResponse;
put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
put(AnalyticsConstants.CHANNEL, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getId());
put(AnalyticsConstants.PAYMENT_METHOD, AnalyticsConstants.COLLECT);
put("error_code", cFErrorResponse.getCode());
put("error_message", cFErrorResponse.getMessage());
}
});
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
{
put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
put(AnalyticsConstants.CHANNEL, AnalyticsConstants.UPI);
put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, AnalyticsConstants.CANCELLED);
}
});
break;
case 2:
CardView cardView = this.cardView;
if (cardView != null) {
cardView.setCardHolderInvalid();
}
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new HashMap<String, String>(cFErrorResponse) {
final CFErrorResponse val$cfErrorResponse;
{
this.val$cfErrorResponse = cFErrorResponse;
put(AnalyticsConstants.PAYMENT_MODE, PaymentMode.CARD.name());
put("error_code", cFErrorResponse.getCode());
put("error_message", cFErrorResponse.getMessage());
}
});
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
{
put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
if (CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName() != null && !CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName().isEmpty()) {
put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName());
}
put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, AnalyticsConstants.CANCELLED);
}
});
CFPersistence.getInstance().clearTxnID();
break;
case 3:
CardView cardView2 = this.cardView;
if (cardView2 != null) {
cardView2.setCardNumberError();
}
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new HashMap<String, String>(cFErrorResponse) {
final CFErrorResponse val$cfErrorResponse;
{
this.val$cfErrorResponse = cFErrorResponse;
put(AnalyticsConstants.PAYMENT_MODE, PaymentMode.CARD.name());
put("error_code", cFErrorResponse.getCode());
put("error_message", cFErrorResponse.getMessage());
}
});
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
{
put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
if (CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName() != null && !CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName().isEmpty()) {
put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName());
}
put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, AnalyticsConstants.CANCELLED);
}
});
CFPersistence.getInstance().clearTxnID();
break;
case 4:
PayLaterView payLaterView = this.payLaterView;
if (payLaterView != null) {
payLaterView.showPhoneIllegible();
}
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_processing_error, new HashMap<String, String>(cFErrorResponse) {
final CFErrorResponse val$cfErrorResponse;
{
this.val$cfErrorResponse = cFErrorResponse;
put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
put("error_code", cFErrorResponse.getCode());
put("error_message", cFErrorResponse.getMessage());
}
});
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
{
put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
if (CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName() != null && !CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName().isEmpty()) {
put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName());
}
put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, AnalyticsConstants.CANCELLED);
}
});
CFPersistence.getInstance().clearTxnID();
break;
case 5:
case 6:
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
{
PaymentMode paymentMode = CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode();
if (paymentMode.equals(PaymentMode.QR_CODE)) {
put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
put(AnalyticsConstants.CHANNEL, AnalyticsConstants.QR);
} else if (paymentMode.equals(PaymentMode.UPI_COLLECT)) {
put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
put(AnalyticsConstants.CHANNEL, AnalyticsConstants.COLLECT);
} else if (!paymentMode.equals(PaymentMode.UPI_INTENT)) {
put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
} else {
put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
put(AnalyticsConstants.CHANNEL, AnalyticsConstants.INTENT);
}
if (CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName() != null && !CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName().isEmpty()) {
put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName());
}
put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, AnalyticsConstants.CANCELLED);
}
});
CFPersistence.getInstance().clearTxnID();
break;
default:
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>() {
{
PaymentMode paymentMode = CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode();
if (paymentMode.equals(PaymentMode.QR_CODE)) {
put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
put(AnalyticsConstants.CHANNEL, AnalyticsConstants.QR);
} else if (paymentMode.equals(PaymentMode.UPI_COLLECT)) {
put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
put(AnalyticsConstants.CHANNEL, AnalyticsConstants.COLLECT);
} else if (!paymentMode.equals(PaymentMode.UPI_INTENT)) {
put(AnalyticsConstants.PAYMENT_MODE, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
} else {
put(AnalyticsConstants.PAYMENT_MODE, AnalyticsConstants.UPI);
put(AnalyticsConstants.CHANNEL, AnalyticsConstants.INTENT);
}
if (CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName() != null && !CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName().isEmpty()) {
put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getName());
}
put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, AnalyticsConstants.FAILED);
}
});
CFPersistence.getInstance().clearTxnID();
sendError(cFErrorResponse);
break;
}
}
@Override
protected void onResume() {
super.onResume();
NfcCardManager nfcCardManager = this.nfcCardManager;
if (nfcCardManager != null) {
nfcCardManager.enableDispatch();
}
}
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Tag tag = (Tag) intent.getParcelableExtra("android.nfc.extra.TAG");
if (tag != null) {
NfcCardResponse readCard = this.nfcCardReader.readCard(tag);
if (readCard == null || readCard.getEmvCard() == null || this.cardView == null) {
return;
}
AnalyticsUtil.addEvent(UserEvents.NFC_CARD_INFO_ENTRY_DONE, new HashMap<String, String>(readCard) {
final NfcCardResponse val$cardResponse;
{
this.val$cardResponse = readCard;
put("card_type", readCard.getEmvCard().getType().getName());
}
});
CFLoggerService.getInstance().d(TAG, String.format("%s \n %s \n %s \n %s", readCard.getEmvCard().getCardNumber(), readCard.getEmvCard().getExpireDate(), readCard.getEmvCard().getHolderFirstname(), readCard.getEmvCard().getHolderLastname()));
this.cardView.setCardNoAndExp(readCard.getEmvCard().getCardNumber(), readCard.getEmvCard().getExpireDate());
return;
}
Toast.makeText((Context) this, (CharSequence) "TAG null", 0).show();
}
@Override
protected BaseViewModel getViewModel() {
return this.nativeCheckoutViewModel;
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_open, new HashMap<String, String>() {
{
put("platform", Constants.PLATFORM);
}
});
this.paymentInitiationData = CFPersistence.getInstance().getPaymentInitiationData();
CFCorePaymentGatewayService.getInstance().setCheckoutCallback(this.cfNativeCoreCallbacks.getCfCheckoutResponseCallback());
CFCorePaymentGatewayService.getInstance().setQRCallback(this.cfNativeCoreCallbacks);
try {
this.quickCheckoutEnabled = getResources().getBoolean(R.bool.cf_quick_checkout_enabled);
} catch (Exception e) {
CFLoggerService.getInstance().e(TAG, e.getMessage());
}
this.isCreated = true;
this.isResponseSent = false;
setContentView(R.layout.activity_cashfree_native_checkout);
NativeCheckoutViewModel nativeCheckoutViewModel = new NativeCheckoutViewModel(this, new INetworkChecks() {
@Override
public final boolean isNetworkConnected() {
return CashfreeNativeCheckoutActivity.this.m85x91c6b994();
}
});
this.nativeCheckoutViewModel = nativeCheckoutViewModel;
this.cfTheme = nativeCheckoutViewModel.getTheme();
this.loader = findViewById(R.id.cf_loader);
setTheme();
this.llContentScrolling = findViewById(R.id.llc_content);
ToolbarView toolbarView = new ToolbarView(findViewById(R.id.cf_cl_root), this.cfTheme);
this.toolbarView = toolbarView;
toolbarView.open();
setSupportActionBar(this.toolbarView.getMaterialToolbar());
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("");
}
showLoader();
this.nativeCheckoutViewModel.init();
this.nativeCheckoutViewModel.addSavedCardListener(this);
}
boolean m85x91c6b994() {
return NetworkConnectivityUtil.isNetworkConnected(getApplicationContext());
}
public void toggleCardViewUIState(NfcAdapter nfcAdapter) {
if (this.cardView != null) {
if (nfcAdapter.isEnabled()) {
AnalyticsUtil.addEvent(UserEvents.NFC_ENABLED);
this.cardView.setUIState(CardView.CardViewUIState.NFC_ENABLED);
} else {
AnalyticsUtil.addEvent(UserEvents.NFC_DISABLED);
this.cardView.setUIState(CardView.CardViewUIState.NFC_DISABLED);
}
}
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == 16908332) {
onBackPressed();
}
return super.onOptionsItemSelected(menuItem);
}
private void setTheme() {
int parseColor = Color.parseColor(this.cfTheme.getNavigationBarBackgroundColor());
((ProgressBar) findViewById(R.id.progress_bar)).getIndeterminateDrawable().setColorFilter(parseColor, PorterDuff.Mode.MULTIPLY);
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setStatusBarColor(parseColor);
}
}
@Override
protected void onPause() {
super.onPause();
hideLoader();
NfcCardManager nfcCardManager = this.nfcCardManager;
if (nfcCardManager != null) {
nfcCardManager.disableDispatch();
}
}
@Override
protected void onStop() {
super.onStop();
hideUPIDialog();
hideNBDialog();
hideExitDialog();
hideEmiDialog();
hideSavedCardDeleteDialog();
}
@Override
protected void onDestroy() {
hideQRDialog();
hideQuickCheckout();
SavedCardView savedCardView = this.savedCardView;
if (savedCardView != null) {
savedCardView.resetView();
}
super.onDestroy();
}
@Override
protected void onStart() {
if (this.isCreated) {
this.isCreated = false;
} else {
this.nativeCheckoutViewModel.getOrderStatus();
}
super.onStart();
}
@Override
public void onFetchPaymentData(final ConfigResponse configResponse, final List<CFPaymentModes> list) {
if (list.isEmpty()) {
sendError(CFUtil.getResponseFromError(CFUtil.getFailedResponse("no payment_modes are available as per configuration.")));
return;
}
if (list.contains(CFPaymentModes.UPI)) {
CFUPIUtil.getInstalledUPIApps(this, new CFUPIUtil.UPIAppsCallback() {
@Override
public final void onUPIAppsFetched(ArrayList arrayList) {
CashfreeNativeCheckoutActivity.this.m87xa89af80f(list, configResponse, arrayList);
}
});
return;
}
if (this.quickCheckoutEnabled && !CFUIPersistence.getInstance().getQuickCheckoutShown()) {
this.nativeCheckoutViewModel.getQuickCheckoutData(list, configResponse.getPaymentModes(), configResponse.getOrderDetails(), new ArrayList(), this);
}
loadViews(configResponse, list, null);
}
void m87xa89af80f(List list, ConfigResponse configResponse, ArrayList arrayList) {
if (this.quickCheckoutEnabled && !CFUIPersistence.getInstance().getQuickCheckoutShown()) {
this.nativeCheckoutViewModel.getQuickCheckoutData(list, configResponse.getPaymentModes(), configResponse.getOrderDetails(), arrayList, this);
}
loadViews(configResponse, list, arrayList);
}
private void loadViews(final ConfigResponse configResponse, final List<CFPaymentModes> list, final ArrayList<CFUPIApp> arrayList) {
runOnUiThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.this.m83x6357fc29(configResponse, list, arrayList);
}
});
}
void m83x6357fc29(ConfigResponse configResponse, List list, ArrayList arrayList) {
this.toolbarView.setMerchantInfo(configResponse.getMerchantInfo(), configResponse.getOrderDetails(), new Action() {
@Override
public final void onAction() {
CashfreeNativeCheckoutActivity.this.hideLoader();
}
});
if (list.size() == 1) {
CFErrorResponse checkAndGetPaymentModeError = checkAndGetPaymentModeError((CFPaymentModes) list.get(0), configResponse.getPaymentModes(), arrayList);
if (checkAndGetPaymentModeError != null) {
sendError(checkAndGetPaymentModeError);
} else {
PaymentView addView = addView(configResponse, (CFPaymentModes) list.get(0), arrayList);
if (addView != null) {
addView.open();
}
}
} else {
Iterator it = list.iterator();
while (it.hasNext()) {
addView(configResponse, (CFPaymentModes) it.next(), arrayList);
}
}
if (this.cardView != null) {
final NfcAdapter defaultAdapter = ((NfcManager) getSystemService("nfc")).getDefaultAdapter();
if (defaultAdapter != null) {
AnalyticsUtil.addEvent(UserEvents.NFC_AVAILABLE);
toggleCardViewUIState(defaultAdapter);
this.nfcCardManager = new NfcCardManager(this);
this.nfcCardReader = new NfcCardReader();
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
CashfreeNativeCheckoutActivity.this.toggleCardViewUIState(defaultAdapter);
}
}, new IntentFilter("android.nfc.action.ADAPTER_STATE_CHANGED"));
return;
}
this.cardView.setUIState(CardView.CardViewUIState.NFC_UNAVAILABLE);
}
}
static class AnonymousClass20 {
static final int[] $SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes;
static final int[] $SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode;
static {
int[] iArr = new int[CFPaymentModes.values().length];
$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes = iArr;
try {
iArr[CFPaymentModes.UPI.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.EMI.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.NB.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.WALLET.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.PAY_LATER.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[CFPaymentModes.CARD.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
int[] iArr2 = new int[ErrorCode.values().length];
$SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode = iArr2;
try {
iArr2[ErrorCode.upi_id_invalid.ordinal()] = 1;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.card_holder_name_invalid.ordinal()] = 2;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.card_number_invalid.ordinal()] = 3;
} catch (NoSuchFieldError unused9) {
}
try {
$SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.phone_ineligible.ordinal()] = 4;
} catch (NoSuchFieldError unused10) {
}
try {
$SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.payment_failed_headless.ordinal()] = 5;
} catch (NoSuchFieldError unused11) {
}
try {
$SwitchMap$com$cashfree$pg$ui$hidden$utils$ErrorCode[ErrorCode.action_cancelled.ordinal()] = 6;
} catch (NoSuchFieldError unused12) {
}
}
}
private CFErrorResponse checkAndGetPaymentModeError(CFPaymentModes cFPaymentModes, PaymentModes paymentModes, ArrayList<CFUPIApp> arrayList) {
int i = AnonymousClass20.$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[cFPaymentModes.ordinal()];
if (i == 1) {
if (paymentModes.getUpi().isEmpty() && (arrayList == null || arrayList.isEmpty())) {
return CFUtil.getErrorForNoPaymentMode(cFPaymentModes.name());
}
} else if (i == 2 && paymentModes.getEMI().isEmpty()) {
return CFUtil.getErrorForNoPaymentMode(cFPaymentModes.name());
}
return null;
}
private void showQuickCheckoutDialog(QuickCheckout quickCheckout, OrderDetails orderDetails) {
hideQuickCheckout();
this.quickCheckoutDialog = new QuickCheckoutBottomSheetDialog(this, quickCheckout, orderDetails, this.cfTheme, this);
if (isFinishing() || isDestroyed()) {
return;
}
this.quickCheckoutDialog.show();
}
@Override
public void onInitiatePayment(CFPayment cFPayment, PaymentInitiationData paymentInitiationData) {
try {
CFDropCheckoutPayment checkoutPayment = CFUIPersistence.getInstance().getCheckoutPayment();
if (checkoutPayment != null && checkoutPayment.getSource() != null) {
String[] split = checkoutPayment.getSource().split("-");
cFPayment.setCfSDKFlavour(CFPayment.CFSDKFlavour.fromString(split[1]).withVersion(split[2]));
cFPayment.setCfsdkFramework(CFPayment.CFSDKFramework.fromString(split[0]).withVersion(split[3]));
cFPayment.withBrowserVersion(split[7]);
}
CFPersistence.getInstance().setPaymentInitiationData(paymentInitiationData);
this.paymentInitiationData = paymentInitiationData;
showLoader();
cFPayment.setTheme(this.cfTheme);
CFCorePaymentGatewayService.getInstance().doPayment(this, cFPayment);
} catch (CFException e) {
e.printStackTrace();
}
}
void m91x3d8634cc() {
this.loader.setVisibility(0);
}
public void showLoader() {
runOnUiThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.this.m91x3d8634cc();
}
});
}
public void hideLoader() {
runOnUiThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.this.m82x8dc9b892();
}
});
}
void m82x8dc9b892() {
this.loader.setVisibility(8);
}
private PaymentView addView(ConfigResponse configResponse, CFPaymentModes cFPaymentModes, ArrayList<CFUPIApp> arrayList) {
PaymentModes paymentModes = configResponse.getPaymentModes();
switch (AnonymousClass20.$SwitchMap$com$cashfree$pg$core$hidden$utils$CFPaymentModes[cFPaymentModes.ordinal()]) {
case 1:
boolean isUPICollectEnable = paymentModes.isUPICollectEnable();
boolean isUPIQRModeEnable = paymentModes.isUPIQRModeEnable();
if ((isUPICollectEnable || ((arrayList != null && !arrayList.isEmpty()) || getResources().getBoolean(R.bool.isDeviceTablet))) && this.upiView == null) {
this.upiView = new UPIView(this.llContentScrolling, configResponse.getOrderDetails(), isUPICollectEnable, isUPIQRModeEnable, this.cfTheme, arrayList, this);
}
return this.upiView;
case 2:
if (this.emiView == null && !paymentModes.getEMI().isEmpty()) {
this.emiView = new EMIView(this.llContentScrolling, configResponse.getOrderDetails(), paymentModes.getEMI(), this.cfTheme, this);
}
return this.emiView;
case 3:
if (this.netBankingView == null && !paymentModes.getNetBanking().isEmpty()) {
this.netBankingView = new NetBankingView(this.llContentScrolling, paymentModes.getNetBanking(), configResponse.getOrderDetails(), this.cfTheme, this);
}
return this.netBankingView;
case 4:
if (this.walletView == null && !paymentModes.getWallet().isEmpty()) {
this.walletView = new WalletView(this.llContentScrolling, paymentModes.getWallet(), configResponse.getOrderDetails(), configResponse.getCustomerDetails(), this.cfTheme, this);
}
return this.walletView;
case 5:
if (this.payLaterView == null && !paymentModes.getPayLater().isEmpty()) {
this.payLaterView = new PayLaterView(this.llContentScrolling, paymentModes.getPayLater(), configResponse.getOrderDetails(), configResponse.getCustomerDetails(), this.cfTheme, this);
}
return this.payLaterView;
case 6:
if (this.cardView == null && !paymentModes.getCard().isEmpty()) {
this.cardView = new CardView(this.llContentScrolling, configResponse.getOrderDetails(), this.cfTheme, configResponse.getFeatureConfig(), this);
}
return this.cardView;
default:
return null;
}
}
private void hideUPIDialog() {
UPIAppsBottomSheetDialog uPIAppsBottomSheetDialog = this.upiAppsDialog;
if (uPIAppsBottomSheetDialog == null || !uPIAppsBottomSheetDialog.isShowing()) {
return;
}
this.upiAppsDialog.dismiss();
}
private void showUPIDialog(ArrayList<CFUPIApp> arrayList, OrderDetails orderDetails) {
hideUPIDialog();
this.upiAppsDialog = new UPIAppsBottomSheetDialog(this, arrayList, orderDetails, this.cfTheme, new UPIAppsBottomSheetDialog.UPIPayListener() {
@Override
public final void onPayInitiate(PaymentInitiationData paymentInitiationData) {
CashfreeNativeCheckoutActivity.this.onUPIPayClick(paymentInitiationData);
}
});
if (isFinishing() || isDestroyed()) {
return;
}
this.upiAppsDialog.show();
}
private void hideNBDialog() {
NBAppsBottomSheetDialog nBAppsBottomSheetDialog = this.nbAppsDialog;
if (nBAppsBottomSheetDialog == null || !nBAppsBottomSheetDialog.isShowing()) {
return;
}
this.nbAppsDialog.dismiss();
}
private void hideEmiDialog() {
EmiInfoBottomSheetDialog emiInfoBottomSheetDialog = this.emiInfoDialog;
if (emiInfoBottomSheetDialog == null || !emiInfoBottomSheetDialog.isVisible()) {
return;
}
this.emiInfoDialog.dismissAllowingStateLoss();
this.emiInfoDialog = null;
}
private void hideSavedCardDeleteDialog() {
SavedCardDeleteBottomSheetDialog savedCardDeleteBottomSheetDialog = this.savedCardDeleteDialog;
if (savedCardDeleteBottomSheetDialog == null || !savedCardDeleteBottomSheetDialog.isShowing()) {
return;
}
this.savedCardDeleteDialog.dismiss();
}
private void hideExitDialog() {
AlertDialog alertDialog = this.exitDialog;
if (alertDialog == null || !alertDialog.isShowing()) {
return;
}
this.exitDialog.dismiss();
}
private void hideQRDialog() {
QRDialog qRDialog = this.qrDialog;
if (qRDialog == null || !qRDialog.isShowing()) {
return;
}
this.qrDialog.dismiss();
}
private void hideQuickCheckout() {
QuickCheckoutBottomSheetDialog quickCheckoutBottomSheetDialog = this.quickCheckoutDialog;
if (quickCheckoutBottomSheetDialog == null || !quickCheckoutBottomSheetDialog.isShowing()) {
return;
}
this.quickCheckoutDialog.dismiss();
}
public void sendVerify(final String str) {
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_ended, new HashMap<String, String>(str) {
final String val$orderId;
{
this.val$orderId = str;
put("order_id", str);
put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
put(AnalyticsConstants.PAYMENT_ATTEMPT_STATUS, AnalyticsConstants.ENDED);
}
});
AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_close, new HashMap<String, String>(str) {
final String val$orderId;
{
this.val$orderId = str;
put("order_id", str);
put(AnalyticsConstants.PAYMENT_METHOD, CashfreeNativeCheckoutActivity.this.paymentInitiationData.getPaymentMode().name());
put(AnalyticsConstants.CHANNEL, AnalyticsConstants.VERIFY_CALLBACK);
}
});
CFPersistence.getInstance().clearTxnID();
if (this.quickCheckoutEnabled) {
this.nativeCheckoutViewModel.sendPaymentDataForQuickCheckout(this.paymentInitiationData, CFPersistence.getInstance().getEnvironment());
}
finish();
if (this.isResponseSent) {
return;
}
this.isResponseSent = true;
if (str != null) {
ThreadUtil.runOnUIThread(new Runnable() {
@Override
public final void run() {
CFNativeCallbackEventBus.getInstance().publishEvent(new CFNativeCallbackEventBus.CFPaymentCallbackEvent(CFNativeCallbackEvents.onVerify, str, null));
}
});
}
}
private void sendError(final CFErrorResponse cFErrorResponse) {
final String orderId;
finish();
if (this.isResponseSent) {
return;
}
this.isResponseSent = true;
if (cFErrorResponse.getMessage().equals("payment method failed.") || (orderId = this.nativeCheckoutViewModel.getOrderId()) == null) {
return;
}
ThreadUtil.runOnUIThread(new Runnable() {
@Override
public final void run() {
CFNativeCallbackEventBus.getInstance().publishEvent(new CFNativeCallbackEventBus.CFPaymentCallbackEvent(CFNativeCallbackEvents.onFailure, orderId, cFErrorResponse));
}
});
}
private void showEmiOptions(List<EmiOption> list, OrderDetails orderDetails) {
hideEmiDialog();
this.emiInfoDialog = new EmiInfoBottomSheetDialog(list, orderDetails, this.cfTheme, this);
if (isFinishing() || isDestroyed()) {
return;
}
this.emiInfoDialog.show(getSupportFragmentManager(), EmiInfoBottomSheetDialog.TAG);
}
private void showNBDialog(List<PaymentOption> list, OrderDetails orderDetails) {
hideNBDialog();
this.nbAppsDialog = new NBAppsBottomSheetDialog(this, list, orderDetails, this.cfTheme, this);
if (isFinishing() || isDestroyed()) {
return;
}
this.nbAppsDialog.show();
}
public void showQRCodeDialog(String str) {
hideQRDialog();
this.qrDialog = new QRDialog(this, str, this.cfTheme, this);
if (isFinishing() || isDestroyed()) {
return;
}
this.qrDialog.show();
}
@Override
public void onPaymentFailure(CFErrorResponse cFErrorResponse) {
sendError(cFErrorResponse);
}
@Override
public void onOrderStatusPaid() {
ThreadUtil.runOnUIThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.this.m89xaf868433();
}
});
}
void m89xaf868433() {
if (this.isResponseSent) {
return;
}
sendVerify(this.nativeCheckoutViewModel.getOrderId());
}
@Override
public void onOrderStatusFailed() {
ThreadUtil.runOnUIThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.this.m88xfe1037e5();
}
});
}
void m88xfe1037e5() {
if (this.isResponseSent) {
return;
}
sendVerify(this.nativeCheckoutViewModel.getOrderId());
}
@Override
public void onOpen(PaymentMode paymentMode) {
onOpenMode(paymentMode);
}
@Override
public void onClose(PaymentMode paymentMode) {
if (isPaymentModeOpen(this.upiView) || isPaymentModeOpen(this.netBankingView) || isPaymentModeOpen(this.walletView) || isPaymentModeOpen(this.payLaterView) || isPaymentModeOpen(this.cardView)) {
return;
}
this.toolbarView.open();
}
private boolean isPaymentModeOpen(PaymentView paymentView) {
return paymentView != null && paymentView.isOpen();
}
private void onOpenMode(PaymentMode paymentMode) {
AnalyticsUtil.addEvent(UserEvents.cfevent_payment_mode_focus, new HashMap<String, String>(paymentMode) {
final PaymentMode val$paymentMode;
{
this.val$paymentMode = paymentMode;
put(AnalyticsConstants.PAYMENT_MODE, paymentMode.name());
}
});
if (this.upiView != null && paymentMode != PaymentMode.UPI_INTENT && paymentMode != PaymentMode.UPI_COLLECT) {
this.upiView.close();
}
if (this.netBankingView != null && paymentMode != PaymentMode.NET_BANKING) {
this.netBankingView.close();
}
if (this.walletView != null && paymentMode != PaymentMode.WALLET) {
this.walletView.close();
}
if (this.payLaterView != null && paymentMode != PaymentMode.PAY_LATER) {
this.payLaterView.close();
}
if (this.cardView != null && paymentMode != PaymentMode.CARD) {
this.cardView.close();
}
this.toolbarView.close();
}
@Override
public void onUPIPayClick(PaymentInitiationData paymentInitiationData) {
this.nativeCheckoutViewModel.createUPIPayment(paymentInitiationData);
}
@Override
public void onShowMoreUPIClick(ArrayList<CFUPIApp> arrayList, OrderDetails orderDetails) {
showUPIDialog(arrayList, orderDetails);
}
@Override
public void onShowMoreNBClick(List<PaymentOption> list, OrderDetails orderDetails) {
showNBDialog(list, orderDetails);
}
@Override
public void onNBPayClick(PaymentInitiationData paymentInitiationData) {
this.nativeCheckoutViewModel.createNBPayment(paymentInitiationData);
}
@Override
public void onPVVerified(String str) {
sendVerify(str);
}
@Override
public void onPVFailed() {
this.nativeCheckoutViewModel.getOrderStatus();
}
@Override
public void onWalletPayClick(PaymentInitiationData paymentInitiationData) {
this.nativeCheckoutViewModel.createWalletPayment(paymentInitiationData);
}
@Override
public void onPayLaterPayClick(PaymentInitiationData paymentInitiationData) {
this.nativeCheckoutViewModel.createPayLaterPayment(paymentInitiationData);
}
@Override
public void onCardPayClick(String str, String str2, String str3, String str4, String str5, boolean z) {
this.nativeCheckoutViewModel.createCardPayment(str, str2, str3, str4, str5, z);
}
@Override
public void onEmiOptionClicked(List<EmiOption> list, OrderDetails orderDetails) {
showEmiOptions(list, orderDetails);
}
@Override
public void onEmiDialogDismiss() {
this.emiInfoDialog = null;
}
@Override
public void onEmiPayClick(EMIView.EMIPaymentObject eMIPaymentObject) {
hideEmiDialog();
this.nativeCheckoutViewModel.createCardEMIPayment(eMIPaymentObject);
}
public void onBackPressed() {
this.exitDialog = new ExitDialog(this, this.cfTheme, new Action() {
@Override
public final void onAction() {
CashfreeNativeCheckoutActivity.this.m84x694fdba4();
}
});
if (isFinishing() || isDestroyed()) {
return;
}
this.exitDialog.show();
}
void m84x694fdba4() {
AnalyticsUtil.addEvent(UserEvents.cfevent_checkout_close, new HashMap<String, String>() {
{
put(AnalyticsConstants.CHANNEL, "back_clicked");
put("platform", Constants.PLATFORM);
}
});
sendError(CFUtil.getResponseFromError(CFUtil.getCancelledResponse()));
}
@Override
public void onDataFetched(final QuickCheckout quickCheckout, final OrderDetails orderDetails, List<CFUPIApp> list) {
runOnUiThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.this.m86x75120820(quickCheckout, orderDetails);
}
});
}
void m86x75120820(QuickCheckout quickCheckout, OrderDetails orderDetails) {
if (quickCheckout == null || quickCheckout.getQuickPaymentModes().size() <= 0) {
return;
}
showQuickCheckoutDialog(quickCheckout, orderDetails);
}
@Override
public void onSelect(PaymentInitiationData paymentInitiationData) {
this.nativeCheckoutViewModel.createQuickCheckoutPayment(paymentInitiationData);
}
@Override
public void onSavedCardsFetchSuccess(final SavedCardsResponse savedCardsResponse) {
runOnUiThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.this.m90xc3e7a2d3(savedCardsResponse);
}
});
}
void m90xc3e7a2d3(SavedCardsResponse savedCardsResponse) {
if (this.savedCardView == null) {
this.savedCardView = new SavedCardView(this.llContentScrolling, savedCardsResponse.getSavedCards(), this, this.cfTheme);
}
}
@Override
public void onSavedCardPayNowClick(SavedCardsResponse.SavedCards savedCards, String str) {
this.nativeCheckoutViewModel.createSavedCardPayment(savedCards.getInstrumentID(), str);
}
@Override
public void onSavedCardDeleteClick(SavedCardsResponse.SavedCards savedCards) {
hideSavedCardDeleteDialog();
SavedCardDeleteBottomSheetDialog savedCardDeleteBottomSheetDialog = new SavedCardDeleteBottomSheetDialog(this, this.cfTheme, savedCards, this);
this.savedCardDeleteDialog = savedCardDeleteBottomSheetDialog;
savedCardDeleteBottomSheetDialog.show();
}
class AnonymousClass19 implements NativeCheckoutDAO.DeleteSavedCardResponseListener {
final String val$instrumentID;
AnonymousClass19(String str) {
this.val$instrumentID = str;
}
@Override
public void onSavedCardDeleteSuccess(DeleteSavedCardResponse deleteSavedCardResponse) {
CashfreeNativeCheckoutActivity cashfreeNativeCheckoutActivity = CashfreeNativeCheckoutActivity.this;
final String str = this.val$instrumentID;
cashfreeNativeCheckoutActivity.runOnUiThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.AnonymousClass19.this.m95x6a6095b3(str);
}
});
}
void m95x6a6095b3(String str) {
CashfreeNativeCheckoutActivity.this.savedCardDeleteDialog.dismiss();
CashfreeNativeCheckoutActivity.this.savedCardView.updateSavedCardViewAfterDelete(str);
}
@Override
public void onSavedCardDeleteFailure(CFErrorResponse cFErrorResponse) {
CashfreeNativeCheckoutActivity.this.runOnUiThread(new Runnable() {
@Override
public final void run() {
CashfreeNativeCheckoutActivity.AnonymousClass19.this.m94x6ba646eb();
}
});
}
void m94x6ba646eb() {
CashfreeNativeCheckoutActivity.this.savedCardDeleteDialog.dismiss();
}
}
@Override
public void onSavedCardDeleteConfirmClick(SavedCardsResponse.SavedCards savedCards) {
String instrumentID = savedCards.getInstrumentID();
this.nativeCheckoutViewModel.deleteSavedCard(instrumentID, new AnonymousClass19(instrumentID));
}
}