pharmacy-pos-qr-system/backend/test_geo_cart_debug.py
thug0bin a672c7a2a0 feat(order): 지오영/수인 선택적 주문 + 장바구니 보존 기능
- internal_code DB 저장 → 프론트에서 선택한 제품 그대로 주문
- 기존 장바구니 백업/복구로 사용자 장바구니 보존
- 수인약품 submit_order() 수정 (체크박스 제외 방식)
- 테스트 파일 정리 및 문서 추가
2026-03-06 23:26:44 +09:00

61 lines
2.0 KiB
Python

# -*- coding: utf-8 -*-
"""
지오영 장바구니 키 매칭 디버그 테스트
- 장바구니 조회 시 반환되는 키와 add_to_cart 시 사용하는 키가 일치하는지 확인
"""
import sys
sys.path.insert(0, r'c:\Users\청춘약국\source\pharmacy-wholesale-api')
from wholesale.geoyoung import GeoYoungSession
def test_cart_keys():
"""장바구니 항목의 키 확인"""
session = GeoYoungSession()
print("=" * 60)
print("지오영 장바구니 키 매칭 디버그")
print("=" * 60)
# 로그인
if not session.login():
print("❌ 로그인 실패")
return
print("✅ 로그인 성공")
# 현재 장바구니 조회
cart = session.get_cart()
print(f"\n📦 장바구니 조회 결과:")
print(f" - success: {cart.get('success')}")
print(f" - total_items: {cart.get('total_items')}")
print(f" - total_amount: {cart.get('total_amount'):,}")
if not cart.get('items'):
print("\n⚠️ 장바구니가 비어있습니다!")
return
print(f"\n📋 장바구니 항목 상세:")
for i, item in enumerate(cart.get('items', [])):
print(f"\n [{i}] {item.get('product_name')}")
print(f" - row_index: {item.get('row_index')}")
print(f" - product_code: {item.get('product_code')}")
print(f" - internal_code: {item.get('internal_code')}")
print(f" - center: {item.get('center')}")
print(f" - quantity: {item.get('quantity')}")
print(f" - unit_price: {item.get('unit_price'):,}")
print(f" - amount: {item.get('amount'):,}")
print(f" - active: {item.get('active')}")
# 키 확인
code = item.get('product_code') or item.get('internal_code')
print(f" → 사용될 키: {code}")
print("\n" + "=" * 60)
print("💡 submit_order_selective()에서 사용하는 키가 위 'product_code'와 일치해야 합니다!")
print("=" * 60)
if __name__ == "__main__":
test_cart_keys()