예제 #1
0
 public function showInvoicedAgnt($account, $tpl = '')
 {
     $form_type = sbr::FT_JURI;
     $this->getInvoiceReqv($form_type);
     $contract_num = $this->getContractNum($this->id, $this->scheme_type);
     $rq = $this->getUserReqvs();
     $reqv = $rq[$form_type];
     $sbr_comm = $billCode = "Б-{$contract_num}";
     $pskb = new pskb($this);
     $lc = $pskb->getLC();
     $dvals = array('P' => pskb::$exrates_map[$lc['ps_emp']]);
     $tax_total = 0;
     foreach ($this->stages as $stage) {
         foreach ($this->scheme['taxes'][sbr::EMP] as $tax) {
             if ($tax['tax_code'] != 'TAX_FL') {
                 continue;
             }
             $tax_total += $stage->calcTax($tax, $dvals, $outsys);
             if (!floatval($tax_total)) {
                 continue;
             }
         }
     }
     $sum = $lc['sum'] + $tax_total;
     $ord_num = $lc['id'];
     // Заменяем данными по которым иницирован аккредитив
     $reqv['full_name'] = $lc['nameCust'];
     $reqv['phone'] = $lc['numCust'];
     $reqv['invoiced_time'] = $lc['created'];
     if ($tpl == 'print') {
         include $_SERVER['DOCUMENT_ROOT'] . '/engine/templates/bill/bill_transfer_agnt_print.tpl';
     } else {
         include $_SERVER['DOCUMENT_ROOT'] . '/engine/templates/bill/bill_transfer_agnt.tpl';
     }
 }
