/**
* 支付宝撤销交易
* 已经成功
* @param
* @return
*/
* 支付宝撤销交易
* 已经成功
* @param
* @return
*/
private void outAliapyTradeCancel() {
Debug.v("outAliapyTradeCance ", "支付宝撤销");
Debug.v("outAliapyTradeCance ", "支付宝撤销");
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
public void run() {
// TODO Auto-generated method stub
AlipayClient alipayClient = new DefaultAlipayClient(AlipayUtils.openapi, AlipayUtils.appid,
AlipayUtils.private_key, "json", "GBK", AlipayUtils.public_key, "RSA2");
AlipayTradeCancelRequest request = new AlipayTradeCancelRequest();
AlipayUtils.private_key, "json", "GBK", AlipayUtils.public_key, "RSA2");
AlipayTradeCancelRequest request = new AlipayTradeCancelRequest();
request.putOtherTextParam("app_auth_token", "###################");
request.setBizContent("{" +
request.setBizContent("{" +
// "\"out_trade_no\":\"" + outTradeNo + "\"," +
"\"trade_no\":\"" + tradeNo + "\"" + " }");
"\"trade_no\":\"" + tradeNo + "\"" + " }");
AlipayTradeCancelResponse response;
try {
response = alipayClient.execute(request);
Debug.v("getMsg", response.getMsg());
Debug.v("code", response.getCode());
try {
response = alipayClient.execute(request);
Debug.v("getMsg", response.getMsg());
Debug.v("code", response.getCode());
if (response.isSuccess()) {
Debug.v("撤销成功");
Debug.v("撤销成功");
Looper.prepare();
ToastUtil.toast("支付宝撤销成功", Toast.LENGTH_LONG);
preferences = getSharedPreferences("TransferMsgActivity", Context.MODE_PRIVATE);
if (preferences.getInt("transFerMsg_cancel", 1) == 1) {
if (preferences.getInt("transFerMsg_cancel", 1) == 1) {
Debug.v("preferences", preferences.getInt("transFerMsg_cancel", 1) + "");
preferences = getSharedPreferences("AliapyStatusActivity", Context.MODE_PRIVATE);
preferences = getSharedPreferences("AliapyStatusActivity", Context.MODE_PRIVATE);
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
info = alipayTradeQuery(tradeNo);
Debug.v("INFO===", info);
if ("SUCCESS".equals(info)) {
Debug.v("INFO===", info);
final Bundle mBundle = new Bundle();
public void run() {
// TODO Auto-generated method stub
info = alipayTradeQuery(tradeNo);
Debug.v("INFO===", info);
if ("SUCCESS".equals(info)) {
Debug.v("INFO===", info);
final Bundle mBundle = new Bundle();
Debug.v("alipayTradeQuery tradeNo", tradeNo);
mBundle.putString("OrderID", alipayOutTradeNo);
mBundle.putString("PayType", "Z");
mBundle.putString("CardID", null);
Debug.v("price ==", preferences.getString("totalAmount", ""));
mBundle.putString("Price", alipayTotalAmount);
Debug.v("alipay MachineID", TransParams.getMachineID());
mBundle.putString("MachineID", TransParams.getMachineID());
mBundle.putString("PayTime", TransParams.getDate());
mBundle.putString("UserName", null);
mBundle.putString("VerifyCode",
TransParams.getVerifyCode(alipayOutTradeNo, TransParams.getDate()));
mBundle.putString("IsBack", "Y");
mBundle.putString("OrderID", alipayOutTradeNo);
mBundle.putString("PayType", "Z");
mBundle.putString("CardID", null);
Debug.v("price ==", preferences.getString("totalAmount", ""));
mBundle.putString("Price", alipayTotalAmount);
Debug.v("alipay MachineID", TransParams.getMachineID());
mBundle.putString("MachineID", TransParams.getMachineID());
mBundle.putString("PayTime", TransParams.getDate());
mBundle.putString("UserName", null);
mBundle.putString("VerifyCode",
TransParams.getVerifyCode(alipayOutTradeNo, TransParams.getDate()));
mBundle.putString("IsBack", "Y");
Map<String, Object> params = TransParams.transFerParams(mBundle);
String result = HttpUtilsGet.doGet(apiurl, params);
Debug.v("支付宝撤销信息回传");
Debug.v("result==", result);
String result = HttpUtilsGet.doGet(apiurl, params);
Debug.v("支付宝撤销信息回传");
Debug.v("result==", result);
}
}
}).start();
}
}).start();
} else {
Debug.v("preferences AliapyTradeCancel ", "is not 1");
}
Looper.loop();
} else {
Debug.v("撤销失败");
Looper.loop();
} else {
Debug.v("撤销失败");
Looper.prepare();
ToastUtil.toast("支付宝撤销失败", Toast.LENGTH_LONG);
Looper.loop();
Looper.loop();
}
} catch (AlipayApiException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}).start();
}).start();
}