Subversion Repositories SmartDukaan

Rev

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

Rev 22024 Rev 22355
Line 6... Line 6...
6
import java.util.Iterator;
6
import java.util.Iterator;
7
import java.util.List;
7
import java.util.List;
8
import java.util.Map;
8
import java.util.Map;
9
 
9
 
10
import org.springframework.beans.factory.annotation.Autowired;
10
import org.springframework.beans.factory.annotation.Autowired;
-
 
11
import org.springframework.http.HttpHeaders;
-
 
12
import org.springframework.http.MediaType;
11
import org.springframework.stereotype.Component;
13
import org.springframework.stereotype.Component;
12
 
14
 
13
import com.fasterxml.jackson.core.JsonProcessingException;
15
import com.fasterxml.jackson.core.JsonProcessingException;
14
import com.fasterxml.jackson.databind.JsonNode;
16
import com.fasterxml.jackson.databind.JsonNode;
15
import com.fasterxml.jackson.databind.ObjectMapper;
17
import com.fasterxml.jackson.databind.ObjectMapper;
Line 49... Line 51...
49
	
51
	
50
	public Map<String, Object> process(Map<String, Object> map) throws ProfitMandiBusinessException{
52
	public Map<String, Object> process(Map<String, Object> map) throws ProfitMandiBusinessException{
51
		RestClient restClient = new RestClient(SchemeType.HTTPS, V1_HOST_NAME, PORT_NUMBER);
53
		RestClient restClient = new RestClient(SchemeType.HTTPS, V1_HOST_NAME, PORT_NUMBER);
52
		Map<String, String> params = new HashMap<>();
54
		Map<String, String> params = new HashMap<>();
53
		params.put(ProfitMandiConstants.ACCESS_TOKEN, map.get(ProfitMandiConstants.TOKEN).toString());
55
		params.put(ProfitMandiConstants.ACCESS_TOKEN, map.get(ProfitMandiConstants.TOKEN).toString());
-
 
56
		Map<String, String> headers = new HashMap<>(1);
-
 
57
		headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
54
		String responseString = restClient.get(V1_URI, params);
58
		String responseString = restClient.get(V1_URI, params, headers);
55
		try {
59
		try {
56
			JsonNode rootNode = objectMapper.readTree(responseString);
60
			JsonNode rootNode = objectMapper.readTree(responseString);
57
			SocialUser socialUser = new SocialUser();
61
			SocialUser socialUser = new SocialUser();
58
			if(rootNode.has("emails")){
62
			if(rootNode.has("emails")){
59
				JsonNode emails = rootNode.get("emails");
63
				JsonNode emails = rootNode.get("emails");
Line 119... Line 123...
119
	
123
	
120
	public Map<String, Object> getFofoDetail(String token) throws ProfitMandiBusinessException{
124
	public Map<String, Object> getFofoDetail(String token) throws ProfitMandiBusinessException{
121
		RestClient restClient = new RestClient(SchemeType.HTTPS, V3_HOST_NAME, PORT_NUMBER);
125
		RestClient restClient = new RestClient(SchemeType.HTTPS, V3_HOST_NAME, PORT_NUMBER);
122
		Map<String, String> params = new HashMap<>();
126
		Map<String, String> params = new HashMap<>();
123
		params.put(ProfitMandiConstants.ID_TOKEN, token);
127
		params.put(ProfitMandiConstants.ID_TOKEN, token);
-
 
128
		Map<String, String> headers = new HashMap<>(1);
-
 
129
		headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
124
		String responseString = restClient.get(V3_URI, params);
130
		String responseString = restClient.get(V3_URI, params, headers);
125
		try {
131
		try {
126
			JsonNode rootNode = objectMapper.readTree(responseString);
132
			JsonNode rootNode = objectMapper.readTree(responseString);
127
			try{
133
			try{
128
				User user = userRepository.selectByEmailId(rootNode.get("email").asText());
134
				User user = userRepository.selectByEmailId(rootNode.get("email").asText());
129
				Map<String, Object> responseMap = new HashMap<>(2);
135
				Map<String, Object> responseMap = new HashMap<>(2);