예제 #2
0
 /**
  * Совершает выплату юзеру по данному этапу СБР.
  * Выплата -- это отметка, что деньги реально выплачены.
  *
  * @param integer $user_id   ид. юзера, которому предназначается выплата.
  * @return boolean   успешно?
  */
 function payoutAgnt($user_id, pskb $pskb, pskb_lc $pskb_lc)
 {
     setlocale(LC_ALL, 'en_US.UTF-8');
     if (!$this->getPayouts($user_id)) {
         return false;
     }
     if ($this->payouts[$user_id]['completed']) {
         return false;
     }
     $account = new account();
     $account->GetInfo($user_id);
     $credit_sys = $this->payouts[$user_id]['credit_sys'];
     $lc = $pskb->getLC(true);
     $acc = $user_id == $this->sbr->emp_id ? $lc['accCust'] : $lc['accPerf'];
     switch ($credit_sys) {
         case exrates::BANK:
             $descr = "Безнал на счет: {$acc}";
             break;
         case exrates::YM:
             $descr = "Яндекс.Деньги на кошелек: {$acc}";
             break;
         case exrates::WMR:
             $descr = "WMR на кошелек: {$acc}";
             break;
         case exrates::WEBM:
             $descr = "Вывод на Веб-кошелек";
             break;
         case exrates::CARD:
             $descr = "Безнал на счет пластиковой карты";
             break;
         default:
             return !($this->error = 'Неверная валюта');
     }
     $this->sbr->getScheme();
     $percent = 1;
     if ($this->payouts[$user_id]['is_arbitrage'] == 't') {
         $this->getArbitrage();
         $percent = abs((int) ($user_id == $this->sbr->emp_id) - $this->arbitrage['frl_percent']);
     }
     $iex = $credit_sys . $this->sbr->cost_sys;
     if (!$this->exrates) {
         $this->sbr->getExrates();
     }
     $credit_sum = $this->payouts[$user_id]['credit_sum'];
     $debit_sum = round($credit_sum * $this->sbr->exrates[$iex], 2);
     $d_descr = 'Списание ' . ($percent == 1 ? '' : 100 * $percent . '% (арбитраж) ') . "резерва «Безопасной Сделки» (этап #{$this->id})";
     $sbr = sbr_meta::getInstanceLocal($user_id);
     $sbr->initFromId($this->data['sbr_id'], false, false);
     $comments = sbr_meta::view_cost($credit_sum, $credit_sys) . ', ' . $sbr->getContractNum();
     $d_comments = sbr_meta::view_cost($debit_sum, $this->sbr->cost_sys) . ', ' . $sbr->getContractNum();
     if (($debit_id = $account->CommitReserved($sbr->emp_id, $this->sbr->reserved_id, $d_descr, sbr::OP_DEBIT, $debit_sum, $d_comments)) && ($credit_id = $account->TransferReserved($user_id, $credit_sum, $credit_sys - 1, $descr, $errors, sbr::OP_CREDIT, $comments))) {
         $sql = "\n              UPDATE sbr_stages_payouts\n                 SET debit_id = {$debit_id},\n                     credit_id = {$credit_id},\n                     completed = now(),\n                     state = '{$pskb_lc->state}',\n                     \"stateReason\" = '{$pskb_lc->stateReason}',\n                     bank_completed = '{$pskb_lc->date}'\n               WHERE stage_id = {$this->id}\n                 AND user_id = {$user_id}\n\n                 AND completed IS NULL\n              RETURNING *\n            ";
         if ($res = pg_query(self::connect(), $sql)) {
             $this->payoutUpdateState($pskb_lc);
             $docs = array();
             $is_emp_arb = $this->status == sbr_stages::STATUS_ARBITRAGED && $this->arbitrage['resolved'] && floatval($this->arbitrage['frl_percent']) == 0;
             if ($this->sbr->scheme_type == sbr::SCHEME_LC && !$is_emp_arb) {
                 if ($doc_file = $this->generateEmpAgentReport($doc_err, $rep_num)) {
                     // отчет агента.
                     $docs[] = array('stage_id' => $this->id, 'file_id' => $doc_file->id, 'num' => $rep_num, 'status' => sbr::DOCS_STATUS_PUBL, 'access_role' => sbr::DOCS_ACCESS_EMP, 'owner_role' => 0, 'type' => sbr::DOCS_TYPE_AGENT_REP);
                     if ($doc_file = $this->generateEmpAct($doc_err, $doc_num, $rep_num)) {
                         // акт работодателя по агентской схеме (он же отчет об арбитраже, если был арбитраж).
                         $docs[] = array('stage_id' => $this->id, 'file_id' => $doc_file->id, 'num' => $doc_num, 'status' => sbr::DOCS_STATUS_PUBL, 'access_role' => sbr::DOCS_ACCESS_EMP, 'owner_role' => 0, 'type' => sbr::DOCS_TYPE_ACT);
                     }
                 }
             } elseif (($this->sbr->scheme_type == sbr::SCHEME_PDRD || $this->sbr->scheme_type == sbr::SCHEME_PDRD2) && !$is_emp_arb) {
                 if ($doc_file = $this->generateArbReportPdrdEmp($doc_err)) {
                     // отчет арбитража по договору подряда для работодателя.
                     $docs[] = array('stage_id' => $this->id, 'file_id' => $doc_file->id, 'status' => sbr::DOCS_STATUS_PUBL, 'access_role' => sbr::DOCS_ACCESS_EMP, 'owner_role' => 0, 'type' => sbr::DOCS_TYPE_ARB_REP);
                 }
             }
             if (count($docs)) {
                 foreach ($docs as $doc) {
                     $ok = $this->sbr->addDocR($doc);
                 }
             }
             $this->payouts[$user_id] = pg_fetch_assoc($res);
             return true;
         }
     }
     if ($debit_id && !$credit_id) {
         $account->Del($user_id, $debit_id);
     }
     return false;
 }
                    }
                    ?>
                    <div class="b-post__txt b-post__txt_padbot_5 b-post__txt_color_a0763b">Дополнительно вам доступен <a class="b-post__link" href="https://webpay.pscb.ru/login/auth">«Веб-кошелек»</a> (№ <?php 
                    echo $sbr->data['numPerf'];
                    ?>
), который в дальнейшем может быть использован для получения денежных средств. С информацией о «Веб-кошельке» и доступных вам возможностях вы можете ознакомиться <noindex><a rel="nofollow" class="b-post__link" href="https://feedback.fl.ru/topic/397421-veb-koshelek-obschaya-informatsiya/">здесь</a></noindex>.</div>
                <?php 
                }
            }
            if ($event['estatus'] != 't' && $sbr->isEmp()) {
                $update_event_sbr[$event['abbr']] = $event['abbr'];
            }
            break;
        case 'sbr.RESERVE':
            if ($sbr->scheme_type == sbr::SCHEME_LC && $sbr->isEmp()) {
                $reqv = pskb::getPayedReqvs($sbr->data, 'emp');
                foreach ($reqv as $name => $acc) {
                    if ($acc == '') {
                        continue;
                    }
                    ?>
<div class="b-post__txt b-post__txt_padbot_5 b-post__txt_color_a0763b"><?php 
                    echo $name;
                    ?>
&nbsp;&nbsp;&nbsp;&nbsp;<?php 
                    echo $acc;
                    ?>
</div><?php 
                }
                ?>
                <?php 
예제 #4
0
 }
 if (!$sbr->error) {
     if ($rez_type != $sbr->user_reqvs['rez_type'] || $form_type != $sbr->user_reqvs['form_type']) {
         //@todo: запрещаем изменять финансы в старой СБР #29196
         //sbr_meta::setUserReqv($sbr->uid, $rez_type, $form_type, $rrr, false);
         $sbr->user_reqvs['rez_type'] = $rez_type;
         $sbr->user_reqvs['form_type'] = $form_type;
     }
     if ($sbr->data['scheme_type'] == sbr::SCHEME_PDRD2) {
         foreach ($sbr->stages as $_stage) {
             $_stage->setUserReqvHistory($sbr->data['frl_id'], $_stage->id, 0);
         }
     }
     if ($sbr->data['scheme_type'] == sbr::SCHEME_LC) {
         $ps = __paramInit('int', NULL, 'mode_type');
         $pskb = new pskb($sbr);
         $res = $pskb->prepareLC($ps);
         if (!$res) {
             header_location_exit("/" . sbr::NEW_TEMPLATE_SBR . "/?id={$id}");
             break;
         }
     }
     if ($sbr->agree($version)) {
         $type_payment = __paramInit('int', NULL, 'type_payment');
         if ($type_payment > 0) {
             $sbr->setTypePayment($type_payment);
         }
         $sbr_stage = $sbr->getStages();
         foreach ($sbr_stage as $stage) {
             $sbr->setUserReqvHistory($sbr->uid, intval($stage->data['id']), 0);
             // Сохраняем для всех этапов, согласие исполнителя
예제 #5
0
$get = $_GET;
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pskb.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/log.php";
$src = __paramValue('int', $get['res']);
$state = __paramValue('int', $post['state']);
$lc_id = __paramValue('int', $post['account']);
$log_data = array('GET' => $get, 'POST' => $post);
if (!pskb::validateCardRequest($post)) {
    $src = 2;
    $state = -999;
    $log_data['err'] = array('src' => $src, 'state' => $state);
}
$log = new log("pskb_cards/income-" . SERVER . '-%d%m%Y.log', 'a', '%d.%m.%Y %H:%M:%S : ' . $_SERVER['REMOTE_ADDR'] . ' : ');
$log->writevar($log_data);
$pskb = new pskb();
$_lc = $pskb->getLCbyLCId($lc_id);
$err_msg = "Неизвестная ошибка";
if ($src == 2) {
    if ($state && in_array($state, array_keys(pskb::$card_messages))) {
        $err_msg = pskb::$card_messages[$state];
    }
    if (!in_array($state, array(2, -999))) {
        $pskb->upLC(array('state' => 'err', 'stateReason' => $err_msg), $_lc['lc_id']);
    }
}
if ($src === 1 && defined('PSKB_TEST_MODE')) {
    $lc = new pskb_lc(json_encode($_lc));
    $lc->id = $_lc['lc_id'];
    $lc->state = 'cover';
    $test = new pskb_server();
예제 #6
0
function aGetHistoryLC($id, $uid = null, $target = null)
{
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pskb.php';
    $id = __paramValue('int', $id);
    $objResponse = new xajaxResponse();
    if (!hasPermissions('sbr')) {
        return $objResponse;
    }
    $pskb = new pskb();
    $history = $pskb->getHistoryLC($id, $uid, $target);
    if (!is_array($history)) {
        if ($history->id > 0) {
            $history = array($history);
        } else {
            $history = false;
        }
    }
    ob_start();
    include $_SERVER['DOCUMENT_ROOT'] . '/sbr/admin/tpl.history-lc.php';
    $out = ob_get_clean();
    if ($target !== null) {
        $content_name = "user{$target}_history_lc_{$uid}";
    } else {
        $content_name = "history_lc_{$uid}";
    }
    $objResponse->assign("{$content_name}-body", 'innerHTML', $out);
    $objResponse->script("\$('{$content_name}').removeClass('b-shadow_hide')");
    return $objResponse;
}
예제 #7
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pskb.php";
// для беты и альфы
if (is_release()) {
    header_location_exit('/404.php');
}
$lc_id = __paramInit('int', 'lc');
$defaults = $defaults2 = array('service' => 'test', 'account' => $lc_id, 'amount' => 100.22, 'state' => 0);
$defaults['sign'] = pskb::signCardRequest($defaults);
$defaults2['state'] = -1;
$defaults2['sign'] = pskb::signCardRequest($defaults2);
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
        <title>card</title>
        <link href="/css/pskb.css" rel="stylesheet" type="text/css">
    </head>
    <body class="b-page" style=" background:#f0ffdf;">
        <form id="res_frm_1" method="post" action="/income/pscb.php?res=1">
            <?php 
foreach ($defaults as $k => $v) {
    ?>
            <input type="hidden" name="<?php 
    echo $k;
    ?>
" value="<?php 
    echo $v;
    ?>
예제 #8
0
                            <input type="hidden" name="order_id" value="<?php 
        echo $lc['lc_id'];
        ?>
" />
                            <input type="hidden" name="nickname" value="<?php 
        echo $lc['lc_id'];
        ?>
" />
                            <input type="hidden" name="mode_type" value="<?php 
        echo $lc['ps_emp'];
        ?>
" />
                        </form>
                        <div class="b-layout__txt b-layout__txt_padbot_10">
                            Если по какой-либо причине вы еще не произвели платеж, то сможете это сделать перейдя по <a class="b-layout__link" href="javascript:void(0)" onclick="<?php 
        echo $lc['ps_emp'] != onlinedengi::CARD ? "\$('reserveForm').submit();" : "pskb_frame({$lc['lc_id']}, '" . pskb::getNonceSign($lc['lc_id']) . "')";
        ?>
">ссылке</a>.
                        </div>
                        <?php 
    }
    //if
    ?>
                        
                        <div class="b-layout__txt b-layout__txt_padbot_10 b-layout__txt_padtop_10"><a class="b-layout__link" href="/<?php 
    echo sbr::NEW_TEMPLATE_SBR;
    ?>
/">Перейти к списку сделок</a>.</div>
                        <?php 
    if ($doc_file) {
        ?>
예제 #9
0
 $inner = 'stage.php';
 $stage_id = __paramInit('int', 'id', 'id');
 $stage = $sbr->initFromStage($stage_id);
 if ($action == 'arb_resolve' && $sbr->isAdmin()) {
     $resolve = __paramInit('bool', NULL, 'sendform');
     $cancel = __paramInit('bool', NULL, 'cancel');
     if ($resolve) {
         if (!($iagree = __paramInit('bool', NULL, 'iagree'))) {
             $stage->error['arbitrage']['iagree'] = 'Необходимо подтверждение';
         } else {
             if ($stage->arbResolve($_POST)) {
                 $frl_percent = $stage->request['frl_percent'] / 100;
                 $stage->getArbitrage(false, false);
                 // Раз вынесли решение берем арбитраж, для корректного расчета процентов
                 if ($frl_percent != 1 && $stage->sbr->scheme_type == sbr::SCHEME_LC) {
                     $pskb = new pskb($stage->sbr);
                     $lc = $pskb->getLC();
                     $credit_sys = intvalPgSql(pskb::$exrates_map[$lc['ps_emp']]);
                     $stage->setPayoutSys($credit_sys, true, sbr::EMP);
                 }
                 header_location_exit("/norisk2/?site=Stage&id={$stage->id}");
             }
         }
     } elseif ($cancel) {
         if ($stage->arbCancel()) {
             header_location_exit("/norisk2/?site=Stage&id={$stage->id}");
         }
     }
 }
 $arbitrsList = $stage->getArbitrs();
 break;
예제 #10
0
 default:
     $projects_cnt = projects::CountMyProjects($sbr->uid, false, true);
     $is_hidden_newmsg = $sbr->getIdSBRNewMsg($_SESSION['uid']);
     if ($action == 'status_action') {
         $resend = __paramInit('bool', NULL, 'resend');
         $del = __paramInit('bool', NULL, 'del');
         $cancel = __paramInit('bool', NULL, 'cancel');
         $id = __paramInit('int', NULL, 'id');
         $ok = true;
         if ($resend) {
             $ok = $sbr->resendCanceled($id);
         } else {
             if ($cancel) {
                 $ok = $sbr->cancel($id);
                 if ($ok) {
                     $pskb = new pskb($sbr);
                     $lc = $pskb->getLC();
                     if ($lc['state'] == 'new') {
                         $pskb->closeLC($lc['lc_id']);
                     }
                 }
             } else {
                 if ($del) {
                     $ok = $sbr->delete($id);
                 }
             }
         }
         if ($ok) {
             header_location_exit('/' . sbr::NEW_TEMPLATE_SBR . '/' . ($del ? '' : "?id={$id}"));
         }
     }
예제 #11
0
define('IS_OPENED', true);
if (!$_SERVER['DOCUMENT_ROOT']) {
    $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__);
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/config.php";
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pskb.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/log.php';
$log = new log('hourly_sbr/' . SERVER . '-%d%m%Y[%H].log', 'w');
$log->writeln('------------ BEGIN hourly_sbr (start time: ' . date('d.m.Y H:i:s') . ') -----');
/**
 * Проверяем сделки на просрочку 
 */
$sbr_meta = new sbr_meta();
$sbr_meta->renewalWorkStagesByFrozen();
//if(date('G') == 1) {
$sbr_meta->checkStageOvertime();
//}
if (date('H') == 0 || date('H') == 1) {
    pskb::checkExpired();
}
if (date('H') % 4 == 0) {
    // раз в 4 часа
    pskb::checkBankCovered();
    pskb::checkStagePayoutsCompleted();
}
// Должен отработать все сделки до 15 декабря
$log->TRACE(pskb::fillingSuperCheck());
if (date('H') == 23) {
    pskb::prolongPaused();
}
예제 #12
0
 public function handleRequest()
 {
     switch ($this->_action) {
         case self::DO_REQUEST_PAYMENT:
             //                return $this->_processPayment();
             break;
         case self::DO_REQUEST_CHECKIN:
             //                return $this->_processCheck();
             break;
         case self::DO_REQUEST_SUCCESS:
             $pmt = $this->_getPayment($this->_request['nickname']);
             if (!$pmt) {
                 header_location_exit('/404.php');
             }
             $pskb = new pskb();
             $pskb->upLC(array('refund' => 1, 'dol_paymentid' => $this->_request['paymentid']), $pmt['lc_id']);
             header_location_exit('/' . sbr::NEW_TEMPLATE_SBR . '/?site=reserve&id=' . $pmt['sbr_id']);
             break;
         case self::DO_REQUEST_FAILURE:
             $pmt = $this->_getPayment($this->_request['nickname']);
             if (!$pmt || $pmt['state'] != 'new' && $pmt['state'] != 'err') {
                 header_location_exit('/404.php');
             }
             if ($this->_request['duplicate'] == 1) {
                 $pskb = new pskb();
                 $pskb->upLC(array('sended' => 1, 'dol_paymentid' => $this->_request['paymentid']), $pmt['lc_id']);
             } else {
                 if ($this->_request['refund'] == 1) {
                     $pskb = new pskb();
                     $pskb->upLC(array('refund' => 1, 'dol_paymentid' => $this->_request['paymentid']), $pmt['lc_id']);
                 } else {
                     $pskb = new pskb();
                     $pskb->upLC(array('dol_paymentid' => $this->_request['paymentid']), $pmt['lc_id']);
                 }
                 $pskb = new pskb();
                 $pskb_lc = $pskb->checkLC($pmt['lc_id']);
                 if ($pskb_lc->state != pskb::STATE_COVER) {
                     $reason = __paramValue('string', $this->_request['process_message']);
                     $this->_clearPayment($pmt['lc_id'], $reason);
                 }
             }
             header_location_exit('/' . sbr::NEW_TEMPLATE_SBR . '/?site=reserve&id=' . $pmt['sbr_id']);
             break;
         default:
             break;
     }
 }
예제 #13
0
파일: pskb.php 프로젝트: uadev/fl-ru-damp
 public function serve($method, $params = array())
 {
     switch ($method) {
         case 'checkOrCreateWallet':
             $num = $params['num'];
             //имитация
             $test['+71234567890'] = array("state" => "EXIST", "message" => "Уже создан +71234567890", "fio" => "Власов Павел Владимирович", "verified" => TRUE, "identified" => false);
             $test['+79272540217'] = array("state" => "EXIST", "message" => "Cоздан +79272540217", "fio" => "Власов Павел Владимирович", "verified" => TRUE, "identified" => TRUE);
             $test['+380664848120'] = array("state" => "EXIST", "message" => "Уже создан +380664848120", "fio" => "Власов Павел Владимирович", "verified" => FALSE, "identified" => TRUE);
             $test['+79034731235'] = array("state" => "EXIST", "message" => "Уже создан +79034731235", "fio" => "Власов Павел Владимирович", "verified" => TRUE, "identified" => TRUE);
             /*
             $test['+380664848120'] = array(
                 "state" => "EXIST",
                 "message" => "Уже создан +380664848120",
                 "fio" => "Власов Павел Владимирович",
                 "verified" => TRUE,
                 "identified" => false
             );                 
             */
             if (isset($test[$num])) {
                 $lc = $test[$num];
             } else {
                 $lc = array();
             }
             break;
         case 'superCheck':
             //$params = json_decode(file_get_contents('php://input'), 1);
             $ids = explode(",", $params['id']);
             /*if(is_array($params['id'])) {
                   $ids = array_map('intval', $params['id']);
               } else {
                   $ids = array(intval($params['id']));
               }*/
             $ids = array_map('intval', $ids);
             $lcs = $this->getRows($ids);
             if (!$lc) {
                 $lc = $this->_err('Ошибка. Счет не найден.');
             }
             $pskb = new pskb();
             foreach ($lcs as $k => $lc) {
                 if ($lc->state == 'trans') {
                     $lc->state = pskb::PAYOUT_END;
                     $this->set($lc);
                 }
                 $pskb_lc = $pskb->getLCbyLCId($lc->id);
                 $lc->sum = $pskb_lc['sum'];
                 $lc->sumOpen = $pskb_lc['sumOpen'];
                 $lc->numDog = $pskb_lc['sbr_id'];
                 $lc->cover = date('d.m.Y H:i', strtotime($pskb_lc['dateCoverLC']));
                 $payouts = sbr_meta::getStatePayout(array($pskb_lc['sbr_id'], 0), true);
                 if ($payouts) {
                     foreach ($payouts as $payout) {
                         if ($lc->state != pskb::PAYOUT_END) {
                             continue;
                         }
                         $history = array('id' => $lc->id, 'state' => $lc->state, 'date' => date('d.m.Y H:i'), 'uid' => $pskb_lc['sbr_id'] . '-' . ($payout['num'] + 1), 'target' => $payout['user_id'] == $payout['emp_id'] ? false : true, 'sum' => $payout['credit_sum'], 'account' => $payout['user_id'] == $payout['emp_id'] ? $pskb_lc['accCust'] : $pskb_lc['accPerf'], 'ps' => $payout['user_id'] == $payout['emp_id'] ? $pskb_lc['ps_emp'] : $pskb_lc['ps_frl']);
                         $lc->history[] = new pskb_lc(json_encode($history));
                     }
                 }
                 $lcs[$k] = $lc;
             }
             $post = json_encode($lcs);
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $params['urlRejoin']);
             curl_setopt($ch, CURLOPT_POST, 1);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
             curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
             curl_setopt($ch, CURLOPT_TIMEOUT, 30);
             if (defined('BASIC_AUTH')) {
                 curl_setopt($ch, CURLOPT_USERPWD, BASIC_AUTH);
             }
             $res = curl_exec($ch);
             return;
             break;
         case 'historyLC':
             $id = intval($params['id']);
             $lc = $this->get($id);
             if (!$lc) {
                 $lc = $this->_err('Ошибка. Счет не найден.');
             }
             if ($lc->state == 'trans') {
                 $lc->state = pskb::PAYOUT_END;
                 $this->set($lc);
             }
             $lc->sum = 1000;
             $lc->account = '79210000000';
             $lc->uid = $params['uid'];
             $lc->target = $params['target'] ? $params['target'] : true;
             $lc->date = date('d.m.Y H:i');
             break;
         case 'addLC':
             $lc = new pskb_lc();
             $lc->state = 'form';
             $lc->stateReason = 'test';
             foreach ($params as $k => $v) {
                 $lc->{$k} = $v;
             }
             $lc = $this->set($lc);
             break;
         case 'checkLC':
             $id = intval($params['id']);
             $lc = $this->get($id);
             if (!$lc) {
                 $lc = $this->_err('Ошибка. Счет не найден.');
             }
             //                $m = new memBuff();
             //                $cntr = intval($m->get('___lc_cntr__' . $lc->id));
             //
             //                if ($lc->state == 'form' && $cntr == 3) {
             //                    $lc->state = 'err';
             //                    $lc->stateReason = '500';
             //                    $this->set($lc);
             //                }
             //
             //                if ($lc->state == 'form' && $cntr > 5) {
             //                    $lc->state = 'new';
             //                    $this->set($lc);
             //                }
             //
             //                $m->set('___lc_cntr__' . $lc->id, ($cntr+1));
             //
             if ($lc->state == 'form') {
                 $lc->state = 'new';
                 $this->set($lc);
             }
             break;
         case 'checks':
             $this->expStatusUpdate();
             $id = json_decode(file_get_contents('php://input'), 1);
             $ids = $id['id'];
             $lc = $this->getRows($ids);
             if (!$lc) {
                 $lc[] = $this->_err('Ошибка. Счет не найден.');
             }
             break;
         case 'changeDateLC':
             $id = intval($params['id']);
             $lc = $this->get($id);
             if (!$lc) {
                 $lc = $this->_err('Ошибка. Счет не найден.');
                 break;
             }
             if ($lc->status == 'end') {
                 $lc = $this->_err('Ошибка. Счет не найден.');
                 break;
             }
             foreach ($params as $k => $v) {
                 $lc->{$k} = $v;
             }
             $this->set($lc);
             break;
         case 'openLC':
             $id = intval($params['id']);
             $lc = $this->get($id);
             if (!$lc) {
                 $lc = $this->_err('Ошибка. Счет не найден.');
                 break;
             }
             if ($lc->status == 'end') {
                 $lc = $this->_err('Ошибка. Счет не найден.');
                 break;
             }
             $lc->state = 'passed';
             $lc->sms = strtoupper(substr(md5(time()), 3, 4));
             $this->set($lc);
             break;
         case 'subOpenLC':
             $id = intval($params['id']);
             $lc = $this->get($id);
             $code = $params['asp'];
             if (!$lc) {
                 $lc = $this->_err('Ошибка. Счет не найден.');
                 break;
             }
             if ($lc->status == 'end') {
                 $lc = $this->_err('Ошибка. Счет не найден.');
                 break;
             }
             if ($code != $lc->sms) {
                 $lc = $this->_err('Неверный код подтверждения.');
                 break;
             }
             foreach ($params as $k => $v) {
                 $lc->{$k} = $v;
             }
             $lc->state = 'trans';
             $this->set($lc);
             break;
         case 'transLC':
             $id = intval($params['id']);
             $lc = $this->get($id);
             if (!$lc) {
                 $lc = $this->_err('Ошибка. Счет не найден.');
                 break;
             }
             if ($lc->state != 'err') {
                 $lc = $this->_err('Ошибка. Приемлемо только для LC в статусе err.');
                 break;
             }
             $lc->state = 'end';
             $this->set($lc);
             break;
         case 'reqCode':
             $id = intval($params['id']);
             $lc = $this->get($id);
             if (!$lc) {
                 $lc = $this->_err('Ошибка. Счет не найден.');
                 break;
             }
             if ($lc->state != 'passed') {
                 $lc = $this->_err('Ошибка. Приемлемо только для LC в статусе passed.');
                 break;
             }
             $lc->sms = strtoupper(substr(md5(time()), 3, 4));
             $this->set($lc);
             break;
         default:
             $lc = $this->_err('Ошибка запроса.');
     }
     echo json_encode($lc);
     exit;
 }
예제 #14
0
 /**
  * Верификация через веб-кошелек ПСКБ. 
  * Требуется заполненность ФИО, пасспорта и активированного номера телефона
  * 
  * @param  integer $uid  uid пользователя
  * @return boolean       результат операции
  */
 public function pskb($uid)
 {
     global $DB;
     if (empty($uid)) {
         $this->error = 'Вы не авторизованы.';
         return false;
     }
     $logId = $DB->insert('verify_pskb', array('user_id' => $uid), 'id');
     // используем проверку на заполненость полей от яндекса, она подходит
     if (empty($this->aUserReqvs)) {
         if (!$this->ydCheckUserReqvs($uid)) {
             return false;
         }
     }
     $phone = $this->aUserReqvs[1]['mob_phone'];
     $pskb = new pskb();
     $res = $pskb->checkOrCreateWallet($phone);
     $DB->update('verify_pskb', array('phone' => $phone, 'log' => $res), "id = ?", $logId);
     if (empty($res)) {
         $this->error = 'Ошибка соединения с Веб-кошельком.';
         return false;
     }
     $res = json_decode(iconv('cp1251', 'utf8', $res), 1);
     if (empty($res['state']) || !in_array($res['state'], array('EXIST', 'COMPLETE'))) {
         $this->error = 'Веб-кошелек не создан.';
         return false;
     }
     if (!$res['verified']) {
         $this->error = 'Для верификации у вас должен быть идентифицированный кошелек.';
         return false;
     }
     $aFields = array('fio', 'birthday', 'idcard_name', 'idcard', 'idcard_from', 'idcard_by', 'mob_phone');
     $this->data = array();
     foreach ($aFields as $sField) {
         $this->data[$sField] = $this->aUserReqvs[1][$sField];
     }
     if ($this->verify($uid)) {
         $DB->update('verify_pskb', array('result' => true), "id = ?", $logId);
         return true;
     }
     return false;
 }
예제 #15
0
<?php

define('NO_CSRF', 1);
$request = $_POST;
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/stdf.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/pskb.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/log.php";
if ($_GET['key'] != pskb::KEY_CHECK_AUTH) {
    exit;
}
// Авторизация
pskb::listenRequest('superCheck');
exit;
예제 #16
0
<?php

ini_set('max_execution_time', '0');
ini_set('memory_limit', '512M');
require_once "../classes/config.php";
require_once "../classes/pskb.php";
pskb::fixStagePayoutsCompleted();
예제 #17
0
      <span class="b-icon b-icon_top_1 b-icon_margleft_-20 b-icon_sbr_oattent"></span>Для проведения сделки будут использованы ваши данные со страницы  «<a href="/users/<?= $sbr->login ?>/setup/finance/" class="b-layout__link b-layout__link_bordbot_dot_0f71c8">Финансы</a>». 
      Пожалуйста, проверьте актуальность указанных данных.
  </div>
  <div id="form_type_alert" class="b-layout__txt b-layout__txt_color_c10600 b-layout__txt_padbot_15 b-layout__txt_padleft_20 b-layout_hide no-finance-alert">
      <span class="b-icon b-icon_top_1 b-icon_margleft_-20 b-icon_sbr_rattent"></span>Вам не хватает данных на странице «<a class="b-layout__link b-layout__link_bordbot_dot_0f71c8" href="/users/<?= $sbr->login ?>/setup/finance/">Финансы</a>». 
      Пожалуйста, заполните всё необходимое, иначе вы не сможете воспользоваться сервисом «Сделка Без Риска».
  </div>*/
?>
        <div id="inline_reqvs_alert" class="b-layout__txt b-layout__txt_color_a0763b b-layout__txt_padbot_30 b-layout__txt_padleft_20">
            <span class="b-icon b-icon_top_2 b-icon_margleft_-20 b-icon_sbr_oattent"></span>Внимательно заполните все поля ниже. После начала сделки эти настройки нельзя будет изменить.</div>
        
        
        <div id="inline_reqvs">
            <?php 
if ($sbr->user_reqvs['rez_type']) {
    $reqvs_fields = pskb::getReqvsFields($sbr->user_reqvs['rez_type']);
} else {
    $reqvs_fields = pskb::$reqvs_fields_both;
}
$reqv_1 = array();
foreach ($reqvs_fields as $k => $v) {
    if (!array_key_exists($k, $sbr->user_reqvs[1])) {
        continue;
    }
    if (in_array('all', $v[2]) || in_array(sbr::FT_PHYS, $v[2])) {
        $reqv_1[$k] = $sbr->user_reqvs[1][$k];
    }
}
$reqv_2 = array();
foreach ($reqvs_fields as $k => $v) {
    if (!array_key_exists($k, $sbr->user_reqvs[2])) {
예제 #18
0
    if ($sbr->isFrl() && $sbr->scheme_type == sbr::SCHEME_LC && $stage->getPayoutSum(sbr::FRL) > 0) {
        ?>
            <div class="b-layout b-layout_padtop_20 b-layout_marglr_15">
                <div class="b-layout__inner b-layout__inner_marglr_-15">
                    <table class="b-layout__table b-layout__table_width_full"  cellpadding="0" cellspacing="0" border="0">
                        <tr class="b-layout__tr">
                            <td class="b-layout__left b-layout__left_padleft_35 b-layout__left_padright_20">
                                <div class="b-layout__txt"></div>
                            </td>
                            <td class="b-layout__right b-layout__right_padright_15 b-layout__right_width_73ps">
                                <?php 
        echo $stage->_new_getTaxInfo(NULL, array('P' => pskb::$exrates_map[$stage->data['ps_frl']]), null, false);
        ?>
                                <div class="b-layout__txt b-layout__txt_color_a0763b b-layout__txt_padleft_20">
                                    <span class="b-icon b-icon_top_2 b-icon_margleft_-20 b-icon_sbr_oattent"></span>После нажатия на кнопку "Завершить этап" вам придет смс с кодом подтверждения на номер <strong><?php 
        echo pskb::phone($lc['numPerf']);
        ?>
</strong>.
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>            
        <?php 
    }
    ?>
        
        <div class="b-layout b-layout_padtop_20 b-layout_marglr_15">
            <div class="b-layout__inner b-layout__inner_padbot_20 b-layout__inner_marglr_-15">
                <table class="b-layout__table b-layout__table_width_full"  cellpadding="0" cellspacing="0" border="0">
예제 #19
0
ini_set('max_execution_time', '0');
ini_set('memory_limit', '512M');
define('IS_OPENED', true);
if (!$_SERVER['DOCUMENT_ROOT']) {
    $_SERVER['DOCUMENT_ROOT'] = dirname(__FILE__);
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/config.php';
//require_once("classes/log.php");
//$log = new log('minutly/minutly-sbr-'.SERVER.'-%d%m%Y[%H].log', 'w');
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/pskb.php';
/*
 * проверка статуса новых аккредитивов и покрытия
 */
pskb::checkStatus(null, $in, $out);
/*
 * проверка аккредитивов в статусе trans (перечисление денег)
 */
if (date('i') % 5 == 0) {
    pskb::checkStagePayoputForSuperCheck(null, $in, $out);
}
if (pskb::PSKB_SUPERCHECK && date('i') % 2 == 0) {
    // сократим до раз в две минуты, раньше смысла нет. Ответ от ПСКБ формируется до 5 минут
    pskb::checkStagePayouts(null, $in, $out);
} elseif (!pskb::PSKB_SUPERCHECK) {
    // Если отключен суперчек по старому
    pskb::checkStagePayouts(null, $in, $out);
}
if (date('i') % 2 == 0) {
    require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/sbr_adm.php';
    sbr_adm::processInvoiceData();
}
예제 #20
0
);"></span>
</div>
<script>
    // Перекидываем в body
    document.body.appendChild(document.getElementById('pskb-frame'));
    
    var pskb_frame = function(id, sgn) {
        if (!parseInt(id)) {
            return false;
        }
        if (!sgn) {
            return false;
        }
        var f = $('pskb-frame');
        var bg = $('pskb-frame-bg');
        if (!bg || !f) {
            return false;
        }
        
        f.getElement('.b-shadow__icon_close').removeEvents('click');
        $$('#pskb-frame, #pskb-frame-bg').removeClass('b-shadow_hide');
        f.getElement('iframe').set('src', '<?php 
echo pskb::getCardsFrameUrl();
?>
' + id + '&sign=' + sgn);
    };

    var pskb_frame_close = function(no_reload) {
        document.location.reload();
    };
</script>