TikTok.apk(点击下载) / C215908e3.java


package X;

import android.content.Context;
import android.net.Uri;
import android.os.SystemClock;
import com.bytedance.covode.number.Covode;
import com.bytedance.router.SmartRouter;
import com.ss.android.ugc.aweme.ecommerce.eventcenter.EventCenter;
import com.ss.android.ugc.aweme.ecommerce.service.IEventCenter;
import com.ss.android.ugc.aweme.utils.ActivityStack;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import kotlin.g.b.m;
import org.json.JSONObject;

/* renamed from: X.8e3 */
public final class C215908e3 {
    public static AnonymousClass3H3 LIZ;
    public static final C215908e3 LIZIZ = new C215908e3();

    static {
        Covode.recordClassIndex(61520);
    }

    private String LIZ(String str, String str2, String str3, C213228Zj r12, Integer num) {
        C214538bq r0;
        C214638c0 r02;
        String str4 = C182747Gd.LIZ.LIZ() + "view/fe_tiktok_ecommerce_pay_middle/index.html/";
        AnonymousClass287 r3 = AnonymousClass287.LIZ;
        C23760wv[] r5 = new C23760wv[6];
        int i2 = 0;
        r5[0] = C23820x1.LIZ("main_order_id", str2);
        r5[1] = C23820x1.LIZ("combo_id", str);
        String str5 = null;
        r5[2] = C23820x1.LIZ("channel_type", m.LIZ((r12 == null || (r02 = r12.LIZ) == null) ? null : r02.isChooseSave(), true) ? "pay_and_bindcard" : "pay");
        r5[3] = C23820x1.LIZ("pay_source", str3);
        if (!(r12 == null || (r0 = r12.LIZIZ) == null)) {
            str5 = r0.LIZJ();
        }
        r5[4] = C23820x1.LIZ("pay_type", str5);
        if (num != null) {
            i2 = num.intValue();
        }
        r5[5] = C23820x1.LIZ("miss_cashback", Integer.valueOf(i2));
        String builder = r3.LIZIZ(str4, AnonymousClass1YE.LIZJ(r5)).toString();
        m.LIZIZ(builder, "");
        return builder;
    }

    public final String LIZ(String str) {
        int hashCode = str.hashCode();
        return hashCode != -1747807002 ? hashCode != -390864660 ? (hashCode == 2103471391 && str.equals("orderdetail")) ? "order_detail" : "" : str.equals("orderlist") ? "ecommerce_centre_page" : "" : str.equals("ordersubmit") ? "order_submit" : "";
    }

    public final String LIZ(String str, C213228Zj r6) {
        String LIZ2 = LIZ(null, null, str, r6, null);
        String builder = AnonymousClass287.LIZ.LIZIZ("snssdk1180://ec/order/middle_page", AnonymousClass1YE.LIZJ(C23820x1.LIZ("url", LIZ2))).toString();
        m.LIZIZ(builder, "");
        return builder;
    }

    public final String LIZ(String str, String str2, C213228Zj r11, boolean z) {
        C214538bq r0;
        C214538bq r02;
        AnonymousClass287 r3 = AnonymousClass287.LIZ;
        C23760wv[] r2 = new C23760wv[10];
        r2[0] = C23820x1.LIZ("main_order_id", str2);
        r2[1] = C23820x1.LIZ("combo_id", str);
        String str3 = null;
        r2[2] = C23820x1.LIZ("pay_type", (r11 == null || (r02 = r11.LIZIZ) == null) ? null : r02.LIZJ());
        r2[3] = C23820x1.LIZ("__status_bar", true);
        r2[4] = C23820x1.LIZ("container_color_auto_dark", 1);
        r2[5] = C23820x1.LIZ("disableBounces", 1);
        r2[6] = C23820x1.LIZ("hide_nav_bar", 1);
        r2[7] = C23820x1.LIZ("hide_source", 1);
        if (!(r11 == null || (r0 = r11.LIZIZ) == null)) {
            str3 = r0.LIZLLL;
        }
        r2[8] = C23820x1.LIZ("payment_method", str3);
        r2[9] = C23820x1.LIZ("should_full_screen", 1);
        HashMap LIZJ = AnonymousClass1YE.LIZJ(r2);
        if (z) {
            LIZJ.put("payment_status", "paying");
        }
        String builder = r3.LIZIZ("https://oec-api.tiktokv.com/view/fe_tiktok_ecommerce_order_detail/index.html/", LIZJ).toString();
        m.LIZIZ(builder, "");
        return builder;
    }

