正在查看: Rilo v2.0.21 应用的 UPICheckoutActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Rilo v2.0.21 应用的 UPICheckoutActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package app.callpe.ui.payment;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.CookieManager;
import android.webkit.ValueCallback;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
import androidx.activity.result.contract.ActivityResultContracts;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import app.callpe.App;
import app.callpe.common.utils.AppsFlyerAnalyticsHelper;
import app.callpe.common.utils.Helper;
import app.callpe.common.utils.cashfree.CFWebIntentJSInterface;
import app.callpe.common.utils.extensions.ActivityExtKt;
import app.callpe.common.utils.helper_functions.AnalyticsHelper;
import app.callpe.common.utils.helper_functions.DialogHelper;
import app.callpe.common.utils.sharedpref.PrefKeys;
import app.callpe.common.utils.sharedpref.SharedPref;
import app.callpe.data.model.APIError;
import app.callpe.data.model.ErrorHandler;
import app.callpe.data.model.LoginResponse;
import app.callpe.data.model.OrderSuccess;
import app.callpe.data.model.SuccessModel;
import app.callpe.databinding.ActivityCheckoutBinding;
import app.callpe.service.ApiService;
import com.adjust.sdk.AdjustConfig;
import com.adjust.sdk.Constants;
import com.cashfree.pg.api.CFPaymentGatewayService;
import com.cashfree.pg.base.exception.CFException;
import com.cashfree.pg.core.api.CFSession;
import com.cashfree.pg.core.api.callback.CFCheckoutResponseCallback;
import com.cashfree.pg.core.api.utils.CFErrorResponse;
import com.cashfree.pg.ui.api.upi.intent.CFIntentTheme;
import com.cashfree.pg.ui.api.upi.intent.CFUPIIntentCheckout;
import com.cashfree.pg.ui.api.upi.intent.CFUPIIntentCheckoutPayment;
import com.facebook.internal.FacebookRequestErrorClassification;
import com.google.gson.Gson;
import com.razorpay.Checkout;
import com.razorpay.PaymentResultListener;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CancellationException;
import javax.inject.Inject;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.collections.ArraysKt;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
import kotlin.random.Random;
import kotlin.ranges.IntRange;
import kotlin.ranges.RangesKt;
import kotlin.text.StringsKt;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import org.json.JSONObject;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import timber.log.Timber;
@Metadata(d1 = {"\u0000®\u0001\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\b\n\u0002\b\n\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\t\n\u0002\b\u0011\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0013\n\u0002\u0018\u0002\n\u0002\b\f\n\u0002\u0018\u0002\b\u0007\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u00032\u00020\u0004:\u0006\u008f\u0001\u0090\u0001\u0091\u0001B\u0005¢\u0006\u0002\u0010\u0005J\b\u0010M\u001a\u00020NH\u0002J\b\u0010O\u001a\u00020\u0018H\u0002J\u0016\u0010P\u001a\b\u0012\u0004\u0012\u00020R0Q2\u0006\u0010S\u001a\u00020\u0018H\u0016J\u0010\u0010T\u001a\u00020\u00182\u0006\u0010U\u001a\u00020VH\u0016Je\u0010W\u001a\u00020N2\u0006\u0010X\u001a\u00020Y2\b\u0010Z\u001a\u0004\u0018\u00010\u00182\b\u0010[\u001a\u0004\u0018\u00010\u00182\u0006\u0010\\\u001a\u00020\u00182\b\u0010]\u001a\u0004\u0018\u00010\u00182\b\u0010^\u001a\u0004\u0018\u00010\u00182\b\u0010_\u001a\u0004\u0018\u00010Y2\b\u0010`\u001a\u0004\u0018\u00010Y2\n\b\u0002\u0010a\u001a\u0004\u0018\u00010\u0018H\u0002¢\u0006\u0002\u0010bJ$\u0010c\u001a\u00020N2\u0006\u0010d\u001a\u00020 2\b\u0010Z\u001a\u0004\u0018\u00010\u00182\b\u0010[\u001a\u0004\u0018\u00010\u0018H\u0002J\u001a\u0010e\u001a\u00020N2\u0006\u0010f\u001a\u00020\u00182\b\b\u0002\u0010g\u001a\u00020+H\u0003J\b\u0010h\u001a\u00020NH\u0016J\u0012\u0010i\u001a\u00020N2\b\u0010j\u001a\u0004\u0018\u00010kH\u0014J\b\u0010l\u001a\u00020NH\u0014J\b\u0010m\u001a\u00020NH\u0014J\u001a\u0010n\u001a\u00020N2\u0006\u0010o\u001a\u00020 2\b\u0010p\u001a\u0004\u0018\u00010\u0018H\u0016J\u0018\u0010q\u001a\u00020N2\u0006\u0010r\u001a\u00020s2\u0006\u00106\u001a\u00020\u0018H\u0016J\u0012\u0010t\u001a\u00020N2\b\u0010o\u001a\u0004\u0018\u00010\u0018H\u0016J\u0010\u0010u\u001a\u00020N2\u0006\u00106\u001a\u00020\u0018H\u0016J\b\u0010v\u001a\u00020NH\u0014J\u0010\u0010w\u001a\u00020N2\u0006\u0010x\u001a\u00020kH\u0014J\b\u0010y\u001a\u00020NH\u0014J\u0018\u0010z\u001a\u00020N2\u0006\u0010{\u001a\u00020\u00182\u0006\u0010f\u001a\u00020\u0018H\u0016J\u001a\u0010|\u001a\u00020N2\b\u00106\u001a\u0004\u0018\u00010\u00182\u0006\u0010}\u001a\u00020+H\u0002J\b\u0010~\u001a\u00020NH\u0002J\u000f\u0010\u007f\u001a\u00020N2\u0007\u0010\u0080\u0001\u001a\u00020+J\t\u0010\u0081\u0001\u001a\u00020NH\u0002J\t\u0010\u0082\u0001\u001a\u00020NH\u0002J\t\u0010\u0083\u0001\u001a\u00020NH\u0002J\u0012\u0010\u0084\u0001\u001a\u00020N2\u0007\u0010\u0080\u0001\u001a\u00020+H\u0002J\u0011\u0010\u0085\u0001\u001a\u00020N2\b\u0010\u0086\u0001\u001a\u00030\u0087\u0001J6\u0010\u0088\u0001\u001a\u00020N2\u0006\u00106\u001a\u00020\u00182\u0006\u0010d\u001a\u00020 2\b\u0010Z\u001a\u0004\u0018\u00010\u00182\b\u0010[\u001a\u0004\u0018\u00010\u00182\u0007\u0010\u0089\u0001\u001a\u00020\u0018H\u0002J\t\u0010\u008a\u0001\u001a\u00020NH\u0002J\t\u0010\u008b\u0001\u001a\u00020NH\u0002J\u001e\u0010\u008c\u0001\u001a\u00020N2\b\u00106\u001a\u0004\u0018\u00010\u00182\t\b\u0002\u0010\u008d\u0001\u001a\u00020+H\u0002J\u0013\u0010\u008e\u0001\u001a\u00020N2\b\u00106\u001a\u0004\u0018\u00010\u0018H\u0002R\u0010\u0010\u0006\u001a\u0004\u0018\u00010\u0007X\u0082\u000e¢\u0006\u0002\n\u0000R\u001e\u0010\b\u001a\u00020\t8\u0006@\u0006X\u0087.¢\u0006\u000e\n\u0000\u001a\u0004\b\n\u0010\u000b\"\u0004\b\f\u0010\rR\u0014\u0010\u000e\u001a\u00020\u00078BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u000f\u0010\u0010R\u000e\u0010\u0011\u001a\u00020\u0012X\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010\u0013\u001a\u0010\u0012\f\u0012\n \u0016*\u0004\u0018\u00010\u00150\u00150\u0014X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0017\u001a\u00020\u0018X\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u0019\u001a\u0004\u0018\u00010\u001aX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001b\u0010\u001c\"\u0004\b\u001d\u0010\u001eR\u001a\u0010\u001f\u001a\u00020 X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b!\u0010\"\"\u0004\b#\u0010$R\u001c\u0010%\u001a\u0004\u0018\u00010\u0018X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b&\u0010'\"\u0004\b(\u0010)R\u001a\u0010*\u001a\u00020+X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b*\u0010,\"\u0004\b-\u0010.R\u001c\u0010/\u001a\u0004\u0018\u000100X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b1\u00102\"\u0004\b3\u00104R\u001c\u00105\u001a\u0010\u0012\f\u0012\n \u0016*\u0004\u0018\u00010\u00150\u00150\u0014X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u00106\u001a\u00020\u0018X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b7\u0010'\"\u0004\b8\u0010)R\u001a\u00109\u001a\u00020+X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b:\u0010,\"\u0004\b;\u0010.R\u000e\u0010<\u001a\u00020=X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010>\u001a\u00020\u0018X\u0082\u0004¢\u0006\u0002\n\u0000R\u0011\u0010?\u001a\u00020@¢\u0006\b\n\u0000\u001a\u0004\bA\u0010BR\u001c\u0010C\u001a\u0004\u0018\u00010\u0018X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bD\u0010'\"\u0004\bE\u0010)R\u001a\u0010F\u001a\u00020\u0018X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bG\u0010'\"\u0004\bH\u0010)R$\u0010I\u001a\u00020\u00188\u0006@\u0006X\u0087.¢\u0006\u0014\n\u0000\u0012\u0004\bJ\u0010\u0005\u001a\u0004\bK\u0010'\"\u0004\bL\u0010)¨\u0006\u0092\u0001²\u0006\f\u0010\u0093\u0001\u001a\u00030\u0094\u0001X\u008a\u0084\u0002"}, d2 = {"Lapp/callpe/ui/payment/UPICheckoutActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "Lcom/razorpay/PaymentResultListener;", "Lcom/cashfree/pg/core/api/callback/CFCheckoutResponseCallback;", "Lapp/callpe/common/utils/cashfree/CFWebIntentJSInterface$CFWebIntentInterface;", "()V", "_binding", "Lapp/callpe/databinding/ActivityCheckoutBinding;", "apiService", "Lapp/callpe/service/ApiService;", "getApiService", "()Lapp/callpe/service/ApiService;", "setApiService", "(Lapp/callpe/service/ApiService;)V", "binding", "getBinding", "()Lapp/callpe/databinding/ActivityCheckoutBinding;", "broadcastReceiver", "Landroid/content/BroadcastReceiver;", "cashFreeUpiAppLauncher", "Landroidx/activity/result/ActivityResultLauncher;", "Landroid/content/Intent;", "kotlin.jvm.PlatformType", "cfEnvironment", "", "co", "Lcom/razorpay/Checkout;", "getCo", "()Lcom/razorpay/Checkout;", "setCo", "(Lcom/razorpay/Checkout;)V", "count", "", "getCount", "()I", "setCount", "(I)V", "failUrl", "getFailUrl", "()Ljava/lang/String;", "setFailUrl", "(Ljava/lang/String;)V", "isScreenVisible", "", "()Z", "setScreenVisible", "(Z)V", "job", "Lkotlinx/coroutines/Job;", "getJob", "()Lkotlinx/coroutines/Job;", "setJob", "(Lkotlinx/coroutines/Job;)V", "launcher", "orderID", "getOrderID", "setOrderID", "paymentSuccessful", "getPaymentSuccessful", "setPaymentSuccessful", "paymentWebView", "Landroid/webkit/WebView;", "razorPayKey", "scope", "Lkotlinx/coroutines/CoroutineScope;", "getScope", "()Lkotlinx/coroutines/CoroutineScope;", "successUrl", "getSuccessUrl", "setSuccessUrl", "token", "getToken", "setToken", "userId", "getUserId$annotations", "getUserId", "setUserId", "checkPaymentSuccessStatus", "", "generateMobileNumber", "getAppList", "", "Landroid/content/pm/ResolveInfo;", "link", "getAppName", "pkg", "Landroid/content/pm/ApplicationInfo;", "getOrderResponse", "topUpId", "", "mobile", FacebookRequestErrorClassification.KEY_NAME, "paymentMethod", "appPackageName", "appName", "upiPgId", "couponCode", "currency", "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/Long;Ljava/lang/String;)V", "getOrderWithAmountResponse", "amount", "loadPaymentUrl", "url", "isCashfreeUrl", "onBackPressed", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onPause", "onPaymentError", "p0", "p1", "onPaymentFailure", "cfErrorResponse", "Lcom/cashfree/pg/core/api/utils/CFErrorResponse;", "onPaymentSuccess", "onPaymentVerify", "onResume", "onSaveInstanceState", "outState", "onStart", "openApp", "appPkg", "orderFiledResponse", "failed", "registerReceiver", "setProgress", "isVisible", "showFailedInfo", "showInfoMessage", "showSuccessInfo", "showVerifyingLoader", "startCashFreeFlow", "order", "Lapp/callpe/data/model/OrderSuccess;", "startPayment", "razorPayClientKey", "stopUpdate", "unRegisterReceiver", "verifyOrderResponse", "isFailed", "verifyPayment", "AppSource", "PAYMENT_STATUS", "WebClient", "app_riloRelease", "cfWebIntentJSInterface", "Lapp/callpe/common/utils/cashfree/CFWebIntentJSInterface;"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class UPICheckoutActivity extends Hilt_UPICheckoutActivity implements PaymentResultListener, CFCheckoutResponseCallback, CFWebIntentJSInterface.CFWebIntentInterface {
private ActivityCheckoutBinding _binding;
@Inject
public ApiService apiService;
private final BroadcastReceiver broadcastReceiver;
private final ActivityResultLauncher<Intent> cashFreeUpiAppLauncher;
private String cfEnvironment;
private Checkout co;
private int count;
private String failUrl;
private boolean isScreenVisible;
private Job job;
private ActivityResultLauncher<Intent> launcher;
private boolean paymentSuccessful;
private WebView paymentWebView;
private final String razorPayKey;
private String successUrl;
@Inject
public String userId;
private String orderID = "";
private String token = "TOKEN";
private final CoroutineScope scope = CoroutineScopeKt.MainScope();
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\u0003\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003¨\u0006\u0004"}, d2 = {"Lapp/callpe/ui/payment/UPICheckoutActivity$AppSource;", "", "(Ljava/lang/String;I)V", "CASHFREE", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum AppSource {
CASHFREE
}
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0010\u0010\n\u0002\b\f\b\u0086\u0001\u0018\u00002\b\u0012\u0004\u0012\u00020\u00000\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002j\u0002\b\u0003j\u0002\b\u0004j\u0002\b\u0005j\u0002\b\u0006j\u0002\b\u0007j\u0002\b\bj\u0002\b\tj\u0002\b\nj\u0002\b\u000bj\u0002\b\f¨\u0006\r"}, d2 = {"Lapp/callpe/ui/payment/UPICheckoutActivity$PAYMENT_STATUS;", "", "(Ljava/lang/String;I)V", "PENDING", "SUCCESS", "FAILED", "CANCELLED", "USER_DROPPED", "PAYMENT_SUCCESSFUL", "PAYMENT_CANCELLED", "REFUND_INITIATED", "REFUND_SUCCESSFUL", "REFUND_FAILED", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public enum PAYMENT_STATUS {
PENDING,
SUCCESS,
FAILED,
CANCELLED,
USER_DROPPED,
PAYMENT_SUCCESSFUL,
PAYMENT_CANCELLED,
REFUND_INITIATED,
REFUND_SUCCESSFUL,
REFUND_FAILED
}
public static final void cashFreeUpiAppLauncher$lambda$2$lambda$1(String str) {
}
public static void getUserId$annotations() {
}
public UPICheckoutActivity() {
ActivityResultLauncher<Intent> registerForActivityResult = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
UPICheckoutActivity.launcher$lambda$0(UPICheckoutActivity.this, (ActivityResult) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul…ifyPayment(orderID)\n }");
this.launcher = registerForActivityResult;
ActivityResultLauncher<Intent> registerForActivityResult2 = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
UPICheckoutActivity.cashFreeUpiAppLauncher$lambda$2(UPICheckoutActivity.this, (ActivityResult) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult2, "registerForActivityResul…UI()\") {}\n }\n }");
this.cashFreeUpiAppLauncher = registerForActivityResult2;
this.razorPayKey = App.isDevelopmentEnv ? "rzp_test_ApIMAPGOXAOV1t" : "rzp_live_630HGEprosYm48";
this.cfEnvironment = "";
this.broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(intent, "intent");
Timber.e("Action %s", new Object[]{intent.getAction()});
String action = intent.getAction();
if (action != null && action.hashCode() == 1614559365 && action.equals(PaymentDetailsActivity.PAYMENT_SUCCESS_EVENT)) {
if (UPICheckoutActivity.this.getIsScreenVisible()) {
WebView webView = UPICheckoutActivity.this.paymentWebView;
if (webView == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView = null;
}
webView.setVisibility(8);
UPICheckoutActivity.this.showVerifyingLoader(true);
UPICheckoutActivity uPICheckoutActivity = UPICheckoutActivity.this;
uPICheckoutActivity.verifyPayment(uPICheckoutActivity.getOrderID());
return;
}
UPICheckoutActivity.this.setPaymentSuccessful(true);
}
}
};
}
public final String getOrderID() {
return this.orderID;
}
public final void setOrderID(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.orderID = str;
}
public final String getToken() {
return this.token;
}
public final void setToken(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.token = str;
}
public final CoroutineScope getScope() {
return this.scope;
}
public final Job getJob() {
return this.job;
}
public final void setJob(Job job) {
this.job = job;
}
public final int getCount() {
return this.count;
}
public final void setCount(int i) {
this.count = i;
}
public final String getSuccessUrl() {
return this.successUrl;
}
public final void setSuccessUrl(String str) {
this.successUrl = str;
}
public final String getFailUrl() {
return this.failUrl;
}
public final void setFailUrl(String str) {
this.failUrl = str;
}
public final String getUserId() {
String str = this.userId;
if (str != null) {
return str;
}
Intrinsics.throwUninitializedPropertyAccessException("userId");
return null;
}
public final void setUserId(String str) {
Intrinsics.checkNotNullParameter(str, "<set-?>");
this.userId = str;
}
public final ActivityCheckoutBinding getBinding() {
ActivityCheckoutBinding activityCheckoutBinding = this._binding;
Intrinsics.checkNotNull(activityCheckoutBinding);
return activityCheckoutBinding;
}
public final ApiService getApiService() {
ApiService apiService = this.apiService;
if (apiService != null) {
return apiService;
}
Intrinsics.throwUninitializedPropertyAccessException("apiService");
return null;
}
public final void setApiService(ApiService apiService) {
Intrinsics.checkNotNullParameter(apiService, "<set-?>");
this.apiService = apiService;
}
public static final void launcher$lambda$0(UPICheckoutActivity uPICheckoutActivity, ActivityResult activityResult) {
Intrinsics.checkNotNullParameter(uPICheckoutActivity, "this$0");
Intrinsics.checkNotNullParameter(activityResult, "result");
Intent data = activityResult.getData();
Bundle extras = data != null ? data.getExtras() : null;
if (extras != null) {
for (String str : extras.keySet()) {
Timber.e("IntentData " + str + ": " + extras.get(str), new Object[0]);
}
}
uPICheckoutActivity.showVerifyingLoader(true);
uPICheckoutActivity.verifyPayment(uPICheckoutActivity.orderID);
}
public static final void cashFreeUpiAppLauncher$lambda$2(UPICheckoutActivity uPICheckoutActivity, ActivityResult activityResult) {
Intrinsics.checkNotNullParameter(uPICheckoutActivity, "this$0");
Intent data = activityResult.getData();
WebView webView = null;
Timber.d("CASH_FREE: bundle= " + (data != null ? data.getExtras() : null) + ", ::::::: resultCode= " + activityResult.getResultCode(), new Object[0]);
if (activityResult.getResultCode() == -1 || activityResult.getResultCode() == 0) {
Timber.d("CASH_FREE: result received!", new Object[0]);
WebView webView2 = uPICheckoutActivity.paymentWebView;
if (webView2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
} else {
webView = webView2;
}
webView.evaluateJavascript("window.showVerifyUI()", new ValueCallback() {
@Override
public final void onReceiveValue(Object obj) {
UPICheckoutActivity.cashFreeUpiAppLauncher$lambda$2$lambda$1((String) obj);
}
});
}
}
public final Checkout getCo() {
return this.co;
}
public final void setCo(Checkout checkout) {
this.co = checkout;
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this._binding = ActivityCheckoutBinding.inflate(getLayoutInflater());
setContentView(getBinding().getRoot());
WebView webView = getBinding().webView;
Intrinsics.checkNotNullExpressionValue(webView, "binding.webView");
this.paymentWebView = webView;
Checkout.preload(getApplicationContext());
long longExtra = getIntent().getLongExtra("topUpId", -1L);
Long valueOf = Long.valueOf(getIntent().getLongExtra("upiPgId", -1L));
Long l = valueOf.longValue() == -1 ? null : valueOf;
String stringExtra = getIntent().getStringExtra("paymentMethod");
if (stringExtra == null) {
stringExtra = "UPI";
}
String str = stringExtra;
String stringExtra2 = getIntent().getStringExtra("packageName");
String stringExtra3 = getIntent().getStringExtra("appName");
String stringExtra4 = getIntent().getStringExtra("currency");
int intExtra = getIntent().getIntExtra("amount", 0);
Context context = (Context) this;
AnalyticsHelper.INSTANCE.sendScreenOpenEvent(context);
AppsFlyerAnalyticsHelper.sendScreenOpenEvent(context);
String string = SharedPref.getString(context, PrefKeys.INSTALL_SOURCE);
String str2 = string;
if (!(str2 == null || str2.length() == 0)) {
Intrinsics.checkNotNullExpressionValue(string, "installSource");
String lowerCase = string.toLowerCase(Locale.ROOT);
Intrinsics.checkNotNullExpressionValue(lowerCase, "this as java.lang.String).toLowerCase(Locale.ROOT)");
if (StringsKt.contains$default(lowerCase, Constants.REFERRER_API_GOOGLE, false, 2, (Object) null)) {
AnalyticsHelper.INSTANCE.sendScreenOpenEventGoogle(context);
}
}
Long valueOf2 = Long.valueOf(getIntent().getLongExtra("couponCode", -1L));
Long l2 = valueOf2.longValue() == -1 ? null : valueOf2;
String string2 = savedInstanceState != null ? savedInstanceState.getString("orderID") : null;
this.orderID = string2 == null ? "" : string2;
String str3 = string2;
if (!(str3 == null || str3.length() == 0)) {
showVerifyingLoader(true);
verifyPayment(string2);
return;
}
if (longExtra != -1) {
try {
CFPaymentGatewayService.getInstance().setCheckoutCallback(this);
} catch (CFException e) {
e.printStackTrace();
}
LoginResponse loginResponse = (LoginResponse) new Gson().fromJson(SharedPref.getString(context, PrefKeys.LOGIN_RESPONSE), LoginResponse.class);
if (loginResponse != null) {
getOrderResponse(longExtra, loginResponse.getMobile(), loginResponse.getName(), str, stringExtra2, stringExtra3, l, l2, stringExtra4);
return;
}
return;
}
if (intExtra > 0) {
LoginResponse loginResponse2 = (LoginResponse) new Gson().fromJson(SharedPref.getString(context, PrefKeys.LOGIN_RESPONSE), LoginResponse.class);
if (loginResponse2 != null) {
getOrderWithAmountResponse(intExtra, loginResponse2.getMobile(), loginResponse2.getName());
return;
}
return;
}
finish();
}
protected void onSaveInstanceState(Bundle outState) {
Intrinsics.checkNotNullParameter(outState, "outState");
super.onSaveInstanceState(outState);
if (this.orderID.length() > 0) {
outState.putString("orderID", this.orderID);
}
}
public final void startPayment(String orderID, int amount, String mobile, String name, String razorPayClientKey) {
Checkout checkout = new Checkout();
this.co = checkout;
checkout.setKeyID(razorPayClientKey);
Activity activity = (Activity) this;
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put(FacebookRequestErrorClassification.KEY_NAME, getString(2131951675));
jSONObject.put("image", getString(2131951673));
jSONObject.put("theme.color", "#3399cc");
jSONObject.put("currency", "INR");
jSONObject.put("order_id", orderID);
jSONObject.put("amount", amount);
JSONObject jSONObject2 = new JSONObject();
String str = mobile;
if (str == null || str.length() == 0) {
jSONObject2.put("contact", generateMobileNumber());
} else {
jSONObject2.put("contact", mobile);
}
jSONObject2.put(FacebookRequestErrorClassification.KEY_NAME, name);
jSONObject.put("prefill", jSONObject2);
Checkout checkout2 = this.co;
if (checkout2 != null) {
checkout2.open(activity, jSONObject);
}
} catch (Exception e) {
Toast.makeText(activity, "Error in payment: " + e.getMessage(), 1).show();
e.printStackTrace();
}
}
private final String generateMobileNumber() {
String str = (String) ArraysKt.random(new String[]{"6", "7", "8", "9"}, Random.Default);
StringBuilder sb = new StringBuilder();
sb.append(RangesKt.random(new IntRange(0, 9), Random.Default));
sb.append(RangesKt.random(new IntRange(0, 9), Random.Default));
sb.append(RangesKt.random(new IntRange(0, 9), Random.Default));
sb.append(RangesKt.random(new IntRange(0, 9), Random.Default));
sb.append(RangesKt.random(new IntRange(0, 9), Random.Default));
sb.append(RangesKt.random(new IntRange(0, 9), Random.Default));
sb.append(RangesKt.random(new IntRange(0, 9), Random.Default));
sb.append(RangesKt.random(new IntRange(0, 9), Random.Default));
sb.append(RangesKt.random(new IntRange(0, 9), Random.Default));
return str + sb.toString();
}
public final void startCashFreeFlow(OrderSuccess order) {
String str;
CFSession.Environment environment;
Intrinsics.checkNotNullParameter(order, "order");
try {
String environment2 = order.getEnvironment();
if (environment2 != null) {
str = environment2.toLowerCase(Locale.ROOT);
Intrinsics.checkNotNullExpressionValue(str, "this as java.lang.String).toLowerCase(Locale.ROOT)");
} else {
str = null;
}
if (AdjustConfig.ENVIRONMENT_PRODUCTION.equals(str)) {
environment = CFSession.Environment.PRODUCTION;
} else {
environment = CFSession.Environment.SANDBOX;
}
Log.d("onCashfreePayment", "Environment : " + environment);
CFSession build = new CFSession.CFSessionBuilder().setEnvironment(environment).setPaymentSessionID(String.valueOf(order.getExtPgId2())).setOrderId(order.getOrderId()).build();
Timber.e("response %s", new Object[]{order.getExtPgId2() + " and " + order.getOrderId()});
Log.d("onCashfreePayment", "ExtPfId : " + order.getExtPgId2() + " and " + order.getOrderId());
CFPaymentGatewayService.getInstance().doPayment((Context) this, new CFUPIIntentCheckoutPayment.CFUPIIntentPaymentBuilder().setSession(build).setCfUPIIntentCheckout(new CFUPIIntentCheckout.CFUPIIntentBuilder().build()).setCfIntentTheme(new CFIntentTheme.CFIntentThemeBuilder().setPrimaryTextColor("#000000").setBackgroundColor("#FFFFFF").build()).build());
} catch (CFException e) {
Timber.e("response %s", new Object[]{e.getLocalizedMessage()});
e.printStackTrace();
}
}
public void onPaymentError(int p0, String p1) {
Timber.e("onPaymentError " + p0 + " , " + p1, new Object[0]);
verifyOrderResponse(this.orderID, true);
}
public void onPaymentSuccess(String p0) {
Timber.e("onPaymentSuccess " + p0, new Object[0]);
showVerifyingLoader(true);
verifyPayment(this.orderID);
}
public void onPaymentVerify(String orderID) {
Intrinsics.checkNotNullParameter(orderID, "orderID");
Timber.e("onPaymentVerify verifyPayment triggered", new Object[0]);
showVerifyingLoader(true);
verifyPayment(orderID);
}
public void onPaymentFailure(CFErrorResponse cfErrorResponse, String orderID) {
Intrinsics.checkNotNullParameter(cfErrorResponse, "cfErrorResponse");
Intrinsics.checkNotNullParameter(orderID, "orderID");
Timber.e("onPaymentFailure " + orderID + " " + cfErrorResponse.getMessage(), new Object[0]);
Log.d("onCashfreePayment", "Res : " + orderID + ' ' + cfErrorResponse.getMessage());
verifyOrderResponse(orderID, true);
}
public final void showFailedInfo() {
showVerifyingLoader(false);
View view = getBinding().paymentStatusParent;
Intrinsics.checkNotNullExpressionValue(view, "binding.paymentStatusParent");
view.setVisibility(0);
getBinding().failed.setVisibility(0);
getBinding().success.setVisibility(4);
getBinding().paymentStatusMessage.setText(getString(2131952973));
stopUpdate();
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new UPICheckoutActivity$showFailedInfo$1(this, null), 3, (Object) null);
}
public final void showSuccessInfo() {
showVerifyingLoader(false);
View view = getBinding().paymentStatusParent;
Intrinsics.checkNotNullExpressionValue(view, "binding.paymentStatusParent");
view.setVisibility(0);
getBinding().failed.setVisibility(4);
getBinding().success.setVisibility(0);
getBinding().paymentStatusMessage.setText(getString(2131952974));
stopUpdate();
setResult(-1);
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new UPICheckoutActivity$showSuccessInfo$1(this, null), 3, (Object) null);
}
public final void showInfoMessage() {
showVerifyingLoader(false);
View view = getBinding().paymentStatusParent;
Intrinsics.checkNotNullExpressionValue(view, "binding.paymentStatusParent");
view.setVisibility(8);
View view2 = getBinding().paymentWaitingParent;
Intrinsics.checkNotNullExpressionValue(view2, "binding.paymentWaitingParent");
view2.setVisibility(0);
getBinding().goBack.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view3) {
UPICheckoutActivity.showInfoMessage$lambda$3(UPICheckoutActivity.this, view3);
}
});
stopUpdate();
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new UPICheckoutActivity$showInfoMessage$2(this, null), 3, (Object) null);
}
public static final void showInfoMessage$lambda$3(UPICheckoutActivity uPICheckoutActivity, View view) {
Intrinsics.checkNotNullParameter(uPICheckoutActivity, "this$0");
uPICheckoutActivity.stopUpdate();
uPICheckoutActivity.finish();
}
public final void verifyPayment(String orderID) {
stopUpdate();
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new UPICheckoutActivity$verifyPayment$1(this, orderID, null), 3, (Object) null);
}
private final void stopUpdate() {
Job job = this.job;
if (job != null) {
Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
}
this.job = null;
}
public final void getOrderResponse(long topUpId, final String mobile, final String name, String paymentMethod, final String appPackageName, String appName, Long upiPgId, Long couponCode, String currency) {
setProgress(true);
ApiService.DefaultImpls.createOrderV2$default(getApiService(), topUpId, paymentMethod, null, appName, appPackageName, upiPgId, couponCode, currency, 4, null).enqueue(new Callback<OrderSuccess>() {
public void onResponse(retrofit2.Call<app.callpe.data.model.OrderSuccess> r11, retrofit2.Response<app.callpe.data.model.OrderSuccess> r12) {
throw new UnsupportedOperationException("Method not decompiled: app.callpe.ui.payment.UPICheckoutActivity$getOrderResponse$1.onResponse(retrofit2.Call, retrofit2.Response):void");
}
public void onFailure(Call<OrderSuccess> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
UPICheckoutActivity.this.setProgress(false);
Timber.e("onFailure: " + t.getCause(), new Object[0]);
Helper.noNetworkToast((Context) UPICheckoutActivity.this, t);
}
});
}
private final void getOrderWithAmountResponse(int amount, final String mobile, final String name) {
setProgress(true);
getApiService().createOrderByAmount(amount).enqueue(new Callback<OrderSuccess>() {
public void onResponse(Call<OrderSuccess> call, Response<OrderSuccess> response) {
String str;
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
UPICheckoutActivity.this.setProgress(false);
try {
Timber.e("response %s", new Object[]{response.raw()});
if (response.isSuccessful()) {
if (response.body() != null) {
UPICheckoutActivity uPICheckoutActivity = UPICheckoutActivity.this;
OrderSuccess orderSuccess = (OrderSuccess) response.body();
if (orderSuccess == null || (str = orderSuccess.getOrderId()) == null) {
str = "";
}
uPICheckoutActivity.setOrderID(str);
OrderSuccess orderSuccess2 = (OrderSuccess) response.body();
if (orderSuccess2 != null) {
UPICheckoutActivity uPICheckoutActivity2 = UPICheckoutActivity.this;
String str2 = mobile;
String str3 = name;
String orderID = uPICheckoutActivity2.getOrderID();
int amount2 = orderSuccess2.getAmount();
String razorPayClientKey = orderSuccess2.getRazorPayClientKey();
if (razorPayClientKey == null) {
razorPayClientKey = uPICheckoutActivity2.razorPayKey;
}
uPICheckoutActivity2.startPayment(orderID, amount2, str2, str3, razorPayClientKey);
return;
}
return;
}
return;
}
try {
APIError parseError = ErrorHandler.parseError(response);
Intrinsics.checkNotNullExpressionValue(parseError, "parseError(response)");
Toast.makeText((Context) UPICheckoutActivity.this, UPICheckoutActivity.this.getString(2131952996) + ": " + parseError.getReason(), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception unused) {
Toast.makeText((Context) UPICheckoutActivity.this, "Error", 0).show();
}
}
public void onFailure(Call<OrderSuccess> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
UPICheckoutActivity.this.setProgress(false);
Timber.e("onFailure: " + t.getCause(), new Object[0]);
Helper.noNetworkToast((Context) UPICheckoutActivity.this, t);
}
});
}
static void verifyOrderResponse$default(UPICheckoutActivity uPICheckoutActivity, String str, boolean z, int i, Object obj) {
if ((i & 2) != 0) {
z = false;
}
uPICheckoutActivity.verifyOrderResponse(str, z);
}
private final void verifyOrderResponse(final String orderID, final boolean isFailed) {
int i = this.count + 1;
this.count = i;
if (i == 15) {
orderFiledResponse(orderID, false);
} else {
getApiService().verifyPaymentStatus(orderID, getUserId()).enqueue(new Callback<SuccessModel>() {
public void onResponse(Call<SuccessModel> call, Response<SuccessModel> response) {
SuccessModel successModel;
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
try {
Timber.e("response %s", new Object[]{response.raw()});
if (response.isSuccessful()) {
if (response.body() != null && (successModel = (SuccessModel) response.body()) != null) {
boolean z = isFailed;
UPICheckoutActivity uPICheckoutActivity = UPICheckoutActivity.this;
String str = orderID;
String paymentStatus = successModel.getPaymentStatus();
if (paymentStatus != null) {
Timber.e("payment success " + paymentStatus, new Object[0]);
if (z) {
switch (paymentStatus.hashCode()) {
case -1872451388:
if (!paymentStatus.equals("REFUND_INITIATED")) {
break;
}
uPICheckoutActivity.orderFiledResponse(str, true);
break;
case -1031784143:
if (!paymentStatus.equals("CANCELLED")) {
break;
}
uPICheckoutActivity.orderFiledResponse(str, true);
break;
case 35394935:
if (!paymentStatus.equals("PENDING")) {
break;
} else {
uPICheckoutActivity.orderFiledResponse(str, true);
break;
}
case 478592449:
if (!paymentStatus.equals("REFUND_SUCCESSFUL")) {
break;
}
uPICheckoutActivity.orderFiledResponse(str, true);
break;
case 755522276:
if (!paymentStatus.equals("REFUND_FAILED")) {
break;
}
uPICheckoutActivity.orderFiledResponse(str, true);
break;
case 2066319421:
if (!paymentStatus.equals("FAILED")) {
break;
}
uPICheckoutActivity.orderFiledResponse(str, true);
break;
}
} else {
switch (paymentStatus.hashCode()) {
case -1872451388:
if (!paymentStatus.equals("REFUND_INITIATED")) {
break;
}
uPICheckoutActivity.showFailedInfo();
break;
case -1149187101:
if (!paymentStatus.equals("SUCCESS")) {
break;
} else {
AnalyticsHelper.sendSuccessEvent$default(AnalyticsHelper.INSTANCE, (Context) uPICheckoutActivity, false, 0.0d, 6, null);
uPICheckoutActivity.showSuccessInfo();
break;
}
case -1031784143:
if (!paymentStatus.equals("CANCELLED")) {
break;
}
uPICheckoutActivity.showFailedInfo();
break;
case 478592449:
if (!paymentStatus.equals("REFUND_SUCCESSFUL")) {
break;
}
uPICheckoutActivity.showFailedInfo();
break;
case 755522276:
if (!paymentStatus.equals("REFUND_FAILED")) {
break;
}
uPICheckoutActivity.showFailedInfo();
break;
case 1409057580:
if (!paymentStatus.equals("USER_DROPPED")) {
break;
}
uPICheckoutActivity.showFailedInfo();
break;
case 2066319421:
if (!paymentStatus.equals("FAILED")) {
break;
}
uPICheckoutActivity.showFailedInfo();
break;
}
}
}
}
} else {
try {
APIError parseError = ErrorHandler.parseError(response);
Intrinsics.checkNotNullExpressionValue(parseError, "parseError(response)");
Toast.makeText((Context) UPICheckoutActivity.this, UPICheckoutActivity.this.getString(2131952996) + ": " + parseError.getReason(), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception unused) {
Toast.makeText((Context) UPICheckoutActivity.this, "Error", 0).show();
}
}
public void onFailure(Call<SuccessModel> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Timber.e("onFailure: " + t.getCause(), new Object[0]);
Helper.noNetworkToast((Context) UPICheckoutActivity.this, t);
}
});
}
}
public final void orderFiledResponse(final String orderID, boolean failed) {
if (failed) {
getApiService().orderFiledResponse(orderID).enqueue(new Callback<SuccessModel>() {
public void onResponse(Call<SuccessModel> call, Response<SuccessModel> response) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
try {
Timber.e("response %s", new Object[]{response.raw()});
if (response.isSuccessful()) {
if (response.body() != null) {
SuccessModel successModel = (SuccessModel) response.body();
String message = successModel != null ? successModel.getMessage() : null;
Timber.e("status message " + message, new Object[0]);
if (Intrinsics.areEqual(message, "PAYMENT_SUCCESSFUL")) {
UPICheckoutActivity.this.showSuccessInfo();
return;
} else if (Intrinsics.areEqual(message, "PAYMENT_CANCELLED")) {
UPICheckoutActivity.this.showFailedInfo();
return;
} else {
UPICheckoutActivity uPICheckoutActivity = UPICheckoutActivity.this;
uPICheckoutActivity.setJob(BuildersKt.launch$default(uPICheckoutActivity.getScope(), (CoroutineContext) null, (CoroutineStart) null, new UPICheckoutActivity$orderFiledResponse$1$onResponse$1(UPICheckoutActivity.this, null), 3, (Object) null));
return;
}
}
return;
}
try {
UPICheckoutActivity uPICheckoutActivity2 = UPICheckoutActivity.this;
uPICheckoutActivity2.setJob(BuildersKt.launch$default(uPICheckoutActivity2.getScope(), (CoroutineContext) null, (CoroutineStart) null, new UPICheckoutActivity$orderFiledResponse$1$onResponse$2(UPICheckoutActivity.this, null), 3, (Object) null));
APIError parseError = ErrorHandler.parseError(response);
Intrinsics.checkNotNullExpressionValue(parseError, "parseError(response)");
Toast.makeText((Context) UPICheckoutActivity.this, UPICheckoutActivity.this.getString(2131952996) + ": " + parseError.getReason(), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception unused) {
Toast.makeText((Context) UPICheckoutActivity.this, "Error", 0).show();
}
}
public void onFailure(Call<SuccessModel> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Timber.e("onFailure: " + t.getCause(), new Object[0]);
Helper.noNetworkToast((Context) UPICheckoutActivity.this, t);
UPICheckoutActivity uPICheckoutActivity = UPICheckoutActivity.this;
uPICheckoutActivity.setJob(BuildersKt.launch$default(uPICheckoutActivity.getScope(), (CoroutineContext) null, (CoroutineStart) null, new UPICheckoutActivity$orderFiledResponse$1$onFailure$1(UPICheckoutActivity.this, null), 3, (Object) null));
}
});
} else {
getApiService().verifyPaymentStatus(orderID, getUserId()).enqueue(new Callback<SuccessModel>() {
public void onResponse(Call<SuccessModel> call, Response<SuccessModel> response) {
SuccessModel successModel;
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
try {
Timber.e("response %s", new Object[]{response.raw()});
if (response.isSuccessful()) {
if (response.body() != null && (successModel = (SuccessModel) response.body()) != null) {
UPICheckoutActivity uPICheckoutActivity = UPICheckoutActivity.this;
String str = orderID;
String paymentStatus = successModel.getPaymentStatus();
if (paymentStatus != null) {
Timber.e("payment success " + paymentStatus, new Object[0]);
if (Intrinsics.areEqual(paymentStatus, "PENDING")) {
uPICheckoutActivity.showInfoMessage();
} else {
uPICheckoutActivity.orderFiledResponse(str, true);
}
}
}
} else {
try {
APIError parseError = ErrorHandler.parseError(response);
Intrinsics.checkNotNullExpressionValue(parseError, "parseError(response)");
Toast.makeText((Context) UPICheckoutActivity.this, UPICheckoutActivity.this.getString(2131952996) + ": " + parseError.getReason(), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception unused) {
Toast.makeText((Context) UPICheckoutActivity.this, "Error", 0).show();
}
}
public void onFailure(Call<SuccessModel> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Timber.e("onFailure: " + t.getCause(), new Object[0]);
Helper.noNetworkToast((Context) UPICheckoutActivity.this, t);
}
});
}
}
public final void showVerifyingLoader(boolean isVisible) {
View view = getBinding().paymentVerificationProgress;
Intrinsics.checkNotNullExpressionValue(view, "binding.paymentVerificationProgress");
view.setVisibility(isVisible ? 0 : 8);
}
public final void setProgress(boolean isVisible) {
View view = getBinding().outerProgress;
Intrinsics.checkNotNullExpressionValue(view, "binding.outerProgress");
view.setVisibility(isVisible ? 0 : 8);
}
static void loadPaymentUrl$default(UPICheckoutActivity uPICheckoutActivity, String str, boolean z, int i, Object obj) {
if ((i & 2) != 0) {
z = false;
}
uPICheckoutActivity.loadPaymentUrl(str, z);
}
public final void loadPaymentUrl(String url, boolean isCashfreeUrl) {
Timber.d("PAYMENT_URL: " + url, new Object[0]);
Lazy lazy = LazyKt.lazy(new Function0<CFWebIntentJSInterface>() {
{
super(0);
}
public final CFWebIntentJSInterface m2161invoke() {
return new CFWebIntentJSInterface(UPICheckoutActivity.this);
}
});
WebView webView = this.paymentWebView;
WebView webView2 = null;
if (webView == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView = null;
}
webView.setVisibility(0);
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);
settings.setDomStorageEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NORMAL);
if (isCashfreeUrl) {
webView.addJavascriptInterface(loadPaymentUrl$lambda$4(lazy), "Android");
}
webView.setWebViewClient(new WebClient());
WebView webView3 = this.paymentWebView;
if (webView3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView3 = null;
}
WebSettings settings2 = webView3.getSettings();
Intrinsics.checkNotNullExpressionValue(settings2, "paymentWebView.settings");
CookieManager cookieManager = CookieManager.getInstance();
WebView webView4 = this.paymentWebView;
if (webView4 == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView4 = null;
}
cookieManager.setAcceptThirdPartyCookies(webView4, true);
String chromeUserAgent = Helper.INSTANCE.getChromeUserAgent((Context) this);
settings2.setUserAgentString(chromeUserAgent);
Timber.d("USER_AGENT: " + chromeUserAgent, new Object[0]);
WebView webView5 = this.paymentWebView;
if (webView5 == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
} else {
webView2 = webView5;
}
webView2.loadUrl(url);
}
private static final CFWebIntentJSInterface loadPaymentUrl$lambda$4(Lazy<? extends CFWebIntentJSInterface> lazy) {
return (CFWebIntentJSInterface) lazy.getValue();
}
@Metadata(d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0000\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\b\u0086\u0004\u0018\u00002\u00020\u0001B\u0005¢\u0006\u0002\u0010\u0002J$\u0010\u0003\u001a\u00020\u00042\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\b\u0010\u0007\u001a\u0004\u0018\u00010\b2\u0006\u0010\t\u001a\u00020\nH\u0016J\u001c\u0010\u000b\u001a\u00020\n2\b\u0010\u0005\u001a\u0004\u0018\u00010\u00062\b\u0010\f\u001a\u0004\u0018\u00010\rH\u0016¨\u0006\u000e"}, d2 = {"Lapp/callpe/ui/payment/UPICheckoutActivity$WebClient;", "Landroid/webkit/WebViewClient;", "(Lapp/callpe/ui/payment/UPICheckoutActivity;)V", "doUpdateVisitedHistory", "", "view", "Landroid/webkit/WebView;", "url", "", "isReload", "", "shouldOverrideUrlLoading", com.birjuvachhani.locus.Constants.INTENT_EXTRA_CONFIGURATION, "Landroid/webkit/WebResourceRequest;", "app_riloRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
public final class WebClient extends WebViewClient {
public WebClient() {
}
@Override
public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
super.doUpdateVisitedHistory(view, url, isReload);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
String str;
Uri url;
if (request == null || (url = request.getUrl()) == null || (str = url.toString()) == null) {
str = "";
}
Timber.e("url " + str, new Object[0]);
WebView webView = null;
if (!StringsKt.startsWith$default(str, Constants.SCHEME, false, 2, (Object) null) || !StringsKt.startsWith$default(str, "http", false, 2, (Object) null)) {
try {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
UPICheckoutActivity.this.startActivity(intent);
} catch (ActivityNotFoundException unused) {
}
} else {
String successUrl = UPICheckoutActivity.this.getSuccessUrl();
if (!(successUrl == null || successUrl.length() == 0)) {
String successUrl2 = UPICheckoutActivity.this.getSuccessUrl();
Intrinsics.checkNotNull(successUrl2);
if (StringsKt.contains$default(str, successUrl2, false, 2, (Object) null)) {
WebView webView2 = UPICheckoutActivity.this.paymentWebView;
if (webView2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
} else {
webView = webView2;
}
webView.setVisibility(8);
UPICheckoutActivity.this.showVerifyingLoader(true);
UPICheckoutActivity uPICheckoutActivity = UPICheckoutActivity.this;
uPICheckoutActivity.verifyPayment(uPICheckoutActivity.getOrderID());
}
}
String failUrl = UPICheckoutActivity.this.getFailUrl();
if (!(failUrl == null || failUrl.length() == 0)) {
String failUrl2 = UPICheckoutActivity.this.getFailUrl();
Intrinsics.checkNotNull(failUrl2);
if (StringsKt.contains$default(str, failUrl2, false, 2, (Object) null)) {
WebView webView3 = UPICheckoutActivity.this.paymentWebView;
if (webView3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
} else {
webView = webView3;
}
webView.setVisibility(8);
UPICheckoutActivity.this.showVerifyingLoader(true);
UPICheckoutActivity uPICheckoutActivity2 = UPICheckoutActivity.this;
uPICheckoutActivity2.verifyPayment(uPICheckoutActivity2.getOrderID());
}
}
if (view != null) {
view.loadUrl(str);
}
}
return true;
}
}
protected void onDestroy() {
super.onDestroy();
stopUpdate();
unRegisterReceiver();
}
public void onBackPressed() {
DialogHelper.showReasonDialog((Context) this, getString(2131953083), getString(2131952110), false, new DialogHelper.Listener() {
@Override
public void onNegativeClick() {
}
@Override
public void onPositiveClick() {
String orderID = UPICheckoutActivity.this.getOrderID();
if (!(orderID == null || orderID.length() == 0)) {
WebView webView = UPICheckoutActivity.this.paymentWebView;
if (webView == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView = null;
}
webView.setVisibility(8);
UPICheckoutActivity uPICheckoutActivity = UPICheckoutActivity.this;
uPICheckoutActivity.orderFiledResponse(uPICheckoutActivity.getOrderID(), true);
return;
}
UPICheckoutActivity.this.finish();
}
});
}
protected void onResume() {
super.onResume();
this.isScreenVisible = true;
checkPaymentSuccessStatus();
}
protected void onPause() {
super.onPause();
this.isScreenVisible = false;
}
protected void onStart() {
super.onStart();
registerReceiver();
}
private final void registerReceiver() {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance((Context) this);
Intrinsics.checkNotNullExpressionValue(localBroadcastManager, "getInstance(this)");
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(PaymentDetailsActivity.PAYMENT_SUCCESS_EVENT);
localBroadcastManager.registerReceiver(this.broadcastReceiver, intentFilter);
}
private final void unRegisterReceiver() {
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance((Context) this);
Intrinsics.checkNotNullExpressionValue(localBroadcastManager, "getInstance(this)");
localBroadcastManager.unregisterReceiver(this.broadcastReceiver);
}
public final boolean getIsScreenVisible() {
return this.isScreenVisible;
}
public final void setScreenVisible(boolean z) {
this.isScreenVisible = z;
}
public final boolean getPaymentSuccessful() {
return this.paymentSuccessful;
}
public final void setPaymentSuccessful(boolean z) {
this.paymentSuccessful = z;
}
private final void checkPaymentSuccessStatus() {
if (this.paymentSuccessful) {
WebView webView = this.paymentWebView;
if (webView == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView = null;
}
webView.setVisibility(8);
showVerifyingLoader(true);
verifyPayment(this.orderID);
this.paymentSuccessful = false;
}
}
@Override
public List<ResolveInfo> getAppList(String link) {
Intrinsics.checkNotNullParameter(link, "link");
try {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(link));
List<ResolveInfo> queryIntentActivities = getPackageManager().queryIntentActivities(intent, 0);
Intrinsics.checkNotNullExpressionValue(queryIntentActivities, "packageManager.queryInte…ctivities(shareIntent, 0)");
Timber.d("CASH_FREE: App List = " + queryIntentActivities, new Object[0]);
return queryIntentActivities;
} catch (Exception e) {
Timber.e("Error: " + e, new Object[0]);
return CollectionsKt.emptyList();
}
}
@Override
public String getAppName(ApplicationInfo pkg) {
Intrinsics.checkNotNullParameter(pkg, "pkg");
try {
String obj = getPackageManager().getApplicationLabel(pkg).toString();
Timber.d("CASH_FREE: App name: " + obj, new Object[0]);
return obj;
} catch (Exception e) {
Timber.e("Error: " + e, new Object[0]);
return "";
}
}
@Override
public void openApp(final String appPkg, String url) {
Intrinsics.checkNotNullParameter(appPkg, "appPkg");
Intrinsics.checkNotNullParameter(url, "url");
try {
Uri parse = Uri.parse(url);
final Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(parse);
runOnUiThread(new Runnable() {
@Override
public final void run() {
UPICheckoutActivity.openApp$lambda$9(appPkg, this, intent);
}
});
} catch (Exception e) {
Timber.e("Error: " + e, new Object[0]);
}
}
public static final void openApp$lambda$9(String str, UPICheckoutActivity uPICheckoutActivity, Intent intent) {
Intrinsics.checkNotNullParameter(str, "$appPkg");
Intrinsics.checkNotNullParameter(uPICheckoutActivity, "this$0");
Intrinsics.checkNotNullParameter(intent, "$intent");
if (Intrinsics.areEqual(str, "others.upiapp") || Intrinsics.areEqual(uPICheckoutActivity.cfEnvironment, AdjustConfig.ENVIRONMENT_SANDBOX)) {
uPICheckoutActivity.cashFreeUpiAppLauncher.launch(Intent.createChooser(intent, "Pay with"));
return;
}
intent.setPackage(str);
List<ResolveInfo> queryIntentActivities = uPICheckoutActivity.getPackageManager().queryIntentActivities(intent, 0);
Intrinsics.checkNotNullExpressionValue(queryIntentActivities, "packageManager.queryIntentActivities(intent, 0)");
if (queryIntentActivities.isEmpty()) {
ActivityExtKt.toast((Activity) uPICheckoutActivity, "Unable to open app.");
Timber.d("CASH_FREE: No app found to handle the intent for package: " + str, new Object[0]);
return;
}
uPICheckoutActivity.cashFreeUpiAppLauncher.launch(intent);
}
}