Repository navigation
feat(pay): 支持连锁品牌入驻、门店管理和分账 - #4139
binarywang wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6512b7184e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @Getter | ||
| private final BrandApplymentService brandApplymentService = new BrandApplymentServiceImpl(this); | ||
|
|
||
| @Getter | ||
| private final BrandStoreService brandStoreService = new BrandStoreServiceImpl(this); | ||
|
|
||
| @Getter | ||
| private final BrandProfitSharingService brandProfitSharingService = new BrandProfitSharingServiceImpl(this); |
There was a problem hiding this comment.
当调用方使用 WxPayServiceJoddHttpImpl 时,这三个新增服务虽然都会被创建并由兼容性测试判定可用,但其依赖的 postV3、patchV3、postV3WithWechatpaySerial、requestV3 和 getV3 在该客户端中仍直接返回 null;因此查询和创建操作不会发出请求而只返回 null,门店删除甚至会无请求地正常返回,导致调用方误以为删除成功。请补齐 Jodd 的 V3 执行能力,或至少明确拒绝该客户端而不是暴露一个静默失效的服务。
AGENTS.md reference: AGENTS.md:L55-L56
Useful? React with 👍 / 👎.
| import org.testng.annotations.Test; | ||
|
|
||
| /** 连锁品牌服务入口兼容性测试。 */ | ||
| public class BrandServiceEntryTest { |
There was a problem hiding this comment.
weixin-java-pay/pom.xml 通过 suiteXmlFiles 固定运行 src/test/resources/testng.xml,但本次新增的四个测试类均未登记到该文件,因此常规的 mvn -pl weixin-java-pay -am test 不会执行它们;提交说明中的 -Dtest=... 能运行是因为该参数会覆盖 suiteXmlFiles,这也符合 Maven Surefire 参数文档 的说明。请把这些类加入套件,否则后续回归(包括上述 Jodd 静默失效)无法由默认 CI 发现。
AGENTS.md reference: AGENTS.md:L63-L64
Useful? React with 👍 / 👎.
| 查询品牌入驻申请: | ||
|
|
||
| ```java | ||
| BrandApplymentQueryResult application = applyments.queryApplymentByBusinessCode("brand-application-001"); |
There was a problem hiding this comment.
这里的示例值包含连字符,但 queryApplymentByBusinessCode 的 Javadoc 及微信支付的官方接口契约都规定 business_code 只能由数字、字母或下划线组成;用户直接照抄文档会得到 PARAM_ERROR。请改为例如 brand_application_001 的合法值。
AGENTS.md reference: AGENTS.md:L53-L54
Useful? React with 👍 / 👎.
|
|
||
| @Override | ||
| public BrandProfitSharingReceiverResult addReceiver(BrandProfitSharingReceiverRequest request) throws WxPayException { | ||
| return GSON.fromJson(this.payService.postV3(url("/receivers/add"), GSON.toJson(request)), |
There was a problem hiding this comment.
当 type 为 PERSONAL_OPENID 或 PERSONAL_SUB_OPENID 时,这里的 JSON 包含明文 name 和可识别用户的 account,而两个实际可用的 Apache 客户端都会在 postV3 成功和异常路径中以 INFO/ERROR 记录完整的 requestStr;每次添加个人接收方都会因此把姓名和 OpenID 持久化到应用日志。请在进入通用日志链路前对这些字段脱敏,或提供不会记录敏感请求体的发送路径,同时保持实际签名和请求体不变。
AGENTS.md reference: AGENTS.md:L58-L59
Useful? React with 👍 / 👎.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🤖 Augment PR Summary摘要:补齐微信支付服务商模式下的连锁品牌接口,覆盖品牌入驻、门店管理和分账。
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
Copilot review overview
1 open finding
What changed in this PR
Adds offline contract coverage and production implementations for WeChat Pay “chain brand” capabilities (brand applyment, brand store management, and chain-brand profit sharing), plus documentation and service entrypoints.
Changes:
- Introduces new
BrandApplymentService,BrandStoreService, andBrandProfitSharingServiceAPIs with corresponding impls and request/response beans. - Wires the new services into
WxPayService(default methods) andBaseWxPayServiceImpl(cached getters). - Adds TestNG offline contract tests and a usage guide doc.
| File | Description |
|---|---|
| weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BrandStoreServiceTest.java | Adds offline contract tests for brand store CRUD + recipient binding/unbinding. |
| weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BrandServiceEntryTest.java | Verifies service entrypoints are exposed across supported WxPayService implementations. |
| weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BrandProfitSharingServiceTest.java | Adds offline contract tests for chain-brand profit sharing routes, encryption, and notify parsing. |
| weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/BrandApplymentServiceTest.java | Adds offline contract tests for brand applyment encryption, routing, and error propagation. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BrandStoreServiceImpl.java | Implements brand store API calls, including DELETE-with-body support. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BrandProfitSharingServiceImpl.java | Implements chain-brand profit sharing APIs, including field encryption and notify parsing delegation. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BrandApplymentServiceImpl.java | Implements brand applyment APIs, including request encryption without mutating caller objects. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java | Adds cached getters for the new brand services. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java | Adds default interface methods to access the new brand services for compatibility. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/BrandStoreService.java | Declares brand store service API. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/BrandProfitSharingService.java | Declares chain-brand profit sharing service API. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/BrandApplymentService.java | Declares brand applyment service API. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandstore/BrandStoreUnbindRecipientResult.java | Adds unbind-recipient response model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandstore/BrandStoreUnbindRecipientRequest.java | Adds unbind-recipient request model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandstore/BrandStoreResult.java | Adds store create/query/update response model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandstore/BrandStoreRequest.java | Adds store create/update request model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandstore/BrandStoreRecipient.java | Adds bound-recipient model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandstore/BrandStoreBusiness.java | Adds store business info model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandstore/BrandStoreBindRecipientResult.java | Adds bind-recipient response model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandstore/BrandStoreBindRecipientRequest.java | Adds bind-recipient request model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandstore/BrandStoreBasics.java | Adds store basics model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandstore/BrandStoreAddress.java | Adds store address model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingReturnResult.java | Adds profit sharing return response model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingReturnRequest.java | Adds profit sharing return request model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingReturnQueryRequest.java | Adds profit sharing return query request model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingResult.java | Adds profit sharing query/result model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingRequest.java | Adds profit sharing create request model with encrypted fields. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingReceiverResult.java | Adds receiver add/delete result model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingReceiverRequest.java | Adds receiver add request model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingReceiverDeleteRequest.java | Adds receiver delete request model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingRatioResult.java | Adds max ratio response model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingQueryRequest.java | Adds profit sharing query request model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingFinishResult.java | Adds finish response model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingFinishRequest.java | Adds finish request model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandprofitsharing/BrandProfitSharingAmountResult.java | Adds remaining-amount response model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandapplyment/BrandApplymentResult.java | Adds brand applyment create/cancel response model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandapplyment/BrandApplymentRequest.java | Adds brand applyment request model with encrypted fields. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandapplyment/BrandApplymentQueryResult.java | Adds brand applyment status response model. |
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/brandapplyment/BrandApplymentCancelRequest.java | Adds brand applyment cancel request model. |
| docs/WECHAT_PAY_CHAIN_BRAND_USAGE.md | Adds end-user documentation for accessing and using the new services. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| /** | ||
| * 根据业务申请编号查询申请状态。 | ||
| * | ||
| * @param businessCode 服务商自定义的业务申请编号,仅包含数字、字母或下划线 |

WxJava 尚未封装服务商模式下的连锁品牌接口。此 PR 增加品牌入驻(4 项)、门店管理(6 项)和连锁品牌分账(9 项)三个独立服务,支持分账通知验签与解密,并通过 WxPayService 提供入口。
敏感字段自动加密且不修改调用方请求,允许使用同一对象重试。门店删除保留官方要求的 JSON 请求体;保持 Java 8 兼容,无新增依赖,原普通分账和品牌红包行为保持不变。附带调用文档。
验证:新增及相关回归测试共 53 项通过,零失败、零跳过;git diff --check 通过;独立代码审查通过。测试覆盖 HTTP 方法/路径、字段映射、RSA 加密、AES-GCM 通知解密及签名拒绝。真实微信接口联调尚未执行,需要已开通品牌权限的服务商账号。
测试命令:
mvn -pl weixin-java-pay -am -Dmaven.test.skip=false -DskipTests=false -Dtest=BrandApplymentServiceTest,BrandStoreServiceTest,BrandProfitSharingServiceTest,BrandServiceEntryTest,PartnerInvoiceServiceImplTest,TransferAuthorizationApiCompatibilityTest,TransferUserAuthorizationApiCompatibilityTest,TransferReceiptApiCompatibilityTest -Dsurefire.failIfNoSpecifiedTests=false testCloses #3972