- internal_code DB 저장 → 프론트에서 선택한 제품 그대로 주문 - 기존 장바구니 백업/복구로 사용자 장바구니 보존 - 수인약품 submit_order() 수정 (체크박스 제외 방식) - 테스트 파일 정리 및 문서 추가
61 lines
2.0 KiB
Python
61 lines
2.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
지오영 clear_cart API 테스트
|
|
"""
|
|
import sys
|
|
sys.path.insert(0, r'c:\Users\청춘약국\source\pharmacy-wholesale-api')
|
|
|
|
from dotenv import load_dotenv
|
|
load_dotenv(r'c:\Users\청춘약국\source\pharmacy-wholesale-api\.env')
|
|
|
|
from wholesale.geoyoung import GeoYoungSession
|
|
|
|
def test_clear_cart():
|
|
session = GeoYoungSession()
|
|
|
|
print("=" * 60)
|
|
print("지오영 clear_cart API 테스트")
|
|
print("=" * 60)
|
|
|
|
# 1. 로그인
|
|
if not session.login():
|
|
print("❌ 로그인 실패")
|
|
return
|
|
print("✅ 로그인 성공\n")
|
|
|
|
# 2. 현재 장바구니 조회
|
|
print("📦 [BEFORE] 장바구니 조회:")
|
|
cart = session.get_cart()
|
|
print(f" - 성공: {cart.get('success')}")
|
|
print(f" - 품목 수: {cart.get('total_items')}")
|
|
for item in cart.get('items', []):
|
|
print(f" • {item.get('product_name')} (code: {item.get('product_code')}, qty: {item.get('quantity')})")
|
|
|
|
if not cart.get('items'):
|
|
print("\n⚠️ 장바구니가 이미 비어있어요! 테스트를 위해 뭔가 담아주세요.")
|
|
return
|
|
|
|
# 3. clear_cart 호출
|
|
print("\n🗑️ clear_cart() 호출...")
|
|
clear_result = session.clear_cart()
|
|
print(f" - 결과: {clear_result}")
|
|
|
|
# 4. 다시 장바구니 조회
|
|
import time
|
|
time.sleep(1) # 서버 처리 대기
|
|
|
|
print("\n📦 [AFTER] 장바구니 조회:")
|
|
cart_after = session.get_cart()
|
|
print(f" - 성공: {cart_after.get('success')}")
|
|
print(f" - 품목 수: {cart_after.get('total_items')}")
|
|
for item in cart_after.get('items', []):
|
|
print(f" • {item.get('product_name')} (code: {item.get('product_code')})")
|
|
|
|
if not cart_after.get('items'):
|
|
print("\n✅ clear_cart 성공! 장바구니가 비워졌습니다.")
|
|
else:
|
|
print(f"\n❌ clear_cart 실패! 아직 {len(cart_after.get('items', []))}개 품목 남아있음")
|
|
|
|
if __name__ == "__main__":
|
|
test_clear_cart()
|