正在查看: 夜猫麻将 v24.1.1 应用的 PayUtil.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 夜猫麻将 v24.1.1 应用的 PayUtil.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.pay.paytypelibrary.base;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import com.pay.paytypelibrary.activity.SandWebActivity;
import com.pay.paytypelibrary.activity.UrlWebActivity;
import com.unity3d.ads.metadata.MediationMetaData;
import com.unity3d.services.core.device.reader.JsonStorageKeyNames;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
public class PayUtil {
private static final String BASE_URL_MIXIE = "https://sandcash.mixienet.com.cn";
private static final String ERR_EXCEPTION = "出错啦,请再试一次";
private static final String ERR_NETWORK = "网络出错,请再试一次";
public static final int PAY_CODE = 100;
private static final String TAG = "PayUtil";
private static final String URL_GATEWAY = "/gateway/v2/api";
private static final String URL_LINKCODE = "/gateway/v2/order/linkCodePayment";
private static final String URL_MIXED = "/gateway/v2/order/mixedpay";
private static final String URL_QUICK = "/gateway/v2/quick";
private static final String URL_QUICKPAY = "/gateway/v2/order/quickPayment";
public static class OooO00o implements OooO00o.OooO00o.OooO00o.OooO00o.OooO00o {
public final Activity f19OooO00o;
public final OnPayResultListener OooO0O0;
public class C0020OooO00o implements OooO00o.OooO00o.OooO00o.OooO00o.OooO00o {
public C0020OooO00o() {
}
@Override
public void OooO00o(Exception exc) {
exc.printStackTrace();
OooO00o.this.OooO0O0.onError(PayUtil.ERR_NETWORK);
}
@Override
public void OooO00o(String str) {
try {
JSONObject jSONObject = new JSONObject(str);
if ("000000".equals(jSONObject.getString("ret_code"))) {
String string = jSONObject.getString(JsonStorageKeyNames.DATA_KEY);
Intent intent = new Intent(OooO00o.this.f19OooO00o, (Class<?>) UrlWebActivity.class);
Bundle bundle = new Bundle();
bundle.putString("url", string);
bundle.putBoolean("hasTitle", true);
intent.putExtras(bundle);
OooO00o.this.f19OooO00o.startActivityForResult(intent, 100);
} else {
OooO00o.this.OooO0O0.onError(jSONObject.getString("ret_msg"));
}
} catch (Exception e) {
e.printStackTrace();
OooO00o.this.OooO0O0.onError(PayUtil.ERR_EXCEPTION);
}
}
}
public OooO00o(Activity activity, OnPayResultListener onPayResultListener) {
this.f19OooO00o = activity;
this.OooO0O0 = onPayResultListener;
}
@Override
public void OooO00o(Exception exc) {
exc.printStackTrace();
this.OooO0O0.onError(PayUtil.ERR_NETWORK);
}
@Override
public void OooO00o(String str) {
try {
JSONObject jSONObject = new JSONObject(str);
if ("000000".equals(jSONObject.getString("ret_code"))) {
String string = jSONObject.getJSONObject(JsonStorageKeyNames.DATA_KEY).getString("token_id");
JSONObject jSONObject2 = new JSONObject();
jSONObject2.put("token_id", string);
OooO00o.OooO00o.OooO00o.OooO00o.OooO0O0.OooO00o(this.f19OooO00o, "https://sandcash.mixienet.com.cn/gateway/v2/order/quickPayment", jSONObject2.toString(), new C0020OooO00o());
} else {
this.OooO0O0.onError(jSONObject.getString("ret_msg"));
}
} catch (Exception e) {
e.printStackTrace();
this.OooO0O0.onError(PayUtil.ERR_EXCEPTION);
}
}
}
public static class OooO0O0 implements OooO00o.OooO00o.OooO00o.OooO00o.OooO00o {
public final String f21OooO00o;
public final Activity OooO0O0;
public final OnPayResultListener OooO0OO;
public final OrderInfo OooO0Oo;
public class OooO00o implements OooO00o.OooO00o.OooO00o.OooO00o.OooO00o {
public OooO00o() {
}
@Override
public void OooO00o(Exception exc) {
exc.printStackTrace();
OooO0O0.this.OooO0OO.onError(PayUtil.ERR_NETWORK);
}
@Override
public void OooO00o(java.lang.String r9) {
throw new UnsupportedOperationException("Method not decompiled: com.pay.paytypelibrary.base.PayUtil.OooO0O0.OooO00o.OooO00o(java.lang.String):void");
}
}
public class C0021OooO0O0 implements OooO00o.OooO00o.OooO00o.OooO00o.OooO00o {
public C0021OooO0O0() {
}
@Override
public void OooO00o(Exception exc) {
exc.printStackTrace();
OooO0O0.this.OooO0OO.onError(PayUtil.ERR_NETWORK);
}
@Override
public void OooO00o(String str) {
try {
JSONObject jSONObject = new JSONObject(str);
if ("000000".equals(jSONObject.getString("ret_code"))) {
try {
Intent parseUri = Intent.parseUri(new JSONObject(jSONObject.getString(JsonStorageKeyNames.DATA_KEY)).getString("qrCode"), 1);
parseUri.addCategory("android.intent.category.BROWSABLE");
parseUri.setComponent(null);
parseUri.setSelector(null);
OooO0O0.this.OooO0O0.startActivity(parseUri);
} catch (Exception e) {
e.printStackTrace();
OooO0O0.this.OooO0OO.onError("您未安装支付宝APP");
}
} else {
OooO0O0.this.OooO0OO.onError(jSONObject.getString("ret_msg"));
}
} catch (Exception e2) {
e2.printStackTrace();
OooO0O0.this.OooO0OO.onError(PayUtil.ERR_EXCEPTION);
}
}
}
public OooO0O0(String str, Activity activity, OnPayResultListener onPayResultListener, OrderInfo orderInfo) {
this.f21OooO00o = str;
this.OooO0O0 = activity;
this.OooO0OO = onPayResultListener;
this.OooO0Oo = orderInfo;
}
@Override
public void OooO00o(Exception exc) {
exc.printStackTrace();
this.OooO0OO.onError(PayUtil.ERR_NETWORK);
}
@Override
public void OooO00o(String str) {
JSONObject jSONObject;
String string;
OnPayResultListener onPayResultListener;
String str2;
OnPayResultListener onPayResultListener2;
Activity activity;
String str3;
String jSONObject2;
OooO00o.OooO00o.OooO00o.OooO00o.OooO00o oooO00o;
try {
jSONObject = new JSONObject(str);
} catch (Exception e) {
e.printStackTrace();
this.OooO0OO.onError(PayUtil.ERR_EXCEPTION);
}
if (!"000000".equals(jSONObject.getString("ret_code"))) {
this.OooO0OO.onError(jSONObject.getString("ret_msg"));
return;
}
string = jSONObject.getJSONObject(JsonStorageKeyNames.DATA_KEY).getString("token_id");
switch (this.f21OooO00o) {
case "02020004":
try {
Intent parseUri = Intent.parseUri(string, 1);
parseUri.addCategory("android.intent.category.BROWSABLE");
parseUri.setComponent(null);
parseUri.setSelector(null);
this.OooO0O0.startActivity(parseUri);
break;
} catch (Exception e2) {
e2.printStackTrace();
onPayResultListener = this.OooO0OO;
str2 = "您未安装支付宝APP";
break;
}
case "02010005":
this.OooO0Oo.setTokenId(string);
onPayResultListener2 = this.OooO0OO;
onPayResultListener2.onSuccess(this.OooO0Oo);
break;
case "02010007":
this.OooO0Oo.setH5UrlTokenId(string);
onPayResultListener2 = this.OooO0OO;
onPayResultListener2.onSuccess(this.OooO0Oo);
break;
case "02030001":
case "02040001":
case "02000002":
case "06030001":
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put("token_id", string);
activity = this.OooO0O0;
str3 = "https://sandcash.mixienet.com.cn/gateway/v2/order/mixedpay";
jSONObject2 = jSONObject3.toString();
oooO00o = new OooO00o();
OooO00o.OooO00o.OooO00o.OooO00o.OooO0O0.OooO00o(activity, str3, jSONObject2, oooO00o);
break;
case "02020006":
JSONObject jSONObject4 = new JSONObject();
jSONObject4.put("token_id", string);
activity = this.OooO0O0;
str3 = "https://sandcash.mixienet.com.cn/gateway/v2/order/linkCodePayment";
jSONObject2 = jSONObject4.toString();
oooO00o = new C0021OooO0O0();
OooO00o.OooO00o.OooO00o.OooO00o.OooO0O0.OooO00o(activity, str3, jSONObject2, oooO00o);
break;
default:
onPayResultListener = this.OooO0OO;
str2 = "不支持的产品编码";
onPayResultListener.onError(str2);
break;
}
}
}
public static void CashierPayMulti(Activity activity, String str) {
String str2;
String str3;
String str4;
String str5;
String str6;
String str7;
OrderInfo orderInfo = new OrderInfo();
try {
JSONObject jSONObject = new JSONObject(str);
String string = jSONObject.getString("product_code");
ArrayList arrayList = new ArrayList();
Collections.addAll(arrayList, string.split(","));
List asList = Arrays.asList("04010001", "04010003", "00000001");
int size = arrayList.size();
arrayList.removeAll(asList);
if (arrayList.size() != size) {
Log.i(TAG, "--ERR-- 云账户产品请使用指定SDK");
return;
}
orderInfo.setVersion(jSONObject.getString(MediationMetaData.KEY_VERSION));
orderInfo.setMerNo(jSONObject.getString("mer_no"));
orderInfo.setMerOrderNo(jSONObject.getString("mer_order_no"));
orderInfo.setCreateTime(jSONObject.getString("create_time"));
orderInfo.setExpireTime(jSONObject.getString("expire_time"));
orderInfo.setOrderAmt(jSONObject.getString("order_amt"));
orderInfo.setNotifyUrl(jSONObject.getString("notify_url"));
orderInfo.setReturnUrl(jSONObject.getString("return_url"));
orderInfo.setCreateIp(jSONObject.getString("create_ip"));
orderInfo.setGoodsName(jSONObject.getString("goods_name"));
orderInfo.setStoreId(jSONObject.getString("store_id"));
orderInfo.setProductCode(jSONObject.getString("product_code"));
if (!jSONObject.has("clear_cycle")) {
Log.i(TAG, "--ERR-- 缺少[clear_cycle]参数");
return;
}
orderInfo.setClearCycle(jSONObject.getString("clear_cycle"));
if (!jSONObject.has("pay_extra")) {
Log.i(TAG, "--ERR-- 缺少[pay_extra]参数");
return;
}
orderInfo.setPayExtra(jSONObject.getString("pay_extra"));
if (!jSONObject.has("accsplit_flag")) {
Log.i(TAG, "--ERR-- 缺少[accsplit_flag]参数");
return;
}
orderInfo.setAccsplitFlag(jSONObject.getString("accsplit_flag"));
if (!jSONObject.has("jump_scheme")) {
Log.i(TAG, "--ERR-- 缺少[jump_scheme]参数");
return;
}
orderInfo.setJumpScheme(jSONObject.getString("jump_scheme"));
if (!jSONObject.has("sign_type")) {
Log.i(TAG, "--ERR-- 缺少[sign_type]参数");
return;
}
orderInfo.setSignType(jSONObject.getString("sign_type"));
if (!jSONObject.has("sign")) {
Log.i(TAG, "--ERR-- 缺少[sign]参数");
return;
}
orderInfo.setSign(jSONObject.getString("sign"));
if (jSONObject.has("activity_no")) {
orderInfo.setActivityNo(jSONObject.getString("activity_no"));
}
if (jSONObject.has("benefit_amount")) {
orderInfo.setBenefitAmount(jSONObject.getString("benefit_amount"));
}
if (jSONObject.has("extend")) {
orderInfo.setExtend(jSONObject.getString("extend"));
}
if (jSONObject.has("limit_pay")) {
orderInfo.setLimitPay(jSONObject.getString("limit_pay"));
}
if (jSONObject.has("channel_mid")) {
orderInfo.setChannelMid(jSONObject.getString("channel_mid"));
}
if (jSONObject.has("extend_params")) {
orderInfo.setExtendParams(jSONObject.getString("extend_params"));
}
if (!TextUtils.isEmpty(string) && (string.contains("01010005") || string.contains("02010005"))) {
JSONObject jSONObject2 = new JSONObject(orderInfo.getPayExtra());
if (!jSONObject2.has("wx_app_id") || !jSONObject2.has("gh_ori_id") || !jSONObject2.has("path_url") || !jSONObject2.has("miniProgramType")) {
Log.i(TAG, "--ERR-- 请检查[pay_extra]参数");
return;
}
orderInfo.setWxAppId(jSONObject2.getString("wx_app_id"));
orderInfo.setGhOriId(jSONObject2.getString("gh_ori_id"));
orderInfo.setPathUrl(jSONObject2.getString("path_url"));
orderInfo.setMiniProgramType(jSONObject2.getString("miniProgramType"));
}
HashMap hashMap = new HashMap();
hashMap.put("s", "Android");
hashMap.put("n", OooO00o.OooO00o.OooO00o.OooO0O0.OooO00o.OooO00o(activity));
try {
str2 = activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0).packageName;
} catch (Exception e) {
e.printStackTrace();
str2 = null;
}
hashMap.put("id", str2);
hashMap.put("sc", orderInfo.getJumpScheme());
JSONObject jSONObject3 = new JSONObject(hashMap);
JSONArray jSONArray = new JSONArray();
jSONArray.put(jSONObject3);
String str8 = "";
if (orderInfo.getActivityNo() != null) {
str3 = "&activity_no=" + orderInfo.getActivityNo();
} else {
str3 = "";
}
if (orderInfo.getBenefitAmount() != null) {
str4 = "&benefit_amount=" + orderInfo.getBenefitAmount();
} else {
str4 = "";
}
if (orderInfo.getExtend() != null) {
str5 = "&extend=" + URLEncoder.encode(URLDecoder.decode(orderInfo.getExtend()));
} else {
str5 = "";
}
if (orderInfo.getLimitPay() != null) {
str6 = "&limit_pay=" + orderInfo.getLimitPay();
} else {
str6 = "";
}
if (orderInfo.getChannelMid() != null) {
str7 = "&channel_mid=" + orderInfo.getChannelMid();
} else {
str7 = "";
}
if (orderInfo.getExtendParams() != null) {
str8 = "&extend_params=" + URLEncoder.encode(URLDecoder.decode(orderInfo.getExtendParams()));
}
Intent intent = new Intent(activity, (Class<?>) SandWebActivity.class);
String str9 = "https://sandcash.mixienet.com.cn/pay/sdk?" + ("version=" + orderInfo.getVersion() + "&mer_no=" + orderInfo.getMerNo() + "&mer_order_no=" + orderInfo.getMerOrderNo() + "&create_time=" + orderInfo.getCreateTime() + "&expire_time=" + orderInfo.getExpireTime() + "&order_amt=" + orderInfo.getOrderAmt() + "¬ify_url=" + URLEncoder.encode(orderInfo.getNotifyUrl()) + "&return_url=" + URLEncoder.encode(orderInfo.getReturnUrl()) + "&create_ip=" + orderInfo.getCreateIp() + "&goods_name=" + URLEncoder.encode(orderInfo.getGoodsName()) + "&store_id=" + orderInfo.getStoreId() + "&product_code=" + orderInfo.getProductCode() + "&clear_cycle=" + orderInfo.getClearCycle() + "&pay_extra=" + URLEncoder.encode(orderInfo.getPayExtra()) + "&meta_option=" + URLEncoder.encode(jSONArray.toString()) + "&accsplit_flag=" + orderInfo.getAccsplitFlag() + str3 + str4 + str5 + str6 + str7 + str8 + "&sign_type=" + orderInfo.getSignType() + "&sign=" + URLEncoder.encode(orderInfo.getSign()));
Bundle bundle = new Bundle();
bundle.putString("url", str9);
bundle.putSerializable("orderInfo", orderInfo);
intent.putExtras(bundle);
activity.startActivityForResult(intent, 100);
} catch (Exception e2) {
Log.i(TAG, "--ERR-- 缺少参数,请对照文档4.1节自行检查");
}
}
public static void CashierPaySingle(android.app.Activity r19, java.lang.String r20, com.pay.paytypelibrary.base.OnPayResultListener r21) {
throw new UnsupportedOperationException("Method not decompiled: com.pay.paytypelibrary.base.PayUtil.CashierPaySingle(android.app.Activity, java.lang.String, com.pay.paytypelibrary.base.OnPayResultListener):void");
}
}