package o; import com.scb.phone.data.entity.transfer.SingleDataEntity; import com.scb.phone.data.network.service.MerchantWalletService; import com.scb.phone.data.network.service.TermsConditionsService; import com.scb.phone.domain.entity.mwpartner.EntityMappingException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Objects; import org.threeten.bp.OffsetDateTime; /* loaded from: classes3.dex */ public final class cNS implements InterfaceC16806rQZ { final PHf a; final C0265Cqo b; final UxE c; final C17585xxc d; final rPg e; private final TRO f; private final C14862gac g; final dKC h; private final MerchantWalletService i; final nSC j; private final TermsConditionsService m; /* renamed from: o, reason: collision with root package name */ private final C16732qmG f8612o; @InterfaceC13391fZD public cNS(C14862gac c14862gac, PHf pHf, MerchantWalletService merchantWalletService, dKC dkc, TermsConditionsService termsConditionsService, TRO tro, C17585xxc c17585xxc, nSC nsc, C0265Cqo c0265Cqo, C16732qmG c16732qmG, UxE uxE, rPg rpg) { this.a = pHf; this.i = merchantWalletService; this.h = dkc; this.m = termsConditionsService; this.f = tro; this.g = c14862gac; this.d = c17585xxc; this.j = nsc; this.b = c0265Cqo; this.c = uxE; this.f8612o = c16732qmG; this.e = rpg; } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk a() { AbstractC13163fSk checkAccountEligibility = this.i.getCheckAccountEligibility(); PHf pHf = this.a; Objects.requireNonNull(pHf); return checkAccountEligibility.map(new C11187eac(pHf)); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk e() { return this.i.getMerchantLanding().map(new fSS(this) { // from class: o.nWr private cNS d; @Override // o.fSS public final Object a(Object obj) { String str; String str2; C0532IwX c0532IwX; int i; String str3; String str4; C0532IwX c0532IwX2; C7806cvL c7806cvL; qsm qsmVar; String str5; C7806cvL c7806cvL2; ArrayList arrayList; Ddv ddv; Boolean bool; C0582JyM c0582JyM; PHf pHf = this.d.a; qsm qsmVar2 = (qsm) ((SingleDataEntity) obj).getData(); C14957gcv.e(qsmVar2, ""); String str6 = qsmVar2.e; int i2 = qsmVar2.h; String str7 = qsmVar2.f9252o; String str8 = qsmVar2.i; String str9 = qsmVar2.b; String str10 = qsmVar2.g; bYT byt = qsmVar2.a; if (byt != null) { C14957gcv.e(byt, ""); str2 = str10; str = str9; c0532IwX = new C0532IwX(byt.c, byt.f, byt.a, byt.e, byt.h, byt.d, byt.i, byt.b, byt.g, byt.j); } else { str = str9; str2 = str10; c0532IwX = null; } Wus wus = qsmVar2.j; if (wus != null) { C14957gcv.e(wus, ""); c0532IwX2 = c0532IwX; str4 = str8; str3 = str7; i = i2; c7806cvL = new C7806cvL(wus.e, wus.j, wus.a, wus.b, wus.i, wus.c, wus.d, wus.g, wus.h, wus.f, wus.m, wus.n, wus.l); } else { i = i2; str3 = str7; str4 = str8; c0532IwX2 = c0532IwX; c7806cvL = null; } List list = qsmVar2.l; if (list != null) { List list2 = list; C14957gcv.e(list2, ""); ArrayList arrayList2 = new ArrayList(list2 instanceof Collection ? list2.size() : 10); Iterator it = list2.iterator(); while (it.hasNext()) { YhA yhA = (YhA) it.next(); C14957gcv.e(yhA, ""); int i3 = yhA.d; String str11 = yhA.c; String str12 = yhA.g; GAL gal = yhA.e; C14957gcv.e(gal, ""); Iterator it2 = it; C7806cvL c7806cvL3 = c7806cvL; String str13 = str6; qsm qsmVar3 = qsmVar2; ArrayList arrayList3 = arrayList2; ZIS zis = new ZIS(gal.j, gal.i, gal.g, gal.h, gal.f8177o, gal.d, gal.a, gal.b, gal.e, gal.c, gal.k, gal.f, gal.n, gal.l); jeV jev = yhA.b; if (jev != null) { C14957gcv.e(jev, ""); c0582JyM = new C0582JyM(jev.e, jev.c, jev.i, jev.l, jev.n, jev.f9183o, jev.f, jev.k, jev.d, jev.h, jev.g, jev.j, jev.a, jev.b); } else { c0582JyM = null; } toe toeVar = yhA.a; C14957gcv.e(toeVar, ""); arrayList2 = arrayList3; arrayList2.add(new tDs(i3, str11, str12, zis, c0582JyM, new C0762OFj(toeVar.e, toeVar.c, toeVar.d, toeVar.a, toeVar.b))); it = it2; c7806cvL = c7806cvL3; str6 = str13; qsmVar2 = qsmVar3; } qsmVar = qsmVar2; str5 = str6; c7806cvL2 = c7806cvL; arrayList = arrayList2; } else { qsmVar = qsmVar2; str5 = str6; c7806cvL2 = c7806cvL; arrayList = null; } List list3 = arrayList == null ? C14851gaI.c : arrayList; qsm qsmVar4 = qsmVar; String str14 = qsmVar4.d; iDf idf = qsmVar4.c; if (idf != null) { C14957gcv.e(idf, ""); String str15 = idf.b; C16616pjp c16616pjp = idf.c; OBr oBr = c16616pjp != null ? new OBr(c16616pjp.d, c16616pjp.a) : null; String str16 = idf.a; String str17 = idf.d; if (str17 != null) { C14957gcv.e(str17, ""); bool = Boolean.valueOf(Integer.parseInt(str17) == 1); } else { bool = null; } ddv = new Ddv(str15, oBr, str16, bool, idf.e); } else { ddv = null; } return new rzT(str5, i, str3, str4, str, str2, c0532IwX2, c7806cvL2, list3, str14, ddv, qsmVar4.f); } { this.d = this; } }).onErrorResumeNext(new fSS() { // from class: o.sgQ @Override // o.fSS public final Object a(Object obj) { return AbstractC13163fSk.error(new EntityMappingException(null, (Throwable) obj)); } }).doOnNext(new fSQ(this) { // from class: o.qFf private cNS d; @Override // o.fSQ public final void c(Object obj) { cNS cns = this.d; rzT rzt = (rzT) obj; PHf pHf = cns.a; C14957gcv.e(rzt, ""); String[] strArr = {"LANDING", "LINKWALLET", "ONBOARD"}; C14957gcv.e(strArr, ""); C14957gcv.e(strArr, ""); List asList = Arrays.asList(strArr); C14957gcv.c(asList, ""); if (asList.contains(rzt.e)) { Integer[] numArr = {0, 1}; C14957gcv.e(numArr, ""); C14957gcv.e(numArr, ""); List asList2 = Arrays.asList(numArr); C14957gcv.c(asList2, ""); if (asList2.contains(Integer.valueOf(rzt.h))) { String[] strArr2 = {"LANDING", "ONBOARD"}; C14957gcv.e(strArr2, ""); C14957gcv.e(strArr2, ""); List asList3 = Arrays.asList(strArr2); C14957gcv.c(asList3, ""); if (asList3.contains(rzt.e)) { if (rzt.n == null) { throw new EntityMappingException("MerchantLanding.urlTH can't be null when function is ONBOARD or LANDING"); } if (rzt.f == null) { throw new EntityMappingException("MerchantLanding.urlEN can't be null when function is ONBOARD or LANDING"); } if (rzt.c == null) { throw new EntityMappingException("MerchantLanding.applicationURL can't be null when function is ONBOARD or LANDING"); } String str = rzt.e; if (!C14957gcv.b((Object) str, (Object) "ONBOARD")) { if (C14957gcv.b((Object) str, (Object) "LANDING") && rzt.b == null) { throw new EntityMappingException(PHf.d); } } else { String str2 = rzt.g; if (str2 == null || str2.length() == 0) { throw new EntityMappingException(PHf.e); } } } cns.b.e(rzt); cns.e.c = rzt.a != null ? rzt.a.d : null; return; } int i = rzt.h; StringBuilder sb = new StringBuilder("MerchantLanding.tncFlag "); sb.append(i); sb.append(" must be 0 or 1"); throw new EntityMappingException(sb.toString()); } String str3 = rzt.e; StringBuilder sb2 = new StringBuilder("MerchantLanding.function "); sb2.append(str3); sb2.append(" must be one of "); sb2.append(asList); throw new EntityMappingException(sb2.toString()); } { this.d = this; } }); } @Override // o.InterfaceC16806rQZ public final rzT d() { return this.b.b(); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk d(C5650bx c5650bx) { return this.i.acceptMerchantTermsAndConditions(c5650bx).flatMap(new fSS() { // from class: o.VMl @Override // o.fSS public final Object a(Object obj) { return AbstractC13163fSk.just(Boolean.TRUE); } }); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk c(C5756bz c5756bz) { return this.i.createQr(c5756bz).map(new fSS() { // from class: o.teP @Override // o.fSS public final Object a(Object obj) { C8152dCn c8152dCn = (C8152dCn) ((SingleDataEntity) obj).getData(); String str = c8152dCn.d; if (str == null) { throw new EntityMappingException("qrCode can not be null"); } String str2 = c8152dCn.a; if (str2 == null) { throw new EntityMappingException("qrCode can not be null"); } String str3 = c8152dCn.e; if (str3 != null) { return new C0646LgD(str, str2, str3, c8152dCn.c); } throw new EntityMappingException("qrCode can not be null"); } }); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk a(C3636bC c3636bC) { return this.i.editMerchantAccount(c3636bC).map(new fSS() { // from class: o.TEX @Override // o.fSS public final Object a(Object obj) { return Boolean.TRUE; } }); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk b(C3699bE c3699bE) { return this.i.saveMerchantNickname(c3699bE).map(new fSS() { // from class: o.TnS @Override // o.fSS public final Object a(Object obj) { return Boolean.TRUE; } }); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk b() { if (this.b.b() == null) { return e(); } return AbstractC13163fSk.just(this.b.b()); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk d(String str) { AbstractC13163fSk map = this.i.getMerchantStatic(str, null).map(new fSS() { // from class: o.nen @Override // o.fSS public final Object a(Object obj) { return (gOm) ((SingleDataEntity) obj).getData(); } }); final C14862gac c14862gac = this.g; Objects.requireNonNull(c14862gac); return map.map(new fSS(c14862gac) { // from class: o.EoO private C14862gac b; @Override // o.fSS public final Object a(Object obj) { gOm gom = (gOm) obj; C14957gcv.e(gom, ""); return new Gzz(C14862gac.a(gom.c)); } { this.b = c14862gac; } }); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk c() { AbstractC13163fSk map = this.i.getShopInfo().map(new fSS(this) { // from class: o.aHj private cNS d; @Override // o.fSS public final Object a(Object obj) { int i; dKC dkc = this.d.h; C14247fpc c14247fpc = (C14247fpc) ((SingleDataEntity) obj).getData(); C14957gcv.e(c14247fpc, ""); List list = c14247fpc.e; C14957gcv.e(list, ""); ArrayList arrayList = new ArrayList(list instanceof Collection ? list.size() : 10); for (wtp wtpVar : list) { String str = wtpVar.c; Integer num = wtpVar.a; int intValue = num != null ? num.intValue() : 0; String str2 = wtpVar.d; String str3 = wtpVar.b; String str4 = wtpVar.e; List list2 = wtpVar.h; C14957gcv.e(list2, ""); ArrayList arrayList2 = new ArrayList(list2 instanceof Collection ? list2.size() : 10); for (jYC jyc : list2) { Integer num2 = jyc.j; int intValue2 = num2 != null ? num2.intValue() : 0; String str5 = jyc.b; String str6 = jyc.e; String str7 = jyc.d; String str8 = jyc.a; String str9 = jyc.c; if (str9 != null) { C14957gcv.e(str9, ""); Integer b = gdZ.b(str9); if (b != null) { i = b.intValue(); arrayList2.add(new lIc(intValue2, str5, str6, str7, str8, i)); } } i = 0; arrayList2.add(new lIc(intValue2, str5, str6, str7, str8, i)); } arrayList.add(new WIL(str, intValue, str2, str3, str4, arrayList2)); } ArrayList arrayList3 = arrayList; List list3 = c14247fpc.a; C14957gcv.e(list3, ""); ArrayList arrayList4 = new ArrayList(list3 instanceof Collection ? list3.size() : 10); for (C15035gfG c15035gfG : list3) { Integer num3 = c15035gfG.i; arrayList4.add(new Rtm(num3 != null ? num3.intValue() : 0, c15035gfG.d, c15035gfG.a, c15035gfG.c, c15035gfG.e, c15035gfG.g, c15035gfG.b)); } ArrayList arrayList5 = arrayList4; List list4 = c14247fpc.c; C14957gcv.e(list4, ""); ArrayList arrayList6 = new ArrayList(list4 instanceof Collection ? list4.size() : 10); for (QUS qus : list4) { Integer num4 = qus.e; arrayList6.add(new Wma(num4 != null ? num4.intValue() : 0, qus.b, qus.c, qus.a, qus.d)); } return new BOR(arrayList3, arrayList5, arrayList6); } { this.d = this; } }); final C16732qmG c16732qmG = this.f8612o; Objects.requireNonNull(c16732qmG); return map.doOnNext(new fSQ(c16732qmG) { // from class: o.zuv private C16732qmG a; @Override // o.fSQ public final void c(Object obj) { C16732qmG c16732qmG2 = this.a; BOR bor = (BOR) obj; C14957gcv.e(bor, ""); c16732qmG2.d = bor; } { this.a = c16732qmG; } }); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk c(C3572bA c3572bA) { return this.i.verificationBankAccount(c3572bA).map(new fSS(this) { // from class: o.IyD private cNS c; @Override // o.fSS public final Object a(Object obj) { C17585xxc c17585xxc = this.c.d; return C17585xxc.c((EIl) ((SingleDataEntity) obj).getData()); } { this.c = this; } }); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk d(C3733bF c3733bF) { return this.i.reviewConfirmation(c3733bF).map(new fSS(this) { // from class: o.CEH private cNS d; @Override // o.fSS public final Object a(Object obj) { nSC nsc = this.d.j; YKr yKr = (YKr) ((SingleDataEntity) obj).getData(); C14957gcv.e(yKr, ""); String str = yKr.e; String str2 = yKr.b; Boolean bool = null; OffsetDateTime offsetDateTime = (OffsetDateTime) ZTC.e(new Object[]{yKr.d, null}, 267499366, -267499366, (int) System.currentTimeMillis()); iDf idf = yKr.c; C14957gcv.e(idf, ""); String str3 = idf.b; C16616pjp c16616pjp = idf.c; OBr oBr = c16616pjp != null ? new OBr(c16616pjp.d, c16616pjp.a) : null; String str4 = idf.a; String str5 = idf.d; if (str5 != null) { C14957gcv.e(str5, ""); bool = Boolean.valueOf(Integer.parseInt(str5) == 1); } return new Nnm(str, str2, offsetDateTime, new Ddv(str3, oBr, str4, bool, idf.e)); } { this.d = this; } }).doOnNext(new fSQ(this) { // from class: o.oab private cNS a; @Override // o.fSQ public final void c(Object obj) { Nnm nnm = (Nnm) obj; this.a.e.c = nnm.c != null ? nnm.c.d : null; } { this.a = this; } }); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk h() { return this.i.getStandAloneAddress().map(new fSS(this) { // from class: o.RdN private cNS d; @Override // o.fSS public final Object a(Object obj) { PHf pHf = this.d.a; return PHf.d((TNJ) ((SingleDataEntity) obj).getData()); } { this.d = this; } }); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk a(String str, String str2, String str3, C3636bC c3636bC) { return this.i.changeMerchantAccount(str, str2, str3, c3636bC).map(new fSS(this) { // from class: o.Ipx private cNS d; @Override // o.fSS public final Object a(Object obj) { UxE uxE = this.d.c; YUY yuy = (YUY) ((SingleDataEntity) obj).getData(); C14957gcv.e(yuy, ""); return new C16240mbx(ZTC.b(yuy.e, (OffsetDateTime) null)); } { this.d = this; } }); } @Override // o.InterfaceC16806rQZ public final AbstractC13163fSk j() { AbstractC13163fSk validateMerchant = this.i.getValidateMerchant(); PHf pHf = this.a; Objects.requireNonNull(pHf); return validateMerchant.map(new C11187eac(pHf)); } @Override // o.InterfaceC16806rQZ public final BOR i() { return this.f8612o.d; } }