fixed #92,#93
This commit is contained in:
parent
a443c29d23
commit
80b121b5af
@ -121,7 +121,7 @@ public class MchApi extends BaseApi {
|
|||||||
merchant.setAppId(weixinAccount.getId());
|
merchant.setAppId(weixinAccount.getId());
|
||||||
merchant.setMchId(weixinAccount.getMchId());
|
merchant.setMchId(weixinAccount.getMchId());
|
||||||
merchant.setDeviceInfo(weixinAccount.getDeviceInfo());
|
merchant.setDeviceInfo(weixinAccount.getDeviceInfo());
|
||||||
merchant.setSubId(weixinAccount.getSubId());
|
merchant.setSubAppId(weixinAccount.getSubId());
|
||||||
merchant.setSubMchId(weixinAccount.getSubMchId());
|
merchant.setSubMchId(weixinAccount.getSubMchId());
|
||||||
merchant.setNonceStr(RandomUtil.generateString(16));
|
merchant.setNonceStr(RandomUtil.generateString(16));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson.TypeReference;
|
import com.alibaba.fastjson.TypeReference;
|
||||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||||
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
||||||
@ -107,7 +108,10 @@ public class PayApi extends MchApi {
|
|||||||
String tradeType = payPackage.getTradeType().toUpperCase();
|
String tradeType = payPackage.getTradeType().toUpperCase();
|
||||||
if (TradeType.MICROPAY.name().equals(tradeType)) {
|
if (TradeType.MICROPAY.name().equals(tradeType)) {
|
||||||
super.declareMerchant(payPackage);
|
super.declareMerchant(payPackage);
|
||||||
payPackage.setSign(weixinSignature.sign(payPackage));
|
JSONObject _payPackage = (JSONObject) JSON.toJSON(payPackage);
|
||||||
|
// 不需要设置TradeType参数
|
||||||
|
_payPackage.remove("tradeType");
|
||||||
|
payPackage.setSign(weixinSignature.sign(_payPackage));
|
||||||
String para = XmlStream.toXML(payPackage);
|
String para = XmlStream.toXML(payPackage);
|
||||||
WeixinResponse response = weixinExecutor.post(
|
WeixinResponse response = weixinExecutor.post(
|
||||||
getRequestUri("micropay_uri"), para);
|
getRequestUri("micropay_uri"), para);
|
||||||
|
|||||||
@ -145,9 +145,6 @@ public class MchPayPackage extends PayPackage {
|
|||||||
String goodsTag, String limitPay, String subOpenId) {
|
String goodsTag, String limitPay, String subOpenId) {
|
||||||
super(body, detial, outTradeNo, totalFee, notifyUrl, createIp, attach,
|
super(body, detial, outTradeNo, totalFee, notifyUrl, createIp, attach,
|
||||||
timeStart, timeExpire, goodsTag);
|
timeStart, timeExpire, goodsTag);
|
||||||
if (tradeType.isPayRequestParameter()) {
|
|
||||||
this.tradeType = tradeType.name();
|
|
||||||
}
|
|
||||||
this.openId = openId;
|
this.openId = openId;
|
||||||
this.authCode = authCode;
|
this.authCode = authCode;
|
||||||
this.productId = productId;
|
this.productId = productId;
|
||||||
|
|||||||
@ -39,9 +39,9 @@ public class MerchantResult extends XmlResult {
|
|||||||
/**
|
/**
|
||||||
* 微信分配的子商户公众账号ID 非必须
|
* 微信分配的子商户公众账号ID 非必须
|
||||||
*/
|
*/
|
||||||
@XmlElement(name = "sub_id")
|
@XmlElement(name = "sub_appid")
|
||||||
@JSONField(name = "sub_id")
|
@JSONField(name = "sub_appid")
|
||||||
private String subId;
|
private String subAppId;
|
||||||
/**
|
/**
|
||||||
* 微信支付分配的子商户号 非必须
|
* 微信支付分配的子商户号 非必须
|
||||||
*/
|
*/
|
||||||
@ -99,12 +99,12 @@ public class MerchantResult extends XmlResult {
|
|||||||
this.mchId = mchId;
|
this.mchId = mchId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSubId() {
|
public String getSubAppId() {
|
||||||
return subId;
|
return subAppId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSubId(String subId) {
|
public void setSubAppId(String subAppId) {
|
||||||
this.subId = subId;
|
this.subAppId = subAppId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSubMchId() {
|
public String getSubMchId() {
|
||||||
@ -168,7 +168,7 @@ public class MerchantResult extends XmlResult {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "appId=" + appId + ", mchId=" + mchId + ", subId=" + subId
|
return "appId=" + appId + ", mchId=" + mchId + ", subAppId=" + subAppId
|
||||||
+ ", subMchId=" + subMchId + ", nonceStr=" + nonceStr
|
+ ", subMchId=" + subMchId + ", nonceStr=" + nonceStr
|
||||||
+ ", sign=" + sign + ", deviceInfo=" + deviceInfo + ", recall="
|
+ ", sign=" + sign + ", deviceInfo=" + deviceInfo + ", recall="
|
||||||
+ getFormatRecall() + ", " + super.toString();
|
+ getFormatRecall() + ", " + super.toString();
|
||||||
|
|||||||
@ -13,36 +13,21 @@ public enum TradeType {
|
|||||||
/**
|
/**
|
||||||
* JS支付
|
* JS支付
|
||||||
*/
|
*/
|
||||||
JSAPI(true),
|
JSAPI,
|
||||||
/**
|
/**
|
||||||
* 刷卡支付:不需要设置TradeType参数
|
* 刷卡支付
|
||||||
*/
|
*/
|
||||||
MICROPAY(false),
|
MICROPAY,
|
||||||
/**
|
/**
|
||||||
* 扫码支付
|
* 扫码支付
|
||||||
*/
|
*/
|
||||||
NATIVE(true),
|
NATIVE,
|
||||||
/**
|
/**
|
||||||
* APP支付
|
* APP支付
|
||||||
*/
|
*/
|
||||||
APP(true),
|
APP,
|
||||||
/**
|
/**
|
||||||
* WAP支付
|
* WAP支付
|
||||||
*/
|
*/
|
||||||
WAP(true);
|
WAP;
|
||||||
|
|
||||||
boolean isPayRequestParameter;
|
|
||||||
|
|
||||||
private TradeType(boolean isPayRequestParameter) {
|
|
||||||
this.isPayRequestParameter = isPayRequestParameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否作为支付请求参数
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isPayRequestParameter() {
|
|
||||||
return isPayRequestParameter;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class PartyApi extends QyApi {
|
|||||||
/**
|
/**
|
||||||
* 创建部门(根部门的parentid为1)
|
* 创建部门(根部门的parentid为1)
|
||||||
*
|
*
|
||||||
* @param depart
|
* @param party
|
||||||
* 部门对象
|
* 部门对象
|
||||||
* @see com.foxinmy.weixin4j.qy.model.Party
|
* @see com.foxinmy.weixin4j.qy.model.Party
|
||||||
* @see <a
|
* @see <a
|
||||||
@ -59,7 +59,7 @@ public class PartyApi extends QyApi {
|
|||||||
/**
|
/**
|
||||||
* 更新部门(如果非必须的字段未指定 则不更新该字段之前的设置值)
|
* 更新部门(如果非必须的字段未指定 则不更新该字段之前的设置值)
|
||||||
*
|
*
|
||||||
* @param depart
|
* @param party
|
||||||
* 部门对象
|
* 部门对象
|
||||||
* @see com.foxinmy.weixin4j.qy.model.Party
|
* @see com.foxinmy.weixin4j.qy.model.Party
|
||||||
* @see <a
|
* @see <a
|
||||||
|
|||||||
@ -37,7 +37,7 @@ public class TagApi extends QyApi {
|
|||||||
* 创建标签(创建的标签属于管理组;默认为加锁状态。加锁状态下只有本管理组才可以增删成员,解锁状态下其它管理组也可以增删成员)
|
* 创建标签(创建的标签属于管理组;默认为加锁状态。加锁状态下只有本管理组才可以增删成员,解锁状态下其它管理组也可以增删成员)
|
||||||
*
|
*
|
||||||
* @param tag
|
* @param tag
|
||||||
* 标签对象;</br> 标签名称,长度为1~64个字节,标签名不可与其他标签重名;</br> 标签id,整型,
|
* 标签对象;</br> 标签名称,长度限制为32个字(汉字或英文字母),标签名不可与其他标签重名。</br> 标签id,整型,
|
||||||
* 指定此参数时新增的标签会生成对应的标签id,不指定时则以目前最大的id自增。
|
* 指定此参数时新增的标签会生成对应的标签id,不指定时则以目前最大的id自增。
|
||||||
* @see <a href=
|
* @see <a href=
|
||||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.9B.E5.BB.BA.E6.A0.87.E7.AD.BE">
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E5.88.9B.E5.BB.BA.E6.A0.87.E7.AD.BE">
|
||||||
|
|||||||
@ -22,7 +22,7 @@ public class Party implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private int id;
|
private int id;
|
||||||
/**
|
/**
|
||||||
* 部门名称。长度限制为1~64个字符
|
* 部门名称。长度限制为32个字(汉字或英文字母),字符不能包括\:*?"<>|
|
||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user