正在查看: Clash Legends v0.0.1 应用的 GetOfferStatusTask.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 GetOfferStatusTask.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.payu.india.Tasks;
import android.os.AsyncTask;
import com.payu.india.Interfaces.GetOfferStatusApiListener;
import com.payu.india.Model.PayuConfig;
import com.payu.india.Model.PayuOffer;
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.Iterator;
import javax.net.ssl.HttpsURLConnection;
import kotlinx.coroutines.internal.LockFreeTaskQueueCore;
import org.json.JSONException;
import org.json.JSONObject;
public class GetOfferStatusTask extends AsyncTask<PayuConfig, String, PayuResponse> {
GetOfferStatusApiListener mGetOfferStatusApiListener;
public GetOfferStatusTask(GetOfferStatusApiListener getOfferStatusApiListener) {
this.mGetOfferStatusApiListener = getOfferStatusApiListener;
}
@Override
public PayuResponse doInBackground(PayuConfig... params) {
URL url;
char c;
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 response = new JSONObject(responseStringBuffer.toString());
if (response.has(PayuConstants.MSG)) {
postData.setResult(response.getString(PayuConstants.MSG));
}
if (response.has("status") && response.getInt("status") == 0) {
postData.setCode(PayuErrors.INVALID_HASH);
postData.setStatus("ERROR");
} else {
postData.setCode(0);
postData.setStatus("SUCCESS");
}
PayuOffer payuOffer = new PayuOffer();
Iterator<String> keys = response.keys();
while (keys.hasNext()) {
String next = keys.next();
URL url2 = url;
PayuConfig payuConfig2 = payuConfig;
HttpsURLConnection conn2 = conn;
InputStream responseInputStream2 = responseInputStream;
StringBuffer responseStringBuffer2 = responseStringBuffer;
switch (next.hashCode()) {
case -892481550:
if (next.equals("status")) {
c = 0;
break;
}
c = 65535;
break;
case -654979397:
if (next.equals(PayuConstants.OFFER_AVAILED_COUNT)) {
c = 5;
break;
}
c = 65535;
break;
case -437728861:
if (next.equals(PayuConstants.OFFER_REMAINING_COUNT)) {
c = 6;
break;
}
c = 65535;
break;
case 108417:
if (next.equals(PayuConstants.MSG)) {
c = 1;
break;
}
c = 65535;
break;
case 50511102:
if (next.equals("category")) {
c = '\b';
break;
}
c = 65535;
break;
case 161695549:
if (next.equals(PayuConstants.OFFER_TYPE)) {
c = 4;
break;
}
c = 65535;
break;
case 273184065:
if (next.equals("discount")) {
c = 7;
break;
}
c = 65535;
break;
case 1635686852:
if (next.equals(PayuConstants.ERROR_CODE)) {
c = 2;
break;
}
c = 65535;
break;
case 1944869372:
if (next.equals(com.payu.paymentparamhelper.PayuConstants.OFFER_KEY)) {
c = 3;
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
switch (c) {
case 0:
payuOffer.setStatus(response.getString("status"));
break;
case 1:
payuOffer.setMsg(response.getString(PayuConstants.MSG));
break;
case 2:
payuOffer.setErrorCode(response.getString(PayuConstants.ERROR_CODE));
break;
case 3:
payuOffer.setOfferKey(response.getString(com.payu.paymentparamhelper.PayuConstants.OFFER_KEY));
break;
case 4:
payuOffer.setOfferType(response.getString(PayuConstants.OFFER_TYPE));
break;
case 5:
payuOffer.setOfferAvailedCount(response.getString(PayuConstants.OFFER_AVAILED_COUNT));
break;
case 6:
payuOffer.setOfferRemainingCount(response.getString(PayuConstants.OFFER_REMAINING_COUNT));
break;
case 7:
payuOffer.setDiscount(response.getString("discount"));
break;
case '\b':
payuOffer.setCategory(response.getString("category"));
break;
}
url = url2;
payuConfig = payuConfig2;
conn = conn2;
responseInputStream = responseInputStream2;
responseStringBuffer = responseStringBuffer2;
}
payuResponse.setPayuOffer(payuOffer);
}
}
}
} catch (MalformedURLException e) {
e = e;
e.printStackTrace();
payuResponse.setResponseStatus(postData);
return payuResponse;
} catch (ProtocolException e2) {
e = e2;
e.printStackTrace();
payuResponse.setResponseStatus(postData);
return payuResponse;
} catch (IOException e3) {
e = e3;
e.printStackTrace();
payuResponse.setResponseStatus(postData);
return payuResponse;
} catch (JSONException e4) {
e = e4;
e.printStackTrace();
payuResponse.setResponseStatus(postData);
return payuResponse;
}
payuResponse.setResponseStatus(postData);
return payuResponse;
}
@Override
public void onPostExecute(PayuResponse payuResponse) {
super.onPostExecute((GetOfferStatusTask) payuResponse);
this.mGetOfferStatusApiListener.onGetOfferStatusApiResponse(payuResponse);
}
}