iKredit v1.2.0.3版本的 MD5 值为:2c00c5c79eecbd6be4c3c546c28d778d
以下内容为反编译后的 Y$_o$.java 源代码,内容仅作参考
package com.razorpay;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.webkit.WebView;
import com.android.sdklibrary.utils.RSAUtilForAndroid;
import com.facebook.internal.ServerProtocol;
import com.facebook.react.uimanager.ViewProps;
import com.facebook.share.internal.MessengerShareContentUtility;
import com.facebook.share.internal.ShareConstants;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.razorpay.AnalyticsProperty;
import com.umeng.commonsdk.proguard.d;
import java.lang.Thread;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import org.json.JSONException;
import org.json.JSONObject;
public class Y$_o$ implements E$_6$, O_$B_, Runnable {
private String D$_X_;
private JSONObject G__G_;
private long O_$B_;
String Q_$2$;
private String R$$r_;
l_$w$ a_$P$;
protected Activity activity;
private boolean b__J_;
private long c__C_;
private String d__1_;
private long l_$w$;
protected Y$_o$$Q_$2$ view;
private String E$_j$ = "{}";
private int r$_Y_ = 0;
private boolean B$$W$ = false;
private boolean E$_6$ = false;
private boolean Y$_o$ = false;
private int l__d$ = 0;
private boolean J$_0_ = false;
private String L__R$ = null;
private B$$W$ g__v_ = null;
private Queue<String> f$_G$ = new LinkedList();
private boolean h__y_ = false;
public void helpersReset() {
}
public boolean isMagicPresent() {
return false;
}
public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
}
public void relay(String str) {
}
public void requestOtpPermission() {
}
static boolean R$$r_(Y$_o$ y$_o$) {
y$_o$.E$_6$ = false;
return false;
}
public Y$_o$(Activity activity, Y$_o$$Q_$2$ y$_o$$Q_$2$) {
this.activity = activity;
this.view = y$_o$$Q_$2$;
}
public boolean setOptions(Bundle bundle, boolean z) {
this.J$_0_ = z;
if (bundle == null) {
destroyActivity(0, this.activity.getResources().getString(R.string.activity_result_invalid_parameters));
return false;
}
l_$w$ l__w_ = new l_$w$(bundle.getString("OPTIONS"));
this.a_$P$ = l__w_;
this.Q_$2$ = l__w_.G__G_();
int i = bundle.getInt(ShareConstants.IMAGE_URL, 0);
this.l__d$ = i;
this.a_$P$.d__1_(this.activity, i);
this.D$_X_ = bundle.getString("BODY");
AnalyticsUtil.setup(this.activity, this.Q_$2$, l__d$.a_$P$, l__d$.R$$r_, l__d$.Q_$2$);
l_$w$ l__w_2 = this.a_$P$;
String Q_$2$ = f$_G$.Q_$2$("https://api.razorpay.com/v1/checkout/public", ServerProtocol.FALLBACK_DIALOG_PARAM_VERSION, l__d$.Q_$2$);
Map<String, String> T__j$ = l__d$.f$_G$().T__j$();
for (String str : T__j$.keySet()) {
Q_$2$ = f$_G$.Q_$2$(Q_$2$, str, T__j$.get(str));
}
Iterator<String> it = l__d$.f$_G$().Y_$B$().iterator();
while (it.hasNext()) {
String next = it.next();
if (l__w_2.Q_$2$(next)) {
Q_$2$ = f$_G$.Q_$2$(Q_$2$, next, (String) l__w_2.d__1_(next));
}
}
this.d__1_ = Q_$2$;
if (Q_$2$ == null) {
destroyActivity(3, this.activity.getResources().getString(R.string.activity_result_invalid_url));
}
try {
this.G__G_ = new JSONObject(this.R$$r_);
} catch (Exception unused) {
}
if (!z) {
this.a_$P$.a_$P$();
this.R$$r_ = I$_n_.Q_$2$(this.activity).getString("pref_merchant_options_".concat(String.valueOf(this.Q_$2$)), null);
String string = bundle.getString("FRAMEWORK");
if (string != null) {
AnalyticsUtil.addProperty("framework", new AnalyticsProperty(string, AnalyticsProperty.d__1_.ORDER));
}
if (bundle.getBoolean("DISABLE_FULL_SCREEN", false)) {
Activity activity = this.activity;
activity.getWindow().addFlags(2048);
activity.getWindow().clearFlags(1024);
}
if (bundle.containsKey("PRELOAD_COMPLETE_DURATION")) {
this.l_$w$ = bundle.getLong("PRELOAD_COMPLETE_DURATION");
}
if (bundle.containsKey("PRELOAD_ABORT_DURATION")) {
this.c__C_ = bundle.getLong("PRELOAD_ABORT_DURATION");
}
} else {
this.R$$r_ = bundle.getString("DASH_OPTIONS");
if (bundle.getBoolean("DISABLE_FULL_SCREEN", false)) {
Activity activity2 = this.activity;
activity2.getWindow().addFlags(2048);
activity2.getWindow().clearFlags(1024);
}
}
return true;
}
public void onActivityResultReceived(int i, int i2, Intent intent) {
if (i == 99) {
JSONObject jSONFromIntentData = BaseUtils.getJSONFromIntentData(intent);
String format = String.format("javascript: upiIntentResponse(%s)", jSONFromIntentData.toString());
HashMap hashMap = new HashMap();
hashMap.put("result", jSONFromIntentData);
AnalyticsUtil.trackEvent(AnalyticsEvent.NATIVE_INTENT_ONACTIVITY_RESULT, hashMap);
if (this.h__y_) {
this.view.loadUrl(1, format);
return;
}
if (this.f$_G$ == null) {
this.f$_G$ = new LinkedList();
}
this.f$_G$.add(format);
}
}
public void verifyGPaySdkResponse(String str) {
String format = String.format("javascript: window.externalSDKResponse(%s)", str);
if (this.h__y_) {
this.view.loadUrl(1, format);
return;
}
if (this.f$_G$ == null) {
this.f$_G$ = new LinkedList();
}
this.f$_G$.add(format);
}
public l_$w$ getCheckoutOptions() {
return this.a_$P$;
}
public void setUpAddOn() {
this.g__v_ = new B$$W$(this.activity, this.view.getWebView(2));
}
public void loadForm(String str) {
if (this.r$_Y_ != 0) {
AnalyticsUtil.postData();
}
int i = this.r$_Y_ + 1;
this.r$_Y_ = i;
AnalyticsUtil.addProperty("payment_attempt", new AnalyticsProperty(i, AnalyticsProperty.d__1_.ORDER));
this.b__J_ = true;
StringBuilder sb = new StringBuilder();
sb.append(this.d__1_);
sb.append(str);
String replace = sb.toString().replace(" ", "%20");
String str2 = this.D$_X_;
if (str2 == null || str2.isEmpty()) {
this.view.loadUrl(1, replace);
} else {
this.view.loadDataWithBaseURL(1, replace, this.D$_X_, "text/html", RSAUtilForAndroid.CHARSET, null);
}
}
public void passPrefillToSegment() {
String D$_X_ = this.a_$P$.D$_X_();
if (!TextUtils.isEmpty(D$_X_)) {
AnalyticsUtil.addProperty("email", new AnalyticsProperty(D$_X_, AnalyticsProperty.d__1_.ORDER));
}
String E$_j$ = this.a_$P$.E$_j$();
if (TextUtils.isEmpty(E$_j$)) {
return;
}
AnalyticsUtil.addProperty("contact", new AnalyticsProperty(E$_j$, AnalyticsProperty.d__1_.ORDER));
}
public void handleCardSaving() {
AnalyticsUtil.trackEvent(AnalyticsEvent.CARD_SAVING_START);
E$_j$.d__1_(this.activity.getApplicationContext());
}
public void saveInstanceState(Bundle bundle) {
if (this.l__d$ != 0) {
bundle.putString("OPTIONS", this.a_$P$.B$$W$());
bundle.putInt(ShareConstants.IMAGE_URL, this.l__d$);
} else {
bundle.putString("OPTIONS", this.a_$P$.d__1_());
}
bundle.putString("DASH_OPTIONS", this.R$$r_);
if (this.activity.getIntent() != null) {
bundle.putBoolean("DISABLE_FULL_SCREEN", this.activity.getIntent().getBooleanExtra("DISABLE_FULL_SCREEN", false));
}
}
public void setCheckoutLoadStartAt() {
this.O_$B_ = System.nanoTime();
}
public void destroyActivity(int i, String str) {
AnalyticsUtil.addProperty("destroy_resultCode", new AnalyticsProperty(String.valueOf(i), AnalyticsProperty.d__1_.ORDER));
AnalyticsUtil.addProperty("destroy_result", new AnalyticsProperty(str, AnalyticsProperty.d__1_.ORDER));
AnalyticsUtil.trackEvent(AnalyticsEvent.INTERNAL_DESTROY_METHOD_CALLED);
this.view.destroy(i, str);
}
@Override
public void onCheckoutBackPress() {
AnalyticsUtil.trackEvent(AnalyticsEvent.CHECKOUT_SOFT_BACK_PRESSED);
destroyActivity(0, "Checkout BackPressed");
}
public void enableAddon(JSONObject jSONObject) {
try {
if (jSONObject.has("magic")) {
boolean z = jSONObject.getBoolean("magic");
this.Y$_o$ = z;
if (this.g__v_ != null) {
this.g__v_.Q_$2$(z);
}
AnalyticsUtil.addProperty("is_magic", new AnalyticsProperty(this.Y$_o$, AnalyticsProperty.d__1_.PAYMENT));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void invokePopup(final String str) {
this.E$_6$ = true;
try {
this.activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
try {
JSONObject jSONObject = new JSONObject(str);
Y$_o$.this.enableAddon(jSONObject);
if (jSONObject.has("content")) {
Y$_o$.this.view.loadDataWithBaseURL(2, "about:blank", jSONObject.getString("content"), "text/html", RSAUtilForAndroid.CHARSET, null);
}
if (jSONObject.has("url")) {
Y$_o$.this.view.loadUrl(2, jSONObject.getString("url"));
}
if (jSONObject.has("focus") && !jSONObject.getBoolean("focus")) {
Y$_o$.this.view.makeWebViewVisible(1);
} else {
Y$_o$.this.view.makeWebViewVisible(2);
}
} catch (Exception e) {
e.printStackTrace();
}
AnalyticsUtil.addProperty("two_webview_flow", new AnalyticsProperty(true, AnalyticsProperty.d__1_.PAYMENT));
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
public void fetchCondfig() {
l__d$.G__G_ = isMagicPresent();
l__d$.d__1_(this.activity, this.Q_$2$);
}
public void onProgressChanges(int i, int i2) {
if (i != 1) {
return;
}
this.view.showProgressBar(i2);
}
public void onPageStarted(int i, WebView webView, String str) {
B$$W$ b$$w$;
if (i == 1) {
f$_G$.a_$P$(this.activity);
} else if (i == 2 && (b$$w$ = this.g__v_) != null && this.Y$_o$) {
b$$w$.a_$P$();
}
}
public void onPageFinished(int i, WebView webView, String str) {
B$$W$ b$$w$;
if (i == 1) {
primaryWebviewPageFinished(str, webView);
} else if (i == 2 && (b$$w$ = this.g__v_) != null && this.Y$_o$) {
b$$w$.R$$r_();
}
}
public void primaryWebviewPageFinished(String str, WebView webView) {
long nanoTime = System.nanoTime();
f$_G$.d__1_();
this.view.hideProgressBar();
if (str.indexOf(this.d__1_) == 0) {
if (this.r$_Y_ == 1) {
this.h__y_ = true;
Queue<String> queue = this.f$_G$;
if (queue != null && !queue.isEmpty()) {
Iterator<String> it = this.f$_G$.iterator();
while (it.hasNext()) {
this.view.loadUrl(1, it.next());
}
this.f$_G$.clear();
}
HashMap hashMap = new HashMap();
long j = nanoTime - this.O_$B_;
hashMap.put("checkout_load_duration", Long.valueOf(j));
BaseUtils.nanoTimeToSecondsString(j, 2);
long j2 = this.l_$w$;
if (j2 > 0) {
hashMap.put("preload_finish_duration", Long.valueOf(j2));
BaseUtils.nanoTimeToSecondsString(this.l_$w$, 2);
} else {
long j3 = this.c__C_;
if (j3 > 0) {
hashMap.put("preload_abort_duration", Long.valueOf(j3));
BaseUtils.nanoTimeToSecondsString(this.c__C_, 2);
}
}
long j4 = this.l_$w$ - j;
if (j4 > 0) {
hashMap.put("time_shaved_off", Long.valueOf(j4));
BaseUtils.nanoTimeToSecondsString(j4, 2);
}
AnalyticsUtil.trackEvent(AnalyticsEvent.CHECKOUT_LOADED, hashMap);
}
if (this.b__J_) {
this.view.clearWebViewHistory(1);
this.b__J_ = false;
}
}
}
public String getProgressBarColor() {
String str = null;
try {
if (this.a_$P$.Q_$2$() != null) {
String string = this.a_$P$.Q_$2$().getJSONObject("theme").getString(ViewProps.COLOR);
Color.parseColor(string);
return string;
}
throw new Exception("No options defined");
} catch (Exception e) {
try {
} catch (Exception e2) {
AnalyticsUtil.reportError(e2, "error", e2.getMessage());
}
if (this.G__G_ != null) {
str = this.G__G_.getJSONObject("theme").getString(ViewProps.COLOR);
Color.parseColor(str);
AnalyticsUtil.reportError(e, "error", e.getMessage());
return str;
}
throw new Exception("No dash options defined");
}
}
public void sendOtpPermissionCallback(final boolean z) {
this.activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("granted", z);
Y$_o$.this.view.loadUrl(1, String.format("javascript: otpPermissionCallback(%s)", jSONObject.toString()));
} catch (Exception unused) {
}
}
});
}
public void addOnFlowEnd() {
B$$W$ b$$w$ = this.g__v_;
if (b$$w$ != null) {
b$$w$.d__1_();
}
}
public void cleanUpOnDestroy() {
Q_$2$();
addOnFlowEnd();
Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler();
if (defaultUncaughtExceptionHandler instanceof b_$A$) {
Thread.setDefaultUncaughtExceptionHandler(((b_$A$) defaultUncaughtExceptionHandler).Q_$2$);
}
}
public void Q_$2$() {
if (this.L__R$ != null && !this.B$$W$) {
try {
String constructBasicAuth = BaseUtils.constructBasicAuth(this.Q_$2$);
HashMap hashMap = new HashMap();
hashMap.put("Authorization", "Basic ".concat(String.valueOf(constructBasicAuth)));
StringBuilder sb = new StringBuilder("https://api.razorpay.com/v1/payments/");
sb.append(this.L__R$);
sb.append("/cancel?platform=android_sdk");
Q$$U_.R$$r_(sb.toString(), hashMap, new Callback() {
@Override
public final void run(L$$C_ l$$c_) {
}
});
this.L__R$ = null;
} catch (Exception unused) {
}
}
}
public void backPressed(final Map<String, Object> map) {
AnalyticsUtil.trackEvent(AnalyticsEvent.CHECKOUT_HARD_BACK_PRESSED, map);
WebView webView = this.view.getWebView(1);
if ((webView.getTag() == null ? "" : webView.getTag().toString()).contains(l__d$.f$_G$().O_$B_()) && !this.view.isWebViewVisible(2)) {
this.view.loadUrl(1, "javascript: window.backPressed ? window.backPressed('onCheckoutBackPress') : CheckoutBridge.onCheckoutBackPress();");
map.put("in_checkout", ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
} else if (!l__d$.f$_G$().r_$Z$()) {
destroyActivity(0, "BackPressed");
} else {
f$_G$.d__1_(this.activity, l__d$.f$_G$().b_$A$(), l__d$.f$_G$().I$_e_(), l__d$.f$_G$().Q$$U_(), new f$_G$$Q_$2$() {
@Override
public final void d__1_() {
AnalyticsUtil.trackEvent(AnalyticsEvent.ALERT_PAYMENT_CONTINUE, (Map<String, Object>) map);
}
@Override
public final void R$$r_() {
AnalyticsUtil.trackEvent(AnalyticsEvent.ALERT_PAYMENT_CANCELLED, (Map<String, Object>) map);
if (Y$_o$.this.E$_6$) {
Y$_o$.this.view.makeWebViewVisible(1);
Y$_o$.this.view.loadUrl(2, "about:blank");
Y$_o$.this.view.loadUrl(1, "javascript: window.onpaymentcancel()");
} else {
Y$_o$.d__1_(Y$_o$.this, "");
Y$_o$.this.Q_$2$();
}
Y$_o$.R$$r_(Y$_o$.this);
}
});
}
}
@Override
public void onLoad() {
this.activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
if (Y$_o$.this.D$_X_ == null || Y$_o$.this.D$_X_.isEmpty()) {
Y$_o$.this.view.loadUrl(1, "javascript: CheckoutBridge.setCheckoutBody(document.documentElement.outerHTML)");
}
Y$_o$.this.view.loadUrl(1, Y$_o$.G__G_(Y$_o$.this));
Y$_o$.this.view.loadUrl(1, String.format("javascript: CheckoutBridge.sendAnalyticsData({data: %s})", AnalyticsUtil.getAnalyticsDataForCheckout(Y$_o$.this.activity).toString()));
}
});
}
public JSONObject getOptionsForHandleMessage() {
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("options", this.a_$P$.Q_$2$());
jSONObject.put("data", this.E$_j$);
jSONObject.put("id", AnalyticsUtil.getLocalOrderId());
jSONObject.put("key_id", this.Q_$2$);
jSONObject.put("upi_intents_data", f$_G$.d__1_(this.activity));
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("openedAt", System.currentTimeMillis());
jSONObject.put("metadata", jSONObject2);
String string = I$_n_.d__1_(this.activity.getApplicationContext()).getString("rzp_device_token", null);
if (!TextUtils.isEmpty(string)) {
jSONObject.put("device_token", string);
}
jSONObject.put("sdk_popup", true);
jSONObject.put("magic", true);
jSONObject.put("network_type", BaseUtils.getNetworkType(this.activity));
jSONObject.put("activity_recreated", this.J$_0_);
} catch (JSONException unused) {
}
return jSONObject;
}
@Override
public void setAppToken(String str) {
I$_n_.R$$r_(this.activity).putString("rzp_app_token", str).apply();
}
@Override
public void setDeviceToken(String str) {
I$_n_.G__G_(this.activity).putString("rzp_device_token", str).apply();
}
@Override
public void callNativeIntent(String str, String str2) {
BaseUtils.startActivityForResult(str, str2, this.activity);
HashMap hashMap = new HashMap();
if (str == null) {
str = "null";
}
hashMap.put("url", str);
if (str2 == null) {
str2 = "null";
}
hashMap.put(d.n, str2);
AnalyticsUtil.trackEvent(AnalyticsEvent.NATIVE_INTENT_CALLED, hashMap);
}
@Override
public void setPaymentID(String str) {
this.L__R$ = str;
AnalyticsUtil.addProperty("payment_id", new AnalyticsProperty(str, AnalyticsProperty.d__1_.PAYMENT));
AnalyticsUtil.trackEvent(AnalyticsEvent.PAYMENT_ID_ATTACHED);
}
@Override
public void setCheckoutBody(String str) {
this.D$_X_ = str;
}
@Override
public void setMerchantOptions(String str) {
this.R$$r_ = str;
try {
this.G__G_ = new JSONObject(str);
} catch (Exception e) {
this.G__G_ = null;
AnalyticsUtil.reportError(e, "critical", e.getMessage());
}
if (this.G__G_ == null) {
f$_G$.R$$r_(this.activity, this.Q_$2$, null);
} else {
f$_G$.R$$r_(this.activity, this.Q_$2$, str);
}
}
public void addAnalyticsData(JSONObject jSONObject) {
AnalyticsUtil.addFilteredPropertiesFromPayload(jSONObject);
}
@Override
public void onSubmit(String str) {
if (this.r$_Y_ > 1) {
AnalyticsUtil.refreshPaymentSession();
}
try {
JSONObject jSONObject = new JSONObject(str);
this.E$_j$ = str;
addAnalyticsData(jSONObject);
try {
if (jSONObject.has("contact")) {
Activity activity = this.activity;
String string = jSONObject.getString("contact");
SharedPreferences.Editor R$$r_ = I$_n_.R$$r_(activity);
R$$r_.putString("rzp_user_contact", string);
R$$r_.commit();
this.a_$P$.Q_$2$("contact", jSONObject.getString("contact"));
}
if (jSONObject.has("email")) {
Activity activity2 = this.activity;
String string2 = jSONObject.getString("email");
SharedPreferences.Editor R$$r_2 = I$_n_.R$$r_(activity2);
R$$r_2.putString("rzp_user_email", string2);
R$$r_2.commit();
this.a_$P$.Q_$2$("email", jSONObject.getString("email"));
}
} catch (JSONException unused) {
}
String string3 = jSONObject.getString(FirebaseAnalytics.Param.METHOD);
if (!string3.equals("card") && string3.equals("wallet")) {
String string4 = jSONObject.getString("wallet");
if (this.a_$P$.a_$P$(string4)) {
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("external_wallet", string4);
AnalyticsUtil.addProperty("external_wallet", new AnalyticsProperty(string4, AnalyticsProperty.d__1_.ORDER));
AnalyticsUtil.trackEvent(AnalyticsEvent.EXTERNAL_WALLET_SELECTED);
onComplete(jSONObject2);
}
}
AnalyticsUtil.trackEvent(AnalyticsEvent.CHECKOUT_SUBMIT);
AnalyticsUtil.postData();
} catch (Exception e) {
AnalyticsUtil.reportError(e, "critical", e.getMessage());
}
}
protected void onComplete(JSONObject jSONObject) {
try {
if (jSONObject.has("error")) {
AnalyticsUtil.addProperty("payment_status", new AnalyticsProperty("fail", AnalyticsProperty.d__1_.PAYMENT));
AnalyticsUtil.addProperty(MessengerShareContentUtility.ATTACHMENT_PAYLOAD, new AnalyticsProperty(jSONObject.toString(), AnalyticsProperty.d__1_.PAYMENT));
AnalyticsUtil.trackEvent(AnalyticsEvent.CHECKOUT_PAYMENT_COMPLETE);
if (this.E$_6$) {
this.view.makeWebViewVisible(1);
}
onError(jSONObject);
} else if (jSONObject.has("razorpay_fund_account_id")) {
destroyActivity(1, jSONObject.toString());
} else if (jSONObject.has("razorpay_payment_id")) {
String string = jSONObject.getString("razorpay_payment_id");
this.L__R$ = string;
AnalyticsUtil.addProperty("payment_id", new AnalyticsProperty(string, AnalyticsProperty.d__1_.PAYMENT));
AnalyticsUtil.addProperty("payment_status", new AnalyticsProperty("success", AnalyticsProperty.d__1_.PAYMENT));
AnalyticsUtil.addProperty(MessengerShareContentUtility.ATTACHMENT_PAYLOAD, new AnalyticsProperty(jSONObject.toString(), AnalyticsProperty.d__1_.PAYMENT));
AnalyticsUtil.trackEvent(AnalyticsEvent.CHECKOUT_PAYMENT_COMPLETE);
this.B$$W$ = true;
destroyActivity(1, jSONObject.toString());
} else if (jSONObject.has("external_wallet")) {
destroyActivity(4, jSONObject.toString());
} else {
destroyActivity(0, "Post payment parsing error");
}
} catch (Exception e) {
AnalyticsUtil.reportError(e, "critical", e.getMessage());
destroyActivity(0, e.getMessage());
}
this.E$_6$ = false;
}
public void onError(JSONObject jSONObject) {
if (this.E$_6$) {
this.view.loadUrl(1, String.format("javascript: window.onComplete(%s)", jSONObject.toString()));
return;
}
final String str = "";
try {
if (jSONObject.has("error")) {
StringBuilder sb = new StringBuilder();
sb.append("");
sb.append(this.d__1_.contains("?") ? "&" : "?");
str = sb.toString();
if (jSONObject.get("error") instanceof JSONObject) {
JSONObject jSONObject2 = (JSONObject) jSONObject.get("error");
if (jSONObject2.has("description")) {
StringBuilder sb2 = new StringBuilder();
sb2.append(str);
sb2.append("error.description=");
sb2.append(jSONObject2.get("description"));
str = sb2.toString();
if (jSONObject2.has("field")) {
StringBuilder sb3 = new StringBuilder();
sb3.append(str);
sb3.append("&error.field=");
sb3.append(jSONObject2.get("field"));
str = sb3.toString();
}
} else {
StringBuilder sb4 = new StringBuilder();
sb4.append(str);
sb4.append("error=");
sb4.append(jSONObject2.toString());
str = sb4.toString();
}
}
}
} catch (Exception e) {
AnalyticsUtil.reportError(e, "critical", e.getMessage());
} finally {
this.activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
Y$_o$.d__1_(Y$_o$.this, str);
}
});
}
}
@Override
public void onFault(String str) {
destroyActivity(3, str);
}
@Override
public void onComplete(final String str) {
this.activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
try {
Y$_o$.this.onComplete(new JSONObject(str));
} catch (Exception e) {
AnalyticsUtil.reportError(e, "critical", e.getMessage());
Y$_o$.this.destroyActivity(0, e.getMessage());
}
}
});
}
@Override
public void setDimensions(final int i, final int i2) {
if (this.activity.getResources().getBoolean(R.bool.isTablet)) {
this.activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
WindowManager.LayoutParams attributes = Y$_o$.this.activity.getWindow().getAttributes();
((ViewGroup.LayoutParams) attributes).height = (int) TypedValue.applyDimension(1, i2, Y$_o$.this.activity.getResources().getDisplayMetrics());
((ViewGroup.LayoutParams) attributes).width = (int) TypedValue.applyDimension(1, i, Y$_o$.this.activity.getResources().getDisplayMetrics());
Y$_o$.this.activity.getWindow().setAttributes(attributes);
}
});
}
}
@Override
public void onDismiss() {
destroyActivity(0, "Payment Cancelled");
}
@Override
public void onDismiss(String str) {
destroyActivity(0, str);
}
@Override
public void requestExtraAnalyticsData() {
final JSONObject extraAnalyticsPayload = AnalyticsUtil.getExtraAnalyticsPayload();
this.activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
try {
Y$_o$.this.view.loadUrl(1, String.format("javascript: CheckoutBridge.sendExtraAnalyticsData(%s)", extraAnalyticsPayload.toString()));
} catch (Exception unused) {
}
}
});
}
@Override
public void onError(String str) {
try {
onError(new JSONObject(str));
} catch (Exception e) {
AnalyticsUtil.reportError(e, "critical", e.getMessage());
this.activity.runOnUiThread(this);
}
}
@Override
public void toast(final String str, final int i) {
this.activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
Y$_o$.this.view.showToast(str, i);
}
});
}
public final class AnonymousClass3 implements f$_G$$Q_$2$, Runnable {
private String Q_$2$;
private String R$$r_;
private String d__1_;
AnonymousClass3(String str, String str2, String str3) {
this.R$$r_ = str;
this.d__1_ = str2;
this.Q_$2$ = str3;
}
@Override
public final void run() {
f$_G$.d__1_(Y$_o$.this.activity, this.R$$r_, this.d__1_, this.Q_$2$, this);
}
@Override
public final void d__1_() {
Y$_o$.this.view.loadUrl(1, String.format("javascript: CheckoutBridge.isPositiveButtonClicked({isClicked: %s})", Boolean.TRUE));
}
@Override
public final void R$$r_() {
Y$_o$.this.view.loadUrl(1, String.format("javascript: CheckoutBridge.isPositiveButtonClicked({isClicked: %s})", Boolean.FALSE));
}
}
@Override
public void showAlertDialog(String str, String str2, String str3) {
this.activity.runOnUiThread(new AnonymousClass3(str, str3, str2));
}
@Override
public void sendDataToWebView(final int i, final String str) {
this.activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
int i2 = i;
if (i2 == 1) {
Y$_o$.this.view.loadUrl(1, String.format("javascript: handleRelay(%s)", str));
} else {
if (i2 != 2) {
return;
}
Y$_o$.this.view.loadUrl(2, String.format("javascript: Magic.handleRelay(%s)", str));
}
}
});
}
public void checkSmsPermission() {
this.view.checkSmsPermission();
}
@Override
public void isWebViewSafeOnUI(final int i, final c__C_$Q_$2$ c__c__q__2_) {
this.activity.runOnUiThread(new Runnable() {
@Override
public final void run() {
Y$_o$.this.d__1_(i, c__c__q__2_);
}
});
}
public void d__1_(int i, c__C_$Q_$2$ c__c__q__2_) {
Y$_o$$Q_$2$ y$_o$$Q_$2$;
int i2 = 1;
if (i == 1) {
y$_o$$Q_$2$ = this.view;
} else {
y$_o$$Q_$2$ = this.view;
i2 = 2;
}
try {
String host = new URL(y$_o$$Q_$2$.getWebView(i2).getTag().toString()).getHost();
if (host == null || !host.endsWith("razorpay.com")) {
return;
}
c__c__q__2_.G__G_();
} catch (Exception unused) {
}
}
@Override
public void isWebViewSafe(int i, c__C_$Q_$2$ c__c__q__2_) {
d__1_(i, c__c__q__2_);
}
@Override
public boolean isUserRegisteredOnUPI(String str) {
return BaseUtils.checkUpiRegisteredApp(this.activity, str);
}
static void d__1_(Y$_o$ y$_o$, String str) {
int i = y$_o$.r$_Y_;
int B_$q$ = l__d$.f$_G$().B_$q$();
boolean z = true;
if (!l__d$.f$_G$().K$$z$() || (B_$q$ != -1 && B_$q$ <= i)) {
z = false;
}
if (z) {
y$_o$.helpersReset();
y$_o$.loadForm(str);
} else {
y$_o$.destroyActivity(0, "BackPressed");
}
}
static String G__G_(Y$_o$ y$_o$) {
return String.format("javascript: handleMessage(%s)", y$_o$.getOptionsForHandleMessage().toString());
}
@Override
public void run() {
helpersReset();
loadForm("");
}
}