Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b
以下内容为反编译后的 PlaceOrderUtility.java 源代码,内容仅作参考
package in.swiggy.android.payment.utility.placeorder;
import android.content.SharedPreferences;
import androidx.appcompat.app.AppCompatActivity;
import com.google.gson.Gson;
import com.newrelic.agent.android.instrumentation.GsonInstrumentation;
import com.newrelic.agent.android.instrumentation.Instrumented;
import in.swiggy.android.commons.utils.x;
import in.swiggy.android.payment.CartObject;
import in.swiggy.android.payment.PaymentSource;
import in.swiggy.android.payment.utility.UserPaymentMethodObject;
import in.swiggy.android.tejas.api.BaseException;
import in.swiggy.android.tejas.api.SwiggyGenericErrorException;
import in.swiggy.android.tejas.api.models.SwiggyApiResponse;
import in.swiggy.android.tejas.api.models.SwiggyApiResponseModel;
import in.swiggy.android.tejas.api.models.SwiggyBaseResponse;
import in.swiggy.android.tejas.feature.order.legacy.model.Order;
import in.swiggy.android.tejas.feature.order.legacy.model.OrderItem;
import in.swiggy.android.tejas.feature.order.model.network.DashPaymentStatusTypes;
import in.swiggy.android.tejas.feature.order.model.network.DashStatusTypes;
import in.swiggy.android.tejas.network.providers.ISwiggyBaseNetworkSubscription;
import in.swiggy.android.tejas.oldapi.models.googleplace.GoogleDirectionResponse;
import in.swiggy.android.tejas.payment.manager.PlaceAndConfirmOrderManager;
import in.swiggy.android.tejas.payment.model.createorder.CreateOrderData;
import in.swiggy.android.tejas.payment.model.createorder.CreateOrderJob;
import in.swiggy.android.tejas.payment.model.createorder.CreateOrderPaymentInfo;
import in.swiggy.android.tejas.payment.model.createorder.CreateOrderResponseBody;
import in.swiggy.android.tejas.payment.model.createorder.CreateOrderSerializedResponse;
import in.swiggy.android.tejas.payment.model.createorder.ErrorActions;
import in.swiggy.android.tejas.payment.model.juspaywallet.JuspayAuthTokenV2Response;
import in.swiggy.android.tejas.payment.model.payment.models.PaymentMethodModel;
import in.swiggy.android.tejas.payment.model.placeorder.PlaceAndConfirmOrderResponseDataModel;
import in.swiggy.android.tejas.utils.GsonUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import kotlin.Unit;
import kotlin.collections.CollectionsKt___CollectionsKt;
import kotlin.collections.j0;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.DefaultConstructorMarker;
import retrofit2.Response;
@Instrumented
public final class PlaceOrderUtility extends in.swiggy.android.payment.utility.e {
private static final String A;
public static final a v = new a(null);
public static final int w = 8;
private static final String x = PlaceOrderUtility.class.getSimpleName();
private static final String y = "www.swiggy.com/justpay/response.php.*status_id=.*";
private static final List<String> z;
private final PlaceAndConfirmOrderManager c;
private final ISwiggyBaseNetworkSubscription d;
private final io.reactivex.disposables.a e;
private final AppCompatActivity f;
private final in.swiggy.android.mvvm.services.s g;
private in.swiggy.android.payment.utility.paymentservice.service.a h;
private final SharedPreferences i;
private final in.swiggy.android.analytics.interfaces.c j;
private final in.swiggy.android.payment.utility.juspay.a k;
private final in.swiggy.android.analytics.generated.e l;
private int m;
private int n;
private long o;
private int p;
private String q;
private String r;
private Order s;
private io.reactivex.disposables.b t;
private boolean u;
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
this();
}
public final String a() {
return PlaceOrderUtility.A;
}
public final String b() {
return PlaceOrderUtility.x;
}
private a() {
}
}
public class b {
public static final int[] a;
static {
int[] iArr = new int[PaymentSource.values().length];
try {
iArr[PaymentSource.GENERIC.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
iArr[PaymentSource.DASH.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
iArr[PaymentSource.DAILY.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
a = iArr;
}
}
public static final class c implements in.swiggy.android.payment.utility.a<SwiggyBaseResponse> {
c() {
}
@Override
public void n(Throwable it) {
kotlin.jvm.internal.o.k(it, "it");
}
@Override
public void p() {
}
@Override
public void o(SwiggyBaseResponse swiggyBaseResponse) {
}
@Override
public void c(SwiggyBaseResponse swiggyBaseResponse, BaseException baseException) {
}
}
public static final class d implements in.swiggy.android.payment.utility.a<CreateOrderSerializedResponse> {
final in.swiggy.android.payment.utility.placeorder.b b;
final PaymentMethodModel c;
public class a {
public static final int[] a;
static {
int[] iArr = new int[PaymentSource.values().length];
try {
iArr[PaymentSource.DAILY.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
a = iArr;
}
}
d(in.swiggy.android.payment.utility.placeorder.b bVar, UserPaymentMethodObject userPaymentMethodObject, PaymentMethodModel paymentMethodModel) {
this.b = bVar;
this.c = paymentMethodModel;
}
@Override
public void n(Throwable throwable) {
kotlin.jvm.internal.o.k(throwable, "throwable");
x.b(PlaceOrderUtility.v.b(), throwable.getMessage());
io.reactivex.disposables.b R = PlaceOrderUtility.this.R();
if (R != null) {
R.dispose();
}
}
@Override
public void p() {
}
@Override
public void o(CreateOrderSerializedResponse createOrderSerializedResponse) {
Integer num;
String str;
CreateOrderResponseBody body;
List<CreateOrderData> orders;
Object v0;
List<CreateOrderJob> orderJobs;
Object v02;
List<CreateOrderPaymentInfo> paymentInfo;
Object v03;
Integer num2;
String string;
ErrorActions actions;
ErrorActions actions2;
String str2 = null;
if (a.a[PlaceOrderUtility.this.S().e().ordinal()] == 1) {
if (createOrderSerializedResponse != null) {
num2 = Integer.valueOf(createOrderSerializedResponse.getStatusCode());
} else {
num2 = null;
}
if (num2 != null && num2.intValue() == 0) {
in.swiggy.android.payment.utility.placeorder.b bVar = this.b;
if (bVar != null) {
bVar.a(null, null);
}
io.reactivex.disposables.b R = PlaceOrderUtility.this.R();
if (R != null) {
R.dispose();
return;
}
return;
} else if (num2 != null && num2.intValue() == 1) {
c(createOrderSerializedResponse, null);
io.reactivex.disposables.b R2 = PlaceOrderUtility.this.R();
if (R2 != null) {
R2.dispose();
return;
}
return;
} else if (num2 != null && num2.intValue() == 3) {
in.swiggy.android.payment.utility.placeorder.b bVar2 = this.b;
if (bVar2 != null) {
bVar2.e(false);
}
in.swiggy.android.payment.utility.placeorder.b bVar3 = this.b;
if (bVar3 != null) {
PlaceOrderUtility.v(PlaceOrderUtility.this);
bVar3.h(false, null, null);
}
PlaceOrderUtility placeOrderUtility = PlaceOrderUtility.this;
in.swiggy.android.payment.utility.placeorder.b bVar4 = this.b;
if (createOrderSerializedResponse == null || (actions2 = createOrderSerializedResponse.getActions()) == null || (string = actions2.getSubtitle()) == null) {
string = PlaceOrderUtility.this.g.getString(in.swiggy.android.commonsui.ui.n.something_not_right_message);
}
if (createOrderSerializedResponse != null && (actions = createOrderSerializedResponse.getActions()) != null) {
str2 = actions.getTitle();
}
placeOrderUtility.o0(bVar4, string, str2);
io.reactivex.disposables.b R3 = PlaceOrderUtility.this.R();
if (R3 != null) {
R3.dispose();
return;
}
return;
} else {
return;
}
}
if (createOrderSerializedResponse != null) {
num = Integer.valueOf(createOrderSerializedResponse.getStatusCode());
} else {
num = null;
}
if (num != null && num.intValue() == 0) {
if (createOrderSerializedResponse != null && (body = createOrderSerializedResponse.getBody()) != null && (orders = body.getOrders()) != null) {
v0 = CollectionsKt___CollectionsKt.v0(orders);
CreateOrderData createOrderData = (CreateOrderData) v0;
if (createOrderData != null && (orderJobs = createOrderData.getOrderJobs()) != null) {
v02 = CollectionsKt___CollectionsKt.v0(orderJobs);
CreateOrderJob createOrderJob = (CreateOrderJob) v02;
if (createOrderJob != null && (paymentInfo = createOrderJob.getPaymentInfo()) != null) {
v03 = CollectionsKt___CollectionsKt.v0(paymentInfo);
CreateOrderPaymentInfo createOrderPaymentInfo = (CreateOrderPaymentInfo) v03;
if (createOrderPaymentInfo != null) {
str = createOrderPaymentInfo.getPaymentStatus();
x.b(PlaceOrderUtility.v.b(), str);
if ((PlaceOrderUtility.this.S().e() != PaymentSource.DASH || PlaceOrderUtility.this.S().e() == PaymentSource.GENERIC) && kotlin.jvm.internal.o.f(str, DashPaymentStatusTypes.STATE_SUCCESSFUL)) {
PlaceOrderUtility.this.i.edit().putBoolean("log_dash_order_confirmed", true).apply();
}
if (str == null) {
int hashCode = str.hashCode();
if (hashCode != -1031784143) {
if (hashCode != -248539494) {
if (hashCode != 2066319421 || !str.equals("FAILED")) {
return;
}
} else if (str.equals(DashPaymentStatusTypes.STATE_SUCCESSFUL)) {
in.swiggy.android.payment.utility.placeorder.b bVar5 = this.b;
if (bVar5 != null) {
bVar5.a(null, null);
}
io.reactivex.disposables.b R4 = PlaceOrderUtility.this.R();
if (R4 != null) {
R4.dispose();
return;
}
return;
} else {
return;
}
} else if (!str.equals(DashStatusTypes.TYPE_CANCELLED)) {
return;
}
c(createOrderSerializedResponse, null);
return;
}
return;
}
}
}
}
str = null;
x.b(PlaceOrderUtility.v.b(), str);
if (PlaceOrderUtility.this.S().e() != PaymentSource.DASH) {
}
PlaceOrderUtility.this.i.edit().putBoolean("log_dash_order_confirmed", true).apply();
if (str == null) {
}
} else {
c(createOrderSerializedResponse, null);
}
}
@Override
public void c(CreateOrderSerializedResponse createOrderSerializedResponse, BaseException baseException) {
x.b(PlaceOrderUtility.v.b(), "Error");
io.reactivex.disposables.b R = PlaceOrderUtility.this.R();
if (R != null) {
R.dispose();
}
}
}
public static final class e implements in.swiggy.android.payment.utility.a<CreateOrderSerializedResponse> {
final in.swiggy.android.payment.utility.placeorder.b a;
final PlaceOrderUtility b;
final PaymentMethodModel c;
e(in.swiggy.android.payment.utility.placeorder.b bVar, UserPaymentMethodObject userPaymentMethodObject, PlaceOrderUtility placeOrderUtility, PaymentMethodModel paymentMethodModel) {
this.a = bVar;
this.b = placeOrderUtility;
this.c = paymentMethodModel;
}
@Override
public void n(Throwable throwable) {
kotlin.jvm.internal.o.k(throwable, "throwable");
io.reactivex.disposables.b R = this.b.R();
if (R != null) {
R.dispose();
}
}
@Override
public void p() {
}
@Override
public void o(CreateOrderSerializedResponse createOrderSerializedResponse) {
String str;
String str2;
CreateOrderResponseBody body;
List<CreateOrderData> orders;
Object v0;
List<CreateOrderJob> orderJobs;
Object v02;
List<CreateOrderPaymentInfo> paymentInfo;
Object v03;
if (createOrderSerializedResponse != null && (body = createOrderSerializedResponse.getBody()) != null && (orders = body.getOrders()) != null) {
v0 = CollectionsKt___CollectionsKt.v0(orders);
CreateOrderData createOrderData = (CreateOrderData) v0;
if (createOrderData != null && (orderJobs = createOrderData.getOrderJobs()) != null) {
v02 = CollectionsKt___CollectionsKt.v0(orderJobs);
CreateOrderJob createOrderJob = (CreateOrderJob) v02;
if (createOrderJob != null && (paymentInfo = createOrderJob.getPaymentInfo()) != null) {
v03 = CollectionsKt___CollectionsKt.v0(paymentInfo);
CreateOrderPaymentInfo createOrderPaymentInfo = (CreateOrderPaymentInfo) v03;
if (createOrderPaymentInfo != null) {
str = createOrderPaymentInfo.getPaymentStatus();
if (str == null) {
int hashCode = str.hashCode();
if (hashCode != -1031784143) {
if (hashCode != -248539494) {
if (hashCode == 2066319421) {
str2 = "FAILED";
} else {
return;
}
} else if (str.equals(DashPaymentStatusTypes.STATE_SUCCESSFUL)) {
in.swiggy.android.payment.utility.placeorder.b bVar = this.a;
if (bVar != null) {
bVar.a(null, null);
}
io.reactivex.disposables.b R = this.b.R();
if (R != null) {
R.dispose();
return;
}
return;
} else {
return;
}
} else {
str2 = DashStatusTypes.TYPE_CANCELLED;
}
str.equals(str2);
return;
}
return;
}
}
}
}
str = null;
if (str == null) {
}
}
@Override
public void c(CreateOrderSerializedResponse createOrderSerializedResponse, BaseException baseException) {
io.reactivex.disposables.b R = this.b.R();
if (R != null) {
R.dispose();
}
}
}
static {
List<String> e2;
e2 = kotlin.collections.q.e("www.swiggy.com/justpay/response.php.*status_id=.*");
z = e2;
A = "cred";
}
public PlaceOrderUtility(PlaceAndConfirmOrderManager placeAndConfirmOrderManager, ISwiggyBaseNetworkSubscription tejasSubscriberProvider, io.reactivex.disposables.a compositeDisposable, AppCompatActivity appCompatActivity, in.swiggy.android.mvvm.services.s resourceService, in.swiggy.android.payment.utility.paymentservice.service.a paymentService, in.swiggy.android.analytics.newrelic.a newrelicPerformanceUtils, SharedPreferences sharedPreferences, in.swiggy.android.analytics.interfaces.c mSwiggyEventHandler, in.swiggy.android.payment.utility.juspay.a juspaySdkWrapper, in.swiggy.android.analytics.generated.e swiggyEventLogger) {
super("payment_create_order", newrelicPerformanceUtils);
kotlin.jvm.internal.o.k(placeAndConfirmOrderManager, "placeAndConfirmOrderManager");
kotlin.jvm.internal.o.k(tejasSubscriberProvider, "tejasSubscriberProvider");
kotlin.jvm.internal.o.k(compositeDisposable, "compositeDisposable");
kotlin.jvm.internal.o.k(appCompatActivity, "appCompatActivity");
kotlin.jvm.internal.o.k(resourceService, "resourceService");
kotlin.jvm.internal.o.k(paymentService, "paymentService");
kotlin.jvm.internal.o.k(newrelicPerformanceUtils, "newrelicPerformanceUtils");
kotlin.jvm.internal.o.k(sharedPreferences, "sharedPreferences");
kotlin.jvm.internal.o.k(mSwiggyEventHandler, "mSwiggyEventHandler");
kotlin.jvm.internal.o.k(juspaySdkWrapper, "juspaySdkWrapper");
kotlin.jvm.internal.o.k(swiggyEventLogger, "swiggyEventLogger");
this.c = placeAndConfirmOrderManager;
this.d = tejasSubscriberProvider;
this.e = compositeDisposable;
this.f = appCompatActivity;
this.g = resourceService;
this.h = paymentService;
this.i = sharedPreferences;
this.j = mSwiggyEventHandler;
this.k = juspaySdkWrapper;
this.l = swiggyEventLogger;
this.m = 1;
this.n = 3;
}
public static void J(PlaceOrderUtility placeOrderUtility, in.swiggy.android.payment.utility.placeorder.a aVar, String str, Map map, Map map2, Map map3, String str2, Map map4, int i, Object obj) {
String str3;
Map<String, String> map5;
Map map6;
Map map7;
String str4 = "";
if ((i & 2) != 0) {
str3 = "";
} else {
str3 = str;
}
if ((i & 4) != 0) {
map5 = j0.i();
} else {
map5 = map;
}
Map<String, String> map8 = null;
if ((i & 8) != 0) {
map6 = null;
} else {
map6 = map2;
}
if ((i & 16) != 0) {
map7 = null;
} else {
map7 = map3;
}
if ((i & 32) == 0) {
str4 = str2;
}
if ((i & 64) == 0) {
map8 = map4;
}
placeOrderUtility.I(aVar, str3, map5, map6, map7, str4, map8);
}
public static final void K(Map map, PlaceOrderUtility this$0, in.swiggy.android.payment.utility.placeorder.a callBackHandler, in.swiggy.android.commons.utils.k kVar) {
Order order;
Map<String, String> map2;
String str;
String str2;
Integer num;
Order order2;
Map<String, String> w2;
Integer num2;
kotlin.jvm.internal.o.k(this$0, "this$0");
kotlin.jvm.internal.o.k(callBackHandler, "$callBackHandler");
SwiggyApiResponseModel swiggyApiResponseModel = (SwiggyApiResponseModel) kVar.a;
if (swiggyApiResponseModel != null) {
if (swiggyApiResponseModel.getExtraParams() != null) {
if (map != null) {
w2 = j0.w(map);
BaseException extraParams = swiggyApiResponseModel.getExtraParams();
if (extraParams != null) {
num2 = Integer.valueOf(extraParams.errorCode);
} else {
num2 = null;
}
w2.put("paymentStatusCode", String.valueOf(num2));
map2 = w2;
} else {
map2 = null;
}
BaseException extraParams2 = swiggyApiResponseModel.getExtraParams();
if (extraParams2 != null) {
str = extraParams2.getErrorMessage();
} else {
str = null;
}
String a2 = this$0.h.a();
PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel = (PlaceAndConfirmOrderResponseDataModel) swiggyApiResponseModel.getResponseModel();
if (placeAndConfirmOrderResponseDataModel != null && (order2 = placeAndConfirmOrderResponseDataModel.getOrder()) != null) {
str2 = order2.getOrderId();
} else {
str2 = null;
}
this$0.b(str, "confirm_order", a2, str2, map2);
BaseException extraParams3 = swiggyApiResponseModel.getExtraParams();
if (extraParams3 != null) {
num = Integer.valueOf(extraParams3.errorCode);
} else {
num = null;
}
if (num != null && num.intValue() == 1) {
callBackHandler.g((PlaceAndConfirmOrderResponseDataModel) swiggyApiResponseModel.getResponseModel(), swiggyApiResponseModel.getExtraParams());
} else if (num != null && num.intValue() == 2) {
callBackHandler.b((PlaceAndConfirmOrderResponseDataModel) swiggyApiResponseModel.getResponseModel(), swiggyApiResponseModel.getExtraParams());
} else if (num != null && num.intValue() == 4) {
callBackHandler.h((PlaceAndConfirmOrderResponseDataModel) swiggyApiResponseModel.getResponseModel(), swiggyApiResponseModel.getExtraParams());
} else if (num != null && num.intValue() == 5) {
callBackHandler.r((PlaceAndConfirmOrderResponseDataModel) swiggyApiResponseModel.getResponseModel(), swiggyApiResponseModel.getExtraParams());
} else if (num != null && num.intValue() == 6) {
callBackHandler.l((PlaceAndConfirmOrderResponseDataModel) swiggyApiResponseModel.getResponseModel(), swiggyApiResponseModel.getExtraParams());
} else if (num != null && num.intValue() == 7) {
callBackHandler.i((PlaceAndConfirmOrderResponseDataModel) swiggyApiResponseModel.getResponseModel(), swiggyApiResponseModel.getExtraParams());
} else if (num != null && num.intValue() == 64) {
callBackHandler.j((PlaceAndConfirmOrderResponseDataModel) swiggyApiResponseModel.getResponseModel(), swiggyApiResponseModel.getExtraParams());
} else if (num != null && num.intValue() == 23) {
callBackHandler.m((PlaceAndConfirmOrderResponseDataModel) swiggyApiResponseModel.getResponseModel(), swiggyApiResponseModel.getExtraParams());
} else {
callBackHandler.c(swiggyApiResponseModel.getResponseModel(), swiggyApiResponseModel.getExtraParams());
}
} else {
PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel2 = (PlaceAndConfirmOrderResponseDataModel) swiggyApiResponseModel.getResponseModel();
if (placeAndConfirmOrderResponseDataModel2 != null) {
order = placeAndConfirmOrderResponseDataModel2.getOrder();
} else {
order = null;
}
this$0.l0(order);
callBackHandler.o(swiggyApiResponseModel.getResponseModel());
}
}
SwiggyGenericErrorException swiggyGenericErrorException = (SwiggyGenericErrorException) kVar.b;
if (swiggyGenericErrorException != null) {
callBackHandler.c(null, swiggyGenericErrorException);
this$0.b(swiggyGenericErrorException.getErrorTitle(), "confirm_order", this$0.h.a(), null, map);
}
}
public static final void L(in.swiggy.android.payment.utility.placeorder.a callBackHandler, PlaceOrderUtility this$0, Map map, Throwable th) {
kotlin.jvm.internal.o.k(callBackHandler, "$callBackHandler");
kotlin.jvm.internal.o.k(this$0, "this$0");
kotlin.jvm.internal.o.h(th);
callBackHandler.n(th);
this$0.b(th.getMessage(), "confirm_order", this$0.h.a(), null, map);
}
public static final void M(in.swiggy.android.payment.utility.placeorder.a callBackHandler) {
kotlin.jvm.internal.o.k(callBackHandler, "$callBackHandler");
callBackHandler.p();
}
public static final void O(in.swiggy.android.payment.utility.c callback, Response response) {
String str;
kotlin.jvm.internal.o.k(callback, "$callback");
SwiggyApiResponse swiggyApiResponse = (SwiggyApiResponse) response.body();
if (response.isSuccessful() && swiggyApiResponse != null) {
JuspayAuthTokenV2Response juspayAuthTokenV2Response = (JuspayAuthTokenV2Response) swiggyApiResponse.getData();
if (juspayAuthTokenV2Response != null) {
str = juspayAuthTokenV2Response.getAuthToken();
} else {
str = null;
}
if (swiggyApiResponse.isResponseOk() && str != null) {
callback.c(str);
return;
} else {
callback.a();
return;
}
}
callback.b();
}
public static final void P(in.swiggy.android.payment.utility.c callback, Throwable th) {
kotlin.jvm.internal.o.k(callback, "$callback");
callback.b();
}
public static final void Q(in.swiggy.android.payment.utility.c callback) {
kotlin.jvm.internal.o.k(callback, "$callback");
callback.onComplete();
}
public final void V(Order order) {
int i;
double d2;
String storeArea;
List<OrderItem> orderItems;
HashMap<String, String> hashMap = new HashMap<>();
String str = "";
hashMap.put("restaurant_id", (order == null || (r2 = order.getStoreId()) == null) ? "" : "");
hashMap.put("coupon_applied", (order == null || (r2 = order.getCouponApplied()) == null) ? "" : "");
hashMap.put("cuisine_list", "");
hashMap.put("first_order", (order == null || (r2 = Boolean.valueOf(order.isFirstOrder()).toString()) == null) ? "" : "");
if (order != null && (orderItems = order.getOrderItems()) != null) {
i = orderItems.size();
} else {
i = 0;
}
hashMap.put("number_of_items", String.valueOf(i));
hashMap.put("payment_type", (order == null || (r2 = order.getPaymentMethod()) == null) ? "" : "");
hashMap.put("order_id", (order == null || (r2 = order.getOrderId()) == null) ? "" : "");
if (order != null && (storeArea = order.getStoreArea()) != null) {
str = storeArea;
}
hashMap.put("restaurant_area", str);
if (order != null) {
d2 = order.getTotalAmount();
} else {
d2 = 0.0d;
}
hashMap.put("total_amount", String.valueOf(d2));
this.l.b(hashMap);
}
public static void X(PlaceOrderUtility placeOrderUtility, in.swiggy.android.payment.utility.placeorder.b bVar, String str, Map map, Map map2, Map map3, String str2, Map map4, int i, Object obj) {
String str3;
Map<String, String> map5;
Map map6;
Map map7;
String str4 = "";
if ((i & 2) != 0) {
str3 = "";
} else {
str3 = str;
}
if ((i & 4) != 0) {
map5 = j0.i();
} else {
map5 = map;
}
Map<String, String> map8 = null;
if ((i & 8) != 0) {
map6 = null;
} else {
map6 = map2;
}
if ((i & 16) != 0) {
map7 = null;
} else {
map7 = map3;
}
if ((i & 32) == 0) {
str4 = str2;
}
if ((i & 64) == 0) {
map8 = map4;
}
placeOrderUtility.W(bVar, str3, map5, map6, map7, str4, map8);
}
private final void Z(final in.swiggy.android.payment.utility.a<SwiggyBaseResponse> aVar, final String str) {
this.e.c((io.reactivex.disposables.b) this.c.confirmDashPayment(str).k0(io.reactivex.schedulers.a.c()).P(io.reactivex.android.schedulers.a.a()).m0(this.d.getRetrofitResponseSubscriber(new io.reactivex.functions.d() {
@Override
public final void accept(Object obj) {
PlaceOrderUtility.a0(in.swiggy.android.payment.utility.a.this, this, str, (Response) obj);
}
}, new io.reactivex.functions.d() {
@Override
public final void accept(Object obj) {
PlaceOrderUtility.b0(in.swiggy.android.payment.utility.a.this, this, str, (Throwable) obj);
}
}, new io.reactivex.functions.a() {
@Override
public final void run() {
PlaceOrderUtility.c0(in.swiggy.android.payment.utility.a.this);
}
})));
}
public static final void a0(in.swiggy.android.payment.utility.a callback, PlaceOrderUtility this$0, String str, Response response) {
Integer statusCode;
kotlin.jvm.internal.o.k(callback, "$callback");
kotlin.jvm.internal.o.k(this$0, "this$0");
if (response != null) {
String str2 = null;
if (response.isSuccessful() && response.body() != null) {
SwiggyBaseResponse swiggyBaseResponse = (SwiggyBaseResponse) response.body();
if (swiggyBaseResponse != null && (statusCode = swiggyBaseResponse.getStatusCode()) != null && statusCode.intValue() == 1) {
callback.o(response.body());
return;
}
callback.c(response.body(), null);
SwiggyBaseResponse swiggyBaseResponse2 = (SwiggyBaseResponse) response.body();
if (swiggyBaseResponse2 != null) {
str2 = swiggyBaseResponse2.getStatusMessage();
}
in.swiggy.android.payment.utility.e.c(this$0, str2, "dash_confirm_transaction", this$0.h.a(), str, null, 16, null);
return;
}
callback.c(response.body(), null);
SwiggyBaseResponse swiggyBaseResponse3 = (SwiggyBaseResponse) response.body();
if (swiggyBaseResponse3 != null) {
str2 = swiggyBaseResponse3.getStatusMessage();
}
in.swiggy.android.payment.utility.e.c(this$0, str2, "dash_confirm_transaction", this$0.h.a(), str, null, 16, null);
}
}
public static final void b0(in.swiggy.android.payment.utility.a callback, PlaceOrderUtility this$0, String str, Throwable th) {
kotlin.jvm.internal.o.k(callback, "$callback");
kotlin.jvm.internal.o.k(this$0, "this$0");
kotlin.jvm.internal.o.h(th);
callback.n(th);
in.swiggy.android.payment.utility.e.c(this$0, th.getMessage(), "dash_confirm_transaction", this$0.h.a(), str, null, 16, null);
}
public static final void c0(in.swiggy.android.payment.utility.a callback) {
kotlin.jvm.internal.o.k(callback, "$callback");
callback.p();
}
public static final void e0(in.swiggy.android.payment.utility.a callback) {
kotlin.jvm.internal.o.k(callback, "$callback");
callback.p();
}
public static final org.reactivestreams.a f0(Function1 tmp0, Object p0) {
kotlin.jvm.internal.o.k(tmp0, "$tmp0");
kotlin.jvm.internal.o.k(p0, "p0");
return (org.reactivestreams.a) tmp0.invoke(p0);
}
public static final org.reactivestreams.a g0(Function1 tmp0, Object p0) {
kotlin.jvm.internal.o.k(tmp0, "$tmp0");
kotlin.jvm.internal.o.k(p0, "p0");
return (org.reactivestreams.a) tmp0.invoke(p0);
}
public static final void h0(in.swiggy.android.payment.utility.a callback, PlaceOrderUtility this$0, String jobId, Response response) {
kotlin.jvm.internal.o.k(callback, "$callback");
kotlin.jvm.internal.o.k(this$0, "this$0");
kotlin.jvm.internal.o.k(jobId, "$jobId");
if (response != null) {
if (response.isSuccessful() && response.body() != null) {
callback.o(response.body());
return;
}
String str = null;
callback.c(response.body(), null);
CreateOrderSerializedResponse createOrderSerializedResponse = (CreateOrderSerializedResponse) response.body();
if (createOrderSerializedResponse != null) {
str = createOrderSerializedResponse.getStatusMessage();
}
in.swiggy.android.payment.utility.e.c(this$0, str, "dash_order_status", this$0.h.a(), jobId, null, 16, null);
}
}
public static final void i0(in.swiggy.android.payment.utility.a callback, PlaceOrderUtility this$0, String jobId, Throwable th) {
kotlin.jvm.internal.o.k(callback, "$callback");
kotlin.jvm.internal.o.k(this$0, "this$0");
kotlin.jvm.internal.o.k(jobId, "$jobId");
kotlin.jvm.internal.o.h(th);
callback.n(th);
in.swiggy.android.payment.utility.e.c(this$0, th.getMessage(), "dash_order_status", this$0.h.a(), jobId, null, 16, null);
}
private final void l0(Order order) {
if (order == null) {
return;
}
try {
order.sanitizeDataFromNetwork();
} catch (Throwable th) {
com.google.firebase.crashlytics.g.a().d(th);
}
}
public final void m0(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel) {
String json;
String str;
double d2;
HashMap hashMap = new HashMap();
String str2 = "";
String string = this.i.getString("clevertap-xp-enabled", "");
if (string != null) {
str2 = string;
}
hashMap.put("clevertap-xp-enabled", str2);
Gson gson = GsonUtil.getGson();
if (!(gson instanceof Gson)) {
json = gson.toJson(hashMap);
} else {
json = GsonInstrumentation.toJson(gson, hashMap);
}
String str3 = json;
in.swiggy.android.analytics.interfaces.c cVar = this.j;
Order order = placeAndConfirmOrderResponseDataModel.getOrder();
if (order != null) {
str = order.getOrderId();
} else {
str = null;
}
String str4 = str;
Order order2 = placeAndConfirmOrderResponseDataModel.getOrder();
if (order2 != null) {
d2 = order2.getTotalAmount();
} else {
d2 = 0.0d;
}
this.j.j(cVar.q("payment", "order-confirmed", str4, (int) d2, str3));
}
public static void p0(PlaceOrderUtility placeOrderUtility, in.swiggy.android.payment.utility.placeorder.b bVar, String str, String str2, int i, Object obj) {
if ((i & 4) != 0) {
str2 = null;
}
placeOrderUtility.o0(bVar, str, str2);
}
public static final t v(PlaceOrderUtility placeOrderUtility) {
placeOrderUtility.getClass();
return null;
}
public final void I(final in.swiggy.android.payment.utility.placeorder.a callBackHandler, String url, Map<String, String> queryParams, Map<String, String> map, Map<String, String> map2, String requestMethod, final Map<String, String> map3) {
kotlin.jvm.internal.o.k(callBackHandler, "callBackHandler");
kotlin.jvm.internal.o.k(url, "url");
kotlin.jvm.internal.o.k(queryParams, "queryParams");
kotlin.jvm.internal.o.k(requestMethod, "requestMethod");
io.reactivex.subscribers.a tejasSubscriber = this.d.getTejasSubscriber(new io.reactivex.functions.d() {
@Override
public final void accept(Object obj) {
PlaceOrderUtility.K(map3, this, callBackHandler, (in.swiggy.android.commons.utils.k) obj);
}
}, new io.reactivex.functions.d() {
@Override
public final void accept(Object obj) {
PlaceOrderUtility.L(a.this, this, map3, (Throwable) obj);
}
}, new io.reactivex.functions.a() {
@Override
public final void run() {
PlaceOrderUtility.M(a.this);
}
});
if (url.length() == 0) {
this.e.c((io.reactivex.disposables.b) this.c.confirmOrder(this.r, String.valueOf(this.p)).k0(io.reactivex.schedulers.a.c()).P(io.reactivex.android.schedulers.a.a()).m0(tejasSubscriber));
} else {
this.e.c((io.reactivex.disposables.b) this.c.confirmPaymentPendingOrder(url, queryParams, map, map2, requestMethod).k0(io.reactivex.schedulers.a.c()).P(io.reactivex.android.schedulers.a.a()).m0(tejasSubscriber));
}
}
public final void N(final in.swiggy.android.payment.utility.c callback, String tenant) {
kotlin.jvm.internal.o.k(callback, "callback");
kotlin.jvm.internal.o.k(tenant, "tenant");
this.e.c((io.reactivex.disposables.b) this.c.getAuthTokenForJuspayV2(tenant).k0(io.reactivex.schedulers.a.c()).P(io.reactivex.android.schedulers.a.a()).m0(this.d.getRetrofitResponseSubscriber(new io.reactivex.functions.d() {
@Override
public final void accept(Object obj) {
PlaceOrderUtility.O(in.swiggy.android.payment.utility.c.this, (Response) obj);
}
}, new io.reactivex.functions.d() {
@Override
public final void accept(Object obj) {
PlaceOrderUtility.P(in.swiggy.android.payment.utility.c.this, (Throwable) obj);
}
}, new io.reactivex.functions.a() {
@Override
public final void run() {
PlaceOrderUtility.Q(in.swiggy.android.payment.utility.c.this);
}
})));
}
public final io.reactivex.disposables.b R() {
return this.t;
}
public final in.swiggy.android.payment.utility.paymentservice.service.a S() {
return this.h;
}
public final t T() {
return null;
}
public void U() {
X(this, null, null, null, null, null, null, null, 126, null);
}
public final void W(final in.swiggy.android.payment.utility.placeorder.b bVar, String url, Map<String, String> queryParams, Map<String, String> map, Map<String, String> map2, String requestMethod, Map<String, String> map3) {
kotlin.jvm.internal.o.k(url, "url");
kotlin.jvm.internal.o.k(queryParams, "queryParams");
kotlin.jvm.internal.o.k(requestMethod, "requestMethod");
if (bVar != null) {
bVar.h(true, null, null);
}
this.h.c("");
this.h.f("");
if (this.h.e() != PaymentSource.REGULAR) {
Y(this.q);
in.swiggy.android.commons.rxjava.e.g(new Function0<Unit>() {
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
PlaceOrderUtility placeOrderUtility = PlaceOrderUtility.this;
b bVar2 = bVar;
String d2 = placeOrderUtility.S().d();
PlaceOrderUtility.v(PlaceOrderUtility.this);
PlaceOrderUtility.v(PlaceOrderUtility.this);
placeOrderUtility.k0(bVar2, d2, null, null);
}
}, 1L, TimeUnit.SECONDS);
return;
}
in.swiggy.android.payment.utility.placeorder.a aVar = new in.swiggy.android.payment.utility.placeorder.a() {
@Override
public void b(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel, BaseException baseException) {
Order order;
in.swiggy.android.analytics.generated.e eVar;
String str;
int i;
Order order2;
b bVar2 = b.this;
if (bVar2 != null) {
PlaceOrderUtility.v(this);
bVar2.i(placeAndConfirmOrderResponseDataModel, baseException, null);
}
PlaceOrderUtility placeOrderUtility = this;
if (placeAndConfirmOrderResponseDataModel != null) {
order = placeAndConfirmOrderResponseDataModel.getOrder();
} else {
order = null;
}
placeOrderUtility.V(order);
eVar = this.l;
PlaceOrderUtility.v(this);
if (baseException != null) {
str = baseException.getErrorMessage();
} else {
str = null;
}
if (baseException != null) {
i = baseException.errorCode;
} else {
i = 0;
}
order2 = this.s;
eVar.e(null, str, i, order2);
}
@Override
public void g(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel, BaseException baseException) {
Order order;
in.swiggy.android.analytics.generated.e eVar;
String str;
int i;
Order order2;
b bVar2 = b.this;
if (bVar2 != null) {
PlaceOrderUtility.v(this);
PlaceOrderUtility.v(this);
PlaceOrderUtility$makeConfirmOrderCall$callBackHandlerobject$1$askConvertOrderToCOD$1 placeOrderUtility$makeConfirmOrderCall$callBackHandlerobject$1$askConvertOrderToCOD$1 = new Function0<Double>() {
@Override
public final Double invoke() {
return Double.valueOf(0.0d);
}
};
PlaceOrderUtility.v(this);
PlaceOrderUtility.v(this);
PlaceOrderUtility.v(this);
PlaceOrderUtility.v(this);
bVar2.f(placeAndConfirmOrderResponseDataModel, null, placeOrderUtility$makeConfirmOrderCall$callBackHandlerobject$1$askConvertOrderToCOD$1, 0, 0.0d, false, null);
}
PlaceOrderUtility placeOrderUtility = this;
if (placeAndConfirmOrderResponseDataModel != null) {
order = placeAndConfirmOrderResponseDataModel.getOrder();
} else {
order = null;
}
placeOrderUtility.V(order);
eVar = this.l;
PlaceOrderUtility.v(this);
if (baseException != null) {
str = baseException.getErrorMessage();
} else {
str = null;
}
if (baseException != null) {
i = baseException.errorCode;
} else {
i = 0;
}
order2 = this.s;
eVar.e(null, str, i, order2);
}
@Override
public void h(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel, BaseException baseException) {
Order order;
in.swiggy.android.analytics.generated.e eVar;
String str;
int i;
Order order2;
b bVar2 = b.this;
if (bVar2 != null) {
PlaceOrderUtility.v(this);
PlaceOrderUtility.v(this);
PlaceOrderUtility$makeConfirmOrderCall$callBackHandlerobject$1$onCouponNotApplicable$1 placeOrderUtility$makeConfirmOrderCall$callBackHandlerobject$1$onCouponNotApplicable$1 = new Function0<Double>() {
@Override
public final Double invoke() {
return Double.valueOf(0.0d);
}
};
PlaceOrderUtility.v(this);
PlaceOrderUtility.v(this);
PlaceOrderUtility.v(this);
bVar2.d(placeAndConfirmOrderResponseDataModel, null, placeOrderUtility$makeConfirmOrderCall$callBackHandlerobject$1$onCouponNotApplicable$1, 0, 0.0d, null);
}
PlaceOrderUtility placeOrderUtility = this;
if (placeAndConfirmOrderResponseDataModel != null) {
order = placeAndConfirmOrderResponseDataModel.getOrder();
} else {
order = null;
}
placeOrderUtility.V(order);
eVar = this.l;
PlaceOrderUtility.v(this);
if (baseException != null) {
str = baseException.getErrorMessage();
} else {
str = null;
}
if (baseException != null) {
i = baseException.errorCode;
} else {
i = 0;
}
order2 = this.s;
eVar.e(null, str, i, order2);
}
@Override
public void i(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel, BaseException baseException) {
Order order;
in.swiggy.android.analytics.generated.e eVar;
String str;
int i;
Order order2;
b bVar2 = b.this;
if (bVar2 != null) {
PlaceOrderUtility.v(this);
bVar2.b(placeAndConfirmOrderResponseDataModel, baseException, null);
}
PlaceOrderUtility placeOrderUtility = this;
if (placeAndConfirmOrderResponseDataModel != null) {
order = placeAndConfirmOrderResponseDataModel.getOrder();
} else {
order = null;
}
placeOrderUtility.V(order);
eVar = this.l;
PlaceOrderUtility.v(this);
if (baseException != null) {
str = baseException.getErrorMessage();
} else {
str = null;
}
if (baseException != null) {
i = baseException.errorCode;
} else {
i = 0;
}
order2 = this.s;
eVar.e(null, str, i, order2);
}
@Override
public void j(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel, BaseException baseException) {
Order order;
in.swiggy.android.analytics.generated.e eVar;
String str;
int i;
Order order2;
b bVar2 = b.this;
if (bVar2 != null) {
PlaceOrderUtility.v(this);
bVar2.j(placeAndConfirmOrderResponseDataModel, baseException, null);
}
PlaceOrderUtility placeOrderUtility = this;
if (placeAndConfirmOrderResponseDataModel != null) {
order = placeAndConfirmOrderResponseDataModel.getOrder();
} else {
order = null;
}
placeOrderUtility.V(order);
eVar = this.l;
PlaceOrderUtility.v(this);
if (baseException != null) {
str = baseException.getErrorMessage();
} else {
str = null;
}
if (baseException != null) {
i = baseException.errorCode;
} else {
i = 0;
}
order2 = this.s;
eVar.e(null, str, i, order2);
}
@Override
public void l(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel, BaseException baseException) {
Order order;
in.swiggy.android.analytics.generated.e eVar;
String str;
int i;
Order order2;
b bVar2 = b.this;
if (bVar2 != null) {
PlaceOrderUtility.v(this);
bVar2.c(placeAndConfirmOrderResponseDataModel, baseException, null);
}
PlaceOrderUtility placeOrderUtility = this;
if (placeAndConfirmOrderResponseDataModel != null) {
order = placeAndConfirmOrderResponseDataModel.getOrder();
} else {
order = null;
}
placeOrderUtility.V(order);
eVar = this.l;
PlaceOrderUtility.v(this);
if (baseException != null) {
str = baseException.getErrorMessage();
} else {
str = null;
}
if (baseException != null) {
i = baseException.errorCode;
} else {
i = 0;
}
order2 = this.s;
eVar.e(null, str, i, order2);
}
@Override
public void m(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel, BaseException baseException) {
int i;
int i2;
long j;
i = this.p;
i2 = this.m;
if (i >= i2) {
PlaceOrderUtility placeOrderUtility = this;
PlaceOrderUtility.p0(placeOrderUtility, b.this, placeOrderUtility.g.getString(in.swiggy.android.payment.j.payment_timeout_message), null, 4, null);
return;
}
final PlaceOrderUtility placeOrderUtility2 = this;
final b bVar2 = b.this;
Function0<Unit> function0 = new Function0<Unit>() {
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
int i3;
PlaceOrderUtility placeOrderUtility3 = PlaceOrderUtility.this;
i3 = placeOrderUtility3.p;
placeOrderUtility3.p = i3 + 1;
PlaceOrderUtility.X(PlaceOrderUtility.this, bVar2, null, null, null, null, null, null, 126, null);
}
};
j = this.o;
in.swiggy.android.commons.rxjava.e.j(function0, j, TimeUnit.MILLISECONDS);
}
@Override
public void n(Throwable it) {
kotlin.jvm.internal.o.k(it, "it");
b bVar2 = b.this;
if (bVar2 != null) {
bVar2.e(false);
}
b bVar3 = b.this;
if (bVar3 != null) {
PlaceOrderUtility.v(this);
bVar3.h(false, null, null);
}
PlaceOrderUtility placeOrderUtility = this;
PlaceOrderUtility.p0(placeOrderUtility, b.this, placeOrderUtility.g.getString(in.swiggy.android.payment.j.payment_timeout_message), null, 4, null);
}
@Override
public void p() {
this.n0(true);
}
@Override
public void r(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel, BaseException baseException) {
Order order;
in.swiggy.android.analytics.generated.e eVar;
String str;
int i;
Order order2;
b bVar2 = b.this;
if (bVar2 != null) {
PlaceOrderUtility.v(this);
PlaceOrderUtility.v(this);
PlaceOrderUtility$makeConfirmOrderCall$callBackHandlerobject$1$onPaymentFailed$1 placeOrderUtility$makeConfirmOrderCall$callBackHandlerobject$1$onPaymentFailed$1 = new Function0<Double>() {
@Override
public final Double invoke() {
return Double.valueOf(0.0d);
}
};
PlaceOrderUtility.v(this);
PlaceOrderUtility.v(this);
bVar2.g(placeAndConfirmOrderResponseDataModel, null, placeOrderUtility$makeConfirmOrderCall$callBackHandlerobject$1$onPaymentFailed$1, 0, null);
}
PlaceOrderUtility placeOrderUtility = this;
if (placeAndConfirmOrderResponseDataModel != null) {
order = placeAndConfirmOrderResponseDataModel.getOrder();
} else {
order = null;
}
placeOrderUtility.V(order);
eVar = this.l;
PlaceOrderUtility.v(this);
if (baseException != null) {
str = baseException.getErrorMessage();
} else {
str = null;
}
if (baseException != null) {
i = baseException.errorCode;
} else {
i = 0;
}
order2 = this.s;
eVar.e(null, str, i, order2);
}
@Override
public void o(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel) {
Long retryDelayTime;
int i;
Integer retryCount;
if (placeAndConfirmOrderResponseDataModel != null) {
if (placeAndConfirmOrderResponseDataModel.getRetryDelayTime() != null && ((retryDelayTime = placeAndConfirmOrderResponseDataModel.getRetryDelayTime()) == null || retryDelayTime.longValue() != 0)) {
if (placeAndConfirmOrderResponseDataModel.getRetryCount() != null && ((retryCount = placeAndConfirmOrderResponseDataModel.getRetryCount()) == null || retryCount.intValue() != 0)) {
PlaceOrderUtility placeOrderUtility = this;
Integer retryCount2 = placeAndConfirmOrderResponseDataModel.getRetryCount();
kotlin.jvm.internal.o.h(retryCount2);
placeOrderUtility.m = retryCount2.intValue();
} else {
PlaceOrderUtility placeOrderUtility2 = this;
i = placeOrderUtility2.n;
placeOrderUtility2.m = i;
}
PlaceOrderUtility placeOrderUtility3 = this;
Long retryDelayTime2 = placeAndConfirmOrderResponseDataModel.getRetryDelayTime();
kotlin.jvm.internal.o.h(retryDelayTime2);
placeOrderUtility3.o = retryDelayTime2.longValue();
m(placeAndConfirmOrderResponseDataModel, null);
return;
}
this.j0(b.this, placeAndConfirmOrderResponseDataModel);
return;
}
c(placeAndConfirmOrderResponseDataModel, null);
}
@Override
public void c(PlaceAndConfirmOrderResponseDataModel placeAndConfirmOrderResponseDataModel, BaseException baseException) {
Order order;
in.swiggy.android.analytics.generated.e eVar;
String str;
Order order2;
b bVar2 = b.this;
int i = 0;
if (bVar2 != null) {
bVar2.e(false);
}
b bVar3 = b.this;
if (bVar3 != null) {
PlaceOrderUtility.v(this);
bVar3.h(false, null, null);
}
b bVar4 = b.this;
if (bVar4 != null) {
PlaceOrderUtility.v(this);
bVar4.c(placeAndConfirmOrderResponseDataModel, baseException, null);
}
PlaceOrderUtility placeOrderUtility = this;
if (placeAndConfirmOrderResponseDataModel != null) {
order = placeAndConfirmOrderResponseDataModel.getOrder();
} else {
order = null;
}
placeOrderUtility.V(order);
eVar = this.l;
PlaceOrderUtility.v(this);
if (baseException != null) {
str = baseException.getErrorMessage();
} else {
str = null;
}
if (baseException != null) {
i = baseException.errorCode;
}
order2 = this.s;
eVar.e(null, str, i, order2);
}
};
if (url.length() == 0) {
J(this, aVar, null, null, null, null, null, map3, 62, null);
} else {
I(aVar, url, queryParams, map, map2, requestMethod, map3);
}
}
public final void Y(String str) {
Z(new c(), str);
}
public final io.reactivex.disposables.b d0(final String jobId, final in.swiggy.android.payment.utility.a<CreateOrderSerializedResponse> callback) {
io.reactivex.disposables.b bVar;
kotlin.jvm.internal.o.k(jobId, "jobId");
kotlin.jvm.internal.o.k(callback, "callback");
io.reactivex.subscribers.a retrofitResponseSubscriber = this.d.getRetrofitResponseSubscriber(new io.reactivex.functions.d() {
@Override
public final void accept(Object obj) {
PlaceOrderUtility.h0(in.swiggy.android.payment.utility.a.this, this, jobId, (Response) obj);
}
}, new io.reactivex.functions.d() {
@Override
public final void accept(Object obj) {
PlaceOrderUtility.i0(in.swiggy.android.payment.utility.a.this, this, jobId, (Throwable) obj);
}
}, new io.reactivex.functions.a() {
@Override
public final void run() {
PlaceOrderUtility.e0(in.swiggy.android.payment.utility.a.this);
}
});
int i = b.a[this.h.e().ordinal()];
if (i != 1 && i != 2) {
if (i != 3) {
bVar = null;
} else {
io.reactivex.d<Long> K = io.reactivex.d.K(0L, 5000L, TimeUnit.MILLISECONDS, io.reactivex.schedulers.a.c());
final PlaceOrderUtility$makeOrderStatusCall$observable$2 placeOrderUtility$makeOrderStatusCall$observable$2 = new PlaceOrderUtility$makeOrderStatusCall$observable$2(this, jobId);
bVar = (io.reactivex.disposables.b) K.B(new io.reactivex.functions.e() {
@Override
public final Object apply(Object obj) {
org.reactivestreams.a g0;
g0 = PlaceOrderUtility.g0(Function1.this, obj);
return g0;
}
}).k0(io.reactivex.schedulers.a.c()).P(io.reactivex.android.schedulers.a.a()).m0(retrofitResponseSubscriber);
}
} else {
io.reactivex.d<Long> K2 = io.reactivex.d.K(0L, 5000L, TimeUnit.MILLISECONDS, io.reactivex.schedulers.a.c());
final PlaceOrderUtility$makeOrderStatusCall$observable$1 placeOrderUtility$makeOrderStatusCall$observable$1 = new PlaceOrderUtility$makeOrderStatusCall$observable$1(this, jobId);
bVar = (io.reactivex.disposables.b) K2.B(new io.reactivex.functions.e() {
@Override
public final Object apply(Object obj) {
org.reactivestreams.a f0;
f0 = PlaceOrderUtility.f0(Function1.this, obj);
return f0;
}
}).k0(io.reactivex.schedulers.a.c()).P(io.reactivex.android.schedulers.a.a()).m0(retrofitResponseSubscriber);
}
if (bVar != null) {
this.e.c(bVar);
}
return bVar;
}
public final void j0(in.swiggy.android.payment.utility.placeorder.b bVar, final PlaceAndConfirmOrderResponseDataModel response) {
String str;
String str2;
kotlin.jvm.internal.o.k(response, "response");
SharedPreferences.Editor edit = this.i.edit();
Order order = response.getOrder();
if (order != null) {
str = order.getOrderId();
} else {
str = null;
}
edit.putString("last_placed_order_id", str).apply();
SharedPreferences.Editor edit2 = this.i.edit();
Order order2 = response.getOrder();
if (order2 != null) {
str2 = order2.toJson();
} else {
str2 = null;
}
edit2.putString("last_placed_order", str2).apply();
this.i.edit().putBoolean("fire_launch_api_after_order_placed", true).apply();
if (bVar != null) {
bVar.a(response, null);
}
in.swiggy.android.commons.rxjava.e.m(new Function0<Unit>() {
{
super(0);
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
PlaceOrderUtility.this.m0(response);
}
});
}
public final void k0(in.swiggy.android.payment.utility.placeorder.b bVar, String str, UserPaymentMethodObject userPaymentMethodObject, PaymentMethodModel paymentMethodModel) {
String str2;
if (str != null) {
CartObject b2 = this.h.b();
String str3 = null;
if (b2 != null) {
str2 = b2.a();
} else {
str2 = null;
}
in.swiggy.android.payment.utility.d dVar = in.swiggy.android.payment.utility.d.a;
if (kotlin.jvm.internal.o.f(str2, dVar.b())) {
this.t = d0(str, new d(bVar, userPaymentMethodObject, paymentMethodModel));
return;
}
CartObject b3 = this.h.b();
if (b3 != null) {
str3 = b3.a();
}
if (kotlin.jvm.internal.o.f(str3, dVar.a())) {
this.t = d0(str, new e(bVar, userPaymentMethodObject, this, paymentMethodModel));
}
}
}
public final void n0(boolean z2) {
this.u = z2;
}
public final void o0(final in.swiggy.android.payment.utility.placeorder.b bVar, String message, String str) {
kotlin.jvm.internal.o.k(message, "message");
try {
in.swiggy.android.commonsui.ui.fragment.f c2 = in.swiggy.android.commonsui.ui.fragment.f.z.c(1, str, message, null, null, GoogleDirectionResponse.OK_RESPONSE);
c2.G1(new Function0<Unit>() {
{
super(0);
}
@Override
public final Unit invoke() {
b bVar2 = b.this;
if (bVar2 != null) {
bVar2.e(false);
}
b bVar3 = b.this;
if (bVar3 == null) {
return null;
}
PlaceOrderUtility.v(this);
bVar3.h(false, null, null);
return Unit.a;
}
});
c2.show(this.f.getSupportFragmentManager(), "dialog");
} catch (Exception e2) {
com.google.firebase.crashlytics.g.a().d(e2);
}
}
}