Subversion Repositories SmartDukaan

Rev

Rev 18969 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18969 Rev 18984
Line 22... Line 22...
22
		$this->mobileapihost = Configure::read('saholicapihost');
22
		$this->mobileapihost = Configure::read('saholicapihost');
23
	}
23
	}
24
	public function tin_search($tin_num = null) {
24
	public function tin_search($tin_num = null) {
25
		$this->layout = 'ajax';
25
		$this->layout = 'ajax';
26
		$user_email = $this->Auth->user('email');
26
		$user_email = $this->Auth->user('email');
27
		$phone_number = $this->Auth->user('mobile_number');;
27
		$phone_number = $this->Auth->user('mobile_number');
-
 
28
		$this->loadModel("UserAccount");
-
 
29
		$opt = array('conditions'=>array('user_id'=>$this->Auth->user('id'),'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'account_key');
-
 
30
		$usId = $this->UserAccount->find('first',$opt);
-
 
31
		$cuid = $usId['UserAccount']['account_key'];
-
 
32
		
-
 
33
		$url = $this->mobileapihost."counter?userId=".$cuid."&isLoggedIn=true&privateDealUser=true&tin=".$tin_num;
-
 
34
		$tinres = $this->make_request($url, null);
-
 
35
		if($tinres["response"]["counterExists"] == true)
-
 
36
		{	$tinres = $tinres["response"];
-
 
37
			$this->set(compact('tinres'));
-
 
38
			$this->render('existtin');
-
 
39
		}
-
 
40
		else{
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);
41
			// 		$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);
29
		$url = $this->apihost."tinsearch?tin=".$tin_num;
42
			$url = $this->apihost."tinsearch?tin=".$tin_num;
30
		$tinres = $this->make_request($url,null);
43
			$tinres = $this->make_request($url,null);
31
		$pincheck = "nothing";
44
			$pincheck = "nothing";
32
		if($tinres['pin_required'] == false){
45
			if($tinres['pin_required'] == false){
33
			$pincheck = $tinres['pin'];
46
				$pincheck = $tinres['pin'];
-
 
47
			}
-
 
48
			$this->set(compact('tinres' ,'tin_num','user_email','phone_number','pincheck'));
-
 
49
			$this->render('/Elements/gettindetail');
34
		}
50
		}
35
		$this->set(compact('tinres' ,'tin_num','user_email','phone_number','pincheck'));
-
 
36
		$this->render('/Elements/gettindetail');
-
 
37
	}
51
	}
38
	
52
	
39
	public function index() {
53
	public function index() {
40
		$this->layout = "innerpages";
54
		$this->layout = "innerpages";
-
 
55
		$res = false;
-
 
56
		$this->loadModel("UserAccount");
-
 
57
// 		$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);
-
 
58
		$opt = array('conditions'=>array('user_id'=>$this->Auth->user('id'),'account_type'=>'saholic'),'recursive'=>-1,'fields'=>'account_key');
-
 
59
		$usId = $this->UserAccount->find('first',$opt);
-
 
60
		$cuid = $usId['UserAccount']['account_key'];
-
 
61
		$url = $this->mobileapihost."counter?userId=".$cuid."&isLoggedIn=true&privateDealUser=true";
-
 
62
 		$tinres = $this->make_request( $url, null );
-
 
63
//  		debug($tinres);
-
 
64
 		$res = $tinres["response"]["counterExists"];
-
 
65
 		$tinres= $tinres["response"];
-
 
66
		if($res == true){
-
 
67
// 			$this->redirect(array(
-
 
68
// 					'controller' => 'tins', 'action' => 'showtin', 'tinres' => $tinres
-
 
69
// 			));
-
 
70
			$this->set(compact('tinres'));
-
 
71
			$this->render('showtin');
-
 
72
		}
-
 
73
		
-
 
74
		
41
	}
75
	}
42
	
76
	
43
	public function confirm(){
77
	public function confirm(){
44
		$this->autoRender = false;
78
		$this->autoRender = false;
45
		$this->request->onlyAllow ( 'ajax' );
79
		$this->request->onlyAllow ( 'ajax' );
Line 53... Line 87...
53
		$usId = $this->UserAccount->find('first',$opt);
87
		$usId = $this->UserAccount->find('first',$opt);
54
		$cuid = $usId['UserAccount']['account_key'];
88
		$cuid = $usId['UserAccount']['account_key'];
55
		$url = $this->mobileapihost."register!registerTin?userId=".$cuid."&isLoggedIn=true&privateDealUser=true";
89
		$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";
90
// 		$url = "http://45.79.106.95:8080/mobileapi/register!registerTin?isLoggedIn=true&privateDealUser=true&userId=483649";
57
		$res = $this->post_request( $url, $arr, 'nojson' );
91
		$res = $this->post_request( $url, $arr, 'nojson' );
58
		//print_r($res);
-
 
59
// 		$this->redirect('/category/3');
92
// 		$this->redirect('/category/3');
60
		return	$res;
93
		return	$res;
61
	}
94
	}
-
 
95
	
-
 
96
	public function showtin(){
-
 
97
		$this->layout = "innerpages";
-
 
98
	}
-
 
99
	public function existtin(){
-
 
100
		$this->layout = "innerpages";
-
 
101
	}
62
 
102
 
63
}
103
}
64
 
104
 
65
 
105
 
66
 
106