feat(performance): 11번가 원본 데이터 확인 도구 — 후보 조회 주소별 동작·항목 합계

11번가 셀러 API 의 주문·클레임 상세 문서는 로그인 뒤에만 있어 조회 주소와
금액 항목 이름을 공개 자료로 확정할 수 없다. 추측으로 매출 수집을 짜지 않고
실데이터로 확정하기 위해:

- ElevenstAdapter.reconcile(day): 결제완료·발송대상·배송중·배송완료·취소신청·
  취소완료·반품신청·반품완료·정산 후보 주소를 그날로 호출 → 동작 여부(404 등 오류),
  건수, 항목별 채워진 줄·숫자 합계·예시 값. 개인정보 항목은 이름만(값 숨김)
- 설정 화면 "11번가 원본 데이터 확인" 카드
- 테스트 추가

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 00:47:55 +09:00
parent 6376092bb7
commit 1952e4f0b1
5 changed files with 145 additions and 3 deletions
@@ -852,6 +852,26 @@ def test_elevenst_connection():
assert status == 403 or "허용되지 않은 IP" in exc.message or "XML 아님" in exc.message
else:
raise AssertionError("오류여야 합니다")
# 원본 데이터 확인: 살아 있는 주소는 항목 합계, 없는 주소(404)는 실패로. 개인정보 값은 숨김
rows = ("<ns2:orders xmlns:ns2='x'>" + "".join(
f"<ns2:order><ordNo>{n}</ordNo><ordPayAmt>{a}</ordPayAmt><rcvrNm>홍길동</rcvrNm><prdNm>상품{n}</prdNm>"
f"<ordStlEndDt>2026-09-29 10:00:00</ordStlEndDt></ns2:order>" for n, a in ((1, 10000), (2, 5500))) +
"</ns2:orders>").encode()
def route(url, headers=None, timeout=None):
if "/ordservices/complete/" in url:
return httpx.Response(200, content=rows)
if "/ordservices/" in url:
return httpx.Response(200, content=b"<ns2:orders xmlns:ns2='x'/>")
return httpx.Response(404, content=b"<html>not found</html>")
httpx.get = route
rec = ev.ElevenstAdapter().reconcile(ctx, date(2026, 9, 29))
by = {p["key"]: p for p in rec["probes"]}
assert by["complete"]["ok"] and by["complete"]["count"] == 2 and by["shipping"]["count"] == 0
assert not by["canceledorders"]["ok"] and "404" in by["canceledorders"]["error"]
f = {x["name"]: x for x in by["complete"]["fields"]}
assert f["ordPayAmt"]["sum"] == 15_500 and f["rcvrNm"]["personal"] and f["rcvrNm"]["sample"] == ""
assert f["prdNm"]["sample"] == "상품1" and "홍길동" not in repr(rec)
finally:
httpx.get = orig