iKredit v1.2.0.3版本的 MD5 值为:2c00c5c79eecbd6be4c3c546c28d778d
以下内容为反编译后的 CFUPIPaymentActivity.java 源代码,内容仅作参考
package com.gocashfree.cashfreesdk.ui.upi;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import com.android.sdklibrary.utils.RSAUtilForAndroid;
import com.gocashfree.cashfreesdk.CFPaymentService;
import com.gocashfree.cashfreesdk.R;
import com.gocashfree.cashfreesdk.a.c.a.f;
import com.gocashfree.cashfreesdk.d.a;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.j256.ormlite.stmt.query.SimpleComparison;
import java.net.URLDecoder;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.json.JSONObject;
public class CFUPIPaymentActivity extends com.gocashfree.cashfreesdk.c.b {
private static final String p = CFUPIPaymentActivity.class.getName();
private BottomSheetDialog o;
public class a implements Comparator<ResolveInfo> {
a() {
}
@Override
public int compare(ResolveInfo resolveInfo, ResolveInfo resolveInfo2) {
String upperCase = CFUPIPaymentActivity.this.getPackageManager().getApplicationLabel(resolveInfo.activityInfo.applicationInfo).toString().toUpperCase();
String upperCase2 = CFUPIPaymentActivity.this.getPackageManager().getApplicationLabel(resolveInfo2.activityInfo.applicationInfo).toString().toUpperCase();
if (com.gocashfree.cashfreesdk.ui.upi.a.c.containsKey(upperCase) && com.gocashfree.cashfreesdk.ui.upi.a.c.containsKey(upperCase2)) {
return com.gocashfree.cashfreesdk.ui.upi.a.c.get(upperCase).intValue() < com.gocashfree.cashfreesdk.ui.upi.a.c.get(upperCase2).intValue() ? -1 : 0;
}
if (com.gocashfree.cashfreesdk.ui.upi.a.c.containsKey(upperCase)) {
return -1;
}
return com.gocashfree.cashfreesdk.ui.upi.a.c.containsKey(upperCase2) ? 1 : 0;
}
}
public class b implements DialogInterface.OnDismissListener {
b() {
}
@Override
public void onDismiss(DialogInterface dialogInterface) {
if (!((com.gocashfree.cashfreesdk.c.b) CFUPIPaymentActivity.this).k) {
CFUPIPaymentActivity.this.g();
} else {
((com.gocashfree.cashfreesdk.c.b) CFUPIPaymentActivity.this).k = false;
}
}
}
public class c implements DialogInterface.OnCancelListener {
c() {
}
@Override
public void onCancel(DialogInterface dialogInterface) {
if (!((com.gocashfree.cashfreesdk.c.b) CFUPIPaymentActivity.this).k) {
CFUPIPaymentActivity.this.g();
} else {
((com.gocashfree.cashfreesdk.c.b) CFUPIPaymentActivity.this).k = false;
}
}
}
public class d implements AdapterView.OnItemClickListener {
final List a;
d(List list) {
this.a = list;
}
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse(((com.gocashfree.cashfreesdk.c.a) CFUPIPaymentActivity.this).c.getString("payLink")));
ResolveInfo resolveInfo = (ResolveInfo) this.a.get(i);
ActivityInfo activityInfo = resolveInfo.activityInfo;
intent.setClassName(activityInfo.packageName, activityInfo.name);
((com.gocashfree.cashfreesdk.c.a) CFUPIPaymentActivity.this).c.putString("selectedApp", resolveInfo.activityInfo.packageName);
com.gocashfree.cashfreesdk.d.c.a(CFUPIPaymentActivity.p, "Selected app package: " + CFUPIPaymentActivity.this.getPackageManager().getApplicationLabel(resolveInfo.activityInfo.applicationInfo).toString());
CFUPIPaymentActivity.this.startActivityForResult(intent, 1);
((com.gocashfree.cashfreesdk.c.b) CFUPIPaymentActivity.this).k = true;
CFUPIPaymentActivity.this.o.dismiss();
}
}
public class e implements com.gocashfree.cashfreesdk.a.c.a.b {
e(CFUPIPaymentActivity cFUPIPaymentActivity) {
}
@Override
public void a(String str) {
}
}
public class f implements com.gocashfree.cashfreesdk.a.c.a.a {
f(CFUPIPaymentActivity cFUPIPaymentActivity) {
}
@Override
public void a(String str) {
}
}
private void l() {
this.d.a(a.EnumC0034a.UPI_LIST_OPENED);
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(this.c.getString("payLink")));
List<ResolveInfo> queryIntentActivities = getPackageManager().queryIntentActivities(intent, 0);
if (!queryIntentActivities.isEmpty()) {
Iterator<ResolveInfo> it = queryIntentActivities.iterator();
while (it.hasNext()) {
if (it.next().activityInfo.packageName.toLowerCase().contains("com.whatsapp")) {
it.remove();
}
}
}
Collections.sort(queryIntentActivities, new a());
if (queryIntentActivities.size() > 0) {
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this);
this.o = bottomSheetDialog;
bottomSheetDialog.setContentView(R.layout.bottomsheet_layout);
BottomSheetListView bottomSheetListView = (BottomSheetListView) this.o.findViewById(R.id.listViewBtmSheet);
bottomSheetListView.setAdapter((ListAdapter) new com.gocashfree.cashfreesdk.ui.upi.b(this, queryIntentActivities, this.c));
this.o.setOnDismissListener(new b());
this.o.setOnCancelListener(new c());
bottomSheetListView.setOnItemClickListener(new d(queryIntentActivities));
this.o.show();
return;
}
a("No UPI Apps found.", false);
}
private void m() {
String string = this.c.getString("upiClientPackage");
if (string != null && !string.isEmpty()) {
d(string);
} else {
l();
}
e("");
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
this.k = false;
if (intent != null && intent.getExtras() != null && intent.getExtras().get("response") != null) {
String str = (String) intent.getExtras().get("response");
String[] strArr = new String[0];
if (str != null) {
strArr = str.split("\\&");
} else {
a("Unexpected Response", false);
}
try {
String str2 = "FAILED";
String str3 = null;
for (String str4 : strArr) {
String[] split = str4.split(SimpleComparison.EQUAL_TO_OPERATION);
String decode = URLDecoder.decode(split[0], RSAUtilForAndroid.CHARSET);
String decode2 = split.length > 1 ? URLDecoder.decode(split[1], RSAUtilForAndroid.CHARSET) : null;
if (decode.equalsIgnoreCase("Status")) {
str2 = decode2;
}
if (decode.equalsIgnoreCase("txnId")) {
str3 = decode2;
}
}
if (str2 != null && str2.equalsIgnoreCase("SUCCESS")) {
com.gocashfree.cashfreesdk.d.c.a(p, "Handling success or no status");
} else {
com.gocashfree.cashfreesdk.d.c.a(p, "Handling all non success scenarios");
String string = this.c.getString("selectedApp");
e(string);
if (string != null && !string.isEmpty() && com.gocashfree.cashfreesdk.ui.upi.a.a.contains(string)) {
com.gocashfree.cashfreesdk.d.c.a(p, "Known App package:" + string);
if (str3 != null && !com.gocashfree.cashfreesdk.ui.upi.a.b.contains(str3.toLowerCase())) {
com.gocashfree.cashfreesdk.d.c.a(p, "Payment failed in UPI app");
a("Payment failed in UPI app", false);
return;
} else {
com.gocashfree.cashfreesdk.d.c.a(p, "Cancelled in UPI app");
g();
return;
}
}
com.gocashfree.cashfreesdk.d.c.a(p, "Non popular app");
}
j();
return;
} catch (Exception e2) {
e2.printStackTrace();
com.gocashfree.cashfreesdk.d.c.a(p, "Payment Failed");
com.gocashfree.cashfreesdk.d.c.a(p, "Scenario Unable to parse application response");
a("Unable to parse application response", true);
return;
}
}
com.gocashfree.cashfreesdk.d.c.a(p, "Cancelled from UPI app");
com.gocashfree.cashfreesdk.d.c.a(p, "Scenario response null");
j();
}
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_cfupipayment);
f.b bVar = f.b.UPI;
this.j = bVar;
if (this.k) {
return;
}
a(bVar);
}
@Override
public boolean onNavigateUp() {
onBackPressed();
return true;
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
private void d(String str) {
ResolveInfo resolveInfo;
boolean z;
this.d.a(a.EnumC0034a.UPI_APP_OPENED);
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse(this.c.getString("payLink")));
Iterator<ResolveInfo> it = getPackageManager().queryIntentActivities(intent, 0).iterator();
while (true) {
if (!it.hasNext()) {
resolveInfo = null;
z = false;
break;
} else {
resolveInfo = it.next();
com.gocashfree.cashfreesdk.d.c.a(p, resolveInfo.activityInfo.packageName);
if (resolveInfo.activityInfo.packageName.equals(str)) {
z = true;
break;
}
}
}
if (z) {
ActivityInfo activityInfo = resolveInfo.activityInfo;
intent.setClassName(activityInfo.packageName, activityInfo.name);
this.c.putString("selectedApp", resolveInfo.activityInfo.packageName);
com.gocashfree.cashfreesdk.d.c.a(p, "Pre Selected app package: " + getPackageManager().getApplicationLabel(resolveInfo.activityInfo.applicationInfo).toString());
this.k = true;
startActivityForResult(intent, 1001);
return;
}
a("Upi client not found", false);
}
private void e(String str) {
HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("appVersion", "1.4.9.4");
hashMap.put(CFPaymentService.PARAM_APP_ID, this.c.getString(CFPaymentService.PARAM_APP_ID));
hashMap.put("selectedApp", str);
hashMap.put("paymentMode", "UPI");
new com.gocashfree.cashfreesdk.a.c.a.c().a(this, c(), hashMap, new e(this), new f(this));
}
@Override
protected void a(JSONObject jSONObject) {
this.c.putString("payLink", jSONObject.getString("payLink"));
com.gocashfree.cashfreesdk.d.c.a(p, "paylink = " + this.c.getString("payLink"));
m();
}
}