| 10606 |
amit.gupta |
1 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
| 10611 |
amit.gupta |
2 |
|
| 10582 |
lgm |
3 |
class Checkout extends MY_Controller {
|
|
|
4 |
|
|
|
5 |
public $layoutName ='';
|
|
|
6 |
|
|
|
7 |
function __construct() {
|
|
|
8 |
|
|
|
9 |
// Call the CI_controller constructor
|
|
|
10 |
parent::__construct();
|
|
|
11 |
$admin = $this->session->userdata('admin');
|
| 11108 |
lgm |
12 |
// if(!isset($admin) || empty($admin)) {
|
|
|
13 |
// redirect(base_url().'authorize');
|
|
|
14 |
// }
|
| 11421 |
lgm |
15 |
$this->output->set_header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
|
|
|
16 |
$this->output->set_header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
|
|
17 |
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
|
|
|
18 |
$this->output->set_header("Cache-Control: post-check=0, pre-check=0", false);
|
|
|
19 |
$this->output->set_header("Pragma: no-cache");
|
| 10582 |
lgm |
20 |
$this->layout->setlayout('layout/layout_main');
|
|
|
21 |
$this->load->model('checkout_model');
|
|
|
22 |
$this->load->model('captcha_model');
|
|
|
23 |
$this->layoutName= $this->layout->getLayout();
|
|
|
24 |
$this->layoutName =substr($this->layoutName , 0, strrpos($this->layoutName , "/")).'/';
|
| 11301 |
lgm |
25 |
//print_r($this->session->userdata);
|
| 10582 |
lgm |
26 |
|
|
|
27 |
|
|
|
28 |
}
|
|
|
29 |
public function index()
|
|
|
30 |
{
|
|
|
31 |
$authorized = $this->session->userdata('authorized');
|
|
|
32 |
if(isset($authorized) and !empty($authorized['id']))
|
|
|
33 |
{
|
|
|
34 |
//if user logged-in
|
|
|
35 |
redirect(base_url().strtolower(__CLASS__).'/shipping');
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
//standard array
|
|
|
39 |
}
|
|
|
40 |
public function __paginateList($data=array())
|
|
|
41 |
{
|
|
|
42 |
//$data['baseSubTotal']=$data['baseSubTotal'];
|
|
|
43 |
$data['subTotal'] = $data['subTotal'];
|
|
|
44 |
//$data['shippingCharges'] = $data['shippingCharges'];
|
|
|
45 |
return $data;
|
|
|
46 |
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
public function orderconfirmation()
|
|
|
50 |
{
|
|
|
51 |
$authorized = $this->session->userdata('authorized');
|
|
|
52 |
if(isset($authorized) && !empty($authorized)){
|
|
|
53 |
$_GET['userId'] = $authorized['Id'];
|
|
|
54 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
55 |
if($authorized['isLoggedIn'] == 1){
|
|
|
56 |
$_GET['isLoggedIn'] = 'true';
|
|
|
57 |
}
|
| 16276 |
amit.gupta |
58 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
| 10582 |
lgm |
59 |
$_GET['isLoggedIn'] = 'false';
|
|
|
60 |
}
|
| 10834 |
lgm |
61 |
$newValues = $authorized;
|
|
|
62 |
$newValues['totalItems'] = 0;
|
| 16276 |
amit.gupta |
63 |
$this->session->userdata['authorized'] = $newValues;
|
| 10582 |
lgm |
64 |
}
|
|
|
65 |
//die();
|
|
|
66 |
$this->lessphp->object()->ccompile('assets/css/shipping.less','assets/css/shipping.css');
|
|
|
67 |
$data['stylesheet'] = 'shipping.css';
|
|
|
68 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$this->config->item('orderconfirmation'));
|
|
|
69 |
// $this->session->unset_userdata('shipping');
|
|
|
70 |
// $this->session->unset_userdata('billing');
|
|
|
71 |
// $this->session->unset_userdata('shoppingId');
|
| 16276 |
amit.gupta |
72 |
$this->session->unset_userdata(array('hotspotId','addressId'));
|
| 10582 |
lgm |
73 |
$this->layout->view('checkout/checkout_view',$data);
|
|
|
74 |
}
|
| 20622 |
amit.gupta |
75 |
public function orderconfirmation1()
|
|
|
76 |
{
|
|
|
77 |
$this->layout->setlayout('layout/layout_bigutsav');
|
|
|
78 |
$authorized = $this->session->userdata('authorized');
|
|
|
79 |
if(isset($authorized) && !empty($authorized)){
|
|
|
80 |
$_GET['userId'] = $authorized['Id'];
|
|
|
81 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
82 |
if($authorized['isLoggedIn'] == 1){
|
|
|
83 |
$_GET['isLoggedIn'] = 'true';
|
|
|
84 |
}
|
|
|
85 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
86 |
$_GET['isLoggedIn'] = 'false';
|
|
|
87 |
}
|
|
|
88 |
$newValues = $authorized;
|
|
|
89 |
$newValues['totalItems'] = 0;
|
|
|
90 |
$this->session->userdata['authorized'] = $newValues;
|
|
|
91 |
}
|
|
|
92 |
//die();
|
|
|
93 |
$this->lessphp->object()->ccompile('assets/css/shipping.less','assets/css/shipping.css');
|
|
|
94 |
$data['stylesheet'] = 'shipping.css';
|
|
|
95 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$this->config->item('orderconfirmation1'));
|
|
|
96 |
// $this->session->unset_userdata('shipping');
|
|
|
97 |
// $this->session->unset_userdata('billing');
|
|
|
98 |
// $this->session->unset_userdata('shoppingId');
|
|
|
99 |
$this->session->unset_userdata(array('hotspotId','addressId'));
|
|
|
100 |
$this->layout->view('checkout/checkout_view',$data);
|
|
|
101 |
}
|
| 20609 |
amit.gupta |
102 |
public function payment1()
|
|
|
103 |
{
|
|
|
104 |
$this->layout->setlayout('layout/layout_bigutsav');
|
|
|
105 |
//standard array
|
|
|
106 |
if (!empty($_GET['cq'])) {
|
|
|
107 |
$this->session->userdata['authorized']['totalItems'] = $_GET['cq'];
|
|
|
108 |
$this->session->set_userdata('addressId',$_GET['addressid']);
|
|
|
109 |
}
|
|
|
110 |
$authorized = $this->session->userdata('authorized');
|
|
|
111 |
if(!isset($authorized) || empty($authorized)){
|
|
|
112 |
redirect(base_url()."cart");
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
$data = array();
|
|
|
116 |
$codCaptcha = $this->session->userdata('cod');
|
|
|
117 |
if(isset($codCaptcha) && $codCaptcha == 1){
|
|
|
118 |
$data['codCaptcha'] = 1;
|
|
|
119 |
$this->session->unset_userdata('cod');
|
|
|
120 |
}else{
|
|
|
121 |
$data['codCaptcha'] = 0;
|
|
|
122 |
}
|
|
|
123 |
$paymentconfig = $this->config->item('payment1');
|
|
|
124 |
if(!isset($_POST['submit'])){
|
|
|
125 |
$hotspot = $this->session->userdata('hotspotId');
|
|
|
126 |
if(isset($hotspot) && !empty($hotspot)){
|
|
|
127 |
$_GET['hotSpotAddressId'] = $hotspot;
|
|
|
128 |
$_GET['deliveryLocation'] = 'hotSpot';
|
|
|
129 |
}else{
|
|
|
130 |
$_GET['deliveryLocation'] = 'myLocation';
|
|
|
131 |
}
|
|
|
132 |
unset($paymentconfig['response'][2]);
|
|
|
133 |
if(isset($authorized) && !empty($authorized)){
|
|
|
134 |
$_GET['userId'] = $authorized['Id'];
|
|
|
135 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
136 |
if($authorized['isLoggedIn'] == 1){
|
|
|
137 |
$_GET['isLoggedIn'] = 'true';
|
|
|
138 |
}
|
|
|
139 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
140 |
$_GET['isLoggedIn'] = 'false';
|
|
|
141 |
}
|
|
|
142 |
if(isset($authorized['isPrivateDealUser']) && $authorized['isPrivateDealUser'] == 1){
|
|
|
143 |
$this->session->set_userdata('skipcaptcha',1);
|
|
|
144 |
$data['skipcaptcha'] = 1;
|
|
|
145 |
}
|
|
|
146 |
}
|
|
|
147 |
$addressId = $this->session->userdata('addressId');
|
|
|
148 |
$_GET['addressid'] = $addressId;
|
| 20862 |
amit.gupta |
149 |
|
| 20609 |
amit.gupta |
150 |
$this->lessphp->object()->ccompile('assets/css/shipping.less','assets/css/shipping.css');
|
|
|
151 |
$data['stylesheet'] = 'shipping.css';
|
|
|
152 |
$data['title'] = 'Saholic';
|
|
|
153 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),'',$paymentconfig);
|
|
|
154 |
if(isset($data['response']['response']['payment_process1'])){
|
|
|
155 |
$result = json_decode($data['response']['response']['payment_process1'][0]);
|
| 20862 |
amit.gupta |
156 |
if(isset($_GET['walletUsed'])) {
|
| 20877 |
amit.gupta |
157 |
$walletUsed = (int)($_GET['walletUsed']);
|
| 20609 |
amit.gupta |
158 |
}
|
| 20862 |
amit.gupta |
159 |
$result->results->totalAmount -= $walletUsed;
|
|
|
160 |
$this->session->set_userdata('walletUsed',$walletUsed);
|
| 20609 |
amit.gupta |
161 |
$this->layout->view('checkout/checkout_view',$data);
|
|
|
162 |
}
|
|
|
163 |
else{
|
|
|
164 |
redirect(base_url()."cart");
|
|
|
165 |
}
|
|
|
166 |
}
|
|
|
167 |
elseif(isset($_POST['submit'])) {
|
|
|
168 |
if(isset($_POST['captcha_response_field']) && !empty($_POST['captcha_response_field'])){
|
|
|
169 |
$captcha = $this->session->userdata('captcha');
|
|
|
170 |
if(strcmp($captcha,$_POST['captcha_response_field']) != 0){
|
|
|
171 |
if(isset($_POST['payoption']) && ($_POST['payoption'] == 3000) || $_POST['payoption'] == 3001) {
|
|
|
172 |
$this->session->set_userdata('cod',1);
|
|
|
173 |
}
|
|
|
174 |
redirect(base_url().'payment');
|
|
|
175 |
}
|
|
|
176 |
}
|
|
|
177 |
unset($paymentconfig['response'][0]);
|
|
|
178 |
unset($paymentconfig['response'][1]);
|
|
|
179 |
if(isset($authorized) && !empty($authorized)){
|
|
|
180 |
$_POST['userId'] = $authorized['Id'];
|
|
|
181 |
if($authorized['isLoggedIn'] == 1){
|
|
|
182 |
$_POST['isLoggedIn'] = 'true';
|
|
|
183 |
}
|
|
|
184 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
185 |
$_POST['isLoggedIn'] = 'false';
|
|
|
186 |
}
|
|
|
187 |
}
|
|
|
188 |
$addressId = $this->session->userdata('addressId');
|
| 20862 |
amit.gupta |
189 |
$walletUsed = $this->session->userdata('walletUsed');
|
| 20609 |
amit.gupta |
190 |
$_POST['addressid'] = $addressId;
|
| 20862 |
amit.gupta |
191 |
$_POST['walletUsed'] = $walletUsed;
|
| 20609 |
amit.gupta |
192 |
$_POST['payment_option'] = $_POST['payoption'];
|
|
|
193 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
194 |
error_log('[USER] ' .print_r($authorized,1),3,'/tmp/payments.log');
|
|
|
195 |
error_log('[RESPONSE] '. print_r($data['response']['response'],1),3,'/tmp/payments.log');
|
|
|
196 |
if(isset($data['response']['response']['payment_submit'][0]) && !empty($data['response']['response']['payment_submit'][0])) {
|
|
|
197 |
$paymentSubmit = $data['response']['response']['payment_submit'][0];
|
|
|
198 |
if(isset($paymentSubmit->response->isPaymentRedirect) && $paymentSubmit->response->isPaymentRedirect == 1){
|
|
|
199 |
$image = '/assets/images/loading.gif';
|
|
|
200 |
$location = $paymentSubmit->response->redirectUrl;
|
|
|
201 |
echo '<html><head><meta http-equiv="refresh" content="1;url='.$paymentSubmit->response->redirectUrl.'">
|
|
|
202 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
203 |
<title>Saholic Mobile Site: Redirecting to <'.$paymentSubmit->response->gatewayName.'> Payment Gateway</title>
|
|
|
204 |
</head>
|
|
|
205 |
<body>
|
|
|
206 |
<div style="text-align:center; margin-top:200px;">Please wait while we redirect you to the Payment Gateway.</div>
|
|
|
207 |
<div align="center" class="img">
|
|
|
208 |
<img title="loading" alt="loading" src="'.$image.'">
|
|
|
209 |
</div>
|
|
|
210 |
</body>
|
|
|
211 |
</html>';
|
|
|
212 |
}elseif(strpos($paymentSubmit->response->redirectUrl, 'ebs-pay') !== false) {
|
|
|
213 |
$url = $this->config->item('curl_base_url').$paymentSubmit->response->redirectUrl;
|
|
|
214 |
//echo $url;
|
|
|
215 |
$authorized = $this->session->userdata('authorized');
|
|
|
216 |
if(isset($authorized) && !empty($authorized)){
|
|
|
217 |
$params['userId'] = $authorized['Id'];
|
|
|
218 |
if($authorized['isLoggedIn'] == 1){
|
|
|
219 |
$params['isLoggedIn'] = 'true';
|
|
|
220 |
}
|
|
|
221 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
222 |
$params['isLoggedIn'] = 'false';
|
|
|
223 |
}
|
|
|
224 |
}
|
|
|
225 |
$this->mcurl->add_call('ebs','get',$url,$params);
|
|
|
226 |
$response = $this->mcurl->execute($url);
|
|
|
227 |
$data['response'] = $response['ebs']['response'];
|
|
|
228 |
$response = $this->magento_model->payment_submit($data);
|
|
|
229 |
if(isset($response) && !empty($response)) {
|
|
|
230 |
$ebs = $response[0]->response;
|
|
|
231 |
$image = './assets/images/loading.gif';
|
|
|
232 |
echo '<html>
|
|
|
233 |
<head>
|
|
|
234 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
235 |
<title>m.saholic.com: Redirecting to EBS Payment Page</title>
|
|
|
236 |
</head>
|
|
|
237 |
<body>
|
|
|
238 |
<div style="text-align:center; margin-top:200px;">Please wait while we redirect you to the Payment Gateway.</div>
|
|
|
239 |
<div align="center" class="img">
|
|
|
240 |
<img title="loading" alt="loading" src="'.$image.'">
|
|
|
241 |
</div>
|
|
|
242 |
<div style="display:none">
|
|
|
243 |
<form method="post" action="'.$ebs->postAction.'" name="frmTransaction" id="frmTransaction">
|
|
|
244 |
<!-- Account Id -->
|
|
|
245 |
<input name="account_id" type="hidden" value="'.$ebs->account_id.'" />
|
|
|
246 |
<!-- Transaction Details -->
|
|
|
247 |
<input name="reference_no" type="hidden" value="'.$ebs->reference_no.'" />
|
|
|
248 |
<input name="amount" type="hidden" value="'.$ebs->amount.'" />
|
|
|
249 |
<input name="description" type="hidden" value="'.$ebs->description.'" />
|
|
|
250 |
<input name="payment_option" type="hidden" value="'.$ebs->payment_option.'"/>
|
|
|
251 |
<!-- Billing Address -->
|
|
|
252 |
<input name="name" type="hidden" value="'.$ebs->name.'" />
|
|
|
253 |
<input name="address" type="hidden" value="'.$ebs->address.'" />
|
|
|
254 |
<input name="city" type="hidden" value="'.$ebs->city.'" />
|
|
|
255 |
<input name="state" type="hidden" value="'.$ebs->state.'" />
|
|
|
256 |
<input name="postal_code" type="hidden" value="'.$ebs->postal_code.'" />
|
|
|
257 |
<input name="country" type="hidden" value="'.$ebs->country.'"/>
|
|
|
258 |
<input name="email" type="hidden" value="'.$ebs->email.'" />
|
|
|
259 |
<input name="phone" type="hidden" value="'.$ebs->phone.'" />
|
|
|
260 |
<!-- Delivery Address -->
|
|
|
261 |
<input name="ship_name" type="hidden" value="'.$ebs->ship_name.'" />
|
|
|
262 |
<input name="ship_address" type="hidden" value="'.$ebs->ship_address.'" />
|
|
|
263 |
<input name="ship_city" type="hidden" value="'.$ebs->ship_city.'" />
|
|
|
264 |
<input name="ship_state" type="hidden" value="'.$ebs->ship_state.'" />
|
|
|
265 |
<input name="ship_postal_code" type="hidden" value="'.$ebs->ship_postal_code.'" />
|
|
|
266 |
<input name="ship_country" type="hidden" value="'.$ebs->ship_country.'"/>
|
|
|
267 |
<input name="ship_phone" type="hidden" value="'.$ebs->ship_phone.'" />
|
|
|
268 |
<input name="return_url" type="hidden" value="'.$ebs->return_url.'" />
|
|
|
269 |
<input name="mode" value="'.$ebs->mode.'"/>
|
|
|
270 |
<input name="secure_hash" type="hidden" value="'.$ebs->secure_hash.'" />
|
|
|
271 |
<input name="channel" type="hidden" value="'.$ebs->channel.'" />
|
|
|
272 |
<input name="page_id" type="hidden" value="'.$ebs->page_id.'" />
|
|
|
273 |
</form>
|
|
|
274 |
</div>
|
|
|
275 |
<script type="text/javascript">
|
|
|
276 |
document.getElementById("frmTransaction").submit();
|
|
|
277 |
</script>
|
|
|
278 |
</body>
|
|
|
279 |
</html>';
|
|
|
280 |
}
|
|
|
281 |
else{
|
|
|
282 |
redirect(base_url().'payment');
|
|
|
283 |
}
|
|
|
284 |
}
|
|
|
285 |
elseif(strpos($paymentSubmit->response->redirectUrl, 'payu-pay') !== false) {
|
|
|
286 |
$url = $this->config->item('curl_base_url').$paymentSubmit->response->redirectUrl;
|
|
|
287 |
//echo $url;
|
|
|
288 |
$params = array();
|
|
|
289 |
$authorized = $this->session->userdata('authorized');
|
|
|
290 |
if(isset($authorized) && !empty($authorized)){
|
|
|
291 |
$params['userId'] = $authorized['Id'];
|
|
|
292 |
if($authorized['isLoggedIn'] == 1){
|
|
|
293 |
$params['isLoggedIn'] = 'true';
|
|
|
294 |
}
|
|
|
295 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
296 |
$params['isLoggedIn'] = 'false';
|
|
|
297 |
}
|
|
|
298 |
}
|
|
|
299 |
$this->mcurl->add_call('payu','get',$url,$params);
|
|
|
300 |
$response = $this->mcurl->execute($url);
|
|
|
301 |
error_log("payu response".print_r($response,1));
|
|
|
302 |
$data['response'] = $response['payu']['response'];
|
|
|
303 |
$response = $this->magento_model->payment_submit($data);
|
|
|
304 |
if(isset($response) && !empty($response)){
|
|
|
305 |
$payu = $response[0]->response;
|
|
|
306 |
$image = '/assets/images/loading.gif';
|
|
|
307 |
// $return_url = base_url().'ebs-pay-processing/?DR={DR}';
|
|
|
308 |
$ci = get_instance();
|
|
|
309 |
}
|
|
|
310 |
?>
|
|
|
311 |
<html>
|
|
|
312 |
<head>
|
|
|
313 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
314 |
<title>m.saholic.com: Redirecting to PayU Payment Gateway</title>
|
|
|
315 |
</head>
|
|
|
316 |
<body>
|
|
|
317 |
<div style="text-align:center; margin-top:200px;">Please wait while we redirect you to the Payment Gateway.</div>
|
|
|
318 |
<div align="center" class="img">
|
|
|
319 |
<img title="loading" alt="loading" src="<?php echo $image;?>">
|
|
|
320 |
</div>
|
|
|
321 |
<div style="display:none;">
|
|
|
322 |
<form action="<?php echo $payu->postActionUrl; ?>" method="post" id="payuForm">
|
|
|
323 |
<input type="hidden" name="key" value="<?php echo $payu->key; ?>" />
|
|
|
324 |
<input type="hidden" name="hash" value="<?php echo $payu->hash ?>"/>
|
|
|
325 |
<input type="hidden" name="txnid" value="<?php echo $payu->txnid ?>" />
|
|
|
326 |
<input name="amount" value="<?php echo $payu->amount; ?>" />
|
|
|
327 |
<input name="firstname" id="firstname" value="<?php echo $payu->firstname;?>" />
|
|
|
328 |
<input name="email" id="email" value="<?php echo $payu->email; ?>" />
|
|
|
329 |
<input name="phone" value="<?php echo $payu->phone; ?>" />
|
|
|
330 |
<input name="productinfo" value="<?php echo $payu->productinfo; ?>" />
|
|
|
331 |
<input name="surl" value="<?php echo rtrim(base_url(), "/").$payu->surl; ?>" />
|
|
|
332 |
<input name="furl" value="<?php echo rtrim(base_url(), "/").$payu->furl; ?>" />
|
|
|
333 |
<input name="bankcode" value="<?php echo $payu->bankcode; ?>" />
|
|
|
334 |
<input name="pg" value="<?php echo $payu->pg; ?>" />
|
|
|
335 |
<input name="curl" value="<?php echo rtrim(base_url(), "/").$payu->curl; ?>" />
|
| 20622 |
amit.gupta |
336 |
<input type="hidden" name="service_provider" value="payu_paisa" />
|
| 20609 |
amit.gupta |
337 |
<input type="submit" value="Submit" />
|
|
|
338 |
</form>
|
|
|
339 |
</div>
|
|
|
340 |
<script type="text/javascript">
|
|
|
341 |
document.getElementById("payuForm").submit();
|
|
|
342 |
</script>
|
|
|
343 |
</body>
|
|
|
344 |
</html>
|
|
|
345 |
<?php
|
|
|
346 |
}
|
|
|
347 |
else{
|
|
|
348 |
redirect(base_url().$paymentSubmit->response->redirectUrl);
|
|
|
349 |
}
|
|
|
350 |
} else {
|
|
|
351 |
redirect(base_url()."payment");
|
|
|
352 |
}
|
|
|
353 |
}
|
|
|
354 |
}
|
| 10582 |
lgm |
355 |
public function payment()
|
|
|
356 |
{
|
|
|
357 |
//standard array
|
| 17868 |
amit.gupta |
358 |
if (!empty($_GET['cq'])) {
|
|
|
359 |
$this->session->userdata['authorized']['totalItems'] = $_GET['cq'];
|
| 17985 |
amit.gupta |
360 |
$this->session->set_userdata('addressId',$_GET['addressid']);
|
| 17868 |
amit.gupta |
361 |
}
|
| 17884 |
amit.gupta |
362 |
$authorized = $this->session->userdata('authorized');
|
| 10582 |
lgm |
363 |
if(!isset($authorized) || empty($authorized)){
|
|
|
364 |
redirect(base_url()."cart");
|
|
|
365 |
}
|
|
|
366 |
|
|
|
367 |
$data = array();
|
|
|
368 |
$codCaptcha = $this->session->userdata('cod');
|
|
|
369 |
if(isset($codCaptcha) && $codCaptcha == 1){
|
|
|
370 |
$data['codCaptcha'] = 1;
|
|
|
371 |
$this->session->unset_userdata('cod');
|
|
|
372 |
}else{
|
|
|
373 |
$data['codCaptcha'] = 0;
|
|
|
374 |
}
|
|
|
375 |
$paymentconfig = $this->config->item('payment');
|
|
|
376 |
if(!isset($_POST['submit'])){
|
|
|
377 |
$hotspot = $this->session->userdata('hotspotId');
|
|
|
378 |
if(isset($hotspot) && !empty($hotspot)){
|
|
|
379 |
$_GET['hotSpotAddressId'] = $hotspot;
|
|
|
380 |
$_GET['deliveryLocation'] = 'hotSpot';
|
|
|
381 |
}else{
|
|
|
382 |
$_GET['deliveryLocation'] = 'myLocation';
|
|
|
383 |
}
|
|
|
384 |
unset($paymentconfig['response'][2]);
|
|
|
385 |
if(isset($authorized) && !empty($authorized)){
|
|
|
386 |
$_GET['userId'] = $authorized['Id'];
|
|
|
387 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
388 |
if($authorized['isLoggedIn'] == 1){
|
|
|
389 |
$_GET['isLoggedIn'] = 'true';
|
|
|
390 |
}
|
|
|
391 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
392 |
$_GET['isLoggedIn'] = 'false';
|
|
|
393 |
}
|
| 14939 |
anikendra |
394 |
if(isset($authorized['isPrivateDealUser']) && $authorized['isPrivateDealUser'] == 1){
|
|
|
395 |
$this->session->set_userdata('skipcaptcha',1);
|
|
|
396 |
$data['skipcaptcha'] = 1;
|
|
|
397 |
}
|
| 10582 |
lgm |
398 |
}
|
|
|
399 |
$addressId = $this->session->userdata('addressId');
|
|
|
400 |
$_GET['addressid'] = $addressId;
|
|
|
401 |
$this->lessphp->object()->ccompile('assets/css/shipping.less','assets/css/shipping.css');
|
|
|
402 |
$data['stylesheet'] = 'shipping.css';
|
| 11012 |
lgm |
403 |
$data['title'] = 'Saholic';
|
| 10582 |
lgm |
404 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),'',$paymentconfig);
|
|
|
405 |
if(isset($data['response']['response']['payment_process'])){
|
|
|
406 |
$result = json_decode($data['response']['response']['payment_process'][0]);
|
|
|
407 |
$totalAmount = $result->results->totalAmount;
|
|
|
408 |
if(isset($result->results->isTotalAmountZero)){
|
|
|
409 |
$isTotalAmountZero = $result->results->isTotalAmountZero;
|
|
|
410 |
}
|
|
|
411 |
$totalAmount = number_format((float)$totalAmount,0,'.','');
|
|
|
412 |
$captcha = $this->captcha_model->generateCaptcha();
|
|
|
413 |
$this->session->set_userdata('captcha',$captcha['word']);
|
|
|
414 |
$data['captcha'] = $captcha;
|
|
|
415 |
// if($totalAmount == 0 && isset($isTotalAmountZero) && $isTotalAmountZero == 1){
|
|
|
416 |
// $captcha = $this->captcha_model->generateCaptcha();
|
|
|
417 |
// $this->session->set_userdata('captcha',$captcha['word']);
|
|
|
418 |
// $this->session->set_userdata('captchaDisplay',$isTotalAmountZero);
|
|
|
419 |
// $data['captcha'] = $captcha;
|
|
|
420 |
// }
|
|
|
421 |
$this->layout->view('checkout/checkout_view',$data);
|
|
|
422 |
}
|
|
|
423 |
else{
|
|
|
424 |
redirect(base_url()."cart");
|
|
|
425 |
}
|
|
|
426 |
}
|
| 15792 |
anikendra |
427 |
elseif(isset($_POST['submit'])) {
|
| 10582 |
lgm |
428 |
if(isset($_POST['captcha_response_field']) && !empty($_POST['captcha_response_field'])){
|
|
|
429 |
$captcha = $this->session->userdata('captcha');
|
|
|
430 |
if(strcmp($captcha,$_POST['captcha_response_field']) != 0){
|
| 10630 |
lgm |
431 |
if(isset($_POST['payoption']) && ($_POST['payoption'] == 3000) || $_POST['payoption'] == 3001) {
|
| 10582 |
lgm |
432 |
$this->session->set_userdata('cod',1);
|
|
|
433 |
}
|
|
|
434 |
redirect(base_url().'payment');
|
|
|
435 |
}
|
|
|
436 |
}
|
|
|
437 |
unset($paymentconfig['response'][0]);
|
|
|
438 |
unset($paymentconfig['response'][1]);
|
|
|
439 |
if(isset($authorized) && !empty($authorized)){
|
|
|
440 |
$_POST['userId'] = $authorized['Id'];
|
|
|
441 |
if($authorized['isLoggedIn'] == 1){
|
|
|
442 |
$_POST['isLoggedIn'] = 'true';
|
|
|
443 |
}
|
|
|
444 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
445 |
$_POST['isLoggedIn'] = 'false';
|
|
|
446 |
}
|
|
|
447 |
}
|
|
|
448 |
$addressId = $this->session->userdata('addressId');
|
|
|
449 |
$_POST['addressid'] = $addressId;
|
|
|
450 |
$_POST['payment_option'] = $_POST['payoption'];
|
|
|
451 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
| 15792 |
anikendra |
452 |
error_log('[USER] ' .print_r($authorized,1),3,'/tmp/payments.log');
|
|
|
453 |
error_log('[RESPONSE] '. print_r($data['response']['response'],1),3,'/tmp/payments.log');
|
|
|
454 |
if(isset($data['response']['response']['payment_submit'][0]) && !empty($data['response']['response']['payment_submit'][0])) {
|
| 10582 |
lgm |
455 |
$paymentSubmit = $data['response']['response']['payment_submit'][0];
|
|
|
456 |
if(isset($paymentSubmit->response->isPaymentRedirect) && $paymentSubmit->response->isPaymentRedirect == 1){
|
| 16276 |
amit.gupta |
457 |
$image = '/assets/images/loading.gif';
|
| 10582 |
lgm |
458 |
$location = $paymentSubmit->response->redirectUrl;
|
| 10735 |
lgm |
459 |
echo '<html><head><meta http-equiv="refresh" content="1;url='.$paymentSubmit->response->redirectUrl.'">
|
| 11301 |
lgm |
460 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 10582 |
lgm |
461 |
<title>Saholic Mobile Site: Redirecting to <'.$paymentSubmit->response->gatewayName.'> Payment Gateway</title>
|
|
|
462 |
</head>
|
|
|
463 |
<body>
|
|
|
464 |
<div style="text-align:center; margin-top:200px;">Please wait while we redirect you to the Payment Gateway.</div>
|
|
|
465 |
<div align="center" class="img">
|
|
|
466 |
<img title="loading" alt="loading" src="'.$image.'">
|
|
|
467 |
</div>
|
|
|
468 |
</body>
|
|
|
469 |
</html>';
|
| 13350 |
anikendra |
470 |
}elseif(strpos($paymentSubmit->response->redirectUrl, 'ebs-pay') !== false) {
|
| 10582 |
lgm |
471 |
$url = $this->config->item('curl_base_url').$paymentSubmit->response->redirectUrl;
|
|
|
472 |
//echo $url;
|
|
|
473 |
$authorized = $this->session->userdata('authorized');
|
|
|
474 |
if(isset($authorized) && !empty($authorized)){
|
|
|
475 |
$params['userId'] = $authorized['Id'];
|
|
|
476 |
if($authorized['isLoggedIn'] == 1){
|
|
|
477 |
$params['isLoggedIn'] = 'true';
|
|
|
478 |
}
|
|
|
479 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
480 |
$params['isLoggedIn'] = 'false';
|
|
|
481 |
}
|
|
|
482 |
}
|
|
|
483 |
$this->mcurl->add_call('ebs','get',$url,$params);
|
|
|
484 |
$response = $this->mcurl->execute($url);
|
|
|
485 |
$data['response'] = $response['ebs']['response'];
|
|
|
486 |
$response = $this->magento_model->payment_submit($data);
|
| 13350 |
anikendra |
487 |
if(isset($response) && !empty($response)) {
|
| 10582 |
lgm |
488 |
$ebs = $response[0]->response;
|
| 11339 |
lgm |
489 |
$image = './assets/images/loading.gif';
|
| 10582 |
lgm |
490 |
echo '<html>
|
|
|
491 |
<head>
|
| 11301 |
lgm |
492 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 10582 |
lgm |
493 |
<title>m.saholic.com: Redirecting to EBS Payment Page</title>
|
|
|
494 |
</head>
|
|
|
495 |
<body>
|
|
|
496 |
<div style="text-align:center; margin-top:200px;">Please wait while we redirect you to the Payment Gateway.</div>
|
|
|
497 |
<div align="center" class="img">
|
| 10735 |
lgm |
498 |
<img title="loading" alt="loading" src="'.$image.'">
|
| 10582 |
lgm |
499 |
</div>
|
|
|
500 |
<div style="display:none">
|
|
|
501 |
<form method="post" action="'.$ebs->postAction.'" name="frmTransaction" id="frmTransaction">
|
|
|
502 |
<!-- Account Id -->
|
|
|
503 |
<input name="account_id" type="hidden" value="'.$ebs->account_id.'" />
|
|
|
504 |
<!-- Transaction Details -->
|
|
|
505 |
<input name="reference_no" type="hidden" value="'.$ebs->reference_no.'" />
|
|
|
506 |
<input name="amount" type="hidden" value="'.$ebs->amount.'" />
|
|
|
507 |
<input name="description" type="hidden" value="'.$ebs->description.'" />
|
|
|
508 |
<input name="payment_option" type="hidden" value="'.$ebs->payment_option.'"/>
|
|
|
509 |
<!-- Billing Address -->
|
|
|
510 |
<input name="name" type="hidden" value="'.$ebs->name.'" />
|
|
|
511 |
<input name="address" type="hidden" value="'.$ebs->address.'" />
|
|
|
512 |
<input name="city" type="hidden" value="'.$ebs->city.'" />
|
|
|
513 |
<input name="state" type="hidden" value="'.$ebs->state.'" />
|
|
|
514 |
<input name="postal_code" type="hidden" value="'.$ebs->postal_code.'" />
|
| 11413 |
amit.gupta |
515 |
<input name="country" type="hidden" value="'.$ebs->country.'"/>
|
| 10582 |
lgm |
516 |
<input name="email" type="hidden" value="'.$ebs->email.'" />
|
|
|
517 |
<input name="phone" type="hidden" value="'.$ebs->phone.'" />
|
|
|
518 |
<!-- Delivery Address -->
|
|
|
519 |
<input name="ship_name" type="hidden" value="'.$ebs->ship_name.'" />
|
|
|
520 |
<input name="ship_address" type="hidden" value="'.$ebs->ship_address.'" />
|
|
|
521 |
<input name="ship_city" type="hidden" value="'.$ebs->ship_city.'" />
|
|
|
522 |
<input name="ship_state" type="hidden" value="'.$ebs->ship_state.'" />
|
|
|
523 |
<input name="ship_postal_code" type="hidden" value="'.$ebs->ship_postal_code.'" />
|
| 11413 |
amit.gupta |
524 |
<input name="ship_country" type="hidden" value="'.$ebs->ship_country.'"/>
|
| 10582 |
lgm |
525 |
<input name="ship_phone" type="hidden" value="'.$ebs->ship_phone.'" />
|
|
|
526 |
<input name="return_url" type="hidden" value="'.$ebs->return_url.'" />
|
|
|
527 |
<input name="mode" value="'.$ebs->mode.'"/>
|
|
|
528 |
<input name="secure_hash" type="hidden" value="'.$ebs->secure_hash.'" />
|
|
|
529 |
<input name="channel" type="hidden" value="'.$ebs->channel.'" />
|
|
|
530 |
<input name="page_id" type="hidden" value="'.$ebs->page_id.'" />
|
|
|
531 |
</form>
|
|
|
532 |
</div>
|
|
|
533 |
<script type="text/javascript">
|
|
|
534 |
document.getElementById("frmTransaction").submit();
|
|
|
535 |
</script>
|
|
|
536 |
</body>
|
|
|
537 |
</html>';
|
| 13350 |
anikendra |
538 |
}
|
|
|
539 |
else{
|
| 10582 |
lgm |
540 |
redirect(base_url().'payment');
|
|
|
541 |
}
|
|
|
542 |
}
|
| 13350 |
anikendra |
543 |
elseif(strpos($paymentSubmit->response->redirectUrl, 'payu-pay') !== false) {
|
|
|
544 |
$url = $this->config->item('curl_base_url').$paymentSubmit->response->redirectUrl;
|
|
|
545 |
//echo $url;
|
|
|
546 |
$params = array();
|
|
|
547 |
$authorized = $this->session->userdata('authorized');
|
|
|
548 |
if(isset($authorized) && !empty($authorized)){
|
|
|
549 |
$params['userId'] = $authorized['Id'];
|
|
|
550 |
if($authorized['isLoggedIn'] == 1){
|
|
|
551 |
$params['isLoggedIn'] = 'true';
|
|
|
552 |
}
|
|
|
553 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
554 |
$params['isLoggedIn'] = 'false';
|
|
|
555 |
}
|
|
|
556 |
}
|
|
|
557 |
$this->mcurl->add_call('payu','get',$url,$params);
|
|
|
558 |
$response = $this->mcurl->execute($url);
|
|
|
559 |
error_log("payu response".print_r($response,1));
|
|
|
560 |
$data['response'] = $response['payu']['response'];
|
|
|
561 |
$response = $this->magento_model->payment_submit($data);
|
|
|
562 |
if(isset($response) && !empty($response)){
|
|
|
563 |
$payu = $response[0]->response;
|
| 16276 |
amit.gupta |
564 |
$image = '/assets/images/loading.gif';
|
| 13350 |
anikendra |
565 |
// $return_url = base_url().'ebs-pay-processing/?DR={DR}';
|
|
|
566 |
$ci = get_instance();
|
|
|
567 |
}
|
|
|
568 |
?>
|
|
|
569 |
<html>
|
|
|
570 |
<head>
|
|
|
571 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 19411 |
amit.gupta |
572 |
<title>m.saholic.com: Redirecting to PayU Payment Gateway</title>
|
| 13350 |
anikendra |
573 |
</head>
|
|
|
574 |
<body>
|
|
|
575 |
<div style="text-align:center; margin-top:200px;">Please wait while we redirect you to the Payment Gateway.</div>
|
|
|
576 |
<div align="center" class="img">
|
| 16276 |
amit.gupta |
577 |
<img title="loading" alt="loading" src="<?php echo $image;?>">
|
| 13350 |
anikendra |
578 |
</div>
|
|
|
579 |
<div style="display:none;">
|
|
|
580 |
<form action="<?php echo $payu->postActionUrl; ?>" method="post" id="payuForm">
|
|
|
581 |
<input type="hidden" name="key" value="<?php echo $payu->key; ?>" />
|
|
|
582 |
<input type="hidden" name="hash" value="<?php echo $payu->hash ?>"/>
|
|
|
583 |
<input type="hidden" name="txnid" value="<?php echo $payu->txnid ?>" />
|
|
|
584 |
<input name="amount" value="<?php echo $payu->amount; ?>" />
|
|
|
585 |
<input name="firstname" id="firstname" value="<?php echo $payu->firstname;?>" />
|
|
|
586 |
<input name="email" id="email" value="<?php echo $payu->email; ?>" />
|
|
|
587 |
<input name="phone" value="<?php echo $payu->phone; ?>" />
|
|
|
588 |
<input name="productinfo" value="<?php echo $payu->productinfo; ?>" />
|
| 19411 |
amit.gupta |
589 |
<input name="surl" value="<?php echo rtrim(base_url(), "/").$payu->surl; ?>" />
|
|
|
590 |
<input name="furl" value="<?php echo rtrim(base_url(), "/").$payu->furl; ?>" />
|
| 13350 |
anikendra |
591 |
<input name="bankcode" value="<?php echo $payu->bankcode; ?>" />
|
|
|
592 |
<input name="pg" value="<?php echo $payu->pg; ?>" />
|
| 20622 |
amit.gupta |
593 |
<input type="hidden" name="service_provider" value="payu_paisa" />
|
| 19418 |
amit.gupta |
594 |
<input name="curl" value="<?php echo rtrim(base_url(), "/").$payu->curl; ?>" />
|
| 13350 |
anikendra |
595 |
<input type="submit" value="Submit" />
|
|
|
596 |
</form>
|
|
|
597 |
</div>
|
|
|
598 |
<script type="text/javascript">
|
|
|
599 |
document.getElementById("payuForm").submit();
|
|
|
600 |
</script>
|
|
|
601 |
</body>
|
|
|
602 |
</html>
|
|
|
603 |
<?php
|
|
|
604 |
}
|
| 10582 |
lgm |
605 |
else{
|
|
|
606 |
redirect(base_url().$paymentSubmit->response->redirectUrl);
|
|
|
607 |
}
|
| 15792 |
anikendra |
608 |
} else {
|
|
|
609 |
redirect(base_url()."payment");
|
| 10582 |
lgm |
610 |
}
|
| 15792 |
anikendra |
611 |
}
|
| 10582 |
lgm |
612 |
}
|
| 13350 |
anikendra |
613 |
|
| 10582 |
lgm |
614 |
public function ebsprocessing(){
|
|
|
615 |
if(isset($_GET['DR']) && !empty($_GET['DR'])){
|
|
|
616 |
$paymentconfig = $this->config->item('ebsProcessing');
|
|
|
617 |
$authorized = $this->session->userdata('authorized');
|
|
|
618 |
if(isset($authorized) && !empty($authorized)){
|
|
|
619 |
$_GET['userId'] = $authorized['Id'];
|
|
|
620 |
if($authorized['isLoggedIn'] == 1){
|
|
|
621 |
$_GET['isLoggedIn'] = 'true';
|
|
|
622 |
}
|
|
|
623 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
624 |
$_GET['isLoggedIn'] = 'false';
|
|
|
625 |
}
|
|
|
626 |
}
|
|
|
627 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
628 |
if(isset($data['response']['response']['ebs_processing'][0]->response)){
|
|
|
629 |
$redirectUrl = $data['response']['response']['ebs_processing'][0]->response->redirectUrl;
|
|
|
630 |
$redirectUrl = explode('?', $redirectUrl);
|
|
|
631 |
$redirectUrl = base_url().'ebs-pay-response/?'.$redirectUrl[1];
|
| 16276 |
amit.gupta |
632 |
$image = '/assets/images/loading.gif';
|
| 10582 |
lgm |
633 |
echo '<html><head><meta http-equiv="refresh" content="2;url='.$redirectUrl.'">
|
| 11301 |
lgm |
634 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 10582 |
lgm |
635 |
<title>Saholic Mobile Site:</title>
|
|
|
636 |
</head>
|
|
|
637 |
<body>
|
|
|
638 |
<div style="text-align:center; margin-top:200px;">'.$data['response']['response']['ebs_processing'][0]->response->redirectMessage.'</div>
|
|
|
639 |
<div align="center" class="img">
|
| 10735 |
lgm |
640 |
<img title="loading" alt="loading" src="'.$image.'">
|
| 10582 |
lgm |
641 |
</div>
|
|
|
642 |
</body>
|
|
|
643 |
</html>';
|
|
|
644 |
}
|
|
|
645 |
}
|
|
|
646 |
}
|
|
|
647 |
public function ebsresponse(){
|
|
|
648 |
if(isset($_GET['DR']) && !empty($_GET['DR'])){
|
|
|
649 |
$paymentconfig = $this->config->item('ebsResponse');
|
|
|
650 |
$authorized = $this->session->userdata('authorized');
|
|
|
651 |
if(isset($authorized) && !empty($authorized)){
|
|
|
652 |
$_GET['userId'] = $authorized['Id'];
|
|
|
653 |
if($authorized['isLoggedIn'] == 1){
|
|
|
654 |
$_GET['isLoggedIn'] = 'true';
|
|
|
655 |
}
|
|
|
656 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
657 |
$_GET['isLoggedIn'] = 'false';
|
|
|
658 |
}
|
|
|
659 |
}
|
|
|
660 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
661 |
if(isset($data['response']['response']['ebs_response'][0]->response) && !empty($data['response']['response']['ebs_response'][0]->response)){
|
|
|
662 |
$redirectUrl = $data['response']['response']['ebs_response'][0]->response->redirectUrl;
|
| 20255 |
amit.gupta |
663 |
redirect($redirectUrl);
|
| 10582 |
lgm |
664 |
}
|
|
|
665 |
else{
|
|
|
666 |
redirect(base_url().'payment');
|
|
|
667 |
}
|
|
|
668 |
}
|
|
|
669 |
}
|
| 13304 |
anikendra |
670 |
|
|
|
671 |
public function payuresponse(){
|
|
|
672 |
error_log("payu response ".print_r($_REQUEST,1));
|
|
|
673 |
$paymentconfig = $this->config->item('payuResponse');
|
|
|
674 |
$authorized = $this->session->userdata('authorized');
|
|
|
675 |
if(isset($authorized) && !empty($authorized)){
|
|
|
676 |
$_GET['userId'] = $authorized['Id'];
|
|
|
677 |
if($authorized['isLoggedIn'] == 1){
|
|
|
678 |
$_GET['isLoggedIn'] = 'true';
|
|
|
679 |
}
|
|
|
680 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
681 |
$_GET['isLoggedIn'] = 'false';
|
|
|
682 |
}
|
|
|
683 |
}
|
|
|
684 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
685 |
error_log("payu response ".print_r($data['response'],1));
|
|
|
686 |
if(isset($data['response']['response']['payu_response'][0]->response) && !empty($data['response']['response']['payu_response'][0]->response)){
|
|
|
687 |
$redirectUrl = $data['response']['response']['payu_response'][0]->response->redirectUrl;
|
| 20061 |
amit.gupta |
688 |
redirect(rtrim(base_url(), "/").$redirectUrl);
|
| 13304 |
anikendra |
689 |
}
|
|
|
690 |
else{
|
| 19417 |
amit.gupta |
691 |
redirect(rtrim(base_url(), "/").'payment');
|
| 13304 |
anikendra |
692 |
}
|
|
|
693 |
}
|
|
|
694 |
|
| 10582 |
lgm |
695 |
public function hdfcPayResponse(){
|
|
|
696 |
if(isset($_POST)){
|
|
|
697 |
$paymentconfig = $this->config->item('hdfcResponse');
|
|
|
698 |
$authorized = $this->session->userdata('authorized');
|
|
|
699 |
if(isset($authorized) && !empty($authorized)){
|
|
|
700 |
$_POST['userId'] = $authorized['Id'];
|
|
|
701 |
if($authorized['isLoggedIn'] == 1){
|
|
|
702 |
$_POST['isLoggedIn'] = 'true';
|
|
|
703 |
}
|
|
|
704 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
705 |
$_POST['isLoggedIn'] = 'false';
|
|
|
706 |
}
|
|
|
707 |
}
|
|
|
708 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
709 |
if(isset($data['response']['response']['hdfc_response'][0]->response) && !empty($data['response']['response']['hdfc_response'][0]->response)){
|
|
|
710 |
$redirectUrl = $data['response']['response']['hdfc_response'][0]->response->redirectUrl;
|
|
|
711 |
redirect($redirectUrl);
|
|
|
712 |
}
|
|
|
713 |
else{
|
|
|
714 |
redirect(base_url());
|
|
|
715 |
}
|
|
|
716 |
}else{
|
|
|
717 |
redirect(base_url());
|
|
|
718 |
}
|
|
|
719 |
}
|
| 10890 |
lgm |
720 |
public function hdfcEmiResponse(){
|
|
|
721 |
if(isset($_POST)){
|
|
|
722 |
$paymentconfig = $this->config->item('hdfcEmiResponse');
|
|
|
723 |
$authorized = $this->session->userdata('authorized');
|
|
|
724 |
if(isset($authorized) && !empty($authorized)){
|
|
|
725 |
$_POST['userId'] = $authorized['Id'];
|
|
|
726 |
if($authorized['isLoggedIn'] == 1){
|
|
|
727 |
$_POST['isLoggedIn'] = 'true';
|
|
|
728 |
}
|
|
|
729 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
730 |
$_POST['isLoggedIn'] = 'false';
|
|
|
731 |
}
|
|
|
732 |
}
|
|
|
733 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
734 |
if(isset($data['response']['response']['hdfc_emi_response'][0]->response) && !empty($data['response']['response']['hdfc_emi_response'][0]->response)){
|
|
|
735 |
$redirectUrl = $data['response']['response']['hdfc_emi_response'][0]->response->redirectUrl;
|
|
|
736 |
redirect($redirectUrl);
|
|
|
737 |
}
|
|
|
738 |
else{
|
|
|
739 |
redirect(base_url());
|
|
|
740 |
}
|
|
|
741 |
}else{
|
|
|
742 |
redirect(base_url());
|
|
|
743 |
}
|
|
|
744 |
}
|
| 10582 |
lgm |
745 |
public function innovitiPayment(){
|
|
|
746 |
$last = $this->uri->total_segments();
|
|
|
747 |
$itemcode = $this->uri->segment($last);
|
|
|
748 |
if(isset($itemcode) && !empty($itemcode)){
|
|
|
749 |
$url = $this->config->item('curl_base_url').'innoviti-pay/'.$itemcode;
|
|
|
750 |
$params = array();
|
|
|
751 |
$authorized = $this->session->userdata('authorized');
|
|
|
752 |
if(isset($authorized) && !empty($authorized)){
|
|
|
753 |
$params['userId'] = $authorized['Id'];
|
|
|
754 |
if($authorized['isLoggedIn'] == 1){
|
|
|
755 |
$params['isLoggedIn'] = 'true';
|
|
|
756 |
}
|
|
|
757 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
758 |
$params['isLoggedIn'] = 'false';
|
|
|
759 |
}
|
|
|
760 |
$this->mcurl->add_call('innoviti','get',$url,$params);
|
|
|
761 |
$response = $this->mcurl->execute($url);
|
|
|
762 |
$data['response'] = $response['innoviti']['response'];
|
|
|
763 |
$response = $this->magento_model->payment_submit($data);
|
|
|
764 |
if(isset($response) && !empty($response)){
|
|
|
765 |
$innoviti = $response[0]->response;
|
| 11339 |
lgm |
766 |
$image = './assets/images/loading.gif';
|
| 11301 |
lgm |
767 |
echo '<html>
|
|
|
768 |
<head>
|
|
|
769 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
770 |
<title>m.saholic.com: Redirecting to Innoviti Payment Page</title>
|
|
|
771 |
</head>
|
|
|
772 |
<body>
|
|
|
773 |
<div style="text-align:center; margin-top:200px;">Please wait while we redirect you to the Payment Gateway.</div>
|
|
|
774 |
<div align="center" class="img">
|
|
|
775 |
<img title="loading" alt="loading" src="'.$image.'">
|
|
|
776 |
</div>
|
|
|
777 |
<div style="display:none">
|
|
|
778 |
<form method="post" action="'.$innoviti->action.'" name="frmTransaction" id="frmTransaction">
|
|
|
779 |
<input name="merchantId" type="hidden" value="'.$innoviti->merchantId.'" />
|
|
|
780 |
<input name="subMerchantId" type="hidden" value="'.$innoviti->subMerchantId.'" />
|
|
|
781 |
<!-- Transaction Details -->
|
|
|
782 |
<input name="orderId" type="hidden" value="'.$innoviti->orderId.'" />
|
|
|
783 |
<input name="amt" type="hidden" value="'.$innoviti->amt.'" />
|
|
|
784 |
<input name="cur" type="hidden" value="INR" />
|
|
|
785 |
<input name="processingCode" type="hidden" value="'.$innoviti->processingCode.'" />
|
|
|
786 |
<input name="proSku" type="hidden" value="'.$innoviti->proSku.'" />
|
|
|
787 |
<input name="Cname" type="hidden" value="'.$innoviti->Cname.'" /></td>
|
|
|
788 |
<input name="mobile" type="hidden" value="'.$innoviti->mobile.'" />
|
|
|
789 |
<input name="emailId" type="hidden" value="'.$innoviti->emailId.'" />
|
|
|
790 |
<input name="redirUrl" type="hidden" value="'.$innoviti->redirUrl.'" />
|
|
|
791 |
<input name="chksum" type="hidden" value="'.$innoviti->chksum.'" />
|
|
|
792 |
<input name="isCtx" type="hidden" value="NO" />
|
|
|
793 |
<input name="submitted" value="Submit" type="submit" />
|
|
|
794 |
</form>
|
|
|
795 |
</div><script type="text/javascript">
|
| 10582 |
lgm |
796 |
document.getElementById("frmTransaction").submit();
|
| 11301 |
lgm |
797 |
</script></body></html>';
|
| 10582 |
lgm |
798 |
}
|
|
|
799 |
}else{
|
|
|
800 |
redirect(base_url());
|
|
|
801 |
}
|
|
|
802 |
|
|
|
803 |
}else{
|
|
|
804 |
redirect(base_url());
|
|
|
805 |
}
|
|
|
806 |
}
|
|
|
807 |
public function innovitiResponse(){
|
|
|
808 |
if(isset($_POST)){
|
|
|
809 |
$paymentconfig = $this->config->item('innovitiResponse');
|
|
|
810 |
$authorized = $this->session->userdata('authorized');
|
|
|
811 |
if(isset($authorized) && !empty($authorized)){
|
|
|
812 |
$_POST['userId'] = $authorized['Id'];
|
|
|
813 |
if($authorized['isLoggedIn'] == 1){
|
|
|
814 |
$_POST['isLoggedIn'] = 'true';
|
|
|
815 |
}
|
|
|
816 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
817 |
$_POST['isLoggedIn'] = 'false';
|
|
|
818 |
}
|
|
|
819 |
}
|
|
|
820 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
821 |
if(isset($data['response']['response']['innoviti_response'][0]->response) && !empty($data['response']['response']['innoviti_response'][0]->response)){
|
|
|
822 |
$redirectUrl = $data['response']['response']['innoviti_response'][0]->response->redirectUrl;
|
|
|
823 |
redirect($redirectUrl);
|
|
|
824 |
}
|
|
|
825 |
else{
|
|
|
826 |
redirect(base_url());
|
|
|
827 |
}
|
|
|
828 |
}else{
|
|
|
829 |
redirect(base_url());
|
|
|
830 |
}
|
|
|
831 |
}
|
|
|
832 |
public function paymenterror(){
|
|
|
833 |
$authorized = $this->session->userdata('authorized');
|
|
|
834 |
if(isset($authorized) && !empty($authorized)){
|
|
|
835 |
$data = array();
|
|
|
836 |
$paymentconfig = $this->config->item('paymenterror');
|
| 10634 |
lgm |
837 |
$this->lessphp->object()->ccompile('assets/css/shipping.less','assets/css/shipping.css');
|
| 10582 |
lgm |
838 |
$data['stylesheet'] = 'shipping.css';
|
|
|
839 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
840 |
$this->layout->view('checkout/checkout_view',$data);
|
|
|
841 |
}else{
|
|
|
842 |
redirect(base_url());
|
|
|
843 |
}
|
|
|
844 |
}
|
|
|
845 |
public function shipping()
|
|
|
846 |
{
|
|
|
847 |
|
|
|
848 |
$data = array();
|
|
|
849 |
$authorized = $this->session->userdata('authorized');
|
|
|
850 |
if($authorized['isLoggedIn'] != 1){
|
|
|
851 |
$this->session->set_userdata('location','shipping');
|
|
|
852 |
redirect(base_url()."login");
|
|
|
853 |
}
|
|
|
854 |
$shippingconfig = $this->config->item('shipping');
|
|
|
855 |
if(!isset($_POST['submit']))
|
|
|
856 |
{
|
|
|
857 |
$authorized = $this->session->userdata('authorized');
|
|
|
858 |
if(isset($authorized) && !empty($authorized)){
|
|
|
859 |
$_GET['userId'] = $authorized['Id'];
|
|
|
860 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
861 |
if($authorized['isLoggedIn'] == 1){
|
|
|
862 |
$_GET['isLoggedIn'] = 'true';
|
|
|
863 |
}
|
|
|
864 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
865 |
$_GET['isLoggedIn'] = 'false';
|
|
|
866 |
}
|
|
|
867 |
}
|
|
|
868 |
$this->lessphp->object()->ccompile('assets/css/shipping.less','assets/css/shipping.css');
|
|
|
869 |
$data['stylesheet'] = 'shipping.css';
|
| 11012 |
lgm |
870 |
$data['title'] = 'Saholic';
|
| 10582 |
lgm |
871 |
$cache = getFileCache('pickup');
|
|
|
872 |
if(isset($cache) && !empty($cache)){
|
|
|
873 |
unset($shippingconfig['response'][1]);
|
|
|
874 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
|
|
|
875 |
$data['response']['response']['pickup'] = $cache;
|
|
|
876 |
}else{
|
|
|
877 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
|
|
|
878 |
if(isset($data['response']['response']['pickup']) && !empty($data['response']['response']['pickup']))
|
|
|
879 |
setFileCache($data['response']['response']['pickup'], 'pickup',900);
|
|
|
880 |
}
|
| 10758 |
lgm |
881 |
$carts = $data['response']['response']['carts'][0];
|
| 10757 |
lgm |
882 |
$shipping = $data['response']['response']['shipping_process'][0];
|
|
|
883 |
if((isset($carts) && !empty($carts)) && (isset($shipping) && !empty($shipping))){
|
| 10752 |
lgm |
884 |
$this->layout->view('checkout/checkout_view',$data);
|
|
|
885 |
}else{
|
|
|
886 |
redirect(base_url()."cart");
|
|
|
887 |
}
|
| 10582 |
lgm |
888 |
}
|
|
|
889 |
if(isset($_POST['submit']))
|
|
|
890 |
{
|
|
|
891 |
unset($shippingconfig['response'][1]);
|
|
|
892 |
$data = $this->get_shipping_billing($_POST);
|
|
|
893 |
$this->session->set_userdata($data);
|
|
|
894 |
$authorized = $this->session->userdata('authorized');
|
|
|
895 |
if(isset($authorized) && !empty($authorized)){
|
|
|
896 |
$_POST['userId'] = $authorized['Id'];
|
| 11530 |
lgm |
897 |
$_POST['Id'] = $authorized['cartId'];
|
| 10582 |
lgm |
898 |
if($authorized['isLoggedIn'] == 1){
|
|
|
899 |
$_POST['isLoggedIn'] = 'true';
|
|
|
900 |
}
|
|
|
901 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
902 |
$_POST['isLoggedIn'] = 'false';
|
|
|
903 |
}
|
|
|
904 |
}
|
|
|
905 |
//$data['stylesheet'] = 'shipping.less';
|
|
|
906 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
|
|
|
907 |
//$this->layout->view('checkout/checkout_view',$data);
|
|
|
908 |
redirect(base_url()."shipping");
|
|
|
909 |
|
|
|
910 |
}
|
|
|
911 |
|
|
|
912 |
}
|
|
|
913 |
|
|
|
914 |
public function get_shipping_billing($data=array()){
|
|
|
915 |
$billing =array();
|
|
|
916 |
$shipping =array();
|
|
|
917 |
if (isset($data) && !empty($data)) {
|
|
|
918 |
$shipping=array('name' => $data['name'],'line1' => $data['line1'],'line2' => $data['line2'], 'city' => $data['city'], 'pin' => $data['pin'], 'phonenumber' => $data['phone']);
|
|
|
919 |
return array('shipping'=>$shipping,'billing'=>$billing);
|
|
|
920 |
}
|
|
|
921 |
}
|
|
|
922 |
|
|
|
923 |
public function delete($addressId){
|
|
|
924 |
$shippingconfig = $this->config->item('shipping_delete');
|
|
|
925 |
$_GET['addressId'] = $addressId;
|
|
|
926 |
$authorized = $this->session->userdata('authorized');
|
|
|
927 |
if(isset($authorized) && !empty($authorized)){
|
|
|
928 |
$_GET['userId'] = $authorized['Id'];
|
|
|
929 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
930 |
if($authorized['isLoggedIn'] == 1){
|
|
|
931 |
$_GET['isLoggedIn'] = 'true';
|
|
|
932 |
}
|
|
|
933 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
934 |
$_GET['isLoggedIn'] = 'false';
|
|
|
935 |
}
|
|
|
936 |
}
|
|
|
937 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
|
|
|
938 |
print_r($data['response']);
|
|
|
939 |
}
|
|
|
940 |
|
|
|
941 |
public function changeAddress($addressId,$type){
|
|
|
942 |
if(isset($addressId) && isset($type)){
|
|
|
943 |
$shippingconfig = $this->config->item('shipping_change');
|
|
|
944 |
$_GET['addressId'] = $addressId;
|
|
|
945 |
$_GET['addressType'] = $type;
|
|
|
946 |
$authorized = $this->session->userdata('authorized');
|
|
|
947 |
if(isset($authorized) && !empty($authorized)){
|
|
|
948 |
$_GET['userId'] = $authorized['Id'];
|
|
|
949 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
950 |
if($authorized['isLoggedIn'] == 1){
|
|
|
951 |
$_GET['isLoggedIn'] = 'true';
|
|
|
952 |
}
|
|
|
953 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
954 |
$_GET['isLoggedIn'] = 'false';
|
|
|
955 |
}
|
|
|
956 |
}
|
|
|
957 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
|
|
|
958 |
$this->session->set_userdata('addressId',$addressId);
|
| 10788 |
lgm |
959 |
echo json_encode($data['response']['response']['changeAddress'][0]);
|
| 10582 |
lgm |
960 |
}
|
|
|
961 |
}
|
|
|
962 |
public function changeCaptcha(){
|
|
|
963 |
$captchaDisplay = $this->session->userdata('captchaDisplay');
|
|
|
964 |
//if(isset($captchaDisplay) && $captchaDisplay == 1){
|
|
|
965 |
$captcha = $this->captcha_model->generateCaptcha();
|
|
|
966 |
$this->session->set_userdata('captcha',$captcha['word']);
|
|
|
967 |
unset($captcha['word']);
|
|
|
968 |
unset($captcha['time']);
|
|
|
969 |
unset($captcha['name']);
|
|
|
970 |
echo json_encode($captcha);
|
|
|
971 |
//}
|
|
|
972 |
}
|
|
|
973 |
public function insuranceInfo($bday,$gname,$addressId){
|
|
|
974 |
if((isset($bday) && !empty($bday)) && (isset($gname) && !empty($gname)) && (isset($addressId) && !empty($addressId))){
|
|
|
975 |
if(isset($gname) && !empty($gname)){
|
| 10840 |
lgm |
976 |
$gname = str_replace('-',' ',$gname);
|
| 10582 |
lgm |
977 |
$gname = ltrim($gname);
|
|
|
978 |
$gname = rtrim($gname);
|
|
|
979 |
$_GET['guardianName'] = $gname;
|
|
|
980 |
}
|
|
|
981 |
if(isset($bday) && !empty($bday)){
|
|
|
982 |
$dob = explode('-',$bday);
|
| 10840 |
lgm |
983 |
//$dob = array_reverse($dob);
|
| 10582 |
lgm |
984 |
$temp1 = $dob[1];
|
|
|
985 |
$temp2 = $dob[0];
|
|
|
986 |
$dob[0] = $temp1;
|
|
|
987 |
$dob[1] = $temp2;
|
| 10840 |
lgm |
988 |
|
| 10582 |
lgm |
989 |
$dob = implode('/', $dob);
|
|
|
990 |
$_GET['dob'] = $dob;
|
| 10840 |
lgm |
991 |
}
|
| 10582 |
lgm |
992 |
$insuranceconfig = $this->config->item('insurance_info');
|
|
|
993 |
$_GET['addressId'] = $addressId;
|
|
|
994 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$insuranceconfig);
|
|
|
995 |
if(isset($data['response']['response']['insuranceInfo'][0]->response) && (!empty($data['response']['response']['insuranceInfo'][0]->response))) {
|
|
|
996 |
echo json_encode($data['response']['response']['insuranceInfo'][0]);
|
|
|
997 |
}
|
|
|
998 |
}
|
|
|
999 |
}
|
|
|
1000 |
public function pickupSpot($id){
|
|
|
1001 |
if(isset($id) && !empty($id) && is_numeric($id)){
|
|
|
1002 |
$this->session->set_userdata('hotspotId',$id);
|
|
|
1003 |
$response['msg'] = 'sucess';
|
|
|
1004 |
echo json_encode($response);
|
|
|
1005 |
}
|
|
|
1006 |
}
|
|
|
1007 |
|
|
|
1008 |
}
|
|
|
1009 |
|
| 10611 |
amit.gupta |
1010 |
|
| 10582 |
lgm |
1011 |
/* End of file welcome.php */
|
| 13350 |
anikendra |
1012 |
/* Location: ./application/controllers/welcome.php */
|