Ejemplo n.º 1
0
 public function save_payment()
 {
     $system_gid = $this->input->post('system_gid', true);
     if (empty($system_gid)) {
         $this->system_messages->add_message('error', l('error_empty_system_gid', 'users_payments'));
     }
     if ($system_gid) {
         $user_id = $this->session->userdata('user_id');
         $amount = abs(floatval(str_replace(',', '.', $this->input->post('amount', true))));
         if (empty($amount)) {
             $this->system_messages->add_message('error', l('error_empty_amount', 'users_payments'));
         } elseif (empty($system_gid)) {
             $this->system_messages->add_message('error', l('error_empty_system_gid', 'users_payments'));
         } else {
             $this->load->model('payments/models/Payment_currency_model');
             $base_currency = $this->Payment_currency_model->get_currency_default(true);
             $this->load->helper('payments');
             $additional['name'] = l('header_add_funds', 'users_payments');
             $additional['lang'] = 'header_add_funds';
             $additional['module'] = 'users_payments';
             $payment_data = send_payment('account', $user_id, $amount, $base_currency['gid'], $system_gid, $additional, 'form');
             if (!empty($payment_data['errors'])) {
                 $this->system_messages->add_message('error', $payment_data['errors']);
             }
             if (!empty($payment_data['info'])) {
                 $this->system_messages->add_message('info', $payment_data['info']);
             }
         }
     }
     $this->load->helper('seo');
     $url = rewrite_link('users', 'account', array('action' => 'update'));
     redirect($url);
 }
Ejemplo n.º 2
0
 function ajax_add_funds()
 {
     $this->load->model('payments/models/Payment_currency_model');
     $amount = abs(floatval($this->input->post('amount', true)));
     $user_ids = $this->input->post('user_ids', true);
     if (empty($amount)) {
         $return['error'] = l('error_empty_amount', 'users_payments');
     } elseif (empty($user_ids)) {
         $return['error'] = l('error_empty_users_list', 'users_payments');
     } else {
         $this->load->helper('payments');
         foreach ($user_ids as $id_user) {
             $payment_data = send_payment('account', $id_user, $amount, $this->Payment_currency_model->default_currency["gid"], 'manual', array('name' => l('added_by_admin', 'users_payments'), 'lang' => 'added_by_admin', 'module' => 'users_payments'));
             $payment_data['data']['status'] = 1;
             receive_payment('manual', $payment_data['data']);
         }
         $return['success'] = '';
         $this->system_messages->add_message('success', l('success_add_funds', 'users_payments'));
     }
     echo json_encode($return);
     return;
 }
Ejemplo n.º 3
0
 public function save_payment()
 {
     $user_id = $this->session->userdata('user_id');
     $amount = $this->input->post('amount', true);
     $system_gid = $this->input->post('system_gid', true);
     if (empty($amount)) {
         $this->set_api_content('errors', l('error_empty_amount', 'users_payments'));
     } elseif (empty($system_gid)) {
         $this->set_api_content('errors', l('error_empty_system_gid', 'users_payments'));
     } else {
         $this->load->model('payments/models/Payment_currency_model');
         $this->load->helper('payments');
         $additional['name'] = l('header_add_funds', 'users');
         $payment_data = send_payment('account', $user_id, $amount, $this->Payment_currency_model->default_currency['gid'], $system_gid, $additional, 'form');
         if (!empty($payment_data['errors'])) {
             $this->set_api_content('errors', $payment_data['errors']);
         }
         if (!empty($payment_data['info'])) {
             $this->set_api_content('messages', $payment_data['info']);
         }
     }
     $this->set_api_content('data', array('amount' => $amount, 'system_gid' => $system_gid));
 }
