<?php 

/**
* Входящий платеж
*/

if (isset($_POST['notification_type'])) {
  
  // Получение настроек системы
  $set_paytype = $payment->getSettings('yandex');
  
  $dataID = explode(':', base64_decode($_POST['label']));
  
  $checkPOST = array(
                  'id' => (int) $dataID[0], 
                  'service' => '', 
                  'service_id' => '', 
                  'wmr' => round($_POST['withdraw_amount'], 2), 
                  'array' => serialize($_POST),
                  'paytype' => 'yandex',
                  'method' => 'Яндекс.Деньги - ' . my_esc($_POST['notification_type']),
                  'resp' => 'OK',
                  );
  
  $data = $_POST['notification_type'].'&'.
          $_POST['operation_id'].'&'.
          $_POST['amount'].'&'.
          $_POST['currency'].'&'.
          $_POST['datetime'].'&'.
          $_POST['sender'].'&'.
          $_POST['codepro'].'&'.
          $set_paytype['PAYMENT']['SECRET_KEY'].'&'.
          base64_encode($dataID[0].':'.sha1($dataID[0].$_POST['withdraw_amount'].$set_paytype['PAYMENT']['SECRET_KEY']));

  $hash = sha1($data);
  
  if ($request === 'result') {
    if ($hash === $_POST['sha1_hash'] && $_POST['codepro'] == 'false') {
      $pay_result = 'result';
    }
  }
}