Subversion Repositories SmartDukaan

Rev

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

Rev 24593 Rev 25743
Line 292... Line 292...
292
		}
292
		}
293
		InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "SmartDukaan Care");
293
		InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "SmartDukaan Care");
294
		helper.setFrom(senderAddress);
294
		helper.setFrom(senderAddress);
295
		mailSender.send(message);
295
		mailSender.send(message);
296
	}
296
	}
-
 
297
	
-
 
298
	public static void sendHtmlMailWithAttachments(JavaMailSender mailSender, String[] emailTo, String[] cc, String subject,
-
 
299
			String body, Attachment... attachments) throws Exception {
-
 
300
		MimeMessage message = mailSender.createMimeMessage();
-
 
301
		MimeMessageHelper helper = new MimeMessageHelper(message, true);
-
 
302
		helper.setSubject(subject);
-
 
303
		helper.setText(body, true);
-
 
304
		if (cc != null) {
-
 
305
			helper.setCc(cc);
-
 
306
		}
-
 
307
		helper.setTo(emailTo);
-
 
308
		for(Attachment attachment: attachments ) {
-
 
309
			helper.addAttachment(attachment.getFileName(), attachment.getInputStreamSource());
-
 
310
		}
-
 
311
		InternetAddress senderAddress = new InternetAddress("noreply@smartdukaan.com", "SmartDukaan Care");
-
 
312
		helper.setFrom(senderAddress);
-
 
313
		mailSender.send(message);
-
 
314
	}
297
 
315
 
298
	public static String[] getOrderStatus(RechargeOrderStatus status) {
316
	public static String[] getOrderStatus(RechargeOrderStatus status) {
299
		if (status == null) {
317
		if (status == null) {
300
			status = RechargeOrderStatus.INIT;
318
			status = RechargeOrderStatus.INIT;
301
		}
319
		}
Line 328... Line 346...
328
			return new String[] { "true", "ERROR", "INVALID INPUT" };
346
			return new String[] { "true", "ERROR", "INVALID INPUT" };
329
		}
347
		}
330
	}
348
	}
331
 
349
 
332
	public static String getIconUrl(int entityId, String host, int port, String webapp) {
350
	public static String getIconUrl(int entityId, String host, int port, String webapp) {
333
		RestClient rc = new RestClient();
-
 
334
		Map<String, String> params = new HashMap<String, String>();
-
 
335
		String response = null;
-
 
336
		String uri = webapp + "/entity/" + entityId;
-
 
337
		Map<String, String> headers = new HashMap<>(1);
-
 
338
		headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
-
 
339
		try {
-
 
340
			response = rc.get(SchemeType.HTTP, host, port, uri, params, headers);
-
 
341
		} catch (Throwable e) {
-
 
342
			// TODO Auto-generated catch block
-
 
343
			e.printStackTrace();
-
 
344
			return "";
351
		return "";
345
		}
-
 
346
		JSONObject obj = new JSONObject(response);
-
 
347
		String iconUrl = null;
-
 
348
		try {
-
 
349
			iconUrl = obj.getJSONObject("entity").getString("iconImageUrl");
-
 
350
		} catch (Exception e) {
-
 
351
			return "";
-
 
352
		}
-
 
353
		return iconUrl == null ? "" : iconUrl;
-
 
354
	}
352
	}
355
	
353
	
356
	public static Map<Integer, GstRate> getStateTaxRate(List<Integer> itemIds, int stateId) throws ProfitMandiBusinessException{
354
	public static Map<Integer, GstRate> getStateTaxRate(List<Integer> itemIds, int stateId) throws ProfitMandiBusinessException{
357
		List<Long> longItemIds = new ArrayList<>();
355
		List<Long> longItemIds = new ArrayList<>();
358
		for(int itemId : itemIds){
356
		for(int itemId : itemIds){