Subversion Repositories SmartDukaan

Rev

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

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