feat(performance): 토스쇼핑 원본 데이터 확인에 환불 후보 3가지(정산 REFUND·주문 취소 시각·클레임 환불 완료)
- 9/6 실데이터: 매출 29,600 일치, 환불 11,900 은 정산 건별 REFUND 에 없음(다른 날 주문을 9/6 에 환불) - 후보 ① 정산 REFUND(현재 규칙) ② orders/v2 canceledAt(기간 90일 전 주문까지) ③ claims refundedDt(isRefunded) — 날짜별 합계를 나란히 + 건별(주문번호·금액·메모), 화면 숫자와 같은 후보로 규칙을 정한다 - 클레임 목록 개인정보(연락처·수거 주소·요청 사유·사진) 값·합계 숨김, 송장번호 합계도 숨김 - performance.js 캐시 버전 20261001c, 테스트·문서 갱신 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -568,10 +568,23 @@ def test_toss_reconcile_hides_personal():
|
||||
_toss_item(2, 21, "2026-09-09T11:00:00", 9900, status="CANCELED_PAYMENT", ship=3000, group=2)]
|
||||
steps = [_toss_step("REFUND", 2, 21, "2026-09-10T11:00:00", -9900), _toss_step("REFUND", 2, None, "2026-09-10T11:00:00", -3000)]
|
||||
|
||||
# 다른 날(8/20) 주문을 9/10 에 취소 — 기간 앞(90일) 주문 조회에서만 보인다
|
||||
old = {**_toss_item(7, 71, "2026-08-20T10:00:00", 11900, status="CANCELED_PAYMENT"), "canceledAt": "2026-09-10T09:00:00"}
|
||||
claims = [{"id": 1, "type": "RETURN", "status": "COMPLETED", "isRefunded": True, "refundedDt": "2026-09-10T12:00:00",
|
||||
"requestReason": "단순 변심 010-5555-6666", "returnAddress": "서울시 반품동",
|
||||
"order": {"id": 8, "orderProductId": 81, "price": 5000, "createdDt": "2026-08-25T10:00:00",
|
||||
"ordererName": "홍길동", "ordererPhoneNumber": "010-1234-5678"},
|
||||
"product": {"id": 3, "name": "밀폐용기", "quantity": 1}},
|
||||
{"id": 2, "type": "CANCEL", "status": "REQUESTED", "isRefunded": False, "order": {"id": 9, "price": 777}}]
|
||||
|
||||
def get(url, params=None, headers=None, timeout=None):
|
||||
if url.endswith("/settlement-steps"):
|
||||
return httpx.Response(200, json={"resultType": "SUCCESS", "success": {"items": steps, "nextToken": None}})
|
||||
return httpx.Response(200, json={"resultType": "SUCCESS", "success": {"results": rows, "nextCursor": None}})
|
||||
if url.endswith("/claims"):
|
||||
return httpx.Response(200, json={"resultType": "SUCCESS", "success": {"items": claims, "nextToken": None,
|
||||
"hasNext": False}})
|
||||
found = rows if params["startDate"] >= "2026-09-09" else [old] if params["startDate"] <= "2026-08-20" <= params["endDate"] else []
|
||||
return httpx.Response(200, json={"resultType": "SUCCESS", "success": {"results": found, "nextCursor": None}})
|
||||
|
||||
orig = (httpx.get, ts.CALL_INTERVAL_SEC)
|
||||
httpx.get, ts.CALL_INTERVAL_SEC = get, 0
|
||||
@@ -594,6 +607,15 @@ def test_toss_reconcile_hides_personal():
|
||||
labels = [p["label"] for p in rec["probes"]]
|
||||
assert any("결제 뒤 취소·반품(매출 포함)" in x for x in labels)
|
||||
assert any(x.startswith("정산 REFUND — 환불") for x in labels) and any("배송비 줄" in x for x in labels)
|
||||
# 환불 후보 세 가지 — 날짜별 합계 + 건별
|
||||
cand = {c["key"]: c for c in rec["refund_candidates"]}
|
||||
assert cand["settlement"]["days"] == {"2026-09-10": 9900}
|
||||
assert cand["canceled"]["days"] == {"2026-09-10": 11900} and cand["canceled"]["rows"][0]["orderId"] == "7"
|
||||
assert "주문일 2026-08-20" in cand["canceled"]["rows"][0]["note"]
|
||||
assert cand["claims"]["days"] == {"2026-09-10": 5000} and len(cand["claims"]["rows"]) == 1 # 환불 안 된 클레임 제외
|
||||
cf = {x["name"]: x for x in next(p for p in rec["probes"] if p["key"] == "claims")["fields"]}
|
||||
assert cf["requestReason"]["personal"] and cf["returnAddress"]["personal"] and cf["order.ordererPhoneNumber"]["personal"]
|
||||
assert "010-5555-6666" not in repr(rec) and "반품동" not in repr(rec)
|
||||
|
||||
|
||||
def test_not_implemented_and_mock():
|
||||
|
||||
Reference in New Issue
Block a user