正在查看: Hopscotch v9.7.2 应用的 ValueAddedServiceTask.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Hopscotch v9.7.2 应用的 ValueAddedServiceTask.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.payu.india.Tasks;
import android.os.AsyncTask;
import android.util.Log;
import com.google.android.gms.ads.internal.client.z0;
import com.payu.india.Interfaces.ValueAddedServiceApiListener;
import com.payu.india.Model.CardStatus;
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.HashMap;
import java.util.Iterator;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class ValueAddedServiceTask extends AsyncTask<PayuConfig, String, PayuResponse> {
private ValueAddedServiceApiListener mValueAddedServiceApiListener;
public ValueAddedServiceTask(ValueAddedServiceApiListener valueAddedServiceApiListener) {
this.mValueAddedServiceApiListener = valueAddedServiceApiListener;
}
@Override
public PayuResponse doInBackground(PayuConfig... payuConfigArr) {
PayuResponse payuResponse = new PayuResponse();
PostData postData = new PostData();
try {
PayuConfig payuConfig = payuConfigArr[0];
int environment = payuConfig.getEnvironment();
URL url = environment != 0 ? environment != 1 ? environment != 2 ? environment != 3 ? environment != 4 ? new URL("https://info.payu.in/merchant/postservice.php?form=2") : new URL(PayuConstants.BIZ_CHECKOUT_TEST_FETCH_DATA_URL) : new URL(PayuConstants.MOBILE_DEV_FETCH_DATA_URL) : new URL("https://test.payu.in/merchant/postservice?form=2") : new URL("https://test.payu.in/merchant/postservice?form=2") : new URL("https://info.payu.in/merchant/postservice.php?form=2");
payuConfig.getData().getBytes("UTF-8");
HttpsURLConnection httpsConn = PayuUtils.getHttpsConn(url.toString(), payuConfig.getData());
if (httpsConn != null) {
InputStream inputStream = httpsConn.getInputStream();
StringBuffer stringBuffer = new StringBuffer();
byte[] bArr = new byte[1024];
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
break;
}
stringBuffer.append(new String(bArr, 0, read));
}
JSONObject jSONObject = new JSONObject(stringBuffer.toString());
payuResponse.setRawResponse(jSONObject);
postData.setResult("ERROR");
postData.setCode(PayuErrors.INVALID_HASH);
if (jSONObject.has(PayuConstants.MSG)) {
postData.setResult(jSONObject.getString(PayuConstants.MSG));
}
if (jSONObject.has("netBankingStatus")) {
HashMap<String, Integer> hashMap = new HashMap<>();
JSONObject jSONObject2 = jSONObject.getJSONObject("netBankingStatus");
Iterator<String> keys = jSONObject2.keys();
while (keys.hasNext()) {
String next = keys.next();
hashMap.put(next, Integer.valueOf(jSONObject2.getJSONObject(next).getInt("up_status")));
}
payuResponse.setNetBankingDownStatus(hashMap);
postData.setResult("SUCCESS");
postData.setCode(0);
postData.setStatus("SUCCESS");
}
if (jSONObject.has("issuingBankDownBins")) {
HashMap<String, CardStatus> hashMap2 = new HashMap<>();
JSONArray jSONArray = jSONObject.getJSONArray("issuingBankDownBins");
int length = jSONArray.length();
for (int i = 0; i < length; i++) {
int length2 = jSONArray.getJSONObject(i).getJSONArray("bins_arr").length();
for (int i2 = 0; i2 < length2; i2++) {
CardStatus cardStatus = new CardStatus();
cardStatus.setBankName(jSONArray.getJSONObject(i).getString("title"));
cardStatus.setStatusCode(jSONArray.getJSONObject(i).getInt("status"));
hashMap2.put(jSONArray.getJSONObject(i).getJSONArray("bins_arr").getString(i2), cardStatus);
}
}
payuResponse.setIssuingBankStatus(hashMap2);
postData.setResult("SUCCESS");
postData.setCode(0);
postData.setStatus("SUCCESS");
}
}
} catch (MalformedURLException e) {
e = e;
Log.d(getClass().getSimpleName(), "Exception " + e.getMessage());
payuResponse.setResponseStatus(postData);
return payuResponse;
} catch (ProtocolException e2) {
e = e2;
Log.d(getClass().getSimpleName(), "Exception " + e.getMessage());
payuResponse.setResponseStatus(postData);
return payuResponse;
} catch (IOException e3) {
e = e3;
z0.l(e, new StringBuilder("Exception "), getClass().getSimpleName());
payuResponse.setResponseStatus(postData);
return payuResponse;
} catch (JSONException e4) {
e = e4;
z0.l(e, new StringBuilder("Exception "), getClass().getSimpleName());
payuResponse.setResponseStatus(postData);
return payuResponse;
}
payuResponse.setResponseStatus(postData);
return payuResponse;
}
@Override
public void onPostExecute(PayuResponse payuResponse) {
super.onPostExecute((ValueAddedServiceTask) payuResponse);
this.mValueAddedServiceApiListener.onValueAddedServiceApiResponse(payuResponse);
}
}