Subversion Repositories SmartDukaan

Rev

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

Rev 22664 Rev 22757
Line 20... Line 20...
20
import org.slf4j.Logger;
20
import org.slf4j.Logger;
21
import org.slf4j.LoggerFactory;
21
import org.slf4j.LoggerFactory;
22
import org.springframework.http.HttpHeaders;
22
import org.springframework.http.HttpHeaders;
23
import org.springframework.http.MediaType;
23
import org.springframework.http.MediaType;
24
 
24
 
-
 
25
import com.sendgrid.Content;
-
 
26
import com.sendgrid.Email;
-
 
27
import com.sendgrid.Mail;
-
 
28
import com.sendgrid.Method;
-
 
29
import com.sendgrid.Request;
-
 
30
import com.sendgrid.Response;
-
 
31
import com.sendgrid.SendGrid;
25
import com.spice.profitmandi.common.enumuration.SchemeType;
32
import com.spice.profitmandi.common.enumuration.SchemeType;
26
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
33
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
27
import com.spice.profitmandi.common.model.GstRate;
34
import com.spice.profitmandi.common.model.GstRate;
28
import com.spice.profitmandi.common.model.ProfitMandiConstants;
35
import com.spice.profitmandi.common.model.ProfitMandiConstants;
29
import com.spice.profitmandi.common.web.client.RestClient;
36
import com.spice.profitmandi.common.web.client.RestClient;
Line 55... Line 62...
55
	private static final Map<Integer, String> helpMap = new HashMap(6);
62
	private static final Map<Integer, String> helpMap = new HashMap(6);
56
	private static final Map<Integer, String> dthIdAliasMap = new HashMap(7);
63
	private static final Map<Integer, String> dthIdAliasMap = new HashMap(7);
57
	private static Map<Long, List<RechargePlan>> operatorPlanMap = new HashMap(20);
64
	private static Map<Long, List<RechargePlan>> operatorPlanMap = new HashMap(20);
58
	private static Map<Long, String> mobileProvidersMap;
65
	private static Map<Long, String> mobileProvidersMap;
59
	private static Map<Long, String> dthProvidersMap;
66
	private static Map<Long, String> dthProvidersMap;
60
	private static final String SMS_GATEWAY = "http://103.15.179.45:8085/SMSGateway/sendingSMS";
67
	//private static final String SMS_GATEWAY = "http://103.15.179.45:8085/SMSGateway/sendingSMS";
-
 
68
	private static final String SMS_GATEWAY = "http://103.15.179.45:8085/MessagingGateway/SendTransSMS";
61
	private static Map<Long, String> allProviders;
69
	private static Map<Long, String> allProviders;
62
	public static Map<RechargeOrderStatus, String> rechargeStatusMap = new HashMap();
70
	public static Map<RechargeOrderStatus, String> rechargeStatusMap = new HashMap();
63
	
71
	
64
	static {
72
	static {
65
		helpMap.put(Integer.valueOf(1), "Your VC number starts with 0 and is 11 digits long.");
73
		helpMap.put(Integer.valueOf(1), "Your VC number starts with 0 and is 11 digits long.");
Line 178... Line 186...
178
		return allProviders.get(operatorId);
186
		return allProviders.get(operatorId);
179
	}
187
	}
180
 
188
 
181
	public static void sendSms(String text, String mobileNumber) throws URISyntaxException, IOException{
189
	public static void sendSms(String text, String mobileNumber) throws URISyntaxException, IOException{
182
		URIBuilder generalSearchUrl = new URIBuilder(SMS_GATEWAY);
190
		URIBuilder generalSearchUrl = new URIBuilder(SMS_GATEWAY);
-
 
191
		generalSearchUrl.addParameter("Mobile", "91"+mobileNumber);
-
 
192
		generalSearchUrl.addParameter("Username", "srlsaholic");                  
-
 
193
		generalSearchUrl.addParameter("Password", "sr18mar"); 					  
-
 
194
		generalSearchUrl.addParameter("SenderID", "PROFTM");             			  
-
 
195
		generalSearchUrl.setParameter("Message", text);
-
 
196
		generalSearchUrl.setParameter("MessageType", "txt");
183
		generalSearchUrl.addParameter("ani", "91"+mobileNumber);
197
/*		generalSearchUrl.addParameter("ani", "91"+mobileNumber);
184
		generalSearchUrl.addParameter("uname", "srlsaholic");                  
198
		generalSearchUrl.addParameter("uname", "srlsaholic");                  
185
		generalSearchUrl.addParameter("passwd", "sr18mar"); 					  
199
		generalSearchUrl.addParameter("passwd", "sr18mar"); 					  
186
		generalSearchUrl.addParameter("cli", "PROFTM");             			  
200
		generalSearchUrl.addParameter("cli", "PROFTM");             			  
187
		generalSearchUrl.setParameter("message", text);
201
		generalSearchUrl.setParameter("message", text);
188
		URL url = generalSearchUrl.build().toURL();
202
*/		URL url = generalSearchUrl.build().toURL();
-
 
203
System.out.println(url);
189
		InputStream is = url.openStream();
204
		InputStream is = url.openStream();
190
		String response;
205
		String response;
191
		try{
206
		try{
192
			response = IOUtils.toString(is, "UTF-8");
207
			response = IOUtils.toString(is, "UTF-8");
193
			System.out.println("response sms gateway "+response);
208
			System.out.println("response sms gateway "+response);
194
		}
209
		}
195
		finally{
210
		finally{
196
			is.close();
211
			is.close();
197
		}
212
		}
198
	}
213
	}
-
 
214
	
-
 
215
	public static void sendMailWithAttachments(String email, String message, List<File> attachments){
-
 
216
		
-
 
217
	}
199
 
218
	
200
	public static String[] getOrderStatus(RechargeOrderStatus status){
219
	public static String[] getOrderStatus(RechargeOrderStatus status){
201
		if (status == null){
220
		if (status == null){
202
			status = RechargeOrderStatus.INIT;
221
			status = RechargeOrderStatus.INIT;
203
		}
222
		}
204
		if(status.equals(RechargeOrderStatus.PAYMENT_FAILED)||status.equals(RechargeOrderStatus.PAYMENT_PENDING)){
223
		if(status.equals(RechargeOrderStatus.PAYMENT_FAILED)||status.equals(RechargeOrderStatus.PAYMENT_PENDING)){
Line 349... Line 368...
349
		}catch (TException e) {
368
		}catch (TException e) {
350
			logger.error("Unable to register user." + e);
369
			logger.error("Unable to register user." + e);
351
			throw new ProfitMandiBusinessException(ProfitMandiConstants.EMAIL_ID, emailId, "");
370
			throw new ProfitMandiBusinessException(ProfitMandiConstants.EMAIL_ID, emailId, "");
352
		} 
371
		} 
353
	}
372
	}
-
 
373
	
-
 
374
	public static void main (String[] args) throws Exception{
-
 
375
		Utils.sendSms("Hello", "9990381569");
-
 
376
	}
354
}
377
}