printNotification();
return $this;
}
/**
* @return Shop_Payment_System_Handler|Shop_Payment_System_Handler9
*/
protected function _processOrder()
{
parent::_processOrder();
// Установка XSL-шаблонов в соответствии с настройками в узле структуры
$this->setXSLs();
// Отправка писем клиенту и пользователю
$this->send();
return $this;
}
/**
* Вычисление суммы товаров заказа
* @return mixed
*/
public function getSumWithCoeff()
{
return Shop_Controller::instance()->round((1 > 0
&& $this->_shopOrder->shop_currency_id > 0
? Shop_Controller::instance()->getCurrencyCoefficientInShopCurrency(
$this->_shopOrder->Shop_Currency,
Core_Entity::factory('Shop_Currency', 1)
)
: 0) * $this->_shopOrder->getAmount() * 1);
}
/**
* @return mixed
*/
public function getInvoice()
{
return $this->getNotification();
}
/**
* Печатает форму отправки запроса на сайт платёжной системы
* @return mixed|void
*/
public function getNotification()
{
$merchant_id = $this->_cash24_merchant_id; // id мерчанта
$merchant_com = $this->_cash24_command_key;
$order_id = $this->_shopOrder->id; // номер заказа
$amount = $this->getSumWithCoeff(); // сумма покупки
$test_mode = $this->_cash24_test_mode; // тестовый режим
$oSite_Alias = $this->_shopOrder->Shop->Site->getCurrentAlias();
$site_alias = !is_null($oSite_Alias) ? $oSite_Alias->name : '';
$shop_path = $this->_shopOrder->Shop->Structure->getPath();
$result_url = 'http://' . $site_alias . $shop_path . 'cart/'; //url на который будет отправлено уведомление о состоянии платежа
$success_url = $result_url . '?order_id=' . $order_id . '&payment=success'; //url на который будет перенаправлен плательщик после успешной оплаты
$fail_url = $result_url . '?order_id=' . $order_id . "&payment=fail"; //url на который будет перенаправлен плательщик при отказе от оплаты
$time = time() + 24 * 60 * 60;
$arParams = array();
$arParams['amount'] = $amount;
$arParams['currency'] = "RUB";
$arParams['email'] = $_SESSION['hostcmsOrder']['email'];
$arParams['description'] = 'Order #'.$order_id;
$arParams['order'] = $order_id;
$arParams['success'] = htmlspecialchars($success_url);
$arParams['cancel'] = htmlspecialchars($fail_url);
$arParams['callback'] = htmlspecialchars($result_url);
$arParams['method'] = $this->_cash24_method;
$arParams['phone'] = $_SESSION['hostcmsOrder']['phone'];
$arParams['wallet'] = '';
$arParams['expires'] = gmdate('Y-m-d', $time) . 'T' . gmdate('H:i:s', $time);
$respurl = $this->_cash24_test_mode == '1'
? "http://api.staging.cash24.ru/1.0/"
: "https://api.cash24.ru/1.0/";
function createInvoice($arParams,$auth,$key)
{
$auth = $auth;
$commandSecretKey = $key;
$request = '';
$toSign = 'create-invoice';
foreach ($arParams as $key => $val)
{
$request .= "<$key>" . $val . "$key>\r\n";
if ($key != 'expires' && $key != 'phone')
$toSign .= '-' . $val;
}
$sign = md5(htmlspecialchars_decode($toSign) . '-' . $commandSecretKey);
$xml = '