- internal_code DB 저장 → 프론트에서 선택한 제품 그대로 주문 - 기존 장바구니 백업/복구로 사용자 장바구니 보존 - 수인약품 submit_order() 수정 (체크박스 제외 방식) - 테스트 파일 정리 및 문서 추가
65 lines
1.8 KiB
Python
65 lines
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""
|
|
지오영 개별 삭제 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_delete_item():
|
|
session = GeoYoungSession()
|
|
|
|
print("=" * 60)
|
|
print("지오영 개별 삭제(cancel_item) API 테스트")
|
|
print("=" * 60)
|
|
|
|
# 1. 로그인
|
|
if not session.login():
|
|
print("❌ 로그인 실패")
|
|
return
|
|
print("✅ 로그인 성공\n")
|
|
|
|
# 2. 현재 장바구니 조회
|
|
print("📦 [BEFORE] 장바구니:")
|
|
cart = session.get_cart()
|
|
print(f" 품목 수: {cart.get('total_items')}")
|
|
|
|
items = cart.get('items', [])
|
|
if not items:
|
|
print(" ⚠️ 장바구니 비어있음")
|
|
return
|
|
|
|
for item in items:
|
|
print(f" • {item.get('product_name')} (code: {item.get('product_code')})")
|
|
|
|
# 3. 첫 번째 항목 삭제
|
|
first_item = items[0]
|
|
product_code = first_item.get('product_code')
|
|
print(f"\n🗑️ 첫 번째 항목 삭제 시도: {product_code}")
|
|
|
|
del_result = session.cancel_item(product_code=product_code)
|
|
print(f" 결과: {del_result}")
|
|
|
|
# 4. 다시 장바구니 조회
|
|
import time
|
|
time.sleep(1)
|
|
|
|
print("\n📦 [AFTER] 장바구니:")
|
|
cart_after = session.get_cart()
|
|
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 len(cart_after.get('items', [])) < len(items):
|
|
print("\n✅ cancel_item 성공!")
|
|
else:
|
|
print("\n❌ cancel_item 실패!")
|
|
|
|
if __name__ == "__main__":
|
|
test_delete_item()
|