| 12694 |
anikendra |
1 |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
2 |
|
|
|
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');
|
|
|
12 |
// if(!isset($admin) || empty($admin)) {
|
|
|
13 |
// redirect(base_url().'authorize');
|
|
|
14 |
// }
|
|
|
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");
|
|
|
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 , "/")).'/';
|
|
|
25 |
//print_r($this->session->userdata);
|
|
|
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 |
}
|
|
|
58 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
59 |
$_GET['isLoggedIn'] = 'false';
|
|
|
60 |
}
|
|
|
61 |
$newValues = $authorized;
|
|
|
62 |
$newValues['totalItems'] = 0;
|
|
|
63 |
$this->session->set_userdata('authorized',$newValues);
|
|
|
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');
|
|
|
72 |
$this->session->unset_userdata('hotspotId');
|
|
|
73 |
$this->session->unset_userdata('addressId');
|
|
|
74 |
$this->layout->view('checkout/checkout_view',$data);
|
|
|
75 |
}
|
|
|
76 |
public function payment()
|
|
|
77 |
{
|
|
|
78 |
//standard array
|
|
|
79 |
//print_r($this->session->all_userdata())
|
|
|
80 |
$authorized = $this->session->userdata('authorized');
|
|
|
81 |
if(!isset($authorized) || empty($authorized)){
|
|
|
82 |
redirect(base_url()."cart");
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
$data = array();
|
|
|
86 |
$codCaptcha = $this->session->userdata('cod');
|
|
|
87 |
if(isset($codCaptcha) && $codCaptcha == 1){
|
|
|
88 |
$data['codCaptcha'] = 1;
|
|
|
89 |
$this->session->unset_userdata('cod');
|
|
|
90 |
}else{
|
|
|
91 |
$data['codCaptcha'] = 0;
|
|
|
92 |
}
|
|
|
93 |
$paymentconfig = $this->config->item('payment');
|
|
|
94 |
if(!isset($_POST['submit'])){
|
|
|
95 |
$hotspot = $this->session->userdata('hotspotId');
|
|
|
96 |
if(isset($hotspot) && !empty($hotspot)){
|
|
|
97 |
$_GET['hotSpotAddressId'] = $hotspot;
|
|
|
98 |
$_GET['deliveryLocation'] = 'hotSpot';
|
|
|
99 |
}else{
|
|
|
100 |
$_GET['deliveryLocation'] = 'myLocation';
|
|
|
101 |
}
|
|
|
102 |
unset($paymentconfig['response'][2]);
|
|
|
103 |
if(isset($authorized) && !empty($authorized)){
|
|
|
104 |
$_GET['userId'] = $authorized['Id'];
|
|
|
105 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
106 |
if($authorized['isLoggedIn'] == 1){
|
|
|
107 |
$_GET['isLoggedIn'] = 'true';
|
|
|
108 |
}
|
|
|
109 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
110 |
$_GET['isLoggedIn'] = 'false';
|
|
|
111 |
}
|
|
|
112 |
}
|
|
|
113 |
$addressId = $this->session->userdata('addressId');
|
|
|
114 |
$_GET['addressid'] = $addressId;
|
|
|
115 |
$this->lessphp->object()->ccompile('assets/css/shipping.less','assets/css/shipping.css');
|
|
|
116 |
$data['stylesheet'] = 'shipping.css';
|
|
|
117 |
$data['title'] = 'Saholic';
|
|
|
118 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),'',$paymentconfig);
|
|
|
119 |
if(isset($data['response']['response']['payment_process'])){
|
|
|
120 |
$result = json_decode($data['response']['response']['payment_process'][0]);
|
|
|
121 |
$totalAmount = $result->results->totalAmount;
|
|
|
122 |
if(isset($result->results->isTotalAmountZero)){
|
|
|
123 |
$isTotalAmountZero = $result->results->isTotalAmountZero;
|
|
|
124 |
}
|
|
|
125 |
$totalAmount = number_format((float)$totalAmount,0,'.','');
|
|
|
126 |
$captcha = $this->captcha_model->generateCaptcha();
|
|
|
127 |
$this->session->set_userdata('captcha',$captcha['word']);
|
|
|
128 |
$data['captcha'] = $captcha;
|
|
|
129 |
// if($totalAmount == 0 && isset($isTotalAmountZero) && $isTotalAmountZero == 1){
|
|
|
130 |
// $captcha = $this->captcha_model->generateCaptcha();
|
|
|
131 |
// $this->session->set_userdata('captcha',$captcha['word']);
|
|
|
132 |
// $this->session->set_userdata('captchaDisplay',$isTotalAmountZero);
|
|
|
133 |
// $data['captcha'] = $captcha;
|
|
|
134 |
// }
|
|
|
135 |
$this->layout->view('checkout/checkout_view',$data);
|
|
|
136 |
}
|
|
|
137 |
else{
|
|
|
138 |
redirect(base_url()."cart");
|
|
|
139 |
}
|
|
|
140 |
}
|
|
|
141 |
elseif(isset($_POST['submit'])){
|
|
|
142 |
if(isset($_POST['captcha_response_field']) && !empty($_POST['captcha_response_field'])){
|
|
|
143 |
$captcha = $this->session->userdata('captcha');
|
|
|
144 |
if(strcmp($captcha,$_POST['captcha_response_field']) != 0){
|
|
|
145 |
if(isset($_POST['payoption']) && ($_POST['payoption'] == 3000) || $_POST['payoption'] == 3001) {
|
|
|
146 |
$this->session->set_userdata('cod',1);
|
|
|
147 |
}
|
|
|
148 |
redirect(base_url().'payment');
|
|
|
149 |
}
|
|
|
150 |
}
|
|
|
151 |
unset($paymentconfig['response'][0]);
|
|
|
152 |
unset($paymentconfig['response'][1]);
|
|
|
153 |
if(isset($authorized) && !empty($authorized)){
|
|
|
154 |
$_POST['userId'] = $authorized['Id'];
|
|
|
155 |
if($authorized['isLoggedIn'] == 1){
|
|
|
156 |
$_POST['isLoggedIn'] = 'true';
|
|
|
157 |
}
|
|
|
158 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
159 |
$_POST['isLoggedIn'] = 'false';
|
|
|
160 |
}
|
|
|
161 |
}
|
|
|
162 |
$addressId = $this->session->userdata('addressId');
|
|
|
163 |
$_POST['addressid'] = $addressId;
|
|
|
164 |
$_POST['payment_option'] = $_POST['payoption'];
|
|
|
165 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
166 |
if(isset($data['response']['response']['payment_submit'][0]) && !empty($data['response']['response']['payment_submit'][0])){
|
|
|
167 |
$paymentSubmit = $data['response']['response']['payment_submit'][0];
|
|
|
168 |
if(isset($paymentSubmit->response->isPaymentRedirect) && $paymentSubmit->response->isPaymentRedirect == 1){
|
|
|
169 |
$image = './assets/images/loading.gif';
|
|
|
170 |
$location = $paymentSubmit->response->redirectUrl;
|
|
|
171 |
echo '<html><head><meta http-equiv="refresh" content="1;url='.$paymentSubmit->response->redirectUrl.'">
|
|
|
172 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
173 |
<title>Saholic Mobile Site: Redirecting to <'.$paymentSubmit->response->gatewayName.'> Payment Gateway</title>
|
|
|
174 |
</head>
|
|
|
175 |
<body>
|
|
|
176 |
<div style="text-align:center; margin-top:200px;">Please wait while we redirect you to the Payment Gateway.</div>
|
|
|
177 |
<div align="center" class="img">
|
|
|
178 |
<img title="loading" alt="loading" src="'.$image.'">
|
|
|
179 |
</div>
|
|
|
180 |
</body>
|
|
|
181 |
</html>';
|
|
|
182 |
}elseif(strpos($paymentSubmit->response->redirectUrl, 'ebs-pay') !== false){
|
|
|
183 |
$url = $this->config->item('curl_base_url').$paymentSubmit->response->redirectUrl;
|
|
|
184 |
//echo $url;
|
|
|
185 |
$authorized = $this->session->userdata('authorized');
|
|
|
186 |
if(isset($authorized) && !empty($authorized)){
|
|
|
187 |
$params['userId'] = $authorized['Id'];
|
|
|
188 |
if($authorized['isLoggedIn'] == 1){
|
|
|
189 |
$params['isLoggedIn'] = 'true';
|
|
|
190 |
}
|
|
|
191 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
192 |
$params['isLoggedIn'] = 'false';
|
|
|
193 |
}
|
|
|
194 |
}
|
|
|
195 |
$this->mcurl->add_call('ebs','get',$url,$params);
|
|
|
196 |
$response = $this->mcurl->execute($url);
|
|
|
197 |
$data['response'] = $response['ebs']['response'];
|
|
|
198 |
$response = $this->magento_model->payment_submit($data);
|
|
|
199 |
if(isset($response) && !empty($response)){
|
|
|
200 |
$ebs = $response[0]->response;
|
|
|
201 |
$image = './assets/images/loading.gif';
|
|
|
202 |
echo '<html>
|
|
|
203 |
<head>
|
|
|
204 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
205 |
<title>m.saholic.com: Redirecting to EBS Payment Page</title>
|
|
|
206 |
</head>
|
|
|
207 |
<body>
|
|
|
208 |
<div style="text-align:center; margin-top:200px;">Please wait while we redirect you to the Payment Gateway.</div>
|
|
|
209 |
<div align="center" class="img">
|
|
|
210 |
<img title="loading" alt="loading" src="'.$image.'">
|
|
|
211 |
</div>
|
|
|
212 |
<div style="display:none">
|
|
|
213 |
<form method="post" action="'.$ebs->postAction.'" name="frmTransaction" id="frmTransaction">
|
|
|
214 |
<!-- Account Id -->
|
|
|
215 |
<input name="account_id" type="hidden" value="'.$ebs->account_id.'" />
|
|
|
216 |
<!-- Transaction Details -->
|
|
|
217 |
<input name="reference_no" type="hidden" value="'.$ebs->reference_no.'" />
|
|
|
218 |
<input name="amount" type="hidden" value="'.$ebs->amount.'" />
|
|
|
219 |
<input name="description" type="hidden" value="'.$ebs->description.'" />
|
|
|
220 |
<input name="payment_option" type="hidden" value="'.$ebs->payment_option.'"/>
|
|
|
221 |
<!-- Billing Address -->
|
|
|
222 |
<input name="name" type="hidden" value="'.$ebs->name.'" />
|
|
|
223 |
<input name="address" type="hidden" value="'.$ebs->address.'" />
|
|
|
224 |
<input name="city" type="hidden" value="'.$ebs->city.'" />
|
|
|
225 |
<input name="state" type="hidden" value="'.$ebs->state.'" />
|
|
|
226 |
<input name="postal_code" type="hidden" value="'.$ebs->postal_code.'" />
|
|
|
227 |
<input name="country" type="hidden" value="'.$ebs->country.'"/>
|
|
|
228 |
<input name="email" type="hidden" value="'.$ebs->email.'" />
|
|
|
229 |
<input name="phone" type="hidden" value="'.$ebs->phone.'" />
|
|
|
230 |
<!-- Delivery Address -->
|
|
|
231 |
<input name="ship_name" type="hidden" value="'.$ebs->ship_name.'" />
|
|
|
232 |
<input name="ship_address" type="hidden" value="'.$ebs->ship_address.'" />
|
|
|
233 |
<input name="ship_city" type="hidden" value="'.$ebs->ship_city.'" />
|
|
|
234 |
<input name="ship_state" type="hidden" value="'.$ebs->ship_state.'" />
|
|
|
235 |
<input name="ship_postal_code" type="hidden" value="'.$ebs->ship_postal_code.'" />
|
|
|
236 |
<input name="ship_country" type="hidden" value="'.$ebs->ship_country.'"/>
|
|
|
237 |
<input name="ship_phone" type="hidden" value="'.$ebs->ship_phone.'" />
|
|
|
238 |
<input name="return_url" type="hidden" value="'.$ebs->return_url.'" />
|
|
|
239 |
<input name="mode" value="'.$ebs->mode.'"/>
|
|
|
240 |
<input name="secure_hash" type="hidden" value="'.$ebs->secure_hash.'" />
|
|
|
241 |
<input name="channel" type="hidden" value="'.$ebs->channel.'" />
|
|
|
242 |
<input name="page_id" type="hidden" value="'.$ebs->page_id.'" />
|
|
|
243 |
</form>
|
|
|
244 |
</div>
|
|
|
245 |
<script type="text/javascript">
|
|
|
246 |
document.getElementById("frmTransaction").submit();
|
|
|
247 |
</script>
|
|
|
248 |
</body>
|
|
|
249 |
</html>';
|
|
|
250 |
}else{
|
|
|
251 |
redirect(base_url().'payment');
|
|
|
252 |
}
|
|
|
253 |
}
|
|
|
254 |
else{
|
|
|
255 |
redirect(base_url().$paymentSubmit->response->redirectUrl);
|
|
|
256 |
}
|
|
|
257 |
}
|
|
|
258 |
else{
|
|
|
259 |
redirect(base_url()."payment");
|
|
|
260 |
}
|
|
|
261 |
}
|
|
|
262 |
|
|
|
263 |
}
|
|
|
264 |
public function ebsprocessing(){
|
|
|
265 |
if(isset($_GET['DR']) && !empty($_GET['DR'])){
|
|
|
266 |
$paymentconfig = $this->config->item('ebsProcessing');
|
|
|
267 |
$authorized = $this->session->userdata('authorized');
|
|
|
268 |
if(isset($authorized) && !empty($authorized)){
|
|
|
269 |
$_GET['userId'] = $authorized['Id'];
|
|
|
270 |
if($authorized['isLoggedIn'] == 1){
|
|
|
271 |
$_GET['isLoggedIn'] = 'true';
|
|
|
272 |
}
|
|
|
273 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
274 |
$_GET['isLoggedIn'] = 'false';
|
|
|
275 |
}
|
|
|
276 |
}
|
|
|
277 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
278 |
if(isset($data['response']['response']['ebs_processing'][0]->response)){
|
|
|
279 |
$redirectUrl = $data['response']['response']['ebs_processing'][0]->response->redirectUrl;
|
|
|
280 |
$redirectUrl = explode('?', $redirectUrl);
|
|
|
281 |
$redirectUrl = base_url().'ebs-pay-response/?'.$redirectUrl[1];
|
|
|
282 |
$image = './assets/images/loading.gif';
|
|
|
283 |
echo '<html><head><meta http-equiv="refresh" content="2;url='.$redirectUrl.'">
|
|
|
284 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
285 |
<title>Saholic Mobile Site:</title>
|
|
|
286 |
</head>
|
|
|
287 |
<body>
|
|
|
288 |
<div style="text-align:center; margin-top:200px;">'.$data['response']['response']['ebs_processing'][0]->response->redirectMessage.'</div>
|
|
|
289 |
<div align="center" class="img">
|
|
|
290 |
<img title="loading" alt="loading" src="'.$image.'">
|
|
|
291 |
</div>
|
|
|
292 |
</body>
|
|
|
293 |
</html>';
|
|
|
294 |
}
|
|
|
295 |
}
|
|
|
296 |
}
|
|
|
297 |
public function ebsresponse(){
|
|
|
298 |
if(isset($_GET['DR']) && !empty($_GET['DR'])){
|
|
|
299 |
$paymentconfig = $this->config->item('ebsResponse');
|
|
|
300 |
$authorized = $this->session->userdata('authorized');
|
|
|
301 |
if(isset($authorized) && !empty($authorized)){
|
|
|
302 |
$_GET['userId'] = $authorized['Id'];
|
|
|
303 |
if($authorized['isLoggedIn'] == 1){
|
|
|
304 |
$_GET['isLoggedIn'] = 'true';
|
|
|
305 |
}
|
|
|
306 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
307 |
$_GET['isLoggedIn'] = 'false';
|
|
|
308 |
}
|
|
|
309 |
}
|
|
|
310 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
311 |
if(isset($data['response']['response']['ebs_response'][0]->response) && !empty($data['response']['response']['ebs_response'][0]->response)){
|
|
|
312 |
$redirectUrl = $data['response']['response']['ebs_response'][0]->response->redirectUrl;
|
|
|
313 |
redirect($redirectUrl);
|
|
|
314 |
}
|
|
|
315 |
else{
|
|
|
316 |
redirect(base_url().'payment');
|
|
|
317 |
}
|
|
|
318 |
}
|
|
|
319 |
}
|
|
|
320 |
public function hdfcPayResponse(){
|
|
|
321 |
if(isset($_POST)){
|
|
|
322 |
$paymentconfig = $this->config->item('hdfcResponse');
|
|
|
323 |
$authorized = $this->session->userdata('authorized');
|
|
|
324 |
if(isset($authorized) && !empty($authorized)){
|
|
|
325 |
$_POST['userId'] = $authorized['Id'];
|
|
|
326 |
if($authorized['isLoggedIn'] == 1){
|
|
|
327 |
$_POST['isLoggedIn'] = 'true';
|
|
|
328 |
}
|
|
|
329 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
330 |
$_POST['isLoggedIn'] = 'false';
|
|
|
331 |
}
|
|
|
332 |
}
|
|
|
333 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
334 |
if(isset($data['response']['response']['hdfc_response'][0]->response) && !empty($data['response']['response']['hdfc_response'][0]->response)){
|
|
|
335 |
$redirectUrl = $data['response']['response']['hdfc_response'][0]->response->redirectUrl;
|
|
|
336 |
redirect($redirectUrl);
|
|
|
337 |
}
|
|
|
338 |
else{
|
|
|
339 |
redirect(base_url());
|
|
|
340 |
}
|
|
|
341 |
}else{
|
|
|
342 |
redirect(base_url());
|
|
|
343 |
}
|
|
|
344 |
}
|
|
|
345 |
public function hdfcEmiResponse(){
|
|
|
346 |
if(isset($_POST)){
|
|
|
347 |
$paymentconfig = $this->config->item('hdfcEmiResponse');
|
|
|
348 |
$authorized = $this->session->userdata('authorized');
|
|
|
349 |
if(isset($authorized) && !empty($authorized)){
|
|
|
350 |
$_POST['userId'] = $authorized['Id'];
|
|
|
351 |
if($authorized['isLoggedIn'] == 1){
|
|
|
352 |
$_POST['isLoggedIn'] = 'true';
|
|
|
353 |
}
|
|
|
354 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
355 |
$_POST['isLoggedIn'] = 'false';
|
|
|
356 |
}
|
|
|
357 |
}
|
|
|
358 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
359 |
if(isset($data['response']['response']['hdfc_emi_response'][0]->response) && !empty($data['response']['response']['hdfc_emi_response'][0]->response)){
|
|
|
360 |
$redirectUrl = $data['response']['response']['hdfc_emi_response'][0]->response->redirectUrl;
|
|
|
361 |
redirect($redirectUrl);
|
|
|
362 |
}
|
|
|
363 |
else{
|
|
|
364 |
redirect(base_url());
|
|
|
365 |
}
|
|
|
366 |
}else{
|
|
|
367 |
redirect(base_url());
|
|
|
368 |
}
|
|
|
369 |
}
|
|
|
370 |
public function innovitiPayment(){
|
|
|
371 |
$last = $this->uri->total_segments();
|
|
|
372 |
$itemcode = $this->uri->segment($last);
|
|
|
373 |
if(isset($itemcode) && !empty($itemcode)){
|
|
|
374 |
$url = $this->config->item('curl_base_url').'innoviti-pay/'.$itemcode;
|
|
|
375 |
$params = array();
|
|
|
376 |
$authorized = $this->session->userdata('authorized');
|
|
|
377 |
if(isset($authorized) && !empty($authorized)){
|
|
|
378 |
$params['userId'] = $authorized['Id'];
|
|
|
379 |
if($authorized['isLoggedIn'] == 1){
|
|
|
380 |
$params['isLoggedIn'] = 'true';
|
|
|
381 |
}
|
|
|
382 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
383 |
$params['isLoggedIn'] = 'false';
|
|
|
384 |
}
|
|
|
385 |
$this->mcurl->add_call('innoviti','get',$url,$params);
|
|
|
386 |
$response = $this->mcurl->execute($url);
|
|
|
387 |
$data['response'] = $response['innoviti']['response'];
|
|
|
388 |
$response = $this->magento_model->payment_submit($data);
|
|
|
389 |
if(isset($response) && !empty($response)){
|
|
|
390 |
$innoviti = $response[0]->response;
|
|
|
391 |
$image = './assets/images/loading.gif';
|
|
|
392 |
echo '<html>
|
|
|
393 |
<head>
|
|
|
394 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
|
395 |
<title>m.saholic.com: Redirecting to Innoviti Payment Page</title>
|
|
|
396 |
</head>
|
|
|
397 |
<body>
|
|
|
398 |
<div style="text-align:center; margin-top:200px;">Please wait while we redirect you to the Payment Gateway.</div>
|
|
|
399 |
<div align="center" class="img">
|
|
|
400 |
<img title="loading" alt="loading" src="'.$image.'">
|
|
|
401 |
</div>
|
|
|
402 |
<div style="display:none">
|
|
|
403 |
<form method="post" action="'.$innoviti->action.'" name="frmTransaction" id="frmTransaction">
|
|
|
404 |
<input name="merchantId" type="hidden" value="'.$innoviti->merchantId.'" />
|
|
|
405 |
<input name="subMerchantId" type="hidden" value="'.$innoviti->subMerchantId.'" />
|
|
|
406 |
<!-- Transaction Details -->
|
|
|
407 |
<input name="orderId" type="hidden" value="'.$innoviti->orderId.'" />
|
|
|
408 |
<input name="amt" type="hidden" value="'.$innoviti->amt.'" />
|
|
|
409 |
<input name="cur" type="hidden" value="INR" />
|
|
|
410 |
<input name="processingCode" type="hidden" value="'.$innoviti->processingCode.'" />
|
|
|
411 |
<input name="proSku" type="hidden" value="'.$innoviti->proSku.'" />
|
|
|
412 |
<input name="Cname" type="hidden" value="'.$innoviti->Cname.'" /></td>
|
|
|
413 |
<input name="mobile" type="hidden" value="'.$innoviti->mobile.'" />
|
|
|
414 |
<input name="emailId" type="hidden" value="'.$innoviti->emailId.'" />
|
|
|
415 |
<input name="redirUrl" type="hidden" value="'.$innoviti->redirUrl.'" />
|
|
|
416 |
<input name="chksum" type="hidden" value="'.$innoviti->chksum.'" />
|
|
|
417 |
<input name="isCtx" type="hidden" value="NO" />
|
|
|
418 |
<input name="submitted" value="Submit" type="submit" />
|
|
|
419 |
</form>
|
|
|
420 |
</div><script type="text/javascript">
|
|
|
421 |
document.getElementById("frmTransaction").submit();
|
|
|
422 |
</script></body></html>';
|
|
|
423 |
}
|
|
|
424 |
}else{
|
|
|
425 |
redirect(base_url());
|
|
|
426 |
}
|
|
|
427 |
|
|
|
428 |
}else{
|
|
|
429 |
redirect(base_url());
|
|
|
430 |
}
|
|
|
431 |
}
|
|
|
432 |
public function innovitiResponse(){
|
|
|
433 |
if(isset($_POST)){
|
|
|
434 |
$paymentconfig = $this->config->item('innovitiResponse');
|
|
|
435 |
$authorized = $this->session->userdata('authorized');
|
|
|
436 |
if(isset($authorized) && !empty($authorized)){
|
|
|
437 |
$_POST['userId'] = $authorized['Id'];
|
|
|
438 |
if($authorized['isLoggedIn'] == 1){
|
|
|
439 |
$_POST['isLoggedIn'] = 'true';
|
|
|
440 |
}
|
|
|
441 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
442 |
$_POST['isLoggedIn'] = 'false';
|
|
|
443 |
}
|
|
|
444 |
}
|
|
|
445 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
446 |
if(isset($data['response']['response']['innoviti_response'][0]->response) && !empty($data['response']['response']['innoviti_response'][0]->response)){
|
|
|
447 |
$redirectUrl = $data['response']['response']['innoviti_response'][0]->response->redirectUrl;
|
|
|
448 |
redirect($redirectUrl);
|
|
|
449 |
}
|
|
|
450 |
else{
|
|
|
451 |
redirect(base_url());
|
|
|
452 |
}
|
|
|
453 |
}else{
|
|
|
454 |
redirect(base_url());
|
|
|
455 |
}
|
|
|
456 |
}
|
|
|
457 |
public function paymenterror(){
|
|
|
458 |
$authorized = $this->session->userdata('authorized');
|
|
|
459 |
if(isset($authorized) && !empty($authorized)){
|
|
|
460 |
$data = array();
|
|
|
461 |
$paymentconfig = $this->config->item('paymenterror');
|
|
|
462 |
$this->lessphp->object()->ccompile('assets/css/shipping.less','assets/css/shipping.css');
|
|
|
463 |
$data['stylesheet'] = 'shipping.css';
|
|
|
464 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$paymentconfig);
|
|
|
465 |
$this->layout->view('checkout/checkout_view',$data);
|
|
|
466 |
}else{
|
|
|
467 |
redirect(base_url());
|
|
|
468 |
}
|
|
|
469 |
}
|
|
|
470 |
public function shipping()
|
|
|
471 |
{
|
|
|
472 |
|
|
|
473 |
$data = array();
|
|
|
474 |
$authorized = $this->session->userdata('authorized');
|
|
|
475 |
if($authorized['isLoggedIn'] != 1){
|
|
|
476 |
$this->session->set_userdata('location','shipping');
|
|
|
477 |
redirect(base_url()."login");
|
|
|
478 |
}
|
|
|
479 |
$shippingconfig = $this->config->item('shipping');
|
|
|
480 |
if(!isset($_POST['submit']))
|
|
|
481 |
{
|
|
|
482 |
$authorized = $this->session->userdata('authorized');
|
|
|
483 |
if(isset($authorized) && !empty($authorized)){
|
|
|
484 |
$_GET['userId'] = $authorized['Id'];
|
|
|
485 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
486 |
if($authorized['isLoggedIn'] == 1){
|
|
|
487 |
$_GET['isLoggedIn'] = 'true';
|
|
|
488 |
}
|
|
|
489 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
490 |
$_GET['isLoggedIn'] = 'false';
|
|
|
491 |
}
|
|
|
492 |
}
|
|
|
493 |
$this->lessphp->object()->ccompile('assets/css/shipping.less','assets/css/shipping.css');
|
|
|
494 |
$data['stylesheet'] = 'shipping.css';
|
|
|
495 |
$data['title'] = 'Saholic';
|
|
|
496 |
$cache = getFileCache('pickup');
|
|
|
497 |
if(isset($cache) && !empty($cache)){
|
|
|
498 |
unset($shippingconfig['response'][1]);
|
|
|
499 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
|
|
|
500 |
$data['response']['response']['pickup'] = $cache;
|
|
|
501 |
}else{
|
|
|
502 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
|
|
|
503 |
if(isset($data['response']['response']['pickup']) && !empty($data['response']['response']['pickup']))
|
|
|
504 |
setFileCache($data['response']['response']['pickup'], 'pickup',900);
|
|
|
505 |
}
|
|
|
506 |
$carts = $data['response']['response']['carts'][0];
|
|
|
507 |
$shipping = $data['response']['response']['shipping_process'][0];
|
|
|
508 |
if((isset($carts) && !empty($carts)) && (isset($shipping) && !empty($shipping))){
|
|
|
509 |
$this->layout->view('checkout/checkout_view',$data);
|
|
|
510 |
}else{
|
|
|
511 |
redirect(base_url()."cart");
|
|
|
512 |
}
|
|
|
513 |
}
|
|
|
514 |
if(isset($_POST['submit']))
|
|
|
515 |
{
|
|
|
516 |
unset($shippingconfig['response'][1]);
|
|
|
517 |
$data = $this->get_shipping_billing($_POST);
|
|
|
518 |
$this->session->set_userdata($data);
|
|
|
519 |
$authorized = $this->session->userdata('authorized');
|
|
|
520 |
if(isset($authorized) && !empty($authorized)){
|
|
|
521 |
$_POST['userId'] = $authorized['Id'];
|
|
|
522 |
$_POST['Id'] = $authorized['cartId'];
|
|
|
523 |
if($authorized['isLoggedIn'] == 1){
|
|
|
524 |
$_POST['isLoggedIn'] = 'true';
|
|
|
525 |
}
|
|
|
526 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
527 |
$_POST['isLoggedIn'] = 'false';
|
|
|
528 |
}
|
|
|
529 |
}
|
|
|
530 |
//$data['stylesheet'] = 'shipping.less';
|
|
|
531 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
|
|
|
532 |
//$this->layout->view('checkout/checkout_view',$data);
|
|
|
533 |
redirect(base_url()."shipping");
|
|
|
534 |
|
|
|
535 |
}
|
|
|
536 |
|
|
|
537 |
}
|
|
|
538 |
|
|
|
539 |
public function get_shipping_billing($data=array()){
|
|
|
540 |
$billing =array();
|
|
|
541 |
$shipping =array();
|
|
|
542 |
if (isset($data) && !empty($data)) {
|
|
|
543 |
$shipping=array('name' => $data['name'],'line1' => $data['line1'],'line2' => $data['line2'], 'city' => $data['city'], 'pin' => $data['pin'], 'phonenumber' => $data['phone']);
|
|
|
544 |
return array('shipping'=>$shipping,'billing'=>$billing);
|
|
|
545 |
}
|
|
|
546 |
}
|
|
|
547 |
|
|
|
548 |
public function delete($addressId){
|
|
|
549 |
$shippingconfig = $this->config->item('shipping_delete');
|
|
|
550 |
$_GET['addressId'] = $addressId;
|
|
|
551 |
$authorized = $this->session->userdata('authorized');
|
|
|
552 |
if(isset($authorized) && !empty($authorized)){
|
|
|
553 |
$_GET['userId'] = $authorized['Id'];
|
|
|
554 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
555 |
if($authorized['isLoggedIn'] == 1){
|
|
|
556 |
$_GET['isLoggedIn'] = 'true';
|
|
|
557 |
}
|
|
|
558 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
559 |
$_GET['isLoggedIn'] = 'false';
|
|
|
560 |
}
|
|
|
561 |
}
|
|
|
562 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
|
|
|
563 |
print_r($data['response']);
|
|
|
564 |
}
|
|
|
565 |
|
|
|
566 |
public function changeAddress($addressId,$type){
|
|
|
567 |
if(isset($addressId) && isset($type)){
|
|
|
568 |
$shippingconfig = $this->config->item('shipping_change');
|
|
|
569 |
$_GET['addressId'] = $addressId;
|
|
|
570 |
$_GET['addressType'] = $type;
|
|
|
571 |
$authorized = $this->session->userdata('authorized');
|
|
|
572 |
if(isset($authorized) && !empty($authorized)){
|
|
|
573 |
$_GET['userId'] = $authorized['Id'];
|
|
|
574 |
$_GET['Id'] = $authorized['cartId'];
|
|
|
575 |
if($authorized['isLoggedIn'] == 1){
|
|
|
576 |
$_GET['isLoggedIn'] = 'true';
|
|
|
577 |
}
|
|
|
578 |
elseif(isset($authorized['isLoggedIn']) && empty($authorized['isLoggedIn'])) {
|
|
|
579 |
$_GET['isLoggedIn'] = 'false';
|
|
|
580 |
}
|
|
|
581 |
}
|
|
|
582 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$shippingconfig);
|
|
|
583 |
$this->session->set_userdata('addressId',$addressId);
|
|
|
584 |
echo json_encode($data['response']['response']['changeAddress'][0]);
|
|
|
585 |
}
|
|
|
586 |
}
|
|
|
587 |
public function changeCaptcha(){
|
|
|
588 |
$captchaDisplay = $this->session->userdata('captchaDisplay');
|
|
|
589 |
//if(isset($captchaDisplay) && $captchaDisplay == 1){
|
|
|
590 |
$captcha = $this->captcha_model->generateCaptcha();
|
|
|
591 |
$this->session->set_userdata('captcha',$captcha['word']);
|
|
|
592 |
unset($captcha['word']);
|
|
|
593 |
unset($captcha['time']);
|
|
|
594 |
unset($captcha['name']);
|
|
|
595 |
echo json_encode($captcha);
|
|
|
596 |
//}
|
|
|
597 |
}
|
|
|
598 |
public function insuranceInfo($bday,$gname,$addressId){
|
|
|
599 |
if((isset($bday) && !empty($bday)) && (isset($gname) && !empty($gname)) && (isset($addressId) && !empty($addressId))){
|
|
|
600 |
if(isset($gname) && !empty($gname)){
|
|
|
601 |
$gname = str_replace('-',' ',$gname);
|
|
|
602 |
$gname = ltrim($gname);
|
|
|
603 |
$gname = rtrim($gname);
|
|
|
604 |
$_GET['guardianName'] = $gname;
|
|
|
605 |
}
|
|
|
606 |
if(isset($bday) && !empty($bday)){
|
|
|
607 |
$dob = explode('-',$bday);
|
|
|
608 |
//$dob = array_reverse($dob);
|
|
|
609 |
$temp1 = $dob[1];
|
|
|
610 |
$temp2 = $dob[0];
|
|
|
611 |
$dob[0] = $temp1;
|
|
|
612 |
$dob[1] = $temp2;
|
|
|
613 |
|
|
|
614 |
$dob = implode('/', $dob);
|
|
|
615 |
$_GET['dob'] = $dob;
|
|
|
616 |
}
|
|
|
617 |
$insuranceconfig = $this->config->item('insurance_info');
|
|
|
618 |
$_GET['addressId'] = $addressId;
|
|
|
619 |
$data['response']=$this->checkout_model->getCheckoutDetails($this->input->get(),$this->input->post(),$insuranceconfig);
|
|
|
620 |
if(isset($data['response']['response']['insuranceInfo'][0]->response) && (!empty($data['response']['response']['insuranceInfo'][0]->response))) {
|
|
|
621 |
echo json_encode($data['response']['response']['insuranceInfo'][0]);
|
|
|
622 |
}
|
|
|
623 |
}
|
|
|
624 |
}
|
|
|
625 |
public function pickupSpot($id){
|
|
|
626 |
if(isset($id) && !empty($id) && is_numeric($id)){
|
|
|
627 |
$this->session->set_userdata('hotspotId',$id);
|
|
|
628 |
$response['msg'] = 'sucess';
|
|
|
629 |
echo json_encode($response);
|
|
|
630 |
}
|
|
|
631 |
}
|
|
|
632 |
|
|
|
633 |
}
|
|
|
634 |
|
|
|
635 |
|
|
|
636 |
/* End of file welcome.php */
|
|
|
637 |
/* Location: ./application/controllers/welcome.php */
|