Subversion Repositories SmartDukaan

Rev

Rev 22350 | Rev 23242 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 22350 Rev 22363
Line 1... Line 1...
1
package in.shop2020.serving.controllers;
1
package in.shop2020.serving.controllers;
2
 
2
 
-
 
3
import in.shop2020.model.v1.order.TransactionService.retrieveHotspotRechargeInvoice_result;
3
import in.shop2020.model.v1.user.Address;
4
import in.shop2020.model.v1.user.Address;
4
import in.shop2020.model.v1.user.Counter;
5
import in.shop2020.model.v1.user.Counter;
-
 
6
import in.shop2020.model.v1.user.CounterVerificationType;
5
import in.shop2020.model.v1.user.PrivateDealUser;
7
import in.shop2020.model.v1.user.PrivateDealUser;
6
import in.shop2020.model.v1.user.User;
8
import in.shop2020.model.v1.user.User;
7
import in.shop2020.model.v1.user.UserCommunicationException;
9
import in.shop2020.model.v1.user.UserCommunicationException;
8
import in.shop2020.thrift.clients.HelperClient;
10
import in.shop2020.thrift.clients.HelperClient;
9
import in.shop2020.thrift.clients.UserClient;
11
import in.shop2020.thrift.clients.UserClient;
10
 
12
 
11
import java.util.ArrayList;
13
import java.util.ArrayList;
-
 
14
import java.util.Date;
12
import java.util.List;
15
import java.util.List;
13
import java.util.Random;
16
import java.util.Random;
14
 
17
 
15
import org.apache.commons.lang.StringUtils;
18
import org.apache.commons.lang.StringUtils;
16
import org.apache.log4j.Logger;
19
import org.apache.log4j.Logger;
17
import org.apache.shiro.SecurityUtils;
20
import org.apache.shiro.SecurityUtils;
-
 
21
import org.apache.velocity.app.event.implement.ReportInvalidReferences;
-
 
22
 
-
 
23
import com.google.gson.Gson;
18
 
24
 
19
/**
25
/**
20
 * @author vikas
26
 * @author vikas
21
 *
27
 *
22
 */
28
 */
Line 75... Line 81...
75
        	this.documentVerified = c.isDocumentVerified();
81
        	this.documentVerified = c.isDocumentVerified();
76
        }
82
        }
77
 
83
 
78
        return INDEX;
84
        return INDEX;
79
    }
85
    }
-
 
86
    
-
 
87
    
-
 
88
    public String verifyRetailer() throws Exception{
-
 
89
    	try{
-
 
90
			UserClient userServiceClient = new UserClient();
-
 
91
	        in.shop2020.model.v1.user.UserContextService.Client userClient = userServiceClient.getClient();
-
 
92
	        Counter counter = userClient.getCounterByUserId(userId);
-
 
93
	        if(counter.getId()!=0) {
-
 
94
	        	counter.setGstin(gstin);
-
 
95
	        	counter.setDocumentVerified(true);
-
 
96
	        	userClient.updateCounter(counter);
-
 
97
	        }else{
-
 
98
		        counter = new Counter();
-
 
99
		        long currentTime = new Date().getTime();
-
 
100
		        counter.setGstin(gstin);
-
 
101
		        counter.setAddedOn(currentTime);
-
 
102
		        counter.setVerifiedOn(currentTime);
-
 
103
		        counter.setVerificationType(CounterVerificationType.OFFLINE);
-
 
104
		        counter.setDocumentVerified(true);
-
 
105
	        }
-
 
106
		}catch (Exception e) {
-
 
107
			e.printStackTrace();
-
 
108
			throw e;
-
 
109
		}
-
 
110
    	return index();
-
 
111
    }
80
 
112
 
81
    public String update() throws Exception {
113
    public String update() throws Exception {
82
        userId = Long.parseLong(id);
114
        userId = Long.parseLong(id);
83
        userContextServiceClient = new UserClient().getClient();
115
        userContextServiceClient = new UserClient().getClient();
84
        userContextServiceClient.increaseTrustLevel(userId, Double.parseDouble(trustLevelDelta));
116
        userContextServiceClient.increaseTrustLevel(userId, Double.parseDouble(trustLevelDelta));