Commit c12ac7ca authored by jiaorz's avatar jiaorz

Merge branch 'master-bacground-im' into dev

parents 55731ebb 2cb784f0
......@@ -319,7 +319,6 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
//这里和普通的接口调用不同,使用的是sdkExecute
AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
log.info(response.getBody());//就是orderString 可以直接给客户端请求,无需再做处理。
return response.getBody();
} catch (AlipayApiException e) {
log.error(e.getMessage(), e);;
......@@ -341,12 +340,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
"\"amount\": \"" + realAmount.toString() + "\" }");
request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
AlipayFundAuthOrderAppFreezeResponse response = alipayClient.sdkExecute(request);//注意这里是sdkExecute,可以获取签名参数
log.info("response: {}" + response.getBody());//签名后的参数,直接入参到
if (response.isSuccess()) {
log.info("调用成功");
log.info("response: {}" + response.getBody());//签名后的参数,直接入参到
log.info("预授权冻结调用成功");
return response.getBody();
} else {
log.info("调用失败");
log.info("预授权冻结调用失败");
return null;
}
}
......@@ -423,6 +422,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
request.setGrantType("authorization_code");
request.setCode(code);
AlipaySystemOauthTokenResponse response = alipayClient.execute(request);
log.info("获取用户token调用成功,获取用户信息 {}", response.getBody());
if(response.isSuccess()){
log.info("获取用户token调用成功,获取用户信息 {}", response.getBody());
if(response.getAccessToken() != null) {
......@@ -478,10 +478,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
"\"is_mobile\":\"true\"" +
" }");
AlipayUserInfoAuthResponse response = alipayClient.execute(request);
log.info("解冻预授权response: {}" + response.getBody());
log.info(response.toString());
if(response.isSuccess()){
System.out.println("调用成功");
log.info("用户授权调用成功");
} else {
System.out.println("调用失败");
log.info("用户授权调用失败");
}
return response.getBody();
}
......@@ -503,13 +505,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
request.setBizModel(model);
request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
AlipayFundAuthOrderUnfreezeResponse response = alipayClient.execute(request);
log.info("response: {}" + response.getBody());
log.info("解冻预授权response: {}" + response.getBody());
if (response.isSuccess()) {
log.info("调用成功");
log.info("response: {}" + response.getBody());//签名后的参数,直接入参到
log.info("解冻预授权调用成功");
return true;
} else {
log.info("调用失败");
log.info("解冻预授权调用失败");
return false;
}
}
......@@ -529,13 +530,12 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
AlipayFundAuthOperationCancelResponse response = alipayClient.execute(request);
log.info("response: {}" + response.getBody());
log.info("取消预授权response: {}" + response.getBody());
if (response.isSuccess()) {
log.info("调用成功");
log.info("response: {}" + response.getBody());//签名后的参数,直接入参到
log.info("取消预授权调用成功");
return response.getBody();
} else {
log.info("调用失败");
log.info("取消预授权调用失败");
return null;
}
}
......@@ -569,11 +569,11 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
AlipayTradePayResponse response = alipayClient.execute(request);
log.info("预授权转支付response: {}" + response.getBody());
if (response.isSuccess()) {
log.info("response: {}" + response.getBody());
return true;
} else {
log.info("调用失败");
log.info("预授权转支付调用失败");
return false;
}
}
......@@ -604,6 +604,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
try {
log.info("支付宝退款中:outTradeNo = {}, tradNo = {}, refundAmount = {}, refundReason = {}", outTradeNo, tradNo, refundAmount, refundReason);
AlipayTradeRefundResponse response = alipayClient.execute(request);
log.info("APP支付退款response: {}" + response.getBody());
if (response.isSuccess()) {
return true;
} else {
......@@ -617,6 +618,30 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
return false;
}
/**
* 查询预授权订单
* @param tradNo
* @throws AlipayApiException
*/
public ObjectRestResponse fundAuthQuery(String tradNo){
AlipayClient alipayClient = getAlipayClient();
AlipayFundAuthOperationDetailQueryRequest request = new AlipayFundAuthOperationDetailQueryRequest();
AlipayFundAuthOperationDetailQueryModel model = new AlipayFundAuthOperationDetailQueryModel();
//model.setAuthNo("2017120110002001390206804295"); // 支付宝资金授权订单号,在授权冻结成功时返回参数中获得
model.setOutOrderNo(tradNo); //商户的授权资金订单号,与支付宝的授权资金订单号不能同时为空
//model.setOperationId("20171201317348823902"); //支付宝的授权资金操作流水号,冻结成功同步返回
model.setOutRequestNo(tradNo);//商户的授权资金操作流水号,与支付宝的授权资金操作流水号不能同时为空,该值为冻结或解冻是的outRequestNo
request.setBizModel(model);
AlipayFundAuthOperationDetailQueryResponse response = null;
try {
response = alipayClient.execute(request);
log.info("response: {}"+response.getBody());
} catch (AlipayApiException e) {
e.printStackTrace();
}
return ObjectRestResponse.succ(response.getBody());
}
public static void main(String[] args) throws AlipayApiException {
OrderPayBiz orderPayBiz = new OrderPayBiz();
OrderPayVo orderPayVo = new OrderPayVo();
......@@ -626,9 +651,11 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper, OrderPay>{
orderPayVo.setAmount(3);
orderPayVo.setBody("扣除租车订单费用");
orderPayVo.setSubject("租车订单交易费用");
//orderPayBiz.fundAuthOrderUnFreeze(orderPayVo, "");
orderPayBiz.fundAuthOrderUnFreeze("2019111410002001530505959461", "2019111410002001530505959461", 7, "退还押金");
//orderPayBiz.alipayOrderRefund("20191024153859000003","2019102422001421530513773694", 2, "xxxx", "");
//orderPayBiz.tradePay(orderPayVo, "");
//orderPayBiz.tradePay("20191108195202000020", "2019110810002001710518149012", 120000,"退还押金", "退还押金");
//orderPayBiz.fundAuthCancel(orderPayVo, "");
//orderPayBiz.tradePay("20191114182254000019", "2019111410002001530505959461", 1,"扣除违约金", "扣除违约金");
}
}
......@@ -105,6 +105,11 @@ public class OrderPayController extends BaseController<OrderPayBiz,OrderPay> {
return baseBiz.alipayNotify();
}
@PostMapping(value = "/app/unauth/notify/fundAuthQuery")
@IgnoreUserToken
public ObjectRestResponse fundAuthQuery(String tradNo){
return baseBiz.fundAuthQuery(tradNo);
}
@PostMapping("/app/unauth/transfer_account")
@IgnoreUserToken
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment