feat(performance): 매출 업데이트는 보고 있는 기간을 가져오기 + 카페24 환불 기준 비교

- 대시보드 [매출 업데이트]가 최근 7일 고정이 아니라 지금 보고 있는 기간(오늘까지)을 가져온다
  ("이번달"이면 1일~오늘). 모듈 권한자 92일까지, 더 긴 기간(최대 366일)은 관리자만. 미래 기간은 400
- 카페24 매출 대조에 "환불 기준 비교": 환불완료일(완료) vs 환불접수일(전체 상태·상태별),
  실제 환불액만 / 적립금·예치금 포함 — 9/23~27 순매출이 카페24보다 크게 나오는 원인 확인용

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-29 17:21:08 +09:00
parent fb7c29833e
commit a19c1f4cab
7 changed files with 79 additions and 14 deletions
@@ -480,6 +480,11 @@ def test_cafe24_normalize_matches_daily_report():
assert ch["auction"]["kind"] == "unknown" and ch["auction"]["target"] == "cafe24"
assert ch["NCHECKOUT"]["kind"] == "self" and ch["NCHECKOUT"]["label"] == "네이버페이"
assert ch["KAKAOPAY"]["label"] == "톡체크아웃" and ch["mobile"]["label"] == "모바일웹"
# 환불 기준 비교: 완료일(완료만) vs 접수일(전체 상태) — 가짜 API 는 두 기준에 같은 목록을 돌려준다
rb = rec["refund_basis"]
assert rb["completed"]["count"] == 3 and rb["completed"]["actual_refund_amount"] == 12_610 + 20_000 + 9_000
assert rb["accepted_all"]["count"] == 4 and rb["accepted_all"]["with_points"] == 12_610 + 20_000 + 9_000 + 5_000
assert {s["status"]: s["count"] for s in rb["accepted_by_status"]} == {"T": 3, "F": 1}
# 기기: PC 채널(self)이어도 휴대폰 주문(order_from_mobile=T)은 모바일
assert ch["self"]["mobile_orders"] == 1 and ch["self"]["pc_orders"] == 0 and ch["self"]["mobile_total"] == 47_000
assert ch["NCHECKOUT"]["pc_orders"] == 1 and ch["mobile"]["mobile_orders"] == 1