<?
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/callback/callback.log", PHP_EOL . 'log start - '. date("d/m/Y") .' в '. date("H:i:s"). PHP_EOL, FILE_APPEND);
foreach ($_GET as $key => $value) {
file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/callback/callback.log", $key . ' - ' . $value . PHP_EOL, FILE_APPEND);
}
$status = 500;
if($_GET['status'] == 1) {
$order_id = explode('_',$_GET['orderNumber'])[0];
$arOrder = CSaleOrder::GetByID($order_id);
$sberNumber = $_GET['mdOrder'];
$sberOperation = $_GET['operation'];
$arOrderFields = array('NUM_SBER' => $sberNumber);
if ($sberOperation == 'approved' || $sberOperation == 'deposited') {
// Статус заказа
CSaleOrder::StatusOrder($order_id, 'P');
CSaleOrder::PayOrder($order_id, "Y", true, true);
CSaleOrder::DeliverOrder($order_id, "Y");
AddOrderProperty(21, $sberNumber, $order_id);
AddOrderProperty(23, strtoupper($sberOperation), $order_id);
CSaleOrder::Update($order_id, $arOrderFields);
file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/callback/callback.log", PHP_EOL . 'Заказ '.$order_id . ' - ' . $sberOperation . PHP_EOL, FILE_APPEND);
}
$status = 200;
}
file_put_contents($_SERVER["DOCUMENT_ROOT"] . "/callback/callback.log", PHP_EOL . 'log finish' . PHP_EOL, FILE_APPEND);
http_response_code($status);