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