use of com.litingzhe.justandroid.pay.utils.AliPayUtils.v2.PayResultV2 in project JustAndroid by chinaltz.
the class AliPayUtils method payV2.
// subject 商品名称 body 商品详情 price 商品价格
public void payV2(String OrderNo, String subject, String body, String price, String notifyUrl, String out_trade_no) {
if (TextUtils.isEmpty(Constants.AliAppId) || TextUtils.isEmpty(Constants.RSA_PRIVATE) || TextUtils.isEmpty(Constants.RSA_PRIVATE)) {
new AlertDialog.Builder(mContex).setTitle("警告").setMessage("需要配置PARTNER | RSA_PRIVATE| SELLER").setPositiveButton("确定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialoginterface, int i) {
//
((Activity) mContex).finish();
}
}).show();
return;
}
// 订单
final String taskProductName = subject;
final String taskProductbody = body;
final String taskProductPrice = "" + price;
final String taskNotifyUrl = notifyUrl;
final String taskoutTradeNo = "" + out_trade_no;
final String taskTradeNo = OrderNo;
AsyncTask<Void, Void, Map<String, String>> asyncTask = new AsyncTask<Void, Void, Map<String, String>>() {
@Override
protected Map<String, String> doInBackground(Void... params) {
Map<String, String> mapParams = OrderInfoUtil2_0.buildOrderParamMap(taskTradeNo, taskProductName, taskProductbody, taskProductPrice, taskNotifyUrl, taskoutTradeNo);
String orderParam = OrderInfoUtil2_0.buildOrderParam(mapParams);
String sign = OrderInfoUtil2_0.getSign(mapParams, Constants.RSA_PRIVATE, true);
final String orderInfo = orderParam + "&" + sign;
// EnvUtils.setEnv(EnvUtils.EnvEnum.SANDBOX);
PayTask alipay = new PayTask((Activity) mContex);
// 调用支付接口,获取支付结果
Map<String, String> result = alipay.payV2(orderInfo, true);
return result;
}
@Override
protected void onPostExecute(Map<String, String> s) {
super.onPostExecute(s);
PayResultV2 payResult = new PayResultV2(s);
//
// 支付宝返回此次支付结果及加签,建议对支付宝签名信息拿签约时支付宝提供的公钥做验签
String resultInfo = payResult.getResult();
if (callBackV2 != null) {
callBackV2.onAliPayResultCallBack(payResult);
}
//
}
};
asyncTask.execute();
}
Aggregations