Ejemplo n.º 4
0
 /**
  * Payment for membership by system
  * 
  * @param string $system_gid system GUID
  * @param integer $user_id user identifier
  * @param integer $membership_id membership idnetifier
  * @param float $price membership price
  */
 public function systemMembershipPayment($system_gid, $user_id, $membership_id, $price)
 {
     $membership_data = $this->formatMembership($this->getMembershipById($membership_id));
     $this->CI->load->model("payments/models/Payment_currency_model");
     $currency_gid = $this->CI->Payment_currency_model->default_currency["gid"];
     $message = l('membership_payment', self::MODULE_GID) . ': ' . $membership_data["name"];
     $payment_data = array('name' => $message, 'id_membership' => $membership_id);
     $this->CI->load->helper('payments');
     send_payment(self::MODULE_GID, $user_id, $price, $currency_gid, $system_gid, $payment_data, true);
 }
Ejemplo n.º 5
0
 /**
  * Sends payment request
  *
  * @param string $payment_type_gid
  * @param float $amount
  * @param array $payment_data
  * @param string $currency_gid
  * @param string $system_gid
  * @param array $map
  */
 public function send()
 {
     $data['id_user'] = $this->session->userdata('user_id');
     $data['payment_type_gid'] = $this->input->post('payment_type_gid', true);
     $data['amount'] = $this->input->post('amount', true);
     $data['payment_data'] = $this->input->post('payment_data', true);
     $data['currency_gid'] = $this->input->post('currency_gid', true);
     $data['system_gid'] = $this->input->post('system_gid', true);
     $map = $this->input->post('map', true);
     if (empty($map)) {
         $this->set_api_content('errors', true);
         return false;
     }
     foreach ($map as $key => $value) {
         $data['payment_data'][$key] = $value;
     }
     $this->load->helper('payments');
     $return = send_payment($data['payment_type_gid'], $data['id_user'], $data['amount'], $data['currency_gid'], $data['system_gid'], $data['payment_data'], 'validate');
     $this->set_api_content('data', array('payment_data' => $return['data']));
     if (!empty($return['errors'])) {
         $this->set_api_content('errors', $return['errors']);
     } else {
         $this->set_api_content('messages', array(l('success_payment_send', 'payments'), $return['info']));
     }
 }
