龙将斩千 v5.5.5.39856版本的 MD5 值为:5c05b1d6f8d872ca3fe0343d6ff07caf
以下内容为反编译后的 PayActivity.java 源代码,内容仅作参考
package com.umarkgame.umarksdk.activity;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.app.NotificationCompat;
import com.umarkgame.umarksdk.UmarkGameSdk;
import com.umarkgame.umarksdk.checkOrderNo.CheckOrderNo;
import com.umarkgame.umarksdk.constant.FinalValue;
import com.umarkgame.umarksdk.global.PhoneInfo;
import com.umarkgame.umarksdk.utils.HttpUtils;
import com.umarkgame.umarksdk.utils.LogUtils;
import com.umarkgame.umarksdk.utils.PreferenceUtils;
import com.umarkgame.umarksdk.utils.ProgressCircleUtils;
import com.umarkgame.umarksdk.utils.ResourcesUtils;
import com.umarkgame.umarksdk.utils.ToastUtils;
import com.yaya.sdk.constants.Constants;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public class PayActivity extends Activity {
public static String itemDesc;
public static String itemId;
public static String itemName;
private static Activity mActivity;
private String cpExpansion;
private Intent foregroundService;
private String goodsName;
private String goodsPrice;
private boolean isNotPayOperation = true;
private ImageView iv_alipay;
private ImageView iv_credit;
private ImageView iv_delete;
private ImageView iv_return;
private ImageView iv_wechat;
private String orderNumber;
private String payType;
private String roleId;
private String serverId;
private TextView tv_account;
private TextView tv_danjia;
private TextView tv_goodsname;
private TextView tv_price;
private static int queryPayResultCount = 0;
private static int queryPayResultMaxCount = 5;
private static int queryPayResultTime = 1200;
private static boolean isQueryPayStatr = false;
static int access$608() {
int i = queryPayResultCount;
queryPayResultCount = i + 1;
return i;
}
public static Activity getActivty() {
return mActivity;
}
public void enterPayFailUI() {
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (PhoneInfo.SCREENDIRECTION == 0) {
LogUtils.output("屏幕方向", "0");
setRequestedOrientation(0);
} else {
LogUtils.output("屏幕方向", "1");
setRequestedOrientation(1);
}
setContentView(ResourcesUtils.getIdByName(this, "layout", "umark_recharge_vertical"));
mActivity = this;
initView();
initData();
ProgressCircleUtils.setOnPayProgressCancelListener(new ProgressCircleUtils.OnPayProgressCancelListener() {
@Override
public void onPayProgressCancel() {
PayActivity.this.finish();
}
});
}
@Override
protected void onDestroy() {
super.onDestroy();
boolean z = this.isNotPayOperation;
}
private void initData() {
String userName = PreferenceUtils.getString(UmarkGameSdk.getInstance().getActivity(), FinalValue.USERNAME, "");
Intent intent = getIntent();
this.goodsName = intent.getStringExtra(FinalValue.GOODSNAME);
this.goodsPrice = intent.getStringExtra(FinalValue.GOODSPRICE);
PhoneInfo.GOODSPRICE = this.goodsPrice;
this.roleId = intent.getStringExtra(FinalValue.ROLEID);
this.serverId = intent.getStringExtra(FinalValue.SERVERID);
this.orderNumber = intent.getStringExtra(FinalValue.ORDERNUMBER);
this.cpExpansion = intent.getStringExtra(FinalValue.CPEXPANSION);
this.tv_account.setText("购买账号: " + userName);
this.tv_goodsname.setText("商品名称: " + this.goodsName);
int parseInt = Integer.parseInt(this.goodsPrice);
double price = new BigDecimal((double) (((float) parseInt) / 100.0f)).setScale(2, 4).doubleValue();
this.tv_danjia.setText("商品单价: " + price + "¥");
this.tv_price.setText("应付金额: " + price + "¥");
PhoneInfo.PAYTYPE = 0;
}
private void initView() {
this.iv_return = (ImageView) findViewById(ResourcesUtils.getIdByName(this, Constants.HELLOINFO_ID, "iv_return"));
this.iv_delete = (ImageView) findViewById(ResourcesUtils.getIdByName(this, Constants.HELLOINFO_ID, "iv_delete"));
this.tv_account = (TextView) findViewById(ResourcesUtils.getIdByName(this, Constants.HELLOINFO_ID, "tv_account"));
this.tv_goodsname = (TextView) findViewById(ResourcesUtils.getIdByName(this, Constants.HELLOINFO_ID, "tv_goodsname"));
this.tv_danjia = (TextView) findViewById(ResourcesUtils.getIdByName(this, Constants.HELLOINFO_ID, "tv_danjia"));
this.tv_price = (TextView) findViewById(ResourcesUtils.getIdByName(this, Constants.HELLOINFO_ID, "tv_price"));
this.iv_alipay = (ImageView) findViewById(ResourcesUtils.getIdByName(this, Constants.HELLOINFO_ID, "iv_alipay"));
this.iv_wechat = (ImageView) findViewById(ResourcesUtils.getIdByName(this, Constants.HELLOINFO_ID, "iv_wechat"));
this.iv_credit = (ImageView) findViewById(ResourcesUtils.getIdByName(this, Constants.HELLOINFO_ID, "iv_credit"));
this.iv_return.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PayActivity.this.finish();
}
});
this.iv_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PayActivity.this.finish();
}
});
this.iv_alipay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PhoneInfo.PAYTYPE = 0;
PayActivity.this.iv_alipay.setImageResource(ResourcesUtils.getIdByName(PayActivity.this, "drawable", "umark_alipay_press"));
PayActivity.this.iv_wechat.setImageResource(ResourcesUtils.getIdByName(PayActivity.this, "drawable", "umark_wechat"));
PayActivity.this.iv_credit.setImageResource(ResourcesUtils.getIdByName(PayActivity.this, "drawable", "umark_credit"));
}
});
this.iv_wechat.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PhoneInfo.PAYTYPE = 1;
PayActivity.this.iv_alipay.setImageResource(ResourcesUtils.getIdByName(PayActivity.this, "drawable", "umark_alipay"));
PayActivity.this.iv_wechat.setImageResource(ResourcesUtils.getIdByName(PayActivity.this, "drawable", "umark_wechat_press"));
PayActivity.this.iv_credit.setImageResource(ResourcesUtils.getIdByName(PayActivity.this, "drawable", "umark_credit"));
}
});
this.iv_credit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
PhoneInfo.PAYTYPE = 2;
PayActivity.this.iv_alipay.setImageResource(ResourcesUtils.getIdByName(PayActivity.this, "drawable", "umark_alipay"));
PayActivity.this.iv_wechat.setImageResource(ResourcesUtils.getIdByName(PayActivity.this, "drawable", "umark_wechat"));
PayActivity.this.iv_credit.setImageResource(ResourcesUtils.getIdByName(PayActivity.this, "drawable", "umark_credit_press"));
}
});
}
public void rechargeMoney(View view) {
LogUtils.output("商品名称", this.goodsName);
LogUtils.output("商品价格", this.goodsPrice);
switch (PhoneInfo.PAYTYPE) {
case 0:
alipay();
return;
case 1:
wechar();
return;
case 2:
unionpay();
return;
default:
return;
}
}
public static float changeF2Y(String amount) {
try {
int parseInt = Integer.parseInt(amount);
float price = new BigDecimal(parseInt / 100.0f).setScale(2, 4).floatValue();
return price;
} catch (Exception e) {
return 0.0f;
}
}
private void unionpay() {
Map<String, String> message = new HashMap<>();
message.put("appid", PhoneInfo.APPID);
message.put("type", "2");
message.put("ostype", PhoneInfo.OSTYPE);
message.put("channel", PhoneInfo.CHANNEL);
message.put("mac", PhoneInfo.MAC);
message.put("sdkversion", "1.0");
String userId = PreferenceUtils.getString(UmarkGameSdk.getInstance().getActivity(), FinalValue.USERID, "");
message.put("username", userId);
message.put("money", this.goodsPrice);
message.put("roleid", this.roleId);
message.put("serverid", this.serverId);
message.put(FinalValue.ORDERNUMBER, this.orderNumber);
String cpJsonStr = "{\"payType\":\"4\", \"deviceInfo\":\"" + PhoneInfo.MAC + "\"}";
message.put(FinalValue.CPEXPANSION, this.cpExpansion);
message.put("expansion", cpJsonStr);
message.put("agentGame", PhoneInfo.AGENTGAME);
LogUtils.output("微信请求:", message.toString());
ProgressCircleUtils.showPayProgress(this, "支付", "去微信支付");
HttpUtils.post("https://yht.umarkgame.com/umarkpay/pay", message, new HttpUtils.RequestListener() {
@Override
public void success(String response) {
ProgressCircleUtils.closeProgress();
LogUtils.output("微信下单响应", response);
try {
JSONObject jsonObject = new JSONObject(response);
int status = jsonObject.getInt(NotificationCompat.CATEGORY_STATUS);
if (status == 1) {
JSONObject payJsonStr = jsonObject.getJSONObject("channelResParams");
try {
PayActivity.this.payType = "2";
PayActivity.this.orderNumber = jsonObject.getString(FinalValue.ORDERNUMBER);
String url = payJsonStr.getString("data");
UmarkGameSdk.getInstance().statReYunPaymentStart(PayActivity.this.orderNumber, "weixinpay", PayActivity.changeF2Y(PayActivity.this.goodsPrice));
LogUtils.output("", "热云上传---" + PayActivity.changeF2Y(PayActivity.this.goodsPrice));
CheckOrderNo.getInstance().addOrderData(PayActivity.this.orderNumber, PayActivity.this.goodsPrice, PayActivity.itemDesc, PayActivity.itemName, PayActivity.itemId);
Uri uri = Uri.parse(url);
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(uri);
PayActivity.this.startActivity(intent);
PayActivity.this.finish();
} catch (Exception e) {
LogUtils.output("网银下单响应", "失败");
Message msg = new Message();
msg.what = 110;
msg.obj = FinalValue.PAY_FAIL_MSG;
UmarkGameSdk.getInstance().mHandler.sendMessage(msg);
}
return;
}
LogUtils.output("网银下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg2 = new Message();
msg2.what = 110;
try {
msg2.obj = FinalValue.PAY_FAIL_MSG;
} catch (Exception e2) {
msg2.obj = FinalValue.PAY_FAIL_MSG;
}
UmarkGameSdk.getInstance().mHandler.sendMessage(msg2);
return;
} catch (JSONException e3) {
e3.printStackTrace();
LogUtils.output("微信下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg3 = new Message();
msg3.what = 110;
msg3.obj = FinalValue.PAY_FAIL_MSG;
UmarkGameSdk.getInstance().mHandler.sendMessage(msg3);
}
e3.printStackTrace();
LogUtils.output("微信下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg32 = new Message();
msg32.what = 110;
msg32.obj = FinalValue.PAY_FAIL_MSG;
UmarkGameSdk.getInstance().mHandler.sendMessage(msg32);
}
@Override
public void fail(String error) {
ProgressCircleUtils.closeProgress();
LogUtils.output("微信下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg = new Message();
msg.what = 110;
msg.obj = "网络异常,支付失败";
UmarkGameSdk.getInstance().mHandler.sendMessage(msg);
}
});
}
private void wechar() {
Map<String, String> message = new HashMap<>();
message.put("appid", PhoneInfo.APPID);
message.put("type", "2");
message.put("ostype", PhoneInfo.OSTYPE);
message.put("channel", PhoneInfo.CHANNEL);
message.put("mac", PhoneInfo.MAC);
message.put("sdkversion", "1.0");
String userId = PreferenceUtils.getString(UmarkGameSdk.getInstance().getActivity(), FinalValue.USERID, "");
message.put("username", userId);
message.put("money", this.goodsPrice);
message.put("roleid", this.roleId);
message.put("serverid", this.serverId);
message.put(FinalValue.ORDERNUMBER, this.orderNumber);
String cpJsonStr = "{\"payType\":\"0\", \"deviceInfo\":\"" + PhoneInfo.MAC + "\"}";
message.put(FinalValue.CPEXPANSION, this.cpExpansion);
message.put("expansion", cpJsonStr);
message.put("agentGame", PhoneInfo.AGENTGAME);
LogUtils.output("微信请求:", message.toString());
ProgressCircleUtils.showPayProgress(this, "支付", "去微信支付");
HttpUtils.post("https://yht.umarkgame.com/umarkpay/pay", message, new HttpUtils.RequestListener() {
@Override
public void success(String response) {
ProgressCircleUtils.closeProgress();
LogUtils.output("微信下单响应", response);
try {
JSONObject jsonObject = new JSONObject(response);
int status = jsonObject.getInt(NotificationCompat.CATEGORY_STATUS);
if (status == 1) {
JSONObject payJsonStr = jsonObject.getJSONObject("channelResParams");
try {
PayActivity.this.payType = "1";
PayActivity.this.orderNumber = jsonObject.getString(FinalValue.ORDERNUMBER);
String url = payJsonStr.getString("data");
UmarkGameSdk.getInstance().statReYunPaymentStart(PayActivity.this.orderNumber, "weixinpay", PayActivity.changeF2Y(PayActivity.this.goodsPrice));
LogUtils.output("", "热云上传---" + PayActivity.changeF2Y(PayActivity.this.goodsPrice));
CheckOrderNo.getInstance().addOrderData(PayActivity.this.orderNumber, PayActivity.this.goodsPrice, PayActivity.itemDesc, PayActivity.itemName, PayActivity.itemId);
Uri uri = Uri.parse(url);
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(uri);
PayActivity.this.startActivity(intent);
PayActivity.this.finish();
} catch (Exception e) {
LogUtils.output("微信下单响应", "失败");
ToastUtils.ToastMsg(UmarkGameSdk.getInstance().getActivity(), "微信客户端支付异常, 请检查您的微信客户端是否安装!");
Message msg = new Message();
msg.what = 110;
msg.obj = FinalValue.PAY_FAIL_MSG;
UmarkGameSdk.getInstance().mHandler.sendMessage(msg);
}
return;
}
LogUtils.output("微信下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg2 = new Message();
msg2.what = 110;
try {
msg2.obj = FinalValue.PAY_FAIL_MSG;
} catch (Exception e2) {
msg2.obj = FinalValue.PAY_FAIL_MSG;
}
UmarkGameSdk.getInstance().mHandler.sendMessage(msg2);
return;
} catch (JSONException e3) {
e3.printStackTrace();
LogUtils.output("微信下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg3 = new Message();
msg3.what = 110;
msg3.obj = FinalValue.PAY_FAIL_MSG;
UmarkGameSdk.getInstance().mHandler.sendMessage(msg3);
}
e3.printStackTrace();
LogUtils.output("微信下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg32 = new Message();
msg32.what = 110;
msg32.obj = FinalValue.PAY_FAIL_MSG;
UmarkGameSdk.getInstance().mHandler.sendMessage(msg32);
}
@Override
public void fail(String error) {
ProgressCircleUtils.closeProgress();
LogUtils.output("微信下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg = new Message();
msg.what = 110;
msg.obj = "网络异常,支付失败";
UmarkGameSdk.getInstance().mHandler.sendMessage(msg);
}
});
}
private void alipay() {
Map<String, String> message = new HashMap<>();
message.put("appid", PhoneInfo.APPID);
message.put("type", "2");
message.put("ostype", PhoneInfo.OSTYPE);
message.put("channel", PhoneInfo.CHANNEL);
message.put("mac", PhoneInfo.MAC);
message.put("sdkversion", "1.0");
String userId = PreferenceUtils.getString(UmarkGameSdk.getInstance().getActivity(), FinalValue.USERID, "");
message.put("username", userId);
message.put("money", this.goodsPrice);
message.put("roleid", this.roleId);
message.put("serverid", this.serverId);
message.put(FinalValue.ORDERNUMBER, this.orderNumber);
String cpJsonStr = "{\"payType\":\"1\", \"deviceInfo\":\"" + PhoneInfo.MAC + "\"}";
message.put(FinalValue.CPEXPANSION, this.cpExpansion);
message.put("expansion", cpJsonStr);
message.put("agentGame", PhoneInfo.AGENTGAME);
LogUtils.output("支付宝请求:", message.toString());
ProgressCircleUtils.showPayProgress(this, "支付", "去支付宝支付");
HttpUtils.post("https://yht.umarkgame.com/umarkpay/pay", message, new HttpUtils.RequestListener() {
@Override
public void success(String response) {
ProgressCircleUtils.closeProgress();
LogUtils.output("支付宝下单响应", response);
try {
JSONObject jsonObject = new JSONObject(response);
int status = jsonObject.getInt(NotificationCompat.CATEGORY_STATUS);
if (status == 1) {
JSONObject payJsonStr = jsonObject.getJSONObject("channelResParams");
PayActivity.this.payType = "2";
PayActivity.this.orderNumber = jsonObject.getString(FinalValue.ORDERNUMBER);
String url = payJsonStr.getString("data");
UmarkGameSdk.getInstance().statReYunPaymentStart(PayActivity.this.orderNumber, "alipay", PayActivity.changeF2Y(PayActivity.this.goodsPrice));
LogUtils.output("", "热云上传---" + PayActivity.changeF2Y(PayActivity.this.goodsPrice));
CheckOrderNo.getInstance().addOrderData(PayActivity.this.orderNumber, PayActivity.this.goodsPrice, PayActivity.itemDesc, PayActivity.itemName, PayActivity.itemId);
Uri uri = Uri.parse(url);
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(uri);
PayActivity.this.startActivity(intent);
PayActivity.this.finish();
return;
}
LogUtils.output("支付宝下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg = new Message();
msg.what = 110;
try {
msg.obj = FinalValue.PAY_FAIL_MSG;
} catch (Exception e) {
msg.obj = FinalValue.PAY_FAIL_MSG;
}
UmarkGameSdk.getInstance().mHandler.sendMessage(msg);
} catch (JSONException e2) {
e2.printStackTrace();
LogUtils.output("支付宝下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg2 = new Message();
msg2.what = 110;
msg2.obj = FinalValue.PAY_FAIL_MSG;
UmarkGameSdk.getInstance().mHandler.sendMessage(msg2);
}
}
@Override
public void fail(String error) {
ProgressCircleUtils.closeProgress();
LogUtils.output("支付宝下单响应", "失败");
PayActivity.this.enterPayFailUI();
Message msg = new Message();
msg.what = 110;
msg.obj = "网络异常,支付失败";
UmarkGameSdk.getInstance().mHandler.sendMessage(msg);
}
});
}
@Override
protected void onStart() {
super.onStart();
if (this.payType == null || TextUtils.equals("", this.payType)) {
return;
}
this.payType = "";
this.isNotPayOperation = false;
}
@SuppressLint({"DefaultLocale"})
public void queryPayResult(final String orderNumber, final String payType) {
Map<String, String> message = new HashMap<>();
message.put("appid", PhoneInfo.APPID);
message.put("type", "4");
message.put("channel", PhoneInfo.CHANNEL);
message.put("mac", PhoneInfo.MAC);
String userId = PreferenceUtils.getString(UmarkGameSdk.getInstance().getActivity(), FinalValue.USERID, "");
message.put("username", userId);
message.put("money", this.goodsPrice);
message.put(FinalValue.ORDERNUMBER, orderNumber);
message.put("agentGame", PhoneInfo.AGENTGAME);
LogUtils.output("支付结果查询请求:", message.toString());
HttpUtils.post("https://yht.umarkgame.com/umarkpay/pay", message, new HttpUtils.RequestListener() {
@Override
public void success(String response) {
LogUtils.output("支付结果查询响应", response);
try {
JSONObject jsonObject = new JSONObject(response);
int status = jsonObject.getInt(NotificationCompat.CATEGORY_STATUS);
if (status == 1) {
LogUtils.output("查询支付结果总时间", (PayActivity.queryPayResultCount * PayActivity.queryPayResultTime) + "ms");
ProgressCircleUtils.closeProgress();
UmarkGameSdk.getInstance().mHandler.sendEmptyMessage(109);
} else if (PayActivity.queryPayResultCount == PayActivity.queryPayResultMaxCount) {
int unused = PayActivity.queryPayResultCount = 0;
ProgressCircleUtils.closeProgress();
PayActivity.this.enterPayFailUI();
Message msg = new Message();
msg.what = 110;
msg.obj = "查询失败, 请确认实际充值是否到账";
UmarkGameSdk.getInstance().mHandler.sendMessage(msg);
} else {
new Thread() {
@Override
public void run() {
try {
Thread.sleep(PayActivity.queryPayResultTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
PayActivity.access$608();
PayActivity.this.queryPayResult(orderNumber, payType);
}
}.start();
}
} catch (JSONException e) {
if (PayActivity.queryPayResultCount == PayActivity.queryPayResultMaxCount) {
int unused2 = PayActivity.queryPayResultCount = 0;
ProgressCircleUtils.closeProgress();
e.printStackTrace();
PayActivity.this.enterPayFailUI();
Message msg2 = new Message();
msg2.what = 110;
msg2.obj = "查询失败, 请确认实际充值是否到账";
UmarkGameSdk.getInstance().mHandler.sendMessage(msg2);
return;
}
new Thread() {
@Override
public void run() {
try {
Thread.sleep(PayActivity.queryPayResultTime);
} catch (InterruptedException e2) {
e2.printStackTrace();
}
PayActivity.access$608();
PayActivity.this.queryPayResult(orderNumber, payType);
}
}.start();
}
}
@Override
public void fail(String error) {
if (PayActivity.queryPayResultCount == PayActivity.queryPayResultMaxCount) {
int unused = PayActivity.queryPayResultCount = 0;
ProgressCircleUtils.closeProgress();
PayActivity.this.enterPayFailUI();
Message msg = new Message();
msg.what = 110;
msg.obj = "查询失败, 请确认实际充值是否到账";
UmarkGameSdk.getInstance().mHandler.sendMessage(msg);
return;
}
new Thread() {
@Override
public void run() {
try {
Thread.sleep(PayActivity.queryPayResultTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
PayActivity.access$608();
PayActivity.this.queryPayResult(orderNumber, payType);
}
}.start();
}
});
}
}