Skip to content

Commit c49ca85

Browse files
committed
feat: 兼容收付通旧版下单模型
1 parent 417e4be commit c49ca85

15 files changed

Lines changed: 2568 additions & 4 deletions
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# 收付通旧 API 过渡兼容层 Implementation Plan
2+
3+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4+
5+
**Goal:** Restore the public e-commerce payment API removed by #4014 as deprecated adapters over the unified V3 API.
6+
7+
**Architecture:** Deprecated legacy models remain in `bean.ecommerce`; `EcommerceService` exposes overloads with those legacy types. Each overload maps the input to the unified request/enums, invokes the existing unified method, and maps the response back, so transport and signature logic remain singular.
8+
9+
**Tech Stack:** Java 8, Maven, JUnit 5, Gson, Lombok.
10+
11+
## Global Constraints
12+
13+
- Keep all new #4014 API signatures and behavior unchanged.
14+
- Mark every restored legacy public class and service method `@Deprecated` with migration Javadoc.
15+
- Do not recreate legacy HTTP, signing, or notification-verification implementations.
16+
- Remove the compatibility layer only in 5.0.
17+
18+
---
19+
20+
### Task 1: Restore legacy model surface
21+
22+
**Files:**
23+
- Create: `weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/{TransactionsResult,CombineTransactionsRequest,CombineTransactionsResult,CombineTransactionsNotifyResult,PartnerTransactionsRequest,PartnerTransactionsResult,PartnerTransactionsNotifyResult,PartnerTransactionsQueryRequest,PartnerTransactionsCloseRequest,SignatureHeader}.java`
24+
- Create: `weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/ecommerce/enums/TradeTypeEnum.java`
25+
- Test: `weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/LegacyEcommerceApiCompatibilityTest.java`
26+
27+
**Interfaces:**
28+
- Produces legacy types with their pre-#4014 fully qualified names and accessors.
29+
30+
- [ ] **Step 1: Write a failing compilation test importing the old types.**
31+
- [ ] **Step 2: Run `mvn -pl weixin-java-pay -Dtest=LegacyEcommerceApiCompatibilityTest test` and confirm compilation fails because the old types do not exist.**
32+
- [ ] **Step 3: Restore the old model source and annotate each class `@Deprecated`.**
33+
- [ ] **Step 4: Re-run the focused Maven test and confirm compilation succeeds.**
34+
35+
### Task 2: Add service-level adapters
36+
37+
**Files:**
38+
- Modify: `weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/EcommerceService.java`
39+
- Create: `weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/LegacyEcommerceApiAdapter.java`
40+
- Test: `weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/LegacyEcommerceApiCompatibilityTest.java`
41+
42+
**Interfaces:**
43+
- Consumes restored legacy models from Task 1 and current unified V3 APIs.
44+
- Produces deprecated overloads for `combine`, `combineTransactions`, notification parsing, query/close, partner order creation, query/close and notification parsing.
45+
46+
- [ ] **Step 1: Write failing tests using legacy `EcommerceService` signatures and asserting delegation to the corresponding unified method.**
47+
- [ ] **Step 2: Run the focused Maven test and confirm each test fails because no legacy overload exists.**
48+
- [ ] **Step 3: Implement mapping helpers and `default` legacy overloads that delegate to current methods.**
49+
- [ ] **Step 4: Re-run the focused Maven test and confirm the legacy paths pass.**
50+
51+
### Task 3: Regression verification and documentation
52+
53+
**Files:**
54+
- Modify: `weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/LegacyEcommerceApiCompatibilityTest.java`
55+
- Modify: `docs/superpowers/specs/2026-08-08-legacy-ecommerce-api-compatibility-design.md`
56+
57+
- [ ] **Step 1: Add tests proving current unified API calls still resolve to their current methods.**
58+
- [ ] **Step 2: Run `mvn -pl weixin-java-pay test` and verify the module builds successfully.**
59+
- [ ] **Step 3: Inspect `git diff --check` and `git diff` for accidental edits.**
60+
- [ ] **Step 4: Commit the implementation and tests with a Chinese message.**
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package com.github.binarywang.wxpay.bean.ecommerce;
2+
3+
import lombok.Data;
4+
import lombok.NoArgsConstructor;
5+
6+
import java.io.Serializable;
7+
8+
/**
9+
* 合单支付 通知结果
10+
* <pre>
11+
* 文档地址:https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_7.shtml
12+
* </pre>
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
@Deprecated
17+
public class CombineTransactionsNotifyResult implements Serializable {
18+
19+
private static final long serialVersionUID = -4710926828683593250L;
20+
/**
21+
* 源数据
22+
*/
23+
private NotifyResponse rawData;
24+
25+
/**
26+
* 解密后的数据
27+
*/
28+
private CombineTransactionsResult result;
29+
30+
}

0 commit comments

Comments
 (0)