本文整理汇总了Java中com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest类的典型用法代码示例。如果您正苦于以下问题:Java WxPayUnifiedOrderRequest类的具体用法?Java WxPayUnifiedOrderRequest怎么用?Java WxPayUnifiedOrderRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WxPayUnifiedOrderRequest类属于com.github.binarywang.wxpay.bean.request包,在下文中一共展示了WxPayUnifiedOrderRequest类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unifiedOrder
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; //导入依赖的package包/类
@Override
public WxPayUnifiedOrderResult unifiedOrder(String orderNo, TradeType tradeType, double amount, String body, String detail, String notifyUrl, String spbillCreateIp) throws WxPayException {
// String paymentId = StringUtil.uuid();
// weixinPayDao.add(paymentId, orderNo);
int totalFee = (int) DecimalUtil.multiply(amount, 100);// TODO
WxPayUnifiedOrderRequest request = new WxPayUnifiedOrderRequest();
request.setOutTradeNo(orderNo);// 商户订单号
request.setTotalFee(totalFee);// 订单总金额
request.setProductId(orderNo);// TODO 商品ID
request.setBody(body);// 商品描述
request.setDetail(detail);// 商品详细介绍
request.setNotifyURL(notifyUrl);
request.setTradeType(tradeType.getKey());// JSAPI,NATIVE,APP
request.setSpbillCreateIp(spbillCreateIp);
WxPayUnifiedOrderResult result = wxPayService.unifiedOrder(request);
Json.print(result, "result");
// wxPayService.downloadBill(billDate, billType, tarType, deviceInfo);
return result;
}
示例2: buildUnifiedOrderRequest
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; //导入依赖的package包/类
/**
* 构建微信统一下单请求数据
* @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;
}