Subversion Repositories SmartDukaan

Rev

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

Rev 7200 Rev 7221
Line 303... Line 303...
303
    
303
    
304
    public void getOrderConfirmationMail() throws IOException, TException, ConfigException, TransactionServiceException {
304
    public void getOrderConfirmationMail() throws IOException, TException, ConfigException, TransactionServiceException {
305
    	TransactionClient transactionServiceClient = new TransactionClient();
305
    	TransactionClient transactionServiceClient = new TransactionClient();
306
    	order = transactionServiceClient.getClient().getOrder(orderId);
306
    	order = transactionServiceClient.getClient().getOrder(orderId);
307
    	long source = order.getTransactionId();
307
    	long source = order.getTransactionId();
308
    	String helper_service_server=ConfigClient.getClient().get("helper_service_server");
-
 
309
    	String helper_service_server_port=ConfigClient.getClient().get("helper_service_server_port");
-
 
310
    	HelperClient helperClient = new HelperClient(helper_service_server,helper_service_server_port);
308
    	HelperClient helperClient = new HelperClient("helper_service_server","helper_service_server_port");
311
    	String mail = helperClient.getClient().getOrderConfirmationMail(source);
309
    	String mail = helperClient.getClient().getOrderConfirmationMail(source);
-
 
310
    	File file = new File("/tmp/temp");
-
 
311
    	
-
 
312
    	FileWriter writer = new FileWriter(file);
-
 
313
    	writer.append(mail);
-
 
314
    	writer.close();
-
 
315
 
-
 
316
    	byte[] buffer = new byte[(int)file.length()];
-
 
317
        InputStream input = null;
-
 
318
    	try {
-
 
319
            int totalBytesRead = 0;
-
 
320
            input = new BufferedInputStream(new FileInputStream(file));
-
 
321
            while(totalBytesRead < buffer.length){
-
 
322
                int bytesRemaining = buffer.length - totalBytesRead;
-
 
323
                int bytesRead = input.read(buffer, totalBytesRead, bytesRemaining); 
-
 
324
                if (bytesRead > 0){
-
 
325
                    totalBytesRead = totalBytesRead + bytesRead;
-
 
326
                }
-
 
327
            }
-
 
328
        }
-
 
329
        finally {
-
 
330
            input.close();
-
 
331
            file.delete();
-
 
332
        }
-
 
333
    	
-
 
334
    	
-
 
335
    	response.setHeader("Content-disposition", "inline; filename=" + "OrderDetail_"+orderId );
-
 
336
 
-
 
337
        ServletOutputStream sos;
-
 
338
        try {
-
 
339
            sos = response.getOutputStream();
-
 
340
            sos.write(buffer);
-
 
341
            sos.flush();
-
 
342
        } catch (IOException e) {
-
 
343
            System.out.println("Unable to stream the manifest file");
-
 
344
        }   
-
 
345
    }
-
 
346
    
-
 
347
    public void getOrderDeliveryMail() throws IOException, TException, ConfigException, TransactionServiceException {
-
 
348
    	HelperClient helperClient = new HelperClient("helper_service_server","helper_service_server_port");
-
 
349
    	String mail = helperClient.getClient().getOrderDeliveryMail(orderId);
312
    	File file = new File("temp");
350
    	File file = new File("/tmp/temp");
313
    	
351
    	
314
    	FileWriter writer = new FileWriter(file);
352
    	FileWriter writer = new FileWriter(file);
315
    	writer.append(mail);
353
    	writer.append(mail);
316
    	writer.close();
354
    	writer.close();
317
 
355