feat(order): 지오영/수인 선택적 주문 + 장바구니 보존 기능
- internal_code DB 저장 → 프론트에서 선택한 제품 그대로 주문 - 기존 장바구니 백업/복구로 사용자 장바구니 보존 - 수인약품 submit_order() 수정 (체크박스 제외 방식) - 테스트 파일 정리 및 문서 추가
This commit is contained in:
64
backend/test_submit_detail.py
Normal file
64
backend/test_submit_detail.py
Normal file
@@ -0,0 +1,64 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys; sys.path.insert(0, '.'); import wholesale_path
|
||||
from wholesale import SooinSession
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
s = SooinSession()
|
||||
print('1. 로그인 & 장바구니 담기...')
|
||||
s.login()
|
||||
s.clear_cart()
|
||||
|
||||
result = s.search_products('코자정')
|
||||
product = result['items'][0]
|
||||
s.add_to_cart(product['internal_code'], qty=1,
|
||||
price=product['price'], stock=product['stock'])
|
||||
|
||||
# 장바구니 확인
|
||||
resp = s.session.get(f'{s.BAG_VIEW_URL}?currVenCd={s.vendor_code}', timeout=15)
|
||||
soup = BeautifulSoup(resp.content, 'html.parser')
|
||||
int_array = soup.find('input', {'name': 'intArray'})
|
||||
print(f" intArray: {int_array.get('value')}")
|
||||
|
||||
print('\n2. Form 데이터 수집...')
|
||||
form = soup.find('form', {'id': 'frmBag'})
|
||||
form_data = {}
|
||||
for inp in form.find_all('input'):
|
||||
name = inp.get('name', '')
|
||||
if not name:
|
||||
continue
|
||||
inp_type = inp.get('type', 'text').lower()
|
||||
if inp_type == 'checkbox':
|
||||
continue
|
||||
form_data[name] = inp.get('value', '')
|
||||
|
||||
# 주요 필드 출력
|
||||
print(f" kind: {form_data.get('kind')}")
|
||||
print(f" intArray: {form_data.get('intArray')}")
|
||||
print(f" currVenCd: {form_data.get('currVenCd')}")
|
||||
|
||||
print('\n3. kind=order로 변경 후 POST...')
|
||||
form_data['kind'] = 'order'
|
||||
form_data['tx_memo'] = '디버그 테스트'
|
||||
|
||||
print(f" 전송할 필드 수: {len(form_data)}")
|
||||
|
||||
resp = s.session.post(
|
||||
s.BAG_URL, # BagOrder.asp
|
||||
data=form_data,
|
||||
headers={
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Referer': f'{s.BAG_VIEW_URL}?currVenCd={s.vendor_code}'
|
||||
},
|
||||
timeout=30
|
||||
)
|
||||
|
||||
print(f'\n4. 응답 분석...')
|
||||
print(f" 상태코드: {resp.status_code}")
|
||||
print(f" 응답 길이: {len(resp.text)}")
|
||||
print(f"\n 응답 내용:\n{resp.text[:1000]}")
|
||||
|
||||
print('\n5. 주문 후 장바구니 확인...')
|
||||
resp2 = s.session.get(f'{s.BAG_VIEW_URL}?currVenCd={s.vendor_code}', timeout=15)
|
||||
soup2 = BeautifulSoup(resp2.content, 'html.parser')
|
||||
int_array2 = soup2.find('input', {'name': 'intArray'})
|
||||
print(f" intArray: {int_array2.get('value')}")
|
||||
Reference in New Issue
Block a user