正在查看: Hopscotch v9.7.2 应用的 PaymentResponseUpiSdkActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Hopscotch v9.7.2 应用的 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.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.fragment.app.n;
import com.payu.india.Payu.PayuConstants;
import com.payu.socketverification.interfaces.PayUSocketEventListener;
import com.payu.socketverification.socket.SocketHandler;
import com.payu.socketverification.socket.SocketPaymentResponse;
import com.payu.socketverification.widgets.PayUProgressDialog;
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 in.hopscotch.android.api.factory.OrderReturnApiFactory;
import in.hopscotch.android.api.response.ActionResponse;
import java.util.ArrayList;
import java.util.Iterator;
import org.jetbrains.annotations.NotNull;
public class PaymentResponseUpiSdkActivity extends n implements com.payu.upisdk.upiinterface.a, PayUSocketEventListener {
public static String y;
public f i;
public String j;
public ArrayList<com.payu.upisdk.upiintent.a> k;
public ArrayList<com.payu.upisdk.upiintent.a> l;
public com.payu.payuanalytics.analytics.model.g m;
public String n;
public PaymentOption o;
public WebView p;
public UpiConfig q;
public e s;
public PayUProgressDialog v;
public SocketPaymentResponse w;
public AlertDialog x;
public Boolean r = Boolean.FALSE;
public String t = "";
public int u = 0;
public class a extends WebViewClient {
public a() {
}
@Override
public final void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
?? r1 = PaymentResponseUpiSdkActivity.this;
PayUProgressDialog payUProgressDialog = r1.v;
if (payUProgressDialog == null || !payUProgressDialog.isShowing() || r1.isDestroyed() || r1.isFinishing()) {
return;
}
r1.v.dismiss();
r1.v = null;
}
}
public final void R0(String str, String str2) {
try {
com.payu.payuanalytics.analytics.model.g gVar = this.m;
if (gVar == null || this.q == null) {
return;
}
gVar.i(com.payu.upisdk.util.c.c(getApplicationContext(), str, str2, this.q.getMerchantKey(), this.q.getTransactionID()));
} catch (Exception e) {
com.payu.upisdk.util.a.e("Class Name:getTransactionID " + str + " " + str2 + e.getMessage());
}
}
public final void S0() {
WebView webView = this.p;
if (webView != null) {
webView.getSettings().setJavaScriptEnabled(true);
this.p.addJavascriptInterface(new com.payu.upisdk.upi.a(this, this.m, this.q), "PayU");
this.p.setVisibility(8);
this.p.setWebViewClient(new a());
}
}
public final void T0(String str, String str2) {
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "URL web " + str);
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Postdata web " + str2);
if (this.p != null) {
getWindow().setLayout(-1, -1);
this.p.setVisibility(0);
this.p.postUrl(str, str2.getBytes());
}
}
public final void U0() {
if (isFinishing() || isDestroyed()) {
return;
}
if (this.v == null) {
this.v = new PayUProgressDialog(this, com.payu.upisdk.k.SINGLETON.a);
}
this.v.setCancelable(false);
if (com.payu.upisdk.k.SINGLETON.a != null || isFinishing() || isDestroyed()) {
return;
}
this.v.setPayUDialogSettings(this);
this.v.show();
}
public final void a() {
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + " Err 1002");
R0(" MERCHANT_INFO_NOT_PRESENT", "ErrorListener_code_1002");
PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
if (payUUPICallback != null) {
payUUPICallback.onUpiErrorReceived(1002, "MERCHANT_INFO_NOT_PRESENT");
}
if (isFinishing() || isDestroyed()) {
return;
}
finish();
}
@Override
public final void errorReceived(int i, String str) {
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Error Received " + str);
StringBuilder sb = new StringBuilder("Technical Error_errorMessage_");
sb.append(str);
R0("socket_cancel", sb.toString());
if (i == 1003) {
f fVar = this.i;
if (fVar != null) {
fVar.i(OrderReturnApiFactory.REFUND_TYPE_CANCEL, UpiConstant.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.e("Class Name: " + getClass().getCanonicalName() + "Upi callback class should not be null onPaymentSuccess");
}
if (isFinishing() || isDestroyed()) {
return;
}
finish();
}
@Override
public final 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) {
R0("socket_trxn_status_upi_sdk", "success_transaction");
kVar.f.onPaymentSuccess(str2, null);
} else {
com.payu.upisdk.util.a.e("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) {
R0("socket_trxn_status_upi_sdk", "failure_transaction");
kVar2.f.onPaymentFailure(str2, null);
} else {
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Upi callback class should not be null onPaymentFailure");
}
}
if (isFinishing() || isDestroyed()) {
return;
}
finish();
}
public final void onActivityResult(int i, int i2, Intent intent) {
SocketPaymentResponse socketPaymentResponse;
super.onActivityResult(i, i2, intent);
if (i == 101) {
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Result code " + i2 + " Data " + intent);
this.u = i2;
String str = null;
String stringExtra = (intent == null || !intent.hasExtra("response")) ? null : intent.getStringExtra("response");
if (i2 != -1 || intent == null) {
R0(OrderReturnApiFactory.REFUND_TYPE_CANCEL, "Customer cancelled on PSP App resultCode " + i2);
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Cancel return");
this.i.i(OrderReturnApiFactory.REFUND_TYPE_CANCEL, UpiConstant.CUSTOMER_CANCELLED_ON_PSP_APP);
return;
}
if (intent.hasExtra("Status")) {
str = intent.getStringExtra("Status");
} else if (intent.hasExtra("response")) {
str = com.payu.upisdk.util.c.o(intent.getStringExtra("response")).get("Status");
}
PaymentOption paymentOption = this.o;
if (paymentOption != null && paymentOption.getAnalyticsKey() != null) {
R0(this.o.getAnalyticsKey().toLowerCase() + " _payment_app_response", android.support.v4.media.b.j("status_", str, "__payment_app_response_", stringExtra));
}
if (str != null && !str.equalsIgnoreCase("SUCCESS")) {
com.payu.upisdk.util.a.e("Payment App response ".concat(str));
this.t = UpiConstant.GET_RESPONSE_FROM_PSP;
this.i.i(UpiConstant.FAILURE, UpiConstant.GET_RESPONSE_FROM_PSP);
return;
}
String str2 = this.t;
R0("upi_socket", UpiConstant.PUSH_ENABLED);
e eVar = this.s;
if (eVar == null || (socketPaymentResponse = eVar.o) == null || socketPaymentResponse.getUpiPushDisabled() == null || !this.s.o.getUpiPushDisabled().equals(PayuConstants.STRING_ZERO)) {
R0("long_polling_from", "verify_using_http");
this.i.i(UpiConstant.FAILURE, str2);
} else {
R0(UpiConstant.VERIFY_TYPE, UpiConstant.SOCKET);
SocketPaymentResponse socketPaymentResponse2 = new SocketPaymentResponse();
this.w = socketPaymentResponse2;
e eVar2 = this.s;
if (eVar2 != null) {
socketPaymentResponse2.setReferenceId(eVar2.d);
UpiConfig upiConfig = this.q;
if (upiConfig != null && upiConfig.getTransactionID() != null) {
this.w.setTxnId(this.q.getTransactionID());
}
this.w.setUpiPushDisabled(this.s.o.getUpiPushDisabled());
this.w.setUpiServicePollInterval(this.s.o.getUpiServicePollInterval());
this.w.setSdkUpiPushExpiry(this.s.o.getSdkUpiPushExpiry());
this.w.setSdkUpiVerificationInterval(this.s.o.getSdkUpiVerificationInterval());
this.w.setPushServiceUrl(this.s.o.getPushServiceUrl());
}
SocketPaymentResponse socketPaymentResponse3 = this.w;
if (socketPaymentResponse3 != null && socketPaymentResponse3.getTxnId() != null) {
SocketHandler.getInstance().createSocket(this.w, this, this);
}
}
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Return FAILURE");
}
}
@Override
public final void onAppSelected(String str, String str2) {
PaymentOption paymentOption;
if (this.q != null && (paymentOption = this.o) != null && paymentOption.getAnalyticsKey() != null) {
R0(this.o.getAnalyticsKey().toLowerCase() + "_payment_app", android.support.v4.media.b.j("packageName_", str, "_version_name_", str2));
}
this.i.f(str);
}
public final void onBackPressed() {
g gVar = new g(this);
if (isFinishing() || isDestroyed()) {
return;
}
String string = getString(com.payu.upisdk.g.do_you_really_want_to_cancel_the_transaction);
AlertDialog.Builder builder = new AlertDialog.Builder(this, com.payu.upisdk.h.upi_sdk_dialog);
if (string != null) {
builder.setMessage(string);
}
builder.setPositiveButton("Ok", gVar);
builder.setNegativeButton("Cancel", gVar);
PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
if (payUUPICallback != null) {
payUUPICallback.onBackButton(builder);
AlertDialog create = builder.create();
this.x = create;
create.show();
}
}
public final void onCreate(Bundle bundle) {
String str;
super.onCreate(bundle);
if (bundle != null) {
finish();
}
if (getIntent() == null || getIntent().getExtras() == null) {
return;
}
this.q = (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.r = Boolean.valueOf(bundle.getBoolean(UpiConstant.IS_UPI_APP_ALREADY_OPENED));
}
if (bundle.get(UpiConstant.UPI_CONFIG) != null) {
this.q = (UpiConfig) bundle.getParcelable(UpiConstant.UPI_CONFIG);
}
if (bundle.get(UpiConstant.PAYMENT_RESPONSE) != null) {
this.s = (e) bundle.getParcelable(UpiConstant.PAYMENT_RESPONSE);
}
}
UpiConfig upiConfig = this.q;
if (upiConfig != null) {
this.j = upiConfig.getPayuPostData();
this.n = this.q.getPaymentType();
this.q.setProgressDialogCustomView(com.payu.upisdk.k.SINGLETON.a);
if ("upi".equalsIgnoreCase(this.n) || UpiConstant.UPI_COLLECT_GENERIC.equalsIgnoreCase(this.n)) {
setTheme(com.payu.upisdk.h.upi_sdk_opaque_screen);
}
setContentView(com.payu.upisdk.f.activity_payment_response);
this.m = com.payu.upisdk.util.a.a(getApplicationContext());
this.p = (WebView) findViewById(com.payu.upisdk.d.wvCollect);
R0(UpiConstant.PAYMENT_OPTION, this.n.toLowerCase());
String lowerCase = this.n.toLowerCase();
lowerCase.getClass();
switch (lowerCase) {
case "tezomni":
case "teztpv":
case "upitpv":
case "upi":
S0();
if (this.n.equalsIgnoreCase(UpiConstant.UPI_COLLECT_TPV)) {
this.o = PaymentOption.UPI_COLLECT_TPV;
} else if (this.n.equalsIgnoreCase(UpiConstant.TEZ_TPV)) {
this.o = PaymentOption.TEZ_TPV;
} else if (this.n.equalsIgnoreCase(UpiConstant.TEZOMNI)) {
this.o = PaymentOption.TEZ_OMNI;
} else {
this.o = PaymentOption.UPI_COLLECT;
}
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Payment Started for UpiCollect >>> " + this.o.getPackageName());
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "PostDataUpiSdk " + this.j);
U0();
String postUrl = this.q.getPostUrl();
PaymentOption paymentOption = this.o;
if (paymentOption != null && paymentOption.getAnalyticsKey() != null) {
R0(this.o.getAnalyticsKey().toLowerCase(), this.o.getAnalyticsKey().toLowerCase() + UpiConstant.LAUNCHED);
R0(this.o.getAnalyticsKey().toLowerCase() + "_url_", postUrl);
R0(this.o.getAnalyticsKey().toLowerCase() + "_postdata_", this.q.getPayuPostData());
}
T0(postUrl, this.j);
break;
case "intent":
case "inttpv":
if (this.n.equalsIgnoreCase(UpiConstant.UPI_INTENT_TPV)) {
this.o = PaymentOption.UPI_INTENT_TPV;
} else {
this.o = PaymentOption.UPI_INTENT;
}
PayUUpiUtil.setUpiPackageName(this.q.getPackageNameForSpecificApp());
if (isFinishing() || isDestroyed()) {
PaymentOption paymentOption2 = this.o;
if (paymentOption2 != null && paymentOption2.getAnalyticsKey() != null) {
R0(this.o.getAnalyticsKey().toLowerCase(), this.o.getAnalyticsKey().toLowerCase() + UpiConstant.LAUNCH_ERROR);
break;
}
} else {
e eVar = this.s;
if (eVar != null && (str = eVar.j) != null) {
this.i = new f(this, this.j, str);
}
if (!this.r.booleanValue()) {
this.i = new f(this, this.j);
this.k = new ArrayList<>();
Intent intent = new Intent();
intent.setData(Uri.parse(UpiConstant.CP_UPI_INTENT_PREFIX));
for (ResolveInfo resolveInfo : getPackageManager().queryIntentActivities(intent, 65536)) {
try {
com.payu.upisdk.util.a.e("UPI Installed App....... " + resolveInfo.activityInfo.packageName);
PackageInfo packageInfo = getPackageManager().getPackageInfo(resolveInfo.activityInfo.packageName, 0);
this.k.add(new com.payu.upisdk.upiintent.a((String) getPackageManager().getApplicationLabel(packageInfo.applicationInfo), packageInfo.packageName));
} catch (PackageManager.NameNotFoundException e) {
com.payu.upisdk.util.a.e("getUPIPackagesList - PackageManager.NameNotFoundException" + e.getMessage());
}
}
PaymentOption paymentOption3 = this.o;
if (paymentOption3 != null && paymentOption3.getAnalyticsKey() != null) {
R0(this.o.getAnalyticsKey().toLowerCase(), this.o.getAnalyticsKey().toLowerCase() + UpiConstant.LAUNCHED);
}
this.i.h();
break;
} else {
PaymentOption paymentOption4 = this.o;
if (paymentOption4 != null && paymentOption4.getAnalyticsKey() != null) {
R0(this.o.getAnalyticsKey().toLowerCase(), this.o.getAnalyticsKey().toLowerCase() + UpiConstant.UPI_APP_ALREADY_OPEN);
break;
}
}
}
break;
case "upi_generic":
Upi.isRecreating = true;
S0();
U0();
this.o = PaymentOption.UPI_COLLECT_GENERIC;
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "Payment Started for UpiCollect >>> " + this.o.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);
y = getIntent().getStringExtra("returnUrl");
PaymentOption paymentOption5 = this.o;
if (paymentOption5 != null && paymentOption5.getAnalyticsKey() != null) {
R0(this.o.getAnalyticsKey().toLowerCase(), this.o.getAnalyticsKey().toLowerCase() + UpiConstant.LAUNCHED);
R0(this.o.getAnalyticsKey().toLowerCase() + "_url_", y);
R0(this.o.getAnalyticsKey().toLowerCase() + "_postdata_", string);
}
T0(y, string);
break;
} else {
PaymentOption paymentOption6 = this.o;
if (paymentOption6 != null && paymentOption6.getAnalyticsKey() != null) {
R0(this.o.getAnalyticsKey().toLowerCase(), this.o.getAnalyticsKey().toLowerCase() + UpiConstant.LAUNCH_ERROR);
break;
}
}
break;
}
}
}
public final void onDestroy() {
super.onDestroy();
com.payu.upisdk.util.a.e("Class Name: " + getClass().getCanonicalName() + "OnDestroy ");
SocketHandler.getInstance().onActivityDestroyed(this);
f fVar = this.i;
if (fVar != null) {
PayUProgressDialog payUProgressDialog = fVar.c;
if (payUProgressDialog != null && !payUProgressDialog.isShowing()) {
fVar.c.dismiss();
fVar.c = null;
}
fVar.a = null;
}
AlertDialog alertDialog = this.x;
if (alertDialog != null) {
alertDialog.dismiss();
}
PayUProgressDialog payUProgressDialog2 = this.v;
if (payUProgressDialog2 != null) {
if (payUProgressDialog2.isShowing()) {
this.v.dismiss();
}
this.v = null;
}
com.payu.upisdk.util.a.e("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 final void onDialogCancelled(boolean z, String str) {
PaymentOption paymentOption;
PaymentOption paymentOption2;
if (!z) {
if (this.q != null && (paymentOption = this.o) != null && paymentOption.getAnalyticsKey() != null) {
R0(this.o.getAnalyticsKey().toLowerCase(), "No Upi apps present and collect disabled.");
}
this.i.i(ActionResponse.FAILURE, "No Upi apps present and collect disabled.");
return;
}
if (this.u != -1) {
this.i.i(OrderReturnApiFactory.REFUND_TYPE_CANCEL, str);
}
if (this.q == null || (paymentOption2 = this.o) == null || paymentOption2.getAnalyticsKey() == null) {
return;
}
R0(this.o.getAnalyticsKey().toLowerCase(), "back_button_cancel_statusCode_" + this.u + "_cancelReason " + str);
}
public final void onPause() {
super.onPause();
SocketHandler.getInstance().onActivityPaused(this);
}
@Override
public final void onResponse(e eVar) {
ArrayList<com.payu.upisdk.upiintent.a> arrayList;
this.s = eVar;
if (eVar == null) {
a();
return;
}
if (TextUtils.isEmpty(eVar.b) || TextUtils.isEmpty(this.s.c) || TextUtils.isEmpty(this.s.d)) {
if (eVar.n != 0 || !TextUtils.isEmpty(eVar.l)) {
a();
return;
}
String m = com.payu.upisdk.util.c.m(eVar.l);
if (m == null) {
a();
return;
}
PayUUPICallback payUUPICallback = com.payu.upisdk.k.SINGLETON.f;
if (payUUPICallback != null) {
payUUPICallback.onPaymentFailure(m, null);
}
if (isFinishing() || isDestroyed()) {
return;
}
finish();
return;
}
PaymentOption paymentOption = this.o;
if (paymentOption == PaymentOption.TEZ) {
this.i.f(UpiConstant.PACKAGE_ID_GOOGLEPAY);
return;
}
if (paymentOption != PaymentOption.UPI_INTENT && paymentOption != PaymentOption.UPI_INTENT_TPV) {
a();
return;
}
if (isFinishing() || isDestroyed() || this.r.booleanValue()) {
R0("activity", "_activity_finished");
return;
}
if (this.q.getPackageNameForSpecificApp() != null && this.q.getPackageNameForSpecificApp().length() > 0) {
onAppSelected(this.q.getPackageNameForSpecificApp(), com.payu.upisdk.util.c.b(this, this.q.getPackageNameForSpecificApp()));
return;
}
y = eVar.b;
this.l = new ArrayList<>();
ArrayList arrayList2 = eVar.i;
if (arrayList2 != null && arrayList2.size() > 0) {
for (com.payu.upisdk.upiintent.a aVar : eVar.i) {
Iterator<com.payu.upisdk.upiintent.a> it = this.k.iterator();
while (it.hasNext()) {
com.payu.upisdk.upiintent.a next = it.next();
if (next.equals(aVar)) {
next.a = aVar.a;
this.l.add(next);
it.remove();
}
}
}
}
ArrayList<com.payu.upisdk.upiintent.a> arrayList3 = this.l;
if (arrayList3 != null && (arrayList = this.k) != null) {
arrayList3.addAll(arrayList);
}
com.payu.upisdk.j A = com.payu.upisdk.j.A(this.l, eVar, this.q);
A.setStyle(0, com.payu.upisdk.h.UpiSdkFullScreenDialogStyle);
A.setRetainInstance(true);
A.show(getSupportFragmentManager(), "packageList");
this.r = Boolean.TRUE;
R0("_payment_app", "show_PackageListDialog");
}
public final void onRestoreInstanceState(@NotNull Bundle bundle) {
super/*android.app.Activity*/.onRestoreInstanceState(bundle);
this.q = (UpiConfig) bundle.getParcelable(UpiConstant.UPI_CONFIG);
this.s = (e) bundle.getParcelable(UpiConstant.PAYMENT_RESPONSE);
this.r = Boolean.valueOf(bundle.getBoolean(UpiConstant.IS_UPI_APP_ALREADY_OPENED));
}
public final void onSaveInstanceState(@NotNull Bundle bundle) {
super/*androidx.activity.j*/.onSaveInstanceState(bundle);
bundle.putParcelable(UpiConstant.UPI_CONFIG, this.q);
bundle.putParcelable(UpiConstant.PAYMENT_RESPONSE, this.s);
bundle.putBoolean(UpiConstant.IS_UPI_APP_ALREADY_OPENED, this.r.booleanValue());
}
@Override
public final void onSocketCreated() {
SocketHandler.getInstance().startSocketEvents(this.q.getMerchantKey(), this.q.getTransactionID(), this, this.q.getProgressDialogCustomView());
}
@Override
public final void transactionCancelled() {
onDialogCancelled(true, UpiConstant.CUSTOMER_CANCELLED_ON_PSP_APP);
}
}