feat(order): 지오영/수인 선택적 주문 + 장바구니 보존 기능
- internal_code DB 저장 → 프론트에서 선택한 제품 그대로 주문 - 기존 장바구니 백업/복구로 사용자 장바구니 보존 - 수인약품 submit_order() 수정 (체크박스 제외 방식) - 테스트 파일 정리 및 문서 추가
This commit is contained in:
43
backend/test_submit_order.py
Normal file
43
backend/test_submit_order.py
Normal file
@@ -0,0 +1,43 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""submit_order 메서드 테스트"""
|
||||
import sys; sys.path.insert(0, '.'); import wholesale_path
|
||||
|
||||
# 모듈 리로드
|
||||
import importlib
|
||||
import wholesale.sooin
|
||||
importlib.reload(wholesale.sooin)
|
||||
|
||||
from wholesale import SooinSession
|
||||
|
||||
s = SooinSession()
|
||||
print('1. 로그인...')
|
||||
s.login()
|
||||
|
||||
print('2. 장바구니 비우기...')
|
||||
s.clear_cart()
|
||||
|
||||
print('3. 제품 검색 및 추가...')
|
||||
result = s.search_products('코자정')
|
||||
product = result['items'][0]
|
||||
print(f" 제품: {product['name']} / {product['price']:,}원")
|
||||
|
||||
s.add_to_cart(product['internal_code'], qty=1,
|
||||
price=product['price'], stock=product['stock'])
|
||||
|
||||
print('4. 장바구니 확인...')
|
||||
cart = s.get_cart()
|
||||
print(f" 품목 수: {cart['total_items']}")
|
||||
print(f" 총액: {cart['total_amount']:,}원")
|
||||
|
||||
print('\n5. 주문 전송...')
|
||||
order_result = s.submit_order(memo="API 테스트")
|
||||
print(f" 결과: {order_result}")
|
||||
|
||||
if order_result.get('success'):
|
||||
print('\n🎉 주문 성공!')
|
||||
else:
|
||||
print(f"\n❌ 주문 실패: {order_result.get('error')}")
|
||||
|
||||
print('\n6. 주문 후 장바구니...')
|
||||
cart2 = s.get_cart()
|
||||
print(f" 품목 수: {cart2['total_items']}")
|
||||
Reference in New Issue
Block a user