正在查看: Crafto v9.3.3 应用的 NativePlusPayActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Crafto v9.3.3 应用的 NativePlusPayActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.paytmpayments.customuisdk.directpages;
import android.app.AlertDialog;
import android.app.Application;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.Html;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.S;
import androidx.lifecycle.T;
import com.airbnb.lottie.LottieAnimationView;
import com.android.volley.VolleyError;
import com.paytmpayments.customuisdk.app.ErrorCodes;
import com.paytmpayments.customuisdk.base.DependencyProvider;
import com.paytmpayments.customuisdk.base.EventLogger;
import com.paytmpayments.customuisdk.base.FlowNavigator;
import com.paytmpayments.customuisdk.base.PaytmHelper;
import com.paytmpayments.customuisdk.base.UtilityHelper;
import com.paytmpayments.customuisdk.common.BaseActivity;
import com.paytmpayments.customuisdk.common.Constants.SDKConstants;
import com.paytmpayments.customuisdk.common.listeners.PayFragmentInteractor;
import com.paytmpayments.customuisdk.common.utils.LogUtility;
import com.paytmpayments.customuisdk.directpages.viewmodel.NativePlusPayViewModel;
import com.paytmpayments.customuisdk.paymethods.datasource.PaymentMethodDataSource;
import com.paytmpayments.customuisdk.paymethods.datasource.PaymentRepository;
import com.paytmpayments.customuisdk.paymethods.model.PaytmAssistParams;
import com.paytmpayments.customuisdk.paymethods.model.processtransaction.Body;
import com.paytmpayments.customuisdk.paymethods.model.processtransaction.Head;
import com.paytmpayments.customuisdk.paymethods.model.processtransaction.ProcessTransactionInfo;
import com.paytmpayments.customuisdk.paymethods.model.processtransaction.ResultInfo;
import com.paytmpayments.customuisdk.transaction.PayUtility;
import com.paytmpayments.customuisdk.transaction.PaymentInstrument;
import java.io.Serializable;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.p;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
@Metadata
public final class NativePlusPayActivity extends BaseActivity implements View.OnClickListener, PayFragmentInteractor {
private PaytmAssistParams assistParams;
private boolean disableUiInteraction;
private boolean isOtpAutoFilled;
private boolean isOtpPasted;
private AlertDialog mAlertDialog;
private NativePlusPayViewModel mViewModel;
public NativeOtpHelper otpHelper;
private PaymentInstrument paymentInstrument;
private ProcessTransactionInfo processTransactionInfo;
@NotNull
public Map<Integer, View> _$_findViewCache = new LinkedHashMap();
private final String TAG = "NativePlusPayActivity";
private final void addCancelObserable() {
NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
if (nativePlusPayViewModel == null) {
Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
nativePlusPayViewModel = null;
}
S<JSONObject> otpCancelResponse = nativePlusPayViewModel.getOtpCancelResponse();
if (otpCancelResponse != null) {
otpCancelResponse.observe(this, new T() {
public final void onChanged(Object obj) {
NativePlusPayActivity.m54addCancelObserable$lambda7(NativePlusPayActivity.this, (JSONObject) obj);
}
});
}
}
public static final void m54addCancelObserable$lambda7(NativePlusPayActivity nativePlusPayActivity, JSONObject jSONObject) {
Map<String, ? extends Object> genericEventParams;
PaytmHelper paytmHelper;
Map<String, ? extends Object> genericEventParams2;
PaytmHelper paytmHelper2;
Intrinsics.checkNotNullParameter(nativePlusPayActivity, "this$0");
Object obj = jSONObject.get("body");
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type org.json.JSONObject");
JSONObject jSONObject2 = (JSONObject) obj;
Object obj2 = jSONObject2.get("resultInfo");
Intrinsics.checkNotNull(obj2, "null cannot be cast to non-null type org.json.JSONObject");
ResultInfo resultInfo = (ResultInfo) new com.google.gson.i().c(ResultInfo.class, ((JSONObject) obj2).toString());
if (resultInfo == null || !Intrinsics.areEqual(resultInfo.getRetry(), Boolean.TRUE)) {
PaytmHelper paytmHelper3 = DependencyProvider.getPaytmHelper();
if (paytmHelper3 != null && (genericEventParams = paytmHelper3.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "cancel_otp", "retry_false", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper.sendGaEvents(genericEventParams);
}
nativePlusPayActivity.backPressCancelTransaction();
} else {
PaytmHelper paytmHelper4 = DependencyProvider.getPaytmHelper();
if (paytmHelper4 != null && (genericEventParams2 = paytmHelper4.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "cancel_otp", "retry_true", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper2 = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper2.sendGaEvents(genericEventParams2);
}
UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper == null || !utilitiesHelper.isServerSDK()) {
nativePlusPayActivity.redirectToPaymentOptions(resultInfo.getResultMsg());
} else {
Object obj3 = jSONObject2.get("txnInfo");
Intrinsics.checkNotNull(obj3, "null cannot be cast to non-null type org.json.JSONObject");
nativePlusPayActivity.redirectToMerchantSDK(((JSONObject) obj3).toString(), true, resultInfo.getResultMsg());
}
}
AlertDialog alertDialog = nativePlusPayActivity.mAlertDialog;
if (alertDialog != null) {
alertDialog.dismiss();
}
}
private final void addResendObserable() {
NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
if (nativePlusPayViewModel == null) {
Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
nativePlusPayViewModel = null;
}
S<JSONObject> otpResendResponse = nativePlusPayViewModel.getOtpResendResponse();
if (otpResendResponse != null) {
otpResendResponse.observe(this, new T<JSONObject>() {
public void onChanged(@org.jetbrains.annotations.NotNull org.json.JSONObject r10) {
throw new UnsupportedOperationException("Method not decompiled: com.paytmpayments.customuisdk.directpages.NativePlusPayActivity$addResendObserable$1.onChanged(org.json.JSONObject):void");
}
});
}
}
private final void addSubmitObservable() {
NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
if (nativePlusPayViewModel == null) {
Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
nativePlusPayViewModel = null;
}
S<JSONObject> otpSubmitResponse = nativePlusPayViewModel.getOtpSubmitResponse();
if (otpSubmitResponse != null) {
otpSubmitResponse.observe(this, new T<JSONObject>() {
public void onChanged(@NotNull JSONObject jSONObject) {
PaymentInstrument paymentInstrument;
Map<String, ? extends Object> genericEventParams;
PaytmHelper paytmHelper;
PaymentInstrument paymentInstrument2;
Map<String, ? extends Object> genericEventParams2;
PaytmHelper paytmHelper2;
PaymentInstrument paymentInstrument3;
Map<String, Object> genericEventParams3;
PaytmHelper paytmHelper3;
PaymentInstrument paymentInstrument4;
Map<String, ? extends Object> genericEventParams4;
PaytmHelper paytmHelper4;
Map<String, ? extends Object> genericEventParams5;
PaytmHelper paytmHelper5;
Intrinsics.checkNotNullParameter(jSONObject, "otpResponse");
Object obj = jSONObject.get("body");
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type org.json.JSONObject");
JSONObject jSONObject2 = (JSONObject) obj;
Object obj2 = jSONObject2.get("resultInfo");
Intrinsics.checkNotNull(obj2, "null cannot be cast to non-null type org.json.JSONObject");
ResultInfo resultInfo = (ResultInfo) new com.google.gson.i().c(ResultInfo.class, ((JSONObject) obj2).toString());
if (resultInfo == null) {
NativePlusPayActivity.this.sendPayCompleteEvent(SDKConstants.VALUE_FAIL);
PaytmHelper paytmHelper6 = DependencyProvider.getPaytmHelper();
if (paytmHelper6 != null && (genericEventParams5 = paytmHelper6.getGenericEventParams(SDKConstants.API_TIME_OUT, "otp_submit_api", "direct_otp_page")) != null && (paytmHelper5 = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper5.sendGaEvents(genericEventParams5);
}
NativePlusPayActivity.this.enableUiInteraction();
PaytmHelper paytmHelper7 = DependencyProvider.getPaytmHelper();
if (paytmHelper7 != null && (genericEventParams4 = paytmHelper7.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", "timeout", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper4 = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper4.sendGaEvents(genericEventParams4);
}
PayUtility.finishSdk(NativePlusPayActivity.this, null, null, SDKConstants.VALUE_CAP_FAILED, ErrorCodes.NETWORK_TIME_OUT_ERROR);
return;
}
?? r8 = NativePlusPayActivity.this;
if (!Intrinsics.areEqual("0000", resultInfo.getResultCode()) && !Intrinsics.areEqual("S", resultInfo.getResultStatus())) {
Boolean bankRetry = resultInfo.getBankRetry();
Boolean bool = Boolean.TRUE;
if (Intrinsics.areEqual(bankRetry, bool)) {
paymentInstrument4 = ((NativePlusPayActivity) r8).paymentInstrument;
if (paymentInstrument4 != null) {
r8.sendPayCompleteEvent(SDKConstants.VALUE_PENDING);
}
r8.enableUiInteraction();
String resultMsg = resultInfo.getResultMsg();
if (resultMsg == null) {
resultMsg = "";
}
r8.showRetryDialog(resultMsg);
PaytmHelper paytmHelper8 = DependencyProvider.getPaytmHelper();
if (paytmHelper8 == null || (genericEventParams3 = paytmHelper8.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", "retry_true", SDKConstants.GA_NATIVE_PLUS, "")) == null || (paytmHelper3 = DependencyProvider.getPaytmHelper()) == null) {
return;
}
} else if (Intrinsics.areEqual(resultInfo.getRetry(), bool)) {
paymentInstrument3 = ((NativePlusPayActivity) r8).paymentInstrument;
if (paymentInstrument3 != null) {
r8.sendPayCompleteEvent(SDKConstants.VALUE_PENDING);
}
r8.enableUiInteraction();
UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper == null || !utilitiesHelper.isServerSDK()) {
r8.redirectToPaymentOptions(resultInfo.getResultMsg());
} else {
Object obj3 = jSONObject2.get("txnInfo");
Intrinsics.checkNotNull(obj3, "null cannot be cast to non-null type org.json.JSONObject");
r8.redirectToMerchantSDK(((JSONObject) obj3).toString(), true, resultInfo.getResultMsg());
}
PaytmHelper paytmHelper9 = DependencyProvider.getPaytmHelper();
if (paytmHelper9 == null || (genericEventParams3 = paytmHelper9.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", "retry_true", SDKConstants.GA_NATIVE_PLUS, "")) == null || (paytmHelper3 = DependencyProvider.getPaytmHelper()) == null) {
return;
}
} else {
paymentInstrument2 = ((NativePlusPayActivity) r8).paymentInstrument;
if (paymentInstrument2 != null) {
r8.sendPayCompleteEvent(SDKConstants.VALUE_FAIL);
}
PaytmHelper paytmHelper10 = DependencyProvider.getPaytmHelper();
if (paytmHelper10 != null && (genericEventParams2 = paytmHelper10.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", "retry_false", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper2 = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper2.sendGaEvents(genericEventParams2);
}
if (!jSONObject2.has("txnInfo")) {
r8.enableUiInteraction();
PayUtility.finishSdk(r8, null, null, SDKConstants.VALUE_CAP_FAILED, ErrorCodes.SUBMIT_OTP_FAIL);
return;
}
}
paytmHelper3.sendGaEvents(genericEventParams3);
return;
}
paymentInstrument = ((NativePlusPayActivity) r8).paymentInstrument;
if (paymentInstrument != null) {
r8.sendPayCompleteEvent(SDKConstants.VALUE_SUCCESS);
}
PaytmHelper paytmHelper11 = DependencyProvider.getPaytmHelper();
if (paytmHelper11 != null && (genericEventParams = paytmHelper11.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", SDKConstants.VALUE_SUCCESS, SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper.sendGaEvents(genericEventParams);
}
if (!jSONObject2.has("txnInfo")) {
r8.enableUiInteraction();
PayUtility.finishSdk(r8, null, null, SDKConstants.VALUE_CAP_SUCCESS, null);
return;
}
r8.postDataOnCallBack(jSONObject);
}
});
}
}
private final void backPressCancelTransaction() {
throw new UnsupportedOperationException("Method not decompiled: com.paytmpayments.customuisdk.directpages.NativePlusPayActivity.backPressCancelTransaction():void");
}
private final void disableResendButton() {
int i = R.id.tvResendOtp;
((TextView) _$_findCachedViewById(i)).setOnClickListener(null);
((TextView) _$_findCachedViewById(i)).setTextColor(J1.a.getColor(this, R.color.black));
((TextView) _$_findCachedViewById(i)).setAlpha(0.4f);
}
private final void disableUiInteraction() {
this.disableUiInteraction = true;
((FrameLayout) _$_findCachedViewById(R.id.disableClickView)).setClickable(true);
showPaymentLoadingState();
((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setOnClickListener(null);
}
public final void enableResendButton() {
int i = R.id.tvResendOtp;
((TextView) _$_findCachedViewById(i)).setOnClickListener(this);
((TextView) _$_findCachedViewById(i)).setTextColor(J1.a.getColor(this, R.color.paytm_blue));
((TextView) _$_findCachedViewById(i)).setAlpha(1.0f);
}
public final void enableUiInteraction() {
AlertDialog alertDialog = this.mAlertDialog;
if (alertDialog != null) {
alertDialog.dismiss();
}
this.disableUiInteraction = false;
((FrameLayout) _$_findCachedViewById(R.id.disableClickView)).setClickable(false);
((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setOnClickListener(this);
hidePaymentLoadingState();
}
public final void hideOtpErrorView() {
int i = R.id.rlResendOtpSuccess;
if (((LinearLayout) _$_findCachedViewById(i)) != null) {
int i2 = R.id.tvPaymentAmount;
if (((TextView) _$_findCachedViewById(i2)) != null) {
int i3 = R.id.llOtpErrorView;
if (((LinearLayout) _$_findCachedViewById(i3)) != null) {
((LinearLayout) _$_findCachedViewById(i)).setVisibility(8);
((TextView) _$_findCachedViewById(i2)).setVisibility(0);
((LinearLayout) _$_findCachedViewById(i3)).setVisibility(8);
}
}
}
}
private final void hidePayOnBankLoader() {
int i = R.id.ltv_loading1;
if (_$_findCachedViewById(i) != null) {
LottieAnimationView _$_findCachedViewById = _$_findCachedViewById(i);
Intrinsics.checkNotNull(_$_findCachedViewById, "null cannot be cast to non-null type com.airbnb.lottie.LottieAnimationView");
_$_findCachedViewById.setVisibility(0);
_$_findCachedViewById.setAnimation("Payments-Loader.json");
_$_findCachedViewById.loop(true);
_$_findCachedViewById.cancelAnimation();
_$_findCachedViewById(i).setVisibility(8);
((TextView) _$_findCachedViewById(R.id.tvGoToBankWebSite)).setVisibility(0);
}
}
private final void hidePaymentLoadingState() {
int i = R.id.ltv_loading;
if (_$_findCachedViewById(i) != null) {
LottieAnimationView _$_findCachedViewById = _$_findCachedViewById(i);
Intrinsics.checkNotNull(_$_findCachedViewById, "null cannot be cast to non-null type com.airbnb.lottie.LottieAnimationView");
_$_findCachedViewById.setVisibility(0);
_$_findCachedViewById.setAnimation("Payments-Loader.json");
_$_findCachedViewById.loop(true);
_$_findCachedViewById.cancelAnimation();
((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setBackgroundResource(R.drawable.nativesdk_button_click);
_$_findCachedViewById(i).setVisibility(8);
((TextView) _$_findCachedViewById(R.id.tvPaySecurely)).setVisibility(0);
}
}
private final void initOtpHelper() {
setOtpHelper(new NativeOtpHelper(this, new OtpListener() {
@Override
public void onOtpReceived(@NotNull String str) {
String str2;
Map<String, ? extends Object> genericEventParams;
PaytmHelper paytmHelper;
Intrinsics.checkNotNullParameter(str, SDKConstants.KEY_OTP);
str2 = NativePlusPayActivity.this.TAG;
LogUtility.d(str2, "received otp is " + str);
NativePlusPayActivity nativePlusPayActivity = NativePlusPayActivity.this;
int i = R.id.otpEditText;
Editable text = ((OtpEditText) nativePlusPayActivity._$_findCachedViewById(i)).getText();
Intrinsics.checkNotNull(text);
if (text.length() == 0) {
((OtpEditText) NativePlusPayActivity.this._$_findCachedViewById(i)).setText(str);
NativePlusPayActivity.this.isOtpAutoFilled = true;
PaytmHelper paytmHelper2 = DependencyProvider.getPaytmHelper();
if (paytmHelper2 == null || (genericEventParams = paytmHelper2.getGenericEventParams(SDKConstants.GA_DIRECT_OTP_INPUT_ACTION, "auto_fill", "")) == null || (paytmHelper = DependencyProvider.getPaytmHelper()) == null) {
return;
}
paytmHelper.sendGaEvents(genericEventParams);
}
}
}));
}
private final void initUI() {
throw new UnsupportedOperationException("Method not decompiled: com.paytmpayments.customuisdk.directpages.NativePlusPayActivity.initUI():void");
}
public static final void m55initUI$lambda9(NativePlusPayActivity nativePlusPayActivity, View view) {
Intrinsics.checkNotNullParameter(nativePlusPayActivity, "this$0");
((OtpEditText) nativePlusPayActivity._$_findCachedViewById(R.id.otpEditText)).isActive = true;
}
public final boolean isValidItemPasted(String str) {
Editable text = ((OtpEditText) _$_findCachedViewById(R.id.otpEditText)).getText();
Intrinsics.checkNotNull(text);
if (text.length() == 6) {
return true;
}
if (str != null) {
int min = Math.min(str.length(), 6);
for (int i = 0; i < min; i++) {
if (Character.isDigit(str.charAt(i))) {
return true;
}
}
}
return false;
}
private final boolean isValidOtp(String str) {
return str.length() == 6;
}
public static final void m56onBackPressed$lambda20(NativePlusPayActivity nativePlusPayActivity, DialogInterface dialogInterface, int i) {
Map<String, ? extends Object> genericEventParams;
PaytmHelper paytmHelper;
Map<String, ? extends Object> genericEventParams2;
PaytmHelper paytmHelper2;
Map<String, ? extends Object> genericEventParams3;
PaytmHelper paytmHelper3;
Intrinsics.checkNotNullParameter(nativePlusPayActivity, "this$0");
PaytmHelper paytmHelper4 = DependencyProvider.getPaytmHelper();
if (paytmHelper4 != null && (genericEventParams3 = paytmHelper4.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "cancel_otp", "init", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper3 = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper3.sendGaEvents(genericEventParams3);
}
UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper == null || !utilitiesHelper.isNetworkAvailable(nativePlusPayActivity)) {
PaytmHelper paytmHelper5 = DependencyProvider.getPaytmHelper();
if (paytmHelper5 != null && (genericEventParams = paytmHelper5.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "cancel_otp", "timeout", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper.sendGaEvents(genericEventParams);
}
nativePlusPayActivity.backPressCancelTransaction();
return;
}
NativePlusPayViewModel nativePlusPayViewModel = nativePlusPayActivity.mViewModel;
if (nativePlusPayViewModel == null) {
Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
nativePlusPayViewModel = null;
}
nativePlusPayViewModel.cancelTransaction();
PaytmHelper paytmHelper6 = DependencyProvider.getPaytmHelper();
if (paytmHelper6 == null || (genericEventParams2 = paytmHelper6.getGenericEventParams(SDKConstants.GA_KEY_CANCEL_PAYMENT, SDKConstants.VALUE_YES, "")) == null || (paytmHelper2 = DependencyProvider.getPaytmHelper()) == null) {
return;
}
paytmHelper2.sendGaEvents(genericEventParams2);
}
public static final void m57onBackPressed$lambda22(DialogInterface dialogInterface, int i) {
Map<String, ? extends Object> genericEventParams;
PaytmHelper paytmHelper;
PaytmHelper paytmHelper2 = DependencyProvider.getPaytmHelper();
if (paytmHelper2 == null || (genericEventParams = paytmHelper2.getGenericEventParams(SDKConstants.GA_KEY_CANCEL_PAYMENT, SDKConstants.VALUE_NO, "")) == null || (paytmHelper = DependencyProvider.getPaytmHelper()) == null) {
return;
}
paytmHelper.sendGaEvents(genericEventParams);
}
private final void payOnBankSite() {
Bundle bundle = new Bundle();
bundle.putBoolean(SDKConstants.EXTRA_NEW_FLOW, true);
NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
if (nativePlusPayViewModel == null) {
Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
nativePlusPayViewModel = null;
}
bundle.putSerializable(SDKConstants.EXTRA_BANK_FORM_ITEM, nativePlusPayViewModel.getDirectFormItemMap().get("payonbank"));
PaytmAssistParams paytmAssistParams = this.assistParams;
bundle.putString(SDKConstants.PAY_TYPE, paytmAssistParams != null ? paytmAssistParams.getPayType() : null);
PaytmAssistParams paytmAssistParams2 = this.assistParams;
bundle.putString(SDKConstants.BANK_CODE, paytmAssistParams2 != null ? paytmAssistParams2.getBankCode() : null);
PaytmAssistParams paytmAssistParams3 = this.assistParams;
bundle.putString(SDKConstants.CARD_TYPE, paytmAssistParams3 != null ? paytmAssistParams3.getCardType() : null);
addPayFragment(bundle);
showPayOnBankLoader();
this.disableUiInteraction = true;
((FrameLayout) _$_findCachedViewById(R.id.disableClickView)).setClickable(true);
}
public final void postDataOnCallBack(final JSONObject jSONObject) {
com.google.gson.i iVar = new com.google.gson.i();
Object obj = jSONObject.get("head");
Intrinsics.checkNotNull(obj, "null cannot be cast to non-null type org.json.JSONObject");
ProcessTransactionInfo processTransactionInfo = new ProcessTransactionInfo((Head) iVar.c(Head.class, ((JSONObject) obj).toString()), new Body());
Body body = processTransactionInfo.getBody();
if (body != null) {
Object obj2 = jSONObject.get("body");
Intrinsics.checkNotNull(obj2, "null cannot be cast to non-null type org.json.JSONObject");
body.setCallBackUrl(((JSONObject) obj2).getString("callBackUrl"));
}
Object obj3 = jSONObject.get("body");
Intrinsics.checkNotNull(obj3, "null cannot be cast to non-null type org.json.JSONObject");
Object obj4 = ((JSONObject) obj3).get("txnInfo");
Body body2 = processTransactionInfo.getBody();
if (body2 != null) {
body2.setTxnInfo(new com.google.gson.i().c(HashMap.class, obj4.toString()));
}
PaymentRepository.Companion companion = PaymentRepository.Companion;
Context applicationContext = getApplicationContext();
Intrinsics.checkNotNullExpressionValue(applicationContext, "applicationContext");
companion.getInstance(applicationContext).postDataOnCallBack(processTransactionInfo, new PaymentMethodDataSource.Callback<Object>() {
@Override
public void onErrorResponse(VolleyError volleyError, Object obj5) {
AppCompatActivity appCompatActivity = NativePlusPayActivity.this;
Object obj6 = jSONObject.get("body");
Intrinsics.checkNotNull(obj6, "null cannot be cast to non-null type org.json.JSONObject");
PayUtility.finishSdk(appCompatActivity, ((JSONObject) obj6).get("txnInfo").toString(), null, null, null);
}
@Override
public void onResponse(Object obj5) {
AppCompatActivity appCompatActivity = NativePlusPayActivity.this;
Object obj6 = jSONObject.get("body");
Intrinsics.checkNotNull(obj6, "null cannot be cast to non-null type org.json.JSONObject");
PayUtility.finishSdk(appCompatActivity, ((JSONObject) obj6).get("txnInfo").toString(), null, null, null);
}
});
}
public final void redirectToMerchantSDK(String str, boolean z, String str2) {
PayUtility.finishSdk(this, str, z, str2);
}
public final void redirectToPaymentOptions(String str) {
Intent intent = new Intent();
intent.putExtra(SDKConstants.DATA, str);
setResult(SDKConstants.SHOW_ALERT, intent);
finish();
}
private final void removeAutoSubmitOtpUI() {
int i = R.id.tvPaySecurely;
((TextView) _$_findCachedViewById(i)).setText(getString(R.string.paytm_pay_securely));
((TextView) _$_findCachedViewById(i)).setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
int i2 = R.id.autoSubmitProgressBar;
((ProgressBar) _$_findCachedViewById(i2)).setProgress(0);
((ProgressBar) _$_findCachedViewById(i2)).setVisibility(8);
}
public final void sendPayCompleteEvent(String str) {
HashMap<String, String> hashMap = new HashMap<>();
PaymentInstrument paymentInstrument = this.paymentInstrument;
String gaPaymentMethod = paymentInstrument != null ? paymentInstrument.getGaPaymentMethod() : null;
if (gaPaymentMethod == null) {
gaPaymentMethod = "";
}
hashMap.put(SDKConstants.KEY_PAYMENT_OPTION_TYPE, gaPaymentMethod);
PaymentInstrument paymentInstrument2 = this.paymentInstrument;
String gaPaymentMode = paymentInstrument2 != null ? paymentInstrument2.getGaPaymentMode() : null;
hashMap.put(SDKConstants.KEY_PAYMENT_MODE_TYPE, gaPaymentMode != null ? gaPaymentMode : "");
hashMap.put(SDKConstants.KEY_PAYMENT_STATUS, str);
EventLogger eventLogger = DependencyProvider.getEventLogger();
if (eventLogger != null) {
eventLogger.sendLogs(SDKConstants.PG_EVENT_CATEGORY, "pay_complete", hashMap);
}
}
private final void setFieldsVisibility() {
NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
NativePlusPayViewModel nativePlusPayViewModel2 = null;
if (nativePlusPayViewModel == null) {
Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
nativePlusPayViewModel = null;
}
if (nativePlusPayViewModel.getDirectFormItemMap().get("submit") != null) {
((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setVisibility(0);
} else {
((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setVisibility(8);
}
NativePlusPayViewModel nativePlusPayViewModel3 = this.mViewModel;
if (nativePlusPayViewModel3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
nativePlusPayViewModel3 = null;
}
if (nativePlusPayViewModel3.getDirectFormItemMap().get("resend") != null) {
((TextView) _$_findCachedViewById(R.id.tvResendOtp)).setVisibility(0);
} else {
((TextView) _$_findCachedViewById(R.id.tvResendOtp)).setVisibility(8);
}
NativePlusPayViewModel nativePlusPayViewModel4 = this.mViewModel;
if (nativePlusPayViewModel4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
} else {
nativePlusPayViewModel2 = nativePlusPayViewModel4;
}
if (nativePlusPayViewModel2.getDirectFormItemMap().get("payonbank") != null) {
((RelativeLayout) _$_findCachedViewById(R.id.rlFooter)).setVisibility(0);
((TextView) _$_findCachedViewById(R.id.footerSeparator)).setVisibility(0);
} else {
((RelativeLayout) _$_findCachedViewById(R.id.rlFooter)).setVisibility(8);
((TextView) _$_findCachedViewById(R.id.footerSeparator)).setVisibility(8);
}
}
public final void showOtpErrorView(String str) {
((LinearLayout) _$_findCachedViewById(R.id.rlResendOtpSuccess)).setVisibility(8);
((TextView) _$_findCachedViewById(R.id.tvPaymentAmount)).setVisibility(4);
((LinearLayout) _$_findCachedViewById(R.id.llOtpErrorView)).setVisibility(0);
((TextView) _$_findCachedViewById(R.id.tvOtpErrorMsg)).setText(Html.fromHtml(str));
}
public final void showOtpValidationError() {
((OtpEditText) _$_findCachedViewById(R.id.otpEditText)).requestFocus();
new Handler().postDelayed(new h(this, 0), 100L);
}
public static final void m60showOtpValidationError$lambda16(NativePlusPayActivity nativePlusPayActivity) {
TextView textView;
int i;
Intrinsics.checkNotNullParameter(nativePlusPayActivity, "this$0");
Editable text = ((OtpEditText) nativePlusPayActivity._$_findCachedViewById(R.id.otpEditText)).getText();
Intrinsics.checkNotNull(text);
if (text.length() == 0) {
textView = (TextView) nativePlusPayActivity._$_findCachedViewById(R.id.tvInvalidOtpText);
i = R.string.empty_otp_error;
} else {
textView = (TextView) nativePlusPayActivity._$_findCachedViewById(R.id.tvInvalidOtpText);
i = R.string.paytm_invalid_otp;
}
textView.setText(nativePlusPayActivity.getString(i));
((TextView) nativePlusPayActivity._$_findCachedViewById(R.id.tvInvalidOtpText)).setVisibility(0);
}
private final void showPayOnBankLoader() {
int i = R.id.ltv_loading1;
if (_$_findCachedViewById(i) != null) {
LottieAnimationView _$_findCachedViewById = _$_findCachedViewById(i);
Intrinsics.checkNotNull(_$_findCachedViewById, "null cannot be cast to non-null type com.airbnb.lottie.LottieAnimationView");
_$_findCachedViewById.setVisibility(0);
_$_findCachedViewById.setAnimation("Payments-Loader.json");
_$_findCachedViewById.loop(true);
_$_findCachedViewById.playAnimation();
_$_findCachedViewById(i).setVisibility(0);
((TextView) _$_findCachedViewById(R.id.tvGoToBankWebSite)).setVisibility(4);
}
}
private final void showPaymentLoadingState() {
int i = R.id.ltv_loading;
if (_$_findCachedViewById(i) != null) {
LottieAnimationView _$_findCachedViewById = _$_findCachedViewById(i);
Intrinsics.checkNotNull(_$_findCachedViewById, "null cannot be cast to non-null type com.airbnb.lottie.LottieAnimationView");
_$_findCachedViewById.setVisibility(0);
_$_findCachedViewById.setAnimation("Payments-Loader.json");
_$_findCachedViewById.loop(true);
_$_findCachedViewById.playAnimation();
((RelativeLayout) _$_findCachedViewById(R.id.payButton)).setBackgroundResource(R.drawable.native_button_onloading);
_$_findCachedViewById(i).setVisibility(0);
((TextView) _$_findCachedViewById(R.id.tvPaySecurely)).setVisibility(8);
}
}
public final void showResendOtpSuccessUi(String str) {
((LinearLayout) _$_findCachedViewById(R.id.rlResendOtpSuccess)).setVisibility(0);
((TextView) _$_findCachedViewById(R.id.tvPaymentAmount)).setVisibility(4);
((LinearLayout) _$_findCachedViewById(R.id.llOtpErrorView)).setVisibility(8);
((TextView) _$_findCachedViewById(R.id.tvResendOtpSuccess)).setText(Html.fromHtml(str));
}
public final void showRetryDialog(String str) {
UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper != null) {
utilitiesHelper.showDialog(this, str, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
NativePlusPayActivity.m61showRetryDialog$lambda23(NativePlusPayActivity.this, dialogInterface, i);
}
});
}
}
public static final void m61showRetryDialog$lambda23(NativePlusPayActivity nativePlusPayActivity, DialogInterface dialogInterface, int i) {
Intrinsics.checkNotNullParameter(nativePlusPayActivity, "this$0");
((OtpEditText) nativePlusPayActivity._$_findCachedViewById(R.id.otpEditText)).setText("");
}
private final void submitOtp() {
Map<String, ? extends Object> genericEventParams;
PaytmHelper paytmHelper;
UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper == null || !utilitiesHelper.isNetworkAvailable(this)) {
UtilityHelper utilitiesHelper2 = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper2 != null) {
utilitiesHelper2.showNoInternetDialog(this, new a());
}
enableUiInteraction();
return;
}
PaytmHelper paytmHelper2 = DependencyProvider.getPaytmHelper();
if (paytmHelper2 != null && (genericEventParams = paytmHelper2.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "submit_otp", "init", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper.sendGaEvents(genericEventParams);
}
disableUiInteraction();
NativePlusPayViewModel nativePlusPayViewModel = this.mViewModel;
if (nativePlusPayViewModel == null) {
Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
nativePlusPayViewModel = null;
}
nativePlusPayViewModel.paySecurely(String.valueOf(((OtpEditText) _$_findCachedViewById(R.id.otpEditText)).getText()));
}
public View _$_findCachedViewById(int i) {
Map<Integer, View> map = this._$_findViewCache;
View view = map.get(Integer.valueOf(i));
if (view != null) {
return view;
}
View findViewById = findViewById(i);
if (findViewById == null) {
return null;
}
map.put(Integer.valueOf(i), findViewById);
return findViewById;
}
@Override
public void addPayFragment(Bundle bundle) {
FlowNavigator flowNavigator = DependencyProvider.getFlowNavigator();
if (flowNavigator != null) {
int i = R.id.fragment_container;
FragmentManager supportFragmentManager = getSupportFragmentManager();
Intrinsics.checkNotNullExpressionValue(supportFragmentManager, "supportFragmentManager");
flowNavigator.addPayFragment(i, supportFragmentManager, bundle);
}
}
public void attachBaseContext(Context context) {
super.attachBaseContext(context);
try {
Bf.a.a(this);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void backToCashierPage(Fragment fragment, String str, boolean z) {
UtilityHelper utilitiesHelper;
hidePayOnBankLoader();
if (!z || ((utilitiesHelper = DependencyProvider.getUtilitiesHelper()) != null && utilitiesHelper.isServerSDK())) {
PayUtility.finishSdk(this, null, null, SDKConstants.VALUE_CAP_FAILED, str);
} else {
redirectToPaymentOptions(str);
}
}
@Override
@NotNull
public String getChildClassName() {
String localClassName = getLocalClassName();
Intrinsics.checkNotNullExpressionValue(localClassName, "localClassName");
return localClassName;
}
@NotNull
public final NativeOtpHelper getOtpHelper() {
NativeOtpHelper nativeOtpHelper = this.otpHelper;
if (nativeOtpHelper != null) {
return nativeOtpHelper;
}
Intrinsics.throwUninitializedPropertyAccessException("otpHelper");
return null;
}
public void onBackPressed() {
UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper != null) {
utilitiesHelper.showTwoButtonDialogNew(this, getString(R.string.native_back_press_title), getString(R.string.common_yes), getString(R.string.common_no), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
NativePlusPayActivity.m56onBackPressed$lambda20(NativePlusPayActivity.this, dialogInterface, i);
}
}, new e());
}
}
@Override
public void onClick(View view) {
Map<String, ? extends Object> genericEventParams;
PaytmHelper paytmHelper;
Map<String, ? extends Object> genericEventParams2;
PaytmHelper paytmHelper2;
NativePlusPayViewModel nativePlusPayViewModel = null;
Integer valueOf = view != null ? Integer.valueOf(view.getId()) : null;
int i = R.id.ivBack;
if (valueOf != null && valueOf.intValue() == i) {
onBackPressed();
return;
}
int i2 = R.id.tvGoToBankWebSite;
if (valueOf != null && valueOf.intValue() == i2) {
UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper == null || !utilitiesHelper.isNetworkAvailable(this)) {
UtilityHelper utilitiesHelper2 = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper2 != null) {
utilitiesHelper2.showNoInternetDialog(this, new b());
return;
}
return;
}
PaytmHelper paytmHelper3 = DependencyProvider.getPaytmHelper();
if (paytmHelper3 != null && (genericEventParams2 = paytmHelper3.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "go_to_bank", "init", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper2 = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper2.sendGaEvents(genericEventParams2);
}
payOnBankSite();
return;
}
int i3 = R.id.tvResendOtp;
if (valueOf == null || valueOf.intValue() != i3) {
int i4 = R.id.payButton;
if (valueOf != null && valueOf.intValue() == i4) {
if (((ProgressBar) _$_findCachedViewById(R.id.autoSubmitProgressBar)).getVisibility() == 0) {
((RelativeLayout) _$_findCachedViewById(i4)).setOnClickListener(null);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
((RelativeLayout) NativePlusPayActivity.this._$_findCachedViewById(R.id.payButton)).setOnClickListener(NativePlusPayActivity.this);
}
}, 1000L);
removeAutoSubmitOtpUI();
return;
} else if (isValidOtp(String.valueOf(((OtpEditText) _$_findCachedViewById(R.id.otpEditText)).getText()))) {
submitOtp();
return;
} else {
showOtpValidationError();
return;
}
}
return;
}
UtilityHelper utilitiesHelper3 = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper3 == null || !utilitiesHelper3.isNetworkAvailable(this)) {
UtilityHelper utilitiesHelper4 = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper4 != null) {
utilitiesHelper4.showNoInternetDialog(this, new c());
return;
}
return;
}
PaytmHelper paytmHelper4 = DependencyProvider.getPaytmHelper();
if (paytmHelper4 != null && (genericEventParams = paytmHelper4.getGenericEventParams("", SDKConstants.GA_DIRECT_OTP_ACTION, "resend_otp", "init", SDKConstants.GA_NATIVE_PLUS, "")) != null && (paytmHelper = DependencyProvider.getPaytmHelper()) != null) {
paytmHelper.sendGaEvents(genericEventParams);
}
disableResendButton();
NativePlusPayViewModel nativePlusPayViewModel2 = this.mViewModel;
if (nativePlusPayViewModel2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("mViewModel");
} else {
nativePlusPayViewModel = nativePlusPayViewModel2;
}
nativePlusPayViewModel.resendOtp();
}
@Override
public void onCreate(Bundle bundle) {
Map<String, ? extends Object> genericEventParams;
PaytmHelper paytmHelper;
Serializable serializableExtra;
Serializable serializableExtra2;
Serializable serializableExtra3;
super.onCreate(bundle);
setContentView(R.layout.activity_native_payment);
if (bundle != null) {
Serializable serializable = bundle.getSerializable("processTransactionInfo");
this.processTransactionInfo = serializable instanceof ProcessTransactionInfo ? (ProcessTransactionInfo) serializable : null;
Serializable serializable2 = bundle.getSerializable(SDKConstants.EXTRA_ASSIST_PARAMS);
this.assistParams = serializable2 instanceof PaytmAssistParams ? (PaytmAssistParams) serializable2 : null;
}
Intent intent = getIntent();
if (intent != null && (serializableExtra3 = intent.getSerializableExtra("processTransactionInfo")) != null) {
this.processTransactionInfo = serializableExtra3 instanceof ProcessTransactionInfo ? (ProcessTransactionInfo) serializableExtra3 : null;
}
Intent intent2 = getIntent();
if (intent2 != null && (serializableExtra2 = intent2.getSerializableExtra(SDKConstants.EXTRA_ASSIST_PARAMS)) != null) {
this.assistParams = serializableExtra2 instanceof PaytmAssistParams ? (PaytmAssistParams) serializableExtra2 : null;
}
Intent intent3 = getIntent();
if (intent3 != null && (serializableExtra = intent3.getSerializableExtra(SDKConstants.PAYMENT_INFO)) != null) {
this.paymentInstrument = serializableExtra instanceof PaymentInstrument ? (PaymentInstrument) serializableExtra : null;
}
Application application = getApplication();
Intrinsics.checkNotNullExpressionValue(application, "this.application");
this.mViewModel = new NativePlusPayViewModel(application, this.processTransactionInfo);
addSubmitObservable();
addResendObserable();
addCancelObserable();
initUI();
initOtpHelper();
PaytmHelper paytmHelper2 = DependencyProvider.getPaytmHelper();
if (paytmHelper2 == null || (genericEventParams = paytmHelper2.getGenericEventParams("", SDKConstants.PG_SCREEN_LOADED, "direct_otp", "", "", SDKConstants.GA_NATIVE_PLUS)) == null || (paytmHelper = DependencyProvider.getPaytmHelper()) == null) {
return;
}
paytmHelper.sendGaEvents(genericEventParams);
}
@Override
public void onDestroy() {
super.onDestroy();
AlertDialog alertDialog = this.mAlertDialog;
if (alertDialog != null) {
alertDialog.dismiss();
}
}
public void onSaveInstanceState(@NotNull Bundle bundle) {
Intrinsics.checkNotNullParameter(bundle, "outState");
bundle.putSerializable("processTransactionInfo", this.processTransactionInfo);
bundle.putSerializable(SDKConstants.EXTRA_ASSIST_PARAMS, this.assistParams);
super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
}
public void onStart() {
super.onStart();
getOtpHelper().onStartOtpHelper();
}
public void onStop() {
super.onStop();
getOtpHelper().onStopOtpHelper();
}
@Override
public void onWebPageFinish() {
hidePayOnBankLoader();
this.disableUiInteraction = false;
((FrameLayout) _$_findCachedViewById(R.id.disableClickView)).setClickable(false);
UtilityHelper utilitiesHelper = DependencyProvider.getUtilitiesHelper();
if (utilitiesHelper != null) {
utilitiesHelper.dismissLoadingSheet(this);
}
}
@Override
public void saveActivityFromFinish(String str) {
if (p.h(str, getChildClassName(), true)) {
return;
}
finish();
}
public final void setOtpHelper(@NotNull NativeOtpHelper nativeOtpHelper) {
Intrinsics.checkNotNullParameter(nativeOtpHelper, "<set-?>");
this.otpHelper = nativeOtpHelper;
}
@Override
public boolean shouldKillActivity() {
return true;
}
@Override
public void addPageVisibleGAEvent() {
}
}