예제 #1
0
 /**
  * Отправляет реестр платежей в ЯД (СБР).
  *
  * @see yd_payments
  * @see sbr_stages::ydPayout()
  *
  * @param string from_dt   день, на который нужно сформировать реестр.
  */
 public function sendYdDayRegistry($from_dt = null, $debug = false)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/yd_payments.php';
     $yd = new yd_payments();
     $yd->DEBUG = $debug;
     $from_dt = date('Y-m-d', strtotime($from_dt ? $from_dt : '-1 day'));
     if (!($enc_file = $yd->createRegistry($from_dt))) {
         return implode(' | ', $yd->errors);
     }
     $default_from = $this->from;
     $this->from = yd_payments::REGISTRY_FROM;
     $this->subject = "Реестр принятых платежей, {$from_dt}, " . yd_payments::AGENT_NAME;
     $this->message = '';
     if (!$yd->DEBUG) {
         // в ЯД.
         $this->recipient = yd_payments::REGISTRY_YDTO;
         $this->SmtpMail('text/plain', $this->CreateLocalAttach($enc_file));
     }
     // в ВААН
     $noenc_att = $this->CreateLocalAttach($enc_file . yd_payments::REGISTRY_NOENC_SFX);
     foreach (yd_payments::$REGISTRY_VAANTO as $email) {
         $this->recipient = $email;
         $this->SmtpMail('text/plain', $noenc_att);
     }
     $this->from = $default_from;
 }
예제 #2
0
 /**
  * Возвращает информацию о выплате ЯД
  * 
  * @param  int $user_id UID пользователя
  * @return object yd_payments
  */
 function getYdPaymentInfo($user_id)
 {
     if (!$this->sbr->isAdmin()) {
         return;
     }
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/yd_payments.php';
     if (!$this->getPayouts($user_id)) {
         return NULL;
     }
     $payout = $this->payouts[$user_id];
     $yd = new yd_payments($payout['id'], yd_payments::SRC_SBR);
     if (!is_release()) {
         $yd->DEBUG = array('address' => $GLOBALS['host'] . '/norisk2/admin/yd-server-test.php');
         if (defined('BASIC_AUTH')) {
             $yd->DEBUG['headers'] = 'Authorization: Basic ' . base64_encode(BASIC_AUTH) . "\r\n";
         }
     }
     $pmt = $yd->getPayment();
     if ($pmt) {
         $tr = $yd->getTr($pmt['ltr_id']);
         $pmt['dstacnt_nr'] = $tr['dstacnt_nr'];
         $pmt['performed_dt'] = $tr['performed_dt'];
     } else {
         $reqvs = sbr_meta::getUserReqvs($user_id);
         $pmt = array('src_id' => $payout['id'], 'src_type' => yd_payments::SRC_SBR, 'in_amt' => $payout['credit_sum'], 'dstacnt_nr' => $reqvs[sbr::FT_PHYS]['el_yd']);
     }
     $pmt['balance'] = $yd->balance();
     $pmt['errors'] = $yd->errors;
     $pmt['amt_sys'] = exrates::YM;
     return $pmt;
 }
예제 #3
0
         if ($action == 'payout') {
             $stage->payout($user_id);
         }
         if ($action == 'unpayout') {
             $stage->unpayout($user_id);
         }
         if ($action == 'refund') {
             $payment_id = __paramInit('int', 'payment_id', 'payment_id');
             $debug = __paramInit('int', 'debug', 'debug');
             $sbr->refund($payment_id, $stage, $debug);
             //header_location_exit("/norisk2/?site=admin&mode=payouts");
         }
     }
     $sbr_payouts = $sbr->getAllPayouts($page, $dir, $dir_col, $filter);
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/yd_payments.php';
     $yd = new yd_payments();
     if (!is_release()) {
         $yd->DEBUG = array('address' => $GLOBALS['host'] . '/norisk2/admin/yd-server-test.php');
         if (defined('BASIC_AUTH')) {
             $yd->DEBUG['headers'] = 'Authorization: Basic ' . base64_encode(BASIC_AUTH) . "\r\n";
         }
     }
     $yd_balance = $yd->balance();
     break;
 case 'reports':
     $inner = $fpath . 'admin-reports.php';
     $filter = $_POST['filter'];
     $ndfl_action = __paramInit('bool', 'ndfl', 'ndfl');
     $rev_action = __paramInit('bool', 'act_rev', 'act_rev');
     $yd_report = __paramInit('bool', 'yd_report', 'yd_report');
     if (!isset($filter['from'])) {