正在查看: OLX India v19.42.007 应用的 PaymentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: OLX India v19.42.007 应用的 PaymentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.olxgroup.panamera.app.monetization.myOrder.activities;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.view.MenuItem;
import android.webkit.SslErrorHandler;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import androidx.browser.customtabs.CustomTabsClient;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.browser.customtabs.a;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.naspers.ragnarok.domain.constant.Constants;
import com.olx.southasia.databinding.o0;
import com.olxgroup.panamera.app.monetization.myOrder.vm.x;
import com.olxgroup.panamera.domain.buyers.common.entity.ad.AdItem;
import com.olxgroup.panamera.domain.monetization.common.entity.PaymentContext;
import com.olxgroup.panamera.domain.monetization.listings.entity.PackageLocationCategory;
import com.olxgroup.panamera.domain.monetization.vas.entity.VASPurchaseOrigin;
import com.olxgroup.panamera.domain.seller.coupons.entity.Coupon;
import com.payu.checkoutpro.PayUCheckoutPro;
import com.payu.ui.model.listeners.PayUHashGenerationListener;
import java.io.Serializable;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
import kotlin.Function;
import kotlin.Lazy;
import kotlin.LazyKt;
import kotlin.Metadata;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.CallableReference;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.FunctionAdapter;
import kotlin.jvm.internal.FunctionReferenceImpl;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlin.text.StringsKt;
import olx.com.delorean.domain.utils.EventWrapper;
import olx.com.delorean.view.notificationCenter.deeplink.DeepLinkActivity;
@Metadata
@SourceDebugExtension
public final class PaymentActivity extends com.olxgroup.panamera.app.monetization.myOrder.activities.f {
public static final a m0 = new a(null);
public static final int n0 = 8;
private PaymentContext a0;
private VASPurchaseOrigin b0;
private List c0;
private PayUHashGenerationListener d0;
private Coupon f0;
private String g0;
private CustomTabsClient h0;
private boolean i0;
public o0 l0;
private List e0 = new ArrayList();
private androidx.browser.customtabs.c j0 = new b();
private final Lazy k0 = LazyKt.b(new Function0() {
public final Object invoke() {
x.a r3;
r3 = PaymentActivity.r3(PaymentActivity.this);
return r3;
}
});
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
private a() {
}
}
public static final class b extends androidx.browser.customtabs.c {
b() {
}
public void onCustomTabsServiceConnected(ComponentName componentName, CustomTabsClient customTabsClient) {
if (PaymentActivity.this.isFinishing()) {
return;
}
PaymentActivity.this.h0 = customTabsClient;
CustomTabsClient customTabsClient2 = PaymentActivity.this.h0;
if (customTabsClient2 != null) {
customTabsClient2.g(0L);
}
PaymentActivity.this.j3();
}
public void onServiceDisconnected(ComponentName componentName) {
PaymentActivity.this.h0 = null;
}
}
class c extends FunctionReferenceImpl implements Function0 {
c(Object obj) {
super(0, obj, PaymentActivity.class, "cancelFlow", "cancelFlow()V", 0);
}
public final void b() {
((PaymentActivity) ((CallableReference) this).receiver).P2();
}
public Object invoke() {
b();
return Unit.a;
}
}
class d extends FunctionReferenceImpl implements Function0 {
d(Object obj) {
super(0, obj, PaymentActivity.class, "finishFlow", "finishFlow()V", 0);
}
public final void b() {
((PaymentActivity) ((CallableReference) this).receiver).finishFlow();
}
public Object invoke() {
b();
return Unit.a;
}
}
public static final class e extends WebViewClient {
final WebView b;
e(WebView webView) {
this.b = webView;
}
@Override
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
PaymentActivity.this.hideProgress();
}
@Override
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
sslErrorHandler.cancel();
PaymentActivity.this.W2().o("Web_View");
PaymentActivity.this.p3();
}
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
PaymentActivity.this.hideProgress();
if (StringsKt.T(str, "upi://pay", false, 2, (Object) null)) {
try {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(str));
PaymentActivity.this.startActivity(intent);
} catch (Exception unused) {
}
return true;
}
if (StringsKt.O(str, "intent://payment", false, 2, (Object) null)) {
return PaymentActivity.this.W2().A(str);
}
if (!StringsKt.O(str, "intent://pay", false, 2, (Object) null)) {
return PaymentActivity.this.W2().A(str);
}
try {
Intent parseUri = Intent.parseUri(str, 1);
if (parseUri == null) {
return PaymentActivity.this.W2().A(str);
}
if (this.b.getContext().getPackageManager().resolveActivity(parseUri, 65536) != null) {
this.b.getContext().startActivity(parseUri);
} else {
String stringExtra = parseUri.getStringExtra("browser_fallback_url");
if (stringExtra != null) {
this.b.loadUrl(stringExtra);
}
}
return true;
} catch (URISyntaxException unused2) {
return PaymentActivity.this.W2().A(str);
}
}
}
static final class f implements Observer, FunctionAdapter {
private final Function1 a;
f(Function1 function1) {
this.a = function1;
}
public final boolean equals(Object obj) {
if ((obj instanceof Observer) && (obj instanceof FunctionAdapter)) {
return Intrinsics.d(getFunctionDelegate(), ((FunctionAdapter) obj).getFunctionDelegate());
}
return false;
}
public final Function getFunctionDelegate() {
return this.a;
}
public final int hashCode() {
return getFunctionDelegate().hashCode();
}
public final void onChanged(Object obj) {
this.a.invoke(obj);
}
}
private final void R2(Intent intent) {
if (intent.hasExtra(Constants.ExtraKeys.CHOSEN_OPTION)) {
this.g0 = intent.getStringExtra(Constants.ExtraKeys.CHOSEN_OPTION);
}
}
private final void S2(Intent intent) {
if (intent.hasExtra("applied_coupon")) {
Coupon serializableExtra = intent.getSerializableExtra("applied_coupon");
this.f0 = serializableExtra instanceof Coupon ? serializableExtra : null;
}
}
private final String T2() {
return CustomTabsClient.c(this, this.e0);
}
private final void U2(Intent intent) {
VASPurchaseOrigin vASPurchaseOrigin;
Bundle extras = intent.getExtras();
if (extras != null) {
Serializable serializable = extras.getSerializable("purchase_origin");
vASPurchaseOrigin = serializable instanceof VASPurchaseOrigin ? (VASPurchaseOrigin) serializable : null;
} else {
vASPurchaseOrigin = VASPurchaseOrigin.HOME;
}
this.b0 = vASPurchaseOrigin;
}
private final void V2(Intent intent) {
if (intent.hasExtra("vas_package")) {
Serializable serializableExtra = getIntent().getSerializableExtra("vas_package");
this.c0 = serializableExtra instanceof List ? (List) serializableExtra : null;
}
}
public final x W2() {
return (x) this.k0.getValue();
}
private final void Y2() {
i3();
}
private final boolean Z2() {
List list = this.e0;
return list != null && (list.isEmpty() ^ true);
}
public static final Unit b3(PaymentActivity paymentActivity, PayUHashGenerationListener payUHashGenerationListener) {
paymentActivity.d0 = payUHashGenerationListener;
return Unit.a;
}
private final void c3() {
W2().b().observe(this, new f(new Function1() {
public final Object invoke(Object obj) {
Unit d3;
d3 = PaymentActivity.d3(PaymentActivity.this, (EventWrapper) obj);
return d3;
}
}));
}
public static final Unit d3(PaymentActivity paymentActivity, EventWrapper eventWrapper) {
String purchaseUrl;
x.b bVar = (x.b) eventWrapper.getContentIfNotHandled();
if (bVar == null) {
return Unit.a;
}
if (Intrinsics.d(bVar, x.b.C0302b.a)) {
paymentActivity.finishFlow();
} else if (Intrinsics.d(bVar, x.b.c.a)) {
paymentActivity.X2();
} else if (bVar instanceof x.b.f) {
if (((x.b.f) bVar).a()) {
paymentActivity.showProgress();
paymentActivity.Q2().I.setVisibility(8);
paymentActivity.hideErrorView();
} else {
paymentActivity.hideProgress();
}
} else if (Intrinsics.d(bVar, x.b.g.a)) {
paymentActivity.hideProgress();
paymentActivity.Q2().I.setVisibility(8);
paymentActivity.p3();
} else if (Intrinsics.d(bVar, x.b.h.a)) {
paymentActivity.hideProgress();
paymentActivity.Q2().I.setVisibility(8);
paymentActivity.p3();
} else if (bVar instanceof x.b.a) {
paymentActivity.hideProgress();
paymentActivity.o3(((x.b.a) bVar).a());
paymentActivity.P2();
} else if (bVar instanceof x.b.e) {
PaymentContext a2 = ((x.b.e) bVar).a();
paymentActivity.a0 = a2;
if (a2 != null && (purchaseUrl = a2.getPurchaseUrl()) != null && (!StringsKt.i0(purchaseUrl))) {
paymentActivity.hideProgress();
paymentActivity.hideErrorView();
paymentActivity.e3();
}
} else {
if (!(bVar instanceof x.b.d)) {
throw new NoWhenBranchMatchedException();
}
x.b.d dVar = (x.b.d) bVar;
paymentActivity.a0 = dVar.a();
paymentActivity.hideProgress();
paymentActivity.hideErrorView();
paymentActivity.a3(dVar.a());
}
return Unit.a;
}
private final void e3() {
if (!n3()) {
if (W2().U()) {
return;
}
Y2();
} else {
W2().f();
boolean a2 = CustomTabsClient.a(this, T2(), this.j0);
this.i0 = a2;
if (a2) {
return;
}
Y2();
}
}
private final void f3(Bundle bundle) {
if (bundle == null) {
m3(this.b0);
} else if (bundle.containsKey("payment_context")) {
PaymentContext serializable = bundle.getSerializable("payment_context");
this.a0 = serializable instanceof PaymentContext ? serializable : null;
}
}
private final void g3(Context context) {
List list;
PackageManager packageManager = context.getPackageManager();
for (ResolveInfo resolveInfo : packageManager.queryIntentActivities(new Intent("android.intent.action.VIEW", Uri.parse("http://www.example.com")), 0)) {
Intent intent = new Intent();
intent.setAction("android.support.customtabs.action.CustomTabsService");
intent.setPackage(resolveInfo.activityInfo.packageName);
if (packageManager.resolveService(intent, 0) != null && (list = this.e0) != null) {
list.add(resolveInfo.activityInfo.packageName);
}
}
}
private final void h3() {
WebView webView = Q2().I;
webView.getSettings().setLoadWithOverviewMode(true);
webView.setVerticalScrollBarEnabled(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setSupportZoom(false);
webView.getSettings().setBuiltInZoomControls(false);
webView.getSettings().setAllowContentAccess(false);
webView.getSettings().setAllowFileAccess(false);
webView.setWebViewClient(new e(webView));
}
private final void hideErrorView() {
Q2().B.setVisibility(8);
}
public final void hideProgress() {
Q2().E.setVisibility(8);
}
private final void i3() {
String purchaseUrl;
showProgress();
W2().l0("Web_View");
h3();
Q2().I.setVisibility(0);
PaymentContext paymentContext = this.a0;
if (paymentContext == null || (purchaseUrl = paymentContext.getPurchaseUrl()) == null) {
return;
}
Q2().I.loadUrl(purchaseUrl);
}
public final void j3() {
String purchaseUrl;
Uri parse;
CustomTabsIntent.e eVar = new CustomTabsIntent.e();
eVar.h(this, com.olx.southasia.b.fab_slide_in_from_left, com.olx.southasia.b.fab_slide_out_to_right);
eVar.o(true);
eVar.n(true);
eVar.d(false);
eVar.g(false);
eVar.i(true);
eVar.m(2);
eVar.c(false);
eVar.f(new a.a().b(androidx.core.content.b.getColor(this, com.olx.southasia.e.white)).a());
CustomTabsIntent a2 = eVar.a();
a2.intent.setPackage(T2());
W2().l0("Chrome_Custom_Tabs");
PaymentContext paymentContext = this.a0;
if (paymentContext == null || (purchaseUrl = paymentContext.getPurchaseUrl()) == null || (parse = Uri.parse(purchaseUrl)) == null) {
return;
}
a2.launchUrl(this, parse);
}
private final void k3(Intent intent) {
U2(intent);
V2(intent);
S2(intent);
R2(intent);
}
private final void m3(VASPurchaseOrigin vASPurchaseOrigin) {
PaymentContext paymentContext;
PaymentContext paymentContext2;
AdItem serializableExtra = getIntent().getSerializableExtra(Constants.ExtraKeys.CURRENT_AD);
AdItem adItem = serializableExtra instanceof AdItem ? serializableExtra : null;
Serializable serializableExtra2 = getIntent().getSerializableExtra("package_location_category");
PackageLocationCategory packageLocationCategory = serializableExtra2 instanceof PackageLocationCategory ? (PackageLocationCategory) serializableExtra2 : null;
PaymentContext paymentContext3 = adItem != null ? new PaymentContext(W2().E(), vASPurchaseOrigin, adItem, (List) null, (String) null, (String) null, (String) null, (Integer) null, (PaymentContext.PaymentStatus) null, (String) null, (PackageLocationCategory) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (Coupon) null, (String) null, (String) null, (String) null, 134217720, (DefaultConstructorMarker) null) : packageLocationCategory != null ? new PaymentContext(W2().E(), vASPurchaseOrigin, (AdItem) null, (List) null, (String) null, (String) null, (String) null, (Integer) null, (PaymentContext.PaymentStatus) null, (String) null, packageLocationCategory, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (Coupon) null, (String) null, (String) null, (String) null, 134216700, (DefaultConstructorMarker) null) : new PaymentContext(W2().E(), vASPurchaseOrigin, (AdItem) null, (List) null, (String) null, (String) null, (String) null, (Integer) null, (PaymentContext.PaymentStatus) null, (String) null, (PackageLocationCategory) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (String) null, (Coupon) null, (String) null, (String) null, (String) null, 134217724, (DefaultConstructorMarker) null);
this.a0 = paymentContext3;
List list = this.c0;
if (list != null) {
paymentContext3.setSelectedVASPackage(CollectionsKt.d0(list));
}
Coupon coupon = this.f0;
if (coupon != null && (paymentContext2 = this.a0) != null) {
paymentContext2.setCoupon(coupon);
}
String str = this.g0;
if (str == null || (paymentContext = this.a0) == null) {
return;
}
paymentContext.setChosenOption(str);
}
private final boolean n3() {
return !W2().U() && W2().a0() && Z2();
}
public final void p3() {
Q2().B.setVisibility(0);
}
private final String q3(Intent intent) {
String schemeSpecificPart;
Uri data = intent.getData();
if (data == null || (schemeSpecificPart = data.getSchemeSpecificPart()) == null) {
return null;
}
return StringsKt.K(schemeSpecificPart, "//", "", false, 4, (Object) null);
}
public static final x.a r3(PaymentActivity paymentActivity) {
return (x.a) new ViewModelProvider(paymentActivity).get(x.a.class);
}
private final void showProgress() {
Q2().E.setVisibility(0);
}
public final void P2() {
setResult(0, olx.com.delorean.a.C0(this.a0));
finish();
}
public final o0 Q2() {
o0 o0Var = this.l0;
if (o0Var != null) {
return o0Var;
}
return null;
}
public final void X2() {
startActivity(olx.com.delorean.a.y0());
finish();
}
public final void a3(PaymentContext paymentContext) {
com.olxgroup.panamera.app.monetization.myOrder.payusdk.a aVar = com.olxgroup.panamera.app.monetization.myOrder.payusdk.a.a;
PayUCheckoutPro.open(this, aVar.a(paymentContext, W2().j0()), aVar.b(), new com.olxgroup.panamera.app.monetization.myOrder.payusdk.b(W2(), new c(this), new d(this), new Function1() {
public final Object invoke(Object obj) {
Unit b3;
b3 = PaymentActivity.b3(PaymentActivity.this, (PayUHashGenerationListener) obj);
return b3;
}
}));
x W2 = W2();
W2.l0("native");
W2.m(paymentContext.getTxnid());
W2.q();
}
public final void finishFlow() {
setResult(-1, olx.com.delorean.a.C0(this.a0));
finish();
}
public final void l3(o0 o0Var) {
this.l0 = o0Var;
}
public final void o3(String str) {
if (str == null || !(!StringsKt.i0(str))) {
return;
}
Toast.makeText((Context) this, (CharSequence) str, 1).show();
}
@Override
public void onBackPressed() {
if (Q2().I.canGoBack()) {
Q2().I.goBack();
} else {
finish();
}
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
k3(getIntent());
f3(bundle);
l3((o0) androidx.databinding.g.j(this, com.olx.southasia.k.activity_payment));
W2().e0(this.a0);
c3();
if (this.c0 == null) {
startActivity(DeepLinkActivity.p2(Constants.Source.HOME));
finish();
}
List list = this.c0;
if (list != null) {
W2().i0(CollectionsKt.d0(list));
}
g3(this);
}
@Override
protected void onDestroy() {
if (this.i0) {
unbindService(this.j0);
this.h0 = null;
}
super.onDestroy();
}
protected void onNewIntent(Intent intent) {
String q3;
PaymentContext paymentContext;
PaymentContext paymentContext2;
PaymentContext paymentContext3;
super/*androidx.activity.ComponentActivity*/.onNewIntent(intent);
if (intent.getData() == null || (q3 = q3(intent)) == null) {
return;
}
switch (q3.hashCode()) {
case -1845857183:
if (q3.equals("payment/completeOffline") && (paymentContext = this.a0) != null) {
paymentContext.setPaymentStatus(PaymentContext.PaymentStatus.PENDING);
return;
}
return;
case -1644676479:
if (!q3.equals("payment/failure")) {
return;
}
break;
case -970085725:
if (q3.equals("payment/cancel") && (paymentContext2 = this.a0) != null) {
paymentContext2.setPaymentStatus(PaymentContext.PaymentStatus.CANCELED);
return;
}
return;
case 386706623:
if (!q3.equals("payment/error")) {
return;
}
break;
case 1869695226:
if (q3.equals("payment/success") && (paymentContext3 = this.a0) != null) {
paymentContext3.setPaymentStatus(PaymentContext.PaymentStatus.PROCESSED);
return;
}
return;
default:
return;
}
PaymentContext paymentContext4 = this.a0;
if (paymentContext4 != null) {
paymentContext4.setPaymentStatus(PaymentContext.PaymentStatus.ERROR);
}
}
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() != 16908332) {
return super/*android.app.Activity*/.onOptionsItemSelected(menuItem);
}
onBackPressed();
return true;
}
@Override
protected void onResume() {
String purchaseUrl;
super.onResume();
PaymentContext paymentContext = this.a0;
if (paymentContext == null || (purchaseUrl = paymentContext.getPurchaseUrl()) == null || !(!StringsKt.i0(purchaseUrl)) || !n3()) {
return;
}
W2().g0("Chrome_Custom_Tabs");
}
protected void onSaveInstanceState(Bundle bundle) {
super/*androidx.activity.ComponentActivity*/.onSaveInstanceState(bundle);
bundle.putSerializable("payment_context", this.a0);
PaymentContext paymentContext = this.a0;
bundle.putString("purchase_url", paymentContext != null ? paymentContext.getPurchaseUrl() : null);
bundle.putStringArrayList("supported_browsers", (ArrayList) this.e0);
}
}