| | |
| | | |
| | | @ApiModelProperty("订单取消剩余倒计时") |
| | | private Long cancelCountdown; |
| | | |
| | | @ApiModelProperty(value = "用户真实ip", hidden = true) |
| | | private String clientIp; |
| | | } |
| | |
| | | return parameters; |
| | | } |
| | | public static String h5pay(String appid, String mchId, String payKey, String notifyUrl, String body, |
| | | String openid, String outTradeNo, BigDecimal money, String tradeType) { |
| | | String openid, String outTradeNo, BigDecimal money, String tradeType, String clientIp) { |
| | | String nonceStr = PayUtil.makeUUID(32); |
| | | SortedMap<Object, Object> params = new TreeMap<>(); |
| | | params.put("appid", appid); |
| | |
| | | params.put("notify_url", notifyUrl); |
| | | params.put("openid", openid); |
| | | params.put("out_trade_no", outTradeNo);// 商品订单号 |
| | | params.put("spbill_create_ip", PayUtil.getLocalIp());// 服务部署的ip |
| | | params.put("spbill_create_ip", clientIp);// 用户真实ip |
| | | params.put("total_fee", PayUtil.moneyToIntegerStr(money));// 费用的参数转型 |
| | | params.put("trade_type", tradeType);// 对接类型 |
| | | params.put("sign", PayUtil.createSign(PayCpmstant.DEFAULT_ENCODING, params, payKey));// MD5签名 |
| | |
| | | } |
| | | // 调用wx支付 |
| | | String result = WxPayUtils.h5pay(appid, mchId, payKey, notifyUrl, "点亮支付", mcsOrderVO.getOpenId(), |
| | | mcsOrder.getOrderNo(), money,mcsOrderVO.getTradeType()); |
| | | mcsOrder.getOrderNo(), money,mcsOrderVO.getTradeType(), mcsOrderVO.getClientIp()); |
| | | if (mcsOrderVO.getTradeType().equals("NATIVE")) { |
| | | JSONObject jsonObjectResult = JSONObject.parseObject(result); |
| | | result = QRCodeUtil.getBase64QRCode(jsonObjectResult.get("codeUrl").toString()); |
| | |
| | | @ApiOperation("微信支付") |
| | | @PostMapping("/wxPay") |
| | | public R wxPay(@RequestBody McsOrderVO mcsOrderVO){ |
| | | String clientIp = this.getRequest().getHeader("X-Real-IP"); |
| | | mcsOrderVO.setClientIp(clientIp); |
| | | return communityService.wxPayMscOrder(mcsOrderVO); |
| | | } |
| | | |