正在查看: Crafto v9.3.3 应用的 TransactionManager.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Crafto v9.3.3 应用的 TransactionManager.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.paytm.pgsdk;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import androidx.annotation.Keep;
import com.paytmpayments.customuisdk.common.Constants.SDKConstants;
import java.util.HashMap;
import mi.i;
import mi.k;
import mi.n;
import mi.o;
import org.json.JSONException;
import org.json.JSONObject;
@Keep
public class TransactionManager {
private String callingBridge;
private PaytmPaymentTransactionCallback mPaymentTransactionCallback;
private PaytmOrder paytmOrder;
private String showPaymentUrl = "https://secure.paytmpayments.com/theia/api/v1/showPaymentPage";
private boolean enableAppInvoke = true;
private boolean enableRedirectionFlow = true;
private boolean isSubscriptionFlow = false;
private boolean isPcfMerchant = false;
private boolean isEmiSubventionEnabled = false;
private Activity mContext = null;
private Integer appInvokeRequestCode = null;
private boolean appInvokedToGetCursor = false;
private String mClientId = null;
private final BroadcastReceiver startTransactionBroadcastReceiver = new a();
private boolean enableAssist = true;
public class a extends BroadcastReceiver {
public a() {
}
@Override
public final void onReceive(android.content.Context r5, android.content.Intent r6) {
throw new UnsupportedOperationException("Method not decompiled: com.paytm.pgsdk.TransactionManager.a.onReceive(android.content.Context, android.content.Intent):void");
}
}
public class b implements Runnable {
public final Activity a;
public b(Activity activity) {
this.a = activity;
}
@Override
public final void run() {
TransactionManager.this.startRedirectionFlow(this.a);
}
}
public TransactionManager() {
}
private String fetchAuthCode(Context context, String str) {
String str2;
if (!isPaytmAppInstalled(context) && this.enableAppInvoke) {
return null;
}
this.appInvokedToGetCursor = false;
Cursor cursorToQueryAuthTokenFromPaytmApp = getCursorToQueryAuthTokenFromPaytmApp(context, str);
String authTokenFromCursor = getAuthTokenFromCursor(cursorToQueryAuthTokenFromPaytmApp);
if (cursorToQueryAuthTokenFromPaytmApp != null && TextUtils.isEmpty(authTokenFromCursor)) {
return null;
}
if (cursorToQueryAuthTokenFromPaytmApp == null || TextUtils.isEmpty(authTokenFromCursor)) {
try {
Intent intent = new Intent();
intent.setComponent(new ComponentName(SDKConstants.PAYTM_APP_PACKAGE, "net.one97.paytm.nativesdk.InvokePaytmTransparentActivity"));
if (intent.resolveActivity(context.getPackageManager()) != null) {
this.appInvokedToGetCursor = true;
context.startActivity(intent);
authTokenFromCursor = getAuthTokenFromCursor(getCursorToQueryAuthTokenFromPaytmApp(context, str));
}
} catch (Exception e) {
n.b(e);
}
}
if (TextUtils.isEmpty(authTokenFromCursor)) {
str2 = "Auth Code is EMPTY";
} else {
str2 = "Auth Code: " + authTokenFromCursor;
}
n.c(str2);
return authTokenFromCursor;
}
private String getAuthTokenFromCursor(Cursor cursor) {
String string;
if (cursor == null) {
return null;
}
cursor.moveToFirst();
do {
string = cursor.getString(cursor.getColumnIndex("auth_code"));
n.c("Found Authtoken credential as " + string);
} while (cursor.moveToNext());
cursor.close();
return string;
}
private Cursor getCursorToQueryAuthTokenFromPaytmApp(Context context, String str) {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("client_id", str);
jSONObject.put("isTrusted", true);
jSONObject.put("shouldMatchMobile", false);
jSONObject.put("package", "net.one97.paytm.nativesdk");
} catch (JSONException e) {
e.printStackTrace();
}
return context.getContentResolver().query(Uri.parse("content://net.one97.paytm.trustlogin.TrustInfo/user/token"), null, jSONObject.toString(), null, null);
}
private HashMap<String, Object> getExtraParams() {
HashMap<String, Object> hashMap = new HashMap<>();
String str = this.callingBridge;
if (str != null && !str.isEmpty()) {
hashMap.put("hybridPlatform", this.callingBridge);
}
if (hashMap.isEmpty()) {
return null;
}
return hashMap;
}
private String getPaytmVersion(Context context) {
try {
return context.getPackageManager().getPackageInfo(SDKConstants.PAYTM_APP_PACKAGE, 0).versionName;
} catch (Exception e) {
i.c().b("AppInvoke", e.getMessage());
n.c("Paytm app not installed");
return null;
}
}
private boolean isEnableAssist() {
return this.enableAssist;
}
private boolean isPaytmAppInstalled(Context context) {
try {
context.getPackageManager().getPackageInfo(SDKConstants.PAYTM_APP_PACKAGE, 0);
i.c().d(SDKConstants.ACTION_PAYTM_APP_EXISTS, "AppInvoke", "exist", "true");
return true;
} catch (Exception unused) {
i.c().d(SDKConstants.ACTION_PAYTM_APP_EXISTS, "AppInvoke", "exist", "false");
n.c("Paytm app not installed");
return false;
}
}
private boolean isSubscriptionFlow() {
return this.isSubscriptionFlow;
}
private void startPaytmAppInvoke(Activity activity, int i) {
double d;
String str;
String str2;
Intent intent = new Intent();
Bundle bundle = new Bundle();
HashMap<String, String> requestParamMap = this.paytmOrder.getRequestParamMap();
String str3 = requestParamMap.get("TXN_AMOUNT");
try {
d = Double.parseDouble(str3);
} catch (NumberFormatException e) {
i.c().b("AppInvoke", e.getMessage());
d = 0.0d;
}
bundle.putBoolean(SDKConstants.KEY_NATIVE_SDK_ENABLED, true);
bundle.putString(SDKConstants.KEY_ORDER_ID, requestParamMap.get("ORDER_ID"));
bundle.putString("txnToken", requestParamMap.get("TXN_TOKEN"));
bundle.putString("mid", requestParamMap.get("MID"));
bundle.putDouble(SDKConstants.KEY_NATIVE_MERCHANT_AMOUNT, d);
String paytmVersion = getPaytmVersion(activity);
i.c().e("app-invoke-bridge", "AppInvoke", i.c().a(this.paytmOrder), paytmVersion);
try {
if (versionCompare(paytmVersion, "8.6.0") < 0) {
intent.setComponent(new ComponentName(SDKConstants.PAYTM_APP_PACKAGE, "net.one97.paytm.AJRJarvisSplash"));
} else {
intent.setComponent(new ComponentName(SDKConstants.PAYTM_APP_PACKAGE, SDKConstants.PAYTM_PAYMENT_ACTIVITY_PACKAGE));
intent.putExtra(SDKConstants.ENABLE_PAYTM_INVOKE, true);
intent.putExtra(SDKConstants.ENABLE_PAYTM_TRANSPARENT_INVOKE, true);
intent.putExtra(SDKConstants.KEY_PRICE, str3);
intent.putExtra(SDKConstants.KEY_NATIVE_SDK_ENABLED, true);
intent.putExtra(SDKConstants.KEY_ORDER_ID, requestParamMap.get("ORDER_ID"));
intent.putExtra("txnToken", requestParamMap.get("TXN_TOKEN"));
intent.putExtra("mid", requestParamMap.get("MID"));
intent.addFlags(134217728);
}
intent.putExtra(SDKConstants.CHECKOUT_PRODUCT, "aio");
intent.putExtra("aio_sdk_version", "1.0.3");
intent.putExtra(SDKConstants.KEY_PAYMENT_MODE, 2);
intent.putExtra(SDKConstants.KEY_BILL, bundle);
intent.putExtra("isFromAIO", true);
HashMap<String, Object> extraParams = getExtraParams();
if (extraParams != null) {
intent.putExtra("extraParams", extraParams);
}
i c = i.c();
c.getClass();
str = "status=";
try {
str2 = "Paytm_App_invoke";
try {
c.e(str2, "AppInvoke", str.concat(SDKConstants.VALUE_SUCCESS), paytmVersion);
try {
activity.startActivityForResult(intent, i);
} catch (Exception unused) {
i c2 = i.c();
c2.getClass();
c2.e(str2, "AppInvoke", str.concat(SDKConstants.VALUE_FAIL), paytmVersion);
startRedirectionFlow(activity);
}
} catch (Exception unused2) {
}
} catch (Exception unused3) {
str2 = "Paytm_App_invoke";
i c22 = i.c();
c22.getClass();
c22.e(str2, "AppInvoke", str.concat(SDKConstants.VALUE_FAIL), paytmVersion);
startRedirectionFlow(activity);
}
} catch (Exception unused4) {
str = "status=";
}
}
public void startRedirectionFlow(Context context) {
k e;
PaytmOrder paytmOrder = this.paytmOrder;
String str = this.showPaymentUrl;
synchronized (k.class) {
try {
HashMap<String, String> requestParamMap = paytmOrder.getRequestParamMap();
if (TextUtils.isEmpty(str)) {
str = "https://secure.paytmpayments.com/theia/api/v1/showPaymentPage";
}
String str2 = requestParamMap.get("ORDER_ID");
String str3 = requestParamMap.get("MID");
e = k.e();
e.b = str + "?mid=" + str3 + "&orderId=" + str2;
o.a().getClass();
} catch (Throwable th2) {
throw th2;
}
}
e.c(this.paytmOrder);
e.h = isEnableAssist();
e.b(context, this.mPaymentTransactionCallback);
}
public void verifyLoginStatusAndStartTxnUsingAuthCodeFlow(Activity activity, int i, String str) {
if (!TextUtils.isEmpty(fetchAuthCode(activity, str))) {
startTransaction(activity, i);
} else if (this.appInvokedToGetCursor) {
new Handler().postDelayed(new b(activity), 2500L);
} else {
startRedirectionFlow(activity);
}
}
private int versionCompare(String str, String str2) {
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
return 1;
}
String[] split = str.split("\\.");
String[] split2 = str2.split("\\.");
int i = 0;
while (i < split.length && i < split2.length && split[i].equalsIgnoreCase(split2[i])) {
i++;
}
return Integer.signum((i >= split.length || i >= split2.length) ? split.length - split2.length : Integer.valueOf(split[i]).compareTo(Integer.valueOf(split2[i])));
}
public String getCallingBridge() {
return this.callingBridge;
}
public void setAppInvokeEnabled(boolean z) {
this.enableAppInvoke = z;
}
public void setCallingBridge(String str) {
this.callingBridge = str;
i.c().a = str;
}
public void setEmiSubventionEnabled(boolean z) {
this.isEmiSubventionEnabled = z;
}
public void setEnableAssist(boolean z) {
this.enableAssist = z;
}
public void setPcfMerchant(boolean z) {
this.isPcfMerchant = z;
}
public void setRedirectionEnabled(boolean z) {
this.enableRedirectionFlow = z;
}
public void setShowPaymentUrl(String str) {
this.showPaymentUrl = str;
}
public void setSubscriptionFlow(boolean z) {
this.isSubscriptionFlow = z;
}
public void startTransaction(Activity activity, int i) {
startTransaction(activity, i, "0.0.0");
}
public void startTransactionAfterCheckingLoginStatus(Activity activity, String str, int i) {
if (!isPaytmAppInstalled(activity) || !this.enableAppInvoke) {
startTransaction(activity, i);
return;
}
this.mContext = activity;
this.appInvokeRequestCode = Integer.valueOf(i);
this.mClientId = str;
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("user_login_status_action");
D2.a.a(activity.getApplicationContext()).b(this.startTransactionBroadcastReceiver, intentFilter);
Intent intent = new Intent(activity, (Class<?>) AioMatchUserActivity.class);
intent.putExtra("check_user_login_only", true);
activity.startActivity(intent);
}
public void startTransactionForONUS(Activity activity, int i) {
startTransaction(activity, i, "8.12.8");
}
public TransactionManager(PaytmOrder paytmOrder, PaytmPaymentTransactionCallback paytmPaymentTransactionCallback) {
if (paytmOrder == null) {
throw new IllegalArgumentException("Transaction params cannot be null");
}
this.mPaymentTransactionCallback = paytmPaymentTransactionCallback;
this.paytmOrder = paytmOrder;
}
public void startTransaction(Activity activity, int i, String str) {
i.c().e(SDKConstants.ACTION_SDK_INITIALIZED, "", i.c().a(this.paytmOrder), "");
String paytmVersion = getPaytmVersion(activity);
if (n.e(activity) && this.enableAppInvoke && versionCompare(paytmVersion, str) >= 0) {
if ((!isSubscriptionFlow() || versionCompare(paytmVersion, "8.10.8") >= 0) && ((!this.isPcfMerchant || versionCompare(paytmVersion, "9.0.0") >= 0) && (!this.isEmiSubventionEnabled || versionCompare(paytmVersion, "9.10.0") >= 0))) {
startPaytmAppInvoke(activity, i);
return;
}
} else if (!this.enableRedirectionFlow) {
this.mPaymentTransactionCallback.onErrorProceed("Some Error Occurred in Selected payment Flow . Please enableRedirectionFlow true ");
n.c("No payment flow opted");
return;
} else {
i.c().d("Paytm_App_invoke", "AppInvoke", SDKConstants.KEY_STATUS, SDKConstants.VALUE_FAIL);
i.c().e("webview-bridge", "Redirection", i.c().a(this.paytmOrder), "");
}
startRedirectionFlow(activity);
}
public void startTransaction(Activity activity, boolean z, String str, String str2, int i) {
boolean isPaytmAppInstalled = isPaytmAppInstalled(activity);
if (TextUtils.isEmpty(str) || !isPaytmAppInstalled || !this.enableAppInvoke || !z) {
startTransaction(activity, i);
return;
}
this.mContext = activity;
this.appInvokeRequestCode = Integer.valueOf(i);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("user_match_result_action");
D2.a.a(activity.getApplicationContext()).b(this.startTransactionBroadcastReceiver, intentFilter);
Intent intent = new Intent(activity, (Class<?>) AioMatchUserActivity.class);
intent.putExtra(SDKConstants.KEY_USER_MOBILE_HASH, str);
intent.putExtra("USER_MOBILE_HASH_2", str2);
activity.startActivity(intent);
}
}