fix(performance): 11번가 연결 테스트 — XML 아닌 응답은 실패, 성공 알림은 초록 체크

- 11번가가 200 으로 웹페이지(IP 차단 안내 등)나 XML 아닌 응답을 주면 "0건 정상"으로
  오판할 수 있어 실패로 처리
- 공용 알림 창 erpAlert(msg, { tone: "ok" }) — 경고 삼각형 대신 초록 체크.
  기존 호출은 그대로. 실적 연결 테스트 성공 알림에 적용

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 00:40:40 +09:00
parent c93ab2fbd8
commit 6376092bb7
8 changed files with 31 additions and 12 deletions
+6 -2
View File
@@ -33,11 +33,13 @@ def _xml_text(content: bytes) -> str:
def xml_result(content: bytes) -> tuple[str, str, int]:
"""(결과코드, 결과문구, 주문 수). 네임스페이스와 무관하게 태그 끝 이름으로 찾는다."""
"""(결과코드, 결과문구, 주문 수). 네임스페이스와 무관하게 태그 끝 이름으로 찾는다. XML 이 아니면 코드 "not-xml"."""
try:
root = ET.fromstring(_xml_text(content))
except ET.ParseError:
return "", "", 0
return "not-xml", "", 0
if root.tag.rsplit("}", 1)[-1].lower() == "html": # 오류 안내 웹페이지(IP 차단 등)
return "not-xml", "", 0
code = text = ""
orders = 0
for el in root.iter():
@@ -78,6 +80,8 @@ class ElevenstAdapter(MarketplaceAdapter):
raise AuthFailed(f"11번가 인증 거부({res.status_code}): {detail}. 키와 등록 IP(이 서버 외부 IP)를 확인하세요.")
if res.status_code >= 400:
raise ApiError(f"11번가 API 오류({res.status_code}): {detail}")
if code == "not-xml":
raise ApiError(f"11번가가 예상하지 못한 응답을 돌려줬습니다(XML 아님): {res.text[:120].strip()}")
if code and code not in ("0", "200", "00"):
raise ApiError(f"11번가 API 오류(코드 {code}): {detail}")
return res.content