Subversion Repositories SmartDukaan

Rev

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

Rev 22215 Rev 22351
Line 12... Line 12...
12
import java.util.Map;
12
import java.util.Map;
13
 
13
 
14
import org.apache.commons.io.FileUtils;
14
import org.apache.commons.io.FileUtils;
15
import org.apache.commons.io.IOUtils;
15
import org.apache.commons.io.IOUtils;
16
import org.apache.http.client.utils.URIBuilder;
16
import org.apache.http.client.utils.URIBuilder;
-
 
17
import org.apache.thrift.TException;
-
 
18
import org.apache.thrift.transport.TTransportException;
17
import org.json.JSONObject;
19
import org.json.JSONObject;
18
import org.slf4j.Logger;
20
import org.slf4j.Logger;
19
import org.slf4j.LoggerFactory;
21
import org.slf4j.LoggerFactory;
20
import org.springframework.http.HttpHeaders;
22
import org.springframework.http.HttpHeaders;
21
import org.springframework.http.MediaType;
23
import org.springframework.http.MediaType;
22
 
24
 
23
import com.spice.profitmandi.common.enumuration.SchemeType;
25
import com.spice.profitmandi.common.enumuration.SchemeType;
24
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
26
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
25
import com.spice.profitmandi.common.model.GstRate;
27
import com.spice.profitmandi.common.model.GstRate;
-
 
28
import com.spice.profitmandi.common.model.ProfitMandiConstants;
26
import com.spice.profitmandi.common.web.client.RestClient;
29
import com.spice.profitmandi.common.web.client.RestClient;
27
import com.spice.profitmandi.thrift.clients.CatalogClient;
30
import com.spice.profitmandi.thrift.clients.CatalogClient;
28
import com.spice.profitmandi.thrift.clients.InventoryClient;
31
import com.spice.profitmandi.thrift.clients.InventoryClient;
29
import com.spice.profitmandi.thrift.clients.TransactionClient;
32
import com.spice.profitmandi.thrift.clients.TransactionClient;
-
 
33
import com.spice.profitmandi.thrift.clients.UserClient;
30
import com.spice.profitmandi.thrift.clients.config.ConfigClient;
34
import com.spice.profitmandi.thrift.clients.config.ConfigClient;
31
 
35
 
32
import in.shop2020.model.v1.catalog.CatalogService;
36
import in.shop2020.model.v1.catalog.CatalogService;
33
import in.shop2020.model.v1.catalog.StateGstRates;
37
import in.shop2020.model.v1.catalog.StateGstRates;
34
import in.shop2020.model.v1.inventory.InventoryService;
38
import in.shop2020.model.v1.inventory.InventoryService;
35
import in.shop2020.model.v1.inventory.StateInfo;
39
import in.shop2020.model.v1.inventory.StateInfo;
36
import in.shop2020.model.v1.order.RechargeOrderStatus;
40
import in.shop2020.model.v1.order.RechargeOrderStatus;
37
import in.shop2020.model.v1.order.RechargePlan;
41
import in.shop2020.model.v1.order.RechargePlan;
38
import in.shop2020.model.v1.order.RechargeType;
42
import in.shop2020.model.v1.order.RechargeType;
-
 
43
import in.shop2020.model.v1.user.Sex;
-
 
44
import in.shop2020.model.v1.user.User;
-
 
45
import in.shop2020.model.v1.user.UserContextException;
39
 
46
 
40
 
47
 
41
 
48
 
42
public class Utils {
49
public class Utils {
43
 
50
 
Line 316... Line 323...
316
		}catch (Exception e) {
323
		}catch (Exception e) {
317
			e.printStackTrace();
324
			e.printStackTrace();
318
			throw e;
325
			throw e;
319
		}
326
		}
320
	}
327
	}
-
 
328
	
-
 
329
	public static User createSaholicUser(String emailId) throws ProfitMandiBusinessException{
-
 
330
		in.shop2020.model.v1.user.User user = new in.shop2020.model.v1.user.User();
-
 
331
		user.setEmail(emailId);
-
 
332
		user.setPassword("");
-
 
333
		user.setCommunicationEmail(emailId);
-
 
334
		user.setSex(Sex.WONT_SAY);
-
 
335
 
-
 
336
		try {
-
 
337
			UserClient userContextServiceClient = new UserClient();
-
 
338
			in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
-
 
339
			user = userClient.createUser(user);
-
 
340
			return user;
-
 
341
		}catch (UserContextException ux){
-
 
342
			logger.error("Unable to register user: " + ux.getMessage());
-
 
343
			throw new ProfitMandiBusinessException(ProfitMandiConstants.EMAIL_ID, emailId, "");
-
 
344
		} catch (TTransportException e) {
-
 
345
			logger.error("Unable to register user." + e);
-
 
346
			throw new ProfitMandiBusinessException(ProfitMandiConstants.EMAIL_ID, emailId, "");
-
 
347
		}catch (TException e) {
-
 
348
			logger.error("Unable to register user." + e);
-
 
349
			throw new ProfitMandiBusinessException(ProfitMandiConstants.EMAIL_ID, emailId, "");
-
 
350
		} 
-
 
351
	}
321
}
352
}