|
@@ -4860,8 +4860,8 @@ public class TOrderController {
|
|
|
@ApiOperation("收钱吧反扫购物车支付")
|
|
|
@PostMapping("/sqbCardPay")
|
|
|
@ResponseBody
|
|
|
- public Object sqbCardPay(String authCode, String frpCode, String clientId, String ip, @RequestBody Map<String, String> productNameMap, HttpServletRequest request) {
|
|
|
- return orderService.sqbCardPay(authCode, frpCode, clientId, ip, productNameMap, request);
|
|
|
+ public Object sqbCardPay(String authCode, String frpCode, String clientId, String ip, @RequestBody Map<String, String> productNameMap) {
|
|
|
+ return orderService.sqbCardPay(authCode, frpCode, clientId, ip, productNameMap);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("收钱吧发起退款")
|
|
@@ -4881,94 +4881,8 @@ public class TOrderController {
|
|
|
*/
|
|
|
@ApiOperation(value = "优化汇付支付")
|
|
|
@GetMapping("/testUniPay")
|
|
|
- public Object testUniPay(String code, String clientId, String productName, String frpCode, String pri) {
|
|
|
+ public Object testUniPay(String code, String clientId, String productName, String frpCode, String pri) throws Exception {
|
|
|
return orderService.scanpay(code, clientId, productName, frpCode, pri);
|
|
|
}
|
|
|
-
|
|
|
- @ApiOperation(value = "汇付:获取code回调跳转到支付页面,用于微信扫码支付")
|
|
|
- @GetMapping("/callBack")
|
|
|
- public void callBack(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
|
- // 获取code
|
|
|
- String code = request.getParameter("code");
|
|
|
- String sn = request.getParameter("state");
|
|
|
- LambdaQueryWrapper<TOrder> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(TOrder::getSn, sn);
|
|
|
- TOrder order = orderService.getOne(wrapper);
|
|
|
- // 从临时表中获取订单信息
|
|
|
- String result = null;
|
|
|
- if (order != null) {
|
|
|
- String companyType = order.getCompanyType();
|
|
|
- if (order.getStatus() == 1) {
|
|
|
- if (StrUtil.isNotEmpty(companyType) && companyType.equals("1")) {
|
|
|
- result = HuifuConstant.SC_JUMP_URL + "/#/popPayment?status=1";
|
|
|
- } else {
|
|
|
- result = HuifuConstant.SZ_JUMP_URL + "/#/popPayment?status=1";
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 查询是否有支付参数
|
|
|
- WechatPayInfo wechatPayInfo = wechatPayInfoService.getById(sn);
|
|
|
- if (wechatPayInfo != null) {
|
|
|
- String timeStamp = wechatPayInfo.getTimeStamp();
|
|
|
- String nonceStr = wechatPayInfo.getNonceStr();
|
|
|
- String packageValue = wechatPayInfo.getPackageValue();
|
|
|
- String paySign = wechatPayInfo.getPaySign();
|
|
|
- if (StrUtil.isNotEmpty(companyType) && companyType.equals("1")) {
|
|
|
- result = HuifuConstant.SC_JUMP_URL + "/#/popPayment?" +
|
|
|
- "sn=" + sn +
|
|
|
- "&timeStamp=" + timeStamp +
|
|
|
- "&nonceStr=" + nonceStr +
|
|
|
- "&package=" + packageValue +
|
|
|
- "&paySign=" + paySign;
|
|
|
- } else {
|
|
|
- result = HuifuConstant.SZ_JUMP_URL + "/#/popPayment?" +
|
|
|
- "sn=" + sn +
|
|
|
- "&timeStamp=" + timeStamp +
|
|
|
- "&nonceStr=" + nonceStr +
|
|
|
- "&package=" + packageValue +
|
|
|
- "&paySign=" + paySign;
|
|
|
- }
|
|
|
- log.info("微信支付链接:{}", result);
|
|
|
- } else {
|
|
|
- String openid;
|
|
|
- if (StrUtil.isNotEmpty(companyType) && companyType.equals("1")) {
|
|
|
- // 获取openid
|
|
|
- try {
|
|
|
- String openUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?" +
|
|
|
- "appid=" + HuifuConstant.SC_WX_SUB_APP_ID +
|
|
|
- "&secret=" + HuifuConstant.SC_WX_APP_SECRET +
|
|
|
- "&code=" + code +
|
|
|
- "&grant_type=authorization_code";
|
|
|
- log.info("获取openID:{}", openUrl);
|
|
|
- org.json.JSONObject jsonObject = HttpClientUtils.get(openUrl);
|
|
|
- log.info("获取openID结果:{}", jsonObject);
|
|
|
- openid = jsonObject.getString("openid");
|
|
|
- result = huifuMchService.payWechat(order, openid);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 获取openid
|
|
|
- try {
|
|
|
- String openUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?" +
|
|
|
- "appid=" + HuifuConstant.SZ_WX_SUB_APP_ID +
|
|
|
- "&secret=" + HuifuConstant.SZ_WX_APP_SECRET +
|
|
|
- "&code=" + code +
|
|
|
- "&grant_type=authorization_code";
|
|
|
- log.info("获取openID:{}", openUrl);
|
|
|
- org.json.JSONObject jsonObject = HttpClientUtils.get(openUrl);
|
|
|
- log.info("获取openID结果:{}", jsonObject);
|
|
|
- openid = jsonObject.getString("openid");
|
|
|
- result = huifuMchService.payWechat(order, openid);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- log.info("支付链接:{}", result);
|
|
|
- response.sendRedirect(result);
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
|