导航菜单

页面标题

页面副标题

Clash Legends v0.0.1 - f.java 源代码

正在查看: Clash Legends v0.0.1 应用的 f.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.payu.checkoutpro.utils;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import com.payu.base.models.ApiResponse;
import com.payu.base.models.CardBinInfo;
import com.payu.base.models.CardOption;
import com.payu.base.models.CardScheme;
import com.payu.base.models.CardType;
import com.payu.base.models.EMIOption;
import com.payu.base.models.EmiType;
import com.payu.base.models.PayUOfferDetails;
import com.payu.base.models.PayUPaymentParams;
import com.payu.base.models.PaymentFlowState;
import com.payu.base.models.PaymentMode;
import com.payu.base.models.PaymentModel;
import com.payu.base.models.PaymentOption;
import com.payu.base.models.PaymentState;
import com.payu.base.models.PaymentType;
import com.payu.base.models.SavedCardOption;
import com.payu.base.models.UPIOption;
import com.payu.base.models.WalletOption;
import com.payu.checkoutpro.R;
import com.payu.checkoutpro.models.m;
import com.payu.india.Model.EligibleEmiBins;
import com.payu.india.Model.Emi;
import com.payu.india.Model.LookupDetails;
import com.payu.india.Model.McpConversionBean;
import com.payu.india.Model.PaymentDetails;
import com.payu.india.Model.PayuEmiAmountAccordingToInterest;
import com.payu.india.Model.PayuOffer;
import com.payu.india.Model.PayuResponse;
import com.payu.india.Model.PayuUserOffer;
import com.payu.india.Model.StoredCard;
import com.payu.india.Model.TaxSpecification;
import com.payu.india.Payu.PayuConstants;
import com.payu.paymentparamhelper.PaymentParams;
import com.payu.paymentparamhelper.PayuErrors;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.regex.Pattern;
import kotlin.collections.ArraysKt;
import kotlin.collections.CollectionsKt;
import kotlin.comparisons.ComparisonsKt;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.StringCompanionObject;
import kotlin.text.StringsKt;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public final class f {
    public static ArrayList<PaymentOption> a = null;
    public static ArrayList<PaymentMode> b = null;
    public static ArrayList<PaymentMode> c = null;
    public static ArrayList<PayUOfferDetails> d = null;
    public static LookupDetails e = null;
    public static boolean f = false;
    public static PayuResponse g = null;
    public static boolean h = false;
    public static boolean i = true;
    public static ArrayList<String> j;
    public static final f k = new f();

    public static final class a<T> implements Comparator<PaymentOption> {
        public static final a a = new a();

        @Override
        public final int compare(PaymentOption paymentOption, PaymentOption paymentOption2) {
            return StringsKt.compareTo(paymentOption.getBankName(), paymentOption2.getBankName(), true);
        }
    }

    public static final class b<T> implements Comparator<T> {
        public final Comparator a;

        public b(Comparator comparator) {
            this.a = comparator;
        }

        @Override
        public final int compare(T t, T t2) {
            return this.a.compare(((PaymentOption) t).getBankName(), ((PaymentOption) t2).getBankName());
        }
    }

    public static final class c<T> implements Comparator<T> {
        public final Comparator a;

        public c(Comparator comparator) {
            this.a = comparator;
        }

        @Override
        public final int compare(T t, T t2) {
            return this.a.compare(((PaymentOption) t).getBankName(), ((PaymentOption) t2).getBankName());
        }
    }

    public static final class d extends Lambda implements Function1<PaymentOption, Comparable<?>> {
        public static final d a = new d();

        public d() {
            super(1);
        }

        @Override
        public Comparable<?> invoke(PaymentOption paymentOption) {
            return paymentOption.getBankName();
        }
    }

    public static final class e extends Lambda implements Function1<PaymentOption, Comparable<?>> {
        public static final e a = new e();

        public e() {
            super(1);
        }

        @Override
        public Comparable<?> invoke(PaymentOption paymentOption) {
            return Integer.valueOf(((EMIOption) paymentOption).getMonths());
        }
    }

    public final void a(boolean z) {
        h = z;
    }

    public final CardScheme b(String str) {
        if (!StringsKt.equals(str, PayuConstants.MASTERCARD, true) && !StringsKt.equals(str, com.payu.paymentparamhelper.PayuConstants.MAST, true)) {
            if (StringsKt.equals(str, com.payu.paymentparamhelper.PayuConstants.MAES, true)) {
                return CardScheme.MAES;
            }
            if (StringsKt.equals(str, com.payu.paymentparamhelper.PayuConstants.SMAE, true)) {
                return CardScheme.SMAE;
            }
            if (StringsKt.equals(str, com.payu.paymentparamhelper.PayuConstants.VISA, true)) {
                return CardScheme.VISA;
            }
            if (StringsKt.equals(str, com.payu.paymentparamhelper.PayuConstants.AMEX, true)) {
                return CardScheme.AMEX;
            }
            if (StringsKt.equals(str, com.payu.paymentparamhelper.PayuConstants.MAES, true)) {
                return CardScheme.MAES;
            }
            if (StringsKt.equals(str, com.payu.paymentparamhelper.PayuConstants.JCB, true)) {
                return CardScheme.JCB;
            }
            if (StringsKt.equals(str, com.payu.paymentparamhelper.PayuConstants.RUPAY, true)) {
                return CardScheme.RUPAY;
            }
            if (StringsKt.equals(str, "RUPAYCC", true)) {
                return CardScheme.RUPAYCC;
            }
            if (!StringsKt.equals(str, com.payu.paymentparamhelper.PayuConstants.DINR, true) && !StringsKt.equals(str, "DINERS", true)) {
                return StringsKt.equals(str, PayuConstants.DISCOVER, true) ? CardScheme.DISCOVER : CardScheme.UNKNOWN;
            }
            return CardScheme.DINR;
        }
        return CardScheme.MAST;
    }

    public final CardType c(String str) {
        return StringsKt.equals(str, com.payu.paymentparamhelper.PayuConstants.CC, true) ? CardType.CC : CardType.DC;
    }

    public final String d(String str) {
        String str2 = "";
        if (str == null || str.length() == 0) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        if (StringsKt.contains$default((CharSequence) str, (CharSequence) ".", false, 2, (Object) null)) {
            String str3 = (String) StringsKt.split$default((CharSequence) str, new String[]{"."}, false, 0, 6, (Object) null).get(0);
            str2 = (String) StringsKt.split$default((CharSequence) str, new String[]{"."}, false, 0, 6, (Object) null).get(1);
            str = str3;
        }
        if (str == null) {
            throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
        }
        char[] charArray = str.toCharArray();
        int i2 = 0;
        int i3 = 0;
        for (int length = charArray.length - 1; length >= 0; length--) {
            if (i2 < 3) {
                sb.append(charArray[length]);
                i2++;
            } else if (i3 < 2) {
                if (i3 == 0) {
                    sb.append(",");
                    sb.append(charArray[length]);
                    i3++;
                } else {
                    sb.append(charArray[length]);
                    i3 = 0;
                }
            }
        }
        return (str2.length() == 0 ? sb.reverse() : new StringBuilder().append(sb.reverse().toString()).append('.').append(str2)).toString();
    }

    public final boolean e(String str, ArrayList<PaymentDetails> arrayList) {
        boolean z = false;
        if (!(str.length() == 0) && !arrayList.isEmpty()) {
            Iterator<PaymentDetails> it = arrayList.iterator();
            while (it.hasNext()) {
                if (StringsKt.equals(it.next().getBankCode(), str, true)) {
                    z = true;
                }
            }
        }
        return z;
    }

    public final boolean f(String str) {
        if (str != null) {
            return !(str.length() == 0);
        }
        return false;
    }

    public final boolean g(String str) {
        return (str == null || StringsKt.toDoubleOrNull(str) == null || Double.parseDouble(str) <= 0.0d) ? false : true;
    }

    public final boolean h(String str) {
        if (str == null) {
            return false;
        }
        if (!(str.length() > 0)) {
            return false;
        }
        try {
            URLEncoder.encode(str, "UTF-8");
            return true;
        } catch (UnsupportedEncodingException e2) {
            return false;
        }
    }

    public final ApiResponse i(String str) {
        ApiResponse apiResponse = new ApiResponse();
        if (str.length() == 0) {
            apiResponse.setStatus(Boolean.FALSE);
            apiResponse.setErrorMessage(PayUCheckoutProConstants.CP_VALIDATE_VPA_ERROR_MESSAGE);
        } else {
            try {
                JSONObject jSONObject = new JSONObject(str);
                if (!jSONObject.has("status") || !StringsKt.equals(jSONObject.getString("status"), "success", true)) {
                    apiResponse.setStatus(Boolean.FALSE);
                    apiResponse.setErrorMessage(PayUCheckoutProConstants.CP_VALIDATE_VPA_ERROR_MESSAGE);
                } else if (!jSONObject.has(PayUCheckoutProConstants.CP_IS_VPA_VALID)) {
                    apiResponse.setStatus(Boolean.FALSE);
                    apiResponse.setErrorMessage(PayUCheckoutProConstants.CP_VALIDATE_VPA_ERROR_MESSAGE);
                } else if (jSONObject.getInt(PayUCheckoutProConstants.CP_IS_VPA_VALID) == 1) {
                    apiResponse.setStatus(Boolean.TRUE);
                    if (!jSONObject.has(PayUCheckoutProConstants.CP_PAYER_ACCOUNT_NAME) || StringsKt.equals(jSONObject.getString(PayUCheckoutProConstants.CP_PAYER_ACCOUNT_NAME), "null", true)) {
                        apiResponse.setSuccessMessage("");
                    } else {
                        apiResponse.setSuccessMessage(jSONObject.optString(PayUCheckoutProConstants.CP_PAYER_ACCOUNT_NAME));
                    }
                } else {
                    apiResponse.setStatus(Boolean.FALSE);
                    apiResponse.setErrorMessage(PayUCheckoutProConstants.CP_VALIDATE_VPA_ERROR_MESSAGE);
                }
            } catch (JSONException e2) {
                apiResponse.setStatus(Boolean.FALSE);
                apiResponse.setErrorMessage(PayUCheckoutProConstants.CP_VALIDATE_VPA_ERROR_MESSAGE);
            }
        }
        return apiResponse;
    }

    public final PaymentParams a(PayUPaymentParams payUPaymentParams, Context context) throws RuntimeException {
        PaymentParams paymentParams = new PaymentParams();
        i = payUPaymentParams.getIsProduction();
        if (!f(payUPaymentParams.getKey())) {
            throw new RuntimeException(PayuErrors.MANDATORY_PARAM_KEY_IS_MISSING);
        }
        paymentParams.setKey(payUPaymentParams.getKey());
        if (!g(payUPaymentParams.getAmount())) {
            throw new RuntimeException(PayuErrors.INVALID_AMOUNT);
        }
        paymentParams.setAmount(payUPaymentParams.getAmount());
        if (!f(payUPaymentParams.getProductInfo())) {
            throw new RuntimeException(PayuErrors.MANDATORY_PARAM_PRODUCT_INFO_IS_MISSING);
        }
        paymentParams.setProductInfo(payUPaymentParams.getProductInfo());
        if (payUPaymentParams.getFirstName() == null) {
            throw new RuntimeException(PayuErrors.MANDATORY_PARAM_FIRST_NAME_IS_MISSING);
        }
        paymentParams.setFirstName(payUPaymentParams.getFirstName());
        if (payUPaymentParams.getEmail() == null) {
            throw new RuntimeException(PayuErrors.MANDATORY_PARAM_EMAIL_IS_MISSING);
        }
        paymentParams.setEmail(payUPaymentParams.getEmail());
        String surl = payUPaymentParams.getSurl();
        if (!f(surl)) {
            throw new RuntimeException(PayuErrors.MANDATORY_PARAM_SURL_IS_MISSING);
        }
        if (!h(surl)) {
            throw new RuntimeException("surl should be something like https://www.payu.in/txnstatus");
        }
        paymentParams.setSurl(surl);
        String furl = payUPaymentParams.getFurl();
        if (!f(furl)) {
            throw new RuntimeException(PayuErrors.MANDATORY_PARAM_FURL_IS_MISSING);
        }
        if (!h(furl)) {
            throw new RuntimeException("furl should be something like https://www.payu.in/txnstatus");
        }
        paymentParams.setFurl(furl);
        HashMap<String, Object> additionalParams = payUPaymentParams.getAdditionalParams();
        if (additionalParams == null || additionalParams.isEmpty()) {
            additionalParams = new HashMap<>();
        }
        paymentParams.setUdf1(a(additionalParams, "udf1"));
        paymentParams.setUdf2(a(additionalParams, "udf2"));
        paymentParams.setUdf3(a(additionalParams, "udf3"));
        paymentParams.setUdf4(a(additionalParams, "udf4"));
        paymentParams.setUdf5(a(additionalParams, "udf5"));
        payUPaymentParams.setAdditionalParams(additionalParams);
        if (payUPaymentParams.getPhone() != null) {
            if (!Pattern.compile("^\\d{10}$").matcher(payUPaymentParams.getPhone()).matches()) {
                throw new RuntimeException(context.getString(R.string.payu_invalid_phone_number));
            }
            paymentParams.setPhone(payUPaymentParams.getPhone());
        }
        if (!f(payUPaymentParams.getTransactionId())) {
            throw new RuntimeException(PayuErrors.MANDATORY_PARAM_TXNID_IS_MISSING);
        }
        paymentParams.setTxnId(payUPaymentParams.getTransactionId());
        paymentParams.setNotifyURL(paymentParams.getSurl());
        paymentParams.setUserCredentials(payUPaymentParams.getUserCredential());
        Object obj = additionalParams.get(PayUCheckoutProConstants.CP_ANALYTICS_DATA);
        if (!(obj instanceof String)) {
            obj = null;
        }
        String str = (String) obj;
        JSONArray jSONArray = new JSONArray();
        if (!(str == null || str.length() == 0)) {
            try {
                jSONArray.put(new JSONObject(str));
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
        }
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("name", PayUCheckoutProConstants.CP_NAME_VALUE);
        jSONObject.put("platform", "android");
        jSONObject.put("version", "1.7.0");
        jSONArray.put(jSONObject);
        paymentParams.setSdkPlatformData(jSONArray.toString());
        return paymentParams;
    }

    public final boolean f(String str, ArrayList<PayuOffer> arrayList) {
        if (arrayList.isEmpty()) {
            return false;
        }
        Iterator<PayuOffer> it = arrayList.iterator();
        while (it.hasNext()) {
            PayuOffer next = it.next();
            String status = next.getStatus();
            if (!(status == null || status.length() == 0) && !StringsKt.equals(next.getStatus(), "0", true)) {
                ArrayList<String> allowedOn = next.getAllowedOn();
                if (!(allowedOn == null || allowedOn.isEmpty()) && next.getAllowedOn().contains(str)) {
                    return true;
                }
            }
        }
        return false;
    }

    public final void c(PayuResponse payuResponse, PayuResponse payuResponse2, ArrayList arrayList) {
        if (payuResponse.isPhonePeIntentAvailable().booleanValue()) {
            String str = e(PayUCheckoutProConstants.CP_PHONEPE_CLASS_NAME) ? "PPINTENT" : PayUCheckoutProConstants.CP_PHONEPE_BANKCODE;
            arrayList.add(a(PayUCheckoutProConstants.CP_PHONEPE, PaymentType.L1_OPTION, PaymentType.WALLET, new WalletOption(), com.payu.paymentparamhelper.PayuConstants.CASH, str, b(str, payuResponse2.getCashCard()), Double.valueOf(a(PayUCheckoutProConstants.CP_PHONEPE, payuResponse2.getCashCard())), StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getCashTaxValue())));
        }
    }

    public final boolean e(String str) {
        if (str != null) {
            try {
                if (str.length() > 0) {
                    ClassLoader classLoader = f.class.getClassLoader();
                    if (classLoader != null) {
                        classLoader.loadClass(str);
                    }
                    return true;
                }
            } catch (Exception e2) {
                e2.printStackTrace();
            }
        }
        return false;
    }

    public final void b(PayuResponse payuResponse, PayuResponse payuResponse2, ArrayList<PaymentMode> arrayList) {
        if (payuResponse.isCashCardAvailable().booleanValue() && e(PayUCheckoutProConstants.CP_PAYTM, payuResponse.getCashCard())) {
            arrayList.add(a(PayUCheckoutProConstants.CP_PAYTM_NAME, PaymentType.L1_OPTION, PaymentType.WALLET, new WalletOption(), com.payu.paymentparamhelper.PayuConstants.CASH, PayUCheckoutProConstants.CP_PAYTM, b(PayUCheckoutProConstants.CP_PAYTM, payuResponse2.getCashCard()), Double.valueOf(a(PayUCheckoutProConstants.CP_PAYTM, payuResponse2.getCashCard())), StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getCashTaxValue())));
        }
    }

    public final PayuUserOffer d(String str, ArrayList<PayuUserOffer> arrayList) {
        ArrayList<PayuOffer> arrayList2;
        if (!(str.length() == 0) && !arrayList.isEmpty()) {
            Iterator<PayuUserOffer> it = arrayList.iterator();
            while (it.hasNext()) {
                PayuUserOffer next = it.next();
                if (StringsKt.equals(next.getStoredCard().getCardToken(), str, true)) {
                    ArrayList<PayuOffer> availableCardOffers = next.getAvailableCardOffers();
                    if (availableCardOffers == null || availableCardOffers.isEmpty()) {
                        arrayList2 = null;
                    } else {
                        arrayList2 = new ArrayList<>();
                        Iterator<PayuOffer> it2 = availableCardOffers.iterator();
                        while (it2.hasNext()) {
                            PayuOffer next2 = it2.next();
                            if (next2.getDiscount() != null) {
                                arrayList2.add(next2);
                            }
                        }
                    }
                    if (!(arrayList2 == null || arrayList2.isEmpty())) {
                        next.setAvailableCardOffers(arrayList2);
                        return next;
                    }
                }
            }
        }
        return null;
    }

    public final EligibleEmiBins c(String str, ArrayList<EligibleEmiBins> arrayList) {
        if (str == null || str.length() == 0) {
            return null;
        }
        Iterator<EligibleEmiBins> it = arrayList.iterator();
        while (it.hasNext()) {
            EligibleEmiBins next = it.next();
            if (StringsKt.equals(next.getBankShortName(), str, true)) {
                return next;
            }
        }
        return null;
    }

    public final void b(Context context, PayuResponse payuResponse, PayuResponse payuResponse2, ArrayList<PaymentMode> arrayList) {
        if (payuResponse.isCashCardAvailable().booleanValue()) {
            PaymentMode paymentMode = new PaymentMode();
            paymentMode.setName(PayUCheckoutProConstants.CP_WALLETS);
            paymentMode.setType(PaymentType.WALLET);
            ArrayList arrayList2 = new ArrayList();
            ArrayList arrayList3 = new ArrayList();
            arrayList3.add("PPINTENT");
            arrayList3.add(PayUCheckoutProConstants.CP_PPINAPP);
            arrayList3.add(PayUCheckoutProConstants.CP_PPSDKLES);
            Iterator<PaymentDetails> it = payuResponse.getCashCard().iterator();
            while (it.hasNext()) {
                PaymentDetails next = it.next();
                if (!arrayList3.contains(next.getBankCode())) {
                    arrayList2.add((WalletOption) a(new WalletOption(), PaymentType.WALLET, next.getBankName(), next.getBankCode(), com.payu.paymentparamhelper.PayuConstants.CASH, b(next.getBankCode(), payuResponse2.getCashCard()), Double.valueOf(a(next.getBankCode(), payuResponse2.getCashCard())), StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getCashTaxValue())));
                }
            }
            paymentMode.setOptionDetail(new ArrayList<>(CollectionsKt.sortedWith(arrayList2, new b(StringsKt.getCASE_INSENSITIVE_ORDER(StringCompanionObject.INSTANCE)))));
            paymentMode.setL1OptionSubText(a(context, paymentMode, payuResponse, false));
            arrayList.add(paymentMode);
        }
    }

    public final List<PaymentOption> b(ArrayList<PaymentOption> arrayList) {
        Random random = new Random();
        Object clone = arrayList.clone();
        if (clone != null) {
            ArrayList arrayList2 = (ArrayList) clone;
            ArrayList arrayList3 = new ArrayList();
            for (int i2 = 0; i2 < 3; i2++) {
                int nextInt = random.nextInt(arrayList2.size());
                arrayList3.add(arrayList2.get(nextInt));
                arrayList2.remove(nextInt);
            }
            return arrayList3;
        }
        throw new NullPointerException("null cannot be cast to non-null type kotlin.collections.ArrayList<com.payu.base.models.PaymentOption> /* = java.util.ArrayList<com.payu.base.models.PaymentOption> */");
    }

    public final void b(PayuResponse payuResponse, PayuResponse payuResponse2, Context context, ArrayList<PaymentMode> arrayList) {
        ArrayList<PaymentOption> arrayList2;
        if (payuResponse.isUpiAvailable().booleanValue() || payuResponse.isGenericIntentAvailable().booleanValue()) {
            PaymentMode paymentMode = new PaymentMode();
            paymentMode.setName(PayuConstants.UPISI);
            paymentMode.setType(PaymentType.UPI);
            ArrayList<PaymentOption> arrayList3 = new ArrayList<>();
            if (payuResponse.isUpiAvailable().booleanValue()) {
                arrayList3.add((UPIOption) a(new UPIOption(), PaymentType.UPI, "upi", "upi", "upi", false, StringsKt.toDoubleOrNull(payuResponse2.getUpi().getAdditionalCharge()), StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getUpiTaxValue())));
            }
            if (!payuResponse.isGenericIntentAvailable().booleanValue()) {
                arrayList2 = null;
            } else {
                arrayList2 = a(context);
                if (arrayList2 != null && arrayList2.size() > 0) {
                    UPIOption uPIOption = (UPIOption) a(new UPIOption(), PaymentType.UPI_INTENT, "upi", "INTENT", "upi", false, Double.valueOf(0.0d), Double.valueOf(0.0d));
                    ArrayList<PaymentOption> arrayList4 = new ArrayList<>();
                    Iterator<PaymentOption> it = arrayList2.iterator();
                    while (it.hasNext()) {
                        PaymentOption next = it.next();
                        if (next != null) {
                            arrayList4.add((UPIOption) a((UPIOption) next, PaymentType.UPI_INTENT, next.getBankName(), "INTENT", "upi", false, StringsKt.toDoubleOrNull(payuResponse2.getGenericIntent().getAdditionalCharge()), StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getUpiTaxValue())));
                        } else {
                            throw new NullPointerException("null cannot be cast to non-null type com.payu.base.models.UPIOption");
                        }
                    }
                    CollectionsKt.sortWith(arrayList4, a.a);
                    uPIOption.setOptionList(arrayList4);
                    arrayList3.add(uPIOption);
                }
            }
            paymentMode.setOptionDetail(arrayList3);
            boolean z = false;
            if (!payuResponse.isUpiAvailable().booleanValue() && payuResponse.isGenericIntentAvailable().booleanValue()) {
                if (arrayList2 == null || arrayList2.isEmpty()) {
                    paymentMode.setPaymentModeDown(true);
                    paymentMode.setL1OptionSubText(context.getString(R.string.payu_no_upi_apps_installed));
                    arrayList.add(paymentMode);
                }
            }
            if (payuResponse.isGenericIntentAvailable().booleanValue() && arrayList2 != null && arrayList2.size() != 0) {
                z = true;
            }
            paymentMode.setL1OptionSubText(a(context, paymentMode, payuResponse, z));
            arrayList.add(paymentMode);
        }
    }

    public final String a(HashMap<String, Object> hashMap, String str) {
        Object obj = hashMap.get(str);
        if (!(obj instanceof String)) {
            obj = null;
        }
        if (((String) obj) != null) {
            Object obj2 = hashMap.get(str);
            if (obj2 != null) {
                return (String) obj2;
            }
            throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
        }
        hashMap.put(str, "");
        return "";
    }

    public final ArrayList<PaymentMode> a(PayuResponse payuResponse, boolean z) {
        double d2;
        TaxSpecification taxSpecification;
        TaxSpecification taxSpecification2;
        ArrayList<PaymentMode> arrayList = new ArrayList<>();
        if (z && !payuResponse.isCreditCardAvailableFoSI().booleanValue() && !payuResponse.isDebitCardAvailableFoSI().booleanValue()) {
            return arrayList;
        }
        ArrayList<StoredCard> storedCards = payuResponse != null ? payuResponse.getStoredCards() : null;
        if (storedCards == null || storedCards.size() == 0) {
            return null;
        }
        Iterator<StoredCard> it = storedCards.iterator();
        while (it.hasNext()) {
            StoredCard next = it.next();
            PaymentMode paymentMode = new PaymentMode();
            paymentMode.setName(next.getIssuingBank());
            paymentMode.setType(PaymentType.CARD);
            ArrayList<PaymentOption> arrayList2 = new ArrayList<>();
            SavedCardOption savedCardOption = new SavedCardOption();
            savedCardOption.setPaymentType(PaymentType.CARD);
            savedCardOption.setCardToken(next.getCardToken());
            savedCardOption.setCardNumber(next.getMaskedCardNumber());
            savedCardOption.setBankName(next.getIssuingBank());
            savedCardOption.setNameOnCard(next.getNameOnCard());
            savedCardOption.setExpiryMonth(next.getExpiryMonth());
            savedCardOption.setExpiryYear(next.getExpiryYear());
            CardBinInfo cardBinInfo = new CardBinInfo();
            cardBinInfo.setCardType(c(next.getCardMode()));
            if (cardBinInfo.getCom.payu.india.Payu.PayuConstants.CARDTYPE java.lang.String() == CardType.DC) {
                cardBinInfo.setCardScheme(b(next.getCardType()));
            } else {
                cardBinInfo.setCardScheme(b(next.getCardBrand()));
            }
            boolean z2 = true;
            cardBinInfo.setDomestic(StringsKt.equals(next.getIsDomestic(), "Y", true));
            cardBinInfo.setBinNumber(next.getCardBin());
            savedCardOption.setCardBinInfo(cardBinInfo);
            if (!z) {
                arrayList2.add(savedCardOption);
                paymentMode.setOptionDetail(arrayList2);
                arrayList.add(paymentMode);
            } else if (z && payuResponse.isDebitCardAvailableFoSI().booleanValue() && cardBinInfo.getCom.payu.india.Payu.PayuConstants.CARDTYPE java.lang.String() == CardType.DC) {
                arrayList2.add(savedCardOption);
                paymentMode.setOptionDetail(arrayList2);
                arrayList.add(paymentMode);
            } else if (z && payuResponse.isCreditCardAvailableFoSI().booleanValue() && cardBinInfo.getCom.payu.india.Payu.PayuConstants.CARDTYPE java.lang.String() == CardType.CC) {
                arrayList2.add(savedCardOption);
                paymentMode.setOptionDetail(arrayList2);
                arrayList.add(paymentMode);
            }
            ArrayList<PaymentOption> optionDetail = paymentMode.getOptionDetail();
            if (optionDetail != null && !optionDetail.isEmpty()) {
                z2 = false;
            }
            if (!z2) {
                Iterator<PaymentOption> it2 = optionDetail.iterator();
                while (it2.hasNext()) {
                    PaymentOption next2 = it2.next();
                    if (next2.getPaymentType() == PaymentType.CARD) {
                        SavedCardOption savedCardOption2 = (SavedCardOption) (!(next2 instanceof SavedCardOption) ? null : next2);
                        if (savedCardOption2 != null) {
                            CardBinInfo cardBinInfo2 = savedCardOption2.getCardBinInfo();
                            if (cardBinInfo2 != null) {
                                cardBinInfo2.setAdditionalCharge(Double.valueOf(k.a(cardBinInfo2)));
                            }
                            if (cardBinInfo2 != null) {
                                if (cardBinInfo2.getCom.payu.india.Payu.PayuConstants.CARDTYPE java.lang.String() != null && g != null) {
                                    if (cardBinInfo2.getCom.payu.india.Payu.PayuConstants.CARDTYPE java.lang.String() == CardType.CC) {
                                        PayuResponse payuResponse2 = g;
                                        d2 = Double.parseDouble((payuResponse2 == null || (taxSpecification2 = payuResponse2.getTaxSpecification()) == null) ? null : taxSpecification2.getCcTaxValue());
                                    } else {
                                        PayuResponse payuResponse3 = g;
                                        d2 = Double.parseDouble((payuResponse3 == null || (taxSpecification = payuResponse3.getTaxSpecification()) == null) ? null : taxSpecification.getDcTaxValue());
                                    }
                                } else {
                                    d2 = 0.0d;
                                }
                                cardBinInfo2.setGst(Double.valueOf(d2));
                            }
                            savedCardOption.setBankDown(k.a(next2.getBankName()));
                        }
                    }
                }
                paymentMode.setBankDown(savedCardOption.getIsBankDown());
            }
        }
        b = arrayList;
        return arrayList;
    }

    public final void a(PayuResponse payuResponse, PayuResponse payuResponse2, ArrayList<PaymentMode> arrayList) {
        if (payuResponse.isLazyPayAvailable().booleanValue()) {
            PaymentType paymentType = PaymentType.L1_OPTION;
            PaymentType paymentType2 = PaymentType.EMI;
            EMIOption eMIOption = new EMIOption();
            eMIOption.setBankShortName(PayUCheckoutProConstants.CP_LAZYPAY);
            arrayList.add(a(PayUCheckoutProConstants.CP_LAZYPAY_NAME, paymentType, paymentType2, eMIOption, com.payu.paymentparamhelper.PayuConstants.EMI, PayUCheckoutProConstants.CP_LAZYPAY, false, Double.valueOf(a(PayUCheckoutProConstants.CP_LAZYPAY, payuResponse2.getLazyPay())), StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getLazypayTaxValue())));
        }
    }

    public final boolean b(PaymentType paymentType) {
        if (paymentType == null || com.payu.checkoutpro.utils.e.i[paymentType.ordinal()] != 1) {
            return false;
        }
        return f;
    }

    public final double b(CardBinInfo cardBinInfo) {
        TaxSpecification taxSpecification;
        TaxSpecification taxSpecification2;
        if (cardBinInfo.getCom.payu.india.Payu.PayuConstants.CARDTYPE java.lang.String() == null || g == null) {
            return 0.0d;
        }
        String str = null;
        if (cardBinInfo.getCom.payu.india.Payu.PayuConstants.CARDTYPE java.lang.String() == CardType.CC) {
            PayuResponse payuResponse = g;
            if (payuResponse != null && (taxSpecification2 = payuResponse.getTaxSpecification()) != null) {
                str = taxSpecification2.getCcTaxValue();
            }
            return Double.parseDouble(str);
        }
        PayuResponse payuResponse2 = g;
        if (payuResponse2 != null && (taxSpecification = payuResponse2.getTaxSpecification()) != null) {
            str = taxSpecification.getDcTaxValue();
        }
        return Double.parseDouble(str);
    }

    public final boolean b(String str, ArrayList<PaymentDetails> arrayList) {
        boolean z = false;
        if (!(arrayList == null || arrayList.isEmpty())) {
            if (!(str == null || str.length() == 0)) {
                Iterator<PaymentDetails> it = arrayList.iterator();
                while (it.hasNext()) {
                    PaymentDetails next = it.next();
                    if (StringsKt.equals(next.getBankCode(), str, true)) {
                        try {
                            z = next.isBankDown();
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                    }
                }
            }
        }
        return z;
    }

    public final void a(PayuResponse payuResponse, PayuResponse payuResponse2, Context context, ArrayList<PaymentMode> arrayList) {
        PaymentMode a2;
        if (payuResponse.isGoogleTezAvailable().booleanValue()) {
            if (e(PayUCheckoutProConstants.CP_GOOGLE_PAY_CLASS_NAME)) {
                a2 = a(PayUCheckoutProConstants.CP_GOOGLE_PAY, PaymentType.L1_OPTION, PaymentType.UPI, new UPIOption(), "upi", "TEZ", false, StringsKt.toDoubleOrNull(payuResponse2.getGoogleTez().getAdditionalCharge()), StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getUpiTaxValue()));
            } else {
                if (!payuResponse.isGenericIntentAvailable().booleanValue() || !a(context, PayUCheckoutProConstants.CP_GOOGLE_PAY_PACKAGE_NAME)) {
                    return;
                }
                UPIOption uPIOption = new UPIOption();
                uPIOption.setPackageName(PayUCheckoutProConstants.CP_GOOGLE_PAY_PACKAGE_NAME);
                HashMap hashMap = new HashMap();
                hashMap.put(PayUCheckoutProConstants.CP_IS_L1_OPTION, Boolean.TRUE);
                hashMap.put(PayUCheckoutProConstants.CP_UPI_APP_NAME, PayUCheckoutProConstants.CP_KEY_ASSET_GOOGLE_PAY);
                uPIOption.setOtherParams(hashMap);
                a2 = a(PayUCheckoutProConstants.CP_GOOGLE_PAY, PaymentType.L1_OPTION, PaymentType.UPI_INTENT, uPIOption, "upi", "INTENT", false, StringsKt.toDoubleOrNull(payuResponse2.getGoogleTez().getAdditionalCharge()), StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getUpiTaxValue()));
            }
            arrayList.add(a2);
        }
    }

    public final boolean a(Context context, String str) {
        ArrayList<PaymentOption> a2;
        if (context != null && (a2 = a(context)) != null && a2.size() != 0) {
            Iterator<PaymentOption> it = a2.iterator();
            while (it.hasNext()) {
                PaymentOption next = it.next();
                if (!(next instanceof UPIOption)) {
                    next = null;
                }
                UPIOption uPIOption = (UPIOption) next;
                if (StringsKt.equals(uPIOption != null ? uPIOption.getPackageName() : null, str, true)) {
                    return true;
                }
            }
        }
        return false;
    }

    public final void a(Context context, PayuResponse payuResponse, PayuResponse payuResponse2, ArrayList<PaymentMode> arrayList) {
        String str;
        if (payuResponse.isEmiAvailable().booleanValue()) {
            PaymentMode paymentMode = new PaymentMode();
            paymentMode.setName(com.payu.paymentparamhelper.PayuConstants.EMI);
            paymentMode.setType(PaymentType.EMI);
            ArrayList<PaymentOption> arrayList2 = new ArrayList<>();
            String[] a2 = com.payu.checkoutpro.utils.a.a.a();
            HashMap hashMap = new HashMap();
            hashMap.put("cc", PayUCheckoutProConstants.CP_CREDIT_CARD);
            hashMap.put("dc", PayUCheckoutProConstants.CP_DEBIT_CARD);
            if (payuResponse2.isCCEmiAvailable().booleanValue()) {
                CharSequence charSequence = (CharSequence) hashMap.get("cc");
                if (!(charSequence == null || charSequence.length() == 0)) {
                    ArrayList<PaymentOption> arrayList3 = new ArrayList<>();
                    EMIOption eMIOption = new EMIOption();
                    eMIOption.setBankShortName("cc");
                    eMIOption.setBankName((String) hashMap.get("cc"));
                    eMIOption.setEmiType(EmiType.CC);
                    eMIOption.setPaymentType(PaymentType.EMI);
                    Iterator<Emi> it = payuResponse2.getCcemi().iterator();
                    while (it.hasNext()) {
                        Emi next = it.next();
                        String bankName = next.getBankName();
                        if (!(bankName == null || bankName.length() == 0) && ArraysKt.contains(a2, next.getBankCode())) {
                            EMIOption eMIOption2 = new EMIOption();
                            String shortTitle = next.getShortTitle();
                            eMIOption2.setBankShortName((shortTitle.hashCode() == 191790114 && shortTitle.equals(PayUCheckoutProConstants.CP_INDUSIND)) ? PayUCheckoutProConstants.CP_INDUS : shortTitle.toUpperCase());
                            eMIOption2.setBankName(next.getBankTitle());
                            eMIOption2.setPaymentType(PaymentType.EMI);
                            eMIOption2.setAdditionalCharge(StringsKt.toDoubleOrNull(next.getAdditionalCharge()));
                            eMIOption2.setGst(StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getEmiTaxValue()));
                            eMIOption2.setOtherParams(a(com.payu.paymentparamhelper.PayuConstants.EMI, next.getBankCode()));
                            arrayList3.add(eMIOption2);
                        }
                    }
                    eMIOption.setOptionList(arrayList3);
                    arrayList2.add(eMIOption);
                }
            }
            if (payuResponse2.isDCEmiAvailable().booleanValue()) {
                CharSequence charSequence2 = (CharSequence) hashMap.get("dc");
                if (!(charSequence2 == null || charSequence2.length() == 0)) {
                    ArrayList<PaymentOption> arrayList4 = new ArrayList<>();
                    EMIOption eMIOption3 = new EMIOption();
                    eMIOption3.setBankShortName("dc");
                    eMIOption3.setBankName((String) hashMap.get("dc"));
                    eMIOption3.setEmiType(EmiType.DC);
                    eMIOption3.setPaymentType(PaymentType.EMI);
                    Iterator<Emi> it2 = payuResponse2.getDcemi().iterator();
                    while (it2.hasNext()) {
                        Emi next2 = it2.next();
                        String bankName2 = next2.getBankName();
                        if (!(bankName2 == null || bankName2.length() == 0) && ArraysKt.contains(a2, next2.getBankCode())) {
                            EMIOption eMIOption4 = new EMIOption();
                            String shortTitle2 = next2.getShortTitle();
                            int hashCode = shortTitle2.hashCode();
                            if (hashCode == 2055105) {
                                if (shortTitle2.equals(PayUCheckoutProConstants.CP_AXIS)) {
                                    str = PayUCheckoutProConstants.CP_AXISD;
                                    eMIOption4.setBankShortName(str);
                                    eMIOption4.setBankName(next2.getBankTitle());
                                    eMIOption4.setPaymentType(PaymentType.EMI);
                                    eMIOption4.setAdditionalCharge(StringsKt.toDoubleOrNull(next2.getAdditionalCharge()));
                                    eMIOption4.setGst(StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getEmiTaxValue()));
                                    eMIOption4.setOtherParams(a(com.payu.paymentparamhelper.PayuConstants.EMI, next2.getBankCode()));
                                    arrayList4.add(eMIOption4);
                                }
                                str = shortTitle2.toUpperCase();
                                eMIOption4.setBankShortName(str);
                                eMIOption4.setBankName(next2.getBankTitle());
                                eMIOption4.setPaymentType(PaymentType.EMI);
                                eMIOption4.setAdditionalCharge(StringsKt.toDoubleOrNull(next2.getAdditionalCharge()));
                                eMIOption4.setGst(StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getEmiTaxValue()));
                                eMIOption4.setOtherParams(a(com.payu.paymentparamhelper.PayuConstants.EMI, next2.getBankCode()));
                                arrayList4.add(eMIOption4);
                            } else if (hashCode != 2244313) {
                                if (hashCode == 70470421 && shortTitle2.equals(PayUCheckoutProConstants.CP_ICICI)) {
                                    str = PayUCheckoutProConstants.CP_ICICID;
                                    eMIOption4.setBankShortName(str);
                                    eMIOption4.setBankName(next2.getBankTitle());
                                    eMIOption4.setPaymentType(PaymentType.EMI);
                                    eMIOption4.setAdditionalCharge(StringsKt.toDoubleOrNull(next2.getAdditionalCharge()));
                                    eMIOption4.setGst(StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getEmiTaxValue()));
                                    eMIOption4.setOtherParams(a(com.payu.paymentparamhelper.PayuConstants.EMI, next2.getBankCode()));
                                    arrayList4.add(eMIOption4);
                                }
                                str = shortTitle2.toUpperCase();
                                eMIOption4.setBankShortName(str);
                                eMIOption4.setBankName(next2.getBankTitle());
                                eMIOption4.setPaymentType(PaymentType.EMI);
                                eMIOption4.setAdditionalCharge(StringsKt.toDoubleOrNull(next2.getAdditionalCharge()));
                                eMIOption4.setGst(StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getEmiTaxValue()));
                                eMIOption4.setOtherParams(a(com.payu.paymentparamhelper.PayuConstants.EMI, next2.getBankCode()));
                                arrayList4.add(eMIOption4);
                            } else {
                                if (shortTitle2.equals(PayUCheckoutProConstants.CP_HDFC)) {
                                    str = PayUCheckoutProConstants.CP_HDFCD;
                                    eMIOption4.setBankShortName(str);
                                    eMIOption4.setBankName(next2.getBankTitle());
                                    eMIOption4.setPaymentType(PaymentType.EMI);
                                    eMIOption4.setAdditionalCharge(StringsKt.toDoubleOrNull(next2.getAdditionalCharge()));
                                    eMIOption4.setGst(StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getEmiTaxValue()));
                                    eMIOption4.setOtherParams(a(com.payu.paymentparamhelper.PayuConstants.EMI, next2.getBankCode()));
                                    arrayList4.add(eMIOption4);
                                }
                                str = shortTitle2.toUpperCase();
                                eMIOption4.setBankShortName(str);
                                eMIOption4.setBankName(next2.getBankTitle());
                                eMIOption4.setPaymentType(PaymentType.EMI);
                                eMIOption4.setAdditionalCharge(StringsKt.toDoubleOrNull(next2.getAdditionalCharge()));
                                eMIOption4.setGst(StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getEmiTaxValue()));
                                eMIOption4.setOtherParams(a(com.payu.paymentparamhelper.PayuConstants.EMI, next2.getBankCode()));
                                arrayList4.add(eMIOption4);
                            }
                        }
                    }
                    eMIOption3.setOptionList(arrayList4);
                    arrayList2.add(eMIOption3);
                }
            }
            if (payuResponse2.isCardLessEmiAvailable().booleanValue()) {
                CharSequence charSequence3 = (CharSequence) hashMap.get(PayUCheckoutProConstants.CP_OTHER);
                if (!(charSequence3 == null || charSequence3.length() == 0)) {
                    ArrayList<PaymentOption> arrayList5 = new ArrayList<>();
                    EMIOption eMIOption5 = new EMIOption();
                    eMIOption5.setBankShortName(PayUCheckoutProConstants.CP_OTHER);
                    eMIOption5.setBankName((String) hashMap.get(PayUCheckoutProConstants.CP_OTHER));
                    eMIOption5.setEmiType(EmiType.CardLess);
                    eMIOption5.setPaymentType(PaymentType.EMI);
                    Iterator<Emi> it3 = payuResponse2.getCardlessemi().iterator();
                    while (it3.hasNext()) {
                        Emi next3 = it3.next();
                        String bankName3 = next3.getBankName();
                        if (!(bankName3 == null || bankName3.length() == 0) && ArraysKt.contains(a2, next3.getBankCode())) {
                            EMIOption eMIOption6 = new EMIOption();
                            String shortTitle3 = next3.getShortTitle();
                            if (shortTitle3 != null) {
                                eMIOption6.setBankShortName(shortTitle3.toUpperCase());
                                eMIOption6.setBankName(next3.getBankTitle());
                                eMIOption6.setPaymentType(PaymentType.EMI);
                                eMIOption6.setAdditionalCharge(StringsKt.toDoubleOrNull(next3.getAdditionalCharge()));
                                eMIOption6.setGst(StringsKt.toDoubleOrNull(payuResponse2.getTaxSpecification().getEmiTaxValue()));
                                eMIOption6.setOtherParams(a(com.payu.paymentparamhelper.PayuConstants.EMI, next3.getBankCode()));
                                arrayList5.add(eMIOption6);
                            } else {
                                throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
                            }
                        }
                    }
                    eMIOption5.setOptionList(arrayList5);
                    arrayList2.add(eMIOption5);
                }
            }
            a = arrayList2;
            paymentMode.setOptionDetail(arrayList2);
            paymentMode.setL1OptionSubText(context != null ? context.getString(R.string.pay_in_easy_installments_with_cc) : null);
            arrayList.add(paymentMode);
        }
    }

    public final String a(Context context, PaymentMode paymentMode, PayuResponse payuResponse, boolean z) {
        String sb;
        PaymentOption paymentOption;
        PaymentOption paymentOption2;
        PaymentOption paymentOption3;
        PaymentOption paymentOption4;
        String valueOf;
        String sb2;
        PaymentOption paymentOption5;
        ArrayList<PaymentOption> optionList;
        PaymentOption paymentOption6;
        PaymentOption paymentOption7;
        ArrayList<PaymentOption> optionList2;
        PaymentOption paymentOption8;
        PaymentOption paymentOption9;
        ArrayList<PaymentOption> optionList3;
        PaymentOption paymentOption10;
        ArrayList<PaymentOption> optionList4;
        PaymentOption paymentOption11;
        PaymentOption paymentOption12;
        ArrayList<PaymentOption> optionList5;
        PaymentOption paymentOption13;
        ArrayList<PaymentOption> optionList6;
        PaymentOption paymentOption14;
        ArrayList<PaymentOption> optionList7;
        PaymentOption paymentOption15;
        PaymentOption paymentOption16;
        ArrayList<PaymentOption> optionList8;
        PaymentOption paymentOption17;
        PaymentOption paymentOption18;
        ArrayList<PaymentOption> optionList9;
        PaymentOption paymentOption19;
        PaymentOption paymentOption20;
        ArrayList<PaymentOption> optionList10;
        String sb3;
        PaymentOption paymentOption21;
        ArrayList<PaymentOption> optionList11;
        PaymentOption paymentOption22;
        PaymentOption paymentOption23;
        ArrayList<PaymentOption> optionList12;
        PaymentOption paymentOption24;
        PaymentOption paymentOption25;
        ArrayList<PaymentOption> optionList13;
        PaymentOption paymentOption26;
        ArrayList<PaymentOption> optionList14;
        PaymentOption paymentOption27;
        PaymentOption paymentOption28;
        ArrayList<PaymentOption> optionList15;
        PaymentOption paymentOption29;
        ArrayList<PaymentOption> optionList16;
        PaymentOption paymentOption30;
        PaymentOption paymentOption31;
        ArrayList<PaymentOption> optionList17;
        PaymentType type = paymentMode.getType();
        String str = "";
        if (type != null) {
            int i2 = 0;
            switch (com.payu.checkoutpro.utils.e.b[type.ordinal()]) {
                case 1:
                    ArrayList<PaymentOption> optionDetail = paymentMode.getOptionDetail();
                    if ((optionDetail != null ? Integer.valueOf(optionDetail.size()) : null).intValue() > 3) {
                        ArrayList arrayList = (ArrayList) b(paymentMode.getOptionDetail());
                        return ((PaymentOption) arrayList.get(0)).getBankName() + ", " + ((PaymentOption) arrayList.get(1)).getBankName() + ", " + ((PaymentOption) arrayList.get(2)).getBankName() + (context != null ? context.getString(R.string.and_more) : null);
                    }
                    ArrayList<PaymentOption> optionDetail2 = paymentMode.getOptionDetail();
                    int intValue = (optionDetail2 != null ? Integer.valueOf(optionDetail2.size()) : null).intValue();
                    while (i2 < intValue) {
                        ArrayList<PaymentOption> optionDetail3 = paymentMode.getOptionDetail();
                        if (i2 == (optionDetail3 != null ? Integer.valueOf(optionDetail3.size()) : null).intValue() - 1) {
                            ArrayList<PaymentOption> optionDetail4 = paymentMode.getOptionDetail();
                            if (optionDetail4 != null && optionDetail4.size() == 1) {
                                ArrayList<PaymentOption> optionDetail5 = paymentMode.getOptionDetail();
                                str = (optionDetail5 == null || (paymentOption4 = optionDetail5.get(i2)) == null) ? null : paymentOption4.getBankName();
                            } else {
                                StringBuilder append = new StringBuilder().append(str).append(context != null ? context.getString(R.string.and) : null);
                                ArrayList<PaymentOption> optionDetail6 = paymentMode.getOptionDetail();
                                str = append.append((optionDetail6 == null || (paymentOption3 = optionDetail6.get(i2)) == null) ? null : paymentOption3.getBankName()).toString();
                            }
                        } else {
                            StringBuilder append2 = new StringBuilder().append(str);
                            ArrayList<PaymentOption> optionDetail7 = paymentMode.getOptionDetail();
                            if (i2 == (optionDetail7 != null ? Integer.valueOf(optionDetail7.size()) : null).intValue() - 2) {
                                ArrayList<PaymentOption> optionDetail8 = paymentMode.getOptionDetail();
                                sb = (optionDetail8 == null || (paymentOption2 = optionDetail8.get(i2)) == null) ? null : paymentOption2.getBankName();
                            } else {
                                StringBuilder append3 = new StringBuilder().append(str);
                                ArrayList<PaymentOption> optionDetail9 = paymentMode.getOptionDetail();
                                sb = append3.append((optionDetail9 == null || (paymentOption = optionDetail9.get(i2)) == null) ? null : paymentOption.getBankName()).append(", ").toString();
                            }
                            str = append2.append(sb).toString();
                        }
                        i2++;
                    }
                    break;
                    break;
                case 2:
                    Iterator<PaymentOption> it = paymentMode.getOptionDetail().iterator();
                    while (it.hasNext()) {
                        if (!it.next().getIsBankDown()) {
                            i2++;
                        }
                    }
                    if (i2 > 10) {
                        valueOf = new StringBuilder().append(i2 - (i2 % 10)).append('+').toString();
                    } else {
                        valueOf = String.valueOf(i2);
                    }
                    return (context != null ? context.getString(R.string.pay_using_any_of) : null) + " " + valueOf + (context != null ? context.getString(R.string.banks_supported) : null);
                case 3:
                    if (Intrinsics.areEqual(paymentMode.getName(), PayUCheckoutProConstants.CP_PHONEPE)) {
                        if (context != null) {
                            return context.getString(R.string.pay_directly_from_your_phonepe_account);
                        }
                        return null;
                    }
                    if (Intrinsics.areEqual(paymentMode.getName(), PayUCheckoutProConstants.CP_PAYTM_NAME)) {
                        if (context != null) {
                            return context.getString(R.string.pay_using_paytm_wallet_or_upi);
                        }
                        return null;
                    }
                    if (Intrinsics.areEqual(paymentMode.getName(), PayUCheckoutProConstants.CP_GOOGLE_PAY)) {
                        if (context != null) {
                            return context.getString(R.string.pay_directly_from_google_pay);
                        }
                        return null;
                    }
                    if (Intrinsics.areEqual(paymentMode.getName(), PayUCheckoutProConstants.CP_LAZYPAY_NAME)) {
                        if (context != null) {
                            return context.getString(R.string.pay_directly_from_lazy_pay);
                        }
                        return null;
                    }
                    break;
                case 4:
                    if (payuResponse.isDebitCardAvailable().booleanValue() && payuResponse.isCreditCardAvailable().booleanValue()) {
                        if (context != null) {
                            return context.getString(R.string.pay_using_debit_card_or_credit_card);
                        }
                        return null;
                    }
                    if (payuResponse.isDebitCardAvailable().booleanValue()) {
                        if (context != null) {
                            return context.getString(R.string.pay_using_debit_card);
                        }
                        return null;
                    }
                    if (payuResponse.isCreditCardAvailable().booleanValue()) {
                        if (context != null) {
                            return context.getString(R.string.pay_using_credit_card);
                        }
                        return null;
                    }
                    break;
                case 5:
                    if (z && payuResponse.isUpiAvailable().booleanValue()) {
                        ArrayList<PaymentOption> optionDetail10 = paymentMode.getOptionDetail();
                        if (((optionDetail10 == null || (paymentOption31 = optionDetail10.get(1)) == null || (optionList17 = paymentOption31.getOptionList()) == null) ? null : Integer.valueOf(optionList17.size())).intValue() > 3) {
                            ArrayList<PaymentOption> optionDetail11 = paymentMode.getOptionDetail();
                            ArrayList arrayList2 = (ArrayList) b((optionDetail11 == null || (paymentOption30 = optionDetail11.get(1)) == null) ? null : paymentOption30.getOptionList());
                            return ((PaymentOption) arrayList2.get(0)).getBankName() + ", " + ((PaymentOption) arrayList2.get(1)).getBankName() + ", " + ((PaymentOption) arrayList2.get(2)).getBankName() + (context != null ? context.getString(R.string.or_any_other_upi_app) : null);
                        }
                        ArrayList<PaymentOption> optionDetail12 = paymentMode.getOptionDetail();
                        int intValue2 = ((optionDetail12 == null || (paymentOption29 = optionDetail12.get(1)) == null || (optionList16 = paymentOption29.getOptionList()) == null) ? null : Integer.valueOf(optionList16.size())).intValue();
                        while (i2 < intValue2) {
                            ArrayList<PaymentOption> optionDetail13 = paymentMode.getOptionDetail();
                            if (i2 == ((optionDetail13 == null || (paymentOption28 = optionDetail13.get(1)) == null || (optionList15 = paymentOption28.getOptionList()) == null) ? null : Integer.valueOf(optionList15.size())).intValue() - 1) {
                                ArrayList<PaymentOption> optionDetail14 = paymentMode.getOptionDetail();
                                if (optionDetail14 != null && (paymentOption25 = optionDetail14.get(1)) != null && (optionList13 = paymentOption25.getOptionList()) != null && optionList13.size() == 1) {
                                    ArrayList<PaymentOption> optionDetail15 = paymentMode.getOptionDetail();
                                    sb3 = Intrinsics.stringPlus((optionDetail15 == null || (paymentOption26 = optionDetail15.get(1)) == null || (optionList14 = paymentOption26.getOptionList()) == null || (paymentOption27 = optionList14.get(i2)) == null) ? null : paymentOption27.getBankName(), context != null ? context.getString(R.string.upi_app) : null);
                                } else {
                                    StringBuilder append4 = new StringBuilder().append(str).append(context != null ? context.getString(R.string.or) : null);
                                    ArrayList<PaymentOption> optionDetail16 = paymentMode.getOptionDetail();
                                    sb3 = append4.append((optionDetail16 == null || (paymentOption23 = optionDetail16.get(1)) == null || (optionList12 = paymentOption23.getOptionList()) == null || (paymentOption24 = optionList12.get(i2)) == null) ? null : paymentOption24.getBankName()).append(context != null ? context.getString(R.string.upi_app) : null).toString();
                                }
                            } else {
                                StringBuilder append5 = new StringBuilder().append(str);
                                ArrayList<PaymentOption> optionDetail17 = paymentMode.getOptionDetail();
                                sb3 = append5.append((optionDetail17 == null || (paymentOption21 = optionDetail17.get(1)) == null || (optionList11 = paymentOption21.getOptionList()) == null || (paymentOption22 = optionList11.get(i2)) == null) ? null : paymentOption22.getBankName()).append(", ").toString();
                            }
                            str = sb3;
                            i2++;
                        }
                        return str;
                    }
                    if (z && !payuResponse.isUpiAvailable().booleanValue()) {
                        ArrayList<PaymentOption> optionDetail18 = paymentMode.getOptionDetail();
                        if (((optionDetail18 == null || (paymentOption20 = optionDetail18.get(0)) == null || (optionList10 = paymentOption20.getOptionList()) == null) ? null : Integer.valueOf(optionList10.size())).intValue() > 3) {
                            StringBuilder sb4 = new StringBuilder();
                            ArrayList<PaymentOption> optionDetail19 = paymentMode.getOptionDetail();
                            StringBuilder append6 = sb4.append((optionDetail19 == null || (paymentOption18 = optionDetail19.get(0)) == null || (optionList9 = paymentOption18.getOptionList()) == null || (paymentOption19 = optionList9.get(0)) == null) ? null : paymentOption19.getBankName()).append(", ");
                            ArrayList<PaymentOption> optionDetail20 = paymentMode.getOptionDetail();
                            StringBuilder append7 = append6.append((optionDetail20 == null || (paymentOption16 = optionDetail20.get(0)) == null || (optionList8 = paymentOption16.getOptionList()) == null || (paymentOption17 = optionList8.get(1)) == null) ? null : paymentOption17.getBankName()).append(", ");
                            ArrayList<PaymentOption> optionDetail21 = paymentMode.getOptionDetail();
                            return append7.append((optionDetail21 == null || (paymentOption14 = optionDetail21.get(0)) == null || (optionList7 = paymentOption14.getOptionList()) == null || (paymentOption15 = optionList7.get(2)) == null) ? null : paymentOption15.getBankName()).append(context != null ? context.getString(R.string.or_any_other_upi_app) : null).toString();
                        }
                        ArrayList<PaymentOption> optionDetail22 = paymentMode.getOptionDetail();
                        int intValue3 = ((optionDetail22 == null || (paymentOption13 = optionDetail22.get(1)) == null || (optionList6 = paymentOption13.getOptionList()) == null) ? null : Integer.valueOf(optionList6.size())).intValue();
                        while (i2 < intValue3) {
                            ArrayList<PaymentOption> optionDetail23 = paymentMode.getOptionDetail();
                            if (i2 == ((optionDetail23 == null || (paymentOption12 = optionDetail23.get(1)) == null || (optionList5 = paymentOption12.getOptionList()) == null) ? null : Integer.valueOf(optionList5.size())).intValue() - 1) {
                                ArrayList<PaymentOption> optionDetail24 = paymentMode.getOptionDetail();
                                if (optionDetail24 != null && (paymentOption9 = optionDetail24.get(1)) != null && (optionList3 = paymentOption9.getOptionList()) != null && optionList3.size() == 1) {
                                    ArrayList<PaymentOption> optionDetail25 = paymentMode.getOptionDetail();
                                    sb2 = Intrinsics.stringPlus((optionDetail25 == null || (paymentOption10 = optionDetail25.get(1)) == null || (optionList4 = paymentOption10.getOptionList()) == null || (paymentOption11 = optionList4.get(i2)) == null) ? null : paymentOption11.getBankName(), context != null ? context.getString(R.string.upi_app) : null);
                                } else {
                                    StringBuilder append8 = new StringBuilder().append(str).append(context != null ? context.getString(R.string.or) : null);
                                    ArrayList<PaymentOption> optionDetail26 = paymentMode.getOptionDetail();
                                    sb2 = append8.append((optionDetail26 == null || (paymentOption7 = optionDetail26.get(1)) == null || (optionList2 = paymentOption7.getOptionList()) == null || (paymentOption8 = optionList2.get(i2)) == null) ? null : paymentOption8.getBankName()).append(context != null ? context.getString(R.string.upi_app) : null).toString();
                                }
                            } else {
                                StringBuilder append9 = new StringBuilder().append(str);
                                ArrayList<PaymentOption> optionDetail27 = paymentMode.getOptionDetail();
                                sb2 = append9.append((optionDetail27 == null || (paymentOption5 = optionDetail27.get(1)) == null || (optionList = paymentOption5.getOptionList()) == null || (paymentOption6 = optionList.get(i2)) == null) ? null : paymentOption6.getBankName()).append(", ").toString();
                            }
                            str = sb2;
                            i2++;
                        }
                        return str;
                    }
                    if (!z && payuResponse.isUpiAvailable().booleanValue()) {
                        if (context != null) {
                            return context.getString(R.string.payu_using_your_upi_id_or_vpa);
                        }
                        return null;
                    }
                    break;
            }
        }
        return str;
    }

    public final void a(Context context, String str, PaymentType paymentType, PayuResponse payuResponse, ArrayList<PaymentMode> arrayList, PayuResponse payuResponse2) {
        int i2 = com.payu.checkoutpro.utils.e.c[paymentType.ordinal()];
        if (i2 != 1) {
            if (i2 == 2 && StringsKt.equals(str, PayUCheckoutProConstants.CP_GOOGLE_PAY, true)) {
                a(payuResponse, payuResponse2, context, arrayList);
                return;
            }
            return;
        }
        int hashCode = str.hashCode();
        if (hashCode != 75906305) {
            if (hashCode == 1069169635 && str.equals(PayUCheckoutProConstants.CP_PHONEPE)) {
                c(payuResponse, payuResponse2, arrayList);
                return;
            }
            return;
        }
        if (str.equals(PayUCheckoutProConstants.CP_PAYTM)) {
            b(payuResponse, payuResponse2, arrayList);
        }
    }

    public final PaymentMode a(String str, PaymentType paymentType, String str2, ArrayList<PaymentDetails> arrayList, PayuResponse payuResponse) {
        Double d2;
        boolean z;
        Double d3;
        String bankCode;
        ArrayList<PaymentDetails> netBanks;
        PaymentMode paymentMode = new PaymentMode();
        paymentMode.setName(str);
        paymentMode.setType(paymentType);
        ArrayList arrayList2 = new ArrayList();
        Iterator<PaymentDetails> it = arrayList.iterator();
        while (it.hasNext()) {
            PaymentDetails next = it.next();
            Double valueOf = Double.valueOf(0.0d);
            Double valueOf2 = Double.valueOf(0.0d);
            if (paymentType != PaymentType.NB) {
                d2 = valueOf2;
                z = false;
                d3 = valueOf;
            } else {
                boolean b2 = b(next.getBankCode(), payuResponse.getNetBanks());
                if (h) {
                    bankCode = next.getBankCode();
                    netBanks = payuResponse.getSiBankList();
                } else {
                    bankCode = next.getBankCode();
                    netBanks = payuResponse.getNetBanks();
                }
                z = b2;
                d3 = Double.valueOf(a(bankCode, netBanks));
                d2 = StringsKt.toDoubleOrNull(h ? payuResponse.getTaxSpecification().getEnachTaxValue() : payuResponse.getTaxSpecification().getNbTaxValue());
            }
            arrayList2.add((PaymentOption) a(new PaymentOption(), paymentType, next.getBankName(), next.getBankCode(), str2, z, d3, d2));
        }
        paymentMode.setOptionDetail(new ArrayList<>(CollectionsKt.sortedWith(arrayList2, new c(StringsKt.getCASE_INSENSITIVE_ORDER(StringCompanionObject.INSTANCE)))));
        return paymentMode;
    }

    public final <T> T a(T t, PaymentType paymentType, String str, String str2, String str3, boolean z, Double d2, Double d3) {
        if (t != 0) {
            PaymentOption paymentOption = (PaymentOption) t;
            paymentOption.setPaymentType(paymentType);
            HashMap hashMap = new HashMap();
            hashMap.put("OLAM", PayUCheckoutProConstants.CP_OLAMONEY);
            hashMap.put(PayUCheckoutProConstants.CP_PHONEPE_BANKCODE, PayUCheckoutProConstants.CP_PHONEPE);
            hashMap.put(PayUCheckoutProConstants.CP_PAYZAPP_BANKCODE, PayUCheckoutProConstants.CP_PAYZAPP);
            if ((str2.length() > 0) && hashMap.containsKey(str2)) {
                str = (String) hashMap.get(str2);
            }
            paymentOption.setBankName(str);
            paymentOption.setBankDown(z);
            paymentOption.setAdditionalCharge(d2);
            paymentOption.setGst(d3);
            paymentOption.setOtherParams(a(str3, str2));
            return t;
        }
        throw new NullPointerException("null cannot be cast to non-null type com.payu.base.models.PaymentOption");
    }

    public final HashMap<String, Object> a(String str, String str2) {
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("pg", str);
        hashMap.put(PayUCheckoutProConstants.CP_BANK_CODE, str2);
        return hashMap;
    }

    public final PaymentMode a(String str, PaymentType paymentType, PaymentType paymentType2, PaymentOption paymentOption, String str2, String str3, boolean z, Double d2, Double d3) {
        PaymentMode paymentMode = new PaymentMode();
        paymentMode.setName(str);
        paymentMode.setType(paymentType);
        paymentMode.setPaymentId(str3);
        ArrayList<PaymentOption> arrayList = new ArrayList<>();
        paymentOption.setBankName(str);
        paymentOption.setPaymentType(paymentType2);
        paymentOption.setBankDown(z);
        paymentOption.setAdditionalCharge(d2);
        paymentOption.setGst(d3);
        if (paymentOption.getOtherParams() != null) {
            Object otherParams = paymentOption.getOtherParams();
            if (!(otherParams instanceof HashMap)) {
                otherParams = null;
            }
            HashMap hashMap = (HashMap) otherParams;
            hashMap.put("pg", str2);
            hashMap.put(PayUCheckoutProConstants.CP_BANK_CODE, str3);
        } else {
            paymentOption.setOtherParams(a(str2, str3));
        }
        arrayList.add(paymentOption);
        paymentMode.setOptionDetail(arrayList);
        return paymentMode;
    }

    public final CardOption a(PaymentDetails paymentDetails, CardType cardType, String str) {
        CardOption cardOption = new CardOption();
        PaymentType paymentType = PaymentType.CARD;
        String bankName = paymentDetails.getBankName();
        String bankCode = paymentDetails.getBankCode();
        Double valueOf = Double.valueOf(0.0d);
        CardOption cardOption2 = (CardOption) a(cardOption, paymentType, bankName, bankCode, str, false, valueOf, valueOf);
        CardBinInfo cardBinInfo = new CardBinInfo();
        cardBinInfo.setCardType(cardType);
        cardOption2.setCardBinInfo(cardBinInfo);
        return cardOption2;
    }

    public final void a(com.payu.base.models.PayUPaymentParams r19, com.payu.base.listeners.BaseTransactionListener r20, com.payu.checkoutpro.models.a r21) {
        throw new UnsupportedOperationException("Method not decompiled: com.payu.checkoutpro.utils.f.a(com.payu.base.models.PayUPaymentParams, com.payu.base.listeners.BaseTransactionListener, com.payu.checkoutpro.models.a):void");
    }

    public final PaymentFlowState a(PaymentModel paymentModel) {
        LookupDetails lookupDetails;
        PaymentOption paymentOption = paymentModel.getPaymentOption();
        ArrayList<PaymentOption> arrayList = null;
        Object otherParams = paymentOption != null ? paymentOption.getOtherParams() : null;
        if (!(otherParams instanceof HashMap)) {
            otherParams = null;
        }
        String str = (String) a(PayUCheckoutProConstants.CP_BANK_CODE, (HashMap<String, Object>) otherParams);
        boolean z = true;
        if (str != null && StringsKt.equals(str, "OLAM", true) && e(m.OLAMONEY.getClassName())) {
            PaymentFlowState paymentFlowState = paymentModel.getPaymentFlowState();
            PaymentState paymentState = paymentFlowState != null ? paymentFlowState.getPaymentState() : null;
            if (paymentState != null && com.payu.checkoutpro.utils.e.e[paymentState.ordinal()] == 1) {
                return null;
            }
            PaymentFlowState paymentFlowState2 = new PaymentFlowState();
            paymentFlowState2.setPaymentState(PaymentState.PHONE);
            return paymentFlowState2;
        }
        if (str != null && StringsKt.equals(str, "upi", true) && e(m.UPI.getClassName())) {
            PaymentFlowState paymentFlowState3 = paymentModel.getPaymentFlowState();
            PaymentState paymentState2 = paymentFlowState3 != null ? paymentFlowState3.getPaymentState() : null;
            if (paymentState2 != null && com.payu.checkoutpro.utils.e.f[paymentState2.ordinal()] == 1) {
                return null;
            }
            PaymentFlowState paymentFlowState4 = new PaymentFlowState();
            paymentFlowState4.setPaymentState(PaymentState.VPA);
            return paymentFlowState4;
        }
        if (str != null && StringsKt.endsWith$default(str, "ENCC", false, 2, (Object) null)) {
            PaymentFlowState paymentFlowState5 = paymentModel.getPaymentFlowState();
            PaymentState paymentState3 = paymentFlowState5 != null ? paymentFlowState5.getPaymentState() : null;
            if (paymentState3 != null && com.payu.checkoutpro.utils.e.g[paymentState3.ordinal()] == 1) {
                return null;
            }
            PaymentFlowState paymentFlowState6 = new PaymentFlowState();
            paymentFlowState6.setPaymentState(PaymentState.NBFORM);
            return paymentFlowState6;
        }
        boolean z2 = paymentOption instanceof CardOption;
        if (((CardOption) (!z2 ? null : paymentOption)) == null || (lookupDetails = e) == null) {
            return null;
        }
        if (!a(lookupDetails != null ? lookupDetails.getSupportedCardSchemes() : null, paymentOption.getCardBinInfo())) {
            return null;
        }
        LookupDetails lookupDetails2 = e;
        ArrayList<McpConversionBean> mcpConversionBeans = lookupDetails2 != null ? lookupDetails2.getMcpConversionBeans() : null;
        if (mcpConversionBeans == null || mcpConversionBeans.isEmpty()) {
            return null;
        }
        PaymentFlowState paymentFlowState7 = paymentModel.getPaymentFlowState();
        PaymentState paymentState4 = paymentFlowState7 != null ? paymentFlowState7.getPaymentState() : null;
        if (paymentState4 != null && com.payu.checkoutpro.utils.e.h[paymentState4.ordinal()] == 1) {
            return null;
        }
        LookupDetails lookupDetails3 = e;
        ArrayList<McpConversionBean> mcpConversionBeans2 = lookupDetails3 != null ? lookupDetails3.getMcpConversionBeans() : null;
        if (mcpConversionBeans2 != null && !mcpConversionBeans2.isEmpty()) {
            z = false;
        }
        if (!z) {
            arrayList = new ArrayList<>();
            Iterator<McpConversionBean> it = mcpConversionBeans2.iterator();
            while (it.hasNext()) {
                McpConversionBean next = it.next();
                if (paymentOption instanceof SavedCardOption) {
                    SavedCardOption savedCardOption = (SavedCardOption) a(new SavedCardOption(), (CardOption) paymentOption, next.getLookupId(), next.getOfferAmount(), next.getOfferCurrency());
                    savedCardOption.setCardToken(((SavedCardOption) paymentOption).getCardToken());
                    arrayList.add(savedCardOption);
                } else if (z2) {
                    arrayList.add(a(new CardOption(), (CardOption) paymentOption, next.getLookupId(), next.getOfferAmount(), next.getOfferCurrency()));
                }
            }
        }
        paymentModel.setPaymentOptionList(arrayList);
        PaymentFlowState paymentFlowState8 = new PaymentFlowState();
        paymentFlowState8.setPaymentState(PaymentState.MCP);
        return paymentFlowState8;
    }

    public final CardOption a(CardOption cardOption, CardOption cardOption2, String str, String str2, String str3) {
        cardOption.setPaymentType(cardOption2.getPaymentType());
        cardOption.setCardBinInfo(cardOption2.getCardBinInfo());
        cardOption.setCardNumber(cardOption2.getCardNumber());
        if (cardOption2.getCom.payu.india.Payu.PayuConstants.ADDITIONAL_CHARGE java.lang.String() != null) {
            cardOption.setAdditionalCharge(cardOption2.getCom.payu.india.Payu.PayuConstants.ADDITIONAL_CHARGE java.lang.String());
        } else {
            CardBinInfo cardBinInfo = cardOption2.getCardBinInfo();
            cardOption.setAdditionalCharge(cardBinInfo != null ? cardBinInfo.getCom.payu.india.Payu.PayuConstants.ADDITIONAL_CHARGE java.lang.String() : null);
        }
        cardOption.setNameOnCard(cardOption2.getNameOnCard());
        cardOption.setCvv(cardOption2.getCvv());
        cardOption.setExpiryMonth(cardOption2.getExpiryMonth());
        cardOption.setExpiryYear(cardOption2.getExpiryYear());
        cardOption.setShouldSaveCard(cardOption2.getShouldSaveCard());
        cardOption.setCardAlias(cardOption2.getCardAlias());
        cardOption.setLookupId(str);
        cardOption.setConvertedAmount(str2);
        cardOption.setConvertedCurrency(str3);
        return cardOption;
    }

    public final boolean a(ArrayList<String> arrayList, CardBinInfo cardBinInfo) {
        if (!(arrayList == null || arrayList.isEmpty()) && cardBinInfo != null) {
            Iterator<String> it = arrayList.iterator();
            while (it.hasNext()) {
                String next = it.next();
                if (!cardBinInfo.getCom.payu.india.Payu.PayuConstants.IS_DOMESTIC java.lang.String()) {
                    CardScheme cardScheme = cardBinInfo.getCardScheme();
                    if (StringsKt.equals(next, cardScheme != null ? cardScheme.name() : null, true)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    public final <T> T a(String str, HashMap<String, Object> hashMap) {
        if (hashMap == null || !hashMap.containsKey(str)) {
            return null;
        }
        Object obj = hashMap.get(str);
        if (!(obj instanceof Object)) {
            obj = null;
        }
        if (obj != null) {
            return (T) hashMap.get(str);
        }
        return null;
    }

    public final ArrayList<PaymentOption> a(Context context) {
        PackageInfo packageInfo;
        CharSequence applicationLabel;
        if (context == null) {
            return null;
        }
        ArrayList<PaymentOption> arrayList = new ArrayList<>();
        Intent intent = new Intent();
        intent.setData(Uri.parse(PayUCheckoutProConstants.CP_UPI_INTENT_PREFIX));
        Iterator<ResolveInfo> it = context.getPackageManager().queryIntentActivities(intent, 65536).iterator();
        while (it.hasNext()) {
            try {
                packageInfo = context.getPackageManager().getPackageInfo(it.next().activityInfo.packageName, 0);
                context.getPackageManager().getApplicationIcon(packageInfo.applicationInfo);
                applicationLabel = context.getPackageManager().getApplicationLabel(packageInfo.applicationInfo);
            } catch (PackageManager.NameNotFoundException e2) {
                e2.printStackTrace();
            }
            if (applicationLabel != null) {
                UPIOption uPIOption = new UPIOption();
                uPIOption.setBankName((String) applicationLabel);
                uPIOption.setPackageName(packageInfo.packageName);
                arrayList.add(uPIOption);
            } else {
                throw new NullPointerException("null cannot be cast to non-null type kotlin.String");
            }
        }
        return arrayList;
    }

    public final ArrayList<PaymentOption> a(PayuResponse payuResponse) {
        Set<String> keySet;
        Set<String> keySet2;
        if (a == null || payuResponse == null || !payuResponse.isPayuEmiAmountAccordingToInterestAvailable().booleanValue()) {
            return null;
        }
        HashMap<String, HashMap<String, PayuEmiAmountAccordingToInterest>> payuEmiAmountAccordingToInterest = payuResponse.getPayuEmiAmountAccordingToInterest();
        Iterator<String> it = (payuEmiAmountAccordingToInterest == null || (keySet2 = payuEmiAmountAccordingToInterest.keySet()) == null) ? null : keySet2.iterator();
        if (it == null) {
            return null;
        }
        while (it.hasNext()) {
            HashMap<String, PayuEmiAmountAccordingToInterest> hashMap = payuEmiAmountAccordingToInterest.get(it.next());
            Iterator<String> it2 = (hashMap == null || (keySet = hashMap.keySet()) == null) ? null : keySet.iterator();
            if (it2 == null) {
                return null;
            }
            while (it2.hasNext()) {
                String next = it2.next();
                if (ArraysKt.contains(com.payu.checkoutpro.utils.a.a.a(), next) && hashMap.get(next) != null) {
                    a(a, next, hashMap.get(next));
                }
            }
        }
        return a;
    }

    public final void a(ArrayList<PaymentOption> arrayList, String str, PayuEmiAmountAccordingToInterest payuEmiAmountAccordingToInterest) {
        int i2;
        Iterator<PaymentOption> it = arrayList.iterator();
        Object obj = null;
        EMIOption eMIOption = null;
        int i3 = -1;
        int i4 = -1;
        while (it.hasNext()) {
            PaymentOption next = it.next();
            Iterator<PaymentOption> it2 = next.getOptionList().iterator();
            while (it2.hasNext()) {
                PaymentOption next2 = it2.next();
                Object otherParams = next2.getOtherParams();
                if (!(otherParams instanceof HashMap)) {
                    otherParams = obj;
                }
                if (StringsKt.equals$default((String) a(PayUCheckoutProConstants.CP_BANK_CODE, (HashMap<String, Object>) otherParams), str, false, 2, obj)) {
                    EMIOption eMIOption2 = (EMIOption) (!(next2 instanceof EMIOption) ? obj : next2);
                    if (eMIOption2 != null) {
                        int indexOf = arrayList.indexOf(next);
                        ArrayList<PaymentOption> optionList = arrayList.get(indexOf).getOptionList();
                        i4 = (optionList != null ? Integer.valueOf(optionList.indexOf(next2)) : obj).intValue();
                        if (payuEmiAmountAccordingToInterest.getEmiValue() == null) {
                            i2 = indexOf;
                        } else if (StringsKt.toDoubleOrNull(payuEmiAmountAccordingToInterest.getEmiValue()) == null || payuEmiAmountAccordingToInterest.getEmiBankInterest() == null) {
                            i2 = indexOf;
                        } else if (StringsKt.toDoubleOrNull(payuEmiAmountAccordingToInterest.getEmiBankInterest()) == null || payuEmiAmountAccordingToInterest.getTenure() == null) {
                            i2 = indexOf;
                        } else {
                            String replace = StringsKt.replace(payuEmiAmountAccordingToInterest.getTenure(), "months", "", true);
                            if (replace != null) {
                                if (StringsKt.toIntOrNull(StringsKt.trim((CharSequence) replace).toString()) == null) {
                                    i2 = indexOf;
                                } else {
                                    eMIOption2.setEmiValue(Double.parseDouble(payuEmiAmountAccordingToInterest.getEmiValue()));
                                    eMIOption2.setInterestRate(Double.parseDouble(payuEmiAmountAccordingToInterest.getEmiBankInterest()));
                                    eMIOption2.setInterestCharged(Double.parseDouble(payuEmiAmountAccordingToInterest.getEmiInterestPaid()));
                                    String replace2 = StringsKt.replace(payuEmiAmountAccordingToInterest.getTenure(), "months", "", true);
                                    if (replace2 == null) {
                                        throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
                                    }
                                    eMIOption2.setMonths(Integer.parseInt(StringsKt.trim((CharSequence) replace2).toString()));
                                    eMIOption = eMIOption2;
                                    i3 = indexOf;
                                }
                            } else {
                                throw new NullPointerException("null cannot be cast to non-null type kotlin.CharSequence");
                            }
                        }
                        i3 = i2;
                    } else {
                        continue;
                    }
                }
                obj = null;
            }
            CollectionsKt.sortWith(next.getOptionList(), ComparisonsKt.compareBy(d.a, e.a));
            obj = null;
        }
        if (i3 != -1) {
            if (eMIOption == null) {
                ArrayList<PaymentOption> optionList2 = arrayList.get(i3).getOptionList();
                if (optionList2 != null) {
                    optionList2.remove(i4);
                    return;
                }
                return;
            }
            arrayList.get(i3).getOptionList().set(i4, eMIOption);
        }
    }

    public final ArrayList<String> a(PaymentType paymentType, ArrayList<PayUOfferDetails> arrayList) {
        if (paymentType == null) {
            return null;
        }
        if (arrayList == null || arrayList.isEmpty()) {
            return null;
        }
        ArrayList<String> arrayList2 = new ArrayList<>();
        Iterator<PayUOfferDetails> it = arrayList.iterator();
        while (it.hasNext()) {
            PayUOfferDetails next = it.next();
            if (next.getOfferPaymentTypes() != null && next.getOfferPaymentTypes().contains(paymentType)) {
                arrayList2.add(next.getOfferKey());
            }
        }
        return arrayList2;
    }

    public final boolean a(PaymentType paymentType) {
        boolean z = false;
        if (paymentType != null) {
            ArrayList<PayUOfferDetails> arrayList = d;
            if (!(arrayList == null || arrayList.isEmpty())) {
                Iterator<PayUOfferDetails> it = d.iterator();
                while (it.hasNext()) {
                    PayUOfferDetails next = it.next();
                    if (next.getOfferPaymentTypes() != null && next.getOfferPaymentTypes().contains(paymentType)) {
                        z = true;
                    }
                }
            }
        }
        return z;
    }

    public final java.lang.String a(java.lang.String r3, com.payu.india.Model.PayuOffer r4) {
        throw new UnsupportedOperationException("Method not decompiled: com.payu.checkoutpro.utils.f.a(java.lang.String, com.payu.india.Model.PayuOffer):java.lang.String");
    }

    public final PayuOffer a(ArrayList<PayuOffer> arrayList) {
        Iterator<PayuOffer> it = arrayList.iterator();
        PayuOffer payuOffer = null;
        while (it.hasNext()) {
            PayuOffer next = it.next();
            String discount = next.getDiscount();
            if (!(discount == null || discount.length() == 0) && StringsKt.toDoubleOrNull(next.getDiscount()) != null && Double.parseDouble(next.getDiscount()) != 0.0d && (payuOffer == null || Double.parseDouble(next.getDiscount()) > Double.parseDouble(payuOffer.getDiscount()))) {
                payuOffer = next;
            }
        }
        return payuOffer;
    }

    public final PayuOffer a(ArrayList<PayuOffer> arrayList, String str) {
        Iterator<PayuOffer> it = arrayList.iterator();
        PayuOffer payuOffer = null;
        while (it.hasNext()) {
            PayuOffer next = it.next();
            String discount = next.getDiscount();
            if (!(discount == null || discount.length() == 0) && StringsKt.toDoubleOrNull(next.getDiscount()) != null && Double.parseDouble(next.getDiscount()) != 0.0d) {
                ArrayList<String> allowedOn = next.getAllowedOn();
                if (!(allowedOn == null || allowedOn.isEmpty()) && next.getAllowedOn().contains(str) && (payuOffer == null || Double.parseDouble(next.getDiscount()) > Double.parseDouble(payuOffer.getDiscount()))) {
                    payuOffer = next;
                }
            }
        }
        return payuOffer;
    }

    public final PaymentMode a(ArrayList<PaymentMode> arrayList, PaymentType paymentType) {
        PaymentMode paymentMode = null;
        if (!(arrayList == null || arrayList.isEmpty()) && paymentType != null) {
            Iterator<PaymentMode> it = arrayList.iterator();
            while (it.hasNext()) {
                PaymentMode next = it.next();
                if (next.getType() == paymentType) {
                    paymentMode = next;
                }
            }
        }
        return paymentMode;
    }

    public final boolean a(String str) {
        boolean z = false;
        if (!(str.length() == 0)) {
            ArrayList<String> arrayList = j;
            if (!(arrayList == null || arrayList.isEmpty())) {
                Iterator<String> it = j.iterator();
                while (it.hasNext()) {
                    if (str.equals(it.next())) {
                        z = true;
                    }
                }
            }
        }
        return z;
    }

    public final double a(com.payu.base.models.CardBinInfo r7) {
        throw new UnsupportedOperationException("Method not decompiled: com.payu.checkoutpro.utils.f.a(com.payu.base.models.CardBinInfo):double");
    }

    public final double a(String str, ArrayList<PaymentDetails> arrayList) {
        double d2 = 0.0d;
        if (!(arrayList == null || arrayList.isEmpty())) {
            if (!(str == null || str.length() == 0)) {
                Iterator<PaymentDetails> it = arrayList.iterator();
                while (it.hasNext()) {
                    PaymentDetails next = it.next();
                    if (StringsKt.equals(next.getBankCode(), str, true)) {
                        try {
                            d2 = Double.parseDouble(String.format("%.2f", Arrays.copyOf(new Object[]{Double.valueOf(Double.parseDouble(next.getAdditionalCharge()))}, 1)));
                        } catch (Exception e2) {
                            e2.printStackTrace();
                        }
                    }
                }
            }
        }
        return d2;
    }

    public final String a(Context context, PaymentMode paymentMode, PayuResponse payuResponse) {
        String valueOf;
        PaymentType type = paymentMode.getType();
        if (type == null) {
            return "";
        }
        int i2 = com.payu.checkoutpro.utils.e.l[type.ordinal()];
        if (i2 == 1) {
            Iterator<PaymentOption> it = paymentMode.getOptionDetail().iterator();
            int i3 = 0;
            while (it.hasNext()) {
                if (!it.next().getIsBankDown()) {
                    i3++;
                }
            }
            if (i3 > 10) {
                valueOf = new StringBuilder().append(i3 - (i3 % 10)).append('+').toString();
            } else {
                valueOf = String.valueOf(i3);
            }
            return (context != null ? context.getString(R.string.pay_using_any_of) : null) + " " + valueOf + (context != null ? context.getString(R.string.banks_supported) : null);
        }
        if (i2 != 2) {
            if (i2 != 3 || !payuResponse.isUPIAvailableFoSI().booleanValue()) {
                return "";
            }
            if (context != null) {
                return context.getString(R.string.payu_using_your_upi_id_or_vpa);
            }
            return null;
        }
        if (payuResponse.isDebitCardAvailableFoSI().booleanValue() && payuResponse.isCreditCardAvailableFoSI().booleanValue()) {
            if (context != null) {
                return context.getString(R.string.pay_using_debit_card_or_credit_card);
            }
            return null;
        }
        if (payuResponse.isDebitCardAvailableFoSI().booleanValue()) {
            if (context != null) {
                return context.getString(R.string.pay_using_debit_card);
            }
            return null;
        }
        if (!payuResponse.isCreditCardAvailableFoSI().booleanValue()) {
            return "";
        }
        if (context != null) {
            return context.getString(R.string.pay_using_credit_card);
        }
        return null;
    }
}