- internal_code DB 저장 → 프론트에서 선택한 제품 그대로 주문 - 기존 장바구니 백업/복구로 사용자 장바구니 보존 - 수인약품 submit_order() 수정 (체크박스 제외 방식) - 테스트 파일 정리 및 문서 추가
61 lines
2.0 KiB
Python
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()
|