public function submission($param) { $list_id = $param; $row = $this->Common_model->getTableData('payment_details', array('code' => 'PAYPAL_ID'))->row(); $paymode = $this->db->where('payment_name', 'Paypal')->get('payments')->row()->is_live; if (get_currency_value($this->session->userdata('amount')) == 0) { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('You are not able to pay a amount for this list. Please contact the Admin.'))); redirect('rooms/lys_next/edit/' . $list_id); } $to_buy = array('desc' => 'Purchase from ACME Store', 'currency' => get_currency_code(), 'type' => 'sale', 'return_URL' => site_url('listpay/list_success/' . $list_id), 'cancel_URL' => site_url('listpay/list_cancel'), 'shipping_amount' => 0, 'get_shipping' => false); // I am just iterating through $this->product from defined // above. In a live case, you could be iterating through // the content of your shopping cart. //foreach($this->product as $p) { $temp_product = array('name' => $this->dx_auth->get_site_title() . ' Transaction', 'number' => $list_id, 'quantity' => 1, 'amount' => get_currency_value($this->session->userdata('amount'))); // add product to main $to_buy array $to_buy['products'][] = $temp_product; //} // enquire Paypal API for token $set_ec_return = $this->paypal_ec->set_ec($to_buy); if (isset($set_ec_return['ec_status']) && $set_ec_return['ec_status'] === true) { // redirect to Paypal $this->paypal_ec->redirect_to_paypal($set_ec_return['TOKEN']); // You could detect your visitor's browser and redirect to Paypal's mobile checkout // if they are on a mobile device. Just add a true as the last parameter. It defaults // to false // $this->paypal_ec->redirect_to_paypal( $set_ec_return['TOKEN'], true); } else { $this->_error($set_ec_return); } }
public function transfer() { $this->load->model('email_model'); $login_id = $this->session->userdata('login_id'); if (!$this->user_session && !$login_id) { redirect(site_url('login')); } if ($this->user_session) { $user_info = $this->user_session; } else { $user_info = $this->user->getUserById($login_id); } $this->data['success'] = $this->input->get('success'); $currencies_array = $this->currencies->getCurrencies(); $balance_currencies[''] = '-- Select Currency --'; $balances = $this->wallet->getBalanceByUserId($user_info['user_id']); $balances_array = array(); foreach ($balances as $balance) { $balances_array[$balance['currency_code']] = $balance['balance']; } $balance_currencies = array(); foreach ($currencies_array as $currency_code => $currency_info) { $balance_currencies[$currency_info['code']] = $currency_info['title'] . ' (' . get_currency_value_format(!empty($balances_array[$currency_info['code']]) ? $balances_array[$currency_info['code']] : 0, $currency_info) . ')'; } $this->assign('balance_currencies', $balance_currencies); $posts = $this->input->post(); if ($posts) { $balance_currency = $posts['balance_currency']; $amount = $posts['amount']; if ($balance_currency == '') { $this->validator->addError('Currency', 'Please select the currency of balance that you want to use for the transaction.'); } if ($amount <= 0) { $this->validator->addError('Amount', 'Please input correct Amount .'); } else { // check if out of balance if ($amount > $balances_array[$balance_currency]) { $this->validator->addError('Balance', 'You have not enough balance to transfer the amount(<strong>' . get_currency_value_format($amount, $currencies_array[$balance_currency]) . '</strong>). Please input difference amount.'); } } $to_account = $posts['to_account']; $to_user_info = $this->user->getUser(array('account_number' => $posts['to_account'])); if (!$to_user_info) { $this->validator->addError('Account Number', 'Invalid account number. Please input correct account number of the user that you want to transfer to.'); } elseif (trim($to_account) == $user_info['account_number']) { $this->validator->addError('Account Number', 'Invalid account number. Please input correct account number of the user that you want to transfer to.'); } if (count($this->validator->errors) == 0) { $batch_number = tep_create_random_value(11, 'digits'); $amount_text = get_currency_value_format($amount, $currencies_array[$balance_currency]); $transaction_memo = ''; $fees = $amount * $this->configs['TRANSFER_FEES'] / 100; $fees_text = get_currency_value_format($fees, $currencies_array[$balance_currency]); $amount = get_currency_value($amount, $currencies_array[$balance_currency]); $fees = get_currency_value($fees, $currencies_array[$balance_currency]); $current_amount = $amount - $fees; $transaction_data_array = array('from_userid' => $user_info['user_id'], 'batch_number' => $batch_number, 'to_userid' => $to_user_info['user_id'], 'amount' => $amount, 'fee' => $fees, 'fee_text' => $fees_text, 'transaction_time' => date('YmdHis'), 'transaction_memo' => $transaction_memo, 'from_account' => $user_info['account_number'], 'to_account' => $to_user_info['account_number'], 'transaction_currency' => $balance_currency, 'amount_text' => $amount_text, 'transaction_status' => 'completed'); $this->data['transaction_data'] = $transaction_data_array; $this->transaction->insert($transaction_data_array); $balanceFrom = array('user_id' => $user_info['user_id'], 'currency_code' => $balance_currency); $this->wallet->updateWallet($balanceFrom, $amount, '-'); $balanceTo = array('user_id' => $to_user_info['user_id'], 'currency_code' => $balance_currency); $this->balance->updateBalance($balanceTo, $current_amount, '+'); //admin transfer $batch_number_admin = tep_create_random_value(11, 'digits'); $transaction_data_array_admin = array('from_userid' => $to_user_info['user_id'], 'batch_number' => $batch_number_admin, 'to_userid' => 1, 'amount' => $fees, 'fee' => 0, 'transaction_time' => date('YmdHis'), 'transaction_memo' => 'transaction fees #' . $batch_number, 'from_account' => $to_user_info['account_number'], 'to_account' => 'OOKCASH', 'transaction_currency' => $balance_currency, 'amount_text' => $fees_text, 'transaction_status' => 'completed', 'status' => '0'); $this->transaction->insert($transaction_data_array_admin); $balanceAdmin = array('user_id' => 1, 'currency_code' => $balance_currency); $this->balance->updateBalance($balanceAdmin, $fees, '+'); $dataEmail = array('firstname' => $to_user_info['firstname'], 'amount_text' => $amount_text, 'batch_number' => $batch_number, 'balance_currency' => $balance_currency, 'from_account' => $user_info['account_number'], 'fees_text' => $fees_text); $this->email_model->sendmail('TRANSFER_EMAIL', $to_user_info['firstname'], $to_user_info['email'], $dataEmail); redirect(site_url('wallet/transfer') . '?success=1'); } else { $this->data['validerrors'] = $this->validator->errors; } } $this->data['posts'] = $posts; $this->view('wallet/transfer'); }
?> <?php echo '<b style="padding-right:5px;color:green;">Completed</b>'; //echo get_currency_symbol1().get_currency_value($completed_amount); } ?> <label class="pending_rate"><?php if ($res->trips_referral_code == '' && $res->list_referral_code !== '' && $res->refer_userid) { $list_Pending = get_currency_value($res->ref_rent); echo '<b style="padding-right:5px;color:green">Pending</b>'; echo get_currency_symbol1() . $list_Pending; } ?> <label class="pending_rate"><?php if ($res->trips_referral_code !== '' && $res->list_referral_code !== '' && $res->refer_userid) { $both_pending = get_currency_value($res->ref_total); ?> <?php echo '<b style="padding-right:5px;color:green">Pending</b>'; echo get_currency_symbol1() . $both_pending; } ?> </label> </label> </label> </label> </div> <br>
public function transfer() { if (!$this->user_session) { redirect(site_url('login')); } $sci_info = $this->session->userdata('sci'); if (!$sci_info || empty($sci_info['checkout_currency'])) { $this->validator->addError('SCI Information', 'You haven\'t yet input sci info'); $this->assign('validerrors', $this->validator->errors); } else { $checkout_amount = $sci_info['checkout_amount']; $currency = $this->currencies->getCurrencyByCode($sci_info['checkout_currency']); $balance = get_currency_value_format($checkout_amount, $currency); $fees = $checkout_amount * $this->configs['TRANSFER_FEES'] / 100; $fees_text = get_currency_value_format($fees, $currency); $checkout_amount = get_currency_value($checkout_amount, $currency); $fees = get_currency_value($fees, $currency); $balance_current = $this->balance->getBalance(array('user_id' => $this->user_session['user_id'], 'currency_code' => $sci_info['checkout_currency'])); $this->data['sci_info'] = $sci_info; $sci_user = $this->user->getUser(array('account_number' => $sci_info['payee_account'])); if (!$sci_user) { redirect(site_url('transfer')); } $this->data['sci_user'] = $sci_user; $posts = $this->input->post(); if ($posts) { $master_key = $posts['master_key']; if ($master_key != $this->user_session['master_key']) { $this->validator->addError('Master Key', 'Invalid master key entered. Master Key is a three digit number you have selected at the time of registration. Please try again.'); } if ($checkout_amount <= 0) { if (empty($posts['checkout_amount'])) { $this->validator->addError('Amount', 'Amount greater than 0'); } else { $amount = $posts['checkout_amount']; if ($validator->validateNumber('Amount', $amount, 'Amount greater than 0')) { $checkout_amount = $amount; $balance = get_currency_value_format($checkout_amount, $currency); $fees = $checkout_amount * TRANSFER_FEES / 100; $fees_text = get_currency_value_format($fees, $currency); $checkout_amount = get_currency_value($checkout_amount, $currency); $fees = get_currency_value($fees, $currency); if ($checkout_amount > $balance_current['balance']) { $this->validator->addError('Amount', 'You don\'t have enough money to transfer'); } } } } if (count($this->validator->errors) == 0) { $sci_info['checkout_amount'] = $checkout_amount; $sci_info['transaction_memo'] = $posts['transaction_memo']; $sci_info['balance'] = $balance; $sci_info['fees'] = $fees; $sci_info['fees_text'] = $fees_text; $sci_info['master_key'] = $master_key; $this->session->set_userdata('sci', $sci_info); redirect('sci/preview'); } else { $this->assign('validerrors', $this->validator->errors); } } } $this->view('sci/transfer'); }
public function payment($param) { $reservation_id = $param; $row = $this->Common_model->getTableData('payment_details', array('code' => 'PAYPAL_ID'))->row(); $paymode = $this->db->where('payment_name', 'Paypal')->get('payments')->row()->is_live; $query = $this->Common_model->getTableData('paymode', array('id' => 3)); $row = $query->row(); $topay = $this->db->where('id', $reservation_id)->get('reservation')->row()->topay; if ($row->is_premium == 1) { if ($row->is_fixed == 1) { $fix = $row->fixed_amount; $amt = $fix; $data['commission'] = $fix; } else { $per = $row->percentage_amount; $camt = floatval($topay * $per / 100); $data['commission'] = $camt; } } $to_buy = array('desc' => 'Purchase from ACME Store', 'currency' => get_currency_code(), 'type' => 'sale', 'return_URL' => site_url('trips/trips_success/'), 'cancel_URL' => site_url('trips/trips_cancel'), 'shipping_amount' => 0, 'get_shipping' => false); // I am just iterating through $this->product from defined // above. In a live case, you could be iterating through // the content of your shopping cart. //foreach($this->product as $p) { $temp_product = array('name' => $this->dx_auth->get_site_title() . ' Transaction', 'number' => $reservation_id, 'quantity' => 1, 'amount' => get_currency_value($data['commission'])); // add product to main $to_buy array $to_buy['products'][] = $temp_product; //} // enquire Paypal API for token $set_ec_return = $this->paypal_ec->set_ec($to_buy); if (isset($set_ec_return['ec_status']) && $set_ec_return['ec_status'] === true) { // redirect to Paypal $this->paypal_ec->redirect_to_paypal($set_ec_return['TOKEN']); // You could detect your visitor's browser and redirect to Paypal's mobile checkout // if they are on a mobile device. Just add a true as the last parameter. It defaults // to false // $this->paypal_ec->redirect_to_paypal( $set_ec_return['TOKEN'], true); } else { $this->_error($set_ec_return); } }
?> " target="_blank"> </a> </div> </div> <?php } } else { ?> <div class="Box_dash"> <h2><?php echo translate("Invite your friends, earn"); ?> <?php echo get_currency_symbol1() . get_currency_value($ref_total); ?> <?php echo translate("travel credit!"); ?> <a href="<?php echo base_url() . 'referrals'; ?> " class="btn_dash_green">Invite now</a> </h2> </div> <?php } ?> </div> </div>
</div> </div> <div class="big_self"></div> </div> <p class="referral_offer"><?php echo translate("You'll get"); ?> <?php echo get_currency_symbol1() . get_currency_value(25); ?> <?php echo translate('when they take a trip &'); ?> <span><?php echo get_currency_symbol1() . get_currency_value(75); ?> <?php echo translate('when they rent out their place.'); ?> </span></p> <div class="action_bar_container"> <div class="action_bar"> <span class="fl_left"><?php echo translate('Get Started'); ?> </span> <span class="sm_arrow fl_left"></span> <a class="invite_fb_blue" onclick='send_invitation()'></a> <span class="on_connect fl_left"><?php echo translate('or');
<h2><?php echo translate("PayPal"); ?> </h2> <div class="currency_alert"><?php echo translate("This payment transacts in"); ?> <?php echo get_currency_symbol1() . get_currency_code(); ?> . <?php echo translate("Your total charge is"); ?> <?php echo get_currency_symbol1() . get_currency_value($amt); ?> .</div> <p class="payment_method_explanation paypal_explanation"> <span style="font-weight:bold;"><?php echo translate("Instructions"); ?> :</span> <br> <?php echo translate("After clicking 'Accept reservation request' you will be redirected to PayPal to complete payment."); ?> <span style="font-weight:bold;"> <?php echo translate("You must complete the process or the transaction will not occur."); ?> </span> </p>
<div class="currency_alert"><?php echo translate("This payment transacts in"); ?> <?php echo get_currency_symbol1() . get_currency_code(); ?> . <?php echo translate("Your total charge is"); ?> <?php echo get_currency_symbol1() . $amt; ?> .</div> <?php $this->session->set_userdata('accept_pay', get_currency_value($amt)); ?> <div class="paypal_explanation col-md-2 col-sm-5 col-xs-5 "></div> <p class="payment_method_explanation "> <span style="font-weight:bold;"><?php echo translate("Instructions"); ?> :</span> <br> <?php echo translate("After clicking 'Accept reservation request' you will be redirected to PayPal to complete payment."); ?> <span style="font-weight:bold;"> <?php echo translate("You must complete the process or the transaction will not occur."); ?> </span> </p> <div class="clear"></div> </div>
function submission_cc($param = '') { $refer = $this->db->query("select * from `referral_management` where `id`=1 ")->row(); //$data['fixed_status']=$refer->fixed_status; $refamt = $refer->fixed_amt; $refcur = $refer->currency; $type = $refer->type; $trip_amt = $refer->trip_amt; $trip_per = $refer->trip_per; $rent_amt = $refer->rent_amt; $rent_per = $refer->rent_per; $ref_total = get_currency_value2($refcur, 'USD', $refamt); if ($type == 1) { $trip_amt0 = $trip_amt; $rent_amt0 = $rent_amt; $trip = get_currency_value2($refcur, 'USD', $trip_amt); $rent = get_currency_value2($refcur, 'USD', $rent_amt); } if ($type == 0) { $trip = $trip_per / 100 * $ref_total; $rent = $rent_per / 100 * $ref_total; $current = $this->session->userdata("locale_currency"); } $checkin = $this->input->post('checkin'); $checkout = $this->input->post('checkout'); $number_of_guests = $this->input->post('number_of_guests'); $ckin = explode('/', $checkin); $ckout = explode('/', $checkout); $id = $this->uri->segment(3); if ($this->session->userdata('mobile_user_id')) { $user_id = $this->session->userdata('mobile_user_id'); $this->session->unset_userdata('mobile_user_id'); } else { $user_id = $this->dx_auth->get_user_id(); } if ($ckin[0] == "mm") { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Sorry! Access denied.'))); redirect('rooms/' . $id, "refresh"); } if ($ckout[0] == "mm") { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Sorry! Access denied.'))); redirect('rooms/' . $id, "refresh"); } $xprice = $this->Common_model->getTableData('price', array('id' => $this->uri->segment(3)))->row(); $price = $xprice->night; $placeid = $xprice->id; $guests = $xprice->guests; $extra_guest_price = $xprice->addguests; if (isset($xprice->cleaning)) { $cleaning = $xprice->cleaning; } else { $cleaning = 0; } if (isset($xprice->security)) { $security = $xprice->security; } else { $security = 0; } if (isset($xprice->week)) { $Wprice = $xprice->week; } else { $Wprice = 0; } if (isset($xprice->month)) { $Mprice = $xprice->month; } else { $Mprice = 0; } $query = $this->Common_model->getTableData('list', array('id' => $id)); $q = $query->result(); $diff = strtotime($ckout[2] . '-' . $ckout[0] . '-' . $ckout[1]) - strtotime($ckin[2] . '-' . $ckin[0] . '-' . $ckin[1]); $days = ceil($diff / (3600 * 24)); $user_travel_cretids = 0; if ($this->session->userdata('travel_cretids')) { $amt = $this->session->userdata('travel_cretids'); $user_travel_cretids = $this->session->userdata('user_travel_cretids'); $is_travelCretids = md5('Yes Travel Cretids'); } else { if ($number_of_guests > $guests) { $diff_days = $number_of_guests - $guests; $amt = $price * $days + $days * $xprice->addguests * $diff_days; } else { $amt = $price * $days; } if ($days >= 7 && $days < 30) { if (!empty($Wprice)) { $finalAmount = $Wprice; $differNights = $days - 7; $perDay = $Wprice / 7; $per_night = round($perDay, 2); if ($differNights > 0) { $addAmount = $differNights * $per_night; $finalAmount = $Wprice + $addAmount; } $amt = $finalAmount; } } if ($days >= 30) { if (!empty($Mprice)) { $finalAmount = $Mprice; $differNights = $days - 30; $perDay = $Mprice / 30; $per_night = round($perDay, 2); if ($differNights > 0) { $addAmount = $differNights * $per_night; $finalAmount = $Mprice + $addAmount; } $amt = $finalAmount; } } //Cleaning fee if ($cleaning != 0) { $amt = $amt + $cleaning; } if ($security != 0) { $amt = $amt + $cleaning; } else { $amt = $amt; } $to_pay = 0; $admin_commission = 0; //Amount from session // $amt=$this->session->userdata("total_price_'".$id."'_'".$this->dx_auth->get_user_id()."'"); //commission calculation $query = $this->Common_model->getTableData('paymode', array('id' => 2)); $row = $query->row(); if ($row->is_premium == 1) { if ($row->is_fixed == 1) { $to_pay = $amt; $fix = $row->fixed_amount; $amt = $amt + get_currency_value_lys($row->currency, get_currency_code(), $fix); //$amt = $this->session->userdata('topay'); $admin_commission = get_currency_value_lys($row->currency, get_currency_code(), $fix); } else { $to_pay = $amt; $per = $row->percentage_amount; $percentage = $per / 100; $admin_commission = $percentage * $to_pay; /* $camt = floatval(($amt * $per) / 100); $amt = $amt + $camt; $amt = $amt; $admin_commission = $camt+get_currency_value_lys($row->currency,get_currency_code(),$camt); */ // print_r($admin_commission); } } else { $amt = $amt; $to_pay = $amt; print_r($to_pay); } $is_travelCretids = md5('No Travel Cretids'); } //echo $amt;exit; if ($contact_key != '') { $contact_result = $this->db->where('contact_key', $contact_key)->get('contacts')->row(); $amt = $contact_result->price + $contact_result->admin_commission; $this->session->set_userdata('contacts_offer', $contact_result->offer); } $ref_total1 = $ref_total + 10; if ($amt > $ref_total1) { if ($this->db->select('referral_amount')->where('id', $user_id)->get('users')->row()->referral_amount != 0) { $referral_amount = $this->db->select('referral_amount')->where('id', $user_id)->get('users')->row()->referral_amount; if ($referral_amount > $ref_total) { $final_amt = get_currency_value1($id, $amt) - get_currency_value($ref_total); } else { $final_amt = $amt - $referral_amount; } $amt = $final_amt; } else { $amt = $amt; } } else { $amt = $amt; } $amount = $amt; if ($contact_key == "") { $contact_key = "None"; } //Entering it into data variables $row = $this->Common_model->getTableData('payment_details', array('code' => 'PAYPAL_ID'))->row(); $paymode = $this->db->where('payment_name', 'Paypal')->get('payments')->row()->is_live; if ($this->session->userdata('final_amount') != '') { $amt = $this->session->userdata('final_amount'); $this->session->unset_userdata('final_amount'); } else { $amt = get_currency_value1($id, $amt) + $admin_commission; } //seasonal price $checkin_time = get_gmt_time(strtotime($checkin)); $checkout_time = get_gmt_time(strtotime($checkout)); $travel_dates = array(); $seasonal_prices = array(); $total_nights = 1; $total_price = 0; $is_seasonal = 0; $i = $checkin_time; while ($i < $checkout_time) { $checkin_date = date('m/d/Y', $i); $checkin_date = explode('/', $checkin_date); $travel_dates[$total_nights] = $checkin_date[1] . $checkin_date[0] . $checkin_date[2]; $i = get_gmt_time(strtotime('+1 day', $i)); // echo "<pre>"; // print_r($i); $total_nights++; } for ($i = 1; $i < $total_nights; $i++) { $seasonal_prices[$travel_dates[$i]] = ""; } $seasonal_query = $this->Common_model->getTableData('seasonalprice', array('list_id' => $id)); $seasonal_result = $seasonal_query->result_array(); // echo "<pre>"; // print_r($seasonal_result); if ($seasonal_query->num_rows() > 0) { foreach ($seasonal_result as $time) { $seasonalprice_query = $this->Common_model->getTableData('seasonalprice', array('list_id' => $id, 'start_date' => $time['start_date'], 'end_date' => $time['end_date'])); $seasonalprice = $seasonalprice_query->row()->price; //Days between start date and end date -> seasonal price $start_time = $time['start_date']; $end_time = $time['end_date']; $i = $start_time; while ($i <= $end_time) { $start_date = date('m/d/Y', $i); $s_date = explode('/', $start_date); $s_date = $s_date[1] . $s_date[0] . $s_date[2]; $seasonal_prices[$s_date] = $seasonalprice; $i = get_gmt_time(strtotime('+1 day', $i)); //echo "<pre>"; //print_r($i); } } //Total Price // print_r($total_nights); for ($i = 1; $i < $total_nights; $i++) { if ($seasonal_prices[$travel_dates[$i]] == "") { $xprice = $this->Common_model->getTableData('price', array('id' => $id))->row(); //print_r($xprice); $total_price = get_currency_value1($id, $total_price) + get_currency_value1($id, $xprice->night); // echo "$total_price"; } else { $total_price = get_currency_value1($id, $total_price) + $seasonal_prices[$travel_dates[$i]]; //echo "$total_price"; $is_seasonal = 1; } } // echo "$total_price"; //Additional Guests if ($data['guests'] > $guests) { $days = $total_nights - 1; $diff_guests = $data['guests'] - $guests; $total_price = get_currency_value1($id, $total_price) + $days * get_currency_value1($id, $xprice->addguests) * $diff_guests; //echo "$total_price"; $data['extra_guest_price'] = get_currency_value1($id, $xprice->addguests) * $diff_guests; } //echo "$total_price"; //Cleaning if ($cleaning != 0) { $total_price = $total_price + get_currency_value1($id, $cleaning); // echo "$total_price"; } if ($security != 0) { $total_price = $total_price + get_currency_value1($id, $security); // echo "$total_price"; } $data['avg_price'] = $total_price / $days; $per_night = $data['avg_price']; $topay = $per_night * $days - $this->session->userdata("coupon_amt"); $query = $this->Common_model->getTableData('paymode', array('id' => 2)); $row = $query->row(); $percentage = $per / 100; $amount = $per_night * $days * $percentage; $admin_commission = $amount; $amt = $admin_commission + $topay; $total_price = $total_price - $this->session->userdata("coupon_amt"); } // echo "$total_price"; //Seasonal price $this->session->set_userdata('subtotal', $amt); /*if($this->session->userdata('booking_currency_symbol')) {*/ //$custom = $id.'@'.$user_id.'@'.get_gmt_time(strtotime($checkin)).'@'.get_gmt_time(strtotime($checkout)).'@'.$number_of_guests.'@'.$is_travelCretids.'@'.$user_travel_cretids.'@'.$to_pay.'@'.$admin_commission.'@'.$contact_key.'@'.$cleaning.'@'.$security.'@'.$extra_guest_price.'@'.$guests.'@'.$amt.'@'.$this->session->userdata('booking_currency_symbol'); /*} else {*/ //print_r($to_pay); //print_r($admin_commission); //print_r($amt); $custom = $id . '@' . $user_id . '@' . get_gmt_time(strtotime($checkin)) . '@' . get_gmt_time(strtotime($checkout)) . '@' . $number_of_guests . '@' . $is_travelCretids . '@' . $user_travel_cretids . '@' . get_currency_value1($id, $total_price) . '@' . $admin_commission . '@' . $contact_key . '@' . get_currency_value1($id, $cleaning) . '@' . get_currency_value1($id, $security) . '@' . get_currency_value1($id, $extra_guest_price) . '@' . $guests . '@' . $amt . '@' . $this->session->userdata('booking_currency_symbol'); //print_r($custom); //exit; //$custom = $id.'@'.$user_id.'@'.get_gmt_time(strtotime($checkin)).'@'.get_gmt_time(strtotime($checkout)).'@'.$number_of_guests.'@'.$is_travelCretids.'@'.$user_travel_cretids.'@'.$to_pay.'@'.$admin_commission.'@'.$contact_key.'@'.$cleaning.'@'.$security.'@'.$extra_guest_price.'@'.$guests.'@'.$amt.'@'.$this->session->userdata('booking_currency_symbol').'@'.$per_night; //$custom = $id.'@'.$user_id.'@'.get_gmt_time(strtotime($checkin)).'@'.get_gmt_time(strtotime($checkout)).'@'.$number_of_guests.'@'.$is_travelCretids.'@'.$user_travel_cretids.'@'.$amt.'@'.$admin_commission.'@'.$contact_key.'@'.$cleaning.'@'.$security.'@'.$extra_guest_price.'@'.$guests.'@'.$to_pay.'@'.$this->session->userdata('booking_currency_symbol').'@'.$per_night; //} $this->session->set_userdata('custom', $custom); $clientToken = Braintree_ClientToken::generate(array()); if ($clientToken == '401') { $username = $this->dx_auth->get_username(); $list_title = $this->Common_model->getTableData('list', array('id' => $id))->row()->title; $email = $this->Common_model->getTableData('users', array('id' => $this->dx_auth->get_user_id()))->row()->email; $admin_email = $this->Common_model->getTableData('users', array('id' => 1))->row()->email; $admin_email_from = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $email_name = 'payment_issue_to_admin'; $splVars = array("{payment_type}" => 'Braintree', "{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($username), "{list_title}" => $list_title, '{email_id}' => $email); $this->Email_model->sendMail($admin_email, $admin_email_from, ucfirst($admin_name), $email_name, $splVars); $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate("Braintree business account is misconfigured. Please contact your Administrator."))); redirect('rooms/' . $id, "refresh"); } $data['title'] = "Payments"; $data["meta_keyword"] = ""; $data["meta_description"] = ""; $data['clientToken'] = $clientToken; $data['message_element'] = "payments/checkout"; $this->load->view('template', $data); }
var NREUMQ=[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);(function(){var d=document;var e=d.createElement("script");e.type="text/javascript";e.async=true;e.src="<?php echo base_url(); ?> http://www.tehuuraanzee.net/html/js/rum.js";var s=d.getElementsByTagName("script")[0];s.parentNode.insertBefore(e,s);})() var base_url = '<?php echo base_url(); ?> ';var symbol = '<?php echo get_currency_symbol1(); ?> ';var min_price = '<?php echo get_currency_value(10); ?> ';var max_price = '<?php echo get_currency_value(10000); ?> '; var default_value = '<?php echo "Where are you going?"; ?> '; var lat = '<?php echo $this->session->userdata('lat'); ?> '; var lng = '<?php echo $this->session->userdata('lng'); ?> '; var time = 1; </script> <title><?php
function submission($param = '', $contact_key) { $checkin = $this->input->post('checkin'); $checkout = $this->input->post('checkout'); $number_of_guests = $this->input->post('number_of_guests'); $ckin = explode('/', $checkin); $ckout = explode('/', $checkout); $pay = $this->Common_model->getTableData('paywhom', array('id' => 1)); $paywhom = $pay->result(); $paywhom = $paywhom[0]->whom; $id = $this->uri->segment(3); if ($ckin[0] == "mm") { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Sorry! Access denied.'))); redirect('rooms/' . $id, "refresh"); } if ($ckout[0] == "mm") { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('Sorry! Access denied.'))); redirect('rooms/' . $id, "refresh"); } $xprice = $this->Common_model->getTableData('price', array('id' => $this->uri->segment(3)))->row(); $price = $xprice->night; //$price = $xprice->night; $placeid = $xprice->id; $guests = $xprice->guests; $extra_guest_price = $xprice->addguests; if (isset($xprice->cleaning)) { $cleaning = $xprice->cleaning; } else { $cleaning = 0; } if (isset($xprice->security)) { $security = $xprice->security; } else { $security = 0; } if (isset($xprice->week)) { $Wprice = $xprice->week; } else { $Wprice = 0; } if (isset($xprice->month)) { $Mprice = $xprice->month; } else { $Mprice = 0; } if ($paywhom) { $query = $this->Common_model->getTableData('list', array('id' => $id))->row(); $email = $query->email; } else { $query = $this->Common_model->getTableData('users', array('role_id' => 2))->row(); $email = $query->email; } $query = $this->Common_model->getTableData('list', array('id' => $id)); $q = $query->result(); $diff = strtotime($ckout[2] . '-' . $ckout[0] . '-' . $ckout[1]) - strtotime($ckin[2] . '-' . $ckin[0] . '-' . $ckin[1]); $days = ceil($diff / (3600 * 24)); $user_travel_cretids = 0; if ($this->session->userdata('travel_cretids')) { $amt = $this->session->userdata('travel_cretids'); $user_travel_cretids = $this->session->userdata('user_travel_cretids'); $is_travelCretids = md5('Yes Travel Cretids'); } else { if ($number_of_guests > $guests) { $diff_days = $number_of_guests - $guests; $amt = $price * $days + $days * $xprice->addguests * $diff_days; } else { $amt = $price * $days; } if ($days >= 7 && $days < 30) { if (!empty($Wprice)) { $finalAmount = $Wprice; $differNights = $days - 7; $perDay = $Wprice / 7; $per_night = round($perDay, 2); if ($differNights > 0) { $addAmount = $differNights * $per_night; $finalAmount = $Wprice + $addAmount; } $amt = $finalAmount; } } if ($days >= 30) { if (!empty($Mprice)) { $finalAmount = $Mprice; $differNights = $days - 30; $perDay = $Mprice / 30; $per_night = round($perDay, 2); if ($differNights > 0) { $addAmount = $differNights * $per_night; $finalAmount = $Mprice + $addAmount; } $amt = $finalAmount; } } //Cleaning fee if ($cleaning != 0) { $amt = $amt + $cleaning; } if ($security != 0) { $amt = $amt + $cleaning; } else { $amt = $amt; } $to_pay = 0; $admin_commission = 0; //Amount from session // $amt=$this->session->userdata("total_price_'".$id."'_'".$this->dx_auth->get_user_id()."'"); //commission calculation $query = $this->Common_model->getTableData('paymode', array('id' => 2)); $row = $query->row(); if ($row->is_premium == 1) { if ($row->is_fixed == 1) { $to_pay = $amt; $fix = $row->fixed_amount; $amt = $amt + $fix; //$amt = $this->session->userdata('topay'); $admin_commission = $fix; } else { $to_pay = $amt; $per = $row->percentage_amount; $camt = floatval($amt * $per / 100); $amt = $amt + $camt; $amt = $amt; $admin_commission = $camt; } } else { $amt = $amt; $to_pay = $amt; } $is_travelCretids = md5('No Travel Cretids'); } //echo $amt;exit; if ($contact_key != '') { $contact_result = $this->db->where('contact_key', $contact_key)->get('contacts')->row(); $amt = $contact_result->price + $contact_result->admin_commission; } if ($amt > 110) { if ($this->db->select('referral_amount')->where('id', $this->dx_auth->get_user_id())->get('users')->row()->referral_amount != 0) { $referral_amount = $this->db->select('referral_amount')->where('id', $this->dx_auth->get_user_id())->get('users')->row()->referral_amount; if ($referral_amount > 100) { $final_amt = get_currency_value1($id, $amt) - get_currency_value(100); } else { $final_amt = $amt - $referral_amount; } $amt = $final_amt; } else { $amt = $amt; } } else { $amt = $amt; } if ($contact_key == "") { $contact_key = "None"; } //Entering it into data variables $row = $this->Common_model->getTableData('payment_details', array('code' => 'PAYPAL_ID'))->row(); $paymode = $this->db->where('payment_name', 'Paypal')->get('payments')->row()->is_live; $custom = $id . '@' . $this->dx_auth->get_user_id() . '@' . get_gmt_time(strtotime($checkin)) . '@' . get_gmt_time(strtotime($checkout)) . '@' . $number_of_guests . '@' . $is_travelCretids . '@' . $user_travel_cretids . '@' . get_currency_value1($id, $to_pay) . '@' . get_currency_value1($id, $admin_commission) . '@' . $contact_key . '@' . get_currency_value1($id, $cleaning) . '@' . get_currency_value1($id, $security) . '@' . get_currency_value1($id, $extra_guest_price) . '@' . $guests; $this->session->set_userdata('custom', $custom); if ($this->session->userdata('final_amount') != '') { $amt = $this->session->userdata('final_amount'); $this->session->unset_userdata('final_amount'); } else { $amt = get_currency_value1($id, $amt); } $to_buy = array('desc' => 'Purchase from ACME Store', 'currency' => get_currency_code(), 'type' => 'sale', 'return_URL' => site_url('payments/paypal_success'), 'cancel_URL' => site_url('payments/paypal_cancel'), 'shipping_amount' => 0, 'get_shipping' => false); // I am just iterating through $this->product from defined // above. In a live case, you could be iterating through // the content of your shopping cart. //foreach($this->product as $p) { $temp_product = array('name' => $this->dx_auth->get_site_title() . ' Transaction', 'number' => $placeid, 'quantity' => 1, 'amount' => $amt); // add product to main $to_buy array $to_buy['products'][] = $temp_product; //} // enquire Paypal API for token $set_ec_return = $this->paypal_ec->set_ec($to_buy); if (isset($set_ec_return['ec_status']) && $set_ec_return['ec_status'] === true) { // redirect to Paypal $this->paypal_ec->redirect_to_paypal($set_ec_return['TOKEN']); // You could detect your visitor's browser and redirect to Paypal's mobile checkout // if they are on a mobile device. Just add a true as the last parameter. It defaults // to false // $this->paypal_ec->redirect_to_paypal( $set_ec_return['TOKEN'], true); } else { $this->_error($set_ec_return); } }
public function index() { $currencies_array = $this->currencies->getCurrencies(); $balance_currencies[''] = '-- Select Currency --'; $balances = $this->balance->getBalanceByUserId($this->user_session['user_id']); $balances_array = array(); foreach ($balances as $balance) { $balances_array[$balance['currency_code']] = $balance['balance']; } $balance_currencies = array(); foreach ($currencies_array as $currency_code => $currency_info) { $balance_currencies[$currency_info['code']] = $currency_info['title'] . ' (' . get_currency_value_format(!empty($balances_array[$currency_info['code']]) ? $balances_array[$currency_info['code']] : 0, $currency_info) . ')'; } $this->assign('balance_currencies', $balance_currencies); $posts = $this->input->post(); if ($posts) { $to_account = $posts['to_account']; $amount = (double) $posts['amount']; $balance_currency = $posts['balance_currency']; $fees = $amount * $this->configs['TRANSFER_FEES'] / 100; $transaction_memo = $posts['transaction_memo']; $master_key = $posts['master_key']; if ($balance_currency == '') { $this->validator->addError('Currency', 'Please select the currency of balance that you want to use for the transaction.'); } if ($amount <= 0) { $this->validator->addError('Amount', 'Please input correct Amount .'); } else { // check if out of balance if ($amount > $balances_array[$balance_currency]) { $this->validator->addError('Balance', 'You have not enough balance to transfer the amount(<strong>' . get_currency_value_format($amount, $currencies_array[$balance_currency]) . '</strong>). Please input difference amount.'); } } $user_to = $this->user->getUser(array('account_number' => $to_account)); if (!$user_to) { $this->validator->addError('Account Number', 'Invalid account number. Please input correct account number of the user that you want to transfer to.'); } elseif ($to_account == $this->user_session['account_number']) { $this->validator->addError('Account Number', 'Invalid account number. Please input correct account number of the user that you want to transfer to.'); } // check master KEy if ($master_key != $this->user_session['master_key']) { $this->validator->addError('Master Key', 'Invalid master key entered. Master Key is a three digit number you have selected at the time of registration. Please try again.'); } if (count($this->validator->errors) == 0) { unset($user_to['password']); $transfer_info = $user_to; $transfer_info['amount'] = get_currency_value($amount, $currencies_array[$balance_currency]); $transfer_info['fees'] = get_currency_value($fees, $currencies_array[$balance_currency]); $transfer_info['balance_currency'] = $balance_currency; $transfer_info['amount_text'] = get_currency_value_format($amount, $currencies_array[$balance_currency]); $transfer_info['fees_text'] = get_currency_value_format($fees, $currencies_array[$balance_currency]); $transfer_info['transaction_memo'] = $transaction_memo; $this->session->set_userdata('transfer_info', $transfer_info); redirect(site_url('transfer/confirmation')); $step = 'confirm'; } else { $this->data['posts'] = $posts; $this->data['validerrors'] = $this->validator->errors; } } $this->view('transfer/index'); }
public function submission($param) { $list_id = $param; $row = $this->Common_model->getTableData('payment_details', array('code' => 'PAYPAL_ID'))->row(); $paymode = $this->db->where('payment_name', 'Paypal')->get('payments')->row()->is_live; $row1 = $this->Common_model->getTableData('paymode', array('id' => '1'))->row(); $list_data = $this->Common_model->getTableData('list', array('id' => $list_id))->row(); if ($row1->is_premium == 1) { if ($row1->is_fixed == 1) { $fix = $row1->fixed_amount; $amt = get_currency_value_lys($row1->currency, get_currency_code(), $fix); } else { $per = $row1->percentage_amount; $list_price = $list_data->price; $list_price = get_currency_value_lys($row1->currency, get_currency_code(), $list_price); $camt = floatval($list_price * $per / 100); $amt = $camt; } } if (!isset($amt)) { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', "Administrator has disabled this commission setup. Please try again.")); redirect('rooms/' . $list_id, "refresh"); } //$amt = get_currency_value_lys('USD',get_currency_code(),$amt); if (get_currency_value($this->session->userdata('amount')) == 0) { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate('You are not able to pay a amount for this list. Please contact the Admin.'))); redirect('rooms/lys_next/edit/' . $list_id); } if (get_currency_code() == 'INR' || get_currency_code() == 'MYR' || get_currency_code() == 'ARS' || get_currency_code() == 'CNY' || get_currency_code() == 'IDR' || get_currency_code() == 'KRW' || get_currency_code() == 'VND' || get_currency_code() == 'ZAR') { $currency_code = 'USD'; $amt = get_currency_value_lys(get_currency_code(), $currency_code, $amt); } else { $currency_code = get_currency_code(); $amt = $amt; } $to_buy = array('desc' => 'Purchase from ACME Store', 'currency' => $currency_code, 'type' => 'sale', 'return_URL' => site_url('listpay/list_success/' . $list_id), 'cancel_URL' => site_url('listpay/list_cancel'), 'shipping_amount' => 0, 'get_shipping' => false); // I am just iterating through $this->product from defined // above. In a live case, you could be iterating through // the content of your shopping cart. //foreach($this->product as $p) { $temp_product = array('name' => $this->dx_auth->get_site_title() . ' Transaction', 'number' => $list_id, 'quantity' => 1, 'amount' => $amt); // add product to main $to_buy array $to_buy['products'][] = $temp_product; //} // enquire Paypal API for token $set_ec_return = $this->paypal_ec->set_ec($to_buy); if (isset($set_ec_return['ec_status']) && $set_ec_return['ec_status'] === true) { // redirect to Paypal $this->paypal_ec->redirect_to_paypal($set_ec_return['TOKEN']); // You could detect your visitor's browser and redirect to Paypal's mobile checkout // if they are on a mobile device. Just add a true as the last parameter. It defaults // to false // $this->paypal_ec->redirect_to_paypal( $set_ec_return['TOKEN'], true); } else { $id = $list_id; if ($set_ec_return['L_LONGMESSAGE0'] == 'Security header is not valid') { $username = $this->dx_auth->get_username(); $list_title = $this->Common_model->getTableData('list', array('id' => $id))->row()->title; $email = $this->Common_model->getTableData('users', array('id' => $this->dx_auth->get_user_id()))->row()->email; $admin_email = $this->Common_model->getTableData('users', array('id' => 1))->row()->email; $admin_email_from = $this->dx_auth->get_site_sadmin(); $admin_name = $this->dx_auth->get_site_title(); $email_name = 'payment_issue_to_admin'; $splVars = array("{payment_type}" => 'PayPal', "{site_name}" => $this->dx_auth->get_site_title(), "{username}" => ucfirst($username), "{list_title}" => $list_title, '{email_id}' => $email); $this->Email_model->sendMail($admin_email, $admin_email_from, ucfirst($admin_name), $email_name, $splVars); $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', translate("PayPal business account is misconfigured. Please contact your Administrator."))); redirect('rooms/' . $list_id, "refresh"); } if ($set_ec_return['L_ERRORCODE0'] == 10525) { $this->session->set_flashdata('flash_message', $this->Common_model->flash_message('error', $set_ec_return['L_LONGMESSAGE0'])); redirect('rooms/' . $list_id, "refresh"); } $this->_error($set_ec_return); } }
?> </span> </span> </li> <?php } ?> <li class="bottom col-md-12 col-sm-12 col-xs-12 padding-zero" id="total"> <span class="label col-md-3 col-sm-3 col-xs-5"><span class="inner"><span class="checkout_icon icon_total"></span><?php echo translate("Total"); ?> </span></span> <span class="data col-md-9 col-sm-9 col-xs-12"> <span class="inner"> <?php if (isset($referral_amount) && $subtotal > $referral_amount) { if ($referral_amount > 100) { $final_amt = $amt - get_currency_value(100); } else { $final_amt = $amt - get_currency_value($referral_amount); } echo get_currency_symbol($id) . $final_amt; $this->session->set_userdata('final_amount', $final_amt); } else { echo get_currency_symbol($id) . $amt; $this->session->set_userdata('final_amount', $amt); //echo $amt; } ?> <sup></sup><span class="optional_usd"></sup></span> </span> </span> </li> </ul> <div class="clear"></div>
echo $this->dx_auth->get_site_title(); ?> " target="_blank"> </a> </div> </div> <?php } } else { ?> <div class="Box_dash"> <h2><?php echo translate("Invite your friends, earn"); ?> <?php echo get_currency_symbol1() . get_currency_value(100); ?> <?php echo translate("travel credit!"); ?> <a href="<?php echo base_url() . 'referrals'; ?> " class="invite_now_green">Invite now</a> </h2> </div> <?php } ?> </div> </div>
?> </span> </span> </li> <?php } ?> <li class="bottom" id="total"> <span class="label"><span class="inner"><span class="checkout_icon icon_total"></span><?php echo translate("Total"); ?> </span></span> <span class="data"> <span class="inner"> <?php if (isset($referral_amount) && $subtotal > $referral_amount) { if ($referral_amount > 100) { $final_amt = get_currency_value1($id, $amt) - get_currency_value(100); } else { $final_amt = get_currency_value1($id, $amt) - get_currency_value($referral_amount); } echo get_currency_symbol($id) . $final_amt; $this->session->set_userdata('final_amount', $final_amt); } else { echo get_currency_symbol($id) . get_currency_value1($id, $amt); $this->session->set_userdata('final_amount', get_currency_value1($id, $amt)); //echo $amt; } ?> <sup></sup><span class="optional_usd"></sup></span> </span> </span> </li> </ul> <div class="clear"></div>