fix(performance): GS샵 매출 = supGiveAmt(협력사 지급액) — 협력사 포털 주문 통계 금액과 같은 항목
- 9월 실데이터: 6호세트 포털 176,715 ÷ 9 = 19,635 = API supGiveAmt(판매가 23,100·고객 결제 20,330), 7호세트 45,900 × 85%, 주부체험 9,900 × 90% — 상품마다 GS 수수료율이 달라 판매가로는 못 맞춤 - 9/1~9/29 지급액 4,972,689 vs 포털 순주문 4,823,074(주문일↔매출인식일 차이) - 이미 GS 수수료를 뺀 금액이라 GS샵 수수료율은 0% 로 둔다(문서·어댑터 설명) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1288,8 +1288,8 @@ def test_gsshop_token_connection_and_probe():
|
||||
|
||||
|
||||
def test_gsshop_collect_sales():
|
||||
"""GS샵 매출 = 매출 내역 custChrAmt(할인 후 고객 결제금액), 매출인식일 기준, 배송비 제외.
|
||||
SALE 이 아닌 줄은 음수(RETURN). 실데이터 9/3: 16,400 − 820 = 15,580 모양."""
|
||||
"""GS샵 매출 = 매출 내역 supGiveAmt(협력사 지급액 = 포털 주문 통계 금액), 매출인식일 기준, 배송비 제외.
|
||||
SALE 이 아닌 줄은 음수(RETURN). 실데이터 9/3: 판매가 16,400 → 지급액 13,940(85%), 고객 결제 15,580."""
|
||||
import httpx
|
||||
|
||||
from app.modules.performance.adapters import gsshop as gs
|
||||
@@ -1299,7 +1299,7 @@ def test_gsshop_collect_sales():
|
||||
def line(no, item, day, sale, dc, typ="SALE", qty=1):
|
||||
return {"rnum": 1, "saleAwareDt": day, "prdCd": 1064149860, "prdNm": "미라클통 황토 3200ml", "supCd": 1047142,
|
||||
"ordNo": no, "ordItemNo": item, "orgOrdNo": no, "ordType": typ, "chrQty": qty, "salePrice": sale,
|
||||
"dcTotAmt": dc, "custChrAmt": sale - dc, "supGiveAmt": int((sale - dc) * 0.9)}
|
||||
"dcTotAmt": dc, "custChrAmt": sale - dc, "supGiveAmt": round(sale * 0.85)}
|
||||
|
||||
rows = [line(3470403225, 1, 20260903, 16400, 820), line(3470403225, 2, 20260903, 32800, 1640, qty=2),
|
||||
line(3470409999, 1, 20260904, 20000, 0, typ="RTN"), line(3470500000, 1, 20260912, 9900, 0)]
|
||||
@@ -1324,11 +1324,11 @@ def test_gsshop_collect_sales():
|
||||
assert r["ok"], r
|
||||
ev_ = {k[2]: v for k, v in st.events.items() if k[0] == "gsshop"}
|
||||
assert set(ev_) == {"gs:3470403225-1-SALE-20260903", "gs:3470403225-2-SALE-20260903", "gs:3470409999-1-RTN-20260904"}
|
||||
assert ev_["gs:3470403225-1-SALE-20260903"]["amount"] == 15580 and ev_["gs:3470403225-1-SALE-20260903"]["discount_amount"] == 820
|
||||
assert ev_["gs:3470403225-1-SALE-20260903"]["amount"] == 13940 and ev_["gs:3470403225-1-SALE-20260903"]["discount_amount"] == 820
|
||||
assert ev_["gs:3470403225-2-SALE-20260903"]["quantity"] == 2
|
||||
ret = ev_["gs:3470409999-1-RTN-20260904"]
|
||||
assert ret["event_type"] == "RETURN" and ret["amount"] == -20000 and ret["sales_date"] == date(2026, 9, 4)
|
||||
assert sum(v["amount"] for v in ev_.values()) == 15580 + 31160 - 20000 # 배송비 3,500 제외
|
||||
assert ret["event_type"] == "RETURN" and ret["amount"] == -17000 and ret["sales_date"] == date(2026, 9, 4)
|
||||
assert sum(v["amount"] for v in ev_.values()) == 13940 + 27880 - 17000 # 배송비 3,500 제외
|
||||
|
||||
httpx.get = get
|
||||
try:
|
||||
@@ -1336,8 +1336,8 @@ def test_gsshop_collect_sales():
|
||||
code="gsshop", credentials=creds.accessor("gsshop")), date(2026, 9, 3), to=date(2026, 9, 4))
|
||||
finally:
|
||||
httpx.get = orig
|
||||
assert rec["days"][0] == {"date": "2026-09-03", "orders": 1, "amount": 46740, "claimed": 0, "ship": 3500}
|
||||
assert rec["days"][1]["amount"] == -20000 and rec["days"][1]["claimed"] == 20000
|
||||
assert rec["days"][0] == {"date": "2026-09-03", "orders": 1, "amount": 41820, "claimed": 0, "ship": 3500}
|
||||
assert rec["days"][1]["amount"] == -17000 and rec["days"][1]["claimed"] == 17000
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user