| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.huifu.properties.HuiFuProperties; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | |
| | | @Value("${callbackPath}") |
| | | private static String callbackPath;//支付回调网关地址 |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | |
| | |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | public static ResultUtil wxPayOrder(String money, String openId, String goodsDesc, int type, String orderId, int callType) { |
| | | public ResultUtil wxPayOrder(String money, String openId, String goodsDesc, int type, String orderId, int callType) { |
| | | HttpRequest post = HttpUtil.createPost("https://api.huifu.com/v4/trade/payment/create"); |
| | | String req_seq_id = orderId + "_" + type + "_" + System.currentTimeMillis() + ToolUtil.getRandomNumber(10); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); |
| | |
| | | System.out.println(p); |
| | | post.body(p); |
| | | |
| | | |
| | | HttpResponse execute = post.execute(); |
| | | System.out.println(execute.body()); |
| | | |
| | | String randomString = ToolUtil.getRandomString(18); |
| | | redisUtil.setStrValue("dg_wx_pay:"+randomString,execute.body(),300); |
| | | JSONObject jsonObject = JSONObject.parseObject(execute.body()); |
| | | jsonObject.put("dg_wx_pay","dg_wx_pay:"+randomString); |
| | | return ResultUtil.success(jsonObject); |
| | | } |
| | | |