what-the-bank/sources/com/kofax/kmc/kut/utilities/MicrParser.java

302 lines
11 KiB
Java

package com.kofax.kmc.kut.utilities;
import com.kofax.kmc.kut.utilities.MicrLine;
import o.gjJ;
/* loaded from: classes3.dex */
public class MicrParser {
private final String TAG;
private MicrLine nR;
public MicrParser(String str) {
this.TAG = "MicrParser";
ParseMicr(str);
}
public MicrParser() {
this.TAG = "MicrParser";
this.nR = new MicrLine();
}
/* JADX WARN: Code restructure failed: missing block: B:10:0x0035, code lost:
r8 = new java.lang.StringBuilder(b(a(r8, r1, r7.nR), r0, r7.nR)).reverse().toString();
*/
/* JADX WARN: Code restructure failed: missing block: B:11:0x0054, code lost:
if (r8.startsWith("/") == false) goto L26;
*/
/* JADX WARN: Code restructure failed: missing block: B:12:0x0056, code lost:
r2 = r8.indexOf("/", 1);
*/
/* JADX WARN: Code restructure failed: missing block: B:13:0x005b, code lost:
if (r2 > 0) goto L21;
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x005d, code lost:
com.kofax.mobile.sdk._internal.k.e(r7.TAG, "Unable to parse amount");
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x006a, code lost:
return r7.nR.getValueSet();
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x006b, code lost:
r7.nR.setAmount(new java.lang.StringBuilder(r8.substring(1, r2)).reverse().toString());
r2 = r2 + 1;
*/
/* JADX WARN: Code restructure failed: missing block: B:17:0x0086, code lost:
if (r2 <= r8.length()) goto L25;
*/
/* JADX WARN: Code restructure failed: missing block: B:19:0x008e, code lost:
return r7.nR.getValueSet();
*/
/* JADX WARN: Code restructure failed: missing block: B:20:0x008f, code lost:
r8 = r8.substring(r2);
*/
/* JADX WARN: Code restructure failed: missing block: B:23:0x0097, code lost:
r8 = c(o.gjJ.c(r8), r0, r7.nR);
r7.nR.setOnUs(r8);
e(d(r8, r1, r7.nR), r1, r7.nR);
*/
/* JADX WARN: Code restructure failed: missing block: B:25:0x00b3, code lost:
return r7.nR.getValueSet();
*/
/* JADX WARN: Code restructure failed: missing block: B:28:0x00ba, code lost:
return r7.nR.getValueSet();
*/
/* JADX WARN: Code restructure failed: missing block: B:32:0x0033, code lost:
if (r8.contains(",") != false) goto L15;
*/
/* JADX WARN: Code restructure failed: missing block: B:9:0x0022, code lost:
if (r8.contains("P") != false) goto L15;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public boolean ParseMicr(java.lang.String r8) throws com.kofax.kmc.kut.utilities.error.NullPointerException {
/*
r7 = this;
com.kofax.kmc.kut.utilities.MicrLine r0 = new com.kofax.kmc.kut.utilities.MicrLine
r0.<init>()
r7.nR = r0
boolean r0 = o.gjJ.b(r8)
if (r0 == 0) goto L14
com.kofax.kmc.kut.utilities.MicrLine r8 = r7.nR
boolean r8 = r8.getValueSet()
return r8
L14:
java.lang.String r0 = "C"
boolean r1 = r8.contains(r0)
if (r1 == 0) goto L25
java.lang.String r1 = "P"
boolean r2 = r8.contains(r1)
if (r2 == 0) goto L25
goto L35
L25:
java.lang.String r0 = "."
boolean r1 = r8.contains(r0)
if (r1 == 0) goto Lbb
java.lang.String r1 = ","
boolean r2 = r8.contains(r1)
if (r2 == 0) goto Lbb
L35:
com.kofax.kmc.kut.utilities.MicrLine r2 = r7.nR
java.lang.String r8 = a(r8, r1, r2)
com.kofax.kmc.kut.utilities.MicrLine r2 = r7.nR
java.lang.String r8 = b(r8, r0, r2)
java.lang.StringBuilder r2 = new java.lang.StringBuilder
r2.<init>(r8)
java.lang.StringBuilder r8 = r2.reverse()
java.lang.String r8 = r8.toString()
java.lang.String r2 = "/"
boolean r3 = r8.startsWith(r2)
if (r3 == 0) goto L93
r3 = 1
int r2 = r8.indexOf(r2, r3)
if (r2 > 0) goto L6b
java.lang.String r8 = r7.TAG
java.lang.String r0 = "Unable to parse amount"
com.kofax.mobile.sdk._internal.k.e(r8, r0)
com.kofax.kmc.kut.utilities.MicrLine r8 = r7.nR
boolean r8 = r8.getValueSet()
return r8
L6b:
java.lang.String r4 = r8.substring(r3, r2)
com.kofax.kmc.kut.utilities.MicrLine r5 = r7.nR
java.lang.StringBuilder r6 = new java.lang.StringBuilder
r6.<init>(r4)
java.lang.StringBuilder r4 = r6.reverse()
java.lang.String r4 = r4.toString()
r5.setAmount(r4)
int r2 = r2 + r3
int r3 = r8.length()
if (r2 <= r3) goto L8f
com.kofax.kmc.kut.utilities.MicrLine r8 = r7.nR
boolean r8 = r8.getValueSet()
return r8
L8f:
java.lang.String r8 = r8.substring(r2)
L93:
java.lang.String r8 = o.gjJ.c(r8)
com.kofax.kmc.kut.utilities.MicrLine r2 = r7.nR // Catch: com.kofax.kmc.kut.utilities.MicrParser.a -> Lb4
java.lang.String r8 = c(r8, r0, r2) // Catch: com.kofax.kmc.kut.utilities.MicrParser.a -> Lb4
com.kofax.kmc.kut.utilities.MicrLine r0 = r7.nR // Catch: com.kofax.kmc.kut.utilities.MicrParser.a -> Lb4
r0.setOnUs(r8) // Catch: com.kofax.kmc.kut.utilities.MicrParser.a -> Lb4
com.kofax.kmc.kut.utilities.MicrLine r0 = r7.nR // Catch: com.kofax.kmc.kut.utilities.MicrParser.a -> Lb4
java.lang.String r8 = d(r8, r1, r0) // Catch: com.kofax.kmc.kut.utilities.MicrParser.a -> Lb4
com.kofax.kmc.kut.utilities.MicrLine r0 = r7.nR // Catch: com.kofax.kmc.kut.utilities.MicrParser.a -> Lb4
e(r8, r1, r0) // Catch: com.kofax.kmc.kut.utilities.MicrParser.a -> Lb4
com.kofax.kmc.kut.utilities.MicrLine r8 = r7.nR
boolean r8 = r8.getValueSet()
return r8
Lb4:
com.kofax.kmc.kut.utilities.MicrLine r8 = r7.nR
boolean r8 = r8.getValueSet()
return r8
Lbb:
com.kofax.kmc.kut.utilities.MicrLine r8 = r7.nR
boolean r8 = r8.getValueSet()
return r8
*/
throw new UnsupportedOperationException("Method not decompiled: com.kofax.kmc.kut.utilities.MicrParser.ParseMicr(java.lang.String):boolean");
}
public boolean isMicrValid() {
String transitNumber = this.nR.getTransitNumber();
if (transitNumber == null || transitNumber.length() != 9) {
return false;
}
String amount = this.nR.getAmount();
return gjJ.b((CharSequence) amount) || amount.length() == 10;
}
public String getAccountNumber() {
String o2 = o(this.nR.getAuxiliaryOnUs());
String o3 = o(this.nR.getOnUs1());
if (!gjJ.b((CharSequence) o2)) {
return o3;
}
String o4 = o(this.nR.getOnUs2());
return !gjJ.b((CharSequence) o4) ? o3.length() < o4.length() ? o4 : o3 : o3.length() >= 14 ? o3.substring(4) : o3;
}
public String getTransitNumber() {
return this.nR.getTransitNumber();
}
public String getCheckNumber() {
String o2 = o(this.nR.getAuxiliaryOnUs());
if (!gjJ.b((CharSequence) o2)) {
return o2;
}
String o3 = o(this.nR.getOnUs1());
String o4 = o(this.nR.getOnUs2());
return !gjJ.b((CharSequence) o4) ? o3.length() >= o4.length() ? o4 : o3 : o3.length() >= 14 ? o3.substring(0, 4) : "";
}
private static String a(String str, String str2, MicrLine micrLine) {
String f = gjJ.f(str, str2);
String h = gjJ.h(str, str2);
if (n(f) && h != null) {
micrLine.setAuxiliaryOnUs(h);
micrLine.setCheckType(MicrLine.CheckType.BUSINESS_CHECK);
return str.substring(f.length() + str2.length() + h.length() + str2.length());
}
micrLine.setCheckType(MicrLine.CheckType.PERSONAL_CHECK);
return str;
}
private static String b(String str, String str2, MicrLine micrLine) {
int indexOf = str.indexOf(str2) - 1;
if (indexOf < 0) {
return str;
}
char charAt = str.charAt(indexOf);
if (!Character.isDigit(charAt)) {
return str;
}
String substring = str.substring(0, indexOf);
if (!n(substring)) {
return str;
}
String valueOf = String.valueOf(charAt);
micrLine.setEPC(valueOf);
return str.substring(substring.length() + valueOf.length());
}
private static String c(String str, String str2, MicrLine micrLine) throws a {
String f = gjJ.f(str, str2);
if (!n(f)) {
throw new a();
}
String h = gjJ.h(str, str2);
if (h == null) {
throw new a();
}
micrLine.setTransitNumber(p(h));
return str.substring(f.length() + str2.length() + h.length() + str2.length());
}
private static String d(String str, String str2, MicrLine micrLine) throws a {
String f = gjJ.f(str, str2);
if (!n(f)) {
micrLine.setOnUs1(f);
return str.substring(f.length());
}
String substring = str.substring(f.length() + str2.length());
String f2 = gjJ.f(substring, str2);
if (o(f2).isEmpty()) {
throw new a();
}
micrLine.setOnUs1(f2);
return substring.substring(f2.length());
}
private static String e(String str, String str2, MicrLine micrLine) {
if (!str.startsWith(str2)) {
return str;
}
micrLine.setOnUs2(str.substring(str2.length()));
return "";
}
private static boolean n(String str) {
return gjJ.d(str, ' ');
}
private static String o(String str) {
return str == null ? "" : q(str);
}
private static String p(String str) {
return str == null ? "" : q(str);
}
private static String q(String str) {
return str.replaceAll("[^0-9]", "");
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes3.dex */
public static class a extends Exception {
private a() {
}
}
public MicrLine getMicrLine() {
return this.nR;
}
}