Exemple #1
0
 /**
  * Посылаем уведомление фрилансеру о том что документы по СБР получены.
  *
  * @param string $suids Значение типа 27_11 где 27 - ИД Этапа СБР, 11 - ИД Пользователя   
  *
  * @return bolean
  */
 public function docsReceivedSBR($suids)
 {
     session_start();
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr.php';
     list($stage_id, $user_id) = explode('_', $suids);
     $sbr = new sbr($user_id);
     $stage = current($sbr->getStages($stage_id));
     $t_user = new users();
     $t_user->GetUserByUID($user_id);
     $this->subject = "Получены документы по «Безопасной Сделке» №{$stage->data['sbr_id']}/{$stage->data['id']}";
     $message = "Отправленные вами документы по «Безопасной Сделке» №{$stage->data['sbr_id']}/{$stage->data['id']} получены компанией FL.ru. \n                    На следующем этапе <a href='https://feedback.fl.ru/{$this->_addUrlParams('f', '?')}'>завершения текущей «Безопасной Сделки»</a> вам будут перечислены денежные средства в счет оплаты за выполненную работу. \n                    Вы можете получить дополнительную информацию относительно документации по «Безопасным Сделкам» в соответствующем <a href='https://feedback.fl.ru/{$this->_addUrlParams('f', '?')}'>разделе «Помощи»</a>.";
     $this->recipient = "{$t_user->uname} {$t_user->usurname} [{$t_user->login}] <" . $t_user->email . '>';
     $this->message = $this->GetHtml($t_user->uname, $message, array('header' => 'default', 'footer' => 'simple_norisk'));
     return $this->SmtpMail('text/html');
 }
Exemple #2
0
 /**
  * Создает аккредитив. Регистрирует, если необходимо, кошельки для пользователей.
  * В случае создания кошельков банк отправляет пользователям смс с временным паролем.
  * 
  * @param type $sum         Сумма резерва
  * 
  * @return pskb_lc
  */
 public function reserve()
 {
     $lc = $this->getLC();
     $numDog = $this->_sbr->data['id'];
     if ($lc['lc_id'] > 0 && $lc['state'] == self::STATE_ERR) {
         $resp = $this->_checks(json_encode(array('id' => array($lc['lc_id']))));
         $lc_ch = $resp[$lc['lc_id']];
         if ($lc_ch->state == self::STATE_NEW) {
             if ($this->not_different_finance) {
                 return 'no_different';
             } else {
                 $this->upLC(array('lc_id' => null), $lc['lc_id']);
                 // Нужен новый аккредитив, изменились данные резерва
                 $lc['lc_id'] = null;
             }
         } elseif ($lc_ch->state == self::STATE_COVER) {
             $this->upLC(array('state' => 'new'), $lc['lc_id']);
             pskb::checkStatus(array($lc['lc_id']), $in, $out);
             return true;
         }
     }
     if (!$lc) {
         $this->_setError('Ошибка запроса.');
         return false;
     }
     if ($lc['lc_id'] && $lc['state'] == self::STATE_NEW) {
         $this->_setError('Аккредитив уже создан. Ожидается оплата.');
         return false;
     }
     $cdate = new LocalDateTime();
     $cdate->getExcDaysInit(false, true);
     $stages = $this->_sbr->getStages();
     $work_time = 0;
     foreach ($stages as $stage) {
         $work_time += $stage->data['work_time'];
         $cdate->start_time = "now + {$work_time} day";
         $cdate->setTimestamp(strtotime("now + {$work_time} day"));
         $cdate->getWorkForDay(self::TEMP_STAGE_DELAY);
         $work_time += $cdate->getCountDays();
     }
     // Считаем 5 рабочих дней
     $cdate->getWorkForDay(self::DATE_COVER_DELAY, true);
     $cover_time = $cdate->getTimestamp();
     $exec_time = $cover_time + 3600 * 24 * $work_time;
     $end_time = $exec_time + 3600 * 24 * self::DATE_END_DELAY;
     $dateCoverLC = date('d.m.Y', $cover_time);
     $dateExecLC = date('d.m.Y', $exec_time);
     $dateEndLC = date('d.m.Y', $end_time);
     $resp = $this->_addLC($lc['sum'], $this->_sbr->data['id'], $dateExecLC, $dateEndLC, $dateCoverLC, $lc['tagCust'], $lc['alienCust'], $lc['nameCust'], $lc['numCust'], $lc['psCust'], $lc['accCust'], $lc['innCust'], $lc['nameBankCust'], $lc['swiftCust'], $lc['corAccbankCust'], $lc['emailCust'], $lc['cityBankCust'], $lc['cntrBankCust'], $lc['tagPerf'], $lc['alienPerf'], $lc['namePerf'], $lc['numPerf'], $lc['psPerf'], $lc['accPerf'], $lc['innPerf'], $lc['nameBankPerf'], $lc['swiftPerf'], $lc['corAccbankPerf'], $lc['emailPerf'], $lc['cityBankPerf'], $lc['cntrBankPerf'], $this->_sbr->data['cost']);
     $dateCoverLC = date('Y-m-d', $cover_time);
     $dateExecLC = date('Y-m-d', $exec_time);
     $dateEndLC = date('Y-m-d', $end_time);
     if ($resp->id) {
         $data = array('lc_id' => $resp->id, 'dateCoverLC' => $dateCoverLC, 'dateExecLC' => $dateExecLC, 'dateEndLC' => $dateEndLC, 'state' => $resp->state, 'stateReason' => $resp->stateReason);
         $res = $this->upLC($data, $this->_sbr->data['id'], 'sbr_id');
     } else {
         $this->_setError('Ошибка создания аккредитива.');
         $resp = false;
     }
     return $resp;
 }