Java Code Examples for com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest#setSceneInfo()
The following examples show how to use
com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest#setSceneInfo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WxUnifiedOrderServiceImpl.java From fw-cloud-framework with MIT License | 4 votes |
/** * 构建微信统一下单请求数据 */ private WxPayUnifiedOrderRequest buildUnifiedOrderRequest(PayOrder payOrder, WxPayConfig wxPayConfig) { String tradeType = wxPayConfig.getTradeType(); String payOrderId = payOrder.getPayOrderId(); Integer totalFee = payOrder.getAmount().intValue();// 支付金额,单位分 String deviceInfo = payOrder.getDevice(); String body = payOrder.getBody(); String detail = null; String attach = null; String outTradeNo = payOrderId; String feeType = "CNY"; String spBillCreateIP = payOrder.getIp(); String timeStart = null; String timeExpire = null; String goodsTag = null; String notifyUrl = wxPayConfig.getNotifyUrl(); String productId = null; if (tradeType.equals(PayConstant.WxConstant.TRADE_TYPE_NATIVE)) productId = JSON.parseObject(payOrder.getExtra()).getString("productId"); String limitPay = null; String openId = null; if (tradeType.equals(PayConstant.WxConstant.TRADE_TYPE_JSPAI)) openId = JSON.parseObject(payOrder.getExtra()).getString("openId"); String sceneInfo = null; if (tradeType.equals(PayConstant.WxConstant.TRADE_TYPE_MWEB)) { JSONObject extraObject = JSON.parseObject(WebUtils.buildURLDecoder(payOrder.getExtra())); sceneInfo = extraObject.getJSONObject("sceneInfo").toJSONString(); } // 微信统一下单请求对象 WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest(); request.setDeviceInfo(deviceInfo); request.setBody(body); request.setDetail(detail); request.setAttach(attach); request.setOutTradeNo(outTradeNo); request.setFeeType(feeType); request.setTotalFee(totalFee); request.setSpbillCreateIp(spBillCreateIP); request.setTimeStart(timeStart); request.setTimeExpire(timeExpire); request.setGoodsTag(goodsTag); request.setNotifyUrl(notifyUrl); request.setTradeType(tradeType); request.setProductId(productId); request.setLimitPay(limitPay); request.setOpenid(openId); request.setSceneInfo(sceneInfo); return request; }
Example 2
Source File: PayChannel4WxServiceImpl.java From xxpay-master with MIT License | 4 votes |
/** * 构建微信统一下单请求数据 * @param payOrder * @param wxPayConfig * @return */ WxPayUnifiedOrderRequest buildUnifiedOrderRequest(PayOrder payOrder, WxPayConfig wxPayConfig) { String tradeType = wxPayConfig.getTradeType(); String payOrderId = payOrder.getPayOrderId(); Integer totalFee = payOrder.getAmount().intValue();// 支付金额,单位分 String deviceInfo = payOrder.getDevice(); String body = payOrder.getBody(); String detail = null; String attach = null; String outTradeNo = payOrderId; String feeType = "CNY"; String spBillCreateIP = payOrder.getClientIp(); String timeStart = null; String timeExpire = null; String goodsTag = null; String notifyUrl = wxPayConfig.getNotifyUrl(); String productId = null; if(tradeType.equals(PayConstant.WxConstant.TRADE_TYPE_NATIVE)) productId = JSON.parseObject(payOrder.getExtra()).getString("productId"); String limitPay = null; String openId = null; if(tradeType.equals(PayConstant.WxConstant.TRADE_TYPE_JSPAI)) openId = JSON.parseObject(payOrder.getExtra()).getString("openId"); String sceneInfo = null; if(tradeType.equals(PayConstant.WxConstant.TRADE_TYPE_MWEB)) sceneInfo = JSON.parseObject(payOrder.getExtra()).getString("sceneInfo"); // 微信统一下单请求对象 WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest(); request.setDeviceInfo(deviceInfo); request.setBody(body); request.setDetail(detail); request.setAttach(attach); request.setOutTradeNo(outTradeNo); request.setFeeType(feeType); request.setTotalFee(totalFee); request.setSpbillCreateIp(spBillCreateIP); request.setTimeStart(timeStart); request.setTimeExpire(timeExpire); request.setGoodsTag(goodsTag); request.setNotifyURL(notifyUrl); request.setTradeType(tradeType); request.setProductId(productId); request.setLimitPay(limitPay); request.setOpenid(openId); request.setSceneInfo(sceneInfo); return request; }
Example 3
Source File: PayChannel4WxController.java From xxpay-master with MIT License | 4 votes |
/** * 构建微信统一下单请求数据 * @param payOrder * @param wxPayConfig * @return */ WxPayUnifiedOrderRequest buildUnifiedOrderRequest(PayOrder payOrder, WxPayConfig wxPayConfig) { String tradeType = wxPayConfig.getTradeType(); String payOrderId = payOrder.getPayOrderId(); Integer totalFee = payOrder.getAmount().intValue();// 支付金额,单位分 String deviceInfo = payOrder.getDevice(); String body = payOrder.getBody(); String detail = null; String attach = null; String outTradeNo = payOrderId; String feeType = "CNY"; String spBillCreateIP = payOrder.getClientIp(); String timeStart = null; String timeExpire = null; String goodsTag = null; String notifyUrl = wxPayConfig.getNotifyUrl(); String productId = null; if(tradeType.equals(PayConstant.WxConstant.TRADE_TYPE_NATIVE)) productId = JSON.parseObject(payOrder.getExtra()).getString("productId"); String limitPay = null; String openId = null; if(tradeType.equals(PayConstant.WxConstant.TRADE_TYPE_JSPAI)) openId = JSON.parseObject(payOrder.getExtra()).getString("openId"); String sceneInfo = null; if(tradeType.equals(PayConstant.WxConstant.TRADE_TYPE_MWEB)) sceneInfo = JSON.parseObject(payOrder.getExtra()).getString("sceneInfo"); // 微信统一下单请求对象 WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest(); request.setDeviceInfo(deviceInfo); request.setBody(body); request.setDetail(detail); request.setAttach(attach); request.setOutTradeNo(outTradeNo); request.setFeeType(feeType); request.setTotalFee(totalFee); request.setSpbillCreateIp(spBillCreateIP); request.setTimeStart(timeStart); request.setTimeExpire(timeExpire); request.setGoodsTag(goodsTag); request.setNotifyURL(notifyUrl); request.setTradeType(tradeType); request.setProductId(productId); request.setLimitPay(limitPay); request.setOpenid(openId); request.setSceneInfo(sceneInfo); return request; }