Subversion Repositories SmartDukaan

Rev

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

Rev 4396 Rev 4401
Line 60... Line 60...
60
	
60
	
61
	private long paymentId;
61
	private long paymentId;
62
	
62
	
63
	private String redirectURL;
63
	private String redirectURL;
64
	
64
	
65
	private double totalAmount;
-
 
66
	
-
 
67
	public OrderController(){
65
	public OrderController(){
68
		super();
66
		super();
69
	}
67
	}
70
	
68
	
71
    // GET /order/ orderid
69
    // GET /order/ orderid
Line 162... Line 160...
162
                this.redirectURL = ((HdfcEmiPaymentService)hdfcEmiPaymentService).getRedirectUrl();
160
                this.redirectURL = ((HdfcEmiPaymentService)hdfcEmiPaymentService).getRedirectUrl();
163
                log.info(this.redirectURL);
161
                log.info(this.redirectURL);
164
                return "success";
162
                return "success";
165
            }
163
            }
166
    	} else {
164
    	} else {
167
    		//FIXME Remove the hardcoding
-
 
168
    		
-
 
169
            if( totalAmount > 100 && (paymentOption.equals(IPaymentService.HDFC_MASTERCARD) || paymentOption.equals(IPaymentService.HDFC_VISA) || paymentOption.equals(IPaymentService.HDFC_VISA_ELECTRON))) {
165
    		if(paymentOption.equals(IPaymentService.HDFC_MASTERCARD) || paymentOption.equals(IPaymentService.HDFC_VISA) || paymentOption.equals(IPaymentService.HDFC_VISA_ELECTRON)) {
170
                // User has selected Visa or MasterCard CC
166
                // User has selected Visa or MasterCard CC
171
                IPaymentService hdfcPaymentService = new HdfcPaymentService();
167
                IPaymentService hdfcPaymentService = new HdfcPaymentService();
172
                paymentId = hdfcPaymentService.createPayment(userinfo.getCartId(), userinfo.getUserId(), txnId, paymentOption, sourceId);
168
                paymentId = hdfcPaymentService.createPayment(userinfo.getCartId(), userinfo.getUserId(), txnId, paymentOption, sourceId);
173
                if (paymentId == IPaymentService.PAYMENT_NOT_CREATED) {
169
                if (paymentId == IPaymentService.PAYMENT_NOT_CREATED) {
174
                    log.error("Unable to process payment through HDFC. Falling through to EBS.");
170
                    log.error("Unable to process payment through HDFC. Falling through to EBS.");
Line 310... Line 306...
310
        try {
306
        try {
311
            transactionServiceClient = new TransactionClient();
307
            transactionServiceClient = new TransactionClient();
312
            List<Order> orders = transactionServiceClient.getClient().getOrdersForTransaction(txnId, userinfo.getUserId());
308
            List<Order> orders = transactionServiceClient.getClient().getOrdersForTransaction(txnId, userinfo.getUserId());
313
            for (Order order : orders) {
309
            for (Order order : orders) {
314
                List<Order> tmpOrders = new ArrayList<Order>();
310
                List<Order> tmpOrders = new ArrayList<Order>();
315
                //FIXME Remove hardcoding
-
 
316
                totalAmount = totalAmount + order.getTotal_amount();
-
 
317
                tmpOrders.add(order);
311
                tmpOrders.add(order);
318
                String itemIdString = Utils.getItemIdStringFromOrders(tmpOrders);
312
                String itemIdString = Utils.getItemIdStringFromOrders(tmpOrders);
319
                DataLogger.logData(EventType.ORDER_CREATION, getSessionId(), userinfo.getUserId(), userinfo.getEmail(), 
313
                DataLogger.logData(EventType.ORDER_CREATION, getSessionId(), userinfo.getUserId(), userinfo.getEmail(), 
320
                        Long.toString(order.getId()), Long.toString(currentCartId), itemIdString);
314
                        Long.toString(order.getId()), Long.toString(currentCartId), itemIdString);
321
            }
315
            }