* 2015-12-04
+ weixin4j-base:【重要】修改PayUtil中的createPayJsRequest方法的返回值为MchPayRequest,便于二次发起支付。 + weixin4j-base:【重要】添加MchPayRequest的构造函数,便于二次发起支付。 + weixin4j-qy:【重要】第三方应用授权时获取永久授权码覆盖问题。
This commit is contained in:
@@ -85,4 +85,10 @@
|
||||
|
||||
+ 调整PayUtil#createPayJsRequestJson参数位置:从主到次
|
||||
|
||||
+ 调整PayUtil#createNativePayRequestURL参数位置:从主到次
|
||||
+ 调整PayUtil#createNativePayRequestURL参数位置:从主到次
|
||||
|
||||
* 2015-12-04
|
||||
|
||||
+【重要】修改PayUtil中的createPayJsRequest方法的返回值为MchPayRequest,便于二次发起支付。
|
||||
|
||||
+【重要】添加MchPayRequest的构造函数,便于二次发起支付。
|
||||
@@ -82,12 +82,13 @@ public class PayUtil {
|
||||
String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, WeixinPayAccount weixinAccount)
|
||||
throws WeixinPayException {
|
||||
return createPayJsRequestJson(weixinAccount, openId, body, outTradeNo,
|
||||
totalFee, notifyUrl, createIp, null, null, null, null, null);
|
||||
return JSON.toJSONString(createPayJsRequest(weixinAccount, openId,
|
||||
body, outTradeNo, totalFee, notifyUrl, createIp, null, null,
|
||||
null, null, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成V3.x版本JSAPI支付字符串【完整参数】
|
||||
* 生成V3.x版本JSAPI支付对象【完整参数】
|
||||
*
|
||||
* @param weixinAccount
|
||||
* 支付配置信息
|
||||
@@ -113,14 +114,17 @@ public class PayUtil {
|
||||
* 商品标记,代金券或立减优惠功能的参数
|
||||
* @param limitPay
|
||||
* 指定支付方式:no_credit--指定不能使用信用卡支付
|
||||
* @return 支付json串
|
||||
* @see com.foxinmy.weixin4j.payment.mch.MchPayRequest
|
||||
* @return MchPayRequest对象;<font
|
||||
* color="red">注意:如果要转换为JSON格式请使用fastjson包或者直接用MchPayRequest#
|
||||
* asPayJsRequestJson方法</font>
|
||||
* @throws WeixinPayException
|
||||
*/
|
||||
public static String createPayJsRequestJson(WeixinPayAccount weixinAccount,
|
||||
String openId, String body, String outTradeNo, double totalFee,
|
||||
String notifyUrl, String createIp, String attach, Date timeStart,
|
||||
Date timeExpire, String goodsTag, String limitPay)
|
||||
throws WeixinPayException {
|
||||
public static MchPayRequest createPayJsRequest(
|
||||
WeixinPayAccount weixinAccount, String openId, String body,
|
||||
String outTradeNo, double totalFee, String notifyUrl,
|
||||
String createIp, String attach, Date timeStart, Date timeExpire,
|
||||
String goodsTag, String limitPay) throws WeixinPayException {
|
||||
MchPayPackage payPackage = new MchPayPackage(weixinAccount, openId,
|
||||
body, outTradeNo, totalFee, notifyUrl, createIp,
|
||||
TradeType.JSAPI);
|
||||
@@ -135,7 +139,7 @@ public class PayUtil {
|
||||
MchPayRequest jsPayRequest = new MchPayRequest(prePay);
|
||||
jsPayRequest.setSignType(SignType.MD5);
|
||||
jsPayRequest.setPaySign(paysignMd5(jsPayRequest, paySignKey));
|
||||
return JSON.toJSONString(jsPayRequest);
|
||||
return jsPayRequest;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,8 +3,10 @@ package com.foxinmy.weixin4j.payment.mch;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
import com.foxinmy.weixin4j.exception.WeixinPayException;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.foxinmy.weixin4j.payment.PayRequest;
|
||||
|
||||
/**
|
||||
@@ -18,7 +20,7 @@ import com.foxinmy.weixin4j.payment.PayRequest;
|
||||
* NATIVE支付:PayRequest.TradeType=NATIVE
|
||||
* </p>
|
||||
*
|
||||
* @className PayRequest
|
||||
* @className MchPayRequest
|
||||
* @author jy
|
||||
* @date 2014年8月17日
|
||||
* @since JDK 1.7
|
||||
@@ -29,18 +31,43 @@ import com.foxinmy.weixin4j.payment.PayRequest;
|
||||
public class MchPayRequest extends PayRequest {
|
||||
|
||||
private static final long serialVersionUID = -5972173459255255197L;
|
||||
|
||||
|
||||
@XmlTransient
|
||||
@JSONField(serialize = false)
|
||||
private PrePay prePay;
|
||||
|
||||
protected MchPayRequest() {
|
||||
// jaxb required
|
||||
}
|
||||
|
||||
public MchPayRequest(PrePay prePay) throws WeixinPayException {
|
||||
this.setAppId(prePay.getAppId());
|
||||
|
||||
public MchPayRequest(PrePay prePay) {
|
||||
this(prePay.getAppId(), prePay.getPrepayId());
|
||||
this.prePay = prePay;
|
||||
}
|
||||
|
||||
public MchPayRequest(String appId, String prepayId) {
|
||||
this.setAppId(appId);
|
||||
this.setPackageInfo("prepay_id=" + prePay.getPrepayId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 注意:MchPayRequest(String appId, String prepayId) 构造时 为空
|
||||
*
|
||||
* @return 预支付对象
|
||||
*/
|
||||
public PrePay getPrePay() {
|
||||
return prePay;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
@JSONField(serialize = false)
|
||||
public String asPayJsRequestJson() {
|
||||
return JSON.toJSONString(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MchPayRequest [" + super.toString() + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user