iKredit v1.2.0.3版本的 MD5 值为:2c00c5c79eecbd6be4c3c546c28d778d
以下内容为反编译后的 RzpAssist.java 源代码,内容仅作参考
package com.razorpay;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.view.inputmethod.InputMethodManager;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.widget.Toast;
import com.facebook.internal.ServerProtocol;
import com.facebook.share.internal.ShareConstants;
import com.razorpay.AnalyticsProperty;
import java.util.HashMap;
import org.json.JSONObject;
public final class RzpAssist implements U$_z$ {
private Activity B$$W$;
private Q__v$ D$_X_;
private String J$_0_;
private String L__R$;
private Object Y$_o$$53b81d6a;
private long a_$P$;
private String b__J_;
private WebView d__1_;
private int g__v_;
private String l_$w$;
private boolean G__G_ = false;
private String Q_$2$ = "";
private String R$$r_ = "";
private boolean E$_j$ = false;
private boolean r$_Y_ = false;
private JSONObject c__C_ = new JSONObject();
private JSONObject E$_6$ = new JSONObject();
private boolean O_$B_ = false;
private boolean f$_G$ = false;
private boolean l__d$ = false;
static boolean G__G_(RzpAssist rzpAssist) {
rzpAssist.f$_G$ = true;
return true;
}
static boolean a_$P$(RzpAssist rzpAssist) {
rzpAssist.r$_Y_ = true;
return true;
}
public RzpAssist(String str, Activity activity, WebView webView, String str2, int i, String str3) {
this.J$_0_ = "standalone";
if (g__v_.f$_G$().r$_Y_().booleanValue()) {
if (str == null || str.isEmpty()) {
throw new RuntimeException("merchantKey cannot be null or empty");
}
this.J$_0_ = str2;
this.g__v_ = i;
if (str2.equals("standalone")) {
AnalyticsUtil.setup(activity, str, str2, i, str3);
}
this.d__1_ = webView;
this.b__J_ = str;
this.B$$W$ = activity;
try {
Object newInstance = ((Class) h__y_.a_$P$(18, 18, (char) 15392)).getDeclaredConstructor(Activity.class).newInstance(activity);
this.Y$_o$$53b81d6a = newInstance;
try {
((Class) h__y_.a_$P$(18, 18, (char) 15392)).getDeclaredMethod("a_$P$", null).invoke(newInstance, null);
if (Q__v$.Q_$2$ == null) {
Q__v$.Q_$2$ = new Q__v$();
}
Q__v$ q__v$ = Q__v$.Q_$2$;
this.D$_X_ = q__v$;
q__v$.a_$P$.add(this);
this.D$_X_.d__1_(this.B$$W$);
this.d__1_.addJavascriptInterface(this, "OTPElfBridge");
this.d__1_.getSettings().setUseWideViewPort(true);
AnalyticsUtil.addProperty("OTPElf Version", new AnalyticsProperty(BaseUtils.getLocalVersion(activity, (String) ((Class) h__y_.a_$P$(18, 18, (char) 15392)).getField("Q_$2$").get(null)), AnalyticsProperty.d__1_.ORDER));
} catch (Throwable th) {
Throwable cause = th.getCause();
if (cause == null) {
throw th;
}
throw cause;
}
} catch (Throwable th2) {
Throwable cause2 = th2.getCause();
if (cause2 == null) {
throw th2;
}
throw cause2;
}
}
}
public final void G__G_(JSONObject jSONObject) {
this.E$_6$ = jSONObject;
}
public final void setOtpElfPreferences(JSONObject jSONObject) {
this.c__C_ = jSONObject;
}
public final void onPageFinished(WebView webView, String str) {
AnalyticsUtil.trackPageLoadEnd(str, System.nanoTime() - this.a_$P$);
this.Q_$2$ = str;
this.R$$r_ = "";
if (g__v_.f$_G$().r$_Y_().booleanValue() && !this.l__d$) {
try {
JSONObject D$_X_ = g__v_.f$_G$().D$_X_();
D$_X_.put("merchant_key", this.b__J_);
D$_X_.put("otp_permission", this.G__G_);
JSONObject jSONObject = new JSONObject();
jSONObject.put("type", this.J$_0_);
jSONObject.put("version_code", this.g__v_);
D$_X_.put(ServerProtocol.DIALOG_PARAM_SDK_VERSION, jSONObject);
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("type", "rzpassist");
jSONObject2.put("version_code", J$_0_.R$$r_.intValue());
D$_X_.put("plugin", jSONObject2);
D$_X_.put("payment_data", this.E$_6$);
D$_X_.put("preferences", this.c__C_);
StringBuilder sb = new StringBuilder("window.__rzp_options = ");
sb.append(D$_X_.toString());
this.d__1_.loadUrl(String.format("javascript: %s", sb.toString()));
} catch (Exception unused) {
}
try {
this.d__1_.loadUrl(String.format("javascript: %s", ((Class) h__y_.a_$P$(18, 18, (char) 15392)).getDeclaredMethod("Q_$2$", null).invoke(this.Y$_o$$53b81d6a, null)));
String str2 = this.L__R$;
if (str2 != null) {
this.d__1_.loadUrl(String.format("javascript: %s", String.format("OTPElf.elfBridge.setSms(%s)", str2)));
this.L__R$ = null;
}
this.l__d$ = true;
} catch (Throwable th) {
Throwable cause = th.getCause();
if (cause == null) {
throw th;
}
throw cause;
}
}
}
public final void onProgressChanged(int i) {
if (!g__v_.f$_G$().r$_Y_().booleanValue()) {
}
}
public final void onPageStarted(WebView webView, String str) {
AnalyticsUtil.trackPageLoadStart(str);
this.a_$P$ = System.nanoTime();
this.R$$r_ = str;
this.l__d$ = false;
}
public final void paymentFlowEnd() {
if (this.J$_0_.equals("standalone")) {
AnalyticsUtil.postData();
}
if (g__v_.f$_G$().r$_Y_().booleanValue()) {
this.D$_X_.a_$P$(this.B$$W$);
try {
this.D$_X_.a_$P$.remove(this);
} catch (Exception unused) {
}
}
}
@Override
public final void postSms(String str, String str2) {
if (this.O_$B_) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("sender", str);
jSONObject.put(ShareConstants.WEB_DIALOG_PARAM_MESSAGE, str2);
String jSONObject2 = jSONObject.toString();
this.L__R$ = jSONObject2;
this.d__1_.loadUrl(String.format("javascript: %s", String.format("OTPElf.elfBridge.setSms(%s)", jSONObject2)));
} catch (Exception unused) {
}
}
}
public final void Q_$2$(String str) {
this.l_$w$ = str;
}
public final void a_$P$(int i, int[] iArr) {
Q__v$ q__v$ = this.D$_X_;
Activity activity = this.B$$W$;
if (i != 1) {
return;
}
if (iArr.length > 0 && iArr[0] == 0) {
q__v$.a_$P$(true);
q__v$.R$$r_(activity);
AnalyticsUtil.trackEvent(AnalyticsEvent.SMS_PERMISSION_NOW_GRANTED);
} else {
q__v$.a_$P$(false);
AnalyticsUtil.trackEvent(AnalyticsEvent.SMS_PERMISSION_NOW_DENIED);
}
}
public final String d__1_() {
return this.Q_$2$;
}
public final String R$$r_() {
return this.R$$r_;
}
public final boolean Q_$2$() {
return this.r$_Y_;
}
public final void a_$P$(boolean z) {
this.O_$B_ = z;
}
@JavascriptInterface
public final void setUseWideViewPort(final boolean z) {
this.B$$W$.runOnUiThread(new Runnable() {
@Override
public final void run() {
RzpAssist.this.d__1_.getSettings().setUseWideViewPort(z);
}
});
}
@JavascriptInterface
public final void openKeyboard() {
this.B$$W$.runOnUiThread(new Runnable() {
@Override
public final void run() {
((InputMethodManager) RzpAssist.this.B$$W$.getSystemService("input_method")).showSoftInput(RzpAssist.this.d__1_, 0);
}
});
}
@JavascriptInterface
public final void toast(final String str) {
this.B$$W$.runOnUiThread(new Runnable() {
@Override
public final void run() {
Toast.makeText(RzpAssist.this.B$$W$, str, 1).show();
}
});
}
@JavascriptInterface
public final void trackEvent(String str, String str2) {
try {
AnalyticsEvent analyticsEvent = AnalyticsEvent.JS_EVENT;
analyticsEvent.setEventName(str);
AnalyticsUtil.trackEvent(analyticsEvent, new JSONObject(str2));
} catch (Exception unused) {
}
}
@JavascriptInterface
public final void trackEvent(String str) {
AnalyticsEvent analyticsEvent = AnalyticsEvent.JS_EVENT;
analyticsEvent.setEventName(str);
AnalyticsUtil.trackEvent(analyticsEvent);
}
@JavascriptInterface
public final void onOtpParsed(final String str) {
this.B$$W$.runOnUiThread(new Runnable() {
@Override
public final void run() {
try {
JSONObject jSONObject = new JSONObject(str);
OTP otp = new OTP(jSONObject.getString("otp"), jSONObject.getString("sender"), jSONObject.getString("bank"));
HashMap hashMap = new HashMap();
hashMap.put("sender", otp.d__1_);
if (otp.d__1_.contains("RZRPAY")) {
RzpAssist.a_$P$(RzpAssist.this);
hashMap.put("razorpay_otp", Boolean.TRUE);
} else {
hashMap.put("razorpay_otp", Boolean.FALSE);
RzpAssist.G__G_(RzpAssist.this);
AnalyticsUtil.addProperty("payment_otp_received", new AnalyticsProperty(true, AnalyticsProperty.d__1_.PAYMENT));
}
AnalyticsUtil.trackEvent(AnalyticsEvent.OTP_RECEIVED, hashMap);
} catch (Exception unused) {
}
}
});
}
@JavascriptInterface
public final void copyToClipboard(String str) {
((ClipboardManager) this.B$$W$.getSystemService("clipboard")).setPrimaryClip(ClipData.newPlainText("rzp_clip_data", str));
}
@Override
public final void setSmsPermission(boolean z) {
this.G__G_ = z;
AnalyticsUtil.addProperty("otp_autoreading_access", new AnalyticsProperty(z, AnalyticsProperty.d__1_.ORDER));
}
public final void reset() {
try {
String constructBasicAuth = BaseUtils.constructBasicAuth(this.b__J_);
HashMap hashMap = new HashMap();
hashMap.put("Authorization", "Basic ".concat(String.valueOf(constructBasicAuth)));
hashMap.put("Content-Type", "application/json");
if (this.l_$w$ != null) {
StringBuilder sb = new StringBuilder("https://api.razorpay.com/v1/payments/");
sb.append(this.l_$w$);
sb.append("/metadata");
Q$$U_.G__G_(sb.toString(), B$$W$.d__1_(this.f$_G$).toString(), hashMap, new Callback() {
@Override
public final void run(L$$C_ l$$c_) {
}
});
}
} catch (Exception e) {
AnalyticsUtil.reportError(e, "critical", e.getMessage());
}
this.Q_$2$ = "";
this.R$$r_ = "";
this.f$_G$ = false;
}
}