feat(baekje): order_api에서 선별 주문 사용
- submit_order_selective로 기존 장바구니 보존 - 지오영/수인과 동일한 방식 적용
This commit is contained in:
parent
0ae4ae66f0
commit
497aeee75f
@ -982,13 +982,23 @@ def submit_baekje_order(order: dict, dry_run: bool, cart_only: bool = True) -> d
|
|||||||
'internal_code': internal_code
|
'internal_code': internal_code
|
||||||
})
|
})
|
||||||
|
|
||||||
# cart_only=False면 주문 확정까지 진행
|
# cart_only=False면 주문 확정까지 진행 (선별 주문!)
|
||||||
if not cart_only and success_count > 0:
|
if not cart_only and success_count > 0:
|
||||||
try:
|
try:
|
||||||
confirm_result = baekje_session.submit_order()
|
# 이번에 담은 품목의 internal_code만 수집
|
||||||
|
ordered_codes = [r['internal_code'] for r in results
|
||||||
|
if r['status'] == 'success' and r.get('internal_code')]
|
||||||
|
|
||||||
|
logger.info(f"[BAEKJE DEBUG] 선별 주문 시작, ordered_codes: {ordered_codes}")
|
||||||
|
|
||||||
|
if ordered_codes:
|
||||||
|
# 선별 주문: 기존 품목은 건드리지 않고, 이번에 담은 것만 주문
|
||||||
|
confirm_result = baekje_session.submit_order_selective(ordered_codes)
|
||||||
|
|
||||||
if confirm_result.get('success'):
|
if confirm_result.get('success'):
|
||||||
|
restored_info = f", 기존 {confirm_result.get('restored_count', 0)}개 복원" if confirm_result.get('restored_count', 0) > 0 else ""
|
||||||
update_order_status(order_id, 'submitted',
|
update_order_status(order_id, 'submitted',
|
||||||
f'백제 주문 확정 완료: {success_count}개')
|
f'백제 주문 확정 완료: {success_count}개{restored_info}')
|
||||||
# 결과 메시지 업데이트
|
# 결과 메시지 업데이트
|
||||||
for r in results:
|
for r in results:
|
||||||
if r['status'] == 'success':
|
if r['status'] == 'success':
|
||||||
@ -997,6 +1007,9 @@ def submit_baekje_order(order: dict, dry_run: bool, cart_only: bool = True) -> d
|
|||||||
else:
|
else:
|
||||||
update_order_status(order_id, 'partial',
|
update_order_status(order_id, 'partial',
|
||||||
f'백제 장바구니 담김, 확정 실패: {confirm_result.get("error", "알 수 없는 오류")}')
|
f'백제 장바구니 담김, 확정 실패: {confirm_result.get("error", "알 수 없는 오류")}')
|
||||||
|
else:
|
||||||
|
update_order_status(order_id, 'partial',
|
||||||
|
f'백제 장바구니 담김, internal_code 없음')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"백제 주문 확정 오류: {e}")
|
logger.error(f"백제 주문 확정 오류: {e}")
|
||||||
update_order_status(order_id, 'partial',
|
update_order_status(order_id, 'partial',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user