fix(performance): 카페24 마켓 통합관리 미사용 — MARKET_MAP 비우기, "카페24 경유" 표시 제거

이 쇼핑몰은 카페24 마켓 통합관리로 들어오는 매출이 없다(사용자 확인). 설정 화면에
네이버·쿠팡 등 9개 쇼핑몰이 "카페24 경유"로 표시돼 카페24 수집분이 그 열로 가는
것처럼 보였다.

- MARKET_MAP = {} — 카페24로 들어온 주문은 market_id 와 관계없이 카페24 열
  (경로 기능은 남겨 두고, 쓰게 되면 매핑만 넣으면 됨)
- 경로 시험은 테스트용 매핑 주입(_with_markets)으로 유지 + 기본값 비어 있음 테스트
- 문서·대조 안내 문구 갱신

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-29 23:59:06 +09:00
parent 1129db9e21
commit b52b182d47
6 changed files with 41 additions and 17 deletions
@@ -405,6 +405,26 @@ def test_not_implemented_and_mock():
# ════════════════════════════════════════════════════════════
# 카페24 어댑터(가짜 API 응답) — 카페24 "일별 매출내역" 기준
# ════════════════════════════════════════════════════════════
# 마켓 통합관리 경로 시험용 매핑 — 실제 MARKET_MAP 은 비어 있다(이 쇼핑몰은 마켓 통합관리 미사용)
TEST_MARKET_MAP = {"shopn": "naver", "sk11st": "elevenst", "coupang": "coupang"}
def _with_markets(fn):
import functools
@functools.wraps(fn)
def run():
from app.modules.performance.adapters import cafe24 as c24
saved = dict(c24.MARKET_MAP)
c24.MARKET_MAP.update(TEST_MARKET_MAP)
try:
fn()
finally:
c24.MARKET_MAP.clear()
c24.MARKET_MAP.update(saved)
return run
def _c24_order(oid, market="self", paid="T", price=50_000, ship=3_000, coupon=5_000, member=1_000, items=2, **kw):
amt = {"order_price_amount": f"{price}.00", "shipping_fee": f"{ship}.00", "coupon_discount_price": f"{coupon}.00",
"membership_discount_amount": f"{member}.00", "points_spent_amount": "0.00",
@@ -447,6 +467,7 @@ class _FakeCafe24(__import__("app.modules.performance.adapters.cafe24", fromlist
return {"orders": self.orders_pages[idx] if idx < len(self.orders_pages) else []}
@_with_markets
def test_cafe24_normalize_matches_daily_report():
from app.modules.performance.adapters.base import AdapterContext
from app.modules.performance.adapters.cafe24 import order_total, target_code
@@ -620,6 +641,7 @@ def test_cafe24_refund_total_includes_points_and_naverpay_cancels():
assert {c["item_code"] for c in rec["no_record_claims"]} == {"NP1-01", "NP2-01", "NP5-02"}
@_with_markets
def test_cafe24_scope_and_replace_range():
import app.modules.performance.sync as syncmod
from app.modules.performance.adapters.base import AdapterContext
@@ -697,6 +719,7 @@ def test_cafe24_paid_total_matches_daily_report():
assert odd["B"]["items_gross"] == 10_000 and odd["B"]["order_price_amount"] == 10_050
@_with_markets
def test_daily_check_db_vs_live():
"""일별 비교: 저장값(카페24 경유 다른 마켓 열 포함) + 지금 API 값(저장 안 함)."""
import app.modules.performance.sync as syncmod
@@ -723,6 +746,14 @@ def test_daily_check_db_vs_live():
assert len(st.events) == 4 # 저장값은 바뀌지 않음
def test_cafe24_market_map_empty_by_default():
"""마켓 통합관리 미사용 — 카페24로 들어온 주문은 market_id 가 무엇이든 카페24 열."""
from app.modules.performance.adapters.cafe24 import MARKET_MAP, target_code
assert MARKET_MAP == {}
assert target_code("shopn") == target_code("coupang", "coupang") == target_code("NCHECKOUT") == "cafe24"
def test_registry_and_event_validation():
codes = [a.code for a in all_adapters()]
assert len(codes) == len(set(codes)) == 10