- internal_code DB 저장 → 프론트에서 선택한 제품 그대로 주문 - 기존 장바구니 백업/복구로 사용자 장바구니 보존 - 수인약품 submit_order() 수정 (체크박스 제외 방식) - 테스트 파일 정리 및 문서 추가
61 lines
1.7 KiB
Python
61 lines
1.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""API 직접 테스트 - 디버그용"""
|
|
import requests
|
|
import json
|
|
|
|
# 지오영에서 실제 품목 검색해서 internal_code 얻기
|
|
import sys; sys.path.insert(0, '.'); import wholesale_path
|
|
from wholesale import GeoYoungSession
|
|
|
|
g = GeoYoungSession()
|
|
g.login()
|
|
|
|
# 재고 있는 품목 검색
|
|
r = g.search_products('라식스')
|
|
if r.get('items'):
|
|
item = r['items'][0]
|
|
print("="*60)
|
|
print("검색된 품목:")
|
|
print(f" name: {item['name']}")
|
|
print(f" internal_code: {item['internal_code']}")
|
|
print(f" stock: {item['stock']}")
|
|
print(f" price: {item['price']}")
|
|
print("="*60)
|
|
|
|
# API 호출
|
|
payload = {
|
|
"wholesaler_id": "geoyoung",
|
|
"items": [{
|
|
"drug_code": "652100200",
|
|
"kd_code": "라식스",
|
|
"internal_code": item['internal_code'], # 검색된 internal_code 사용
|
|
"product_name": item['name'],
|
|
"manufacturer": "한독",
|
|
"specification": item.get('spec', ''),
|
|
"order_qty": 1,
|
|
"usage_qty": 100,
|
|
"current_stock": 0
|
|
}],
|
|
"reference_period": "2026-02-01~2026-03-07",
|
|
"dry_run": False,
|
|
"cart_only": False
|
|
}
|
|
|
|
print("\n" + "="*60)
|
|
print("API 요청:")
|
|
print(json.dumps(payload, ensure_ascii=False, indent=2))
|
|
print("="*60)
|
|
|
|
response = requests.post(
|
|
'http://localhost:7001/api/order/quick-submit',
|
|
json=payload,
|
|
timeout=60
|
|
)
|
|
|
|
print("\n" + "="*60)
|
|
print(f"응답 (status: {response.status_code}):")
|
|
print(json.dumps(response.json(), ensure_ascii=False, indent=2))
|
|
print("="*60)
|
|
else:
|
|
print("품목을 찾을 수 없습니다")
|