正在查看: Biko v2.0.23 应用的 CheckoutActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Biko v2.0.23 应用的 CheckoutActivity.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.content.res.ColorStateList;
import android.net.Uri;
import android.os.Bundle;
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.ComponentActivity;
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.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.OrderSuccess;
import app.callpe.data.model.PgDetailBody;
import app.callpe.data.model.PgDetailBodyKt;
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 com.stripe.android.paymentsheet.PaymentSheet;
import com.stripe.android.paymentsheet.PaymentSheetResult;
import com.stripe.android.paymentsheet.addresselement.AddressDetails;
import com.stripe.android.paymentsheet.addresselement.AddressLauncher;
import com.stripe.android.paymentsheet.addresselement.AddressLauncherResult;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CancellationException;
import javax.inject.Inject;
import kotlin.Deprecated;
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.DefaultConstructorMarker;
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\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\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\u000f\n\u0002\u0010\u000b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u000b\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000e\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\u000e\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0007\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0018\u0002\n\u0002\b\b\n\u0002\u0018\u0002\n\u0002\b\r\n\u0002\u0018\u0002\b\u0007\u0018\u00002\u00020\u00012\u00020\u00022\u00020\u00032\u00020\u0004:\u0002¨\u0001B\u0005¢\u0006\u0002\u0010\u0005J\b\u0010[\u001a\u00020\\H\u0002J\b\u0010]\u001a\u00020\u001cH\u0002J\u0016\u0010^\u001a\b\u0012\u0004\u0012\u00020`0_2\u0006\u0010a\u001a\u00020\u001cH\u0016J\u0010\u0010b\u001a\u00020\u001c2\u0006\u0010c\u001a\u00020dH\u0016J=\u0010e\u001a\u00020\\2\u0006\u0010f\u001a\u00020g2\u0006\u0010h\u001a\u00020\u001c2\b\u0010i\u001a\u0004\u0018\u00010\u001c2\b\u0010j\u001a\u0004\u0018\u00010g2\n\b\u0002\u0010k\u001a\u0004\u0018\u00010\u001cH\u0002¢\u0006\u0002\u0010lJ\u001a\u0010m\u001a\u00020\\2\u0006\u0010n\u001a\u00020\u001c2\b\b\u0002\u0010o\u001a\u00020.H\u0003J\"\u0010p\u001a\u00020\\2\u0006\u0010q\u001a\u00020\u00072\u0006\u0010r\u001a\u00020\u00072\b\u0010s\u001a\u0004\u0018\u00010\u0019H\u0015J\u0010\u0010t\u001a\u00020\\2\u0006\u0010u\u001a\u00020vH\u0002J\b\u0010w\u001a\u00020\\H\u0016J\u0012\u0010x\u001a\u00020\\2\b\u0010y\u001a\u0004\u0018\u00010zH\u0014J\b\u0010{\u001a\u00020\\H\u0014J\b\u0010|\u001a\u00020\\H\u0014J\u001a\u0010}\u001a\u00020\\2\u0006\u0010~\u001a\u00020\u00072\b\u0010\u007f\u001a\u0004\u0018\u00010\u001cH\u0016J\u001c\u0010\u0080\u0001\u001a\u00020\\2\b\u0010\u0081\u0001\u001a\u00030\u0082\u00012\u0007\u0010\u0083\u0001\u001a\u00020\u001cH\u0016J\u0013\u0010\u0084\u0001\u001a\u00020\\2\b\u0010\u0085\u0001\u001a\u00030\u0086\u0001H\u0002J\u0013\u0010\u0087\u0001\u001a\u00020\\2\b\u0010~\u001a\u0004\u0018\u00010\u001cH\u0016J\u0012\u0010\u0088\u0001\u001a\u00020\\2\u0007\u0010\u0083\u0001\u001a\u00020\u001cH\u0016J\t\u0010\u0089\u0001\u001a\u00020\\H\u0014J\u0012\u0010\u008a\u0001\u001a\u00020\\2\u0007\u0010\u008b\u0001\u001a\u00020zH\u0014J\t\u0010\u008c\u0001\u001a\u00020\\H\u0014J\u001a\u0010\u008d\u0001\u001a\u00020\\2\u0007\u0010\u008e\u0001\u001a\u00020\u001c2\u0006\u0010n\u001a\u00020\u001cH\u0016J\u001d\u0010\u008f\u0001\u001a\u00020\\2\t\u0010\u0083\u0001\u001a\u0004\u0018\u00010\u001c2\u0007\u0010\u0090\u0001\u001a\u00020.H\u0002J\t\u0010\u0091\u0001\u001a\u00020\\H\u0002J\u0013\u0010\u0092\u0001\u001a\u00020\\2\b\u0010\u0093\u0001\u001a\u00030\u0094\u0001H\u0002J\u0010\u0010\u0095\u0001\u001a\u00020\\2\u0007\u0010\u0096\u0001\u001a\u00020.J\t\u0010\u0097\u0001\u001a\u00020\\H\u0002J\t\u0010\u0098\u0001\u001a\u00020\\H\u0002J\t\u0010\u0099\u0001\u001a\u00020\\H\u0002J\u0012\u0010\u009a\u0001\u001a\u00020\\2\u0007\u0010\u0096\u0001\u001a\u00020.H\u0002J\u0011\u0010\u009b\u0001\u001a\u00020\\2\b\u0010\u009c\u0001\u001a\u00030\u009d\u0001J:\u0010\u009e\u0001\u001a\u00020\\2\u0007\u0010\u0083\u0001\u001a\u00020\u001c2\u0007\u0010\u009f\u0001\u001a\u00020\u00072\t\u0010 \u0001\u001a\u0004\u0018\u00010\u001c2\t\u0010¡\u0001\u001a\u0004\u0018\u00010\u001c2\u0007\u0010¢\u0001\u001a\u00020\u001cH\u0002J\t\u0010£\u0001\u001a\u00020\\H\u0002J\t\u0010¤\u0001\u001a\u00020\\H\u0002J\u001f\u0010¥\u0001\u001a\u00020\\2\t\u0010\u0083\u0001\u001a\u0004\u0018\u00010\u001c2\t\b\u0002\u0010¦\u0001\u001a\u00020.H\u0002J\u0014\u0010§\u0001\u001a\u00020\\2\t\u0010\u0083\u0001\u001a\u0004\u0018\u00010\u001cH\u0002R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082D¢\u0006\u0002\n\u0000R\u0010\u0010\b\u001a\u0004\u0018\u00010\tX\u0082\u000e¢\u0006\u0002\n\u0000R\u0010\u0010\n\u001a\u0004\u0018\u00010\u000bX\u0082\u000e¢\u0006\u0002\n\u0000R\u001e\u0010\f\u001a\u00020\r8\u0006@\u0006X\u0087.¢\u0006\u000e\n\u0000\u001a\u0004\b\u000e\u0010\u000f\"\u0004\b\u0010\u0010\u0011R\u0014\u0010\u0012\u001a\u00020\t8BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0013\u0010\u0014R\u000e\u0010\u0015\u001a\u00020\u0016X\u0082\u0004¢\u0006\u0002\n\u0000R\u001c\u0010\u0017\u001a\u0010\u0012\f\u0012\n \u001a*\u0004\u0018\u00010\u00190\u00190\u0018X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u001b\u001a\u00020\u001cX\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u001d\u001a\u0004\u0018\u00010\u001eX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b\u001f\u0010 \"\u0004\b!\u0010\"R\u001a\u0010#\u001a\u00020\u0007X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b$\u0010%\"\u0004\b&\u0010'R\u001c\u0010(\u001a\u0004\u0018\u00010\u001cX\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\b0\u00101R\u001c\u00102\u001a\u0004\u0018\u000103X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b4\u00105\"\u0004\b6\u00107R\u001a\u00108\u001a\u00020\u001cX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b9\u0010*\"\u0004\b:\u0010,R\u001c\u0010;\u001a\u0004\u0018\u00010\u001cX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\b<\u0010*\"\u0004\b=\u0010,R\u0010\u0010>\u001a\u0004\u0018\u00010?X\u0082\u000e¢\u0006\u0002\n\u0000R\u001a\u0010@\u001a\u00020.X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bA\u0010/\"\u0004\bB\u00101R\u000e\u0010C\u001a\u00020DX\u0082.¢\u0006\u0002\n\u0000R\"\u0010E\u001a\n\u0012\u0004\u0012\u00020\u0019\u0018\u00010\u0018X\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bF\u0010G\"\u0004\bH\u0010IR\u0010\u0010J\u001a\u0004\u0018\u00010KX\u0082\u000e¢\u0006\u0002\n\u0000R\u0011\u0010L\u001a\u00020M¢\u0006\b\n\u0000\u001a\u0004\bN\u0010OR\u0010\u0010P\u001a\u0004\u0018\u00010KX\u0082\u000e¢\u0006\u0002\n\u0000R\u001c\u0010Q\u001a\u0004\u0018\u00010\u001cX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bR\u0010*\"\u0004\bS\u0010,R\u001a\u0010T\u001a\u00020\u001cX\u0086\u000e¢\u0006\u000e\n\u0000\u001a\u0004\bU\u0010*\"\u0004\bV\u0010,R$\u0010W\u001a\u00020\u001c8\u0006@\u0006X\u0087.¢\u0006\u0014\n\u0000\u0012\u0004\bX\u0010\u0005\u001a\u0004\bY\u0010*\"\u0004\bZ\u0010,¨\u0006©\u0001²\u0006\f\u0010ª\u0001\u001a\u00030«\u0001X\u008a\u0084\u0002"}, d2 = {"Lapp/callpe/ui/payment/CheckoutActivity;", "Landroidx/appcompat/app/AppCompatActivity;", "Lcom/razorpay/PaymentResultListener;", "Lcom/cashfree/pg/core/api/callback/CFCheckoutResponseCallback;", "Lapp/callpe/common/utils/cashfree/CFWebIntentJSInterface$CFWebIntentInterface;", "()V", "B2B_PG_REQUEST_CODE", "", "_binding", "Lapp/callpe/databinding/ActivityCheckoutBinding;", "addressLauncher", "Lcom/stripe/android/paymentsheet/addresselement/AddressLauncher;", "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", "orderId", "getOrderId", "setOrderId", "paymentIntentClientSecret", "getPaymentIntentClientSecret", "setPaymentIntentClientSecret", "paymentSheet", "Lcom/stripe/android/paymentsheet/PaymentSheet;", "paymentSuccessful", "getPaymentSuccessful", "setPaymentSuccessful", "paymentWebView", "Landroid/webkit/WebView;", "pweActivityResultLauncher", "getPweActivityResultLauncher", "()Landroidx/activity/result/ActivityResultLauncher;", "setPweActivityResultLauncher", "(Landroidx/activity/result/ActivityResultLauncher;)V", "savedAddressDetail", "Lcom/stripe/android/paymentsheet/addresselement/AddressDetails;", "scope", "Lkotlinx/coroutines/CoroutineScope;", "getScope", "()Lkotlinx/coroutines/CoroutineScope;", "shippingDetails", "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", "", "paymentMethod", "cardType", "couponCode", "currency", "(JLjava/lang/String;Ljava/lang/String;Ljava/lang/Long;Ljava/lang/String;)V", "loadPaymentUrl", "url", "isCashfreeUrl", "onActivityResult", "requestCode", "resultCode", "data", "onAddressLauncherResult", "result", "Lcom/stripe/android/paymentsheet/addresselement/AddressLauncherResult;", "onBackPressed", "onCreate", "savedInstanceState", "Landroid/os/Bundle;", "onDestroy", "onPause", "onPaymentError", "p0", "p1", "onPaymentFailure", "cfErrorResponse", "Lcom/cashfree/pg/core/api/utils/CFErrorResponse;", "orderID", "onPaymentSheetResult", "paymentSheetResult", "Lcom/stripe/android/paymentsheet/PaymentSheetResult;", "onPaymentSuccess", "onPaymentVerify", "onResume", "onSaveInstanceState", "outState", "onStart", "openApp", "appPkg", "orderFiledResponse", "failed", "registerReceiver", "saveUserPgDetails", "pgDetailBody", "Lapp/callpe/data/model/PgDetailBody;", "setProgress", "isVisible", "showFailedInfo", "showInfoMessage", "showSuccessInfo", "showVerifyingLoader", "startCashFreeFlow", "order", "Lapp/callpe/data/model/OrderSuccess;", "startPayment", "amount", "mobile", FacebookRequestErrorClassification.KEY_NAME, "razorPayClientKey", "stopUpdate", "unRegisterReceiver", "verifyOrderResponse", "isFailed", "verifyPayment", "WebClient", "app_bikoRelease", "cfWebIntentJSInterface", "Lapp/callpe/common/utils/cashfree/CFWebIntentJSInterface;"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class CheckoutActivity extends Hilt_CheckoutActivity implements PaymentResultListener, CFCheckoutResponseCallback, CFWebIntentJSInterface.CFWebIntentInterface {
private ActivityCheckoutBinding _binding;
private AddressLauncher addressLauncher;
@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 String paymentIntentClientSecret;
private PaymentSheet paymentSheet;
private boolean paymentSuccessful;
private WebView paymentWebView;
private AddressDetails savedAddressDetail;
private AddressDetails shippingDetails;
private String successUrl;
@Inject
public String userId;
private String orderId = "";
private String token = "TOKEN";
private final CoroutineScope scope = CoroutineScopeKt.MainScope();
private final int B2B_PG_REQUEST_CODE = 777;
private ActivityResultLauncher<Intent> pweActivityResultLauncher = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
CheckoutActivity.pweActivityResultLauncher$lambda$0(CheckoutActivity.this, (ActivityResult) obj);
}
});
public static final void cashFreeUpiAppLauncher$lambda$2$lambda$1(String str) {
}
public static void getUserId$annotations() {
}
public CheckoutActivity() {
ActivityResultLauncher<Intent> registerForActivityResult = registerForActivityResult((ActivityResultContract) new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback() {
public final void onActivityResult(Object obj) {
CheckoutActivity.cashFreeUpiAppLauncher$lambda$2(CheckoutActivity.this, (ActivityResult) obj);
}
});
Intrinsics.checkNotNullExpressionValue(registerForActivityResult, "registerForActivityResul…UI()\") {}\n }\n }");
this.cashFreeUpiAppLauncher = registerForActivityResult;
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 (CheckoutActivity.this.getIsScreenVisible()) {
WebView webView = CheckoutActivity.this.paymentWebView;
if (webView == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView = null;
}
webView.setVisibility(8);
CheckoutActivity.this.showVerifyingLoader(true);
CheckoutActivity checkoutActivity = CheckoutActivity.this;
checkoutActivity.verifyPayment(checkoutActivity.getOrderId());
return;
}
CheckoutActivity.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 getPaymentIntentClientSecret() {
return this.paymentIntentClientSecret;
}
public final void setPaymentIntentClientSecret(String str) {
this.paymentIntentClientSecret = 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 final ActivityResultLauncher<Intent> getPweActivityResultLauncher() {
return this.pweActivityResultLauncher;
}
public final void setPweActivityResultLauncher(ActivityResultLauncher<Intent> activityResultLauncher) {
this.pweActivityResultLauncher = activityResultLauncher;
}
public static final void pweActivityResultLauncher$lambda$0(CheckoutActivity checkoutActivity, ActivityResult activityResult) {
Intrinsics.checkNotNullParameter(checkoutActivity, "this$0");
Intent data = activityResult.getData();
if (data != null) {
data.getStringExtra("result");
try {
Timber.e("payment_response == " + data.getStringExtra("payment_response"), new Object[0]);
checkoutActivity.showVerifyingLoader(true);
checkoutActivity.verifyPayment(checkoutActivity.orderId);
} catch (Exception unused) {
}
}
}
public static final void cashFreeUpiAppLauncher$lambda$2(CheckoutActivity checkoutActivity, ActivityResult activityResult) {
Intrinsics.checkNotNullParameter(checkoutActivity, "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 = checkoutActivity.paymentWebView;
if (webView2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
} else {
webView = webView2;
}
webView.evaluateJavascript("window.showVerifyUI()", new ValueCallback() {
@Override
public final void onReceiveValue(Object obj) {
CheckoutActivity.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) {
String str;
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());
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 longExtra = getIntent().getLongExtra("topUpId", -1L);
String stringExtra = getIntent().getStringExtra("currency");
Long valueOf = Long.valueOf(getIntent().getLongExtra("couponCode", -1L));
Long l = valueOf.longValue() == -1 ? null : valueOf;
String stringExtra2 = getIntent().getStringExtra("paymentMethod");
if (stringExtra2 == null) {
stringExtra2 = "UPI";
}
String str3 = stringExtra2;
if (Intrinsics.areEqual(str3, "CARD")) {
str = getIntent().getStringExtra("cardType");
if (str == null) {
str = "VISA";
}
} else {
str = null;
}
String string2 = savedInstanceState != null ? savedInstanceState.getString("orderId") : null;
this.orderId = string2 == null ? "" : string2;
String str4 = string2;
if (!(str4 == null || str4.length() == 0)) {
showVerifyingLoader(true);
verifyPayment(string2);
} else if (longExtra != -1) {
try {
CFPaymentGatewayService.getInstance().setCheckoutCallback(this);
} catch (CFException e) {
e.printStackTrace();
}
if (Intrinsics.areEqual(str3, "CARD")) {
ComponentActivity componentActivity = (ComponentActivity) this;
this.paymentSheet = new PaymentSheet(componentActivity, new CheckoutActivity$onCreate$1(this));
this.addressLauncher = new AddressLauncher(componentActivity, new CheckoutActivity$onCreate$2(this));
}
getOrderResponse(longExtra, str3, str, l, stringExtra);
}
}
protected void onSaveInstanceState(Bundle outState) {
Intrinsics.checkNotNullParameter(outState, "outState");
super.onSaveInstanceState(outState);
if (this.orderId.length() > 0) {
outState.putString("orderId", this.orderId);
}
}
@Deprecated(message = "Deprecated in Java")
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Bundle extras;
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == this.B2B_PG_REQUEST_CODE) {
extras = data != null ? data.getExtras() : null;
if (extras != null) {
for (String str : extras.keySet()) {
Timber.e("IntentData " + str + ": " + extras.get(str), new Object[0]);
}
}
showVerifyingLoader(true);
verifyPayment(this.orderId);
return;
}
if (requestCode == 2001) {
extras = data != null ? data.getExtras() : null;
if (extras != null) {
for (String str2 : extras.keySet()) {
Timber.e("IntentData " + str2 + ": " + extras.get(str2), new Object[0]);
}
}
}
}
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;
}
CFSession build = new CFSession.CFSessionBuilder().setEnvironment(environment).setPaymentSessionID(String.valueOf(order.getExtPgId2())).setOrderId(order.getOrderId()).build();
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) {
e.printStackTrace();
}
}
public final void showFailedInfo() {
showVerifyingLoader(false);
WebView webView = this.paymentWebView;
if (webView == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView = null;
}
webView.setVisibility(8);
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));
getBinding().paymentStatusMessage.setText(getString(2131952973));
stopUpdate();
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new CheckoutActivity$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);
WebView webView = this.paymentWebView;
if (webView == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView = null;
}
webView.setVisibility(8);
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 CheckoutActivity$showSuccessInfo$1(this, null), 3, (Object) null);
}
public final void showInfoMessage() {
showVerifyingLoader(false);
WebView webView = this.paymentWebView;
if (webView == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView = null;
}
webView.setVisibility(8);
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) {
CheckoutActivity.showInfoMessage$lambda$3(CheckoutActivity.this, view3);
}
});
stopUpdate();
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new CheckoutActivity$showInfoMessage$2(this, null), 3, (Object) null);
}
public static final void showInfoMessage$lambda$3(CheckoutActivity checkoutActivity, View view) {
Intrinsics.checkNotNullParameter(checkoutActivity, "this$0");
checkoutActivity.stopUpdate();
checkoutActivity.finish();
}
public final void verifyPayment(String orderID) {
stopUpdate();
this.job = BuildersKt.launch$default(this.scope, (CoroutineContext) null, (CoroutineStart) null, new CheckoutActivity$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;
}
static void getOrderResponse$default(CheckoutActivity checkoutActivity, long j, String str, String str2, Long l, String str3, int i, Object obj) {
if ((i & 16) != 0) {
str3 = "INR";
}
checkoutActivity.getOrderResponse(j, str, str2, l, str3);
}
private final void getOrderResponse(long topUpId, final String paymentMethod, String cardType, Long couponCode, String currency) {
setProgress(true);
ApiService.DefaultImpls.createOrderV2$default(getApiService(), topUpId, paymentMethod, cardType, null, null, null, couponCode, currency, 56, null).enqueue(new Callback<OrderSuccess>() {
public void onResponse(retrofit2.Call<app.callpe.data.model.OrderSuccess> r12, retrofit2.Response<app.callpe.data.model.OrderSuccess> r13) {
throw new UnsupportedOperationException("Method not decompiled: app.callpe.ui.payment.CheckoutActivity$getOrderResponse$1.onResponse(retrofit2.Call, retrofit2.Response):void");
}
public void onFailure(Call<OrderSuccess> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
CheckoutActivity.this.setProgress(false);
Timber.e("onFailure: " + t.getCause(), new Object[0]);
Helper.noNetworkToast((Context) CheckoutActivity.this, t);
}
});
}
public final void onPaymentSheetResult(PaymentSheetResult paymentSheetResult) {
if (paymentSheetResult instanceof PaymentSheetResult.Canceled) {
orderFiledResponse(this.orderId, true);
return;
}
if (paymentSheetResult instanceof PaymentSheetResult.Failed) {
showVerifyingLoader(true);
verifyPayment(this.orderId);
} else if (paymentSheetResult instanceof PaymentSheetResult.Completed) {
showVerifyingLoader(true);
verifyPayment(this.orderId);
}
}
static void verifyOrderResponse$default(CheckoutActivity checkoutActivity, String str, boolean z, int i, Object obj) {
if ((i & 2) != 0) {
z = false;
}
checkoutActivity.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;
CheckoutActivity checkoutActivity = CheckoutActivity.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;
}
checkoutActivity.orderFiledResponse(str, true);
break;
case -1031784143:
if (!paymentStatus.equals("CANCELLED")) {
break;
}
checkoutActivity.orderFiledResponse(str, true);
break;
case 35394935:
if (!paymentStatus.equals("PENDING")) {
break;
} else {
checkoutActivity.orderFiledResponse(str, true);
break;
}
case 478592449:
if (!paymentStatus.equals("REFUND_SUCCESSFUL")) {
break;
}
checkoutActivity.orderFiledResponse(str, true);
break;
case 755522276:
if (!paymentStatus.equals("REFUND_FAILED")) {
break;
}
checkoutActivity.orderFiledResponse(str, true);
break;
case 2066319421:
if (!paymentStatus.equals("FAILED")) {
break;
}
checkoutActivity.orderFiledResponse(str, true);
break;
}
} else {
switch (paymentStatus.hashCode()) {
case -1872451388:
if (!paymentStatus.equals("REFUND_INITIATED")) {
break;
}
checkoutActivity.showFailedInfo();
break;
case -1149187101:
if (!paymentStatus.equals("SUCCESS")) {
break;
} else {
AnalyticsHelper.sendSuccessEvent$default(AnalyticsHelper.INSTANCE, (Context) checkoutActivity, false, 0.0d, 6, null);
checkoutActivity.showSuccessInfo();
break;
}
case -1031784143:
if (!paymentStatus.equals("CANCELLED")) {
break;
}
checkoutActivity.showFailedInfo();
break;
case 478592449:
if (!paymentStatus.equals("REFUND_SUCCESSFUL")) {
break;
}
checkoutActivity.showFailedInfo();
break;
case 755522276:
if (!paymentStatus.equals("REFUND_FAILED")) {
break;
}
checkoutActivity.showFailedInfo();
break;
case 1409057580:
if (!paymentStatus.equals("USER_DROPPED")) {
break;
}
checkoutActivity.showFailedInfo();
break;
case 2066319421:
if (!paymentStatus.equals("FAILED")) {
break;
}
checkoutActivity.showFailedInfo();
break;
}
}
}
}
} else {
try {
APIError parseError = ErrorHandler.parseError(response);
Intrinsics.checkNotNullExpressionValue(parseError, "parseError(response)");
Toast.makeText((Context) CheckoutActivity.this, CheckoutActivity.this.getString(2131952996) + ": " + parseError.getReason(), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception unused) {
Toast.makeText((Context) CheckoutActivity.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) CheckoutActivity.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")) {
CheckoutActivity.this.showSuccessInfo();
return;
} else if (Intrinsics.areEqual(message, "PAYMENT_CANCELLED")) {
CheckoutActivity.this.showFailedInfo();
return;
} else {
CheckoutActivity checkoutActivity = CheckoutActivity.this;
checkoutActivity.setJob(BuildersKt.launch$default(checkoutActivity.getScope(), (CoroutineContext) null, (CoroutineStart) null, new CheckoutActivity$orderFiledResponse$1$onResponse$1(CheckoutActivity.this, null), 3, (Object) null));
return;
}
}
return;
}
try {
CheckoutActivity checkoutActivity2 = CheckoutActivity.this;
checkoutActivity2.setJob(BuildersKt.launch$default(checkoutActivity2.getScope(), (CoroutineContext) null, (CoroutineStart) null, new CheckoutActivity$orderFiledResponse$1$onResponse$2(CheckoutActivity.this, null), 3, (Object) null));
APIError parseError = ErrorHandler.parseError(response);
Intrinsics.checkNotNullExpressionValue(parseError, "parseError(response)");
Toast.makeText((Context) CheckoutActivity.this, CheckoutActivity.this.getString(2131952996) + ": " + parseError.getReason(), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception unused) {
Toast.makeText((Context) CheckoutActivity.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) CheckoutActivity.this, t);
CheckoutActivity checkoutActivity = CheckoutActivity.this;
checkoutActivity.setJob(BuildersKt.launch$default(checkoutActivity.getScope(), (CoroutineContext) null, (CoroutineStart) null, new CheckoutActivity$orderFiledResponse$1$onFailure$1(CheckoutActivity.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) {
CheckoutActivity checkoutActivity = CheckoutActivity.this;
String str = orderID;
String paymentStatus = successModel.getPaymentStatus();
if (paymentStatus != null) {
Timber.e("payment success " + paymentStatus, new Object[0]);
if (Intrinsics.areEqual(paymentStatus, "PENDING")) {
checkoutActivity.showInfoMessage();
} else {
checkoutActivity.orderFiledResponse(str, true);
}
}
}
} else {
try {
APIError parseError = ErrorHandler.parseError(response);
Intrinsics.checkNotNullExpressionValue(parseError, "parseError(response)");
Toast.makeText((Context) CheckoutActivity.this, CheckoutActivity.this.getString(2131952996) + ": " + parseError.getReason(), 0).show();
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception unused) {
Toast.makeText((Context) CheckoutActivity.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) CheckoutActivity.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);
}
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 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]);
verifyOrderResponse(orderID, true);
}
static void loadPaymentUrl$default(CheckoutActivity checkoutActivity, String str, boolean z, int i, Object obj) {
if ((i & 2) != 0) {
z = false;
}
checkoutActivity.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 m2137invoke() {
return new CFWebIntentJSInterface(CheckoutActivity.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/CheckoutActivity$WebClient;", "Landroid/webkit/WebViewClient;", "(Lapp/callpe/ui/payment/CheckoutActivity;)V", "doUpdateVisitedHistory", "", "view", "Landroid/webkit/WebView;", "url", "", "isReload", "", "shouldOverrideUrlLoading", com.birjuvachhani.locus.Constants.INTENT_EXTRA_CONFIGURATION, "Landroid/webkit/WebResourceRequest;", "app_bikoRelease"}, 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 parseUri = Intent.parseUri(str, 1);
parseUri.addFlags(268435456);
CheckoutActivity.this.startActivityForResult(parseUri, 2001);
} catch (ActivityNotFoundException unused) {
}
return true;
}
String successUrl = CheckoutActivity.this.getSuccessUrl();
if (!(successUrl == null || successUrl.length() == 0)) {
String successUrl2 = CheckoutActivity.this.getSuccessUrl();
Intrinsics.checkNotNull(successUrl2);
if (StringsKt.contains$default(str, successUrl2, false, 2, (Object) null)) {
WebView webView2 = CheckoutActivity.this.paymentWebView;
if (webView2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
} else {
webView = webView2;
}
webView.setVisibility(8);
CheckoutActivity.this.showVerifyingLoader(true);
CheckoutActivity checkoutActivity = CheckoutActivity.this;
checkoutActivity.verifyPayment(checkoutActivity.getOrderId());
return true;
}
}
String failUrl = CheckoutActivity.this.getFailUrl();
if (!(failUrl == null || failUrl.length() == 0)) {
String failUrl2 = CheckoutActivity.this.getFailUrl();
Intrinsics.checkNotNull(failUrl2);
if (StringsKt.contains$default(str, failUrl2, false, 2, (Object) null)) {
WebView webView3 = CheckoutActivity.this.paymentWebView;
if (webView3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
} else {
webView = webView3;
}
webView.setVisibility(8);
CheckoutActivity.this.showVerifyingLoader(true);
CheckoutActivity checkoutActivity2 = CheckoutActivity.this;
checkoutActivity2.verifyPayment(checkoutActivity2.getOrderId());
return true;
}
}
return false;
}
}
public final void onAddressLauncherResult(AddressLauncherResult result) {
if (result instanceof AddressLauncherResult.Succeeded) {
AddressDetails address = ((AddressLauncherResult.Succeeded) result).getAddress();
this.shippingDetails = address;
if (address != null) {
Context context = (Context) this;
boolean z = SharedPref.getBoolean(context, PrefKeys.ADDRESS_CHANGED, false);
if (PgDetailBodyKt.hasAddressChanged(address, this.savedAddressDetail) || !z) {
Timber.d("Stripe: Address is changed", new Object[0]);
if (!z) {
SharedPref.setBoolean(context, PrefKeys.ADDRESS_CHANGED, true);
}
saveUserPgDetails(PgDetailBodyKt.toPgDetailBody(address));
}
SharedPref.setString(context, PrefKeys.SHIPPING_DETAILS, new Gson().toJson(address));
}
PaymentSheet.BillingDetailsCollectionConfiguration billingDetailsCollectionConfiguration = new PaymentSheet.BillingDetailsCollectionConfiguration((PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode) null, (PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode) null, (PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode) null, (PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode) null, true, 15, (DefaultConstructorMarker) null);
PaymentSheet paymentSheet = this.paymentSheet;
if (paymentSheet != null) {
String str = this.paymentIntentClientSecret;
if (str == null) {
str = "";
}
String string = getString(2131951681);
AddressDetails addressDetails = this.shippingDetails;
String name = addressDetails != null ? addressDetails.getName() : null;
AddressDetails addressDetails2 = this.shippingDetails;
PaymentSheet.BillingDetails billingDetails = new PaymentSheet.BillingDetails(addressDetails2 != null ? addressDetails2.getAddress() : null, (String) null, name, (String) null, 10, (DefaultConstructorMarker) null);
Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.application_name)");
paymentSheet.presentWithPaymentIntent(str, new PaymentSheet.Configuration(string, (PaymentSheet.CustomerConfiguration) null, (PaymentSheet.GooglePayConfiguration) null, (ColorStateList) null, billingDetails, addressDetails, false, false, (PaymentSheet.Appearance) null, (String) null, billingDetailsCollectionConfiguration, (List) null, 2958, (DefaultConstructorMarker) null));
return;
}
return;
}
if (result instanceof AddressLauncherResult.Canceled) {
orderFiledResponse(this.orderId, true);
}
}
private final void saveUserPgDetails(PgDetailBody pgDetailBody) {
getApiService().saveUserPgDetails(pgDetailBody).enqueue(new Callback<PgDetailBody>() {
public void onResponse(Call<PgDetailBody> call, Response<PgDetailBody> response) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(response, "response");
try {
Timber.e("response %s", new Object[]{response.raw()});
if (response.isSuccessful()) {
Timber.d("Stripe: Pg Info saved " + response.body(), new Object[0]);
}
} catch (Exception unused) {
}
}
public void onFailure(Call<PgDetailBody> call, Throwable t) {
Intrinsics.checkNotNullParameter(call, "call");
Intrinsics.checkNotNullParameter(t, "t");
Timber.e(t.getCause(), "onFailure: ", new Object[0]);
}
});
}
protected void onStart() {
super.onStart();
registerReceiver();
}
protected void onDestroy() {
super.onDestroy();
this.paymentSheet = null;
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 = CheckoutActivity.this.getOrderId();
if (!(orderId == null || orderId.length() == 0)) {
WebView webView = CheckoutActivity.this.paymentWebView;
if (webView == null) {
Intrinsics.throwUninitializedPropertyAccessException("paymentWebView");
webView = null;
}
webView.setVisibility(8);
CheckoutActivity checkoutActivity = CheckoutActivity.this;
checkoutActivity.orderFiledResponse(checkoutActivity.getOrderId(), true);
CheckoutActivity.this.finish();
return;
}
CheckoutActivity.this.finish();
}
});
}
protected void onResume() {
super.onResume();
this.isScreenVisible = true;
checkPaymentSuccessStatus();
}
protected void onPause() {
super.onPause();
this.isScreenVisible = false;
}
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() {
CheckoutActivity.openApp$lambda$10(appPkg, this, intent);
}
});
} catch (Exception e) {
Timber.e("Error: " + e, new Object[0]);
}
}
public static final void openApp$lambda$10(String str, CheckoutActivity checkoutActivity, Intent intent) {
Intrinsics.checkNotNullParameter(str, "$appPkg");
Intrinsics.checkNotNullParameter(checkoutActivity, "this$0");
Intrinsics.checkNotNullParameter(intent, "$intent");
if (Intrinsics.areEqual(str, "others.upiapp") || Intrinsics.areEqual(checkoutActivity.cfEnvironment, AdjustConfig.ENVIRONMENT_SANDBOX)) {
checkoutActivity.cashFreeUpiAppLauncher.launch(Intent.createChooser(intent, "Pay with"));
return;
}
intent.setPackage(str);
List<ResolveInfo> queryIntentActivities = checkoutActivity.getPackageManager().queryIntentActivities(intent, 0);
Intrinsics.checkNotNullExpressionValue(queryIntentActivities, "packageManager.queryIntentActivities(intent, 0)");
if (queryIntentActivities.isEmpty()) {
ActivityExtKt.toast((Activity) checkoutActivity, "Unable to open app.");
Timber.d("CASH_FREE: No app found to handle the intent for package: " + str, new Object[0]);
return;
}
checkoutActivity.cashFreeUpiAppLauncher.launch(intent);
}
}