    /* JADX WARNING: Code restructure failed: missing block: B:22:0x0076, code lost:
        if (r6 == null) goto L_0x0078;
     */
    public final void LIZ(C215918e4 r26) {
        String str;
        Object obj;
        String str2;
        String str3;
        String str4;
        C214538bq r0;
        String str5;
        String str6;
        C214538bq r02;
        C214538bq r03;
        C214538bq r04;
        String str7;
        C216218eY r05;
        C214538bq r06;
        C21090sc.LIZ(r26);
        Context context = r26.LIZ;
        C215618da r2 = r26.LIZLLL;
        List<String> list = r26.LIZIZ;
        String str8 = r26.LIZJ;
        AbstractC216548f5 r1 = r26.LJIIIZ;
        C215968e9 r10 = r26.LJIIJ;
        C215958e8 r13 = r26.LJIIJJI;
        String str9 = r26.LJII;
        if (str9 == null) {
            str9 = "";
        }
        String str10 = list != null ? (String) AnonymousClass1ZP.LJI((List) list) : null;
        C213228Zj r6 = r26.LJFF;
        Boolean bool = r26.LJIIL;
        boolean booleanValue = bool != null ? bool.booleanValue() : false;
        int i2 = booleanValue ? 1 : 0;
        int i3 = booleanValue ? 1 : 0;
        int i4 = booleanValue ? 1 : 0;
        String LIZ2 = LIZ(str8, str10, str9, r6, Integer.valueOf(i2));
        String LIZ3 = LIZ((C215908e3) str8, list != null ? (String) AnonymousClass1ZP.LJI((List) list) : null, (String) r26.LJFF, (C213228Zj) false);
        r13.LJIIJ = LIZ2;
        Map<String, Object> map = r26.LJI;
        C213228Zj r07 = r26.LJFF;
        if (r07 == null || (r06 = r07.LIZIZ) == null || (str = r06.LIZJ()) == null) {
            str = "";
        }
        map.put("pay_type", str);
        Map<String, Object> map2 = r26.LJI;
        if (str8 == null) {
            if (list != null) {
                obj = AnonymousClass1ZP.LJI((List) list);
            }
            obj = "";
            map2.put("order_id", obj);
            StringBuilder sb = new StringBuilder("payment_track_key_");
            if (list == null || (str2 = (String) AnonymousClass1ZP.LJI((List) list)) == null) {
                str2 = "";
            }
            C50687JvI.LIZ(context).LIZ(sb.append(str2).toString(), C20590ro.LIZ().toJson(r26.LJI));
            AnonymousClass3QL r12 = new AnonymousClass3QL(LIZ2, context);
            C215928e5 r11 = new C215928e5(r26, str9, LIZ3, context);
            AnonymousClass3QK r62 = new AnonymousClass3QK(str9, LIZ2, context);
            C216018eE r5 = new C216018eE(r26, str9);
            if (r2 == null) {
                String str11 = r26.LJIIIIZZ;
                if (str11 != null) {
                    SmartRouter.buildRoute(context, str11).open();
                }
                if (r1 != null) {
                    r1.LIZ(EnumC216458ew.ERROR, "-1", null);
                    return;
                }
                return;
            }
            EnumC216458ew r08 = r2.LIZIZ;
            if (r08 != null) {
                int i5 = C216468ex.LIZ[r08.ordinal()];
                if (i5 == 1) {
                    C49251ww.LIZ.LIZ(4, "PayResult - DONE");
                    C216708fL.LIZ.LIZ().LIZ(r10, new C215948e7(r12, r1, r11, System.currentTimeMillis(), r26, list, r2));
                } else if (i5 == 2) {
                    C49251ww.LIZ.LIZ(4, "PayResult - REDIRECT, redirectUrl: " + r2.LIZ);
                    String str12 = r2.LIZ;
                    if (str12 != null) {
                        Uri parse = Uri.parse(str12);
                        m.LIZIZ(parse, "");
                        if (!m.LIZ((Object) parse.getScheme(), (Object) "aweme") || !m.LIZ((Object) parse.getHost(), (Object) "ec")) {
                            str3 = null;
                            if (m.LIZ((Object) parse.getScheme(), (Object) "http") || m.LIZ((Object) parse.getScheme(), (Object) "https")) {
                                r62.LIZ((AnonymousClass3QK) str12, (String) AnonymousClass1YE.LIZ());
                            } else {
                                SmartRouter.buildRoute(context, AnonymousClass287.LIZ.LIZIZ(str12, AnonymousClass1YE.LIZJ(C23820x1.LIZ("source", str9), C23820x1.LIZ("trackParams", r26.LJI))).toString()).open();
                            }
                        } else {
                            String queryParameter = parse.getQueryParameter("url");
                            LinkedHashMap linkedHashMap = new LinkedHashMap();
                            Set<String> queryParameterNames = parse.getQueryParameterNames();
                            m.LIZIZ(queryParameterNames, "");
                            for (T t : queryParameterNames) {
                                String queryParameter2 = parse.getQueryParameter(t);
                                if ((!m.LIZ((Object) t, (Object) "url")) && C20890sI.LIZ(queryParameter2)) {
                                    m.LIZIZ(t, "");
                                    if (queryParameter2 == null) {
                                        m.LIZIZ();
                                    }
                                    linkedHashMap.put(t, queryParameter2);
                                }
                            }
                            if (queryParameter != null) {
                                String path = parse.getPath();
                                if (path != null) {
                                    int hashCode = path.hashCode();
                                    if (hashCode != -1169490130) {
                                        if (hashCode != -478974217) {
                                            if (hashCode == 1720098852 && path.equals("/payment_redirect")) {
                                                AnonymousClass287.LIZ.LIZ(queryParameter, AnonymousClass1YE.LIZJ(C23820x1.LIZ("trackParams", r26.LJI)));
                                                r62.LIZ(queryParameter, linkedHashMap);
                                            }
                                        } else if (path.equals("/payment")) {
                                            SmartRouter.buildRoute(context, AnonymousClass287.LIZ.LIZIZ(str12, AnonymousClass1YE.LIZJ(C23820x1.LIZ("trackParams", r26.LJI), C23820x1.LIZ("cashier", r26.LJ), C23820x1.LIZ("source", str9))).toString()).open();
                                        }
                                    } else if (path.equals("/payment_deeplink")) {
                                        long elapsedRealtime = SystemClock.elapsedRealtime();
                                        C213228Zj r09 = r26.LJFF;
                                        String str13 = (r09 == null || (r04 = r09.LIZIZ) == null) ? null : r04.LJIIIZ;
                                        C37285Ekc ekc = C37285Ekc.LIZ;
                                        if (str13 == null) {
                                            str13 = "";
                                        }
                                        if (ekc.LIZ(context, str13, queryParameter)) {
                                            if (r1 != null) {
                                                r1.LIZ();
                                            }
                                            C213228Zj r010 = r26.LJFF;
                                            if (r010 == null || (r03 = r010.LIZIZ) == null || (str5 = r03.LIZLLL) == null) {
                                                str5 = "";
                                            }
                                            r5.LIZ(true, str5);
                                            C215978eA r112 = new C215978eA(elapsedRealtime, r26, context, r1, r5, str9, str8, list, r62);
                                            LIZ = r112;
                                            ActivityStack.addAppBackGroundListener(r112);
                                            if (!m.LIZ((Object) str9, (Object) "ordersubmit")) {
                                                IEventCenter LIZ4 = EventCenter.LIZ();
                                                JSONObject jSONObject = new JSONObject();
                                                jSONObject.put("payment_status", "paying");
                                                C213228Zj r011 = r26.LJFF;
                                                if (r011 == null || (r02 = r011.LIZIZ) == null || (str6 = r02.LIZLLL) == null) {
                                                    str6 = "";
                                                }
                                                jSONObject.put("payment_method", str6);
                                                String jSONObject2 = jSONObject.toString();
                                                m.LIZIZ(jSONObject2, "");
                                                LIZ4.LIZ("ec_order_payment_status", jSONObject2);
                                            }
                                        } else {
                                            C213228Zj r012 = r26.LJFF;
                                            if (r012 == null || (r0 = r012.LIZIZ) == null || (str4 = r0.LIZLLL) == null) {
                                                str4 = "";
                                            }
                                            r5.LIZ(false, str4);
                                            r62.LIZ(queryParameter, linkedHashMap);
                                        }
                                    }
                                    str3 = null;
                                }
                                str3 = null;
                                SmartRouter.buildRoute(context, AnonymousClass287.LIZ.LIZIZ(queryParameter, AnonymousClass1YE.LIZJ(C23820x1.LIZ("source", str9), C23820x1.LIZ("trackParams", r26.LJI))).toString()).open();
                            }
                            str3 = null;
                        }
                    } else {
                        str3 = null;
                    }
                    if (r1 != null) {
                        r1.LIZ(EnumC216458ew.REDIRECT, str3, r2.LIZ);
                    }
                } else if (i5 == 3) {
                    C49251ww.LIZ.LIZ(4, "PayResult - NEED_INFO");
                    C216708fL.LIZ.LIZ().LIZ(r13, new C215938e6(System.currentTimeMillis(), r26, list));
                } else if (i5 == 4) {
                    C49251ww.LIZ.LIZ(4, "PayResult - ERROR");
                    C216308eh r013 = r2.LIZJ;
                    String str14 = r013 != null ? r013.LIZ : null;
                    C216308eh r014 = r2.LIZJ;
                    r11.LIZ(str14, r014 != null ? r014.LIZIZ : null);
                    if (r1 != null) {
                        EnumC216458ew r3 = EnumC216458ew.ERROR;
                        C216308eh r015 = r2.LIZJ;
                        str7 = null;
                        r1.LIZ(r3, r015 != null ? r015.LIZ : null, null);
                    } else {
                        str7 = null;
                    }
                    AnonymousClass8ZT r52 = C214178bG.LJIIIIZZ;
                    C215998eC r016 = r26.LJ;
                    String str15 = (r016 == null || (r05 = r016.LJIIIZ) == null) ? str7 : r05.LIZLLL;
                    Object obj2 = r26.LJI.get("previous_page");
                    if (!(obj2 instanceof String)) {
                        obj2 = str7;
                    }
                    String str16 = (String) obj2;
                    C216308eh r017 = r2.LIZJ;
                    if (r017 != null) {
                        str7 = r017.LIZ;
                    }
                    r52.LIZ(str15, str16, str7);
                }
            }
        } else {
            obj = str8;
        }
    }
}