Subversion Repositories SmartDukaan

Rev

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

Rev 28925 Rev 28987
Line 76... Line 76...
76
	private static final RestClient rc = new RestClient();
76
	private static final RestClient rc = new RestClient();
77
	private static final String regex = "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$";  
77
	private static final String regex = "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$";  
78
	public static final LocalTime MAX_TIME=LocalTime.of(23, 59, 59);
78
	public static final LocalTime MAX_TIME=LocalTime.of(23, 59, 59);
79
	//Compile regular expression to get the pattern  
79
	//Compile regular expression to get the pattern  
80
	private static final Pattern pattern = Pattern.compile(regex);  
80
	private static final Pattern pattern = Pattern.compile(regex);  
81
 
-
 
82
	public static SellerInfo getSellerInfoBySellerId(int sellerId) throws Exception {
-
 
83
		TransactionClient tcl = new TransactionClient();
-
 
84
		return tcl.getClient().getSellerInfo((long) sellerId);
-
 
85
	}
-
 
86
	
-
 
87
        
81
        
88
    public static boolean validateEmail(String email) {
82
    public static boolean validateEmail(String email) {
89
    	if(email== null) {
83
    	if(email== null) {
90
    		return false;
84
    		return false;
91
    	}
85
    	}
Line 412... Line 406...
412
			e.printStackTrace();
406
			e.printStackTrace();
413
			throw e;
407
			throw e;
414
		}
408
		}
415
	}
409
	}
416
 
410
 
417
	public static List<String> getAllStateNames() {
-
 
418
		List<String> sortedStateNames = new ArrayList<>();
-
 
419
		try {
-
 
420
			InventoryClient client = new InventoryClient();
-
 
421
			InventoryService.Client inventoryClient = client.getClient();
-
 
422
			Map<Long, StateInfo> map = inventoryClient.getStateMaster();
-
 
423
			List<StateInfo> stateInfos = new ArrayList<>(map.values());
-
 
424
			Set<String> stateNames = new TreeSet<>();
-
 
425
 
-
 
426
			for (StateInfo stateInfo : stateInfos) {
-
 
427
				stateNames.add(stateInfo.getStateName());
-
 
428
			}
-
 
429
			sortedStateNames = new ArrayList<>(stateNames);
-
 
430
			return sortedStateNames;
-
 
431
		} catch (Exception e) {
-
 
432
			e.printStackTrace();
-
 
433
			return sortedStateNames;
-
 
434
		}
-
 
435
	}
-
 
436
 
-
 
437
	public static Map<Long, StateInfo> getAllStatesMap() throws Exception {
-
 
438
		InventoryClient client = new InventoryClient();
-
 
439
		InventoryService.Client inventoryClient = client.getClient();
-
 
440
		return inventoryClient.getStateMaster();
-
 
441
 
-
 
442
	}
-
 
443
 
-
 
444
	public static User createSaholicUser(String emailId) throws ProfitMandiBusinessException {
-
 
445
		in.shop2020.model.v1.user.User user = new in.shop2020.model.v1.user.User();
-
 
446
		user.setEmail(emailId);
-
 
447
		user.setPassword("");
-
 
448
		user.setCommunicationEmail(emailId);
-
 
449
		user.setSex(Sex.WONT_SAY);
-
 
450
 
-
 
451
		try {
-
 
452
			UserClient userContextServiceClient = new UserClient();
-
 
453
			in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
-
 
454
			user = userClient.createUser(user);
-
 
455
			return user;
-
 
456
		} catch (UserContextException ux) {
-
 
457
			logger.error("Unable to register user: " + ux.getMessage());
-
 
458
			throw new ProfitMandiBusinessException(ProfitMandiConstants.EMAIL_ID, emailId, "");
-
 
459
		} catch (TTransportException e) {
-
 
460
			logger.error("Unable to register user." + e);
-
 
461
			throw new ProfitMandiBusinessException(ProfitMandiConstants.EMAIL_ID, emailId, "");
-
 
462
		} catch (TException e) {
-
 
463
			logger.error("Unable to register user." + e);
-
 
464
			throw new ProfitMandiBusinessException(ProfitMandiConstants.EMAIL_ID, emailId, "");
-
 
465
		}
-
 
466
	}
-
 
467
 
-
 
468
	public static void main(String[] args) throws Exception {
411
	public static void main(String[] args) throws Exception {
469
		Utils.sendSms("Hello", "9990381569");
412
		Utils.sendSms("Hello", "9990381569");
470
	}
413
	}
471
 
414
 
472
	public static WarehouseAddress getWarehouseByWarehouseId(int warehouseAddressId) throws Exception {
415
	public static WarehouseAddress getWarehouseByWarehouseId(int warehouseAddressId) throws Exception {