chenchuchuan
|
6a8796cc0b
|
fix: 补齐包更名遗留的 package 声明与 GUIDE 示例
- IdempotencyGuardTest 的 package 由 common.ecommerce.idempotency
改为 common.ecommerce.shared.idempotency,与文件路径一致
- GUIDE 示例里的 import 与子包说明同步到 channel / shared
Co-Authored-By: Claude <noreply@anthropic.com>
|
2 weeks ago |
chenchuchuan
|
8bca2bff73
|
refactor: 模块更名 shared/channel,README 补架构图
- common → shared(跨域共享层),core → channel(渠道域),
包名同步为 common.ecommerce.shared.* / common.ecommerce.channel.*
- GUIDE / 操作手册 的 Maven 坐标随之更新
- README 增加架构图:分层依赖、模块依赖、一次查询的调用链;
包职责表与 lingxing 适配器结构对齐当前实现
Co-Authored-By: Claude <noreply@anthropic.com>
|
2 weeks ago |
chenchuchuan
|
aaeb0c23f5
|
refactor: 拆出 common 模块,渠道域与仓库域共享基础设施
把与渠道域无关的基础设施从 core 上提到 common 模块(包名
common.ecommerce.shared.*),为三方仓域复用同一套 SPI 与管道做准备。
不改变任何行为,只做搬迁、改包名与 import。
迁移内容(36 个类 + 3 个测试):
- audit CallObserver / CallOutcome / CallRecord / Slf4jCallObserver
- error 8 个异常(AuthException … ValidationException)
- idempotency IdempotencyGuard / WriteAudit / WriteResult / WriteScope
- spi AccessToken / ChannelSecret / TokenStore / LockProvider /
SecretProvider / SyncCursorStore / Idempotency* 共 10 个
- sync SyncSpec / SyncResult(SyncEngine 留在 core,它依赖订单模型)
- model Platform / ChannelProvider / Capability / FulfillmentMode
- support Money / Page / PlatformTime / CanonicalKeys
模块依赖调整为:
core / http / testkit → common
lingxing → core + http + common
http 不再依赖 core,仓库域可直接复用传输层与令牌管理。
验证:全量 84 个测试通过(common 33 / core 29 / http 13 / testkit 29 /
lingxing 84 含 13 个默认跳过的探针)。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2 weeks ago |
chenchuchuan
|
c9d60153c7
|
test: 每个平台补 listing / 售后契约测试,新增 SDK 门面调用测试
testkit(测试支撑):
- RecordingTransport:记录全部请求、按 URL 路由响应;令牌请求自动返回最小成功响应,
业务请求可断言
- JsonFixture:classpath 夹具加载
- Responses:恢复快捷响应构造
- FakeDirectAdapter:补 AfterSaleCapable,支持 afterSales(count)
lingxing(每平台一套):
- 9 个 listing 测试:walmart / ebay / temu / shein / tiktok / target /
aliexpress / amazon sc / amazon vc
覆盖请求参数(店铺、时间窗、分页、搜索编码)与响应映射
- 售后:ListSource(请求构造、过滤、上限、时间窗校验、行展开)+ Mapper(10 例)
- LingxingTestSupport:测试公共样板(账户/调用/断言)
- 夹具:每平台一套 success.json
testkit(门面调用):
- SdkFacadeCallTest:products / afterSales / salesOrders 的完整调用、分页、
参数校验、能力检查、账户缺失等错误路径
清理:
- 删除 ProductCallExampleTest、SdkCallGuideTest 与两份 AmazonScProductLiveTest
(已被上述测试覆盖)
- 探针改为 -Dlingxing.probe=true 才运行,避免真实凭证让 mvn test 变红
修复:
- TargetProductSource 的 store_ids 被误注释,恢复
- AmazonVcProductSource 传搜索条件时显式抛异常,不再静默忽略
Co-Authored-By: Claude <noreply@anthropic.com>
|
2 weeks ago |
chenchuchuan
|
e940945174
|
feat(product): ProductListing 扩充标准字段,SC/VC 全字段映射
统一模型新增(都有注释说明对应哪个平台字段):
- platform:业务平台,落库时不必再反查账户
- listingId / asin / parentAsin / gtin:平台商品标识
- attributes:未标准化的原始字段(本地 SKU、库存、费用、排名、尺寸等)
- status 改为枚举 ProductStatus(ACTIVE/INACTIVE/DELETED/UNKNOWN),
rawStatus 保留平台原值
SC 映射:seller_sku / listing_id / asin / item_name / small_image_url /
status+is_delete / price+currency_code / on_sale_time / listing_update_date,
其余 40+ 字段进 attributes。
VC 映射:msku / asin / parent_asin / upc|ean / item_name / small_min_image_url /
status / price,其余进 attributes。
VC 只给货币符号不给 ISO 代码,按符号反推,反推不出时 currency 与 price 都为 null;
¥ 因人民币与日元无法区分,一律返回 null。
Co-Authored-By: Claude <noreply@anthropic.com>
|
3 weeks ago |
chenchuchuan
|
f6d301b16d
|
test(lingxing): 移除假响应测试,保留真实环境冒烟
按要求只测真实接口,删除依赖录制报文的部分:
- LingxingAdapterTest / LingxingTokenClientTest / LingxingOrderMapperTest
- fixtures/lingxing 下全部夹具
- testkit 的 FakeTransport / Fixtures / Responses
保留 LingxingLiveSmokeTest(未配环境变量整类跳过),
以及不涉及网络用例(Signer / Envelope / RateLimiter / RequestFactory)。
Co-Authored-By: Claude <noreply@anthropic.com>
|
3 weeks ago |
chenchuchuan
|
54877562d1
|
refactor(sdk): 连接信息改由调用方每次传入,SDK 不保存
端点与凭据此前固化成常量或注入的 SecretProvider,等于 SDK 在替宿主保存连接配置。
现在改为调用方每次调用显式传入:
- 新增 ChannelConnection(endpointBaseUrl + ChannelSecret)
- ChannelContext 持有 connection;新增 endpointBaseUrl() / secret()
- ChannelSdk.salesOrders(key, conn) / products(key, conn) 必须传连接
- LingxingAdapter 构造函数不再接收 baseUrl 与 SecretProvider
- LingxingRequestFactory 的 baseUrl 改为每次 post 传入
- LingxingTokenClient.fetch(baseUrl, appId, appSecret)
- ChannelSecret 增加 endpointBaseUrl:TokenManager 的 refresh 回调只拿得到凭据对象
- LingxingConstants.DEFAULT_BASE_URL 改名 PRODUCTION_BASE_URL,明确仅作参考/测试常量
TokenManager 仍按设计文档 9.1 管理 token 生命周期(缓存、提前续期、防击穿、
失效重取),token 存储仍走宿主 TokenStore SPI——文档没要求 SDK 自己存。
Co-Authored-By: Claude <noreply@anthropic.com>
|
3 weeks ago |
chenchuchuan
|
3140aaf328
|
chore: 删除重构遗留的 apelet 旧包目录
包名迁移时旧路径下的 79 个文件未被移除,形成新旧两套源码并存。
旧文件内容仍是改名前版本(包声明为 apelet.common.ecommerce),
且与新路径文件功能重复。删除后 src 下仅保留 common.ecommerce。
Co-Authored-By: Claude <noreply@anthropic.com>
|
3 weeks ago |
chenchuchuan
|
b694116aa6
|
build: Maven groupId 改为 ecommerce
Java 包名去掉 apelet 前缀后,Maven 坐标同步对齐。
- 根 pom 与四个子模块的 groupId、parent、依赖坐标
- GUIDE 第三章示例中的 groupId
- README 移除「groupId 待处理」事项
Co-Authored-By: Claude <noreply@anthropic.com>
|
3 weeks ago |
chenchuchuan
|
a6f3b3060f
|
feat(core): 写操作幂等守卫与 IdempotencyStore SPI
业务键 + provider 请求键双锁:业务键不带 provider,直连与聚合器共用;
provider 键只防单 provider 内重试。
- 新增 idempotency 包:WriteScope / WriteResult / IdempotencyGuard
- 新增 SPI:IdempotencyStore 及 Claim / Record / Status 四态
- ChannelSdk.writes() 装配守卫;未注入 store 时显式失败,无降级路径
- 崩溃窗口由 provider 键恢复:平台已写但业务键未记成功时回放,不重复写
- testkit 新增 InMemoryIdempotencyStore / MutableClock,junit 改为 test 作用域
Co-Authored-By: Claude <noreply@anthropic.com>
|
3 weeks ago |
chenchuchuan
|
9e6b8c5c61
|
refactor(capability): 详情参数改用 SalesOrderRef / ProductRef
裸 String 在擦除后使 SalesOrderCapable.get 与 ProductCapable.get 签名相同,
一个适配器无法同时实现订单与商品两种能力。改为包装类型后两者可共存。
- 新增 common.ecommerce.model.order.SalesOrderRef / model.product.ProductRef
- SalesOrderCapable / ProductCapable 的 get 参数改为引用类型
- 门面 SalesOrders.get(String) / Products.get(String) 对外签名不变
- LingxingAdapter、ChannelSdkTest 同步适配
- testkit 新增 FakeDirectAdapter 及其测试,验证 core 抽象未被聚合器带偏
Co-Authored-By: Claude <noreply@anthropic.com>
|
3 weeks ago |
chenchuchuan
|
ff9ec456c2
|
refactor: 包名去掉 apelet 前缀并按职责拆分 model 子包
- 包路径 apelet.common.ecommerce → common.ecommerce(四个模块的 main/test 全量迁移)
- model 拆为 account / order / product / support 四个子包,枚举留在根包
- 同步更新 README 包结构与导入路径
行为无变化,仅重命名与目录调整。
Co-Authored-By: Claude <noreply@anthropic.com>
|
3 weeks ago |
chenchuchuan
|
0f929a6be3
|
feat(testkit): InMemory SPI、FakeTransport 与夹具加载
- FakeTransport:按 URL 子串+方法路由,记录全部请求,可直接返回录制响应
- InMemory*:Accounts/TokenStore/CursorStore/Sink/LockProvider
- Fixtures:fixtures/{platform}/{operation}/{case}.json 约定加载
- Responses/TestData:响应与同步测试的快捷构造
目标:适配器单测不依赖网络、数据库、Spring。
Co-Authored-By: Claude <noreply@anthropic.com>
|
3 weeks ago |
chenchuchuan
|
3b8c99d9b1
|
chore: 初始化 common-ecommerce 多模块骨架
四个模块:core / http / testkit / lingxing。
JDK 1.8 编译,依赖版本在 parent 统一管理,
core 仅依赖 slf4j-api,保证无第三方运行时耦合。
Co-Authored-By: Claude <noreply@anthropic.com>
|
3 weeks ago |