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.setMchId(weixinAccount.getMchId());
|
||||
merchant.setDeviceInfo(weixinAccount.getDeviceInfo());
|
||||
merchant.setSubId(weixinAccount.getSubId());
|
||||
merchant.setSubAppId(weixinAccount.getSubId());
|
||||
merchant.setSubMchId(weixinAccount.getSubMchId());
|
||||
merchant.setNonceStr(RandomUtil.generateString(16));
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||
import com.foxinmy.weixin4j.http.weixin.WeixinResponse;
|
||||
@ -107,7 +108,10 @@ public class PayApi extends MchApi {
|
||||
String tradeType = payPackage.getTradeType().toUpperCase();
|
||||
if (TradeType.MICROPAY.name().equals(tradeType)) {
|
||||
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);
|
||||
WeixinResponse response = weixinExecutor.post(
|
||||
getRequestUri("micropay_uri"), para);
|
||||
|
||||
@ -145,9 +145,6 @@ public class MchPayPackage extends PayPackage {
|
||||
String goodsTag, String limitPay, String subOpenId) {
|
||||
super(body, detial, outTradeNo, totalFee, notifyUrl, createIp, attach,
|
||||
timeStart, timeExpire, goodsTag);
|
||||
if (tradeType.isPayRequestParameter()) {
|
||||
this.tradeType = tradeType.name();
|
||||
}
|
||||
this.openId = openId;
|
||||
this.authCode = authCode;
|
||||
this.productId = productId;
|
||||
|
||||
@ -39,9 +39,9 @@ public class MerchantResult extends XmlResult {
|
||||
/**
|
||||
* 微信分配的子商户公众账号ID 非必须
|
||||
*/
|
||||
@XmlElement(name = "sub_id")
|
||||
@JSONField(name = "sub_id")
|
||||
private String subId;
|
||||
@XmlElement(name = "sub_appid")
|
||||
@JSONField(name = "sub_appid")
|
||||
private String subAppId;
|
||||
/**
|
||||
* 微信支付分配的子商户号 非必须
|
||||
*/
|
||||
@ -99,12 +99,12 @@ public class MerchantResult extends XmlResult {
|
||||
this.mchId = mchId;
|
||||
}
|
||||
|
||||
public String getSubId() {
|
||||
return subId;
|
||||
public String getSubAppId() {
|
||||
return subAppId;
|
||||
}
|
||||
|
||||
public void setSubId(String subId) {
|
||||
this.subId = subId;
|
||||
public void setSubAppId(String subAppId) {
|
||||
this.subAppId = subAppId;
|
||||
}
|
||||
|
||||
public String getSubMchId() {
|
||||
@ -168,7 +168,7 @@ public class MerchantResult extends XmlResult {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "appId=" + appId + ", mchId=" + mchId + ", subId=" + subId
|
||||
return "appId=" + appId + ", mchId=" + mchId + ", subAppId=" + subAppId
|
||||
+ ", subMchId=" + subMchId + ", nonceStr=" + nonceStr
|
||||
+ ", sign=" + sign + ", deviceInfo=" + deviceInfo + ", recall="
|
||||
+ getFormatRecall() + ", " + super.toString();
|
||||
|
||||
@ -2,7 +2,7 @@ package com.foxinmy.weixin4j.type;
|
||||
|
||||
/**
|
||||
* 微信支付类型
|
||||
*
|
||||
*
|
||||
* @className TradeType
|
||||
* @author jinyu(foxinmy@gmail.com)
|
||||
* @date 2014年10月21日
|
||||
@ -10,39 +10,24 @@ package com.foxinmy.weixin4j.type;
|
||||
* @see
|
||||
*/
|
||||
public enum TradeType {
|
||||
/**
|
||||
* JS支付
|
||||
*/
|
||||
JSAPI(true),
|
||||
/**
|
||||
* 刷卡支付:不需要设置TradeType参数
|
||||
*/
|
||||
MICROPAY(false),
|
||||
/**
|
||||
* 扫码支付
|
||||
*/
|
||||
NATIVE(true),
|
||||
/**
|
||||
* APP支付
|
||||
*/
|
||||
APP(true),
|
||||
/**
|
||||
* WAP支付
|
||||
*/
|
||||
WAP(true);
|
||||
|
||||
boolean isPayRequestParameter;
|
||||
|
||||
private TradeType(boolean isPayRequestParameter) {
|
||||
this.isPayRequestParameter = isPayRequestParameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否作为支付请求参数
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isPayRequestParameter() {
|
||||
return isPayRequestParameter;
|
||||
}
|
||||
/**
|
||||
* JS支付
|
||||
*/
|
||||
JSAPI,
|
||||
/**
|
||||
* 刷卡支付
|
||||
*/
|
||||
MICROPAY,
|
||||
/**
|
||||
* 扫码支付
|
||||
*/
|
||||
NATIVE,
|
||||
/**
|
||||
* APP支付
|
||||
*/
|
||||
APP,
|
||||
/**
|
||||
* WAP支付
|
||||
*/
|
||||
WAP;
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ import com.foxinmy.weixin4j.token.TokenManager;
|
||||
|
||||
/**
|
||||
* 部门API
|
||||
*
|
||||
*
|
||||
* @className PartyApi
|
||||
* @author jinyu(foxinmy@gmail.com)
|
||||
* @date 2014年11月18日
|
||||
@ -31,8 +31,8 @@ public class PartyApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 创建部门(根部门的parentid为1)
|
||||
*
|
||||
* @param depart
|
||||
*
|
||||
* @param party
|
||||
* 部门对象
|
||||
* @see com.foxinmy.weixin4j.qy.model.Party
|
||||
* @see <a
|
||||
@ -58,8 +58,8 @@ public class PartyApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 更新部门(如果非必须的字段未指定 则不更新该字段之前的设置值)
|
||||
*
|
||||
* @param depart
|
||||
*
|
||||
* @param party
|
||||
* 部门对象
|
||||
* @see com.foxinmy.weixin4j.qy.model.Party
|
||||
* @see <a
|
||||
@ -88,7 +88,7 @@ public class PartyApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 查询部门列表(以部门的order字段从小到大排列)
|
||||
*
|
||||
*
|
||||
* @param partId
|
||||
* 部门ID。获取指定部门ID下的子部门 传入0表示获取全部子部门
|
||||
* @see com.foxinmy.weixin4j.qy.model.Party
|
||||
@ -111,7 +111,7 @@ public class PartyApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 删除部门(不能删除根部门;不能删除含有子部门、成员的部门)
|
||||
*
|
||||
*
|
||||
* @param partId
|
||||
* 部门ID
|
||||
* @see <a
|
||||
|
||||
@ -17,7 +17,7 @@ import com.foxinmy.weixin4j.token.TokenManager;
|
||||
|
||||
/**
|
||||
* 标签API
|
||||
*
|
||||
*
|
||||
* @className TagApi
|
||||
* @author jinyu(foxinmy@gmail.com)
|
||||
* @date 2014年11月19日
|
||||
@ -35,9 +35,9 @@ public class TagApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 创建标签(创建的标签属于管理组;默认为加锁状态。加锁状态下只有本管理组才可以增删成员,解锁状态下其它管理组也可以增删成员)
|
||||
*
|
||||
*
|
||||
* @param tag
|
||||
* 标签对象;</br> 标签名称,长度为1~64个字节,标签名不可与其他标签重名;</br> 标签id,整型,
|
||||
* 标签对象;</br> 标签名称,长度限制为32个字(汉字或英文字母),标签名不可与其他标签重名。</br> 标签id,整型,
|
||||
* 指定此参数时新增的标签会生成对应的标签id,不指定时则以目前最大的id自增。
|
||||
* @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">
|
||||
@ -60,7 +60,7 @@ public class TagApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 更新标签(管理组必须是指定标签的创建者)
|
||||
*
|
||||
*
|
||||
* @param tag
|
||||
* 标签信息
|
||||
* @see <a href=
|
||||
@ -81,7 +81,7 @@ public class TagApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 删除标签(管理组必须是指定标签的创建者,并且标签的成员列表为空。)
|
||||
*
|
||||
*
|
||||
* @param tagId
|
||||
* 标签ID
|
||||
* @return 处理结果
|
||||
@ -100,7 +100,7 @@ public class TagApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 获取标签列表
|
||||
*
|
||||
*
|
||||
* @see <a href=
|
||||
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E7%AE%A1%E7%90%86%E6%A0%87%E7%AD%BE#.E8.8E.B7.E5.8F.96.E6.A0.87.E7.AD.BE.E5.88.97.E8.A1.A8">
|
||||
* 获取标签列表说明</a>
|
||||
@ -119,7 +119,7 @@ public class TagApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 获取标签成员(管理组须拥有“获取标签成员”的接口权限,返回列表仅包含管理组管辖范围的成员。)
|
||||
*
|
||||
*
|
||||
* @param tagId
|
||||
* 标签ID
|
||||
* @see com.foxinmy.weixin4j.qy.model.Contacts
|
||||
@ -147,7 +147,7 @@ public class TagApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 新增标签成员(标签对管理组可见且未加锁,成员属于管理组管辖范围。)
|
||||
*
|
||||
*
|
||||
* @param tagId
|
||||
* 标签ID
|
||||
* @param userIds
|
||||
@ -169,7 +169,7 @@ public class TagApi extends QyApi {
|
||||
|
||||
/**
|
||||
* 删除标签成员(标签对管理组未加锁,成员属于管理组管辖范围)<br>
|
||||
*
|
||||
*
|
||||
* @param tagId
|
||||
* 标签ID
|
||||
* @param userIds
|
||||
|
||||
@ -6,7 +6,7 @@ import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* 部门对象
|
||||
*
|
||||
*
|
||||
* @className Party
|
||||
* @author jinyu(foxinmy@gmail.com)
|
||||
* @date 2014年11月18日
|
||||
@ -22,7 +22,7 @@ public class Party implements Serializable {
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* 部门名称。长度限制为1~64个字符
|
||||
* 部门名称。长度限制为32个字(汉字或英文字母),字符不能包括\:*?"<>|
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user