重要:com.foxinmy.weixin4j.payment.mch.MchPayPackage构造函数新增notifyUrl支付回调URL参数

This commit is contained in:
jinyu 2015-11-21 21:47:53 +08:00
parent e6a46b1ece
commit a4d660e7b0
3 changed files with 12 additions and 12 deletions

View File

@ -17,12 +17,12 @@ import com.foxinmy.weixin4j.payment.mch.Order;
import com.foxinmy.weixin4j.payment.mch.PrePay;
import com.foxinmy.weixin4j.type.SignType;
import com.foxinmy.weixin4j.type.TradeType;
import com.foxinmy.weixin4j.util.Weixin4jConfigUtil;
import com.foxinmy.weixin4j.util.DateUtil;
import com.foxinmy.weixin4j.util.DigestUtil;
import com.foxinmy.weixin4j.util.MapUtil;
import com.foxinmy.weixin4j.util.RandomUtil;
import com.foxinmy.weixin4j.util.StringUtil;
import com.foxinmy.weixin4j.util.Weixin4jConfigUtil;
import com.foxinmy.weixin4j.xml.XmlStream;
/**
@ -81,8 +81,7 @@ public class PayUtil {
String orderNo, double orderFee, String notifyUrl, String ip,
WeixinPayAccount weixinAccount) throws PayException {
MchPayPackage payPackage = new MchPayPackage(weixinAccount, openId,
body, orderNo, orderFee, ip, TradeType.JSAPI);
payPackage.setNotifyUrl(notifyUrl);
body, orderNo, orderFee, notifyUrl, ip, TradeType.JSAPI);
return createPayJsRequestJson(payPackage, weixinAccount);
}
@ -228,6 +227,8 @@ public class PayUtil {
* 商户内部唯一订单号
* @param totalFee
* 商品总额 单位元
* @param notifyUrl
* 支付回调URL
* @param createIp
* 订单生成的机器 IP
* @return 支付链接
@ -238,10 +239,10 @@ public class PayUtil {
*/
public static String createNativePayRequestURL(
WeixinPayAccount weixinAccount, String productId, String body,
String outTradeNo, double totalFee, String createIp)
throws PayException {
String outTradeNo, double totalFee, String notifyUrl,
String createIp) throws PayException {
MchPayPackage payPackage = new MchPayPackage(weixinAccount, null, body,
outTradeNo, totalFee, createIp, TradeType.NATIVE);
outTradeNo, totalFee, createIp, notifyUrl, TradeType.NATIVE);
payPackage.setProductId(productId);
String paySignKey = weixinAccount.getPaySignKey();
payPackage.setSign(paysignMd5(payPackage, paySignKey));

View File

@ -69,7 +69,7 @@ public class MchPayPackage extends PayPackage {
@JSONField(name = "openid")
private String openId;
/**
* 只在 trade_type NATIVE 时需要填写 非必须
* 只在 trade_type NATIVE 模式一 时需要填写 非必须
*/
@XmlElement(name = "product_id")
@JSONField(name = "product_id")
@ -80,10 +80,10 @@ public class MchPayPackage extends PayPackage {
}
public MchPayPackage(WeixinPayAccount weixinAccount, String openId,
String body, String outTradeNo, double totalFee,
String body, String outTradeNo, double totalFee, String notifyUrl,
String spbillCreateIp, TradeType tradeType) {
this(weixinAccount, openId, body, null, outTradeNo, totalFee, null,
spbillCreateIp, tradeType);
this(weixinAccount, openId, body, null, outTradeNo, totalFee,
notifyUrl, spbillCreateIp, tradeType);
}
public MchPayPackage(WeixinPayAccount weixinAccount, String openId,

View File

@ -137,9 +137,8 @@ public class PayTest {
public void nativeV3() throws WeixinException {
MchPayPackage payPackageV3 = new MchPayPackage(ACCOUNT3,
"oyFLst1bqtuTcxK-ojF8hOGtLQao", "native测试", "T0001", 0.1d,
"127.0.0.1", TradeType.NATIVE);
"notify_url", "127.0.0.1", TradeType.NATIVE);
payPackageV3.setProductId("0001");
payPackageV3.setNotifyUrl("xxxx");
PrePay prePay = null;
try {
prePay = PayUtil.createPrePay(payPackageV3,