Subversion Repositories SmartDukaan

Rev

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

Rev 3101 Rev 3126
Line 9... Line 9...
9
import in.shop2020.serving.services.CommonPaymentService;
9
import in.shop2020.serving.services.CommonPaymentService;
10
import in.shop2020.serving.services.EbsPaymentService;
10
import in.shop2020.serving.services.EbsPaymentService;
11
import in.shop2020.serving.services.HdfcPaymentService;
11
import in.shop2020.serving.services.HdfcPaymentService;
12
import in.shop2020.serving.services.IPaymentService;
12
import in.shop2020.serving.services.IPaymentService;
13
import in.shop2020.serving.utils.DesEncrypter;
13
import in.shop2020.serving.utils.DesEncrypter;
14
import in.shop2020.thrift.clients.LogisticsServiceClient;
14
import in.shop2020.thrift.clients.LogisticsClient;
15
import in.shop2020.thrift.clients.TransactionServiceClient;
15
import in.shop2020.thrift.clients.TransactionClient;
16
import in.shop2020.thrift.clients.UserContextServiceClient;
16
import in.shop2020.thrift.clients.UserClient;
17
import in.shop2020.utils.DataLogger;
17
import in.shop2020.utils.DataLogger;
18
 
18
 
19
import java.util.List;
19
import java.util.List;
20
import java.util.ResourceBundle;
20
import java.util.ResourceBundle;
21
 
21
 
Line 104... Line 104...
104
    	        addActionError("Invalid captcha");
104
    	        addActionError("Invalid captcha");
105
    	        return "proceed-to-pay-redirect";    
105
    	        return "proceed-to-pay-redirect";    
106
    	    }
106
    	    }
107
    	    
107
    	    
108
    	    //Check that this address is eligible for COD shipping.
108
    	    //Check that this address is eligible for COD shipping.
109
    	    UserContextServiceClient userServiceClient = null;
109
    	    UserClient userServiceClient = null;
110
            try {
110
            try {
111
                userServiceClient = new UserContextServiceClient();
111
                userServiceClient = new UserClient();
112
                in.shop2020.model.v1.user.UserContextService.Client userClient = userServiceClient.getClient();
112
                in.shop2020.model.v1.user.UserContextService.Client userClient = userServiceClient.getClient();
113
                Address address = userClient.getAddressById(addressId);
113
                Address address = userClient.getAddressById(addressId);
114
                
114
                
115
                LogisticsServiceClient logisticsServiceClient = new LogisticsServiceClient();
115
                LogisticsClient logisticsServiceClient = new LogisticsClient();
116
                if(!logisticsServiceClient.getClient().isCodAllowed(address.getPin())){
116
                if(!logisticsServiceClient.getClient().isCodAllowed(address.getPin())){
117
                    addActionError("Cash on Delivery is currently not available for this pincode. Please choose a different payment option.");
117
                    addActionError("Cash on Delivery is currently not available for this pincode. Please choose a different payment option.");
118
                    return "proceed-to-pay-redirect";    
118
                    return "proceed-to-pay-redirect";    
119
                }
119
                }
120
            } catch (Exception e) {
120
            } catch (Exception e) {
Line 226... Line 226...
226
	 * @param addressId
226
	 * @param addressId
227
	 * @param currentCartId
227
	 * @param currentCartId
228
	 * @return
228
	 * @return
229
	 */
229
	 */
230
	private boolean createOrders(long addressId, long currentCartId){
230
	private boolean createOrders(long addressId, long currentCartId){
231
		UserContextServiceClient userServiceClient = null;
231
		UserClient userServiceClient = null;
232
		try {
232
		try {
233
			userServiceClient = new UserContextServiceClient();
233
			userServiceClient = new UserClient();
234
		} catch (Exception e) {
234
		} catch (Exception e) {
235
			log.error("Unable to talk to the user context service.", e);
235
			log.error("Unable to talk to the user context service.", e);
236
			return false;
236
			return false;
237
		}
237
		}
238
		
238
		
Line 287... Line 287...
287
		} catch (TException e) {
287
		} catch (TException e) {
288
			log.error("Thrift exception while creating orders from cart.", e);
288
			log.error("Thrift exception while creating orders from cart.", e);
289
			return false;
289
			return false;
290
		}
290
		}
291
		
291
		
292
		TransactionServiceClient transactionServiceClient = null;
292
		TransactionClient transactionServiceClient = null;
293
        try {
293
        try {
294
            transactionServiceClient = new TransactionServiceClient();
294
            transactionServiceClient = new TransactionClient();
295
            List<Order> orders = transactionServiceClient.getClient().getOrdersForTransaction(txnId, userinfo.getUserId());
295
            List<Order> orders = transactionServiceClient.getClient().getOrdersForTransaction(txnId, userinfo.getUserId());
296
            for (Order order : orders) {
296
            for (Order order : orders) {
297
                DataLogger.logData(EventType.ORDER_CREATION, session.getId(),
297
                DataLogger.logData(EventType.ORDER_CREATION, session.getId(),
298
                        userinfo.getUserId(), userinfo.getEmail(), Long.toString(order.getId()));
298
                        userinfo.getUserId(), userinfo.getEmail(), Long.toString(order.getId()));
299
            }
299
            }