| | |
| | | package com.ruoyi.payment.ali.v2; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.AlipayConfig; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | |
| | | //异步返回参数 |
| | | model.setPassbackParams(pojo.getPassbackParams()); |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(aliProperties.getNotifyUrl() + pojo.getNotifyUrl()); |
| | | |
| | | AlipayTradeCreateResponse response = alipayClient.execute(request); |
| | | log.info("-----调起支付宝支付-----"); |
| | | log.info("请求参数:{}", pojo); |
| | | log.info("请求参数:{}", JSON.toJSONString(request)); |
| | | log.info("返回结果:{}", response.getBody()); |
| | | if (response.isSuccess()) { |
| | | return PaymentResp.build(response.getOutTradeNo(), response.getTradeNo()); |
| | |
| | | log.info("请求参数:{}", req); |
| | | log.info("返回结果:{}", response.getBody()); |
| | | if (response.isSuccess()) { |
| | | return JSON.parseObject(response.getBody(), RefundResp.class); |
| | | JSONObject jsonObject = JSON.parseObject(response.getBody()); |
| | | RefundResp alipay_trade_refund_response = jsonObject.getObject("alipay_trade_refund_response", RefundResp.class); |
| | | return alipay_trade_refund_response; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |