コード例 #1
0
ファイル: payment.php プロジェクト: ZerGabriel/ffcms
 private function viewRobokassa()
 {
     if (!extension::getInstance()->getConfig('balance_use_rk', 'user', extension::TYPE_COMPONENT, 'boolean')) {
         exit("Robokassa API disabled");
     }
     require_once root . '/resource/payments/robokassa/robokassa.class.php';
     $init_rk = new Robokassa(extension::getInstance()->getConfig('balance_rk_id', 'user', extension::TYPE_COMPONENT, 'str'), extension::getInstance()->getConfig('balance_rk_key_1', 'user', extension::TYPE_COMPONENT, 'str'), extension::getInstance()->getConfig('balance_rk_key_2', 'user', extension::TYPE_COMPONENT, 'str'), extension::getInstance()->getConfig('balance_rk_test', 'user', extension::TYPE_COMPONENT, 'boolean'));
     $init_rk->OutSum = $amount = (double) system::getInstance()->post('OutSum');
     $init_rk->InvId = $transid = (int) system::getInstance()->post('InvId');
     $user_id = (int) system::getInstance()->post('shp_userid');
     $init_rk->addCustomValues(array('shp_userid' => $user_id));
     if (!$init_rk->checkHash($_POST['SignatureValue'])) {
         exit("Hash sum was wrong!");
     }
     $mul = $params['config']['balance_rk_mul'] = extension::getInstance()->getConfig('balance_rk_mul', 'user', extension::TYPE_COMPONENT, 'float');
     $amount *= $mul;
     user::getInstance()->addBalance($user_id, $amount);
     $payparam = array('amount' => $amount, 'sys_trans_id' => $transid);
     user::getInstance()->putLog($user_id, 'balance.rkadd', $payparam, 'Recharge balance via robokassa');
     echo "Success payment";
 }
コード例 #2
0
ファイル: front.php プロジェクト: ZerGabriel/ffcms
 private function viewUserBalance($target, $viewer)
 {
     if ($target != $viewer || !extension::getInstance()->getConfig('balance_view', 'user', extension::TYPE_COMPONENT, 'bol')) {
         return null;
     }
     $params = array();
     $params['config']['balance_use_webmoney'] = extension::getInstance()->getConfig('balance_use_webmoney', 'user', extension::TYPE_COMPONENT, 'int');
     $params['config']['balance_wm_purse'] = extension::getInstance()->getConfig('balance_wm_purse', 'user', extension::TYPE_COMPONENT, 'str');
     $params['config']['balance_wm_mul'] = extension::getInstance()->getConfig('balance_wm_mul', 'user', extension::TYPE_COMPONENT, 'float');
     $params['config']['balance_wm_test'] = extension::getInstance()->getConfig('balance_wm_test', 'user', extension::TYPE_COMPONENT, 'int');
     $params['config']['balance_valut_name'] = extension::getInstance()->getConfig('balance_valut_name', 'user', extension::TYPE_COMPONENT, 'str');
     $params['config']['balance_wm_type'] = "WM" . system::getInstance()->altsubstr($params['config']['balance_wm_purse'], 0, 1);
     $params['config']['balance_use_ik'] = extension::getInstance()->getConfig('balance_use_ik', 'user', extension::TYPE_COMPONENT, 'int');
     $params['config']['balance_ik_id'] = extension::getInstance()->getConfig('balance_ik_id', 'user', extension::TYPE_COMPONENT, 'str');
     $params['config']['balance_ik_mul'] = extension::getInstance()->getConfig('balance_ik_mul', 'user', extension::TYPE_COMPONENT, 'float');
     $params['config']['balance_ik_valute'] = extension::getInstance()->getConfig('balance_ik_valute', 'user', extension::TYPE_COMPONENT, 'str');
     $params['config']['balance_use_rk'] = extension::getInstance()->getConfig('balance_use_rk', 'user', extension::TYPE_COMPONENT, 'int');
     $params['config']['balance_rk_id'] = extension::getInstance()->getConfig('balance_rk_id', 'user', extension::TYPE_COMPONENT, 'str');
     $params['config']['balance_rk_mul'] = extension::getInstance()->getConfig('balance_rk_mul', 'user', extension::TYPE_COMPONENT, 'float');
     $params['config']['balance_rk_valute'] = extension::getInstance()->getConfig('balance_rk_valute', 'user', extension::TYPE_COMPONENT, 'str');
     if (system::getInstance()->post('rk_submit')) {
         $topay = (double) system::getInstance()->post('topay');
         require_once root . '/resource/payments/robokassa/robokassa.class.php';
         $init_rk = new Robokassa($params['config']['balance_rk_id'], extension::getInstance()->getConfig('balance_rk_key_1', 'user', extension::TYPE_COMPONENT, 'str'), extension::getInstance()->getConfig('balance_rk_key_2', 'user', extension::TYPE_COMPONENT, 'str'), extension::getInstance()->getConfig('balance_rk_test', 'user', extension::TYPE_COMPONENT, 'boolean'));
         $init_rk->OutSum = $topay;
         $init_rk->Desc = 'Recharge balance on ' . property::getInstance()->get('url') . '. Userid: ' . $target;
         $init_rk->Culture = language::getInstance()->getUseLanguage();
         $init_rk->addCustomValues(array('shp_userid' => $target));
         header('Location: ' . $init_rk->getRedirectURL());
         exit("Browser not support header accept. Payment: <a href='" . $init_rk->getRedirectURL() . "'>Start pay</a>");
     }
     $stmt = database::getInstance()->con()->prepare("SELECT * FROM " . property::getInstance()->get('db_prefix') . "_user_log WHERE `owner` = ? and `type` like 'balance.%' ORDER BY `time` DESC LIMIT 0,50");
     $stmt->bindParam(1, $target, \PDO::PARAM_INT);
     $stmt->execute();
     $resultAll = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     $stmt = null;
     foreach ($resultAll as $row) {
         $data_array = unserialize($row['params']);
         $params['balancelogs'][] = array('id' => $row['id'], 'type' => $row['type'], 'message' => $row['message'], 'date' => system::getInstance()->toDate($row['time'], 'h'), 'amount' => $data_array['amount']);
     }
     return $this->viewUserProfileHeader($target, $viewer, $params);
 }