what-the-bank/sources/com/kofax/kmc/klo/logistics/webservice/calls/SendImage.java

177 lines
7.4 KiB
Java

package com.kofax.kmc.klo.logistics.webservice.calls;
import com.kofax.kmc.klo.logistics.webservice.KofaxWebServiceResponseBase;
import com.kofax.kmc.klo.logistics.webservice.SendImageResponse;
import com.kofax.kmc.klo.logistics.webservice.WebServiceCallResult;
import com.kofax.kmc.klo.logistics.webservice.WscDestination;
import com.kofax.kmc.klo.logistics.webservice.WscSendImageRequest;
import com.kofax.kmc.klo.logistics.webservice.ksoap.MarshalByte;
import com.kofax.kmc.klo.logistics.webservice.ksoap.MarshalShort;
import com.kofax.kmc.kut.utilities.CertificateValidatorListener;
import com.kofax.kmc.kut.utilities.error.ErrorInfo;
import com.kofax.mobile.sdk._internal.k;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import o.C15280gmP;
import o.C15281gmQ;
import o.C15332gnh;
import o.gjJ;
import o.gmO;
import o.gmR;
/* loaded from: classes3.dex */
public class SendImage extends KofaxWebServiceCallBase {
public static String METHOD_NAME = "sendImage";
public static String NAMESPACE = "http://job.wsc.des.kofax.com";
public static String SERVICE_NAME = "SendImageService";
public static String SOAP_ACTION = "urn:sendImage";
private static final String TAG = "SendImage";
private WscSendImageRequest request = null;
private byte[] imageBytes = null;
private Map<String, String> headerMap = new HashMap();
@Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase
public KofaxWebServiceResponseBase populateFromResponse(gmO gmo) {
return SendImageResponse.populateFromResponse(gmo);
}
@Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase
protected List<C15332gnh> getExtraHeaders() {
if (this.headerMap.size() == 0) {
return new ArrayList();
}
ArrayList arrayList = new ArrayList();
for (String str : this.headerMap.keySet()) {
C15332gnh b = new C15332gnh().b(getNamespace(), str);
String str2 = this.headerMap.get(str);
Vector vector = b.a;
b.a(vector == null ? 0 : vector.size(), 4, str2);
arrayList.add(b);
}
return arrayList;
}
public static WebServiceCallResult cancelJob(URL url, WscDestination wscDestination, String str, String str2, String str3, CertificateValidatorListener certificateValidatorListener) {
WscSendImageRequest wscSendImageRequest = new WscSendImageRequest();
wscSendImageRequest.initialize();
wscSendImageRequest.setCancelled(true);
wscSendImageRequest.setJobId(str3);
wscSendImageRequest.setDestination(wscDestination);
wscSendImageRequest.setUserName(str);
wscSendImageRequest.setPassword(str2);
SendImage sendImage = new SendImage();
WebServiceCallResult init = sendImage.init(url, certificateValidatorListener);
if (init.isSuccess()) {
sendImage.setRequest(wscSendImageRequest);
try {
SendImageResponse sendImageResponse = (SendImageResponse) sendImage.execute();
if (!gjJ.b((CharSequence) sendImageResponse.getErrorMessage())) {
init.setErrorMsg(sendImageResponse.getErrorMessage());
init.setSuccess(false);
} else {
init.setExtraData(sendImageResponse);
init.setSuccess(true);
}
} catch (Exception e) {
k.e(TAG, "Unable to cancel job for ".concat(String.valueOf(str3)), (Throwable) e);
init.setErrorMsg("Unknown error");
}
}
return init;
}
public static WebServiceCallResult sendImage(URL url, WscDestination wscDestination, String str, String str2, String str3, byte[] bArr, int i, boolean z, CertificateValidatorListener certificateValidatorListener, int i2) {
int i3 = (bArr[0] == 73 && bArr[1] == 73 && bArr[2] == 42) ? 1 : 0;
WscSendImageRequest wscSendImageRequest = new WscSendImageRequest();
wscSendImageRequest.initialize();
wscSendImageRequest.setJobId(str3);
wscSendImageRequest.setPartNumber(i + 1);
wscSendImageRequest.setDone(z);
wscSendImageRequest.setImageType((short) i3);
wscSendImageRequest.setDestination(wscDestination);
wscSendImageRequest.setUserName(str);
wscSendImageRequest.setPassword(str2);
SendImage sendImage = new SendImage();
sendImage.setTimeout(i2);
sendImage.imageBytes = bArr;
WebServiceCallResult init = sendImage.init(url, certificateValidatorListener);
if (init.isSuccess()) {
sendImage.setRequest(wscSendImageRequest);
try {
SendImageResponse sendImageResponse = (SendImageResponse) sendImage.execute();
if (!gjJ.b((CharSequence) sendImageResponse.getErrorMessage())) {
init.setErrorMsg(sendImageResponse.getErrorMessage());
init.setSuccess(false);
} else {
init.setExtraData(sendImageResponse);
init.setSuccess(true);
}
} catch (SocketTimeoutException e) {
k.e(TAG, "send image socketTimeoutException for ".concat(String.valueOf(str3)), (Throwable) e);
init.setErrorMsg(e.getMessage());
init.setErrorInfo(ErrorInfo.KMC_LO_REQUEST_TIMEOUT);
init.setSuccess(false);
} catch (Exception e2) {
k.e(TAG, "Unable to send image for ".concat(String.valueOf(str3)), (Throwable) e2);
init.setErrorMsg("Unknown error");
init.setSuccess(false);
}
}
return init;
}
@Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase
public gmO packageRequest() {
gmO gmo = new gmO(getNamespace(), getMethodName());
gmO soapObject = this.request.toSoapObject(getNamespace(), "wsRequest");
C15281gmQ c15281gmQ = new C15281gmQ();
c15281gmQ.m = "image";
c15281gmQ.l = getNamespace();
c15281gmQ.a(this.imageBytes);
c15281gmQ.k = gmR.c;
gmo.b.addElement(soapObject);
gmo.b.addElement(c15281gmQ);
return gmo;
}
@Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase
public void registerMarshallers(C15280gmP c15280gmP) {
new MarshalShort().register(c15280gmP);
new gmR().register(c15280gmP);
new MarshalByte().register(c15280gmP);
}
public void setRequest(WscSendImageRequest wscSendImageRequest) {
this.request = wscSendImageRequest;
}
@Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase
public String getSoapAction() {
return SOAP_ACTION;
}
@Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase
public String getServiceName() {
return SERVICE_NAME;
}
public WscSendImageRequest getRequest() {
return this.request;
}
@Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase
public String getNamespace() {
return NAMESPACE;
}
@Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase
public String getMethodName() {
return METHOD_NAME;
}
}