what-the-bank/sources/io/beid/beidk/messages/transaction/TransactionUploadForm.java

83 lines
4.3 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package io.beid.beidk.messages.transaction;
import com.google.common.base.Preconditions;
import com.google.common.net.HttpHeaders;
import io.beid.beidk.definitions.BeIDParams;
import io.beid.beidk.definitions.TransactionUploadFileType;
import java.io.InputStream;
import java.util.EnumMap;
import java.util.UUID;
import o.C16487olf;
import o.C16726qjC;
import o.Dfn;
import o.OmK;
import o.WUg;
import org.jmrtd.lds.ImageInfo;
/* loaded from: classes5.dex */
public final class TransactionUploadForm {
private static final EnumMap<TransactionUploadFileType, String> c;
private String a;
private InputStream b;
private TransactionUploadFileType d;
private String e;
public final C16487olf asMultiplePartFormData() {
C16487olf c16487olf = new C16487olf();
new OmK("multipart/form-data").b("boundary", UUID.randomUUID().toString());
C16487olf.IeS ieS = new C16487olf.IeS();
ieS.a = new C16726qjC().b(HttpHeaders.CONTENT_DISPOSITION, String.format("form-data; name=\"%s\"", BeIDParams.BEID_TRANSACTION_ID));
ieS.e = WUg.c(this.a);
c16487olf.b.add(Preconditions.checkNotNull(ieS));
C16487olf.IeS ieS2 = new C16487olf.IeS();
ieS2.a = new C16726qjC().b(HttpHeaders.CONTENT_DISPOSITION, String.format("form-data; name=\"%s\"", "fileType"));
ieS2.e = WUg.c(this.d.getValue().toString());
c16487olf.b.add(Preconditions.checkNotNull(ieS2));
C16487olf.IeS ieS3 = new C16487olf.IeS();
ieS3.a = new C16726qjC().b(HttpHeaders.CONTENT_DISPOSITION, String.format("form-data; name=\"%s\"", "meta"));
ieS3.e = WUg.c(this.e);
c16487olf.b.add(Preconditions.checkNotNull(ieS3));
C16487olf.IeS ieS4 = new C16487olf.IeS();
ieS4.a = new C16726qjC().b(HttpHeaders.CONTENT_DISPOSITION, String.format("form-data; name=\"file\"; filename=\"%s\"", c.get(this.d)));
ieS4.e = new Dfn(ImageInfo.JPEG_MIME_TYPE, this.b);
c16487olf.b.add(Preconditions.checkNotNull(ieS4));
return c16487olf;
}
public final TransactionUploadForm setTransactionId(String str) {
this.a = str;
return this;
}
public final TransactionUploadForm setMeta(String str) {
this.e = str;
return this;
}
public final TransactionUploadForm setInputStream(InputStream inputStream) {
this.b = inputStream;
return this;
}
public final TransactionUploadForm setFileType(TransactionUploadFileType transactionUploadFileType) {
this.d = transactionUploadFileType;
return this;
}
static {
EnumMap<TransactionUploadFileType, String> enumMap = new EnumMap<>((Class<TransactionUploadFileType>) TransactionUploadFileType.class);
c = enumMap;
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.CITIZEN, (TransactionUploadFileType) "citizen.jpg");
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.EPASSPORT, (TransactionUploadFileType) "epassport.jpg");
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.LIVENESS_1, (TransactionUploadFileType) "liveness1.jpg");
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.LIVENESS_2, (TransactionUploadFileType) "liveness2.jpg");
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.LIVENESS_3, (TransactionUploadFileType) "liveness3.jpg");
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.LIVENESS_4, (TransactionUploadFileType) "liveness4.jpg");
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.LIVENESS_5, (TransactionUploadFileType) "liveness5.jpg");
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.LIVENESS_6, (TransactionUploadFileType) "liveness6.jpg");
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.LIVENESS_7, (TransactionUploadFileType) "liveness7.jpg");
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.LIVENESS_8, (TransactionUploadFileType) "liveness8.jpg");
enumMap.put((EnumMap<TransactionUploadFileType, String>) TransactionUploadFileType.LIVENESS_9, (TransactionUploadFileType) "liveness9.jpg");
}
}