导航菜单

页面标题

页面副标题

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

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

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


package com.payu.india.Tasks;

import android.os.AsyncTask;
import com.payu.india.Interfaces.EligibleBinsForEMIApiListener;
import com.payu.india.Model.EligibleEmiBins;
import com.payu.india.Model.PayuConfig;
import com.payu.india.Model.PayuResponse;
import com.payu.india.Model.PostData;
import com.payu.india.Payu.PayuConstants;
import com.payu.india.Payu.PayuErrors;
import com.payu.india.Payu.PayuUtils;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import javax.net.ssl.HttpsURLConnection;
import kotlinx.coroutines.internal.LockFreeTaskQueueCore;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class EligibleBinsForEMITask extends AsyncTask<PayuConfig, String, PayuResponse> {
    EligibleBinsForEMIApiListener apiListener;

    public EligibleBinsForEMITask(EligibleBinsForEMIApiListener apiListener) {
        this.apiListener = apiListener;
    }

    @Override
    public PayuResponse doInBackground(PayuConfig... params) {
        URL url;
        String str;
        String str2;
        String str3 = PayuConstants.MSG;
        String str4 = PayuConstants.CARD_BINS;
        PayuResponse payuResponse = new PayuResponse();
        PostData postData = new PostData();
        try {
            PayuConfig payuConfig = params[0];
            switch (payuConfig.getEnvironment()) {
                case 0:
                    url = new URL("https://info.payu.in/merchant/postservice.php?form=2");
                    break;
                case 1:
                    url = new URL("https://mobiletest.payu.in/merchant/postservice?form=2");
                    break;
                case 2:
                    url = new URL(PayuConstants.TEST_FETCH_DATA_URL);
                    break;
                case 3:
                    url = new URL(PayuConstants.MOBILE_DEV_FETCH_DATA_URL);
                    break;
                default:
                    url = new URL("https://info.payu.in/merchant/postservice.php?form=2");
                    break;
            }
            HttpsURLConnection conn = PayuUtils.getHttpsConn(url.toString(), payuConfig.getData());
            if (conn != null) {
                InputStream responseInputStream = conn.getInputStream();
                StringBuffer responseStringBuffer = new StringBuffer();
                byte[] byteContainer = new byte[LockFreeTaskQueueCore.MIN_ADD_SPIN_CAPACITY];
                while (true) {
                    int i = responseInputStream.read(byteContainer);
                    if (i != -1) {
                        responseStringBuffer.append(new String(byteContainer, 0, i));
                    } else {
                        JSONObject jsonResponse = new JSONObject(responseStringBuffer.toString());
                        if (jsonResponse.has(PayuConstants.MSG)) {
                            postData.setResult(jsonResponse.getString(PayuConstants.MSG));
                        }
                        if (jsonResponse.has("status") && jsonResponse.getInt("status") == 0) {
                            postData.setCode(PayuErrors.INVALID_HASH);
                            postData.setStatus("ERROR");
                        } else {
                            postData.setCode(0);
                            postData.setStatus("SUCCESS");
                        }
                        if (jsonResponse.has(PayuConstants.DETAILS) && jsonResponse.get(PayuConstants.DETAILS) != null) {
                            JSONObject detailsObject = jsonResponse.getJSONObject(PayuConstants.DETAILS);
                            Iterator<String> keys = detailsObject.keys();
                            ArrayList<EligibleEmiBins> eligibleEmiBinsList = new ArrayList<>();
                            while (true) {
                                if (keys.hasNext()) {
                                    EligibleEmiBins eligibleEmiBins = new EligibleEmiBins();
                                    String bankShortName = keys.next();
                                    Iterator<String> keys2 = keys;
                                    if (detailsObject.optJSONObject(bankShortName) != null) {
                                        JSONObject bankObject = detailsObject.optJSONObject(bankShortName);
                                        eligibleEmiBins.setBankShortName(bankShortName);
                                        JSONObject detailsObject2 = detailsObject;
                                        eligibleEmiBins.setMinAmount(Integer.valueOf(bankObject.optInt(PayuConstants.MIN_AMOUNT)));
                                        eligibleEmiBins.setIsEligible(1);
                                        ArrayList<String> cardBinsList = new ArrayList<>();
                                        if (!bankObject.has(str4) || bankObject.optJSONArray(str4) == null || bankObject.optJSONArray(str4).length() <= 0) {
                                            str = str3;
                                            str2 = str4;
                                        } else {
                                            JSONArray cardBinsArray = bankObject.getJSONArray(str4);
                                            int i2 = 0;
                                            while (true) {
                                                str = str3;
                                                if (i2 < cardBinsArray.length()) {
                                                    JSONArray cardBinsArray2 = cardBinsArray;
                                                    cardBinsList.add(cardBinsArray2.getString(i2));
                                                    i2++;
                                                    str4 = str4;
                                                    cardBinsArray = cardBinsArray2;
                                                    str3 = str;
                                                } else {
                                                    str2 = str4;
                                                }
                                            }
                                        }
                                        eligibleEmiBins.setCardBins(cardBinsList);
                                        eligibleEmiBinsList.add(eligibleEmiBins);
                                        detailsObject = detailsObject2;
                                        keys = keys2;
                                        str3 = str;
                                        str4 = str2;
                                    } else {
                                        eligibleEmiBins.setIsEligible(Integer.valueOf(detailsObject.optInt(PayuConstants.IS_ELIGIBLE)));
                                        eligibleEmiBins.setBankShortName(detailsObject.optString("bank"));
                                        eligibleEmiBins.setMinAmount(Integer.valueOf(detailsObject.optInt(PayuConstants.MIN_AMOUNT)));
                                        if (detailsObject.has(str3)) {
                                            eligibleEmiBins.setIsEligible(0);
                                        }
                                        eligibleEmiBinsList.add(eligibleEmiBins);
                                    }
                                }
                            }
                            payuResponse.setEligibleEmiBins(eligibleEmiBinsList);
                        }
                    }
                }
            }
        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (ProtocolException e2) {
            e2.printStackTrace();
        } catch (IOException e3) {
            e3.printStackTrace();
        } catch (JSONException e4) {
            e4.printStackTrace();
        }
        payuResponse.setResponseStatus(postData);
        return payuResponse;
    }

    @Override
    public void onPostExecute(PayuResponse payuResponse) {
        super.onPostExecute((EligibleBinsForEMITask) payuResponse);
        this.apiListener.onEligibleBinsForEMIApiResponse(payuResponse);
    }
}