Subversion Repositories SmartDukaan

Rev

Rev 18954 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
18900 naman 1
<?php
2
App::uses('AppController', 'Controller');
3
/**
4
 * Exceptionalnlcs Controller
5
 *
6
 * @property Exceptionalnlc $Exceptionalnlc
7
 * @property PaginatorComponent $Paginator
8
 */
9
class TinsController extends AppController {
10
 
11
/**
12
 * Components
13
 *
14
 * @var array
15
 */
16
	public $components = array('Paginator');
17
 
18
	public function beforeFilter() {
19
		parent::beforeFilter();
18908 naman 20
		$this->Auth->allow(array('tin_search'));
18900 naman 21
		$this->apihost = Configure::read('pythonapihost');
18915 naman 22
		$this->mobileapihost = Configure::read('saholicapihost');
18900 naman 23
	}
24
	public function tin_search($tin_num = null) {
25
		$this->layout = 'ajax';
18915 naman 26
		$user_email = $this->Auth->user('email');
18954 naman 27
		$phone_number = $this->Auth->user('mobile_number');;
28
// 		$tinres = json_decode('{"pin_required" : "false" , "tin" : "07976957280" , "cst" : "07976957280","counter_name" : "E-RETAIL SHOP","counter_address" : "SHOP IN H. NO. 61 BLOCK B MOLAR BAND EXTN.,-110044" ,"state" : "North Delhi","pan" : "AEEPV9740C","registered_on" :"16/03/15 ","cst_status" : "Active","valid_since" :"06/07/15", "isError": false, "errorMsg": "Error message"}',true);
18900 naman 29
		$url = $this->apihost."tinsearch?tin=".$tin_num;
30
		$tinres = $this->make_request($url,null);
18969 naman 31
		$pincheck = "nothing";
18954 naman 32
		if($tinres['pin_required'] == false){
18969 naman 33
			$pincheck = $tinres['pin'];
18954 naman 34
		}
35
		$this->set(compact('tinres' ,'tin_num','user_email','phone_number','pincheck'));
18900 naman 36
		$this->render('/Elements/gettindetail');
37
	}
38
 
39
	public function index() {
40
		$this->layout = "innerpages";
41
	}
42
 
43
	public function confirm(){
18954 naman 44
		$this->autoRender = false;
45
		$this->request->onlyAllow ( 'ajax' );
46
		$arr=array();
47
		$data = $this->request->data;
48
 
49
		$arr['tinMap'] = json_encode($data);
50
// 		$senddata = $this->request->query('aParam');
51
		$this->loadModel('UserAccount');
52
		$opt = array('conditions'=>array('user_id'=>$this->Auth->user('id'),'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'account_key');
53
		$usId = $this->UserAccount->find('first',$opt);
54
		$cuid = $usId['UserAccount']['account_key'];
55
		$url = $this->mobileapihost."register!registerTin?userId=".$cuid."&isLoggedIn=true&privateDealUser=true";
56
// 		$url = "http://45.79.106.95:8080/mobileapi/register!registerTin?isLoggedIn=true&privateDealUser=true&userId=483649";
18969 naman 57
		$res = $this->post_request( $url, $arr, 'nojson' );
58
		//print_r($res);
18954 naman 59
// 		$this->redirect('/category/3');
18969 naman 60
		return	$res;
18900 naman 61
	}
62
 
63
}
64
 
65
 
66
 
67
 
68
 
69
 
70