Просмотр исходного кода

fix(contract): 移除额外平台自动盖章调用

Co-authored-by: Cursor <cursoragent@cursor.com>
天空之城 4 часов назад
Родитель
Сommit
73174ec830
1 измененных файлов с 1 добавлено и 31 удалено
  1. 1 31
      alien_contract/infrastructure/esign/contract_builder.py

+ 1 - 31
alien_contract/infrastructure/esign/contract_builder.py

@@ -4,7 +4,7 @@ import re
 import urllib.parse
 from typing import Any
 
-from alien_contract.infrastructure.esign.main import SIGN_POSITIONS, apply_platform_seal, fill_in_template, create_by_file
+from alien_contract.infrastructure.esign.main import fill_in_template, create_by_file
 from alien_contract.infrastructure.esign.esign_config import Config
 
 logger = logging.getLogger(__name__)
@@ -18,34 +18,6 @@ class ContractBuildError(Exception):
         self.raw = raw
 
 
-def _is_esign_success(resp: dict[str, Any]) -> bool:
-    code = resp.get("code")
-    return code in (0, "0") or resp.get("success") is True
-
-
-def _apply_platform_seal_if_required(contract_type: str, contract_name: str, sign_flow_id: str) -> None:
-    positions = SIGN_POSITIONS.get(contract_type, {})
-    if not positions.get("alien"):
-        return
-
-    seal_resp = apply_platform_seal(sign_flow_id)
-    try:
-        seal_json = json.loads(seal_resp)
-    except json.JSONDecodeError:
-        logger.error("apply_platform_seal non-json resp contract_type=%s: %s", contract_type, seal_resp)
-        raise ContractBuildError(
-            message=f"{contract_name}平台自动盖章失败:e签宝返回非 JSON",
-            raw={"contract_type": contract_type, "sign_flow_id": sign_flow_id, "resp": seal_resp},
-        )
-
-    if not isinstance(seal_json, dict) or not _is_esign_success(seal_json):
-        logger.error("apply_platform_seal failed contract_type=%s: %s", contract_type, seal_json)
-        raise ContractBuildError(
-            message=f"{contract_name}平台自动盖章失败",
-            raw={"contract_type": contract_type, "sign_flow_id": sign_flow_id, "resp": seal_json},
-        )
-
-
 def build_contract_items(
     configs: list[tuple[str, str, int]],
     template_name: str,
@@ -137,8 +109,6 @@ def build_contract_items(
                 raw={"contract_type": contract_type, "resp": sign_json},
             )
 
-        _apply_platform_seal_if_required(contract_type, contract_name, sign_id)
-
         items.append(
             {
                 "contract_type": contract_type,