Skip to content

Fix WeChat League API URL patterns to resolve error 48001 #3651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -372,21 +372,21 @@ public interface League {
/** 添加团长商品到橱窗 */
String ADD_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/add";
/** 查询橱窗上团长商品列表 */
String LIST_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/getall";
String LIST_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/list/get";
/** 从橱窗移除团长商品 */
String REMOVE_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/remove";
/** 查询橱窗上团长商品详情 */
String GET_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/getdetail";
String GET_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/get";
/** 获取达人橱窗授权链接 */
String GET_SUPPLIER_AUTH_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/windowauth/get";
/** 获取达人橱窗授权状态 */
String GET_SUPPLIER_AUTH_STATUS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/windowauth/status/get";
/** 获取团长账户余额 */
String GET_SUPPLIER_BALANCE_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/funds/balance/get";
/** 获取资金流水详情 */
String GET_SUPPLIER_BALANCE_FLOW_DETAIL_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/funds/flowdetail/get";
String GET_SUPPLIER_BALANCE_FLOW_DETAIL_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/funds/flow/detail/get";
/** 获取资金流水列表 */
String GET_SUPPLIER_BALANCE_FLOW_LIST_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/funds/flowlist/get";
String GET_SUPPLIER_BALANCE_FLOW_LIST_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/funds/flow/list/get";
/** 获取合作商品详情 */
String GET_SUPPLIER_ITEM_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/item/get";
/** 获取合作商品列表 */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package me.chanjar.weixin.channel.test;

import me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.League;
import org.testng.Assert;
import org.testng.annotations.Test;

/**
* WeChat League API URL Pattern Validation Test
*
* This test verifies that all League API URLs follow consistent patterns
* to avoid the 48001 error (no interface permission) mentioned in issue #3630.
*/
public class LeagueUrlPatternTest {

@Test
public void testWindowUrlPatternsAreConsistent() {
// Verify that window-related URLs follow consistent patterns
String listUrl = League.LIST_SUPPLIER_GOODS_URL;
String detailUrl = League.GET_SUPPLIER_GOODS_URL;

// List URLs should end with /list/get
Assert.assertTrue(listUrl.endsWith("/list/get"),
"LIST_SUPPLIER_GOODS_URL should end with /list/get for consistency");

// Detail/Get URLs should end with /get (but not /list/get)
Assert.assertTrue(detailUrl.endsWith("/get"),
"GET_SUPPLIER_GOODS_URL should end with /get");
Assert.assertFalse(detailUrl.contains("getdetail"),
"GET_SUPPLIER_GOODS_URL should not contain 'getdetail' pattern");
}

@Test
public void testFlowUrlPatternsAreConsistent() {
// Verify that flow-related URLs follow the same pattern as other list/detail URLs
String flowDetailUrl = League.GET_SUPPLIER_BALANCE_FLOW_DETAIL_URL;
String flowListUrl = League.GET_SUPPLIER_BALANCE_FLOW_LIST_URL;

// Flow detail URL should follow proper pattern
Assert.assertTrue(flowDetailUrl.contains("/flow/detail/get"),
"Flow detail URL should use '/flow/detail/get' pattern");
Assert.assertFalse(flowDetailUrl.contains("flowdetail"),
"Flow detail URL should not use 'flowdetail' pattern");

// Flow list URL should follow proper pattern
Assert.assertTrue(flowListUrl.contains("/flow/list/get"),
"Flow list URL should use '/flow/list/get' pattern");
Assert.assertFalse(flowListUrl.contains("flowlist"),
"Flow list URL should not use 'flowlist' pattern");
}

@Test
public void testAllUrlsHaveCorrectBasePattern() {
// Verify all supplier URLs start with the correct base path
String expectedBase = "https://api.weixin.qq.com/channels/ec/league/headsupplier/";

String[] supplierUrls = {
League.ADD_SUPPLIER_GOODS_URL,
League.LIST_SUPPLIER_GOODS_URL,
League.REMOVE_SUPPLIER_GOODS_URL,
League.GET_SUPPLIER_GOODS_URL,
League.GET_SUPPLIER_AUTH_URL,
League.GET_SUPPLIER_AUTH_STATUS_URL,
League.GET_SUPPLIER_BALANCE_URL,
League.GET_SUPPLIER_BALANCE_FLOW_DETAIL_URL,
League.GET_SUPPLIER_BALANCE_FLOW_LIST_URL,
League.GET_SUPPLIER_ITEM_URL,
League.GET_SUPPLIER_ITEM_LIST_URL,
League.GET_SUPPLIER_ORDER_URL,
League.GET_SUPPLIER_ORDER_LIST_URL, // This was the working URL mentioned in the issue
League.GET_SUPPLIER_SHOP_URL,
League.GET_SUPPLIER_SHOP_LIST_URL
};

for (String url : supplierUrls) {
Assert.assertTrue(url.startsWith(expectedBase),
"URL " + url + " should start with " + expectedBase);
}
}

@Test
public void testWorkingUrlPatternIsFollowed() {
// The issue mentioned that GET_SUPPLIER_ORDER_LIST_URL works correctly
// All similar URLs should follow the same pattern
String workingUrl = League.GET_SUPPLIER_ORDER_LIST_URL;
String workingPattern = "/order/list/get";

Assert.assertTrue(workingUrl.endsWith(workingPattern),
"Working URL should end with " + workingPattern);

// Other list URLs should follow the same pattern
Assert.assertTrue(League.LIST_SUPPLIER_GOODS_URL.endsWith("/list/get"),
"LIST_SUPPLIER_GOODS_URL should follow the same pattern as working URL");
Assert.assertTrue(League.GET_SUPPLIER_ITEM_LIST_URL.endsWith("/list/get"),
"GET_SUPPLIER_ITEM_LIST_URL should follow the same pattern as working URL");
Assert.assertTrue(League.GET_SUPPLIER_SHOP_LIST_URL.endsWith("/list/get"),
"GET_SUPPLIER_SHOP_LIST_URL should follow the same pattern as working URL");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ public String toString() {
* </pre>
*/
@XStreamAlias("refund_recv_accout")
private String refundRecvAccout;
private String refundRecvAccount;

/**
* <pre>
Expand Down Expand Up @@ -324,7 +324,7 @@ public void loadXML(Document d) {
settlementRefundFee = readXmlInteger(d, "settlement_refund_fee");
refundStatus = readXmlString(d, "refund_status");
successTime = readXmlString(d, "success_time");
refundRecvAccout = readXmlString(d, "refund_recv_accout");
refundRecvAccount = readXmlString(d, "refund_recv_accout");
refundAccount = readXmlString(d, "refund_account");
refundRequestSource = readXmlString(d, "refund_request_source");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void testFromXMLFastMode() throws WxPayException {
refundNotifyResult.loadReqInfo(xmlDecryptedReqInfo);
assertEquals(refundNotifyResult.getReqInfo().getRefundFee().intValue(), 15);
assertEquals(refundNotifyResult.getReqInfo().getRefundStatus(), "SUCCESS");
assertEquals(refundNotifyResult.getReqInfo().getRefundRecvAccout(), "用户零钱");
assertEquals(refundNotifyResult.getReqInfo().getRefundRecvAccount(), "用户零钱");
System.out.println(refundNotifyResult);
} finally {
XmlConfig.fastMode = false;
Expand Down