| Line 83... |
Line 83... |
| 83 |
$user_name = "";
|
83 |
$user_name = "";
|
| 84 |
$user_contact = "";
|
84 |
$user_contact = "";
|
| 85 |
$codAvailable = $cartskus['cod'];
|
85 |
$codAvailable = $cartskus['cod'];
|
| 86 |
//$codAvailable = false;
|
86 |
//$codAvailable = false;
|
| 87 |
$this->Session->write('cod', $codAvailable);
|
87 |
$this->Session->write('cod', $codAvailable);
|
| 88 |
$creditTicketSize = 0;
|
88 |
$walletAmount = 0;
|
| 89 |
|
- |
|
| 90 |
$creditorAssociated = $response ['creditorAssociated'];
|
- |
|
| 91 |
if(!isset($response ['userSanctions'])){
|
89 |
if(array_key_exists('walletAmount',$response)){
|
| 92 |
$creditLimit = 0;
|
- |
|
| 93 |
}else{
|
- |
|
| 94 |
$creditLimit = 0;
|
- |
|
| 95 |
$creditTicketSize = intval($response ['userSanctions'][0]['ticket_size']);
|
90 |
$walletAmount = $response ['walletAmount'];
|
| 96 |
foreach ( $response ['userSanctions'] as $key => $value ) {
|
- |
|
| 97 |
$creditLimit = $creditLimit + intval($value ['credit_limit']) - (intval($value['credit_blocked'])+intval($value['loan']));
|
- |
|
| 98 |
}
|
- |
|
| 99 |
}
|
91 |
}
|
| 100 |
$this->Session->write('creditorAssociated', $creditorAssociated);
|
92 |
//$creditorAssociated
|
| 101 |
$this->Session->write('creditLimit', $creditLimit);
|
93 |
$this->Session->write('walletAmount', $walletAmount);
|
| 102 |
$this->Session->write('creditTicketSize', $creditTicketSize);
|
- |
|
| 103 |
$taxInvoiceEnabledUser = $response ['taxInvoiceEnabledUser'];
|
94 |
$taxInvoiceEnabledUser = $response ['taxInvoiceEnabledUser'];
|
| 104 |
$this->Session->write('taxInvoiceEnabledUser', $taxInvoiceEnabledUser);
|
95 |
$this->Session->write('taxInvoiceEnabledUser', $taxInvoiceEnabledUser);
|
| 105 |
|
96 |
|
| 106 |
if(empty($response ['addresses'])){
|
97 |
if(empty($response ['addresses'])){
|
| 107 |
$this->redirect ( array (
|
98 |
$this->redirect ( array (
|
| Line 166... |
Line 157... |
| 166 |
array_push ( $firstshowaddress, $moreshowaddress [$i] );
|
157 |
array_push ( $firstshowaddress, $moreshowaddress [$i] );
|
| 167 |
}
|
158 |
}
|
| 168 |
|
159 |
|
| 169 |
$this->set ( 'address', $response );
|
160 |
$this->set ( 'address', $response );
|
| 170 |
|
161 |
|
| 171 |
$this->set ( compact ( 'stateres','firstshowaddress', 'totalPayable', 'user_name', 'user_contact', 'pincode', 'defaultselectedaddress', 'message', 'codAvailable', 'taxInvoiceEnabledUser', 'creditorAssociated', 'creditLimit', 'creditTicketSize') );
|
162 |
$this->set ( compact ( 'stateres','firstshowaddress', 'totalPayable', 'user_name', 'user_contact', 'pincode', 'defaultselectedaddress', 'message', 'codAvailable', 'taxInvoiceEnabledUser', 'walletAmount') );
|
| 172 |
}
|
163 |
}
|
| 173 |
}
|
164 |
}
|
| 174 |
public function add($user_name = null, $user_contact = null) {
|
165 |
public function add($user_name = null, $user_contact = null) {
|
| 175 |
$this->layout = 'cartinnerpages';
|
166 |
$this->layout = 'cartinnerpages';
|
| 176 |
|
167 |
|
| 177 |
$totalPayable = $_SESSION ['totalPayable'];
|
168 |
$totalPayable = $_SESSION ['totalPayable'];
|
| 178 |
$codAvailable = $_SESSION ['cod'];
|
169 |
$codAvailable = $_SESSION ['cod'];
|
| 179 |
$creditLimit = $_SESSION ['creditLimit'];
|
- |
|
| 180 |
$creditorAssociated = $_SESSION ['creditorAssociated'];
|
- |
|
| 181 |
$creditTicketSize = $_SESSION ['creditTicketSize'];
|
- |
|
| - |
|
170 |
|
| 182 |
$taxInvoiceEnabledUser = $_SESSION['taxInvoiceEnabledUser'];
|
171 |
$taxInvoiceEnabledUser = $_SESSION['taxInvoiceEnabledUser'];
|
| 183 |
//$pinval = base64_decode ( $_COOKIE ['s_pincode'] );
|
172 |
//$pinval = base64_decode ( $_COOKIE ['s_pincode'] );
|
| 184 |
$pinval='';
|
173 |
$pinval='';
|
| 185 |
$suserId = base64_decode ( $_COOKIE ['s_id'] );
|
174 |
$suserId = base64_decode ( $_COOKIE ['s_id'] );
|
| 186 |
$scart = base64_decode ( $_COOKIE ['s_cart'] );
|
175 |
$scart = base64_decode ( $_COOKIE ['s_cart'] );
|
| Line 250... |
Line 239... |
| 250 |
// debug($getstate);
|
239 |
// debug($getstate);
|
| 251 |
$getstateval = "";
|
240 |
$getstateval = "";
|
| 252 |
if ($getstate != "{}") {
|
241 |
if ($getstate != "{}") {
|
| 253 |
$getstateval = ucwords ( strtolower ( $getstate ['state'] ) );
|
242 |
$getstateval = ucwords ( strtolower ( $getstate ['state'] ) );
|
| 254 |
}
|
243 |
}
|
| 255 |
$this->set(compact('getstateval', 'user_name', 'user_contact', 'pinval', 'totalPayable', 'codAvailable', 'creditorAssociated', 'creditLimit', 'creditTicketSize', 'taxInvoiceEnabledUser'));
|
244 |
$this->set(compact('getstateval', 'user_name', 'user_contact', 'pinval', 'totalPayable', 'codAvailable', 'taxInvoiceEnabledUser', 'walletAmount'));
|
| 256 |
}
|
245 |
}
|
| 257 |
public function submitcheck() {
|
246 |
public function submitcheck() {
|
| 258 |
$this->autoRender = false;
|
247 |
$this->autoRender = false;
|
| 259 |
$this->request->onlyAllow ( 'ajax' );
|
248 |
$this->request->onlyAllow ( 'ajax' );
|
| 260 |
|
249 |
|
| Line 371... |
Line 360... |
| 371 |
public function checkout(){
|
360 |
public function checkout(){
|
| 372 |
$addressid = $this->request->data['addressid'];
|
361 |
$addressid = $this->request->data['addressid'];
|
| 373 |
$pincode = 0;
|
362 |
$pincode = 0;
|
| 374 |
$cod = $this->request->query('cod');
|
363 |
$cod = $this->request->query('cod');
|
| 375 |
$userId = $this->request->query('user_id');
|
364 |
$userId = $this->request->query('user_id');
|
| - |
|
365 |
$walletUsed = $this->request->data('walletUsed');
|
| 376 |
|
366 |
|
| 377 |
//Added token validation to ensure only user
|
367 |
//Added token validation to ensure only user
|
| 378 |
$testCheck = Configure::read('requireusercheck');
|
368 |
$testCheck = Configure::read('requireusercheck');
|
| 379 |
$tokenValidated = 0;
|
369 |
$tokenValidated = 0;
|
| 380 |
if($testCheck){
|
370 |
if($testCheck){
|
| Line 401... |
Line 391... |
| 401 |
unset($_COOKIE['txn_comp']);
|
391 |
unset($_COOKIE['txn_comp']);
|
| 402 |
}
|
392 |
}
|
| 403 |
|
393 |
|
| 404 |
if($cod==1){
|
394 |
if($cod==1){
|
| 405 |
$url = Configure::read('saholicapihost').'order?payment_option=COD~3000&isLoggedIn=true&privateDealUser=true&userId='.$suserId.'&id='.$scartId.'&email='.$semailId.'&addressid='.$addressid;
|
395 |
$url = Configure::read('saholicapihost').'order?payment_option=COD~3000&isLoggedIn=true&privateDealUser=true&userId='.$suserId.'&id='.$scartId.'&email='.$semailId.'&addressid='.$addressid;
|
| - |
|
396 |
if(isset($walletUsed)) {
|
| - |
|
397 |
$url .= '?walletUsed='.$walletUsed;
|
| - |
|
398 |
}
|
| 406 |
if($pincode!='0'){
|
399 |
if($pincode!='0'){
|
| 407 |
$url = $url.'&pinCode='.$pincode;
|
400 |
$url = $url.'&pinCode='.$pincode;
|
| 408 |
}
|
401 |
}
|
| 409 |
$orderCreationResponse = $this->post_cartinfo_request($url, null);
|
402 |
$orderCreationResponse = $this->post_cartinfo_request($url, null);
|
| 410 |
//{"response":{"success":true,"redirectUrl":"pay-success?paymentId=998593"}}
|
403 |
//{"response":{"success":true,"redirectUrl":"pay-success?paymentId=998593"}}
|
| Line 468... |
Line 461... |
| 468 |
$redirectUrl = $this->getBigUtsavAutoLoginUrl($userId,$next);
|
461 |
$redirectUrl = $this->getBigUtsavAutoLoginUrl($userId,$next);
|
| 469 |
$this->log($redirectUrl,'headers');
|
462 |
$this->log($redirectUrl,'headers');
|
| 470 |
$this->set(compact('redirectUrl','next'));
|
463 |
$this->set(compact('redirectUrl','next'));
|
| 471 |
}else{
|
464 |
}else{
|
| 472 |
$dataGiven = json_decode($this->request->data['cart_details']);
|
465 |
$dataGiven = json_decode($this->request->data['cart_details']);
|
| 473 |
$payMethod = $this->request->data['paymethod'];
|
466 |
if($walletUsed==$this->Session->read('totalPayable')){
|
| 474 |
if(isset($payMethod) && $payMethod=='cap_float'){
|
- |
|
| 475 |
$url = Configure::read('saholicapihost').'order?payment_option=456789&isLoggedIn=true&privateDealUser=true&userId='.$suserId.'&id='.$scartId.'&email='.$semailId.'&addressid='.$addressid;
|
467 |
$url = Configure::read('saholicapihost').'order?isLoggedIn=true&privateDealUser=true&userId='.$suserId.'&id='.$scartId.'&email='.$semailId.'&addressid='.$addressid.'&walletUsed='.$walletUsed;
|
| 476 |
if($pincode!='0'){
|
468 |
if($pincode!='0'){
|
| 477 |
$url = $url.'&pinCode='.$pincode;
|
469 |
$url = $url.'&pinCode='.$pincode;
|
| 478 |
}
|
470 |
}
|
| 479 |
$orderCreationResponse = $this->post_cartinfo_request($url, null);
|
471 |
$orderCreationResponse = $this->post_cartinfo_request($url, null);
|
| 480 |
//{"response":{"success":true,"redirectUrl":"pay-success?paymentId=998593"}}
|
472 |
//{"response":{"success":true,"redirectUrl":"pay-success?paymentId=998593"}}
|
| Line 523... |
Line 515... |
| 523 |
else {
|
515 |
else {
|
| 524 |
$result =array('success'=>true,'message'=> $response['result']);
|
516 |
$result =array('success'=>true,'message'=> $response['result']);
|
| 525 |
$sql = "UPDATE orders SET status = '".$response['result']."' WHERE id = ".$order['Order']['id'];
|
517 |
$sql = "UPDATE orders SET status = '".$response['result']."' WHERE id = ".$order['Order']['id'];
|
| 526 |
$this->log(print_r('insideelse',1),'ordersdet');
|
518 |
$this->log(print_r('insideelse',1),'ordersdet');
|
| 527 |
}
|
519 |
}
|
| 528 |
$this->log(print_r($sql,1),'ordersdet');
|
- |
|
| 529 |
$this->Order->query($sql);
|
520 |
$this->Order->query($sql);
|
| 530 |
|
521 |
|
| 531 |
}
|
522 |
}
|
| 532 |
}
|
523 |
}
|
| 533 |
}
|
524 |
}
|
| Line 539... |
Line 530... |
| 539 |
$this->set(compact('redirectUrl','next','redirectToCart'));
|
530 |
$this->set(compact('redirectUrl','next','redirectToCart'));
|
| 540 |
}else{
|
531 |
}else{
|
| 541 |
$totalSkus= intval($dataGiven->totalSkus);
|
532 |
$totalSkus= intval($dataGiven->totalSkus);
|
| 542 |
setcookie('txn_comp', 'no', -1, '/');
|
533 |
setcookie('txn_comp', 'no', -1, '/');
|
| 543 |
$this->layout = 'innerpages';
|
534 |
$this->layout = 'innerpages';
|
| 544 |
$next = "payment1?cq=".$totalSkus.'&addressid='.$addressid;
|
535 |
$next = "payment1?cq=".$totalSkus.'&addressid='.$addressid;
|
| - |
|
536 |
if(isset($walletUsed)) {
|
| - |
|
537 |
$next .= '?walletUsed='.$walletUsed;
|
| - |
|
538 |
}
|
| 545 |
$redirectUrl = $this->getBigUtsavAutoLoginUrl($userId,$next);
|
539 |
$redirectUrl = $this->getBigUtsavAutoLoginUrl($userId,$next);
|
| 546 |
$this->log($redirectUrl,'headers');
|
540 |
$this->log($redirectUrl,'headers');
|
| 547 |
$this->set(compact('redirectUrl','next'));
|
541 |
$this->set(compact('redirectUrl','next'));
|
| 548 |
}
|
542 |
}
|
| 549 |
}
|
543 |
}
|