- wholesale 패키지 연동 (SooinSession, GeoYoungSession) - Flask Blueprint 분리 (sooin_api.py, geoyoung_api.py) - order_context 스키마 확장 (wholesaler_id, internal_code 등) - 수인약품 개별 취소 기능 (cancel_item, restore_item) - 문서 추가: WHOLESALE_API_INTEGRATION.md - 테스트 스크립트들
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""수인약품 API 테스트"""
|
|
import time
|
|
import sys
|
|
|
|
# 현재 디렉토리 추가
|
|
sys.path.insert(0, '.')
|
|
|
|
from sooin_api import SooinSession
|
|
|
|
print('수인약품 API 테스트')
|
|
print('='*50)
|
|
|
|
session = SooinSession()
|
|
|
|
# 1. 로그인 테스트
|
|
start = time.time()
|
|
print('1. 로그인 중...')
|
|
if session.login():
|
|
print(f' ✅ 로그인 성공! ({time.time()-start:.1f}초)')
|
|
else:
|
|
print(' ❌ 로그인 실패')
|
|
sys.exit(1)
|
|
|
|
# 2. 검색 테스트 (KD코드: 코자정)
|
|
start = time.time()
|
|
print('\n2. 검색 테스트 (KD코드: 073100220 - 코자정)...')
|
|
products = session.search_products('073100220', 'kd_code')
|
|
elapsed = time.time() - start
|
|
print(f' 검색 완료: {len(products)}개 ({elapsed:.2f}초)')
|
|
|
|
for p in products[:3]:
|
|
name = p.get('product_name', '')
|
|
spec = p.get('specification', '')
|
|
stock = p.get('stock', 0)
|
|
price = p.get('unit_price', 0)
|
|
code = p.get('internal_code', '')
|
|
print(f' - {name} ({spec})')
|
|
print(f' 재고: {stock}, 단가: {price:,}원, 내부코드: {code}')
|
|
|
|
# 3. 장바구니 조회
|
|
start = time.time()
|
|
print('\n3. 장바구니 조회...')
|
|
cart = session.get_cart()
|
|
elapsed = time.time() - start
|
|
print(f' 장바구니: {cart.get("total_items", 0)}개 품목 ({elapsed:.2f}초)')
|
|
|
|
print('\n' + '='*50)
|
|
print('✅ 테스트 완료!')
|