Example #1
0
 /**
  * проверяет обязательные параметры запроса
  */
 private function checkParameters()
 {
     $params = $this->parameters();
     Reporter::payExternalParameters($params);
     if (empty($params['order_id']) || empty($params['customer_id'])) {
         Reporter::payExternalParametersFail($params);
         return $this->responseError('Ошибка параметров запроса', 200);
     }
     $params4Hash = ['action' => Input::get('action'), 'orderSumAmount' => Input::get('orderSumAmount'), 'orderSumCurrencyPaycash' => Input::get('orderSumCurrencyPaycash'), 'orderSumBankPaycash' => Input::get('orderSumBankPaycash'), 'shopId' => Input::get('shopId'), 'invoiceId' => Input::get('invoiceId'), 'customerNumber' => Input::get('customerNumber'), 'shopPassword' => Config::get('cloud.yam.secret')];
     $str2Hash = implode(';', $params4Hash);
     $hash = strtoupper(md5($str2Hash));
     \Log::debug('параметры для подписи', [$params4Hash]);
     \Log::debug('строка для подписи', [$str2Hash]);
     \Log::debug('подпись', [$hash]);
     \Log::debug('подпись запроса', [Input::get('md5')]);
     if ($hash !== Input::get('md5')) {
         return $this->responseError('Ошибка авторизации (подпись)', 1);
     }
     return true;
 }
 /**
  * проверяет обязательные параметры запроса
  */
 private function checkParameters()
 {
     $this->params = $this->parameters();
     Reporter::payExternalParameters($this->params);
     if (empty($this->params['customer_id'])) {
         Reporter::payExternalParametersFail($this->params);
         $this->responseError(13);
     }
 }