Subversion Repositories SmartDukaan

Rev

Rev 894 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 894 Rev 907
Line 183... Line 183...
183
				transaction = transactionClient.getTransaction(txnId);
183
				transaction = transactionClient.getTransaction(txnId);
184
				for(Order order: transaction.getOrders()){
184
				for(Order order: transaction.getOrders()){
185
					for(LineItem lineitem: order.getLineitems()){
185
					for(LineItem lineitem: order.getLineitems()){
186
						Long itemId = lineitem.getItem_id();
186
						Long itemId = lineitem.getItem_id();
187
						Double quantity = items.get(itemId);
187
						Double quantity = items.get(itemId);
188
						if(quantity!=null)
188
						if(quantity==null){
-
 
189
							quantity = lineitem.getQuantity();
-
 
190
						}
-
 
191
						else{
189
							quantity = quantity + lineitem.getQuantity();
192
							quantity= quantity + lineitem.getQuantity();
-
 
193
						}
190
						items.put(itemId, quantity);
194
						items.put(itemId, quantity);
191
					}
195
					}
192
				}	
196
				}	
193
			} catch (PaymentException e1) {
197
			} catch (PaymentException e1) {
194
				log.error("Unable to get transaction id from payment service." + e1.getError_code() + e1.getMessage());
198
				log.error("Unable to get transaction id from payment service." + e1.getError_code() + e1.getMessage());
Line 203... Line 207...
203
			
207
			
204
			
208
			
205
			
209
			
206
			try {
210
			try {
207
				//TODO Optimize the function to send less number of data over network
211
				//TODO Optimize the function to send less number of data over network
-
 
212
				System.out.println("Transaction shopping cart id is: " + transaction.getShoppingCartid());
-
 
213
				System.out.println("Items to restr in cart are: " + items );
-
 
214
				log.info("Transaction shopping cart id is: " + transaction.getShoppingCartid());
-
 
215
				log.info("Items to restr in cart are: " + items );
208
				userServiceClient.getClient().resetCart(transaction.getShoppingCartid(), items);	
216
				userServiceClient.getClient().resetCart(transaction.getShoppingCartid(), items);	
209
			}catch (TException e) {
217
			}catch (TException e) {
210
				log.error("Error while updating information in payment database.");
218
				log.error("Error while updating information in payment database.");
211
				e.printStackTrace();
219
				e.printStackTrace();
212
				//FIXME Even we get exception we should sent url back to payment gateway. And some thing back channel should be done
220
				//FIXME Even we get exception we should sent url back to payment gateway. And some thing back channel should be done