diff --git a/backend/geoyoung_api.py b/backend/geoyoung_api.py index 5b41c63..1084555 100644 --- a/backend/geoyoung_api.py +++ b/backend/geoyoung_api.py @@ -171,6 +171,53 @@ def api_geoyoung_cart_clear(): return jsonify({'success': False, 'error': str(e)}), 500 +@geoyoung_bp.route('/cart/cancel', methods=['POST']) +def api_geoyoung_cart_cancel(): + """ + 장바구니 개별 항목 삭제 API (Hard delete) + + POST /api/geoyoung/cart/cancel + { + "row_index": 0, // 또는 + "product_code": "008709" + } + + ⚠️ 지오영은 완전 삭제됨 (복원 불가, 다시 추가해야 함) + """ + data = request.get_json() or {} + row_index = data.get('row_index') + product_code = data.get('product_code') + + if row_index is None and not product_code: + return jsonify({ + 'success': False, + 'error': 'MISSING_PARAM', + 'message': 'row_index 또는 product_code 필요' + }), 400 + + try: + session = get_geo_session() + result = session.cancel_item(row_index=row_index, product_code=product_code) + return jsonify(result) + except Exception as e: + return jsonify({'success': False, 'error': str(e)}), 500 + + +@geoyoung_bp.route('/cart/restore', methods=['POST']) +def api_geoyoung_cart_restore(): + """ + 삭제된 항목 복원 API - 지오영은 Hard delete이므로 지원 안 함 + + Returns: + 항상 {'success': False, 'error': 'NOT_SUPPORTED'} + """ + return jsonify({ + 'success': False, + 'error': 'NOT_SUPPORTED', + 'message': '지오영은 삭제 후 복원 불가 (다시 추가 필요)' + }), 400 + + @geoyoung_bp.route('/confirm', methods=['POST']) def api_geoyoung_confirm(): """주문 확정 API"""