package com.intsig.tianshu.purchase; import com.evernote.edam.limits.Constants; import com.facebook.appevents.AppEventsConstants; import com.intsig.CsHosts; import com.intsig.https.HttpsUtil; import com.intsig.log.LogUtils; import com.intsig.tianshu.URLEncoder; import com.intsig.utils.AESEncUtil; import java.net.HttpURLConnection; import java.net.URL; public class TianshuPurchaseApi { /* renamed from: a reason: collision with root package name */ private static String f38919a = "https://www.camscanner.com/shop"; public static String a() { return CsHosts.l(); } public static String b() { return f38919a; } /* JADX WARNING: Removed duplicated region for block: B:29:0x0103 */ /* JADX WARNING: Removed duplicated region for block: B:30:0x0105 */ /* JADX WARNING: Removed duplicated region for block: B:35:0x010b */ public static String c(String str, String str2) { Throwable th; HttpURLConnection httpURLConnection; String str3; Exception e10; HttpURLConnection httpURLConnection2; String str4; String str5 = null; try { String str6 = CsHosts.l() + "/reg_device?app=" + str + "&" + "cs_ept_d" + "=" + URLEncoder.b(AESEncUtil.d(str2)); LogUtils.c("TianshuPurchaseApi", "queryRegDevice url = " + str6); httpURLConnection2 = HttpsUtil.a(new URL(str6)); try { httpURLConnection2.setConnectTimeout(Constants.EDAM_BUSINESS_NOTEBOOKS_MAX); httpURLConnection2.setReadTimeout(Constants.EDAM_BUSINESS_NOTEBOOKS_MAX); int responseCode = httpURLConnection2.getResponseCode(); LogUtils.c("TianshuPurchaseApi", "regDevice code = " + responseCode); if (responseCode == 200) { String headerField = httpURLConnection2.getHeaderField("X-IS-Purchased"); LogUtils.c("TianshuPurchaseApi", "queryRegDevice success X-IS-Purchased = " + headerField); if (headerField != null) { if (!AppEventsConstants.EVENT_PARAM_VALUE_NO.equalsIgnoreCase(headerField)) { if ("1".equalsIgnoreCase(headerField)) { } } str4 = headerField; httpURLConnection2.disconnect(); str3 = str4; return str3; } } else if (responseCode == 406) { LogUtils.c("TianshuPurchaseApi", "queryRegDevice X-IS-Error-Code"); httpURLConnection2.getHeaderField("X-IS-Error-Code"); str4 = str5; httpURLConnection2.disconnect(); str3 = str4; return str3; } else { LogUtils.c("TianshuPurchaseApi", "queryRegDevice other error"); } str4 = str5; } catch (Exception e11) { e10 = e11; try { LogUtils.e("TianshuPurchaseApi", e10); if (httpURLConnection2 == null) { } } catch (Throwable th2) { th = th2; httpURLConnection = httpURLConnection2; if (httpURLConnection != null) { httpURLConnection.disconnect(); } throw th; } } } catch (Exception e12) { e10 = e12; httpURLConnection2 = null; LogUtils.e("TianshuPurchaseApi", e10); if (httpURLConnection2 == null) { str4 = str5; httpURLConnection2.disconnect(); str3 = str4; return str3; } str3 = str5; return str3; } catch (Throwable th3) { th = th3; httpURLConnection = str5; if (httpURLConnection != null) { } throw th; } httpURLConnection2.disconnect(); str3 = str4; return str3; } public static void d(int i10) { if (i10 == 0) { f38919a = "https://www-sandbox.camscanner.com/shop"; } else if (1 == i10) { f38919a = "https://www.camscanner.com/shop"; } else { f38919a = "https://www.camscanner.com/shop"; } } }