Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
anburocky3 committed Sep 23, 2017
1 parent 7089bf5 commit 15bdbec
Show file tree
Hide file tree
Showing 8 changed files with 566 additions and 31 deletions.
4 changes: 2 additions & 2 deletions application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
| a PHP script and you can easily do that on your own.
|
*/
$config['base_url'] = '';
$config['base_url'] = 'http://localhost/--projects/PayUMoney-Gateway-Integration-CodeIgniter/';

/*
|--------------------------------------------------------------------------
Expand All @@ -35,7 +35,7 @@
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';
$config['index_page'] = '';

/*
|--------------------------------------------------------------------------
Expand Down
48 changes: 48 additions & 0 deletions application/controllers/Status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Status extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper('url');
}

public function index() {
$status = $this->input->post('status');
if (empty($status)) {
redirect('Welcome');
}

$firstname = $this->input->post('firstname');
$amount = $this->input->post('amount');
$txnid = $this->input->post('txnid');
$posted_hash = $this->input->post('hash');
$key = $this->input->post('key');
$productinfo = $this->input->post('productinfo');
$email = $this->input->post('email');
$salt = "dxmk9SZZ9y"; // Your salt
$add = $this->input->post('additionalCharges');
If (isset($add)) {
$additionalCharges = $this->input->post('additionalCharges');
$retHashSeq = $additionalCharges . '|' . $salt . '|' . $status . '|||||||||||' . $email . '|' . $firstname . '|' . $productinfo . '|' . $amount . '|' . $txnid . '|' . $key;
} else {

$retHashSeq = $salt . '|' . $status . '|||||||||||' . $email . '|' . $firstname . '|' . $productinfo . '|' . $amount . '|' . $txnid . '|' . $key;
}
$data['hash'] = hash("sha512", $retHashSeq);
$data['amount'] = $amount;
$data['txnid'] = $txnid;
$data['posted_hash'] = $posted_hash;
$data['status'] = $status;
if($status == 'success'){
$this->load->view('success', $data);
}
else{
$this->load->view('failure', $data);
}

}


}
72 changes: 56 additions & 16 deletions application/controllers/Welcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,63 @@

class Welcome extends CI_Controller {

/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see https://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('product_form');
$this->load->view('product_form');
}

public function check()
{
$amount = $this->input->post('payble_amount');
$product_info = $this->input->post('product_info');
$customer_name = $this->input->post('customer_name');
$customer_emial = $this->input->post('customer_email');
$customer_mobile = $this->input->post('mobile_number');
$customer_address = $this->input->post('customer_address');

//payumoney details


$MERCHANT_KEY = "SYMBk2HQ"; //change merchant with yours
$SALT = "dxmk9SZZ9y"; //change salt with yours

$txnid = substr(hash('sha256', mt_rand() . microtime()), 0, 20);
//optional udf values
$udf1 = '';
$udf2 = '';
$udf3 = '';
$udf4 = '';
$udf5 = '';

$hashstring = $MERCHANT_KEY . '|' . $txnid . '|' . $amount . '|' . $product_info . '|' . $customer_name . '|' . $customer_emial . '|' . $udf1 . '|' . $udf2 . '|' . $udf3 . '|' . $udf4 . '|' . $udf5 . '||||||' . $SALT;
$hash = strtolower(hash('sha512', $hashstring));

$success = base_url() . 'Status';
$fail = base_url() . 'Status';
$cancel = base_url() . 'Status';


$data = array(
'mkey' => $MERCHANT_KEY,
'tid' => $txnid,
'hash' => $hash,
'amount' => $amount,
'name' => $customer_name,
'productinfo' => $product_info,
'mailid' => $customer_emial,
'phoneno' => $customer_mobile,
'address' => $customer_address,
'action' => "https://test.payu.in", //for live change action https://secure.payu.in
'sucess' => $success,
'failure' => $fail,
'cancel' => $cancel
);
$this->load->view('confirmation', $data);

}

public function help()
{
$this->load->view('help');
}
}
112 changes: 112 additions & 0 deletions application/views/confirmation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link rel="stylesheet" href="<?php echo base_url(); ?>/assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="<?php echo base_url(); ?>/assets/js/bootstrap.min.js" />

</head>
<body>

<!-- Bootstrap 4 Navbar -->
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a href="#" class="navbar-brand">PayUMoney Gateway</a>

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarsExampleDefault">

<ul class="navbar-nav ml-auto">

<li class="nav-item ">
<a href="https://facebook.com/anburocky3" class="nav-link" target="_blank">#Developer</a>
</li>

<li class="nav-item">
<a href="<?php echo base_url(); ?>Welcome/help" class="nav-link">Help Article</a>
</li>

<li class="nav-item">
<a href="https://facebook.com/cdudenetworks" class="nav-link" target="_blank">Support</a>
</li>

</ul>

</div>

</nav>
<!-- End Bootstrap 4 Navbar -->



<div class="container mt-5">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="card">
<h5 class="card-header bg-success text-white">Checkout Confirmation</h5>
<div class="card-body">
<form action="<?php echo $action; ?>/_payment" method="post" id="payuForm" name="payuForm">
<input type="hidden" name="key" value="<?php echo $mkey; ?>" />
<input type="hidden" name="hash" value="<?php echo $hash; ?>"/>
<input type="hidden" name="txnid" value="<?php echo $tid; ?>" />
<div class="form-group">
<label class="control-label">Total Payable Amount</label>
<input class="form-control" name="amount" value="<?php echo $amount; ?>" readonly/>
</div>
<div class="form-group">
<label class="control-label">Your Name</label>
<input class="form-control" name="firstname" id="firstname" value="<?php echo $name; ?>" readonly/>
</div>
<div class="form-group">
<label class="control-label">Email</label>
<input class="form-control" name="email" id="email" value="<?php echo $mailid; ?>" readonly/>
</div>
<div class="form-group">
<label class="control-label">Phone</label>
<input class="form-control" name="phone" value="<?php echo $phoneno; ?>" readonly />
</div>
<div class="form-group">
<label class="control-label"> Booking Info</label>
<textarea class="form-control" name="productinfo" readonly><?php echo $productinfo; ?></textarea>
</div>
<div class="form-group">
<label class="control-label">Address</label>
<input class="form-control" name="address1" value="<?php echo $address; ?>" readonly/>
</div>
<div class="form-group">
<input name="surl" value="<?php echo $sucess; ?>" size="64" type="hidden" />
<input name="furl" value="<?php echo $failure; ?>" size="64" type="hidden" />
<!--for test environment comment service provider -->
<input type="hidden" name="service_provider" value="payu_paisa" size="64" />
<input name="curl" value="<?php echo $cancel; ?> " type="hidden" />
</div>
<div class="form-group float-right">
<input type="submit" value="Pay Now" class="btn btn-success" />
</div>
</form>
</div>
</div>

</div>
<div class="col-md-2"></div>
</div>
<!-- Footer -->

<footer>
<hr>
<p>Copyright &copy; <?php echo date('Y'); ?>
<span class="float-right">Coded with Love &hearts; : <a href="https://facebook.com/anburocky3" target="_blank">Anbuselvan Rocky</a></span></p>
</footer>
</div>

</body>
</html>
77 changes: 77 additions & 0 deletions application/views/failure.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link rel="stylesheet" href="<?php echo base_url(); ?>/assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="<?php echo base_url(); ?>/assets/js/bootstrap.min.js" />

</head>
<body>

<!-- Bootstrap 4 Navbar -->
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a href="#" class="navbar-brand">PayUMoney Gateway</a>

<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse" id="navbarsExampleDefault">

<ul class="navbar-nav ml-auto">

<li class="nav-item ">
<a href="https://facebook.com/anburocky3" class="nav-link" target="_blank">#Developer</a>
</li>

<li class="nav-item">
<a href="<?php echo base_url(); ?>Welcome/help" class="nav-link">Help Article</a>
</li>

<li class="nav-item">
<a href="https://facebook.com/cdudenetworks" class="nav-link" target="_blank">Support</a>
</li>

</ul>

</div>

</nav>
<!-- End Bootstrap 4 Navbar -->



<div class="container mt-5">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8 text-center">
<div class="card">
<h4 class="card-header">Transaction <label for="failure" class="badge badge-danger">Failed</label></h4>
<div class="card-body">
<?php
echo "<p>Your order status is ". $status ."..</br>";
echo "Your transaction id for this transaction is ".$txnid.". <br>Contact our customer support.</p>";
echo "<a href='".base_url()."' class='btn btn-sm float-left btn-info'> < - Go Back</a>";
?>
</div>
</div>
</div>
<div class="col-md-2"></div>
</div>
<!-- Footer -->

<footer style="position: absolute;bottom:0; width: 90%;">
<hr>
<p>Copyright &copy; <?php echo date('Y'); ?>
<span class="float-right">Coded with Love &hearts; : <a href="https://facebook.com/anburocky3" target="_blank">Anbuselvan Rocky</a></span></p>
</footer>
</div>

</body>
</html>
Loading

0 comments on commit 15bdbec

Please sign in to comment.