Example #1
0
 $soseri = $_POST['txtSoSeri'];
 $sopin = $_POST['txtSoPin'];
 $type_card = $_POST['select_method'];
 if ($_POST['txtSoSeri'] == "") {
     echo '<script>alert("Vui lòng nhập Số Seri");</script>';
     echo "<script>location.href='" . $_SERVER['HTTP_REFERER'] . "';</script>";
     exit;
 }
 if ($_POST['txtSoPin'] == "") {
     echo '<script>alert("Vui lòng nhập Mã Thẻ");</script>';
     echo "<script>location.href='" . $_SERVER['HTTP_REFERER'] . "';</script>";
     exit;
 }
 $arytype = array(92 => 'VMS', 93 => 'VNP', 107 => 'VIETTEL', 121 => 'VCOIN', 120 => 'GATE');
 //Tiến hành kết nối thanh toán Thẻ cào.
 $call = new MobiCard();
 $rs = new Result();
 $coin1 = rand(10, 999);
 $coin2 = rand(0, 999);
 $coin3 = rand(0, 999);
 $coin4 = rand(0, 999);
 $ref_code = $coin4 + $coin3 * 1000 + $coin2 * 1000000 + $coin1 * 100000000;
 $rs = $call->CardPay($sopin, $soseri, $type_card, $ref_code, "Tên khách hàng", "Mobile Khách Hàng", " Email Khách hàng");
 if ($rs->error_code == '00') {
     // Cập nhật data tại đây
     $check = KiemTraTokenTonTai($rs->card_serial);
     if ($check) {
         if (isset($_GET['course_id'])) {
             wp_redirect(home_url() . '/thanh-toan-khoa-hoc/?course_id=' . $_GET['course_id'] . '');
         } else {
             wp_redirect(home_url() . '/thanh-toan-khoa-hoc/');
Example #2
0
 public function mobi_card()
 {
     require_once APPPATH . 'third_party/nl_lib/include/lib/nusoap.php';
     include APPPATH . 'third_party/nl_lib/MobiCard.php';
     $this->initial_order();
     $pin_card = $this->input->post('pin_card');
     $card_serial = $this->input->post('card_serial');
     $type_card = $this->input->post('type_card');
     $order_sn = $this->order['order_sn'];
     $client_fullname = "";
     $client_email = "";
     $client_mobile = "";
     //Tạo md5 để check
     //$security = md5($pin_card .'|'.$card_serial);
     $merchant_data = $this->pay_model->get_merchant_data_by_pay_type($this->order['pay_type_id'], $this->order['method_id']);
     $initial_data = array();
     $initial_data['merchant_name'] = $merchant_data['merchant_key2'];
     //nganluong@xinyoudi.com
     $initial_data['merchant_key'] = $merchant_data['merchant_name'];
     //31300
     $initial_data['merchant_password'] = $merchant_data['merchant_key'];
     //phongluutamquoc@#@#@#
     $call_mobicard = new MobiCard($initial_data);
     $result = new Result();
     $result = $call_mobicard->CardPay($pin_card, $card_serial, $type_card, $order_sn, $client_fullname, $client_email, $client_mobile);
     if ($result->error_code != '00') {
         $msg = $this->recharge_lang['ask_to_try'];
         $this->payorder->over($msg);
         return;
     }
     $pay_amount = $result->card_amount;
     $payment_info['pay_type_id'] = $this->order['pay_type_id'];
     $payment_info['method_id'] = $this->order['method_id'];
     $payment_info['currency'] = $this->order['currency'];
     $payment_info['game_id'] = $this->order['game_id'];
     $payment_info['pay_amount'] = $this->pay_amout_basic;
     $yuanbao_amount_info = $this->CI->payorder->get_yuanbao_amount($payment_info);
     //取出基础元宝比例, amount为10000
     if (empty($yuanbao_amount_info)) {
         $msg['msg'] = $this->recharge_lang['amount_not_exist'];
         $this->show_result($msg);
         return FALSE;
     }
     $ratio = $pay_amount / $this->pay_amout_basic;
     $basic_yuanbao_amount = $ratio * $yuanbao_amount_info[0]->yuanbao_amount;
     $extra_yuanbao_amount = $ratio * $yuanbao_amount_info[0]->yuanbao_extra;
     $huodong_yuanbao_amount = $ratio * $yuanbao_amount_info[0]->yuanbao_huodong;
     $this->order['basic_yuanbao_amount'] = intval($basic_yuanbao_amount);
     $this->order['extra_yuanbao_amount'] = intval($extra_yuanbao_amount);
     $this->order['huodong_yuanbao_amount'] = intval($huodong_yuanbao_amount);
     $this->order['yuanbao_amount'] = intval($basic_yuanbao_amount + $extra_yuanbao_amount + $huodong_yuanbao_amount);
     $update_order = array('order_sn' => $this->order['order_sn'], 'tradeseq' => $result->transaction_id, 'pay_amount' => $pay_amount, 'basic_yuanbao_amount' => $this->order['basic_yuanbao_amount'], 'extra_yuanbao_amount' => $this->order['extra_yuanbao_amount'], 'huodong_yuanbao_amount' => $this->order['huodong_yuanbao_amount'], 'yuanbao_amount' => $this->order['yuanbao_amount']);
     $log_array = array('type' => 'ng_card update order', 'value' => $update_order);
     log_message('gash', json_encode($log_array));
     $this->CI->payorder->update_order_to_get_payment($update_order);
     $offer_data_res = $this->offer_service($this->order['order_sn'], $this->order['game_id']);
     // $offer_data_res['status']=1;
     if ($offer_data_res['status']) {
         $offer_order['order_sn'] = $this->order['order_sn'];
         $this->CI->payorder->update_order_to_offer_service($offer_order);
         $msg = $this->recharge_lang['recharge_success'];
         $this->CI->payorder->over($msg, $this->order['order_sn']);
         return;
     }
     $msg = $this->recharge_lang['ask_to_try'];
     $this->CI->payorder->over($msg);
     return;
 }