导航菜单

页面标题

页面副标题

Bhakti v5.4.0 - EasyPayConfigDownloader.java 源代码

正在查看: Bhakti v5.4.0 应用的 EasyPayConfigDownloader.java JAVA 源代码文件

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


package easypay.appinvoke.utils;

import Xb.e;
import Z5.g;
import android.content.Intent;
import android.content.SharedPreferences;
import android.text.TextUtils;
import androidx.core.app.JobIntentService;
import com.google.firebase.perf.network.FirebasePerfUrlConnection;
import easypay.appinvoke.manager.Constants;
import easypay.appinvoke.manager.PaytmAssist;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import org.json.JSONObject;

public class EasyPayConfigDownloader extends JobIntentService {
    public static final int c = 0;
    public SharedPreferences a;
    public String b;

    public final boolean a(String str) {
        try {
            URL url = new URL(str);
            e.K(this, "url:" + url.toString());
            HttpURLConnection httpURLConnection = (HttpURLConnection) ((URLConnection) FirebasePerfUrlConnection.instrument(url.openConnection()));
            httpURLConnection.setReadTimeout(15000);
            httpURLConnection.setConnectTimeout(13000);
            httpURLConnection.setRequestMethod("POST");
            JSONObject jSONObject = new JSONObject(this.b);
            JSONObject jSONObject2 = new JSONObject();
            jSONObject2.put("bankName", jSONObject.getString(Constants.EXTRA_BANK_CODE));
            jSONObject2.put("payMode", jSONObject.getString(Constants.EXTRA_BANK_PAYTYPE));
            if (jSONObject.getString(Constants.EXTRA_BANK_PAYTYPE).equals(Constants.EASYPAY_PAYTYPE_NETBANKING)) {
                jSONObject2.put(Constants.EXTRA_BANK_SCHEME, (Object) null);
            } else {
                jSONObject2.put(Constants.EXTRA_BANK_SCHEME, jSONObject.getString(Constants.EXTRA_BANK_SCHEME));
            }
            jSONObject2.put(Constants.EXTRA_ORDER_ID, PaytmAssist.getAssistInstance().getOrderId());
            jSONObject2.put(Constants.EXTRA_MID, PaytmAssist.getAssistInstance().getMid());
            jSONObject2.put("deviceType", "ANDROID");
            e.K(this, "resquestBody:" + jSONObject2.toString());
            String i0 = g.i0(this, jSONObject.getString(Constants.EXTRA_BANK_CODE), jSONObject.getString(Constants.EXTRA_BANK_PAYTYPE), jSONObject.getString(Constants.EXTRA_BANK_SCHEME));
            if (i0 == null) {
                i0 = "";
            }
            httpURLConnection.setRequestProperty("If-None-Match", i0);
            httpURLConnection.setRequestProperty("Content-Type", "application/json");
            OutputStream outputStream = httpURLConnection.getOutputStream();
            outputStream.write(jSONObject2.toString().getBytes());
            outputStream.close();
            e.K(this, "EasyPay Config requestbody:" + jSONObject2.toString());
            String headerField = httpURLConnection.getHeaderField("ETag");
            InputStream inputStream = httpURLConnection.getInputStream();
            BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, 5120);
            StringBuilder sb2 = new StringBuilder();
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
            while (true) {
                String readLine = bufferedReader.readLine();
                if (readLine == null) {
                    bufferedInputStream.close();
                    e.K(this, "unique Assist Config response" + sb2.toString());
                    g.v0(this, sb2.toString(), headerField);
                    Intent intent = new Intent();
                    intent.setAction(Constants.EASYPAY_ACTION_FILE_DOWNLOADED);
                    sendBroadcast(intent);
                    return true;
                }
                sb2.append(readLine);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }

    public final void onHandleWork(Intent intent) {
        this.a = getSharedPreferences(Constants.EASYPAY_NEW_PREFERENCE_FILE, 0);
        getSharedPreferences(Constants.EASY_PAY_ETAG_PREF, 0);
        this.b = intent.getStringExtra(Constants.EXTRA_BANK_REQ_JSON);
        try {
            if (System.currentTimeMillis() - this.a.getLong("easypay_configuration_load_timestamp", 0L) > this.a.getLong("easypay_configuration_ttl", 0L)) {
                String configUrlToHit = PaytmAssist.getAssistInstance().getConfigUrlToHit();
                e.K(this, "EasyPay Config requestURL:" + configUrlToHit);
                if (TextUtils.isEmpty(configUrlToHit) || !a(configUrlToHit)) {
                    return;
                }
                SharedPreferences.Editor edit = this.a.edit();
                edit.putLong("easypay_configuration_load_timestamp", System.currentTimeMillis());
                edit.apply();
            }
        } catch (Exception e) {
            e.printStackTrace();
            e.K(e, "EXCEPTION");
        }
    }
}