File tree Expand file tree Collapse file tree 5 files changed +108
-0
lines changed
weixin-java-mp/src/main/java/me/chanjar/weixin/mp Expand file tree Collapse file tree 5 files changed +108
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,16 @@ public interface WxMpConfigStorage {
8080
8181 String getAppId ();
8282
83+ /**
84+ * 服务商模式下的子商户公众账号ID
85+ */
86+ String getSubAppId ();
87+
88+ /**
89+ * 服务商模式下的子商户号
90+ */
91+ String getSubMchId ();
92+
8393 String getSecret ();
8494
8595 String getPartnerId ();
Original file line number Diff line number Diff line change 2020public class WxMpInMemoryConfigStorage implements WxMpConfigStorage {
2121
2222 protected volatile String appId ;
23+ protected volatile String subAppId ;
24+ protected volatile String subMchId ;
2325 protected volatile String secret ;
2426 protected volatile String partnerId ;
2527 protected volatile String partnerKey ;
@@ -349,4 +351,22 @@ public boolean autoRefreshToken() {
349351 public boolean useSandboxForWxPay () {
350352 return false ;
351353 }
354+
355+ @ Override
356+ public String getSubAppId () {
357+ return subAppId ;
358+ }
359+
360+ public void setSubAppId (String subAppId ) {
361+ this .subAppId = subAppId ;
362+ }
363+
364+ @ Override
365+ public String getSubMchId () {
366+ return subMchId ;
367+ }
368+
369+ public void setSubMchId (String subMchId ) {
370+ this .subMchId = subMchId ;
371+ }
352372}
Original file line number Diff line number Diff line change @@ -268,9 +268,19 @@ private void initRequest(WxPayBaseRequest request) {
268268 if (StringUtils .isBlank (request .getAppid ())) {
269269 request .setAppid (getConfig ().getAppId ());
270270 }
271+
271272 if (StringUtils .isBlank (request .getMchId ())) {
272273 request .setMchId (getConfig ().getPartnerId ());
273274 }
275+
276+ if (StringUtils .isBlank (request .getSubAppId ())) {
277+ request .setAppid (getConfig ().getSubAppId ());
278+ }
279+
280+ if (StringUtils .isBlank (request .getSubMchId ())) {
281+ request .setMchId (getConfig ().getSubMchId ());
282+ }
283+
274284 if (StringUtils .isBlank (request .getNonceStr ())) {
275285 request .setNonceStr (String .valueOf (System .currentTimeMillis ()));
276286 }
Original file line number Diff line number Diff line change @@ -47,6 +47,32 @@ public abstract class WxPayBaseRequest {
4747 */
4848 @ XStreamAlias ("mch_id" )
4949 protected String mchId ;
50+
51+ /**
52+ * <pre>
53+ * 服务商模式下的子商户公众账号ID
54+ * sub_appid
55+ * 是
56+ * String(32)
57+ * wxd678efh567hg6787
58+ * 微信分配的子商户公众账号ID
59+ * </pre>
60+ */
61+ @ XStreamAlias ("sub_appid" )
62+ protected String subAppId ;
63+
64+ /**
65+ * <pre>
66+ * 服务商模式下的子商户号
67+ * sub_mch_id
68+ * 是
69+ * String(32)
70+ * 1230000109
71+ * 微信支付分配的子商户号,开发者模式下必填
72+ * </pre>
73+ */
74+ @ XStreamAlias ("sub_mch_id" )
75+ protected String subMchId ;
5076 /**
5177 * <pre>
5278 * 随机字符串
@@ -128,6 +154,22 @@ public void setSign(String sign) {
128154 this .sign = sign ;
129155 }
130156
157+ public String getSubAppId () {
158+ return subAppId ;
159+ }
160+
161+ public void setSubAppId (String subAppId ) {
162+ this .subAppId = subAppId ;
163+ }
164+
165+ public String getSubMchId () {
166+ return subMchId ;
167+ }
168+
169+ public void setSubMchId (String subMchId ) {
170+ this .subMchId = subMchId ;
171+ }
172+
131173 @ Override
132174 public String toString () {
133175 return ToStringUtils .toSimpleString (this );
Original file line number Diff line number Diff line change @@ -61,6 +61,16 @@ public abstract class WxPayBaseResult {
6161 */
6262 @ XStreamAlias ("mch_id" )
6363 private String mchId ;
64+ /**
65+ * 服务商模式下的子公众账号ID
66+ */
67+ @ XStreamAlias ("appid" )
68+ private String subAppId ;
69+ /**
70+ * 服务商模式下的子商户号
71+ */
72+ @ XStreamAlias ("sub_mch_id" )
73+ private String subMchId ;
6474 /**
6575 * 随机字符串
6676 */
@@ -181,6 +191,22 @@ public void setSign(String sign) {
181191 this .sign = sign ;
182192 }
183193
194+ public String getSubAppId () {
195+ return subAppId ;
196+ }
197+
198+ public void setSubAppId (String subAppId ) {
199+ this .subAppId = subAppId ;
200+ }
201+
202+ public String getSubMchId () {
203+ return subMchId ;
204+ }
205+
206+ public void setSubMchId (String subMchId ) {
207+ this .subMchId = subMchId ;
208+ }
209+
184210 /**
185211 * 将bean通过保存的xml字符串转换成map
186212 */
You can’t perform that action at this time.
0 commit comments