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
+33
View File
@@ -826,6 +826,39 @@
}
});
// ── 11번가 원본 데이터 확인 — 후보 조회 주소별 동작 여부·항목 합계 ──
const probe = document.getElementById("perf-probe");
if (probe) probe.addEventListener("click", async function () {
const day = document.getElementById("perf-probe-date").value;
const out = document.getElementById("perf-probe-result");
if (!day) return;
probe.disabled = true;
out.innerHTML = '<p class="perf-muted">11번가에서 불러오는 중… (주소 9개)</p>';
try {
const r = await api("GET", "/performance/api/marketplaces/" + probe.dataset.code + "/reconcile?date=" + encodeURIComponent(day));
if (!r.ok) { out.innerHTML = '<p class="perf-notice is-warn">' + esc((r.label ? r.label + " — " : "") + r.message) + "</p>"; return; }
const summary = '<table class="perf-table" style="margin-top:8px"><thead><tr><th class="perf-th-label">조회</th>' +
'<th class="perf-th-label">주소</th><th class="perf-th-label">결과</th><th>건수</th></tr></thead><tbody>' +
r.probes.map(function (p) {
return '<tr><td class="perf-td-label">' + esc(p.label) + '</td><td class="perf-muted">' + esc(p.path) + "</td><td>" +
(p.ok ? '<span class="perf-pill is-ok">동작</span>' : '<span class="perf-pill is-bad">실패</span> <span class="perf-muted" style="white-space:normal">' + esc(p.error) + "</span>") +
'</td><td class="perf-num">' + (p.ok ? fmt(p.count) : "") + "</td></tr>";
}).join("") + "</tbody></table>";
const details = r.probes.filter(function (p) { return p.ok && p.count; }).map(function (p) {
return '<h4 class="perf-h" style="margin:14px 0 6px">' + esc(p.label) + " — " + fmt(p.count) + "줄</h4>" +
'<table class="perf-table"><thead><tr><th class="perf-th-label">항목</th><th>채워진 줄</th><th>숫자 합계</th>' +
'<th class="perf-th-label">예시 값</th></tr></thead><tbody>' +
p.fields.map(function (f) {
return '<tr><td class="perf-td-label">' + esc(f.name) + '</td><td class="perf-num">' + fmt(f.filled) + '</td><td class="perf-num">' +
(f.sum == null ? "" : fmt(f.sum)) + "</td><td>" + (f.personal ? '<span class="perf-muted">개인정보(숨김)</span>' : esc(f.sample)) + "</td></tr>";
}).join("") + "</tbody></table>";
}).join("");
out.innerHTML = summary + (details || '<p class="perf-muted" style="margin-top:8px">그날 조회된 주문이 없습니다. 셀러오피스에서 매출이 있던 날로 다시 해 보세요.</p>');
} catch (err) {
out.innerHTML = '<p class="perf-notice is-warn">' + esc(err.message) + "</p>";
} finally { probe.disabled = false; }
});
// ── 과거 매출 가져오기(기간 지정 수집, 관리자) ──
const backfill = document.getElementById("perf-backfill");
if (backfill) backfill.addEventListener("click", async function () {