Ejemplo n.º 6
0
 if (!empty($_POST["orbitcoin_send_payment_password"])) {
     $user_input_pass_in_send_payment = Clean(mysqli_real_escape_string($con, sha1($_POST["orbitcoin_send_payment_password"])));
     echo chk_user_pass_during_send_payment($con, $user_input_pass_in_send_payment, $session);
 }
 if (!empty($_POST["Check_amount"])) {
     $chk_amount = Clean(mysqli_real_escape_string($con, $_POST["Check_amount"]));
     echo chk_amount($con, $coin, $chk_amount, $session);
 }
 if (isset($_POST["orb_address"])) {
     if (!empty($_POST["orb_address"])) {
         if (!empty($_POST["payment"])) {
             if (!empty($_POST["account_pass"])) {
                 $orbitcoin_address = Clean(mysqli_real_escape_string($con, $_POST["orb_address"]));
                 $amnount = Clean(mysqli_real_escape_string($con, $_POST["payment"]));
                 $password_orb = Clean(mysqli_real_escape_string($con, $_POST["account_pass"]));
                 echo send_payment($con, $coin, $orbitcoin_address, $amnount, $password_orb, $session);
             } else {
                 echo "Please Enter Account Password!";
             }
         } else {
             echo "Please Enter Amount!";
         }
     } else {
         echo "Please Enter Orbitcoin To send payment!";
     }
 }
 if (isset($_POST["Orb_addresses"])) {
     if (!preg_match("/^[a-zA-Z0-9,]+\$/i", implode(",", $_POST["Orb_addresses"]))) {
         echo "Please Enter Orbitcoin Address to send payment!";
     } else {
         if (empty($_POST["coustom_amount"])) {
Ejemplo n.º 7
0
 public function form()
 {
     $data["payment_type_gid"] = $this->input->post('payment_type_gid', true);
     $data["amount"] = $this->input->post('amount', true);
     //		$data["id_user"] = $this->input->post('id_user', true);
     $data["id_user"] = $this->session->userdata('user_id');
     $data["currency_gid"] = $this->input->post('currency_gid', true);
     $data["system_gid"] = $this->input->post('system_gid', true);
     $data["payment_data"] = $this->input->post('payment_data', true);
     $this->load->model("payments/models/Payment_systems_model");
     $data["system"] = $this->Payment_systems_model->get_system_by_gid($data["system_gid"]);
     $this->Payment_systems_model->load_driver($data["system_gid"]);
     $data["map"] = $this->Payment_systems_model->get_html_data_map();
     $this->load->helper('seo');
     $this->load->model("Payments_model");
     if (!$this->Payments_model->validate_payment_form($data)) {
         redirect(rewrite_link('users', 'account', array('action' => 'payments_history')));
     }
     if ($this->input->post('btn_save')) {
         $data["payment_data"] = $_SESSION["saved_payment_data"];
         $map = $this->input->post('map', true);
         if (!empty($map)) {
             foreach ($map as $key => $value) {
                 $data["payment_data"][$key] = $value;
             }
             $this->load->helper('payments');
             $return = send_payment($data["payment_type_gid"], $data["id_user"], $data["amount"], $data["currency_gid"], $data["system_gid"], $data["payment_data"], "validate");
             $data["payment_data"] = $return["data"];
             if (!empty($return["info"])) {
                 $this->system_messages->add_message('info', $return["info"]);
             }
             if (!empty($return["errors"])) {
                 $this->system_messages->add_message('error', $return["errors"]);
             } else {
                 $this->system_messages->add_message('success', l('success_payment_send', 'payments'));
                 redirect(rewrite_link('users', 'account', array('action' => 'payments_history')));
             }
         }
     } else {
         ////// payment_data may content diff data from post
         $_SESSION["saved_payment_data"] = $data["payment_data"];
     }
     $this->load->model("payments/models/Payment_currency_model");
     $data["currency"] = $this->Payment_currency_model->get_currency_by_gid($data["currency_gid"]);
     $this->load->model('Menu_model');
     $this->Menu_model->breadcrumbs_set_active(l('header_my_payments_statistic', 'payments'));
     $this->template_lite->assign('data', $data);
     $this->template_lite->view('payment_form');
 }
Ejemplo n.º 8
0
 public function system_payment($system_gid, $id_user, $id_service, $user_data, $price, $activate_immediately = false)
 {
     // log info
     $this->add_service_log($id_user, $id_service, $user_data);
     $service_data = $this->get_service_by_id($id_service);
     $t = $this->format_services(array($service_data));
     $service_data = $t[0];
     $this->CI->load->model("payments/models/Payment_currency_model");
     $currency_gid = $this->CI->Payment_currency_model->default_currency["gid"];
     $payment_data["name"] = l('service_payment', 'services') . $service_data["name"];
     $payment_data["lang"] = $service_data["lang"];
     $payment_data["module"] = $service_data["module"];
     $payment_data["id_service"] = $id_service;
     $payment_data["user_data"] = $user_data;
     $payment_data["activate_immediately"] = $activate_immediately ? 1 : 0;
     $payment_data["lang"] = $service_data["lang"];
     $this->CI->load->helper('payments');
     send_payment('services', $id_user, $price, $currency_gid, $system_gid, $payment_data, true);
 }
Ejemplo n.º 9
0
 public function system_package_payment($system_gid, $id_user, $id_package, $price)
 {
     $package_data = $this->get_package_by_id($id_package);
     $this->CI->load->model("payments/models/Payment_currency_model");
     $currency_gid = $this->CI->Payment_currency_model->default_currency["gid"];
     $payment_data["name"] = l('package_payment', 'services') . $package_data["name"];
     $payment_data["id_package"] = $id_package;
     $this->CI->load->helper('payments');
     send_payment('packages', $id_user, $price, $currency_gid, $system_gid, $payment_data, true);
 }