正在查看: Clash Legends v0.0.1 应用的 PaymentConfirmActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 PaymentConfirmActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.paypal.android.sdk.payments;
import android.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.SpannableString;
import android.util.Log;
import android.widget.ListAdapter;
import android.widget.ListView;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.paypal.android.sdk.ek;
import com.paypal.android.sdk.er;
import com.paypal.android.sdk.fc;
import com.paypal.android.sdk.fg;
import com.paypal.android.sdk.fu;
import com.paypal.android.sdk.fw;
import com.paypal.android.sdk.fz;
import com.paypal.android.sdk.ga;
import com.paypal.android.sdk.ge;
import com.paypal.android.sdk.gl;
import com.paypal.android.sdk.gm;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.json.JSONObject;
public final class PaymentConfirmActivity extends Activity {
private static final String a = PaymentConfirmActivity.class.getSimpleName();
private dg b;
private dx c;
private boolean d;
private boolean e;
private boolean f;
private ge g;
private cp h;
private dh i;
private Parcelable j;
private PayPalService k;
private final ServiceConnection l = new cw(this);
private boolean m;
private static er a(PayPalPayment payPalPayment) {
return new er(new BigDecimal(ek.a(payPalPayment.a().doubleValue(), payPalPayment.d()).trim()), payPalPayment.d());
}
private void a(int i) {
setResult(i, new Intent());
}
static void a(Activity activity, int i, dh dhVar, Parcelable parcelable, PayPalConfiguration payPalConfiguration) {
a(activity, 2, dhVar, null, payPalConfiguration, false);
}
static void a(Activity activity, int i, dh dhVar, Parcelable parcelable, PayPalConfiguration payPalConfiguration, boolean z) {
Intent intent = new Intent(activity, (Class<?>) PaymentConfirmActivity.class);
intent.putExtras(activity.getIntent());
intent.putExtra("com.paypal.android.sdk.payments.PaymentConfirmActivity.EXTRA_PAYMENT_KIND", dhVar);
intent.putExtra("com.paypal.android.sdk.payments.PaymentConfirmActivity.EXTRA_CREDIT_CARD", parcelable);
intent.putExtra("com.paypal.android.sdk.payments.PaymentConfirmActivity.EXTRA_RESET_PP_REQUEST_ID", z);
intent.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION, payPalConfiguration);
activity.startActivityForResult(intent, i);
}
private void a(Bundle bundle) {
String string = bundle.getString("authAccount");
String string2 = bundle.getString("authtoken");
String string3 = bundle.getString("scope");
long j = bundle.getLong("valid_until");
for (String str : bundle.keySet()) {
Object obj = bundle.get(str);
if (obj == null) {
String.format("%s:null", str);
} else {
String.format("%s:%s (%s)", str, obj.toString(), obj.getClass().getName());
}
}
com.paypal.android.sdk.dw dwVar = new com.paypal.android.sdk.dw(string2, string3, j, false);
if (this.k == null) {
this.b = new dg(this, string, dwVar);
} else {
a(string, dwVar);
}
}
static void a(PaymentConfirmActivity paymentConfirmActivity, fg fgVar) {
paymentConfirmActivity.c = new dx(fgVar, paymentConfirmActivity.h.a().getProvidedShippingAddress());
paymentConfirmActivity.getIntent().putExtra("com.paypal.android.sdk.payments.PaymentConfirmActivity.EXTRA_PAYMENT_INFO", paymentConfirmActivity.c);
paymentConfirmActivity.b();
paymentConfirmActivity.j();
}
static void a(PaymentConfirmActivity paymentConfirmActivity, List list, int i) {
paymentConfirmActivity.h.b().a(i);
paymentConfirmActivity.g.a(paymentConfirmActivity, (fz) list.get(i));
}
private void a(String str) {
this.g.a(str);
}
private void a(String str, com.paypal.android.sdk.dw dwVar) {
this.k.c().c = str;
a(str);
this.k.c().g = dwVar;
if (this.i != dh.PayPal) {
this.g.b(true);
}
}
public void a(boolean z) {
new StringBuilder().append(a).append(".doLogin");
if (!k.a(this, this.k)) {
LoginActivity.a(this, 1, this.k.q(), false, z, "https://uri.paypal.com/services/payments/basic", this.k.d());
return;
}
Intent a2 = new com.paypal.android.sdk.dq().a(this.k.d().k(), z ? com.paypal.android.sdk.dr.PROMPT_LOGIN : com.paypal.android.sdk.dr.USER_REQUIRED, com.paypal.android.sdk.ds.token, this.k.b().d().e());
a2.putExtra("scope", "https://uri.paypal.com/services/payments/basic");
new StringBuilder("startActivityForResult(").append(a2).append(", 2").append(")");
Log.w("paypal.sdk", "requesting " + a2.getStringExtra("response_type") + " with scope={" + a2.getStringExtra("scope") + "} from Authenticator.");
startActivityForResult(a2, 2);
}
static boolean a(PaymentConfirmActivity paymentConfirmActivity, boolean z) {
paymentConfirmActivity.f = false;
return false;
}
private static Map b(PayPalPayment payPalPayment) {
if (payPalPayment == null) {
return null;
}
HashMap hashMap = new HashMap();
PayPalPaymentDetails g = payPalPayment.g();
if (g != null) {
if (g.getShipping() != null) {
hashMap.put(FirebaseAnalytics.Param.SHIPPING, ek.a(g.getShipping().doubleValue(), payPalPayment.d()));
}
if (g.getSubtotal() != null) {
hashMap.put("subtotal", ek.a(g.getSubtotal().doubleValue(), payPalPayment.d()));
}
if (g.getTax() != null) {
hashMap.put(FirebaseAnalytics.Param.TAX, ek.a(g.getTax().doubleValue(), payPalPayment.d()));
}
}
if (hashMap.isEmpty()) {
return null;
}
return hashMap;
}
private void b() {
dx dxVar = this.c;
if (dxVar != null) {
JSONObject jSONObject = dxVar.b() != null ? this.c.b().toJSONObject() : null;
int h = this.c.h();
ArrayList a2 = gl.a(jSONObject, this.c.a(), this.c.i());
if (this.h.a().isNoShipping() || a2 == null || a2.size() <= 0) {
this.g.f().setClickable(false);
this.g.f().setVisibility(8);
} else {
this.g.f().setVisibility(0);
this.g.f().setClickable(true);
this.g.a(getApplicationContext(), (gl) a2.get(h));
gm gmVar = new gm(this, a2, h);
new ListView(this).setAdapter((ListAdapter) gmVar);
this.g.d(new da(this, gmVar, a2));
}
int g = this.c.g();
ArrayList a3 = fz.a(this.c.c(), this.c.d());
if (a3 == null || a3.size() <= 0) {
this.g.e().setClickable(false);
this.g.e().setVisibility(8);
} else {
this.g.e().setVisibility(0);
this.g.e().setClickable(true);
this.g.a(getApplicationContext(), (fz) a3.get(g));
ga gaVar = new ga(this, a3, g);
new ListView(this).setAdapter((ListAdapter) gaVar);
this.g.c(new cy(this, gaVar, a3));
}
this.g.b(true);
}
}
static void b(PaymentConfirmActivity paymentConfirmActivity) {
new StringBuilder().append(a).append(".postBindSetup()");
if (paymentConfirmActivity.i.equals(dh.PayPal)) {
paymentConfirmActivity.g.a(com.paypal.android.sdk.d.b(paymentConfirmActivity.k.d().a()));
} else {
paymentConfirmActivity.g.a((SpannableString) null);
}
dg dgVar = paymentConfirmActivity.b;
if (dgVar != null) {
paymentConfirmActivity.a(dgVar.a, paymentConfirmActivity.b.b);
paymentConfirmActivity.b = null;
}
if (paymentConfirmActivity.getIntent().getBooleanExtra("com.paypal.android.sdk.payments.PaymentConfirmActivity.EXTRA_RESET_PP_REQUEST_ID", false)) {
paymentConfirmActivity.k.c().a();
}
boolean e = paymentConfirmActivity.e();
if (!paymentConfirmActivity.d) {
paymentConfirmActivity.d = true;
paymentConfirmActivity.k.a(fc.ConfirmPaymentWindow);
}
paymentConfirmActivity.f();
paymentConfirmActivity.k.b(new dc(paymentConfirmActivity));
if (dh.PayPal != paymentConfirmActivity.i || e || paymentConfirmActivity.f || paymentConfirmActivity.c != null) {
return;
}
paymentConfirmActivity.i();
}
static void b(PaymentConfirmActivity paymentConfirmActivity, List list, int i) {
paymentConfirmActivity.h.b().b(i);
paymentConfirmActivity.g.a(paymentConfirmActivity, (gl) list.get(i));
}
public void c() {
if (this.k.c().g == null || this.k.c().g.a()) {
return;
}
this.k.c().g = null;
this.k.c().c = null;
}
private void d() {
this.m = bindService(d.b(this), this.l, 1);
}
private boolean e() {
if (!this.i.equals(dh.PayPal) || this.k.j() || this.e) {
return false;
}
this.e = true;
a(false);
return true;
}
private void f() {
Enum a2;
String str;
int i;
int i2;
PayPalPayment a3 = this.h.a();
this.g.a(a3.b(), ek.a(Locale.getDefault(), com.paypal.android.sdk.de.a().c().a(), a3.a().doubleValue(), a3.d(), true));
if (this.i == dh.PayPal) {
this.g.a(true);
a(this.k.r());
} else if (this.i == dh.CreditCard || this.i == dh.CreditCardToken) {
this.g.a(false);
if (this.i == dh.CreditCard) {
str = com.paypal.android.sdk.dt.a(d.a(this.j));
i = d.b(this.j, "expiryMonth");
i2 = d.b(this.j, "expiryYear");
a2 = d.b(this.j);
} else {
com.paypal.android.sdk.dt s = this.k.s();
String d = s.d();
int f = s.f();
int g = s.g();
a2 = d.a(s);
str = d;
i = f;
i2 = g;
}
this.g.a(str, d.a(this, a2), String.format(Locale.getDefault(), "%02d / %04d", Integer.valueOf(i), Integer.valueOf(i2)));
} else {
Log.wtf(a, "Unknown payment type: " + this.i.toString());
d.a(this, "The payment is not a valid type. Please try again.", 3);
}
d.a(this.g.d(), this.k.e());
}
public void g() {
throw new UnsupportedOperationException("Method not decompiled: com.paypal.android.sdk.payments.PaymentConfirmActivity.g():void");
}
public ce h() {
return new ct(this);
}
public void i() {
PayPalService payPalService = this.k;
if (payPalService == null || payPalService.c().g == null) {
return;
}
showDialog(2);
PayPalPayment a2 = this.h.a();
this.k.a(a(a2), b(a2), a2.h(), a2.b(), this.k.d().j(), a2.e(), a2.c().toString(), a2.isEnablePayPalShippingAddressesRetrieval(), a2.i(), a2.j(), a2.k(), a2.isNoShipping(), a2.f());
this.f = true;
a(this.k.r());
}
public void j() {
try {
dismissDialog(2);
} catch (IllegalArgumentException e) {
}
}
@Override
public final void finish() {
super.finish();
new StringBuilder().append(a).append(".finish");
}
@Override
protected final void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
StringBuilder sb = new StringBuilder();
String str = a;
sb.append(str).append(".onActivityResult(requestCode:").append(i).append(", resultCode:").append(i2).append(", data:").append(intent).append(")");
switch (i) {
case 1:
this.e = false;
if (i2 == -1) {
ge geVar = this.g;
if (geVar != null) {
geVar.b(false);
}
if (this.k != null) {
i();
return;
}
return;
}
break;
case 2:
this.e = false;
if (i2 == -1) {
this.g.b(true);
a(intent.getExtras());
if (this.k != null) {
i();
return;
}
return;
}
break;
default:
Log.e(str, "unhandled requestCode " + i);
return;
}
a(i2);
finish();
}
@Override
public final void onBackPressed() {
PayPalService payPalService = this.k;
if (payPalService != null) {
payPalService.a(fc.ConfirmPaymentCancel);
c();
}
super.onBackPressed();
}
@Override
protected final void onCreate(Bundle bundle) {
super.onCreate(bundle);
new StringBuilder().append(a).append(".onCreate");
d();
if (bundle == null) {
if (!d.a(this)) {
finish();
}
this.d = false;
} else {
this.d = bundle.getBoolean("pageTrackingSent");
this.e = bundle.getBoolean("isLoginActivityInProgress");
this.f = bundle.getBoolean("isSFOPaymentRequestInProgress");
}
if (getIntent().getExtras() == null) {
onBackPressed();
return;
}
this.i = (dh) getIntent().getSerializableExtra("com.paypal.android.sdk.payments.PaymentConfirmActivity.EXTRA_PAYMENT_KIND");
this.j = getIntent().getParcelableExtra("com.paypal.android.sdk.payments.PaymentConfirmActivity.EXTRA_CREDIT_CARD");
this.h = new cp(getIntent());
setTheme(R.style.Theme.Holo.Light);
requestWindowFeature(8);
ge geVar = new ge(this, this.i == dh.PayPal);
this.g = geVar;
setContentView(geVar.a());
d.a(this, this.g.b(), fw.CONFIRM);
this.g.b(new cq(this));
this.g.a(new cv(this));
if (dh.PayPal == this.i) {
this.c = (dx) getIntent().getParcelableExtra("com.paypal.android.sdk.payments.PaymentConfirmActivity.EXTRA_PAYMENT_INFO");
b();
}
}
@Override
protected final Dialog onCreateDialog(int i, Bundle bundle) {
switch (i) {
case 1:
return d.a(this, fw.PAY_FAILED_ALERT_TITLE, bundle);
case 2:
return d.a(this, fw.PROCESSING, fw.ONE_MOMENT);
case 3:
return d.a(this, fw.INTERNAL_ERROR, bundle, i);
case 4:
return d.a(this, fw.SESSION_EXPIRED_TITLE, bundle, new dd(this));
case 5:
fu.a(fw.UNEXPECTED_PAYMENT_FLOW);
if (bundle == null || !com.paypal.android.sdk.d.b((CharSequence) bundle.getString("BUNDLE_ERROR_CODE"))) {
fw fwVar = fw.WE_ARE_SORRY;
fw fwVar2 = fw.UNEXPECTED_PAYMENT_FLOW;
fw fwVar3 = fw.TRY_AGAIN;
fw fwVar4 = fw.CANCEL;
cr crVar = new cr(this);
return new AlertDialog.Builder(this).setIcon(R.drawable.ic_dialog_alert).setTitle(fu.a(fwVar)).setMessage(fu.a(fwVar2)).setPositiveButton(fu.a(fwVar3), crVar).setNegativeButton(fu.a(fwVar4), new cs(this)).create();
}
String string = bundle.getString("BUNDLE_ERROR_CODE");
fw fwVar5 = fw.WE_ARE_SORRY;
String a2 = fu.a(string);
fw fwVar6 = fw.TRY_AGAIN;
fw fwVar7 = fw.CANCEL;
de deVar = new de(this);
return new AlertDialog.Builder(this).setIcon(R.drawable.ic_dialog_alert).setTitle(fu.a(fwVar5)).setMessage(a2).setPositiveButton(fu.a(fwVar6), deVar).setNegativeButton(fu.a(fwVar7), new df(this)).create();
default:
return null;
}
}
@Override
protected final void onDestroy() {
new StringBuilder().append(a).append(".onDestroy");
PayPalService payPalService = this.k;
if (payPalService != null) {
payPalService.m();
}
if (this.m) {
unbindService(this.l);
this.m = false;
}
super.onDestroy();
}
@Override
protected final void onRestart() {
super.onRestart();
d();
}
@Override
protected final void onResume() {
super.onResume();
new StringBuilder().append(a).append(".onResume");
if (this.k != null) {
f();
}
}
@Override
protected final void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
bundle.putBoolean("pageTrackingSent", this.d);
bundle.putBoolean("isLoginActivityInProgress", this.e);
bundle.putBoolean("isSFOPaymentRequestInProgress", this.f);
}
@Override
public final void onWindowFocusChanged(boolean z) {
super.onWindowFocusChanged(z);
new StringBuilder().append(a).append(".onWindowFocusChanged");
this.g.c();
}
}