正在查看: Hopscotch v9.7.2 应用的 PaymentStateActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Hopscotch v9.7.2 应用的 PaymentStateActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package in.hopscotch.android.hscheckout.ui;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.ViewGroup;
import androidx.activity.c0;
import androidx.lifecycle.LifecycleCoroutineScope;
import androidx.lifecycle.LifecycleOwnerKt;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelKt;
import androidx.lifecycle.ViewModelLazy;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.ViewModelStore;
import androidx.lifecycle.viewmodel.CreationExtras;
import androidx.work.d0;
import androidx.work.f0;
import androidx.work.g;
import androidx.work.impl.n0;
import androidx.work.t;
import in.hopscotch.android.hscheckout.communicator.a;
import in.hopscotch.android.hscheckout.ui.o;
import in.hopscotch.android.hscheckout.worker.PaymentWorker;
import in.juspay.hyper.constants.Labels;
import in.juspay.hyper.constants.LogCategory;
import in.juspay.hyperinteg.HyperServiceHolder;
import in.juspay.hypersdk.core.PaymentConstants;
import in.juspay.services.HyperServices;
import java.util.UUID;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.FunctionAdapter;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.Reflection;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.BuildersKt__Builders_commonKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.Dispatchers;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;
@Metadata
@SourceDebugExtension({"SMAP\nPaymentStateActivity.kt\nKotlin\n*S Kotlin\n*F\n+ 1 PaymentStateActivity.kt\nin/hopscotch/android/hscheckout/ui/PaymentStateActivity\n+ 2 ActivityViewModelLazy.kt\nandroidx/activity/ActivityViewModelLazyKt\n+ 3 Bundle+Extensions.kt\nin/hopscotch/android/hscheckout/util/Bundle_ExtensionsKt\n+ 4 OneTimeWorkRequest.kt\nandroidx/work/OneTimeWorkRequestKt\n+ 5 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,355:1\n75#2,13:356\n13#3,4:369\n100#4:373\n1#5:374\n*S KotlinDebug\n*F\n+ 1 PaymentStateActivity.kt\nin/hopscotch/android/hscheckout/ui/PaymentStateActivity\n*L\n56#1:356,13\n69#1:369,4\n220#1:373\n*E\n"})
public final class PaymentStateActivity extends n implements o.a {
public static final int j = 0;
private boolean exitedFromJuspay;
private HyperServiceHolder hyperServicesHolder;
public in.hopscotch.android.hscheckout.databinding.a i;
private in.hopscotch.android.hscheckout.domain.model.d jusPayResponse;
private long orderId;
private f0 payStatusWork;
private o paymentFragment;
@NotNull
private String orderBarCode = "";
@NotNull
private final kotlin.l workManager$delegate = kotlin.m.b(new h());
@NotNull
private final kotlin.l paymentViewModel$delegate = new ViewModelLazy(Reflection.getOrCreateKotlinClass(in.hopscotch.android.hscheckout.viewmodel.h.class), new f(this), new e(this), new g(null, this));
@NotNull
private final b onBackPressedCallback = new b();
public class a {
public static final int[] a;
static {
int[] iArr = new int[in.hopscotch.android.hscheckout.data.model.j.values().length];
try {
iArr[in.hopscotch.android.hscheckout.data.model.j.SUCCESS.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[in.hopscotch.android.hscheckout.data.model.j.FAILURE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[in.hopscotch.android.hscheckout.data.model.j.PENDING.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
a = iArr;
}
}
public static final class b extends c0 {
public b() {
super(true);
}
public final void d() {
androidx.fragment.app.n nVar = PaymentStateActivity.this;
HyperServiceHolder hyperServiceHolder = ((PaymentStateActivity) nVar).hyperServicesHolder;
if ((hyperServiceHolder == null || !hyperServiceHolder.onBackPressed()) && ((PaymentStateActivity) nVar).exitedFromJuspay && !nVar.isFinishing()) {
o oVar = new o();
oVar.show(nVar.getSupportFragmentManager(), o.class.getName());
((PaymentStateActivity) nVar).paymentFragment = oVar;
}
}
}
@kotlin.coroutines.jvm.internal.e(c = "in.hopscotch.android.hscheckout.ui.PaymentStateActivity$onCreate$2", f = "PaymentStateActivity.kt", l = {80, 83}, m = "invokeSuspend")
public static final class c extends kotlin.coroutines.jvm.internal.j implements Function2<CoroutineScope, kotlin.coroutines.d<? super Unit>, Object> {
public int a;
public c(kotlin.coroutines.d<? super c> dVar) {
super(2, dVar);
}
@Override
@NotNull
public final kotlin.coroutines.d<Unit> create(Object obj, @NotNull kotlin.coroutines.d<?> dVar) {
return PaymentStateActivity.this.new c(dVar);
}
@Override
public final Object invoke(CoroutineScope coroutineScope, kotlin.coroutines.d<? super Unit> dVar) {
return ((c) create(coroutineScope, dVar)).invokeSuspend(Unit.a);
}
@Override
public final Object invokeSuspend(@NotNull Object obj) {
Object obj2 = kotlin.coroutines.intrinsics.a.COROUTINE_SUSPENDED;
int i = this.a;
if (i == 0) {
kotlin.r.b(obj);
PaymentStateActivity paymentStateActivity = PaymentStateActivity.this;
HyperServiceHolder hyperServiceHolder = paymentStateActivity.hyperServicesHolder;
if (hyperServiceHolder == null || !hyperServiceHolder.isInitialised()) {
HyperServiceHolder hyperServiceHolder2 = paymentStateActivity.hyperServicesHolder;
if (hyperServiceHolder2 != null) {
in.hopscotch.android.hscheckout.util.c.a.getClass();
JSONObject jSONObject = new JSONObject();
JSONObject jSONObject2 = new JSONObject();
try {
jSONObject2.put(LogCategory.ACTION, Labels.HyperSdk.INITIATE);
jSONObject2.put("logLevel", "1");
jSONObject2.put(PaymentConstants.MERCHANT_ID_CAMEL, "hopscotch");
jSONObject2.put(PaymentConstants.CLIENT_ID_CAMEL, "hopscotch");
jSONObject2.put(PaymentConstants.ENV, "production");
UUID randomUUID = UUID.randomUUID();
StringBuilder sb = new StringBuilder();
sb.append(randomUUID);
jSONObject.put("requestId", sb.toString());
jSONObject.put(PaymentConstants.SERVICE, "in.juspay.hyperpay");
jSONObject.put(PaymentConstants.PAYLOAD, jSONObject2);
} catch (Exception e) {
e.printStackTrace();
}
hyperServiceHolder2.initiate(jSONObject);
}
this.a = 2;
Object withContext = BuildersKt.withContext(Dispatchers.getIO(), new t(paymentStateActivity, null), this);
if (withContext != kotlin.coroutines.intrinsics.a.COROUTINE_SUSPENDED) {
withContext = Unit.a;
}
if (withContext == obj2) {
return obj2;
}
} else {
this.a = 1;
Object withContext2 = BuildersKt.withContext(Dispatchers.getIO(), new t(paymentStateActivity, null), this);
if (withContext2 != obj2) {
withContext2 = Unit.a;
}
if (withContext2 == obj2) {
return obj2;
}
}
} else {
if (i != 1 && i != 2) {
throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
}
kotlin.r.b(obj);
}
return Unit.a;
}
}
public static final class d implements Observer, FunctionAdapter {
private final Function1 function;
public d(Function1 function) {
Intrinsics.checkNotNullParameter(function, "function");
this.function = function;
}
public final boolean equals(Object obj) {
if ((obj instanceof Observer) && (obj instanceof FunctionAdapter)) {
return Intrinsics.areEqual(this.function, ((FunctionAdapter) obj).getFunctionDelegate());
}
return false;
}
@Override
@NotNull
public final kotlin.h<?> getFunctionDelegate() {
return this.function;
}
public final int hashCode() {
return this.function.hashCode();
}
public final void onChanged(Object obj) {
this.function.invoke(obj);
}
}
@SourceDebugExtension({"SMAP\nActivityViewModelLazy.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ActivityViewModelLazy.kt\nandroidx/activity/ActivityViewModelLazyKt$viewModels$factoryPromise$2\n*L\n1#1,90:1\n*E\n"})
public static final class e extends Lambda implements Function0<ViewModelProvider.Factory> {
public final androidx.activity.j h;
public e(androidx.activity.j jVar) {
super(0);
this.h = jVar;
}
@Override
public final ViewModelProvider.Factory invoke() {
return this.h.getDefaultViewModelProviderFactory();
}
}
@SourceDebugExtension({"SMAP\nActivityViewModelLazy.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ActivityViewModelLazy.kt\nandroidx/activity/ActivityViewModelLazyKt$viewModels$3\n*L\n1#1,90:1\n*E\n"})
public static final class f extends Lambda implements Function0<ViewModelStore> {
public final androidx.activity.j h;
public f(androidx.activity.j jVar) {
super(0);
this.h = jVar;
}
@Override
public final ViewModelStore invoke() {
return this.h.getViewModelStore();
}
}
@SourceDebugExtension({"SMAP\nActivityViewModelLazy.kt\nKotlin\n*S Kotlin\n*F\n+ 1 ActivityViewModelLazy.kt\nandroidx/activity/ActivityViewModelLazyKt$viewModels$4\n*L\n1#1,90:1\n*E\n"})
public static final class g extends Lambda implements Function0<CreationExtras> {
public final Function0 h;
public final androidx.activity.j i;
public g(Function0 function0, androidx.activity.j jVar) {
super(0);
this.h = function0;
this.i = jVar;
}
@Override
public final CreationExtras invoke() {
CreationExtras creationExtras;
Function0 function0 = this.h;
return (function0 == null || (creationExtras = (CreationExtras) function0.invoke()) == null) ? this.i.getDefaultViewModelCreationExtras() : creationExtras;
}
}
public static final class h extends Lambda implements Function0<d0> {
public h() {
super(0);
}
@Override
public final d0 invoke() {
n0 n = n0.n(PaymentStateActivity.this);
Intrinsics.checkNotNullExpressionValue(n, "getInstance(...)");
return n;
}
}
public static final void T0(PaymentStateActivity paymentStateActivity) {
paymentStateActivity.exitedFromJuspay = true;
if (paymentStateActivity.orderId == 0) {
paymentStateActivity.g1("Order is zero");
in.hopscotch.android.hscheckout.communicator.a aVar = in.hopscotch.android.hscheckout.communicator.a.a;
LifecycleCoroutineScope lifecycleScope = LifecycleOwnerKt.getLifecycleScope(paymentStateActivity);
a.b.e eVar = new a.b.e(new in.hopscotch.android.hscheckout.data.model.d("", "", "Order is zero", ""), null);
aVar.getClass();
in.hopscotch.android.hscheckout.communicator.a.b(lifecycleScope, eVar);
paymentStateActivity.b();
}
in.hopscotch.android.hscheckout.viewmodel.h e1 = paymentStateActivity.e1();
long j2 = paymentStateActivity.orderId;
e1.getClass();
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(e1), null, null, new in.hopscotch.android.hscheckout.viewmodel.e(e1, j2, null), 3, null);
}
public static final void Z0(PaymentStateActivity paymentStateActivity, long j2) {
paymentStateActivity.getClass();
g.a aVar = new g.a();
aVar.e(paymentStateActivity.orderId, "ORDER_ID");
aVar.e(j2, "retries");
androidx.work.g a2 = aVar.a();
Intrinsics.checkNotNullExpressionValue(a2, "build(...)");
paymentStateActivity.payStatusWork = new t.a(PaymentWorker.class).k(a2).i(androidx.work.f.a).b();
d0 f1 = paymentStateActivity.f1();
f0 f0Var = paymentStateActivity.payStatusWork;
f0 f0Var2 = null;
if (f0Var == null) {
Intrinsics.throwUninitializedPropertyAccessException("payStatusWork");
f0Var = null;
}
f1.c(f0Var);
d0 f12 = paymentStateActivity.f1();
f0 f0Var3 = paymentStateActivity.payStatusWork;
if (f0Var3 == null) {
Intrinsics.throwUninitializedPropertyAccessException("payStatusWork");
} else {
f0Var2 = f0Var3;
}
f12.d(f0Var2.a()).observe(paymentStateActivity, new d(new q(paymentStateActivity)));
}
public static final void a1(PaymentStateActivity paymentStateActivity, in.hopscotch.android.hscheckout.data.model.j jVar, in.hopscotch.android.hscheckout.data.model.d dVar, String str) {
paymentStateActivity.getClass();
if (dVar != null) {
in.hopscotch.android.hscheckout.communicator.a aVar = in.hopscotch.android.hscheckout.communicator.a.a;
LifecycleCoroutineScope lifecycleScope = LifecycleOwnerKt.getLifecycleScope(paymentStateActivity);
a.b.e eVar = new a.b.e(dVar, str);
aVar.getClass();
in.hopscotch.android.hscheckout.communicator.a.b(lifecycleScope, eVar);
Intent intent = new Intent();
intent.putExtra("errorData", dVar);
paymentStateActivity.setResult(1997520, intent);
paymentStateActivity.finish();
return;
}
int i = jVar == null ? -1 : a.a[jVar.ordinal()];
if (i == 1) {
paymentStateActivity.d1();
return;
}
if (i == 2) {
new a.b.e(null, str);
paymentStateActivity.h1();
} else if (i != 3) {
paymentStateActivity.h1();
} else {
new a.b.f(null, str);
paymentStateActivity.h1();
}
}
@Override
public final void b() {
o oVar = this.paymentFragment;
if (oVar != null) {
oVar.dismissAllowingStateLoss();
}
f1().a();
this.exitedFromJuspay = true;
Intent intent = new Intent();
intent.putExtra("ORDER_ID", this.orderId);
setResult(2000520, intent);
finish();
}
public final void d1() {
in.hopscotch.android.hscheckout.viewmodel.h e1 = e1();
long j2 = this.orderId;
e1.getClass();
BuildersKt__Builders_commonKt.launch$default(ViewModelKt.getViewModelScope(e1), null, null, new in.hopscotch.android.hscheckout.viewmodel.g(e1, j2, null), 3, null);
}
public final in.hopscotch.android.hscheckout.viewmodel.h e1() {
return (in.hopscotch.android.hscheckout.viewmodel.h) this.paymentViewModel$delegate.getValue();
}
public final d0 f1() {
return (d0) this.workManager$delegate.getValue();
}
public final void g1(String str) {
if (str != null) {
in.hopscotch.android.hscheckout.communicator.a aVar = in.hopscotch.android.hscheckout.communicator.a.a;
LifecycleCoroutineScope lifecycleScope = LifecycleOwnerKt.getLifecycleScope(this);
a.b.g gVar = new a.b.g(str);
aVar.getClass();
in.hopscotch.android.hscheckout.communicator.a.b(lifecycleScope, gVar);
}
}
public final void h1() {
in.hopscotch.android.hscheckout.communicator.a aVar = in.hopscotch.android.hscheckout.communicator.a.a;
LifecycleCoroutineScope lifecycleScope = LifecycleOwnerKt.getLifecycleScope(this);
a.b.m mVar = new a.b.m(this);
aVar.getClass();
in.hopscotch.android.hscheckout.communicator.a.b(lifecycleScope, mVar);
}
public final void onActivityResult(int i, int i2, Intent intent) {
HyperServices hyperServices;
super/*androidx.fragment.app.n*/.onActivityResult(i, i2, intent);
HyperServiceHolder hyperServiceHolder = this.hyperServicesHolder;
if (hyperServiceHolder == null || (hyperServices = hyperServiceHolder.getHyperServices()) == null) {
return;
}
hyperServices.onActivityResult(i, i2, intent);
}
@Override
public final void onCreate(Bundle bundle) {
Object obj;
super.onCreate(bundle);
LayoutInflater layoutInflater = getLayoutInflater();
int i = in.hopscotch.android.hscheckout.databinding.a.e;
in.hopscotch.android.hscheckout.databinding.a aVar = (in.hopscotch.android.hscheckout.databinding.a) androidx.databinding.p.M(layoutInflater, in.hopscotch.android.hscheckout.f.activity_hs_payment_state, (ViewGroup) null, false, androidx.databinding.g.e());
Intrinsics.checkNotNullExpressionValue(aVar, "inflate(...)");
Intrinsics.checkNotNullParameter(aVar, "<set-?>");
this.i = aVar;
if (aVar == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
aVar = null;
}
setContentView(aVar.E());
in.hopscotch.android.hscheckout.databinding.a aVar2 = this.i;
if (aVar2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("binding");
aVar2 = null;
}
setSupportActionBar(aVar2.d);
androidx.appcompat.app.a supportActionBar = getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.t(true);
supportActionBar.w();
supportActionBar.x(false);
}
androidx.activity.d0 onBackPressedDispatcher = getOnBackPressedDispatcher();
b onBackPressedCallback = this.onBackPressedCallback;
onBackPressedDispatcher.getClass();
Intrinsics.checkNotNullParameter(onBackPressedCallback, "onBackPressedCallback");
onBackPressedDispatcher.g(onBackPressedCallback);
Intent intent = getIntent();
Intrinsics.checkNotNullExpressionValue(intent, "getIntent(...)");
if (Build.VERSION.SDK_INT >= 33) {
obj = intent.getSerializableExtra("juspayResponse", in.hopscotch.android.hscheckout.domain.model.d.class);
} else {
Object serializableExtra = intent.getSerializableExtra("juspayResponse");
if (!(serializableExtra instanceof in.hopscotch.android.hscheckout.domain.model.d)) {
serializableExtra = null;
}
obj = (in.hopscotch.android.hscheckout.domain.model.d) serializableExtra;
}
this.jusPayResponse = (in.hopscotch.android.hscheckout.domain.model.d) obj;
this.orderId = getIntent().getLongExtra("ORDER_ID", 0L);
String stringExtra = getIntent().getStringExtra("ORDER_BARCODE");
if (stringExtra == null) {
stringExtra = "";
}
this.orderBarCode = stringExtra;
BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), null, null, new r(this, null), 3, null);
BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), null, null, new s(this, null), 3, null);
HyperServiceHolder hyperServiceHolder = new HyperServiceHolder(this);
this.hyperServicesHolder = hyperServiceHolder;
hyperServiceHolder.setCallback(new p(this));
BuildersKt__Builders_commonKt.launch$default(LifecycleOwnerKt.getLifecycleScope(this), null, null, new c(null), 3, null);
}
public final boolean onOptionsItemSelected(@NotNull MenuItem item) {
Intrinsics.checkNotNullParameter(item, "item");
if (item.getItemId() == 16908332) {
this.onBackPressedCallback.d();
}
return super/*android.app.Activity*/.onOptionsItemSelected(item);
}
}