return $this->error('phone'); } if (empty($this->params['productinfo'])) { return $this->error('productinfo'); } if (empty($this->params['surl'])) { return $this->error('surl'); } if (empty($this->params['furl'])) { return $this->error('furl'); } return true; } private function error($key) { return 'Mandatory parameter ' . $key . ' is empty'; } } $txnid = uniqid(); $zone1 = get_option('timezone_string'); date_default_timezone_set($zone1); $title = 'Temple Booking'; $price = array_sum($_SESSION['shoopin_cart']['price']); $payumode = get_option('payumode'); $curconversion = get_option('curconversion'); // Merchant key here as provided by Payu $MERCHANT_KEY = get_option('payumerchantkey'); // Merchant Salt as provided by Payu $SALT = get_option('payusalt'); $response = pay_page(array('key' => $MERCHANT_KEY, 'txnid' => uniqid('animesh_'), 'amount' => rand(0, 100), 'firstname' => 'animesh', 'email' => '*****@*****.**', 'phone' => '1234567890', 'productinfo' => 'This is shit', 'surl' => 'payment_success', 'furl' => 'payment_failure'), '200');
public function booking() { $total_booked_rate = 0; $event_slug = $this->input->post('slug'); $ticket_data = $this->input->post('qty'); $qty = count($this->input->post('qty')); // dump($ticket_data); exit; for ($i = 0; $i < $qty; $i++) { if (is_numeric($i)) { $ticket = $ticket_data[$i]; if ($ticket != 0) { $ticket_info = explode('_', $ticket); $ticket_qty = $ticket_info[0]; $ticket_id = $ticket_info[2]; $get_ticket_data = $this->event_ticket_model->get_ticket_details($ticket_id); $total_tickets_booked = $this->event_booked_ticket_model->total_tickets_booked($ticket_id); $event_id = $get_ticket_data[0]->event_id; $tickets_issued = $get_ticket_data[0]->tickets_issued; $ticket_left = $tickets_issued - $total_tickets_booked; if ($ticket_qty > $ticket_left) { redirect('users/login'); } else { $ticket_rate = $get_ticket_data[0]->rate; $ticket_total = $ticket_rate * $ticket_qty; $total_booked_rate += $ticket_total; } } } } $userId = $this->ion_auth->get_user_id(); $user_details = $this->customer_profile_model->get_with_user_details($userId); $failed_uri = 'payments/failed'; $success_uri = 'payments/success'; pay_page(array('key' => 'gtKFFx', 'txnid' => uniqid(), 'amount' => $total_booked_rate, 'firstname' => $user_details[0]->first_name, 'email' => $user_details[0]->username, 'phone' => $user_details[0]->mobile_number, 'productinfo' => 'Event Booking Info', 'surl' => $success_uri, 'furl' => $failed_uri), 'eCwWELxi'); if (!empty($_POST) && isset($_POST['mihpayid']) && $_POST['mihpayid'] != '') { if ($_POST['status'] == 'failure') { if ($_POST['error_Message'] != '') { $_SESSION['payment_error_message'] = $_POST['error_Message']; } else { if ($_POST['field9'] != '') { $_SESSION['payment_error_message'] = $_POST['field9']; } } redirect($failed_uri, 'refresh'); } } }