<?php
require_once dirname(__DIR__) . '/_bootstrap.php';
require_once dirname(__DIR__, 2) . '/common/web_session_auth.php';

$master = golder_master_pdo();
$ctx = golder_require_current_web_customer_session($master);
$input = golder_api_input();

$reqId = trim((string)($input['request_id'] ?? ''));
$barcode = trim((string)($input['barcode'] ?? ''));
$action = trim((string)($input['scan_action'] ?? 'completed')); // completed veya cancelled

$st = $master->prepare("UPDATE remote_scan_requests SET status = ?, barcode_data = ? WHERE id = ? AND status = 'pending'");
$st->execute([$action, $barcode, $reqId]);

golder_json_response(['status' => 'ok']);


