Swiggy v4.51.1版本的 MD5 值为:5af7ec91512a0a8c1510e3f8bac20b8b
以下内容为反编译后的 f.java 源代码,内容仅作参考
package co.hyperverge.hypersnapsdk.b.g;
import android.content.Context;
import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import co.hyperverge.hypersnapsdk.b.b;
import co.hyperverge.hypersnapsdk.c.j;
import co.hyperverge.hypersnapsdk.c.o;
import co.hyperverge.hypersnapsdk.c.p;
import co.hyperverge.hypersnapsdk.c.q;
import co.hyperverge.hypersnapsdk.f.i;
import co.hyperverge.hypersnapsdk.objects.HVDocConfig;
import co.hyperverge.hypersnapsdk.objects.HVError;
import co.hyperverge.hypersnapsdk.objects.HVFaceConfig;
import co.hyperverge.hypersnapsdk.objects.HyperSnapParams$FaceMatchMode;
import co.hyperverge.hypersnapsdk.objects.HyperSnapParams$Region;
import com.google.gson.Gson;
import com.newrelic.agent.android.analytics.AnalyticsAttribute;
import com.newrelic.agent.android.distributedtracing.DistributedTracing;
import com.newrelic.agent.android.instrumentation.GsonInstrumentation;
import com.newrelic.agent.android.instrumentation.Instrumented;
import com.newrelic.agent.android.instrumentation.JSONObjectInstrumentation;
import com.payu.threedsbase.constants.APIConstants;
import in.juspay.hyper.constants.LogCategory;
import in.swiggy.android.tejas.network.HttpRequest;
import in.swiggy.android.tejas.oldapi.models.order.RenderingDetails;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import okhttp3.Headers;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import org.json.JSONException;
import org.json.JSONObject;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@Instrumented
public class f extends co.hyperverge.hypersnapsdk.b.b {
private static final String a = "co.hyperverge.hypersnapsdk.b.g.e";
private static f b;
public static class a {
static final int[] a;
static {
int[] iArr = new int[HyperSnapParams$FaceMatchMode.values().length];
a = iArr;
try {
iArr[HyperSnapParams$FaceMatchMode.FACE_FACE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
a[HyperSnapParams$FaceMatchMode.FACE_ID.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
a[HyperSnapParams$FaceMatchMode.FACE_IDFACESTRING.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
a[HyperSnapParams$FaceMatchMode.FACE_ID_FACE_STRING.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
class b implements Callback<ResponseBody> {
final String a;
final HVFaceConfig b;
final b.a c;
b(String str, HVFaceConfig hVFaceConfig, b.a aVar) {
this.a = str;
this.b = hVFaceConfig;
this.c = aVar;
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable th) {
this.c.a(th.getLocalizedMessage());
}
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
co.hyperverge.hypersnapsdk.model.e eVar = new co.hyperverge.hypersnapsdk.model.e();
Headers headers = response.headers();
JSONObject l = f.this.l(headers, this.a);
eVar.h(l);
eVar.b(response.code());
if (response.isSuccessful()) {
try {
String string = response.body().string();
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldReturnRawResponse()) {
l.put("X-HV-Raw-Response", string);
}
if (f.this.t(this.b.getLivenessEndpoint(), string, headers, this.a)) {
eVar.k(new JSONObject(string));
} else {
eVar.i("Network tampering detected");
eVar.b(18);
}
} catch (IOException e) {
Log.e(f.a, i.h(e));
if (o.C().x() != null) {
o.C().x().a(e);
}
} catch (JSONException e2) {
Log.e(f.a, i.h(e2));
if (o.C().x() != null) {
o.C().x().a(e2);
}
}
}
if (response.errorBody() != null) {
try {
String string2 = response.errorBody().string();
JSONObject jSONObject = new JSONObject(string2);
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldReturnRawResponse()) {
l.put("X-HV-Raw-Response", string2);
}
f.this.p(eVar, new JSONObject(string2));
eVar.i(jSONObject.getString("error"));
} catch (IOException e3) {
e = e3;
Log.e(f.a, i.h(e));
if (o.C().x() != null) {
o.C().x().a(e);
}
eVar.i(e.getLocalizedMessage());
eVar.j(f.this.k(headers));
this.c.a(eVar);
} catch (JSONException e4) {
e = e4;
Log.e(f.a, i.h(e));
if (o.C().x() != null) {
}
eVar.i(e.getLocalizedMessage());
eVar.j(f.this.k(headers));
this.c.a(eVar);
}
}
try {
eVar.j(f.this.k(headers));
} catch (Exception e5) {
Log.e(f.a, i.h(e5));
if (o.C().x() != null) {
o.C().x().a(e5);
}
}
this.c.a(eVar);
}
}
class c implements Callback<ResponseBody> {
final String a;
final String b;
final Context c;
final String d;
final q e;
final co.hyperverge.hypersnapsdk.listeners.a f;
c(String str, String str2, Context context, String str3, q qVar, co.hyperverge.hypersnapsdk.listeners.a aVar) {
this.a = str;
this.b = str2;
this.c = context;
this.d = str3;
this.e = qVar;
this.f = aVar;
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable th) {
HVError hVError;
String unused = f.a;
i.h(th);
if (th.getLocalizedMessage().contains("Certificate pinning")) {
hVError = new HVError(15, "Secure connection could not be established.");
} else {
hVError = new HVError(12, th.getLocalizedMessage());
}
if (o.C().M()) {
o.C().d(this.c).f0(null, hVError);
}
this.f.c(hVError, null);
}
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
Headers headers = response.headers();
JSONObject l = f.this.l(headers, this.a);
co.hyperverge.hypersnapsdk.objects.c cVar = new co.hyperverge.hypersnapsdk.objects.c();
cVar.setApiHeaders(l);
if (response.isSuccessful()) {
try {
String string = response.body().string();
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldReturnRawResponse()) {
l.put("X-HV-Raw-Response", string);
cVar.setApiHeaders(l);
}
if (f.this.t(this.b, string, headers, this.a)) {
JSONObject jSONObject = new JSONObject(string);
cVar.setApiResult(jSONObject);
co.hyperverge.hypersnapsdk.objects.c i = f.this.i(cVar, jSONObject);
if (o.C().M()) {
o.C().d(this.c).H(i, this.d, this.e.d().longValue());
}
this.f.c(null, i);
return;
}
HVError g = f.this.g("Network tampering detected", 18);
if (o.C().M()) {
o.C().d(this.c).f0(null, g);
}
this.f.c(g, cVar);
return;
} catch (Exception e) {
Log.e(f.a, i.h(e));
o.C().n(this.c).a(e);
HVError f = f.this.f(e);
if (o.C().M()) {
o.C().d(this.c).f0(cVar, f);
}
this.f.c(f, cVar);
return;
}
}
try {
String string2 = response.errorBody().string();
JSONObject jSONObject2 = new JSONObject(string2);
cVar = f.this.i(cVar, jSONObject2);
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldReturnRawResponse()) {
l.put("X-HV-Raw-Response", string2);
cVar.setApiHeaders(l);
}
HVError C = f.this.C(jSONObject2);
if (o.C().M()) {
o.C().d(this.c).f0(null, C);
}
this.f.c(C, cVar);
} catch (Exception e2) {
Log.e(f.a, i.h(e2));
o.C().n(this.c).a(e2);
HVError f2 = f.this.f(e2);
if (o.C().M()) {
o.C().d(this.c).f0(null, f2);
}
this.f.c(f2, cVar);
}
}
}
class d implements Callback<ResponseBody> {
final String a;
final String b;
final Context c;
final HyperSnapParams$FaceMatchMode d;
final co.hyperverge.hypersnapsdk.listeners.a e;
final q f;
d(String str, String str2, Context context, HyperSnapParams$FaceMatchMode hyperSnapParams$FaceMatchMode, co.hyperverge.hypersnapsdk.listeners.a aVar, q qVar) {
this.a = str;
this.b = str2;
this.c = context;
this.d = hyperSnapParams$FaceMatchMode;
this.e = aVar;
this.f = qVar;
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable th) {
HVError hVError;
String unused = f.a;
i.h(th);
if (th.getLocalizedMessage().contains("Certificate pinning")) {
hVError = new HVError(15, "Secure connection error");
} else {
hVError = new HVError(12, th.getLocalizedMessage());
}
if (o.C().M()) {
o.C().d(this.c).Z(null, hVError, this.d.toString());
}
this.e.c(hVError, null);
}
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
JSONObject jSONObject;
Headers headers = response.headers();
co.hyperverge.hypersnapsdk.objects.c cVar = new co.hyperverge.hypersnapsdk.objects.c();
JSONObject l = f.this.l(headers, this.a);
cVar.setApiHeaders(l);
if (response.isSuccessful()) {
try {
String string = response.body().string();
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldReturnRawResponse()) {
l.put("X-HV-Raw-Response", string);
cVar.setApiHeaders(l);
}
if (f.this.t(this.b, string, headers, this.a)) {
JSONObject jSONObject2 = new JSONObject(string);
if (jSONObject2.has(APIConstants.PAYMENT_API_RESULT)) {
jSONObject = jSONObject2.getJSONObject(APIConstants.PAYMENT_API_RESULT);
} else {
jSONObject = null;
}
if (jSONObject != null && jSONObject.has("error") && jSONObject.getString("error").toLowerCase().contains("face not detected")) {
HVError g = f.this.g(jSONObject.getString("error"), 22);
if (o.C().M()) {
o.C().d(this.c).Z(null, g, this.d.toString());
}
this.e.c(g, cVar);
return;
}
cVar.setApiResult(jSONObject2);
co.hyperverge.hypersnapsdk.objects.c i = f.this.i(cVar, jSONObject2);
if (o.C().M()) {
o.C().d(this.c).e0(i, this.f.d().longValue());
}
this.e.c(null, i);
return;
}
HVError g2 = f.this.g("Network tampering detected", 18);
if (o.C().M()) {
o.C().d(this.c).Z(null, g2, this.d.toString());
}
this.e.c(f.this.g("Network tampering detected", 18), cVar);
return;
} catch (Exception e) {
f.this.v(e);
o.C().n(this.c).a(e);
HVError f = f.this.f(e);
if (o.C().M()) {
o.C().d(this.c).Z(cVar, f, this.d.toString());
}
this.e.c(f, cVar);
return;
}
}
try {
String string2 = response.errorBody().string();
JSONObject jSONObject3 = new JSONObject(string2);
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldReturnRawResponse()) {
l.put("X-HV-Raw-Response", string2);
cVar.setApiHeaders(l);
}
cVar = f.this.i(cVar, jSONObject3);
HVError C = f.this.C(jSONObject3);
if (o.C().M()) {
o.C().d(this.c).Z(null, C, this.d.toString());
}
this.e.c(C, cVar);
} catch (Exception e2) {
Log.e(f.a, i.h(e2));
o.C().n(this.c).a(e2);
HVError f2 = f.this.f(e2);
if (o.C().M()) {
o.C().d(this.c).Z(null, f2, this.d.toString());
}
this.e.c(f2, cVar);
}
}
}
class e implements Callback<ResponseBody> {
e() {
}
@Override
public void onFailure(Call<ResponseBody> call, Throwable th) {
String str = f.a;
Log.e(str, "onFailure postSensorDataFiles : " + i.h(th));
if (o.C().t() != null) {
o.C().t().p0(new HVError(2, i.h(th)));
}
}
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
if (response.isSuccessful()) {
if (o.C().t() != null) {
o.C().t().s();
}
} else if (o.C().t() != null) {
o.C().t().p0(new HVError(2, "response.isSuccessful() is false"));
}
}
}
class C0218f implements Callback<ResponseBody> {
final co.hyperverge.hypersnapsdk.listeners.a a;
C0218f(co.hyperverge.hypersnapsdk.listeners.a aVar) {
this.a = aVar;
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable th) {
String unused = f.a;
i.h(th);
o.C().x().a(th);
this.a.c(new HVError(12, th.getLocalizedMessage()), null);
}
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> response) {
JSONObject l = f.this.l(response.headers(), null);
co.hyperverge.hypersnapsdk.objects.c cVar = new co.hyperverge.hypersnapsdk.objects.c();
cVar.setApiHeaders(l);
if (response.isSuccessful()) {
try {
cVar.setApiResult(new JSONObject(response.body().string()));
this.a.c(null, cVar);
return;
} catch (Exception e) {
Log.e(f.a, i.h(e));
this.a.c(f.this.f(e), cVar);
return;
}
}
try {
this.a.c(f.this.C(new JSONObject(response.errorBody().string())), cVar);
} catch (Exception e2) {
Log.e(f.a, i.h(e2));
o.C().x().a(e2);
this.a.c(f.this.f(e2), cVar);
}
}
}
private JSONObject A(JSONObject jSONObject) {
if (jSONObject == null) {
return new JSONObject();
}
return jSONObject;
}
private boolean B(String str) {
if (!co.hyperverge.hypersnapsdk.f.g.a(str) && (str.contains("/v1.1/readNID") || str.contains("/v2/nationalID"))) {
return true;
}
return false;
}
private boolean D(String str) {
if (!co.hyperverge.hypersnapsdk.f.g.a(str) && (str.contains("apac") || str.contains("ind"))) {
return true;
}
return false;
}
public co.hyperverge.hypersnapsdk.objects.c i(co.hyperverge.hypersnapsdk.objects.c cVar, JSONObject jSONObject) {
String str;
try {
if (jSONObject.has(APIConstants.PAYMENT_API_RESULT)) {
JSONObject jSONObject2 = jSONObject.getJSONObject(APIConstants.PAYMENT_API_RESULT);
if (jSONObject2.has(RenderingDetails.TYPE_SUMMARY)) {
JSONObject jSONObject3 = jSONObject2.getJSONObject(RenderingDetails.TYPE_SUMMARY);
String string = jSONObject3.getString(LogCategory.ACTION);
if (jSONObject3.has("retakeMessage")) {
str = jSONObject3.getString("retakeMessage");
} else {
str = "Some issue with the image capture. Please try again.";
}
cVar.setAction(string);
cVar.setRetakeMessage(str);
cVar.setApiResult(jSONObject);
}
}
} catch (Exception e2) {
if (o.C().x() != null) {
o.C().x().a(e2);
}
}
return cVar;
}
public void p(co.hyperverge.hypersnapsdk.model.e eVar, JSONObject jSONObject) {
try {
if (jSONObject.has(APIConstants.PAYMENT_API_RESULT) && jSONObject.getJSONObject(APIConstants.PAYMENT_API_RESULT).has(RenderingDetails.TYPE_SUMMARY)) {
eVar.k(jSONObject);
}
} catch (JSONException e2) {
if (o.C().x() != null) {
o.C().x().a(e2);
}
}
}
private boolean q(Context context, String str, String str2, String str3, HyperSnapParams$FaceMatchMode hyperSnapParams$FaceMatchMode, co.hyperverge.hypersnapsdk.listeners.a aVar) {
String str4;
boolean z;
if (aVar == null) {
return false;
}
if (context == null) {
str4 = "Context object is null";
z = false;
} else {
str4 = "";
z = true;
}
if (co.hyperverge.hypersnapsdk.f.g.a(str)) {
str4 = "endpoint is empty";
z = false;
}
if (co.hyperverge.hypersnapsdk.f.g.a(str2) || !new File(str2).exists()) {
str4 = "Face file path is invalid";
z = false;
}
if (co.hyperverge.hypersnapsdk.f.g.a(str3)) {
int i = a.a[hyperSnapParams$FaceMatchMode.ordinal()];
if (i != 1) {
if (i != 2) {
if (i == 3 || i == 4) {
str4 = "ID Face String is invalid";
}
} else if (!new File(str3).exists()) {
str4 = "Document file path is invalid";
}
} else if (!new File(str3).exists()) {
str4 = "Second face file path is invalid";
}
z = false;
}
if (z) {
return true;
}
aVar.c(new HVError(6, str4), null);
return false;
}
private boolean s(String str) {
HyperSnapParams$Region hyperSnapRegion = co.hyperverge.hypersnapsdk.a.t().s().getHyperSnapRegion();
if (!str.contains("zaf") && !hyperSnapRegion.equals(HyperSnapParams$Region.AFRICA)) {
return false;
}
return true;
}
public boolean t(String str, String str2, Headers headers, String str3) {
if (!co.hyperverge.hypersnapsdk.a.t().s().isShouldUseSHA256Signature()) {
return g.l(str2, headers, str3);
}
return g.i(str2, headers, str3);
}
public static f u() {
if (b == null) {
b = new f();
}
return b;
}
public void v(Exception exc) {
try {
if (!TextUtils.isEmpty(i.h(exc))) {
Log.e(a, i.h(exc));
}
} catch (Exception unused) {
}
}
private boolean w(String str) {
HyperSnapParams$Region hyperSnapRegion = co.hyperverge.hypersnapsdk.a.t().s().getHyperSnapRegion();
if (!str.contains("apac") && !hyperSnapRegion.equals(HyperSnapParams$Region.ASIA_PACIFIC) && !hyperSnapRegion.equals(HyperSnapParams$Region.AsiaPacific)) {
return false;
}
return true;
}
public static boolean x(JSONObject jSONObject) {
if (jSONObject == null || !jSONObject.has("dataLogging")) {
return false;
}
try {
return jSONObject.getString("dataLogging").equals("yes");
} catch (JSONException e2) {
if (o.C().x() == null) {
return false;
}
o.C().x().a(e2);
return false;
}
}
private JSONObject y(JSONObject jSONObject) {
if (jSONObject == null) {
jSONObject = new JSONObject();
}
return m(jSONObject);
}
private boolean z(String str) {
HyperSnapParams$Region hyperSnapRegion = co.hyperverge.hypersnapsdk.a.t().s().getHyperSnapRegion();
if (!str.contains("ind") && !hyperSnapRegion.equals(HyperSnapParams$Region.INDIA) && !hyperSnapRegion.equals(HyperSnapParams$Region.India)) {
return false;
}
return true;
}
public HVError C(JSONObject jSONObject) {
String str;
String string;
int i;
new JSONObject();
HVError hVError = new HVError();
try {
if (jSONObject.has("error")) {
str = jSONObject.getString("error");
} else {
str = " ";
}
if (jSONObject.has(APIConstants.PAYMENT_API_RESULT)) {
JSONObject jSONObject2 = jSONObject.getJSONObject(APIConstants.PAYMENT_API_RESULT);
if (jSONObject2.has("error")) {
string = jSONObject2.getString("error");
str = string;
}
if (!jSONObject.has("statusCode")) {
i = jSONObject.getInt("statusCode");
} else {
i = 14;
}
return new HVError(i, str);
}
if (jSONObject.has("message")) {
string = jSONObject.getString("message");
str = string;
}
if (!jSONObject.has("statusCode")) {
}
return new HVError(i, str);
} catch (JSONException e2) {
v(e2);
if (o.C().x() == null) {
}
}
v(e2);
if (o.C().x() == null) {
o.C().x().a(e2);
return hVError;
}
return hVError;
}
public Map<String, RequestBody> E(JSONObject jSONObject) {
Gson gson = new Gson();
HashMap hashMap = new HashMap();
HashMap hashMap2 = new HashMap();
if (jSONObject == null) {
return hashMap;
}
Map map = (Map) GsonInstrumentation.fromJson(gson, JSONObjectInstrumentation.toString(jSONObject), (Class<Object>) hashMap2.getClass());
for (String str : map.keySet()) {
hashMap.put(str, RequestBody.create(MediaType.parse(HttpRequest.SHARE_TYPE), (String) map.get(str)));
}
return hashMap;
}
public String F(JSONObject jSONObject) {
if (jSONObject != null && jSONObject.has("referenceId")) {
try {
return jSONObject.getString("referenceId");
} catch (JSONException e2) {
v(e2);
if (o.C().x() != null) {
o.C().x().a(e2);
}
}
}
return " ";
}
@Override
public void a(Context context, String str, File file) {
MultipartBody.Part createFormData = MultipartBody.Part.createFormData("sensorDataZipFile", file.getName(), RequestBody.create(MediaType.parse("application/zip"), file));
HashMap hashMap = new HashMap();
if (co.hyperverge.hypersnapsdk.a.t().s().getAccessToken() != null && !co.hyperverge.hypersnapsdk.a.t().s().getAccessToken().isEmpty()) {
hashMap.put(HttpRequest.HEADER_AUTHORIZATION, co.hyperverge.hypersnapsdk.a.t().s().getAccessToken());
} else {
hashMap.put(AnalyticsAttribute.APP_ID_ATTRIBUTE, co.hyperverge.hypersnapsdk.a.t().s().getAppId());
hashMap.put("appKey", co.hyperverge.hypersnapsdk.a.t().s().getAppKey());
}
co.hyperverge.hypersnapsdk.b.g.a.d().g(str, hashMap, createFormData).enqueue(new e());
}
@Override
public void b(Context context, String str, String str2, String str3, HVDocConfig hVDocConfig, JSONObject jSONObject, JSONObject jSONObject2, co.hyperverge.hypersnapsdk.listeners.a aVar) {
String str4;
String str5;
MultipartBody.Part part;
JSONObject jSONObject3;
Call<ResponseBody> f;
if (aVar == null) {
return;
}
if (context == null) {
aVar.c(new HVError(6, "Context object is null"), null);
} else if (str2 != null && !str2.trim().isEmpty() && new File(str2).exists()) {
File file = new File(str2);
if (str2.contains(".pdf")) {
str5 = "application/pdf";
str4 = "pdf";
} else {
str4 = "image";
str5 = "image/jpeg";
}
MultipartBody.Part createFormData = MultipartBody.Part.createFormData(str4, file.getName(), RequestBody.create(MediaType.parse(str5), file));
if (hVDocConfig != null && hVDocConfig.isShouldReadQR() && !co.hyperverge.hypersnapsdk.f.g.a(str3)) {
File file2 = new File(str3);
part = MultipartBody.Part.createFormData("qrCroppedImage", file2.getName(), RequestBody.create(MediaType.parse("image/jpeg"), file2));
} else {
part = null;
}
if (jSONObject2 == null) {
jSONObject3 = new JSONObject();
} else {
jSONObject3 = jSONObject2;
}
JSONObject m = m(jSONObject3);
String d2 = g.d(str2, m);
try {
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldUseSHA256Signature() && d2 != null && !m.has(AnalyticsAttribute.UUID_ATTRIBUTE)) {
m.put(AnalyticsAttribute.UUID_ATTRIBUTE, d2);
}
} catch (JSONException e2) {
Log.e(a, i.h(e2));
o.C().n(context).a(e2);
}
x(jSONObject);
Map<String, RequestBody> E = E(jSONObject);
Map<String, String> hashMap = new HashMap<>();
if (m != null) {
hashMap = (Map) GsonInstrumentation.fromJson(new Gson(), JSONObjectInstrumentation.toString(m), (Class<Object>) HashMap.class);
}
Map<String, String> map = hashMap;
if (co.hyperverge.hypersnapsdk.a.t().s().getAccessToken() != null && !co.hyperverge.hypersnapsdk.a.t().s().getAccessToken().isEmpty()) {
map.put(HttpRequest.HEADER_AUTHORIZATION, co.hyperverge.hypersnapsdk.a.t().s().getAccessToken());
} else {
map.put(AnalyticsAttribute.APP_ID_ATTRIBUTE, co.hyperverge.hypersnapsdk.a.t().s().getAppId());
map.put("appKey", co.hyperverge.hypersnapsdk.a.t().s().getAppKey());
}
if (hVDocConfig != null && hVDocConfig.isShouldReadQR() && B(str) && part != null) {
f = co.hyperverge.hypersnapsdk.b.g.a.d().b(str, map, createFormData, part, E);
} else {
f = co.hyperverge.hypersnapsdk.b.g.a.d().f(str, map, createFormData, E);
}
F(m);
f.enqueue(new c(d2, str, context, str2, new q(), aVar));
if (o.C().M()) {
o.C().d(context).K(str, str2);
}
} else {
aVar.c(new HVError(6, "Document file path is null"), null);
}
}
@Override
public void c(Context context, String str, String str2, String str3, HyperSnapParams$FaceMatchMode hyperSnapParams$FaceMatchMode, JSONObject jSONObject, JSONObject jSONObject2, co.hyperverge.hypersnapsdk.listeners.a aVar) {
MultipartBody.Part part;
Map<String, String> map;
if (!q(context, str, str2, str3, hyperSnapParams$FaceMatchMode, aVar)) {
return;
}
JSONObject y = y(jSONObject2);
JSONObject A = A(jSONObject);
String c2 = g.c(str3, str2, y);
try {
if (!co.hyperverge.hypersnapsdk.f.g.a(p.p()) && !y.has("transactionId")) {
y.put("transactionId", p.p());
}
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldUseSHA256Signature() && c2 != null && !y.has(AnalyticsAttribute.UUID_ATTRIBUTE)) {
y.put(AnalyticsAttribute.UUID_ATTRIBUTE, c2);
}
} catch (JSONException e2) {
Log.e(a, i.h(e2));
o.C().n(context).a(e2);
}
int i = a.a[hyperSnapParams$FaceMatchMode.ordinal()];
String str4 = "image2";
String str5 = "image1";
if (i != 1) {
if (i != 2) {
if (i == 3 || i == 4) {
try {
A.put("idFaceString", str3);
} catch (JSONException e3) {
Log.e(a, i.h(e3));
o.C().n(context).a(e3);
}
}
} else if (!z(str) && (w(str) || s(str))) {
try {
A.put("type", "selfie");
} catch (JSONException e4) {
Log.e(a, i.h(e4));
o.C().n(context).a(e4);
}
File file = new File(str2);
MultipartBody.Part createFormData = MultipartBody.Part.createFormData(str5, file.getName(), RequestBody.create(MediaType.parse("image/jpeg"), file));
if (hyperSnapParams$FaceMatchMode == HyperSnapParams$FaceMatchMode.FACE_IDFACESTRING && hyperSnapParams$FaceMatchMode != HyperSnapParams$FaceMatchMode.FACE_ID_FACE_STRING) {
File file2 = new File(str3);
part = MultipartBody.Part.createFormData(str4, file2.getName(), RequestBody.create(MediaType.parse("image/jpeg"), file2));
} else {
part = null;
}
MultipartBody.Part part2 = part;
Map<String, RequestBody> E = E(A);
Map<String, String> hashMap = new HashMap<>();
if (y != null) {
hashMap = (Map) GsonInstrumentation.fromJson(new Gson(), JSONObjectInstrumentation.toString(y), (Class<Object>) HashMap.class);
}
map = hashMap;
if (co.hyperverge.hypersnapsdk.a.t().s().getAccessToken() == null && !co.hyperverge.hypersnapsdk.a.t().s().getAccessToken().isEmpty()) {
map.put(HttpRequest.HEADER_AUTHORIZATION, co.hyperverge.hypersnapsdk.a.t().s().getAccessToken());
} else {
map.put(AnalyticsAttribute.APP_ID_ATTRIBUTE, co.hyperverge.hypersnapsdk.a.t().s().getAppId());
map.put("appKey", co.hyperverge.hypersnapsdk.a.t().s().getAppKey());
}
co.hyperverge.hypersnapsdk.b.g.a.d().c(str, map, createFormData, part2, E).enqueue(new d(c2, str, context, hyperSnapParams$FaceMatchMode, aVar, new q()));
if (o.C().M()) {
o.C().d(context).m0(str, hyperSnapParams$FaceMatchMode.toString(), str2, str3);
return;
}
return;
}
str5 = "selfie";
str4 = DistributedTracing.NR_ID_ATTRIBUTE;
File file3 = new File(str2);
MultipartBody.Part createFormData2 = MultipartBody.Part.createFormData(str5, file3.getName(), RequestBody.create(MediaType.parse("image/jpeg"), file3));
if (hyperSnapParams$FaceMatchMode == HyperSnapParams$FaceMatchMode.FACE_IDFACESTRING) {
}
part = null;
MultipartBody.Part part22 = part;
Map<String, RequestBody> E2 = E(A);
Map<String, String> hashMap2 = new HashMap<>();
if (y != null) {
}
map = hashMap2;
if (co.hyperverge.hypersnapsdk.a.t().s().getAccessToken() == null) {
}
map.put(AnalyticsAttribute.APP_ID_ATTRIBUTE, co.hyperverge.hypersnapsdk.a.t().s().getAppId());
map.put("appKey", co.hyperverge.hypersnapsdk.a.t().s().getAppKey());
co.hyperverge.hypersnapsdk.b.g.a.d().c(str, map, createFormData2, part22, E2).enqueue(new d(c2, str, context, hyperSnapParams$FaceMatchMode, aVar, new q()));
if (o.C().M()) {
}
} else {
if (z(str)) {
str4 = "selfie2";
str5 = "selfie";
} else {
if (w(str) || s(str)) {
try {
A.put("type", DistributedTracing.NR_ID_ATTRIBUTE);
} catch (JSONException e5) {
Log.e(a, i.h(e5));
o.C().n(context).a(e5);
}
}
str5 = "selfie";
str4 = DistributedTracing.NR_ID_ATTRIBUTE;
}
File file32 = new File(str2);
MultipartBody.Part createFormData22 = MultipartBody.Part.createFormData(str5, file32.getName(), RequestBody.create(MediaType.parse("image/jpeg"), file32));
if (hyperSnapParams$FaceMatchMode == HyperSnapParams$FaceMatchMode.FACE_IDFACESTRING) {
}
part = null;
MultipartBody.Part part222 = part;
Map<String, RequestBody> E22 = E(A);
Map<String, String> hashMap22 = new HashMap<>();
if (y != null) {
}
map = hashMap22;
if (co.hyperverge.hypersnapsdk.a.t().s().getAccessToken() == null) {
}
map.put(AnalyticsAttribute.APP_ID_ATTRIBUTE, co.hyperverge.hypersnapsdk.a.t().s().getAppId());
map.put("appKey", co.hyperverge.hypersnapsdk.a.t().s().getAppKey());
co.hyperverge.hypersnapsdk.b.g.a.d().c(str, map, createFormData22, part222, E22).enqueue(new d(c2, str, context, hyperSnapParams$FaceMatchMode, aVar, new q()));
if (o.C().M()) {
}
}
}
@Override
public void d(co.hyperverge.hypersnapsdk.listeners.a aVar) {
HashMap hashMap = new HashMap();
if (co.hyperverge.hypersnapsdk.a.t().s().getAccessToken() != null && !co.hyperverge.hypersnapsdk.a.t().s().getAccessToken().isEmpty()) {
hashMap.put(HttpRequest.HEADER_AUTHORIZATION, co.hyperverge.hypersnapsdk.a.t().s().getAccessToken());
} else {
hashMap.put(AnalyticsAttribute.APP_ID_ATTRIBUTE, co.hyperverge.hypersnapsdk.a.t().s().getAppId());
hashMap.put("appKey", co.hyperverge.hypersnapsdk.a.t().s().getAppKey());
}
try {
if (!p.p().trim().isEmpty() && !hashMap.containsKey("transactionId")) {
hashMap.put("transactionId", p.p());
}
} catch (Exception e2) {
Log.e(a, i.h(e2));
}
co.hyperverge.hypersnapsdk.b.g.a.d().d("https://hypersnapweb.hyperverge.co/api/proxy/geoIP/", hashMap).enqueue(new C0218f(aVar));
}
@Override
public void e(String str, String str2, String str3, List<Integer> list, HVFaceConfig hVFaceConfig, b.a aVar) {
MultipartBody.Part part;
String jSONObjectInstrumentation;
Call<ResponseBody> e2;
File file = new File(str);
MultipartBody.Part createFormData = MultipartBody.Part.createFormData("image", file.getName(), RequestBody.create(MediaType.parse("image/jpeg"), file));
JSONObject livenessParams = hVFaceConfig.getLivenessParams();
try {
if (hVFaceConfig.isShouldUseDefaultZoom()) {
livenessParams.put("zoom-factor", String.valueOf(co.hyperverge.hypersnapsdk.f.a.b));
}
if (co.hyperverge.hypersnapsdk.a.t().s().getHyperSnapRegion() == HyperSnapParams$Region.ASIA_PACIFIC || co.hyperverge.hypersnapsdk.a.t().s().getHyperSnapRegion() == HyperSnapParams$Region.AsiaPacific) {
livenessParams.put("validateFaceSize", "no");
}
} catch (JSONException e3) {
if (o.C().x() != null) {
o.C().x().a(e3);
}
}
String str4 = null;
if (str3 != null && D(hVFaceConfig.getLivenessEndpoint())) {
File file2 = new File(str3);
part = MultipartBody.Part.createFormData("video", file2.getName(), RequestBody.create(MediaType.parse("video/mp4"), file2));
} else {
part = null;
}
if (list != null && !list.isEmpty()) {
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("x1", list.get(0));
jSONObject.put("y1", list.get(1));
jSONObject.put("x2", list.get(2));
jSONObject.put("y2", list.get(3));
livenessParams.put("face-coordinates", JSONObjectInstrumentation.toString(jSONObject));
} catch (Exception e4) {
Log.e(a, i.h(e4));
if (o.C().x() != null) {
o.C().x().a(e4);
}
}
}
Map<String, RequestBody> E = E(livenessParams);
E.putAll(j.o().g(hVFaceConfig));
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldUseSensorBiometrics()) {
E.putAll(o.C().A().c0());
}
RequestBody create = RequestBody.create(MediaType.parse(HttpRequest.SHARE_TYPE), "no");
if (hVFaceConfig.getShouldUseBackCamera()) {
create = RequestBody.create(MediaType.parse(HttpRequest.SHARE_TYPE), "yes");
}
new HashMap();
JSONObject jSONObject2 = new JSONObject();
if (hVFaceConfig.getHeaders() != null) {
jSONObject2 = hVFaceConfig.getHeaders();
}
JSONObject m = m(jSONObject2);
Gson gson = new Gson();
if (!(m instanceof JSONObject)) {
jSONObjectInstrumentation = m.toString();
} else {
jSONObjectInstrumentation = JSONObjectInstrumentation.toString(m);
}
Map<String, String> map = (Map) GsonInstrumentation.fromJson(gson, jSONObjectInstrumentation, (Class<Object>) HashMap.class);
if (co.hyperverge.hypersnapsdk.a.t().s().getAccessToken() != null && !co.hyperverge.hypersnapsdk.a.t().s().getAccessToken().isEmpty()) {
map.put(HttpRequest.HEADER_AUTHORIZATION, co.hyperverge.hypersnapsdk.a.t().s().getAccessToken());
} else {
map.put(AnalyticsAttribute.APP_ID_ATTRIBUTE, co.hyperverge.hypersnapsdk.a.t().s().getAppId());
map.put("appKey", co.hyperverge.hypersnapsdk.a.t().s().getAppKey());
}
if (hVFaceConfig.isUseBothImagesSignature()) {
if (str2 != null) {
str4 = g.c(str, str2, m);
}
} else {
str4 = g.d(str, m);
}
try {
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldUseSHA256Signature() && str4 != null && !map.containsKey(AnalyticsAttribute.UUID_ATTRIBUTE)) {
map.put(AnalyticsAttribute.UUID_ATTRIBUTE, str4);
}
} catch (Exception e5) {
Log.e(a, i.h(e5));
if (o.C().x() != null) {
o.C().x().a(e5);
}
}
if (hVFaceConfig.isShouldRecordVideo() && str3 != null) {
e2 = co.hyperverge.hypersnapsdk.b.g.a.d().a(hVFaceConfig.getLivenessEndpoint(), map, createFormData, part, E, create);
} else {
e2 = co.hyperverge.hypersnapsdk.b.g.a.d().e(hVFaceConfig.getLivenessEndpoint(), map, createFormData, E, create);
}
e2.enqueue(new b(str4, hVFaceConfig, aVar));
if (o.C().M() && o.C().t() != null) {
o.C().t().P(hVFaceConfig.getLivenessEndpoint(), str);
}
}
public HVError f(Exception exc) {
exc.printStackTrace();
return new HVError(2, exc.getLocalizedMessage());
}
public HVError g(String str, int i) {
return new HVError(i, str);
}
public String k(Headers headers) {
String str;
try {
str = headers.get("X-Request-Id");
} catch (Exception e2) {
v(e2);
if (o.C().x() != null) {
o.C().x().a(e2);
}
str = " ";
}
if (str != null && !str.trim().isEmpty()) {
return str;
}
try {
return headers.get("X-HV-Request-Id");
} catch (Exception e3) {
v(e3);
if (o.C().x() == null) {
return " ";
}
o.C().x().a(e3);
return " ";
}
}
JSONObject l(Headers headers, String str) {
JSONObject jSONObject = new JSONObject();
for (int i = 0; i < headers.size(); i++) {
try {
String name = headers.name(i);
String value = headers.value(i);
if (name.toLowerCase().startsWith("x-hv-")) {
jSONObject.put(name, value);
}
if (name.equalsIgnoreCase("x-request-id")) {
jSONObject.put("X-HV-Request-Id", value);
}
if (name.equalsIgnoreCase("x-response-signature")) {
jSONObject.put("X-HV-Response-Signature", value);
}
} catch (Exception e2) {
v(e2);
if (o.C().x() != null) {
o.C().x().a(e2);
return null;
}
return null;
}
}
if (co.hyperverge.hypersnapsdk.a.t().s().isShouldUseSignature() && str != null) {
jSONObject.put("X-HV-Request-Signature", str);
}
return jSONObject;
}
public JSONObject m(JSONObject jSONObject) {
try {
if (jSONObject.has("transactionId") && jSONObject.getString("transactionId").equalsIgnoreCase("transactionId")) {
jSONObject.remove("transactionId");
}
} catch (Exception e2) {
if (o.C().x() != null) {
o.C().x().a(e2);
}
}
try {
jSONObject.put("sdk-version", "3.7.2");
jSONObject.put("os", "android");
jSONObject.put(HttpRequest.SWIGGY_HEADER_VERSION_NAME, o.C().w());
jSONObject.put("device", Build.MODEL);
} catch (Exception e3) {
v(e3);
if (o.C().x() != null) {
o.C().x().a(e3);
}
}
return jSONObject;
}
}