feat(tds): 同步 ssw-tdc 最新 internal 契约并完成真 TDS 联调验证

- 协议版本收敛为单一常量 3.2,移除联调期自创的 env 覆盖
- 按真源同步 5 项契约:Dispute 下线、Billing/List 增 side、internalCatalog 6 过滤字段、新增 ServiceCatalog/Detail、出向方法收敛
- 修正 /api/** 未命中非 GET 请求被静态兜底判成 405 的偏差,恢复 404 契约
- 新增上游用例跨进程验证脚本与 4 份联调文档;部署级凭据只从环境变量读取
- 全量测试 308 passed;132 端点契约一致;真 TDS 21 条用例 19 PASS / 1 FAIL / 1 INFO
This commit is contained in:
admin committed 2026-11-05 17:53:15 +08:00
1 parent 400d883e1a
commit 4b32b40bd6
20 files changed
+1853 -96

No files matched your search

+1 -1
View File
@@ -596,7 +596,7 @@ mod tests {
"/api/ssw/tdc/Product",
&[
(INTERNAL_TOKEN_HEADER, TEST_INTERNAL_TOKEN),
(PROTOCOL_VERSION_HEADER, "1.0"),
(PROTOCOL_VERSION_HEADER, "3.2"),
],
);
let (status, body) = call(app, req).await;
-1
View File
@@ -25,7 +25,6 @@ pub const DEFAULT_PORT: u16 = 30000;
pub const DEFAULT_TDS_CONNECT_TIMEOUT_MS: u64 = 3000;
/// 出向读取超时默认值(毫秒)—— 照抄上游 `restTemplate()` 的 `setReadTimeout(5000)`。
pub const DEFAULT_TDS_READ_TIMEOUT_MS: u64 = 5000;
// 🔴 **业务配置不在本模块**(v3 spec §2.3.1 C8):身份码 / 身份名 / 身份密钥 /
// 引导管理员账号口令这五项是**业务口径** ⇒ 归 `crate::tdc::config::TdcConfig`
// (常量在 `crate::tdc::constant`)。平台配置只认「端口 / 数据目录 / 令牌 /
+16 -1
View File
@@ -9,7 +9,7 @@
//!
//! | 请求路径 / 响应 | 结果 |
//! |---|---|
//! | `/api`、`/api/`、`/api/**` | **404 + JSON**(`api_not_found()`) |
//! | `/api`、`/api/`、`/api/**`(**任意方法**) | **404 + JSON**(`api_not_found()`,先于静态服务的 405) |
//! | 路径中**任意一段**的**扩展名**(去尾部空白与尾部 `.`、**Unicode 大写折叠**后)等于 `SQL` | **404 + JSON**(**前置守卫** `ddl_guard`) |
//! | 响应体与**内嵌 DDL 逐字节相同**(**不论文件名**) | **404 + JSON**(**内容级兜底** `ddl_content_guard`) |
//! | 响应体是**内嵌 DDL 的某一片段**(`Range` 分块下载) | **404 + JSON**(**内容级兜底** `ddl_content_guard`) |
@@ -107,6 +107,12 @@ pub async fn api_not_found() -> Response {
/// 兜底服务:[静态文件服务](crate::platform::static_files)(出 `static/` 里的真实文件)
/// + **找不到文件时**的决策层。
///
/// 🔴 **`/api` 命名空间的判定前置于静态服务**:`static_files::serve` 对非 `GET`/`HEAD`
/// 一律先回 `405 + Allow`(对齐 `ServeDir`)。若不在其之前判 `/api`,则
/// 「已下线的 API 端点用 `PUT` 探活」会拿到 405,违反本模块第一行契约
/// 「`/api/**` 未命中 ⇒ 404 JSON」。上游 `ssw-tdc` `chg_0022/C5` 亦按 404 验收
/// 下线端点(`/Billing/{id}/Dispute`)。非 `/api` 路径保持 405 + `Allow`(RFC 9110)。
///
/// 决策层:`/api` 命名空间 ⇒ 404 JSON;其余 ⇒ `static/index.html`(200 `text/html`)。
///
/// 🔴 返回的是 `Router`(不是静态服务本身)——因为 **DDL 前置守卫 `ddl_guard` 必须跑在
@@ -137,7 +143,13 @@ pub fn spa_fallback(static_dir: impl Into<PathBuf>) -> Router {
.and_then(|v| v.to_str().ok())
.map(str::to_string);
let uri = req.uri().clone();
// 🔴 先判 `/api`:**必须**在 `static_files::serve` 之前,见函数文档。
// 判定口径与 `fallback_response` / `ddl_guard` 完全一致(一层 decode)。
let is_api = is_api_path(&decoded_path(&path));
async move {
if is_api {
return api_not_found().await;
}
match crate::platform::static_files::serve(
&static_dir,
&method,
@@ -246,6 +258,9 @@ fn parse_content_range(value: &str) -> Option<(usize, usize)> {
/// 兜底决策:`/api` 命名空间 ⇒ 404 JSON;否则 ⇒ `index.html`。
///
/// ⚠️ `spa_fallback` 已对 `/api` 做前置判定(先于静态服务的 405),
/// 这里保留**同一口径**的判定作为防御,不要在此处另改判定规则。
///
/// ⚠️ DDL 判定**不在这里**(已由前置守卫 `ddl_guard` 拦在 `ServeDir` 之前 ⇒ 此处再判是死代码)。
async fn fallback_response(index_file: &Path, uri: &Uri) -> Response {
if is_api_path(&decoded_path(uri.path())) {
+4
View File
@@ -34,6 +34,10 @@
//! | 405(方法不允许) | 405 | `{"code":405,"msg":"方法不被允许","data":null}`(**有 `data`、无 `success`**) | 本模块 |
//! | 业务失败(400/600 等) | **200** | `{"code":…,"msg":…,"data":…}` | `envelope::ActionResult` |
//!
//! ⚠️ **405 的边界**:`/api/**` **未命中路径**在任意方法下都由
//! `platform::fallback` 前置判成 404;只有「已注册路由但方法不匹配」以及
//! 「非 `/api` 的 SPA 静态路径用非 GET/HEAD 请求」才会产生 405。
//!
//! 前两类是**鉴权/路由族**(裸三字段、无 `data`,与上游 `auth::reject` 同族),
//! 后两类是**业务族**(有 `data`)。
//! 两族的形状分别来自 `task-10-audit.md` §C 与 `task-10-addendum.md` §H.2,
+9 -9
View File
@@ -30,8 +30,8 @@
use std::collections::HashSet;
use std::sync::{Mutex, MutexGuard, OnceLock};
/// 本端协议版本。
pub const PROTOCOL_VERSION: &str = "1.0";
/// 本端协议版本(与 ssw-tdc `InternalTokenSupport.PROTOCOL_VERSION` 严格 1:1 对齐,当前 `3.2`)。
pub const PROTOCOL_VERSION: &str = "3.2";
/// 协议版本声明头。
pub const PROTOCOL_VERSION_HEADER: &str = "X-Protocol-Version";
/// 内部令牌头。
@@ -489,8 +489,8 @@ mod tests {
#[test]
fn compares_major_only() {
assert!(is_protocol_compatible("1.0"));
assert!(is_protocol_compatible("1.9"));
assert!(is_protocol_compatible("3.2"));
assert!(is_protocol_compatible("3.9"));
assert!(!is_protocol_compatible("2.0"));
assert!(!is_protocol_compatible("0.9"));
assert!(!is_protocol_compatible("1.x"));
@@ -527,7 +527,7 @@ mod tests {
let _g = test_guard();
reset_warn_state();
assert!(check_protocol(None), "未声明 ⇒ 兼容期放行");
assert!(check_protocol(Some("1.4")), "同 major ⇒ 放行");
assert!(check_protocol(Some("3.4")), "同 major ⇒ 放行");
assert!(!check_protocol(Some("5.1")), "major 不同 ⇒ 拒绝");
}
@@ -567,7 +567,7 @@ mod tests {
assert!(allowed, "未声明协议版本 ⇒ 兼容期放行");
assert!(warned, "未声明协议版本 ⇒ 应告警一次");
let (allowed, warned) = check_protocol_with_warn(Some("1.0"));
let (allowed, warned) = check_protocol_with_warn(Some("3.2"));
assert!(allowed, "major 相同 ⇒ 放行");
assert!(!warned, "兼容的声明不该告警");
@@ -582,11 +582,11 @@ mod tests {
reset_warn_state();
// 唯一版本串(其它用例不会用到)⇒ 独立的告警 key
let (allowed, warned) = check_protocol_with_warn(Some("3.7"));
let (allowed, warned) = check_protocol_with_warn(Some("4.7"));
assert!(!allowed, "major 不同 ⇒ 拒绝");
assert!(warned, "第一次不兼容 ⇒ 应告警");
let (allowed, warned) = check_protocol_with_warn(Some("3.7"));
let (allowed, warned) = check_protocol_with_warn(Some("4.7"));
assert!(!allowed);
assert!(!warned, "同一声明值只应告警一次");
}
@@ -988,7 +988,7 @@ mod tests {
// 副作用的**反向**:不该告警时就一行都不许打
let _g = test_guard();
reset_warn_state();
let (allowed, warned) = check_protocol_with_warn(Some("1.9"));
let (allowed, warned) = check_protocol_with_warn(Some("3.9"));
assert!(allowed, "同 major ⇒ 放行");
assert!(!warned, "兼容的声明不该告警");
assert_eq!(
+75 -16
View File
@@ -1,9 +1,13 @@
//! TDS 出向客户端(照抄上游 `TdsReportClient` 的 **internal 通道**)。
//!
//! 上游真源:`/tmp/sswtdc-probe/boot/ssw-tdc/ssw-tdc-biz/src/main/java/ssw/tdc/client/TdsReportClient.java`
//! (`internalHeaders()` / `restTemplate()` / `internalCatalog` / `internalApply` / `internalApplyBatch`
//! / `listBillingForConnector` / `disputeBilling` / `confirmBilling` / `settleBilling` / `receiptBilling`
//! / `voucherBilling`)。
//! (`internalHeaders()` / `restTemplate()` / `internalCatalog` / `catalogDetail` / `internalApply`
//! / `internalApplyBatch` / `listBillingForConnector` / `confirmBilling` / `settleBilling`
//! / `receiptBilling` / `voucherBilling`)。
//!
//! 🔴 对标 `ssw-tdc` `2d331e9`(2026-11-05 15:55,协议 3.2):`internalCatalog` 改吃
//! filters Map、新增 `catalogDetail`、`listBillingForConnector` 加 `side`;批4b
//! (chg_0022 乙案)已下线 `disputeBilling` ⇒ 本仓同步移除。
//!
//! 🔴 **只实现 internal 通道**(`X-Internal-Token` + 固定头,走 TDS `white-url` 放行的内部端点)。
//! 上游还有一条 login/`ensureToken` 通道(JNPF 登录换 token)⇒ 本轮**不做**(见 spec §5)。
@@ -163,8 +167,16 @@ impl TdsClient {
///
/// 🔴 **不读系统代理**:出向是内网直连(`platform::http` 不实现代理,
/// 等价于原来 reqwest 的 `.no_proxy()`)⇒ loopback 的 TDS 不会被劫持。
pub fn new(base_url: Option<String>, internal_token: String) -> Self {
Self::with_timeouts(base_url, internal_token, CONNECT_TIMEOUT, READ_TIMEOUT)
pub fn new(
base_url: Option<String>,
internal_token: String,
) -> Self {
Self::with_timeouts(
base_url,
internal_token,
CONNECT_TIMEOUT,
READ_TIMEOUT,
)
}
/// 造客户端(**显式**给出超时)—— 上游 chg_0012 的「配置值 ⇒ socket 工厂」那一跳。
@@ -220,7 +232,7 @@ impl TdsClient {
/// | `Jnpf-Origin` | `pc` |
/// | `Vue-Version` | `3` |
/// | `X-Internal-Token` | 出向令牌 |
/// | `X-Protocol-Version` | `1.0`(与上游 `InternalTokenSupport.PROTOCOL_VERSION` 一致) |
/// | `X-Protocol-Version` | 出向协议版本(`crate::platform::protocol::PROTOCOL_VERSION`,与 ssw-tdc `InternalTokenSupport.PROTOCOL_VERSION` 严格 1:1,当前 `3.2`) |
///
/// 🔴 **绝不**加 `Authorization` / `Cookie` ⇒ 本地会话令牌不外泄。
fn internal_headers(&self) -> HeaderMap {
@@ -232,7 +244,10 @@ impl TdsClient {
if let Ok(v) = HeaderValue::from_str(&self.internal_token) {
h.insert("x-internal-token", v);
}
h.insert("x-protocol-version", HeaderValue::from_static("1.0"));
// 出向协议版本(≡ 上游 `internalHeaders()` 直接引用 `InternalTokenSupport.PROTOCOL_VERSION`)
if let Ok(v) = HeaderValue::from_str(crate::platform::protocol::PROTOCOL_VERSION) {
h.insert("x-protocol-version", v);
}
h
}
@@ -263,13 +278,31 @@ impl TdsClient {
/// 服务目录(上游 `internalCatalog`):`POST /api/ssw/tds/Catalog/Internal/Catalog`。
///
/// ⚠️ 上游 `body.put("keyword", keyword)` —— `keyword` 为 `null` 时**也**带这个键 ⇒ 照抄。
/// 上游 2026-11-04 起签名改为 `internalCatalog(spaceId, Map<String,Object> filters)`:
/// body 先放 `spaceId`,再把 filters 里**非空白**的键值逐个 `String.valueOf(v)` 放进去
/// (`filters == null` ⇒ 只带 `spaceId`)。⇒ 旧的「keyword 为 null 也带键」行为已取消。
pub async fn internal_catalog(
&self,
space_id: &str,
keyword: Option<&str>,
filters: Option<&serde_json::Map<String, Value>>,
) -> Result<Value, String> {
let body = json!({"spaceId": space_id, "keyword": keyword});
let mut body = serde_json::Map::new();
body.insert("spaceId".to_string(), Value::String(space_id.to_string()));
if let Some(filters) = filters {
for (k, v) in filters {
if v.is_null() {
continue;
}
let s = match v {
Value::String(s) => s.clone(),
_ => v.to_string(),
};
if !s.trim().is_empty() {
body.insert(k.clone(), Value::String(s));
}
}
}
let body = Value::Object(body);
let env = self
.send(
Method::POST,
@@ -310,10 +343,13 @@ impl TdsClient {
///
/// ⚠️ 上游 `keyword` **可选**:缺省时**不带**这个键(`ownsLedger` 复用本方法做越权校验,
/// 缺省时不得过滤)。上游异常时返回 `null` ⇒ 本方法返回 `Err`。
/// ⚠️ 2026-11-04(供方中心数据交易 R1)新增 `side`:`PROVIDER` / `CONSUMER` 只看本侧台账,
/// 缺省两侧都返;与 `keyword` 一样非空白才放进 body。
pub async fn list_billing_for_connector(
&self,
connector_id: &str,
keyword: Option<&str>,
side: Option<&str>,
) -> Result<Value, String> {
let mut body = json!({"connectorId": connector_id});
if let Some(k) = keyword {
@@ -321,6 +357,11 @@ impl TdsClient {
body["keyword"] = Value::String(k.trim().to_string());
}
}
if let Some(s) = side {
if !s.trim().is_empty() {
body["side"] = Value::String(s.to_string());
}
}
self.send(
Method::POST,
"/api/ssw/tds/BillingLedger/Internal/List",
@@ -329,11 +370,26 @@ impl TdsClient {
.await
}
/// 发起异议(上游 `disputeBilling`):`PUT /api/ssw/tds/BillingLedger/{id}/Dispute`,体 `{}`。
pub async fn dispute_billing(&self, ledger_id: &str) -> Result<Value, String> {
let path = ledger_path(ledger_id, "Dispute")?;
self.send(Method::PUT, &path, Some(&json!({})))
.await
/// 目录详情(上游 `catalogDetail`,2026-11-03 数据集语义批新增):
/// `GET /api/ssw/tds/Catalog/Detail/{productCode}?spaceId=<enc>`。
///
/// 上游用 `UriComponentsBuilder.pathSegment(productCode).queryParam("spaceId", spaceId)`
/// ⇒ 路径段与查询值都编码;本仓同样先过段白名单再编码。解包型(`code==200` 取 `data`)。
pub async fn catalog_detail(
&self,
product_code: &str,
space_id: &str,
) -> Result<Value, String> {
if !is_safe_path_segment(product_code) {
return Err(format!("产品编码非法: {}", product_code));
}
let path = format!(
"/api/ssw/tds/Catalog/Detail/{}?spaceId={}",
url_encode(product_code),
url_encode(space_id)
);
let env = self.send(Method::GET, &path, None).await?;
unwrap_data(env, "目录详情查询失败")
}
/// 确认账单(上游 `confirmBilling`):`PUT .../{id}/Confirm?connectorId=<enc>`,体 `{}`。
@@ -460,7 +516,10 @@ mod tests {
assert_eq!(h.get("jnpf-origin").unwrap(), "pc");
assert_eq!(h.get("vue-version").unwrap(), "3");
assert_eq!(h.get("x-internal-token").unwrap(), "tok-123");
assert_eq!(h.get("x-protocol-version").unwrap(), "1.0");
assert_eq!(
h.get("x-protocol-version").unwrap(),
crate::platform::protocol::PROTOCOL_VERSION
);
// 🔴 出向**不得**带 Authorization / Cookie(本地会话令牌不外泄)
assert!(h.get("authorization").is_none());
assert!(h.get("cookie").is_none());
+60 -39
View File
@@ -34,6 +34,10 @@ pub fn router() -> Router<TdcState> {
Router::new()
// ---- 服务目录(上游 ServiceCatalogController) ----
.route("/api/ssw/tdc/ServiceCatalog", get(service_catalog_list))
.route(
"/api/ssw/tdc/ServiceCatalog/Detail/{productCode}",
get(service_catalog_detail),
)
.route("/api/ssw/tdc/ServiceCatalog/Buy", post(service_catalog_buy))
.route(
"/api/ssw/tdc/ServiceCatalog/BuyBatch",
@@ -45,7 +49,6 @@ pub fn router() -> Router<TdcState> {
"/api/ssw/tdc/Billing/LocalCompare",
get(billing_local_compare),
)
.route("/api/ssw/tdc/Billing/{id}/Dispute", put(billing_dispute))
.route("/api/ssw/tdc/Billing/{id}/Confirm", put(billing_confirm))
.route("/api/ssw/tdc/Billing/{id}/Settle", put(billing_settle))
.route("/api/ssw/tdc/Billing/{id}/Receipt", put(billing_receipt))
@@ -156,13 +159,14 @@ fn resolve_connector_id_strict(explicit: Option<String>, local: &identity::TdsBi
/// 越权自检(照抄上游 `BillingController.ownsLedger`)。
///
/// 先 `listBillingForConnector(cid)`(**不带 keyword**),在 `data.list` 里找 id 匹配 ⇒ 不匹配 ⇒ 拒。
/// 🔴 任何异常(TDS 不可达 / 拒 / 形状不符)⇒ **false**(fail-closed)。
async fn owns_ledger(state: &TdcState, connector_id: &str, ledger_id: &str) -> bool {
let env = match state
.tds
.list_billing_for_connector(connector_id, None)
.await
/// 先 `listBillingForConnector(cid)`(**不带 keyword / side**),在 `data.list` 里找 id 匹配 ⇒ 不匹配 ⇒ 拒。
/// 🔴 任何异常(TDS 不可达 / 拒 / 形状不符)⇒ **false**(fail-closed)。
/// 🔴 `side` 必须缺省(两侧都返),否则 `ownsLedger` 会漏判对方台账。
async fn owns_ledger(state: &TdcState, connector_id: &str, ledger_id: &str) -> bool {
let env = match state
.tds
.list_billing_for_connector(connector_id, None, None)
.await
{
Ok(e) => e,
Err(_) => return false,
@@ -248,16 +252,31 @@ fn unreachable_msg(upstream_msg: &str, err: &str) -> String {
// 服务目录(上游 ServiceCatalogController)
// ==================================================================
/// `GET /api/ssw/tdc/ServiceCatalog?keyword=`(上游 `search` 的 standalone 分支)。
/// `GET /api/ssw/tdc/ServiceCatalog?keyword=...`(上游 `search` 的 standalone 分支)。
///
/// ⚠️ 上游 standalone 分支**不翻页**(`internalCatalog` 无分页参数)⇒ `currentPage`/`pageSize` 忽略。
/// ⚠️ 2026-11-04 目录条目字段批:查询参数扩为 6 个,`putIfPresent` 只收非空白值(trim 后放入)。
async fn service_catalog_list(
State(state): State<TdcState>,
q: RawQuery,
_p: Option<Extension<Principal>>,
) -> Response {
let params = parse_query(q.0.as_deref());
let keyword = param(&params, "keyword");
// 上游 `putIfPresent(filters, k, v)`:v != null && !v.isBlank() ⇒ m.put(k, v.trim())。
// `param()` 已做 trim + 空值过滤 ⇒ 逐键等价。
let mut filters = serde_json::Map::new();
for key in [
"keyword",
"industry",
"productType",
"dataSource",
"safeLevel",
"priceMode",
] {
if let Some(v) = param(&params, key) {
filters.insert(key.to_string(), Value::String(v));
}
}
let ident = local_identity(&state).await;
let space_id = match ident.space_id.as_ref() {
Some(s) if !is_blank(s) => s.clone(),
@@ -265,7 +284,7 @@ async fn service_catalog_list(
};
match state
.tds
.internal_catalog(&space_id, keyword.as_deref())
.internal_catalog(&space_id, Some(&filters))
.await
{
Ok(data) => ActionResult::ok(data).into_response(),
@@ -273,6 +292,28 @@ async fn service_catalog_list(
}
}
/// `GET /api/ssw/tdc/ServiceCatalog/Detail/{productCode}`(上游 `detail`,2026-11-03 数据集语义批新增)。
///
/// 🔴 上游明确:`spaceId` **只能从本端身份解析**,不得接受浏览器指定(否则可跨空间读目录);
/// 且不得让浏览器直调 TDS 内部端点 ⇒ 必须经本代理。
async fn service_catalog_detail(
State(state): State<TdcState>,
Path(product_code): Path<String>,
_p: Option<Extension<Principal>>,
) -> Response {
let ident = local_identity(&state).await;
let space_id = match ident.space_id.as_ref() {
Some(s) if !is_blank(s) => s.clone(),
_ => {
return ActionResult::fail("连接器未绑定空间,目录详情不可用").into_response()
}
};
match state.tds.catalog_detail(&product_code, &space_id).await {
Ok(data) => ActionResult::ok(data).into_response(),
Err(msg) => ActionResult::fail(msg).into_response(),
}
}
/// `POST /api/ssw/tdc/ServiceCatalog/Buy`(上游 `buy` 的 standalone 分支)。
async fn service_catalog_buy(
State(state): State<TdcState>,
@@ -327,7 +368,9 @@ async fn fill_buyer_connector_id(state: &TdcState, payload: &mut Value) {
// 连接器账单(上游 BillingController)
// ==================================================================
/// `GET /api/ssw/tdc/Billing/List?connectorId=&keyword=`(上游 `list`)。
/// `GET /api/ssw/tdc/Billing/List?connectorId=&keyword=&side=`(上游 `list`)。
///
/// ⚠️ 2026-11-04(供方中心数据交易 R1)新增 `side`(PROVIDER / CONSUMER);缺省两侧都返。
async fn billing_list(
State(state): State<TdcState>,
q: RawQuery,
@@ -336,6 +379,7 @@ async fn billing_list(
let params = parse_query(q.0.as_deref());
let explicit = param(&params, "connectorId");
let keyword = param(&params, "keyword");
let side = param(&params, "side");
let ident = local_identity(&state).await;
let cid = match resolve_connector_id_relaxed(explicit, &ident) {
Some(c) => c,
@@ -346,7 +390,7 @@ async fn billing_list(
};
match state
.tds
.list_billing_for_connector(&cid, keyword.as_deref())
.list_billing_for_connector(&cid, keyword.as_deref(), side.as_deref())
.await
{
// 上游:`res == null` ⇒ "TDS 账单查询不可达"(`null` 只在异常时出现)
@@ -358,32 +402,9 @@ async fn billing_list(
}
}
/// `PUT /api/ssw/tdc/Billing/{id}/Dispute`(上游 `dispute`,**宽松**身份口径)。
async fn billing_dispute(
State(state): State<TdcState>,
Path(id): Path<String>,
_p: Option<Extension<Principal>>,
body: OptionalJsonBody,
) -> Response {
let ident = local_identity(&state).await;
let cid = match resolve_connector_id_relaxed(body_text(&body.0, "connectorId"), &ident) {
Some(c) => c,
None => {
return ActionResult::fail("无法确定连接器身份(固定身份不可用或未显式传入)")
.into_response()
}
};
if !owns_ledger(&state, &cid, &id).await {
return ActionResult::fail("非本方账单,无权发起异议").into_response();
}
match state.tds.dispute_billing(&id).await {
Err(e) => ActionResult::fail(unreachable_msg("TDS 异议提交不可达", &e)).into_response(),
Ok(env) => match unwrap_envelope_str(&env, &id) {
Ok((msg, ledger)) => ActionResult::ok_msg(msg, ledger).into_response(),
Err(msg) => ActionResult::fail(msg).into_response(),
},
}
}
// 🔴 `/Billing/{id}/Dispute` 与上游 `disputeBilling` 已按批4b(chg_0022 乙案)下线:
// ssw-tdc `2d331e9` 的 BillingController 无该路由、TdsReportClient 无该方法、
// 真 TDS 该路径也不在 internal 白名单。⇒ 本仓同步移除,不再保留端点与出向方法。
/// `PUT /api/ssw/tdc/Billing/{id}/Confirm`(上游 `confirm`,**严格**身份口径)。
async fn billing_confirm(