正在查看: OLX India v19.42.007 应用的 PaymentResponseUpiSdkActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: OLX India v19.42.007 应用的 PaymentResponseUpiSdkActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.payu.upisdk.upiintent;
import android.app.AlertDialog;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.text.TextUtils;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.fragment.app.r;
import com.payu.otpassist.utils.Constants;
import com.payu.payuanalytics.analytics.model.PayUAnalytics;
import com.payu.socketverification.interfaces.PayUSocketEventListener;
import com.payu.socketverification.socket.SocketHandler;
import com.payu.socketverification.socket.SocketPaymentResponse;
import com.payu.socketverification.util.PayUNetworkConstant;
import com.payu.socketverification.widgets.PayUProgressDialog;
import com.payu.ui.model.utils.AnalyticsConstant;
import com.payu.upisdk.PaymentOption;
import com.payu.upisdk.Upi;
import com.payu.upisdk.bean.UpiConfig;
import com.payu.upisdk.callbacks.PayUUPICallback;
import com.payu.upisdk.util.PayUUpiUtil;
import com.payu.upisdk.util.UpiConstant;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class PaymentResponseUpiSdkActivity extends r implements com.payu.upisdk.upiinterface.a, PayUSocketEventListener {
public static String g0;
public d Q;
public String R;
public ArrayList S;
public ArrayList T;
public PayUAnalytics U;
public String V;
public PaymentOption W;
public WebView X;
public UpiConfig Y;
public e a0;
public PayUProgressDialog d0;
public SocketPaymentResponse e0;
public AlertDialog f0;
public Boolean Z = Boolean.FALSE;
public String b0 = "";
public int c0 = 0;
public class a extends WebViewClient {
public a() {
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
PaymentResponseUpiSdkActivity.this.f2("upiCollect_onPageFinished", str);
?? r2 = PaymentResponseUpiSdkActivity.this;
PayUProgressDialog payUProgressDialog = r2.d0;
if (payUProgressDialog == null || !payUProgressDialog.isShowing() || r2.isDestroyed() || r2.isFinishing()) {
return;
}
r2.d0.dismiss();
r2.d0 = null;
}
@Override
public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
super.onPageStarted(webView, str, bitmap);
PaymentResponseUpiSdkActivity.this.f2("upiCollect_onPageStarted", str);
}
@Override
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
super.onReceivedError(webView, webResourceRequest, webResourceError);
PaymentResponseUpiSdkActivity.this.f2("upiCollect_onReceivedError", webResourceRequest.getUrl().toString());
}
@Override
public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
PaymentResponseUpiSdkActivity.this.f2("upiCollect_onReceivedHttpError", webResourceRequest.getUrl().toString());
}
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
super.onReceivedSslError(webView, sslErrorHandler, sslError);
PaymentResponseUpiSdkActivity.this.f2("upiCollect_onReceivedSslError", sslError.getUrl());
}
}
public final void a() {
WebView webView = this.X;
if (webView != null) {
webView.getSettings().setJavaScriptEnabled(true);
this.X.addJavascriptInterface(new com.payu.upisdk.upi.a(this, this.U, this.Y), "PayU");
this.X.setVisibility(8);
this.X.setWebViewClient(new a());
}
}
public final void e2(String str) {
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + " Err " + Constants.INVALID_MERCHANT_KEY_ERROR_CODE);
f2("MERCHANT_INFO_NOT_PRESENT", "ErrorDetails_" + str + "_|_ErrorCode: " + Constants.INVALID_MERCHANT_KEY_ERROR_CODE);
PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
if (payUUPICallback != null) {
payUUPICallback.onUpiErrorReceived(Constants.INVALID_MERCHANT_KEY_ERROR_CODE, "MERCHANT_INFO_NOT_PRESENT");
}
if (isFinishing() || isDestroyed()) {
return;
}
finish();
}
@Override
public void errorReceived(int i, String str) {
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Error Received " + str);
StringBuilder sb = new StringBuilder();
sb.append("technical_error_&_error_message: ");
sb.append(str);
f2("socket_cancel", sb.toString());
if (i == 1003) {
d dVar = this.Q;
if (dVar != null) {
dVar.l("cancel", "Technical Error");
return;
}
return;
}
PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
if (payUUPICallback != null) {
payUUPICallback.onUpiErrorReceived(i, str);
} else {
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Upi callback class should not be null onPaymentSuccess");
}
if (isFinishing() || isDestroyed()) {
return;
}
finish();
}
public void f2(String str, String str2) {
try {
PayUAnalytics payUAnalytics = this.U;
if (payUAnalytics == null || this.Y == null) {
return;
}
payUAnalytics.log(com.payu.upisdk.util.c.c(getApplicationContext(), str, str2, this.Y.getMerchantKey(), this.Y.getTransactionID()));
} catch (Exception e) {
com.payu.upisdk.util.a.c("Class Name:getTransactionID " + str + " " + str2 + e.getMessage());
}
}
public final void g2() {
if (isFinishing() || isDestroyed()) {
return;
}
if (this.d0 == null) {
this.d0 = new PayUProgressDialog(this, com.payu.upisdk.k.SINGLETON.a);
}
this.d0.setCancelable(false);
if (com.payu.upisdk.k.SINGLETON.a != null || isFinishing() || isDestroyed()) {
return;
}
this.d0.setPayUDialogSettings(this);
this.d0.show();
}
@Override
public void getSocketResult(String str, String str2, String str3, boolean z) {
if (str3.equals("success")) {
com.payu.upisdk.k kVar = com.payu.upisdk.k.SINGLETON;
if (kVar.f != null) {
f2("socket_trxn_status_upi_sdk", "success_transaction");
kVar.f.onPaymentSuccess(str2, null);
} else {
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Upi callback class should not be null onPaymentSuccess");
}
} else {
com.payu.upisdk.k kVar2 = com.payu.upisdk.k.SINGLETON;
if (kVar2.f != null) {
f2("socket_trxn_status_upi_sdk_0", "failure_transaction");
kVar2.f.onPaymentFailure(str2, null);
} else {
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Upi callback class should not be null onPaymentFailure");
}
}
if (isFinishing() || isDestroyed()) {
return;
}
finish();
}
public final void h2(String str, String str2) {
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "URL web " + str);
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Postdata web " + str2);
if (this.X != null) {
getWindow().setLayout(-1, -1);
f2("upiCollect_postUrlWebView", str);
this.X.setVisibility(0);
this.X.postUrl(str, str2.getBytes());
}
}
public void onActivityResult(int i, int i2, Intent intent) {
SocketPaymentResponse socketPaymentResponse;
super.onActivityResult(i, i2, intent);
if (i == 101) {
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Result code " + i2 + " Data " + intent);
this.c0 = i2;
String str = null;
String stringExtra = (intent == null || !intent.hasExtra("response")) ? null : intent.getStringExtra("response");
if (i2 != -1 || intent == null) {
f2("cancel", UpiConstant.CUSTOMER_CANCELLED_ON_PSP_APP + "_&_resultCode_" + i2);
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Cancel return");
this.Q.l("cancel", UpiConstant.CUSTOMER_CANCELLED_ON_PSP_APP);
return;
}
if (intent.hasExtra(AnalyticsConstant.CP_GV_STATUS)) {
str = intent.getStringExtra(AnalyticsConstant.CP_GV_STATUS);
} else if (intent.hasExtra("response")) {
str = (String) com.payu.upisdk.util.c.p(intent.getStringExtra("response")).get(AnalyticsConstant.CP_GV_STATUS);
}
f2("payment_app_response", "Status_" + str + "_|_payment_app_response: " + stringExtra);
if (str != null && !str.equalsIgnoreCase(UpiConstant.SUCCESS)) {
com.payu.upisdk.util.a.c("Payment App response " + str);
this.b0 = UpiConstant.GET_RESPONSE_FROM_PSP;
this.Q.l(UpiConstant.FAILURE, UpiConstant.GET_RESPONSE_FROM_PSP);
return;
}
String str2 = this.b0;
f2(PayUNetworkConstant.UPI_SOCKET, "push_enabled");
e eVar = this.a0;
if (eVar == null || (socketPaymentResponse = eVar.o) == null || socketPaymentResponse.getUpiPushDisabled() == null || !this.a0.o.getUpiPushDisabled().equals("0")) {
f2("long_polling_from", "verify_using_http");
this.Q.l(UpiConstant.FAILURE, str2);
} else {
f2("verify_type", "socket");
SocketPaymentResponse socketPaymentResponse2 = new SocketPaymentResponse();
this.e0 = socketPaymentResponse2;
e eVar2 = this.a0;
if (eVar2 != null) {
socketPaymentResponse2.setReferenceId(eVar2.d);
UpiConfig upiConfig = this.Y;
if (upiConfig != null && upiConfig.getTransactionID() != null) {
this.e0.setTxnId(this.Y.getTransactionID());
}
this.e0.setUpiPushDisabled(this.a0.o.getUpiPushDisabled());
this.e0.setUpiServicePollInterval(this.a0.o.getUpiServicePollInterval());
this.e0.setSdkUpiPushExpiry(this.a0.o.getSdkUpiPushExpiry());
this.e0.setSdkUpiVerificationInterval(this.a0.o.getSdkUpiVerificationInterval());
this.e0.setPushServiceUrl(this.a0.o.getPushServiceUrl());
}
SocketPaymentResponse socketPaymentResponse3 = this.e0;
if (socketPaymentResponse3 != null && socketPaymentResponse3.getTxnId() != null) {
SocketHandler.getInstance().createSocket(this.e0, this, this);
}
}
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Return " + UpiConstant.FAILURE);
}
}
@Override
public void onAppSelected(String str, String str2) {
if (this.Y != null && this.W != null) {
f2("_payment_app", "packageName_" + str + "_version_name_" + str2);
}
this.Q.g(str);
}
public void onBackPressed() {
h hVar = new h(this);
if (isFinishing() || isDestroyed()) {
return;
}
AlertDialog.Builder a2 = com.payu.upisdk.util.c.a(this, hVar, Constants.PAYU_OK, "Cancel", null, getString(com.payu.upisdk.h.do_you_really_want_to_cancel_the_transaction));
PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
if (payUUPICallback != null) {
payUUPICallback.onBackButton(a2);
AlertDialog create = a2.create();
this.f0 = create;
create.show();
}
}
public void onCreate(Bundle bundle) {
String str;
super.onCreate(bundle);
if (bundle != null) {
finish();
return;
}
if (getIntent() != null && getIntent().getExtras() != null) {
this.Y = (UpiConfig) getIntent().getExtras().getParcelable(UpiConstant.UPI_CONFIG);
SocketHandler.getInstance().onActivityCreated(this, this);
if (bundle != null) {
if (bundle.get(UpiConstant.IS_UPI_APP_ALREADY_OPENED) != null) {
this.Z = Boolean.valueOf(bundle.getBoolean(UpiConstant.IS_UPI_APP_ALREADY_OPENED));
}
if (bundle.get(UpiConstant.UPI_CONFIG) != null) {
this.Y = (UpiConfig) bundle.getParcelable(UpiConstant.UPI_CONFIG);
}
if (bundle.get(UpiConstant.PAYMENT_RESPONSE) != null) {
this.a0 = (e) bundle.getParcelable(UpiConstant.PAYMENT_RESPONSE);
}
}
UpiConfig upiConfig = this.Y;
if (upiConfig != null) {
this.R = upiConfig.getPayuPostData();
this.V = this.Y.getPaymentType();
this.Y.setProgressDialogCustomView(com.payu.upisdk.k.SINGLETON.a);
if ("upi".equalsIgnoreCase(this.V) || UpiConstant.UPI_COLLECT_GENERIC.equalsIgnoreCase(this.V)) {
setTheme(com.payu.upisdk.i.upi_sdk_opaque_screen);
}
setContentView(com.payu.upisdk.g.activity_payment_response);
this.U = com.payu.upisdk.util.a.a(getApplicationContext());
this.X = (WebView) findViewById(com.payu.upisdk.e.wvCollect);
f2(UpiConstant.PAYMENT_OPTION, this.V.toLowerCase());
f2("paymentType", this.V.toUpperCase());
String lowerCase = this.V.toLowerCase();
lowerCase.hashCode();
switch (lowerCase) {
case "tezomni":
case "teztpv":
case "upitpv":
case "upi":
a();
if (this.V.equalsIgnoreCase(UpiConstant.UPI_COLLECT_TPV)) {
this.W = PaymentOption.UPI_COLLECT_TPV;
} else if (this.V.equalsIgnoreCase(UpiConstant.TEZ_TPV)) {
this.W = PaymentOption.TEZ_TPV;
} else if (this.V.equalsIgnoreCase(UpiConstant.TEZOMNI)) {
this.W = PaymentOption.TEZ_OMNI;
} else {
this.W = PaymentOption.UPI_COLLECT;
}
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Payment Started for UpiCollect >>> " + this.W.getPackageName());
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "PostDataUpiSdk " + this.R);
g2();
String postUrl = this.Y.getPostUrl();
f2("payment_type_state", "launched");
f2("teztpv_url", postUrl);
f2("teztpv_post_data", this.Y.getPayuPostData());
h2(postUrl, this.R);
break;
case "intent":
case "inttpv":
if (this.V.equalsIgnoreCase(UpiConstant.UPI_INTENT_TPV)) {
this.W = PaymentOption.UPI_INTENT_TPV;
} else {
this.W = PaymentOption.UPI_INTENT;
}
PayUUpiUtil.setUpiPackageName(this.Y.getPackageNameForSpecificApp());
if (!isFinishing() && !isDestroyed()) {
e eVar = this.a0;
if (eVar != null && (str = eVar.j) != null) {
this.Q = new d(this, this.R, str);
}
if (this.Z.booleanValue()) {
f2("payment_type_state_2", "_upi_app_already_open");
break;
} else {
this.Q = new d(this, this.R);
this.S = new ArrayList();
Intent intent = new Intent();
intent.setData(Uri.parse("upi://pay?"));
for (ResolveInfo resolveInfo : getPackageManager().queryIntentActivities(intent, 65536)) {
try {
com.payu.upisdk.util.a.c("UPI Installed App....... " + resolveInfo.activityInfo.packageName);
PackageInfo packageInfo = getPackageManager().getPackageInfo(resolveInfo.activityInfo.packageName, 0);
this.S.add(new com.payu.upisdk.upiintent.a((String) getPackageManager().getApplicationLabel(packageInfo.applicationInfo), packageInfo.packageName));
} catch (PackageManager.NameNotFoundException e) {
com.payu.upisdk.util.a.c("getUPIPackagesList - PackageManager.NameNotFoundException" + e.getMessage());
}
}
f2("payment_type_state_1", "launched");
this.Q.k();
break;
}
} else {
f2("launch_error_0", UpiConstant.LAUNCH_ERROR);
break;
}
break;
case "upi_generic":
Upi.isRecreating = true;
a();
g2();
this.W = PaymentOption.UPI_COLLECT_GENERIC;
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Payment Started for UpiCollect >>> " + this.W.getPackageName());
if (getIntent() != null && getIntent().getExtras() != null && getIntent().getStringExtra(UpiConstant.POST_DATA_UPI_COLLECT_GENERIC) != null && getIntent().getStringExtra("returnUrl") != null) {
String string = getIntent().getExtras().getString(UpiConstant.POST_DATA_UPI_COLLECT_GENERIC);
g0 = getIntent().getStringExtra("returnUrl");
f2("payment_type_state_0", "launched");
f2("upi_generic_url", g0);
f2("upi_generic_postdata", string);
h2(g0, string);
break;
} else {
f2("launch_error", UpiConstant.LAUNCH_ERROR);
break;
}
break;
}
}
}
UpiConfig upiConfig2 = this.Y;
PayUUpiUtil.updateLayoutSecurity(this, Boolean.valueOf(upiConfig2 != null && upiConfig2.isProtectedScreen()));
}
public void onDestroy() {
super.onDestroy();
PayUUpiUtil.updateLayoutSecurity(this, Boolean.FALSE);
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "OnDestroy ");
SocketHandler.getInstance().onActivityDestroyed(this);
d dVar = this.Q;
if (dVar != null) {
dVar.c();
}
AlertDialog alertDialog = this.f0;
if (alertDialog != null) {
alertDialog.dismiss();
}
PayUProgressDialog payUProgressDialog = this.d0;
if (payUProgressDialog != null) {
if (payUProgressDialog.isShowing()) {
this.d0.dismiss();
}
this.d0 = null;
}
com.payu.upisdk.util.a.c("Class Name: " + getClass().getCanonicalName() + "Is recreating " + Upi.isRecreating);
if (Upi.isRecreating) {
Upi.isRecreating = false;
return;
}
PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
if (payUUPICallback != null) {
payUUPICallback.onPaymentTerminate();
}
}
@Override
public void onDialogCancelled(boolean z, String str) {
if (!z) {
f2("payment_type_state_3", "No Upi apps present and collect disabled.");
this.Q.l("failure", "No Upi apps present and collect disabled.");
return;
}
if (this.c0 != -1) {
this.Q.l("cancel", str);
}
f2("back_button_cancel", "statusCode_" + this.c0 + "_&_cancelReason_" + str.trim());
}
public void onPause() {
super.onPause();
SocketHandler.getInstance().onActivityPaused(this);
}
@Override
public void onResponse(e eVar) {
ArrayList arrayList;
this.a0 = eVar;
if (eVar == null) {
e2("paymentResponse_null");
return;
}
if (TextUtils.isEmpty(eVar.b) || TextUtils.isEmpty(this.a0.c) || TextUtils.isEmpty(this.a0.d)) {
if (eVar.n != 0 || !TextUtils.isEmpty(eVar.l)) {
e2("paymentStatus_zero_&_paymentResult_blank");
return;
}
String n = com.payu.upisdk.util.c.n(eVar.l);
if (n == null) {
e2("base64Response_null");
return;
}
PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
if (payUUPICallback != null) {
payUUPICallback.onPaymentFailure(n, null);
}
if (isFinishing() || isDestroyed()) {
return;
}
finish();
return;
}
PaymentOption paymentOption = this.W;
if (paymentOption == PaymentOption.TEZ) {
this.Q.g("com.google.android.apps.nbu.paisa.user");
return;
}
if (paymentOption != PaymentOption.UPI_INTENT && paymentOption != PaymentOption.UPI_INTENT_TPV) {
e2("invalid_response");
return;
}
if (isFinishing() || isDestroyed() || this.Z.booleanValue()) {
f2("activity_2", "activity_finished");
return;
}
if (this.Y.getPackageNameForSpecificApp() != null && this.Y.getPackageNameForSpecificApp().length() > 0) {
onAppSelected(this.Y.getPackageNameForSpecificApp(), com.payu.upisdk.util.c.e(this.Y.getPackageNameForSpecificApp(), this));
return;
}
g0 = eVar.b;
this.T = new ArrayList();
List list = eVar.i;
if (list != null && list.size() > 0) {
for (com.payu.upisdk.upiintent.a aVar : eVar.i) {
Iterator it = this.S.iterator();
while (it.hasNext()) {
com.payu.upisdk.upiintent.a aVar2 = (com.payu.upisdk.upiintent.a) it.next();
if (aVar2.equals(aVar)) {
aVar2.a = aVar.a;
this.T.add(aVar2);
it.remove();
}
}
}
}
ArrayList arrayList2 = this.T;
if (arrayList2 != null && (arrayList = this.S) != null) {
arrayList2.addAll(arrayList);
}
com.payu.upisdk.a i5 = com.payu.upisdk.a.i5(this.T, eVar, this.Y, this);
i5.setStyle(0, com.payu.upisdk.i.UpiSdkFullScreenDialogStyle);
i5.setRetainInstance(true);
i5.show(getSupportFragmentManager(), "packageList");
this.Z = Boolean.TRUE;
f2("_payment_app", "show_PackageListDialog");
}
public void onRestoreInstanceState(Bundle bundle) {
super/*android.app.Activity*/.onRestoreInstanceState(bundle);
this.Y = (UpiConfig) bundle.getParcelable(UpiConstant.UPI_CONFIG);
this.a0 = (e) bundle.getParcelable(UpiConstant.PAYMENT_RESPONSE);
this.Z = Boolean.valueOf(bundle.getBoolean(UpiConstant.IS_UPI_APP_ALREADY_OPENED));
}
public void onSaveInstanceState(Bundle bundle) {
super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
bundle.putParcelable(UpiConstant.UPI_CONFIG, this.Y);
bundle.putParcelable(UpiConstant.PAYMENT_RESPONSE, this.a0);
bundle.putBoolean(UpiConstant.IS_UPI_APP_ALREADY_OPENED, this.Z.booleanValue());
}
@Override
public void onSocketCreated() {
SocketHandler.getInstance().startSocketEvents(this.Y.getMerchantKey(), this.Y.getTransactionID(), this, this.Y.getProgressDialogCustomView());
}
@Override
public void transactionCancelled() {
onDialogCancelled(true, UpiConstant.CUSTOMER_CANCELLED_ON_PSP_APP);
}
}