Subversion Repositories SmartDukaan

Rev

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

Rev 12601 Rev 13208
Line 98... Line 98...
98
 * @author vikas
98
 * @author vikas
99
 * 
99
 * 
100
 */
100
 */
101
@SuppressWarnings("serial")
101
@SuppressWarnings("serial")
102
public class UserOrderInfoController extends BaseController {
102
public class UserOrderInfoController extends BaseController {
103
	private static Logger                  log                     = Logger.getLogger(Class.class);
103
    private static Logger                  log                     = Logger.getLogger(Class.class);
104
	private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
104
    private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
105
	private static AramexTrackingService aramexTrackingService     = new AramexTrackingService();
105
    private static AramexTrackingService aramexTrackingService     = new AramexTrackingService();
106
	private static DelhiveryTrackingService delhiveryTrackingService     = new DelhiveryTrackingService();
106
    private static DelhiveryTrackingService delhiveryTrackingService     = new DelhiveryTrackingService();
107
	private static RedExpressTrackingService redexpressTrackingService = new RedExpressTrackingService();
107
    private static RedExpressTrackingService redexpressTrackingService = new RedExpressTrackingService();
108
	private FedExTrackingService fedexTrackingService;
108
    private FedExTrackingService fedexTrackingService;
109
	
109
 
110
	private long                 orderId;
110
    private long                 orderId;
111
	private Order                order;
111
    private Order                order;
112
	private List<Payment>        payments;
112
    private List<Payment>        payments;
113
	private List<ShipmentUpdate> shipmentUpdates = new ArrayList<ShipmentUpdate>();
113
    private List<ShipmentUpdate> shipmentUpdates = new ArrayList<ShipmentUpdate>();
114
	private Long                 codTicketId;
114
    private Long                 codTicketId;
115
	private List<Address>        addresses;
115
    private List<Address>        addresses;
116
	private Set<OrderStatus>     setOfcancellableStates;
116
    private Set<OrderStatus>     setOfcancellableStates;
117
	//Start:- Added by Manish Sharma for Physical Refunds 
117
    //Start:- Added by Manish Sharma for Physical Refunds 
118
	private Set<OrderStatus>	 setOfrefundableStates;
118
    private Set<OrderStatus>	 setOfrefundableStates;
119
	private Set<OrderStatus>	 setOfprepaidrefundableStates;
119
    private Set<OrderStatus>	 setOfprepaidrefundableStates;
120
	//End:- Added by Manish Sharma for Physical Refunds
120
    //End:- Added by Manish Sharma for Physical Refunds
121
	private String               cancellationInitiator;
121
    private String               cancellationInitiator;
122
	private String               cancelReason;
122
    private String               cancelReason;
123
	private String               body;
123
    private String               body;
124
	private String               line1;
124
    private String               line1;
125
	private String               line2;
125
    private String               line2;
126
	private String               city;
126
    private String               city;
127
	private String               state;
127
    private String               state;
128
	private String               pin;
128
    private String               pin;
129
	private String				 freebieItem;
129
    private String				 freebieItem;
130
	private String				 dealText;
130
    private String				 dealText;
131
	private String 				 parentOrderIdForFreebieOrder;
131
    private String 				 parentOrderIdForFreebieOrder;
132
	private String				 freebieOrderId;
132
    private String				 freebieOrderId;
133
	private double               cashAmount;
133
    private double               cashAmount;
134
	private double               cardAmount;
134
    private double               cardAmount;
135
    private StoreOrderDetail     storeOrderDetail;
135
    private StoreOrderDetail     storeOrderDetail;
136
    //Start:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
136
    //Start:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
137
    private AmazonOrder          amazonOrder = null;
137
    private AmazonOrder          amazonOrder = null;
138
    private String               providerName = "N/A";
138
    private String               providerName = "N/A";
139
    //End:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
139
    //End:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
Line 144... Line 144...
144
    private String               refundAmountCoupon;
144
    private String               refundAmountCoupon;
145
    private String               chequeDetails;
145
    private String               chequeDetails;
146
    private String               refundAmountCheque;
146
    private String               refundAmountCheque;
147
    private String 			     refundAmountGateway;
147
    private String 			     refundAmountGateway;
148
    private String			     comments;
148
    private String			     comments;
149
    
149
 
150
    private String 				 errorMsg = "";
150
    private String 				 errorMsg = "";
151
	private String 				 successmsg = "";
151
    private String 				 successmsg = "";
152
	
152
 
153
	private List<String>         refundDetails;
153
    private List<String>         refundDetails;
-
 
154
    
154
	//End:- Added by Manish Sharma for Physical Refunds 
155
    private String               billingWarehouseName="";
155
 
156
 
156
	public UserOrderInfoController() {
157
    public UserOrderInfoController() {
157
		super();
158
        super();
158
		setOfcancellableStates = new HashSet<OrderStatus>();
159
        setOfcancellableStates = new HashSet<OrderStatus>();
159
		setOfcancellableStates.add(OrderStatus.SUBMITTED_FOR_PROCESSING);
160
        setOfcancellableStates.add(OrderStatus.SUBMITTED_FOR_PROCESSING);
160
		setOfcancellableStates.add(OrderStatus.INVENTORY_LOW);
161
        setOfcancellableStates.add(OrderStatus.INVENTORY_LOW);
161
		setOfcancellableStates.add(OrderStatus.LOW_INV_PO_RAISED);
162
        setOfcancellableStates.add(OrderStatus.LOW_INV_PO_RAISED);
162
		setOfcancellableStates.add(OrderStatus.LOW_INV_REVERSAL_IN_PROCESS);
163
        setOfcancellableStates.add(OrderStatus.LOW_INV_REVERSAL_IN_PROCESS);
163
		setOfcancellableStates.add(OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT);
164
        setOfcancellableStates.add(OrderStatus.LOW_INV_NOT_AVAILABLE_AT_HOTSPOT);
164
		setOfcancellableStates.add(OrderStatus.ACCEPTED);
165
        setOfcancellableStates.add(OrderStatus.ACCEPTED);
165
		setOfcancellableStates.add(OrderStatus.BILLED);
166
        setOfcancellableStates.add(OrderStatus.BILLED);
166
		
167
 
167
		//Start:- Added by Manish Sharma for Physical Refunds 
168
        //Start:- Added by Manish Sharma for Physical Refunds 
168
		setOfrefundableStates = new HashSet<OrderStatus>();
169
        setOfrefundableStates = new HashSet<OrderStatus>();
169
		setOfrefundableStates.add(OrderStatus.DOA_VALID_REFUNDED);
170
        setOfrefundableStates.add(OrderStatus.DOA_VALID_REFUNDED);
170
		setOfrefundableStates.add(OrderStatus.DOA_INVALID_REFUNDED);
171
        setOfrefundableStates.add(OrderStatus.DOA_INVALID_REFUNDED);
171
		setOfrefundableStates.add(OrderStatus.DOA_REFUNDED_RCVD_DAMAGED);
172
        setOfrefundableStates.add(OrderStatus.DOA_REFUNDED_RCVD_DAMAGED);
172
		setOfrefundableStates.add(OrderStatus.DOA_REFUNDED_LOST_IN_TRANSIT);
173
        setOfrefundableStates.add(OrderStatus.DOA_REFUNDED_LOST_IN_TRANSIT);
173
		setOfrefundableStates.add(OrderStatus.RTO_DAMAGED_REFUNDED);
174
        setOfrefundableStates.add(OrderStatus.RTO_DAMAGED_REFUNDED);
174
		setOfrefundableStates.add(OrderStatus.RET_PRODUCT_USABLE_REFUNDED);
175
        setOfrefundableStates.add(OrderStatus.RET_PRODUCT_USABLE_REFUNDED);
175
		setOfrefundableStates.add(OrderStatus.RET_PRODUCT_UNUSABLE_REFUNDED);
176
        setOfrefundableStates.add(OrderStatus.RET_PRODUCT_UNUSABLE_REFUNDED);
176
		setOfrefundableStates.add(OrderStatus.RET_REFUNDED_RCVD_DAMAGED);
177
        setOfrefundableStates.add(OrderStatus.RET_REFUNDED_RCVD_DAMAGED);
177
		setOfrefundableStates.add(OrderStatus.RET_REFUNDED_LOST_IN_TRANSIT);
178
        setOfrefundableStates.add(OrderStatus.RET_REFUNDED_LOST_IN_TRANSIT);
178
		//End:- Added by Manish Sharma for Physical Refunds 
179
        //End:- Added by Manish Sharma for Physical Refunds 
179
		
180
 
180
		setOfprepaidrefundableStates = new HashSet<OrderStatus>();
181
        setOfprepaidrefundableStates = new HashSet<OrderStatus>();
181
		setOfprepaidrefundableStates.add(OrderStatus.RTO_REFUNDED);
182
        setOfprepaidrefundableStates.add(OrderStatus.RTO_REFUNDED);
182
		setOfprepaidrefundableStates.add(OrderStatus.RTO_LOST_IN_TRANSIT_REFUNDED);
183
        setOfprepaidrefundableStates.add(OrderStatus.RTO_LOST_IN_TRANSIT_REFUNDED);
183
		setOfprepaidrefundableStates.add(OrderStatus.LOST_IN_TRANSIT_REFUNDED);
184
        setOfprepaidrefundableStates.add(OrderStatus.LOST_IN_TRANSIT_REFUNDED);
184
		setOfprepaidrefundableStates.add(OrderStatus.CANCELLED_ON_CUSTOMER_REQUEST);
185
        setOfprepaidrefundableStates.add(OrderStatus.CANCELLED_ON_CUSTOMER_REQUEST);
185
		setOfprepaidrefundableStates.add(OrderStatus.CANCELLED_DUE_TO_LOW_INVENTORY);
186
        setOfprepaidrefundableStates.add(OrderStatus.CANCELLED_DUE_TO_LOW_INVENTORY);
186
		
187
 
187
		
188
 
188
	}
189
    }
189
	
190
 
190
	public static final Map<Long, String> providerNameMap = new HashMap<Long, String>() {
191
    public static final Map<Long, String> providerNameMap = new HashMap<Long, String>() {
191
        {
192
        {
192
            put(1l, "BlueDart");
193
            put(1l, "BlueDart");
193
            put(2l, "Aramex");
194
            put(2l, "Aramex");
194
            put(3l, "Delhivery");
195
            put(3l, "Delhivery");
195
            put(4l, "SelfPickup");
196
            put(4l, "SelfPickup");
196
            put(5l, "Runner");
197
            put(5l, "Runner");
197
            put(6l, "RedExpress");
198
            put(6l, "RedExpress");
198
            put(7l, "FedEx");
199
            put(7l, "FedEx");
199
        }
200
        }
200
	};
201
    };
-
 
202
 
201
	
203
 
-
 
204
    public static final Map<Long,String> billingWarehouseMap = new HashMap<Long, String>() {
-
 
205
        { 
-
 
206
            put(7l, "Mahipalpur-MMX");
-
 
207
            put(12l, "Goregaon");
-
 
208
            put(13l, "Bhiwandi");
-
 
209
            put(1765l, "Bangalore");
-
 
210
            put(1768l, "Bangalore - SR");
-
 
211
            put(3298l, "TG-SORPL/Hyderabad");
-
 
212
            put(3931l, "HR-SORPL/Gurgaon-S");
-
 
213
        }
-
 
214
    };
-
 
215
 
202
	public String index() {
216
    public String index() {
203
		try {
217
        try {
204
			PaymentClient paymentServiceClient = new PaymentClient();
218
            PaymentClient paymentServiceClient = new PaymentClient();
205
			TransactionClient transactionServiceClient = new TransactionClient();
219
            TransactionClient transactionServiceClient = new TransactionClient();
206
			LogisticsClient logisticsServiceClient = new LogisticsClient();
220
            LogisticsClient logisticsServiceClient = new LogisticsClient();
207
			
221
 
208
			/*List<Provider> providerList = logisticsServiceClient.getClient().getAllProviders();
222
            /*List<Provider> providerList = logisticsServiceClient.getClient().getAllProviders();
209
			Map<Long, String> providerNameMap = new HashMap<Long, String>();
223
			Map<Long, String> providerNameMap = new HashMap<Long, String>();
210
			for(Provider provider : providerList){
224
			for(Provider provider : providerList){
211
				providerNameMap.put(provider.getId(), provider.getName());
225
				providerNameMap.put(provider.getId(), provider.getName());
212
			}*/
226
			}*/
213
			order = transactionServiceClient.getClient().getOrder(orderId);
227
            order = transactionServiceClient.getClient().getOrder(orderId);
-
 
228
            
-
 
229
            if (billingWarehouseMap.containsKey(order.getWarehouse_id()) && order.getWarehouse_id()!=0){
-
 
230
                setBillingWarehouseName(billingWarehouseMap.get(order.getWarehouse_id()));
-
 
231
            }
-
 
232
            
214
			Warehouse warehouse;
233
            Warehouse warehouse;
215
			if (order.getLogistics_provider_id() == 7){
234
            if (order.getLogistics_provider_id() == 7){
216
				warehouse = getWareHouseForOrder(order.getWarehouse_id());
235
                warehouse = getWareHouseForOrder(order.getWarehouse_id());
217
				fedexTrackingService = new FedExTrackingService(warehouse.getLogisticsLocation());
236
                fedexTrackingService = new FedExTrackingService(warehouse.getLogisticsLocation());
218
			}
237
            }
219
			//Start:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
238
            //Start:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
220
			if(OrderSource.AMAZON == OrderSource.findByValue((int)order.getSource()) || OrderSource.JUNGLEE == OrderSource.findByValue((int)order.getSource())){
239
            if(OrderSource.AMAZON == OrderSource.findByValue((int)order.getSource()) || OrderSource.JUNGLEE == OrderSource.findByValue((int)order.getSource())){
221
				try {
240
                try {
222
				    amazonOrder = transactionServiceClient.getClient().getAmazonOrder(orderId);
241
                    amazonOrder = transactionServiceClient.getClient().getAmazonOrder(orderId);
223
				} catch (Exception e) {
242
                } catch (Exception e) {
224
				    log.error("Exception : No Amazon order found with orderId " + orderId);
243
                    log.error("Exception : No Amazon order found with orderId " + orderId);
225
				}
244
                }
226
			}
245
            }
227
			if (order.getLogistics_provider_id() > 0) {
246
            if (order.getLogistics_provider_id() > 0) {
228
			    setProviderName(providerNameMap.get(order.getLogistics_provider_id()));
247
                setProviderName(providerNameMap.get(order.getLogistics_provider_id()));
229
			}
248
            }
230
			//End:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
249
            //End:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
231
			if(order.getSource() == 2) {
250
            if(order.getSource() == 2) {
232
    			storeOrderDetail = transactionServiceClient.getClient().getStoreOrderDetail(order.getId(),order.getStoreId());
251
                storeOrderDetail = transactionServiceClient.getClient().getStoreOrderDetail(order.getId(),order.getStoreId());
233
    			if(order.getStatus().getValue() == 15 || order.getStatus().getValue() == 34) {
252
                if(order.getStatus().getValue() == 15 || order.getStatus().getValue() == 34) {
234
    			    setCashAmount(storeOrderDetail.getCashRefundAmount());
253
                    setCashAmount(storeOrderDetail.getCashRefundAmount());
235
                    setCardAmount(storeOrderDetail.getCardRefundAmount()); 
254
                    setCardAmount(storeOrderDetail.getCardRefundAmount()); 
236
    			} else {
255
                } else {
237
        			setCashAmount(storeOrderDetail.getCashAmount());
256
                    setCashAmount(storeOrderDetail.getCashAmount());
238
        			setCardAmount(storeOrderDetail.getCardAmount());
257
                    setCardAmount(storeOrderDetail.getCardAmount());
239
    			}
258
                }
240
			}
259
            }
241
			if(order.getFreebieItemId()>0) {
260
            if(order.getFreebieItemId()>0) {
242
				CatalogService.Client catalogClient = new CatalogClient().getClient();
261
                CatalogService.Client catalogClient = new CatalogClient().getClient();
243
				Item item = catalogClient.getItem(order.getFreebieItemId());
262
                Item item = catalogClient.getItem(order.getFreebieItemId());
244
				freebieItem = item.getBrand() + " " + item.getModelName() + " " + item.getModelNumber() + " " + item.getColor();
263
                freebieItem = item.getBrand() + " " + item.getModelName() + " " + item.getModelNumber() + " " + item.getColor();
245
			}
264
            }
246
 
265
 
247
			if(order.getLineitems().get(0).getDealText()!=null && !order.getLineitems().get(0).getDealText().isEmpty()) {
266
            if(order.getLineitems().get(0).getDealText()!=null && !order.getLineitems().get(0).getDealText().isEmpty()) {
248
				dealText = order.getLineitems().get(0).getDealText();
267
                dealText = order.getLineitems().get(0).getDealText();
249
			}
268
            }
250
			List<in.shop2020.model.v1.order.Attribute> attributes = 
269
            List<in.shop2020.model.v1.order.Attribute> attributes = 
251
				transactionServiceClient.getClient().getAllAttributesForOrderId(orderId);
270
                transactionServiceClient.getClient().getAllAttributesForOrderId(orderId);
252
 
271
 
253
			for(in.shop2020.model.v1.order.Attribute attribute: attributes){
272
            for(in.shop2020.model.v1.order.Attribute attribute: attributes){
254
				if(attribute.getName().equals("parentOrderIdForFreebie")){
273
                if(attribute.getName().equals("parentOrderIdForFreebie")){
255
					parentOrderIdForFreebieOrder = attribute.getValue();
274
                    parentOrderIdForFreebieOrder = attribute.getValue();
256
				} else if (attribute.getName().equals("freebieOrderId")){
275
                } else if (attribute.getName().equals("freebieOrderId")){
257
					freebieOrderId = attribute.getValue();
276
                    freebieOrderId = attribute.getValue();
258
				}
277
                }
259
			}
278
            }
260
 
279
 
261
			payments = paymentServiceClient.getClient()
280
            payments = paymentServiceClient.getClient()
262
			.getPaymentForTxnId(order.getTransactionId());
281
            .getPaymentForTxnId(order.getTransactionId());
263
			
282
 
264
			gvAmount = order.getGvAmount();
283
            gvAmount = order.getGvAmount();
265
 
284
 
266
 
285
 
267
 
286
 
268
			// Spawning a thread to capture shipment updates from Bluedart
287
            // Spawning a thread to capture shipment updates from Bluedart
269
			// This is done to ensure that response from Crm web app is sent
288
            // This is done to ensure that response from Crm web app is sent
270
			// within given time limits. Also, we wont be affected in the cases 
289
            // within given time limits. Also, we wont be affected in the cases 
271
			// where bluedart site is down or slow
290
            // where bluedart site is down or slow
272
			Executors.newSingleThreadExecutor().invokeAll(Collections.singletonList(new Callable<Boolean>() {
291
            Executors.newSingleThreadExecutor().invokeAll(Collections.singletonList(new Callable<Boolean>() {
273
				public Boolean call() throws Exception {
292
                public Boolean call() throws Exception {
274
					if (order.getLogistics_provider_id() == 1)
293
                    if (order.getLogistics_provider_id() == 1)
275
						shipmentUpdates = blueDartTrackingService.getUpdates(order.getAirwaybill_no());
294
                        shipmentUpdates = blueDartTrackingService.getUpdates(order.getAirwaybill_no());
276
					else if (order.getLogistics_provider_id() == 2) {
295
                    else if (order.getLogistics_provider_id() == 2) {
277
						shipmentUpdates = aramexTrackingService.getUpdates(order.getAirwaybill_no());
296
                        shipmentUpdates = aramexTrackingService.getUpdates(order.getAirwaybill_no());
278
					}
297
                    }
279
					else if (order.getLogistics_provider_id() == 3) {
298
                    else if (order.getLogistics_provider_id() == 3) {
280
						shipmentUpdates = delhiveryTrackingService.getUpdates(order.getAirwaybill_no());
299
                        shipmentUpdates = delhiveryTrackingService.getUpdates(order.getAirwaybill_no());
281
					}
300
                    }
282
					else if (order.getLogistics_provider_id() == 6) {
301
                    else if (order.getLogistics_provider_id() == 6) {
283
						shipmentUpdates = redexpressTrackingService.getUpdates(order.getAirwaybill_no());
302
                        shipmentUpdates = redexpressTrackingService.getUpdates(order.getAirwaybill_no());
284
					}
303
                    }
285
					//Start:- Added by Manish Sharma for fedex Integration- Shipment Tracking on 31-Jul-2013
304
                    //Start:- Added by Manish Sharma for fedex Integration- Shipment Tracking on 31-Jul-2013
286
					else if (order.getLogistics_provider_id() == 7) {
305
                    else if (order.getLogistics_provider_id() == 7) {
287
						shipmentUpdates = fedexTrackingService.getUpdates(order.getAirwaybill_no());
306
                        shipmentUpdates = fedexTrackingService.getUpdates(order.getAirwaybill_no());
288
					}
307
                    }
289
					//End:- Added by Manish Sharma for fedex Integration- Shipment Tracking on 31-Jul-2013
308
                    //End:- Added by Manish Sharma for fedex Integration- Shipment Tracking on 31-Jul-2013
290
					else {
309
                    else {
291
						shipmentUpdates = new ArrayList<ShipmentUpdate>();
310
                        shipmentUpdates = new ArrayList<ShipmentUpdate>();
292
						log.error("Error : providerId = " + order.getLogistics_provider_id() + "for orderId : " + order.getId());
311
                        log.error("Error : providerId = " + order.getLogistics_provider_id() + "for orderId : " + order.getId());
293
					}
312
                    }
294
					return true;
313
                    return true;
295
				}
314
                }
296
			}), 60, TimeUnit.SECONDS);
315
            }), 60, TimeUnit.SECONDS);
297
 
316
 
298
			if (order.isCod() && OrderStatus.COD_VERIFICATION_PENDING.equals(order.getStatus())) {
317
            if (order.isCod() && OrderStatus.COD_VERIFICATION_PENDING.equals(order.getStatus())) {
299
				populateCODTicketId(order.getCustomer_id());
318
                populateCODTicketId(order.getCustomer_id());
300
			}
319
            }
301
 
320
 
302
			if (canEditOrderAddress()) {
321
            if (canEditOrderAddress()) {
303
				userContextServiceClient = new UserClient().getClient();
322
                userContextServiceClient = new UserClient().getClient();
304
				addresses = userContextServiceClient.getAllAddressesForUser(order.getCustomer_id());
323
                addresses = userContextServiceClient.getAllAddressesForUser(order.getCustomer_id());
305
			}
324
            }
306
 
325
 
307
		} catch (TTransportException e) {
326
        } catch (TTransportException e) {
308
			log.error("Unable to create thrift Client", e);
327
            log.error("Unable to create thrift Client", e);
309
		} catch (TransactionServiceException e) {
328
        } catch (TransactionServiceException e) {
310
			addActionError("Invalid order id or no order selected.");
329
            addActionError("Invalid order id or no order selected.");
311
		} catch (TException e) {
330
        } catch (TException e) {
312
			log.error("Unable to get thrift Client", e);
331
            log.error("Unable to get thrift Client", e);
313
		} catch (PaymentException e) {
332
        } catch (PaymentException e) {
314
			log.error("Unable to get payments for transctionId : " + order.getTransactionId(), e);
333
            log.error("Unable to get payments for transctionId : " + order.getTransactionId(), e);
315
		} catch (InterruptedException e) {
334
        } catch (InterruptedException e) {
316
			log.error("Thread was interrupted", e);
335
            log.error("Thread was interrupted", e);
317
		} catch (UserContextException e) {
336
        } catch (UserContextException e) {
318
			log.error("Unable to get addresses for user : " + order.getCustomer_id(), e);
337
            log.error("Unable to get addresses for user : " + order.getCustomer_id(), e);
319
		} catch(CatalogServiceException csex) {
338
        } catch(CatalogServiceException csex) {
320
			log.error("Unable to get item details for itemId: " + order.getFreebieItemId(), csex);
339
            log.error("Unable to get item details for itemId: " + order.getFreebieItemId(), csex);
321
		} /*catch (LogisticsServiceException lsex) {
340
        } /*catch (LogisticsServiceException lsex) {
322
			log.error("Unable to get providers infromation: " , lsex);
341
			log.error("Unable to get providers infromation: " , lsex);
323
		}*/
342
		}*/
324
		return INDEX;
343
        return INDEX;
-
 
344
    }
325
	}
345
 
-
 
346
    private boolean canEditOrderAddress() {
-
 
347
        return false;
-
 
348
    }
-
 
349
 
-
 
350
    private void populateCODTicketId(long customerId) {
-
 
351
        try {
-
 
352
            SearchFilter searchFilter = new SearchFilter();
-
 
353
            searchFilter.setTicketCategory(TicketCategory.COD_VERIFICATION);
-
 
354
            searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
-
 
355
            searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
-
 
356
            searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
-
 
357
            searchFilter.setCustomerId(customerId);
-
 
358
            crmServiceClient = new CRMClient().getClient();
-
 
359
            List<Ticket> tickets = crmServiceClient.getTickets(searchFilter);
-
 
360
            if (tickets != null && !tickets.isEmpty()) {
-
 
361
                codTicketId = tickets.get(0).getId();
-
 
362
            }
-
 
363
        } catch (TException e) {
-
 
364
            log.error("Error fetching tickets for customerId: " + customerId, e);
-
 
365
        }
-
 
366
    }
326
 
367
 
327
	private boolean canEditOrderAddress() {
-
 
328
		return false;
-
 
329
	}
-
 
330
 
-
 
331
	private void populateCODTicketId(long customerId) {
-
 
332
		try {
-
 
333
			SearchFilter searchFilter = new SearchFilter();
-
 
334
			searchFilter.setTicketCategory(TicketCategory.COD_VERIFICATION);
-
 
335
			searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
-
 
336
			searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
-
 
337
			searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
-
 
338
			searchFilter.setCustomerId(customerId);
-
 
339
			crmServiceClient = new CRMClient().getClient();
-
 
340
			List<Ticket> tickets = crmServiceClient.getTickets(searchFilter);
-
 
341
			if (tickets != null && !tickets.isEmpty()) {
-
 
342
				codTicketId = tickets.get(0).getId();
-
 
343
			}
-
 
344
		} catch (TException e) {
-
 
345
			log.error("Error fetching tickets for customerId: " + customerId, e);
-
 
346
		}
-
 
347
	}
-
 
348
 
-
 
349
	public String markOrderForCancellation() {
368
    public String markOrderForCancellation() {
350
		try{
369
        try{
351
			TransactionClient transactionServiceClient = new TransactionClient();
370
            TransactionClient transactionServiceClient = new TransactionClient();
352
			log.info("URL = " + request.getRequestURI());
371
            log.info("URL = " + request.getRequestURI());
353
			log.info("Initiator = " + request.getParameter("cancellationInitiator"));
372
            log.info("Initiator = " + request.getParameter("cancellationInitiator"));
354
			log.info("orderId = " + request.getParameter("orderId"));
373
            log.info("orderId = " + request.getParameter("orderId"));
355
			
374
 
356
			order = transactionServiceClient.getClient().getOrder(orderId);
375
            order = transactionServiceClient.getClient().getOrder(orderId);
357
			
376
 
358
			/**
377
            /**
359
			 * If the order is from store then refund the order directly.
378
             * If the order is from store then refund the order directly.
360
			 */
379
             */
361
			if (order.getSource() == 2) {
380
            if (order.getSource() == 2) {
362
			    String plainTextbody = "";
381
                String plainTextbody = "";
363
			    if(body!=null && !body.isEmpty()){
382
                if(body!=null && !body.isEmpty()){
364
                    plainTextbody = new Source(body).getTextExtractor().toString();
383
                    plainTextbody = new Source(body).getTextExtractor().toString();
365
                }
384
                }
366
			    
385
 
367
			    if(cashAmount + cardAmount > order.getAdvanceAmount()) {
386
                if(cashAmount + cardAmount > order.getAdvanceAmount()) {
368
			        log.error("Could not mark order for Cancellation, OrderId : " + orderId);
387
                    log.error("Could not mark order for Cancellation, OrderId : " + orderId);
369
			        return "index";
388
                    return "index";
370
			    }
389
                }
371
			    
390
 
372
			    transactionServiceClient.getClient().saveRefundAmountsForStoreOrder(orderId, order.getStoreId(), cashAmount, cardAmount);
391
                transactionServiceClient.getClient().saveRefundAmountsForStoreOrder(orderId, order.getStoreId(), cashAmount, cardAmount);
373
			    if (cancellationInitiator.equals("CUSTOMER")) {
392
                if (cancellationInitiator.equals("CUSTOMER")) {
374
			        transactionServiceClient.getClient().markOrderCancellationRequestReceived(orderId);
393
                    transactionServiceClient.getClient().markOrderCancellationRequestReceived(orderId);
375
			        transactionServiceClient.getClient().markOrderCancellationRequestConfirmed(orderId);
394
                    transactionServiceClient.getClient().markOrderCancellationRequestConfirmed(orderId);
376
			    }
395
                }
377
			    transactionServiceClient.getClient().refundOrder(orderId, currentAgentEmailId, cancelReason + " : " + plainTextbody);
396
                transactionServiceClient.getClient().refundOrder(orderId, currentAgentEmailId, cancelReason + " : " + plainTextbody);
378
			} else {
397
            } else {
379
		         if (cancellationInitiator.equals("CUSTOMER")) {
398
                if (cancellationInitiator.equals("CUSTOMER")) {
380
	                transactionServiceClient.getClient().markOrderCancellationRequestReceived(orderId);
399
                    transactionServiceClient.getClient().markOrderCancellationRequestReceived(orderId);
381
	                long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
400
                    long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
382
	                Ticket ticket = new Ticket();
401
                    Ticket ticket = new Ticket();
383
	                String plainTextbody = "";
402
                    String plainTextbody = "";
384
	                if(body!=null && !body.isEmpty()){
403
                    if(body!=null && !body.isEmpty()){
385
	                    plainTextbody = new Source(body).getTextExtractor().toString();
404
                        plainTextbody = new Source(body).getTextExtractor().toString();
386
	                }
405
                    }
387
	                ticket.setDescription("Creating ticket for Cancellation Request Received, Reason : " + cancelReason + " : " + plainTextbody);
406
                    ticket.setDescription("Creating ticket for Cancellation Request Received, Reason : " + cancelReason + " : " + plainTextbody);
388
	                ticket.setCreatorId(creatorId);
407
                    ticket.setCreatorId(creatorId);
389
	                ticket.setStatus(TicketStatus.OPEN);
408
                    ticket.setStatus(TicketStatus.OPEN);
390
	                ticket.setPriority(TicketPriority.HIGH);
409
                    ticket.setPriority(TicketPriority.HIGH);
391
	                ticket.setCategory(TicketCategory.ORDER_CANCELLATION);
410
                    ticket.setCategory(TicketCategory.ORDER_CANCELLATION);
392
	                ticket.setOrderId(orderId);
411
                    ticket.setOrderId(orderId);
393
 
412
 
394
	                Activity activity = new Activity();
413
                    Activity activity = new Activity();
395
	                activity.setDescription("Creating Ticket");
414
                    activity.setDescription("Creating Ticket");
396
	                activity.setType(ActivityType.OTHER);
415
                    activity.setType(ActivityType.OTHER);
397
	                activity.setTicketPriority(TicketPriority.HIGH);
416
                    activity.setTicketPriority(TicketPriority.HIGH);
398
	                activity.setTicketStatus(TicketStatus.OPEN);
417
                    activity.setTicketStatus(TicketStatus.OPEN);
399
	                activity.setCreatorId(creatorId);
418
                    activity.setCreatorId(creatorId);
400
	                activity.setTicketDescription("Creating ticket for Cancellation Request Received, Reason : " + cancelReason + " : " + plainTextbody);
419
                    activity.setTicketDescription("Creating ticket for Cancellation Request Received, Reason : " + cancelReason + " : " + plainTextbody);
401
	                activity.setTicketCategory(TicketCategory.ORDER_CANCELLATION);
420
                    activity.setTicketCategory(TicketCategory.ORDER_CANCELLATION);
402
 
421
 
403
	                ticket.setCustomerId(order.getCustomer_id());
422
                    ticket.setCustomerId(order.getCustomer_id());
404
	                activity.setCustomerId(order.getCustomer_id());
423
                    activity.setCustomerId(order.getCustomer_id());
405
	                ticket.setCustomerName(order.getCustomer_name());
424
                    ticket.setCustomerName(order.getCustomer_name());
406
	                activity.setCustomerName(order.getCustomer_name());
425
                    activity.setCustomerName(order.getCustomer_name());
407
	                ticket.setCustomerEmailId(order.getCustomer_email());
426
                    ticket.setCustomerEmailId(order.getCustomer_email());
408
	                activity.setCustomerEmailId(order.getCustomer_email());
427
                    activity.setCustomerEmailId(order.getCustomer_email());
409
	                ticket.setCustomerMobileNumber(order.getCustomer_mobilenumber());
428
                    ticket.setCustomerMobileNumber(order.getCustomer_mobilenumber());
410
	                activity.setCustomerMobileNumber(order.getCustomer_mobilenumber());
429
                    activity.setCustomerMobileNumber(order.getCustomer_mobilenumber());
411
 
430
 
412
	                crmServiceClient = new CRMClient().getClient();
431
                    crmServiceClient = new CRMClient().getClient();
413
	                crmServiceClient.insertTicket(ticket, activity);
432
                    crmServiceClient.insertTicket(ticket, activity);
414
	            } 
433
                } 
415
	            else if (cancellationInitiator.equals("INTERNAL")) {
434
                else if (cancellationInitiator.equals("INTERNAL")) {
416
	                String plainTextbody = "";
435
                    String plainTextbody = "";
417
	                if(body!=null && !body.isEmpty()){
436
                    if(body!=null && !body.isEmpty()){
418
	                    plainTextbody = new Source(body).getTextExtractor().toString();
437
                        plainTextbody = new Source(body).getTextExtractor().toString();
419
	                }
438
                    }
420
	                boolean status_returned = transactionServiceClient.getClient().refundOrder(orderId, currentAgentEmailId, cancelReason + " : " + plainTextbody);
439
                    boolean status_returned = transactionServiceClient.getClient().refundOrder(orderId, currentAgentEmailId, cancelReason + " : " + plainTextbody);
421
	                if (status_returned) {
440
                    if (status_returned) {
422
	                    order = transactionServiceClient.getClient().getOrder(orderId);
441
                        order = transactionServiceClient.getClient().getOrder(orderId);
423
	                    long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
442
                        long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
424
	                    Ticket ticket = new Ticket();
443
                        Ticket ticket = new Ticket();
425
	                    ticket.setDescription("Creating ticket for Order Cancellation due to Low inventory");
444
                        ticket.setDescription("Creating ticket for Order Cancellation due to Low inventory");
426
	                    ticket.setCreatorId(creatorId);
445
                        ticket.setCreatorId(creatorId);
427
	                    ticket.setAssigneeId(36);
446
                        ticket.setAssigneeId(36);
428
	                    ticket.setStatus(TicketStatus.OPEN);
447
                        ticket.setStatus(TicketStatus.OPEN);
429
	                    ticket.setPriority(TicketPriority.MEDIUM);
448
                        ticket.setPriority(TicketPriority.MEDIUM);
430
	                    ticket.setCategory(TicketCategory.LOW_INVENTORY_CANCELLED_ORDERS);
449
                        ticket.setCategory(TicketCategory.LOW_INVENTORY_CANCELLED_ORDERS);
431
	                    ticket.setOrderId(orderId);
450
                        ticket.setOrderId(orderId);
432
	                    ticket.setCustomerId(order.getCustomer_id());
451
                        ticket.setCustomerId(order.getCustomer_id());
433
	                    ticket.setCustomerName(order.getCustomer_name());
452
                        ticket.setCustomerName(order.getCustomer_name());
434
	                    ticket.setCustomerEmailId(order.getCustomer_email());
453
                        ticket.setCustomerEmailId(order.getCustomer_email());
435
	                    ticket.setCustomerMobileNumber(order.getCustomer_mobilenumber());
454
                        ticket.setCustomerMobileNumber(order.getCustomer_mobilenumber());
436
 
455
 
437
	                    Activity activity = new Activity();
456
                        Activity activity = new Activity();
438
	                    activity.setDescription("Creating Ticket");
457
                        activity.setDescription("Creating Ticket");
439
	                    activity.setType(ActivityType.OTHER);
458
                        activity.setType(ActivityType.OTHER);
440
	                    activity.setTicketPriority(TicketPriority.MEDIUM);
459
                        activity.setTicketPriority(TicketPriority.MEDIUM);
441
	                    activity.setTicketStatus(TicketStatus.OPEN);
460
                        activity.setTicketStatus(TicketStatus.OPEN);
442
	                    activity.setCreatorId(creatorId);
461
                        activity.setCreatorId(creatorId);
443
	                    activity.setTicketAssigneeId(36);
462
                        activity.setTicketAssigneeId(36);
444
	                    activity.setTicketCategory(TicketCategory.LOW_INVENTORY_CANCELLED_ORDERS);
463
                        activity.setTicketCategory(TicketCategory.LOW_INVENTORY_CANCELLED_ORDERS);
445
	                    activity.setTicketDescription("Creating ticket for Order Cancellation due to Low inventory");
464
                        activity.setTicketDescription("Creating ticket for Order Cancellation due to Low inventory");
446
	                    activity.setCustomerId(order.getCustomer_id());
465
                        activity.setCustomerId(order.getCustomer_id());
447
	                    activity.setCustomerName(order.getCustomer_name());
466
                        activity.setCustomerName(order.getCustomer_name());
448
	                    activity.setCustomerEmailId(order.getCustomer_email());
467
                        activity.setCustomerEmailId(order.getCustomer_email());
449
	                    activity.setCustomerMobileNumber(order.getCustomer_mobilenumber());
468
                        activity.setCustomerMobileNumber(order.getCustomer_mobilenumber());
450
 
469
 
451
	                    crmServiceClient = new CRMClient().getClient();
470
                        crmServiceClient = new CRMClient().getClient();
452
	                    crmServiceClient.insertTicket(ticket, activity);
471
                        crmServiceClient.insertTicket(ticket, activity);
453
	                }
472
                    }
454
	            }
473
                }
455
			}
474
            }
456
		} catch(Exception e) {
475
        } catch(Exception e) {
457
			log.error("Could not mark order for Cancellation, OrderId : " + orderId, e);
476
            log.error("Could not mark order for Cancellation, OrderId : " + orderId, e);
458
		}
477
        }
459
		return index();
478
        return index();
460
	}
479
    }
461
 
480
 
462
	public void getOrderConfirmationMail() throws IOException, TException, ConfigException, TransactionServiceException {
481
    public void getOrderConfirmationMail() throws IOException, TException, ConfigException, TransactionServiceException {
463
		TransactionClient transactionServiceClient = new TransactionClient();
482
        TransactionClient transactionServiceClient = new TransactionClient();
464
		order = transactionServiceClient.getClient().getOrder(orderId);
483
        order = transactionServiceClient.getClient().getOrder(orderId);
465
		long source = order.getTransactionId();
484
        long source = order.getTransactionId();
466
		HelperClient helperClient = new HelperClient("helper_service_server","helper_service_server_port");
485
        HelperClient helperClient = new HelperClient("helper_service_server","helper_service_server_port");
467
		String mail = helperClient.getClient().getOrderConfirmationMail(source);
486
        String mail = helperClient.getClient().getOrderConfirmationMail(source);
468
		File file = new File("/tmp/temp");
487
        File file = new File("/tmp/temp");
469
		//Start:- Added by Manish Sharma for resolving Exception for getting order delivery and confirmation mail on 27-Jun-2013
488
        //Start:- Added by Manish Sharma for resolving Exception for getting order delivery and confirmation mail on 27-Jun-2013
470
		if(mail.isEmpty() || mail==null || mail=="")
489
        if(mail.isEmpty() || mail==null || mail=="")
471
			mail="<html><body><p>Sorry, Required e-mail for mentioned order does not exist in the system !!!</p></body></html>";
490
            mail="<html><body><p>Sorry, Required e-mail for mentioned order does not exist in the system !!!</p></body></html>";
472
		//End:- Added by Manish Sharma for resolving Exception for getting order delivery and confirmation mail on 27-Jun-2013
491
        //End:- Added by Manish Sharma for resolving Exception for getting order delivery and confirmation mail on 27-Jun-2013
473
 
492
 
474
		FileWriter writer = new FileWriter(file);
493
        FileWriter writer = new FileWriter(file);
475
		writer.append(mail);
494
        writer.append(mail);
476
		writer.close();
495
        writer.close();
477
 
496
 
478
		byte[] buffer = new byte[(int)file.length()];
497
        byte[] buffer = new byte[(int)file.length()];
479
		InputStream input = null;
498
        InputStream input = null;
480
		try {
499
        try {
481
			int totalBytesRead = 0;
500
            int totalBytesRead = 0;
482
			input = new BufferedInputStream(new FileInputStream(file));
501
            input = new BufferedInputStream(new FileInputStream(file));
483
			while(totalBytesRead < buffer.length){
502
            while(totalBytesRead < buffer.length){
484
				int bytesRemaining = buffer.length - totalBytesRead;
503
                int bytesRemaining = buffer.length - totalBytesRead;
485
				int bytesRead = input.read(buffer, totalBytesRead, bytesRemaining); 
504
                int bytesRead = input.read(buffer, totalBytesRead, bytesRemaining); 
486
				if (bytesRead > 0){
505
                if (bytesRead > 0){
487
					totalBytesRead = totalBytesRead + bytesRead;
506
                    totalBytesRead = totalBytesRead + bytesRead;
488
				}
507
                }
489
			}
508
            }
490
		}
509
        }
491
		finally {
510
        finally {
492
			input.close();
511
            input.close();
493
			file.delete();
512
            file.delete();
494
		}
513
        }
495
 
514
 
496
 
515
 
497
		response.setHeader("Content-disposition", "inline; filename=" + "OrderDetail_"+orderId );
516
        response.setHeader("Content-disposition", "inline; filename=" + "OrderDetail_"+orderId );
498
 
517
 
499
		ServletOutputStream sos;
518
        ServletOutputStream sos;
500
		try {
519
        try {
501
			sos = response.getOutputStream();
520
            sos = response.getOutputStream();
502
			sos.write(buffer);
521
            sos.write(buffer);
503
			sos.flush();
522
            sos.flush();
504
		} catch (IOException e) {
523
        } catch (IOException e) {
505
			System.out.println("Unable to stream the manifest file");
524
            System.out.println("Unable to stream the manifest file");
506
		}   
525
        }   
507
	}
526
    }
508
	
527
 
509
	public Warehouse getWareHouseForOrder(long warehouseId){
528
    public Warehouse getWareHouseForOrder(long warehouseId){
510
		Warehouse warehouse = null;
529
        Warehouse warehouse = null;
511
		try{
530
        try{
512
    		InventoryClient isc = new InventoryClient();
531
            InventoryClient isc = new InventoryClient();
513
    		warehouse = isc.getClient().getWarehouse(warehouseId);
532
            warehouse = isc.getClient().getWarehouse(warehouseId);
514
		} catch(Exception e) {
533
        } catch(Exception e) {
515
			log.error("Unable to get warehouse for id : " + warehouseId,e);
534
            log.error("Unable to get warehouse for id : " + warehouseId,e);
516
		    //TODO throw e;
535
            //TODO throw e;
517
		}
536
        }
518
		return warehouse;
537
        return warehouse;
519
	}
538
    }
520
 
539
 
521
	public void getOrderDeliveryMail() throws IOException, TException, ConfigException, TransactionServiceException {
540
    public void getOrderDeliveryMail() throws IOException, TException, ConfigException, TransactionServiceException {
522
		HelperClient helperClient = new HelperClient("helper_service_server","helper_service_server_port");
541
        HelperClient helperClient = new HelperClient("helper_service_server","helper_service_server_port");
523
		String mail = helperClient.getClient().getOrderDeliveryMail(orderId);
542
        String mail = helperClient.getClient().getOrderDeliveryMail(orderId);
524
		File file = new File("/tmp/temp");
543
        File file = new File("/tmp/temp");
525
		//Start:- Added by Manish Sharma for resolving Exception for getting order delivery and confirmation mail on 27-Jun-2013
544
        //Start:- Added by Manish Sharma for resolving Exception for getting order delivery and confirmation mail on 27-Jun-2013
526
		if(mail.isEmpty() || mail==null || mail=="")
545
        if(mail.isEmpty() || mail==null || mail=="")
527
			mail="<html><body><p>Sorry, Required e-mail for mentioned order does not exist in the system anymore !!!</p></body></html>";
546
            mail="<html><body><p>Sorry, Required e-mail for mentioned order does not exist in the system anymore !!!</p></body></html>";
528
		//End:- Added by Manish Sharma for resolving Exception for getting order delivery and confirmation mail on 27-Jun-2013
547
        //End:- Added by Manish Sharma for resolving Exception for getting order delivery and confirmation mail on 27-Jun-2013
529
		FileWriter writer = new FileWriter(file);
548
        FileWriter writer = new FileWriter(file);
530
		writer.append(mail);
549
        writer.append(mail);
531
		writer.close();
550
        writer.close();
532
 
551
 
533
		byte[] buffer = new byte[(int)file.length()];
552
        byte[] buffer = new byte[(int)file.length()];
534
		InputStream input = null;
553
        InputStream input = null;
535
		try {
554
        try {
536
			int totalBytesRead = 0;
555
            int totalBytesRead = 0;
537
			input = new BufferedInputStream(new FileInputStream(file));
556
            input = new BufferedInputStream(new FileInputStream(file));
538
			while(totalBytesRead < buffer.length){
557
            while(totalBytesRead < buffer.length){
539
				int bytesRemaining = buffer.length - totalBytesRead;
558
                int bytesRemaining = buffer.length - totalBytesRead;
540
				int bytesRead = input.read(buffer, totalBytesRead, bytesRemaining); 
559
                int bytesRead = input.read(buffer, totalBytesRead, bytesRemaining); 
541
				if (bytesRead > 0){
560
                if (bytesRead > 0){
542
					totalBytesRead = totalBytesRead + bytesRead;
561
                    totalBytesRead = totalBytesRead + bytesRead;
543
				}
562
                }
544
			}
563
            }
545
		}
564
        }
546
		finally {
565
        finally {
547
			input.close();
566
            input.close();
548
			file.delete();
567
            file.delete();
549
		}
568
        }
550
 
569
 
551
 
570
 
552
		response.setHeader("Content-disposition", "inline; filename=" + "OrderDetail_"+orderId );
571
        response.setHeader("Content-disposition", "inline; filename=" + "OrderDetail_"+orderId );
553
 
572
 
554
		ServletOutputStream sos;
573
        ServletOutputStream sos;
555
		try {
574
        try {
556
			sos = response.getOutputStream();
575
            sos = response.getOutputStream();
557
			sos.write(buffer);
576
            sos.write(buffer);
558
			sos.flush();
577
            sos.flush();
559
		} catch (IOException e) {
578
        } catch (IOException e) {
560
			System.out.println("Unable to stream the manifest file");
579
            System.out.println("Unable to stream the manifest file");
561
		}   
580
        }   
562
	}
581
    }
563
 
582
 
564
	public boolean canOrderBeCancelled() {
583
    public boolean canOrderBeCancelled() {
565
		if (setOfcancellableStates.contains(order.getStatus())) {
584
        if (setOfcancellableStates.contains(order.getStatus())) {
566
			return true;
585
            return true;
567
		}
586
        }
568
		return false;
587
        return false;
569
	}
588
    }
570
 
589
 
571
	public String getPaymentGateway(Payment payment) {
590
    public String getPaymentGateway(Payment payment) {
572
		String gatewayName = "";
591
        String gatewayName = "";
573
 
592
 
574
		try {
593
        try {
575
			Client paymentServiceClient = new PaymentClient().getClient();
594
            Client paymentServiceClient = new PaymentClient().getClient();
576
			gatewayName = paymentServiceClient.getPaymentGateway(payment.getGatewayId()).getName();
595
            gatewayName = paymentServiceClient.getPaymentGateway(payment.getGatewayId()).getName();
577
		} catch (TTransportException e) {
596
        } catch (TTransportException e) {
578
		} catch (PaymentException e) {
597
        } catch (PaymentException e) {
579
		} catch (TException e) {
598
        } catch (TException e) {
580
		}
599
        }
581
 
600
 
582
		return gatewayName;
601
        return gatewayName;
583
	}
602
    }
584
 
603
 
585
	public int convertDouble(double value) {
604
    public int convertDouble(double value) {
586
		return (int)value;
605
        return (int)value;
587
	}
606
    }
588
 
607
 
589
	public String getInsuranceExpiryDate(long DeliveryDate) {
608
    public String getInsuranceExpiryDate(long DeliveryDate) {
590
		if (DeliveryDate == 0) {
609
        if (DeliveryDate == 0) {
591
			return "N/A";
610
            return "N/A";
592
		}
611
        }
593
		Calendar cal = Calendar.getInstance();
612
        Calendar cal = Calendar.getInstance();
594
		cal.setTimeInMillis(DeliveryDate);
613
        cal.setTimeInMillis(DeliveryDate);
595
		cal.add(Calendar.YEAR, 1);
614
        cal.add(Calendar.YEAR, 1);
596
		SimpleDateFormat sdf = new SimpleDateFormat("dd MMM, yyyy");
615
        SimpleDateFormat sdf = new SimpleDateFormat("dd MMM, yyyy");
597
		return sdf.format(cal.getTime());
616
        return sdf.format(cal.getTime());
598
	}
617
    }
599
 
618
 
600
	public String getShippingAddressOfStore(long storeId) {
619
    public String getShippingAddressOfStore(long storeId) {
601
		try {
620
        try {
602
			in.shop2020.logistics.LogisticsService.Client client = new LogisticsClient().getClient();
621
            in.shop2020.logistics.LogisticsService.Client client = new LogisticsClient().getClient();
603
			PickupStore store = client.getPickupStore(storeId);
622
            PickupStore store = client.getPickupStore(storeId);
604
			return StringUtils.join(new String[] {
623
            return StringUtils.join(new String[] {
605
					store.getName(),
624
                    store.getName(),
606
					store.getLine1(),
625
                    store.getLine1(),
607
					store.getLine2(),
626
                    store.getLine2(),
608
					store.getPin(),
627
                    store.getPin(),
609
					store.getCity(),
628
                    store.getCity(),
610
					store.getState(),
629
                    store.getState(),
611
					store.getPhone()}, ",");
630
                    store.getPhone()}, ",");
612
		} catch (Exception e) {
631
        } catch (Exception e) {
613
			return "";
632
            return "";
614
		}
633
        }
615
	}
634
    }
616
 
635
 
617
	public String getAddress(Order order) {
636
    public String getAddress(Order order) {
618
		return ModelUtils.extractAddressFromOrder(order);
637
        return ModelUtils.extractAddressFromOrder(order);
619
	}
638
    }
620
 
639
 
621
	public String changeShippingAddress() {
640
    public String changeShippingAddress() {
622
		try {
641
        try {
623
			TransactionClient transactionServiceClient = new TransactionClient();
642
            TransactionClient transactionServiceClient = new TransactionClient();
624
			in.shop2020.model.v1.order.TransactionService.Client transactionClient
643
            in.shop2020.model.v1.order.TransactionService.Client transactionClient
625
		    = transactionServiceClient.getClient();
644
            = transactionServiceClient.getClient();
626
			transactionClient.changeShippingAddress(orderId, line1, line2, city, state, pin);
645
            transactionClient.changeShippingAddress(orderId, line1, line2, city, state, pin);
627
			in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
646
            in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
628
			Warehouse warehouse = getWareHouseForOrder(t_order.getWarehouse_id());			
647
            Warehouse warehouse = getWareHouseForOrder(t_order.getWarehouse_id());			
629
			if(t_order.getLogistics_provider_id()==7L){
648
            if(t_order.getLogistics_provider_id()==7L){
630
				FedExShipAccountInfo fedexAccountInfo = FedExShipAccountInfo.getFedExInfo(warehouse.getLogisticsLocation());
649
                FedExShipAccountInfo fedexAccountInfo = FedExShipAccountInfo.getFedExInfo(warehouse.getLogisticsLocation());
631
				ProcessShipmentReply  processShipmentReply = ShipWebServiceClient.getShipmentCreationReply(t_order,fedexAccountInfo.getClientDetail(),fedexAccountInfo.getWad(),fedexAccountInfo.getEndPointAddress());
650
                ProcessShipmentReply  processShipmentReply = ShipWebServiceClient.getShipmentCreationReply(t_order,fedexAccountInfo.getClientDetail(),fedexAccountInfo.getWad(),fedexAccountInfo.getEndPointAddress());
632
				CompletedShipmentDetail completedShipmentDetails = processShipmentReply.getCompletedShipmentDetail();
651
                CompletedShipmentDetail completedShipmentDetails = processShipmentReply.getCompletedShipmentDetail();
633
				CompletedPackageDetail completedPackageDetails =  completedShipmentDetails.getCompletedPackageDetails(0);
652
                CompletedPackageDetail completedPackageDetails =  completedShipmentDetails.getCompletedPackageDetails(0);
634
				TrackingId  trackId= completedPackageDetails.getTrackingIds(0);
653
                TrackingId  trackId= completedPackageDetails.getTrackingIds(0);
635
				t_order = transactionClient.updateOrderAWB(t_order.getId(), trackId.getTrackingNumber());
654
                t_order = transactionClient.updateOrderAWB(t_order.getId(), trackId.getTrackingNumber());
636
				//Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
655
                //Start:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
637
				CompletedPackageDetail[] cpd= completedShipmentDetails.getCompletedPackageDetails();
656
                CompletedPackageDetail[] cpd= completedShipmentDetails.getCompletedPackageDetails();
638
				AssociatedShipmentDetail[] asdetails = completedShipmentDetails.getAssociatedShipments();
657
                AssociatedShipmentDetail[] asdetails = completedShipmentDetails.getAssociatedShipments();
639
				List<in.shop2020.model.v1.order.Attribute> attrList = new ArrayList<in.shop2020.model.v1.order.Attribute>();
658
                List<in.shop2020.model.v1.order.Attribute> attrList = new ArrayList<in.shop2020.model.v1.order.Attribute>();
640
				if(t_order.isCod()){
659
                if(t_order.isCod()){
641
					if(asdetails!=null){
660
                    if(asdetails!=null){
642
						for(AssociatedShipmentDetail as : asdetails){
661
                        for(AssociatedShipmentDetail as : asdetails){
643
							if(as.getType().getValue().equalsIgnoreCase("COD_RETURN")){
662
                            if(as.getType().getValue().equalsIgnoreCase("COD_RETURN")){
644
								PackageOperationalDetail pod = as.getPackageOperationalDetail();
663
                                PackageOperationalDetail pod = as.getPackageOperationalDetail();
645
								StringBarcode[] barcodes = pod.getBarcodes().getStringBarcodes();
664
                                StringBarcode[] barcodes = pod.getBarcodes().getStringBarcodes();
646
								for(StringBarcode bc : barcodes){
665
                                for(StringBarcode bc : barcodes){
647
									in.shop2020.model.v1.order.Attribute attr3 = new in.shop2020.model.v1.order.Attribute();
666
                                    in.shop2020.model.v1.order.Attribute attr3 = new in.shop2020.model.v1.order.Attribute();
648
									attr3.setName("FedEx_COD_Return_BarCode");
667
                                    attr3.setName("FedEx_COD_Return_BarCode");
649
									attr3.setValue(bc.getValue());
668
                                    attr3.setValue(bc.getValue());
650
									attrList.add(attr3);
669
                                    attrList.add(attr3);
651
								}
670
                                }
652
								
671
 
653
								String codReturnTrackingNo= as.getTrackingId().getTrackingNumber();
672
                                String codReturnTrackingNo= as.getTrackingId().getTrackingNumber();
654
								in.shop2020.model.v1.order.Attribute attr4 = new in.shop2020.model.v1.order.Attribute();
673
                                in.shop2020.model.v1.order.Attribute attr4 = new in.shop2020.model.v1.order.Attribute();
655
								attr4.setName("FedEx_COD_Return_Tracking_No");
674
                                attr4.setName("FedEx_COD_Return_Tracking_No");
656
								attr4.setValue(codReturnTrackingNo);
675
                                attr4.setValue(codReturnTrackingNo);
657
								attrList.add(attr4);
676
                                attrList.add(attr4);
658
							}
677
                            }
659
						}
678
                        }
660
					}
679
                    }
661
				}
680
                }
662
				for(CompletedPackageDetail cd : cpd){
681
                for(CompletedPackageDetail cd : cpd){
663
					PackageOperationalDetail pod = cd.getOperationalDetail();
682
                    PackageOperationalDetail pod = cd.getOperationalDetail();
664
					StringBarcode[] barcodes = pod.getBarcodes().getStringBarcodes();
683
                    StringBarcode[] barcodes = pod.getBarcodes().getStringBarcodes();
665
					for(StringBarcode bc : barcodes){
684
                    for(StringBarcode bc : barcodes){
666
						in.shop2020.model.v1.order.Attribute attr1 = new in.shop2020.model.v1.order.Attribute();
685
                        in.shop2020.model.v1.order.Attribute attr1 = new in.shop2020.model.v1.order.Attribute();
667
						attr1.setName("FedEx_Package_BarCode");
686
                        attr1.setName("FedEx_Package_BarCode");
668
						attr1.setValue(bc.getValue());
687
                        attr1.setValue(bc.getValue());
669
						attrList.add(attr1);
688
                        attrList.add(attr1);
670
					}
689
                    }
671
					OperationalInstruction[] ois = pod.getOperationalInstructions();
690
                    OperationalInstruction[] ois = pod.getOperationalInstructions();
672
					in.shop2020.model.v1.order.Attribute attr2 = new in.shop2020.model.v1.order.Attribute();
691
                    in.shop2020.model.v1.order.Attribute attr2 = new in.shop2020.model.v1.order.Attribute();
673
					for(OperationalInstruction oi : ois){
692
                    for(OperationalInstruction oi : ois){
674
						if(oi.getNumber().intValue()==5){
693
                        if(oi.getNumber().intValue()==5){
675
							attr2.setName("FedEx_Location_Code");
694
                            attr2.setName("FedEx_Location_Code");
676
							attr2.setValue(oi.getContent());
695
                            attr2.setValue(oi.getContent());
677
							attrList.add(attr2);
696
                            attrList.add(attr2);
678
						}
697
                        }
679
					}						
698
                    }						
680
				}
699
                }
681
				transactionClient.setOrderAttributes(t_order.getId(), attrList);
700
                transactionClient.setOrderAttributes(t_order.getId(), attrList);
682
				//End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
701
                //End:-Added By Manish Sharma for FedEx Integration - Shipment Creation on 21-Aug-2013
683
 
702
 
684
			}
703
            }
685
		} catch(Exception e) {
704
        } catch(Exception e) {
686
			log.error("Unable to update address for orderId : " + orderId + "and address : " + 
705
            log.error("Unable to update address for orderId : " + orderId + "and address : " + 
687
					line1 + ", " + line2+ ", " + city + ", " + state + ", " + pin, e);
706
                    line1 + ", " + line2+ ", " + city + ", " + state + ", " + pin, e);
688
		}
707
        }
689
		return null;
708
        return null;
690
	}
709
    }
691
	
710
 
692
	public String convertStoreToNormal() {
711
    public String convertStoreToNormal() {
693
	    try{
712
        try{
694
	        TransactionClient transactionServiceClient = new TransactionClient();
713
            TransactionClient transactionServiceClient = new TransactionClient();
695
	        transactionServiceClient.getClient().convertStoreToNormal(orderId);
714
            transactionServiceClient.getClient().convertStoreToNormal(orderId);
696
	    } catch(Exception e) {
715
        } catch(Exception e) {
697
	        log.error("Unable to convert to normal order", e);
716
            log.error("Unable to convert to normal order", e);
698
	    }
717
        }
699
	    return null;
718
        return null;
700
	}
719
    }
701
	
720
 
702
	public String getStoreDetails(long storeId) {
721
    public String getStoreDetails(long storeId) {
703
	    try {
722
        try {
704
	        TransactionClient tcl = new TransactionClient();
723
            TransactionClient tcl = new TransactionClient();
705
	        HotspotStore store = tcl.getClient().getHotspotStore(storeId, "");
724
            HotspotStore store = tcl.getClient().getHotspotStore(storeId, "");
706
	        return store.getHotspotId() + " - " + store.getCity(); 
725
            return store.getHotspotId() + " - " + store.getCity(); 
707
	    } catch (Exception e) {
726
        } catch (Exception e) {
708
	        log.error("Unable to get hostspotStore for id : " + storeId, e);
727
            log.error("Unable to get hostspotStore for id : " + storeId, e);
709
	    }
728
        }
710
	    return "N/A";
729
        return "N/A";
711
	}
730
    }
712
 
731
 
713
	public Address getShippingAddress(Order order) {
732
    public Address getShippingAddress(Order order) {
714
		Address address = new Address();
733
        Address address = new Address();
715
		address.setLine1(order.getCustomer_address1());
734
        address.setLine1(order.getCustomer_address1());
716
		address.setLine2(order.getCustomer_address2());
735
        address.setLine2(order.getCustomer_address2());
717
		address.setCity(order.getCustomer_city());
736
        address.setCity(order.getCustomer_city());
718
		address.setState(order.getCustomer_state());
737
        address.setState(order.getCustomer_state());
719
		address.setPin(order.getCustomer_pincode());
738
        address.setPin(order.getCustomer_pincode());
720
		return address;
739
        return address;
721
	}
740
    }
722
	
741
 
723
	public String getOrderSource(Order order) {
742
    public String getOrderSource(Order order) {
724
		return OrderSource.findByValue((int)(order.getSource())).toString();
743
        return OrderSource.findByValue((int)(order.getSource())).toString();
725
	}
744
    }
726
 
745
 
727
	public String getPaymentMethod(List<Attribute> paymentAttributes) {
746
    public String getPaymentMethod(List<Attribute> paymentAttributes) {
728
		String paymentMethod = null;
747
        String paymentMethod = null;
729
		if (paymentAttributes == null || paymentAttributes.isEmpty()) {
748
        if (paymentAttributes == null || paymentAttributes.isEmpty()) {
730
			return "N/A";
749
            return "N/A";
731
		}
750
        }
732
		for (Attribute a : paymentAttributes) {
751
        for (Attribute a : paymentAttributes) {
733
			if ("payMethod".equals(a.getName())) {
752
            if ("payMethod".equals(a.getName())) {
734
				paymentMethod = Constants.PAYMENT_METHOD.get(a.getValue());
753
                paymentMethod = Constants.PAYMENT_METHOD.get(a.getValue());
735
				break;
754
                break;
736
			}
755
            }
737
		}
756
        }
738
		return paymentMethod != null ? paymentMethod : "N/A";
757
        return paymentMethod != null ? paymentMethod : "N/A";
739
	}
758
    }
740
	//Start:- Added by Manish Sharma for Physical Refunds 
759
    //Start:- Added by Manish Sharma for Physical Refunds 
741
	public String refundOrderPayment(){
760
    public String refundOrderPayment(){
742
		try{
761
        try{
743
			TransactionClient transactionServiceClient = new TransactionClient();
762
            TransactionClient transactionServiceClient = new TransactionClient();
744
			in.shop2020.model.v1.order.TransactionService.Client transactionClient
763
            in.shop2020.model.v1.order.TransactionService.Client transactionClient
745
		    = transactionServiceClient.getClient();
764
            = transactionServiceClient.getClient();
746
			
765
 
747
			in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
766
            in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
748
			List<in.shop2020.model.v1.order.Attribute> attrList = new ArrayList<in.shop2020.model.v1.order.Attribute>();
767
            List<in.shop2020.model.v1.order.Attribute> attrList = new ArrayList<in.shop2020.model.v1.order.Attribute>();
749
			in.shop2020.model.v1.order.Attribute attr1 = new in.shop2020.model.v1.order.Attribute();
768
            in.shop2020.model.v1.order.Attribute attr1 = new in.shop2020.model.v1.order.Attribute();
750
			attr1.setName("Refund_Option");
769
            attr1.setName("Refund_Option");
751
			in.shop2020.model.v1.order.Attribute attr2 = new in.shop2020.model.v1.order.Attribute();
770
            in.shop2020.model.v1.order.Attribute attr2 = new in.shop2020.model.v1.order.Attribute();
752
			attr2.setName("Refund_Amount");
771
            attr2.setName("Refund_Amount");
753
			in.shop2020.model.v1.order.Attribute attr3 = new in.shop2020.model.v1.order.Attribute();
772
            in.shop2020.model.v1.order.Attribute attr3 = new in.shop2020.model.v1.order.Attribute();
754
			attr3.setName("Refund_TimeStamp");
773
            attr3.setName("Refund_TimeStamp");
755
			SimpleDateFormat timestmapFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
774
            SimpleDateFormat timestmapFormat = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
756
			PaymentClient paymentServiceClient = new PaymentClient();
775
            PaymentClient paymentServiceClient = new PaymentClient();
757
			List<Payment> orderPayments =null; 
776
            List<Payment> orderPayments =null; 
758
			if(!t_order.isCod()){
777
            if(!t_order.isCod()){
759
				orderPayments =paymentServiceClient.getClient()
778
                orderPayments =paymentServiceClient.getClient()
760
					.getPaymentForTxnId(t_order.getTransactionId());
779
                .getPaymentForTxnId(t_order.getTransactionId());
761
			}
780
            }
762
			
781
 
763
			if(rfdRadio.equalsIgnoreCase("rfdCoupon")){
782
            if(rfdRadio.equalsIgnoreCase("rfdCoupon")){
764
				if((couponDetails!=null && !("").equalsIgnoreCase(couponDetails)) || (refundAmountCoupon!=null &&!("").equalsIgnoreCase(refundAmountCoupon))){
783
                if((couponDetails!=null && !("").equalsIgnoreCase(couponDetails)) || (refundAmountCoupon!=null &&!("").equalsIgnoreCase(refundAmountCoupon))){
765
					if(Double.parseDouble(refundAmountCoupon) <= t_order.getTotal_amount()){
784
                    if(Double.parseDouble(refundAmountCoupon) <= t_order.getTotal_amount()){
766
						log.info(Double.parseDouble(refundAmountCoupon));
785
                        log.info(Double.parseDouble(refundAmountCoupon));
767
						log.info(t_order.getTotal_amount());
786
                        log.info(t_order.getTotal_amount());
768
						attr1.setValue("Refund By Coupon: "+couponDetails);
787
                        attr1.setValue("Refund By Coupon: "+couponDetails);
769
						attrList.add(attr1);
788
                        attrList.add(attr1);
770
						attr2.setValue(refundAmountCoupon);
789
                        attr2.setValue(refundAmountCoupon);
771
						attrList.add(attr2);
790
                        attrList.add(attr2);
772
						attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
791
                        attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
773
						attrList.add(attr3);
792
                        attrList.add(attr3);
774
						transactionClient.setOrderAttributes(t_order.getId(), attrList);
793
                        transactionClient.setOrderAttributes(t_order.getId(), attrList);
775
						successmsg = "Refund Marked Successful: Through Coupon";
794
                        successmsg = "Refund Marked Successful: Through Coupon";
776
						return "physical-refund-result";
795
                        return "physical-refund-result";
777
					}
796
                    }
778
					else if(orderPayments !=null && !orderPayments.isEmpty()){
797
                    else if(orderPayments !=null && !orderPayments.isEmpty()){
779
						Payment payment = orderPayments.get(0);
798
                        Payment payment = orderPayments.get(0);
780
						if(Double.parseDouble(refundAmountCoupon) <= payment.getAmount()){
799
                        if(Double.parseDouble(refundAmountCoupon) <= payment.getAmount()){
781
							log.info(Double.parseDouble(refundAmountCoupon));
800
                            log.info(Double.parseDouble(refundAmountCoupon));
782
							log.info(payment.getAmount());
801
                            log.info(payment.getAmount());
783
							attr1.setValue("Refund By Coupon: "+couponDetails);
802
                            attr1.setValue("Refund By Coupon: "+couponDetails);
784
							attrList.add(attr1);
803
                            attrList.add(attr1);
785
							attr2.setValue(refundAmountCoupon);
804
                            attr2.setValue(refundAmountCoupon);
786
							attrList.add(attr2);
805
                            attrList.add(attr2);
787
							attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
806
                            attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
788
							attrList.add(attr3);
807
                            attrList.add(attr3);
789
							transactionClient.setOrderAttributes(t_order.getId(), attrList);
808
                            transactionClient.setOrderAttributes(t_order.getId(), attrList);
790
							successmsg = "Refund Marked Successful: Through Coupon";
809
                            successmsg = "Refund Marked Successful: Through Coupon";
791
							return "physical-refund-result";
810
                            return "physical-refund-result";
792
						}
811
                        }
793
						else{
812
                        else{
794
							errorMsg ="Refund Unsuccessful: Due to coupon amount greater than Payment Gateway Amount ";
813
                            errorMsg ="Refund Unsuccessful: Due to coupon amount greater than Payment Gateway Amount ";
795
							return "physical-refund-result";
814
                            return "physical-refund-result";
796
						}
815
                        }
797
					}
816
                    }
798
					errorMsg ="Refund Unsuccessful: Due to coupon amount greater than Order Total Amount ";
817
                    errorMsg ="Refund Unsuccessful: Due to coupon amount greater than Order Total Amount ";
799
				}
818
                }
800
				else{
819
                else{
801
					errorMsg ="Refund Unsuccessful: Due to either coupon details or refund amount is blank ";
820
                    errorMsg ="Refund Unsuccessful: Due to either coupon details or refund amount is blank ";
802
					return "physical-refund-result";
821
                    return "physical-refund-result";
803
				}
822
                }
804
				errorMsg ="Refund Unsuccessful: Due to coupon amount greater than order total amount ";
823
                errorMsg ="Refund Unsuccessful: Due to coupon amount greater than order total amount ";
805
			}
824
            }
806
			if(rfdRadio.equalsIgnoreCase("rfdCheque")){
825
            if(rfdRadio.equalsIgnoreCase("rfdCheque")){
807
				if((chequeDetails!=null && !("").equalsIgnoreCase(chequeDetails)) || (refundAmountCheque!=null &&!("").equalsIgnoreCase(refundAmountCheque))){
826
                if((chequeDetails!=null && !("").equalsIgnoreCase(chequeDetails)) || (refundAmountCheque!=null &&!("").equalsIgnoreCase(refundAmountCheque))){
808
					if(Double.parseDouble(refundAmountCheque) <= t_order.getTotal_amount()){
827
                    if(Double.parseDouble(refundAmountCheque) <= t_order.getTotal_amount()){
809
						attr1.setValue("Refund By Cheque: "+chequeDetails);
828
                        attr1.setValue("Refund By Cheque: "+chequeDetails);
810
						attrList.add(attr1);
829
                        attrList.add(attr1);
811
						attr2.setValue(refundAmountCheque);
830
                        attr2.setValue(refundAmountCheque);
812
						attrList.add(attr2);
831
                        attrList.add(attr2);
813
						attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
832
                        attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
814
						attrList.add(attr3);
833
                        attrList.add(attr3);
815
						transactionClient.setOrderAttributes(t_order.getId(), attrList);
834
                        transactionClient.setOrderAttributes(t_order.getId(), attrList);
816
						successmsg = "Refund Marked Successful: Through Cheque";
835
                        successmsg = "Refund Marked Successful: Through Cheque";
817
						return "physical-refund-result";
836
                        return "physical-refund-result";
818
					}
837
                    }
819
				}
838
                }
820
				else{
839
                else{
821
					errorMsg ="Refund Unsuccessful: Due to either cheque details or refund amount is blank ";
840
                    errorMsg ="Refund Unsuccessful: Due to either cheque details or refund amount is blank ";
822
					return "physical-refund-result";
841
                    return "physical-refund-result";
823
				}
842
                }
824
				errorMsg ="Refund Unsuccessful: Due to cheque amount greater than order total amount ";
843
                errorMsg ="Refund Unsuccessful: Due to cheque amount greater than order total amount ";
825
			}
844
            }
826
			if(rfdRadio.equalsIgnoreCase("rfdGateway")){
845
            if(rfdRadio.equalsIgnoreCase("rfdGateway")){
827
				if((comments!=null && !("").equalsIgnoreCase(comments)) 
846
                if((comments!=null && !("").equalsIgnoreCase(comments)) 
828
						|| (refundAmountGateway!=null &&!("").equalsIgnoreCase(refundAmountGateway))){
847
                        || (refundAmountGateway!=null &&!("").equalsIgnoreCase(refundAmountGateway))){
829
					if(orderPayments !=null && !orderPayments.isEmpty()){
848
                    if(orderPayments !=null && !orderPayments.isEmpty()){
830
						Payment payment = orderPayments.get(0);
849
                        Payment payment = orderPayments.get(0);
831
						if(Double.parseDouble(refundAmountGateway) <= payment.getAmount()){
850
                        if(Double.parseDouble(refundAmountGateway) <= payment.getAmount()){
832
							boolean refundResult = paymentServiceClient.getClient().refundPayment(t_order.getTransactionId(), Double.parseDouble(refundAmountGateway), false);
851
                            boolean refundResult = paymentServiceClient.getClient().refundPayment(t_order.getTransactionId(), Double.parseDouble(refundAmountGateway), false);
833
							if(refundResult){
852
                            if(refundResult){
834
								attr1.setValue("Refund By Payment Gatway: "+comments);
853
                                attr1.setValue("Refund By Payment Gatway: "+comments);
835
								attrList.add(attr1);
854
                                attrList.add(attr1);
836
								attr2.setValue(refundAmountGateway);
855
                                attr2.setValue(refundAmountGateway);
837
								attrList.add(attr2);
856
                                attrList.add(attr2);
838
								attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
857
                                attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
839
								attrList.add(attr3);
858
                                attrList.add(attr3);
840
								transactionClient.setOrderAttributes(t_order.getId(), attrList);
859
                                transactionClient.setOrderAttributes(t_order.getId(), attrList);
841
								successmsg = "Refund Marked Successful: Through Gateway";
860
                                successmsg = "Refund Marked Successful: Through Gateway";
842
								return "physical-refund-result";
861
                                return "physical-refund-result";
843
							}
862
                            }
844
							else{
863
                            else{
845
								if(payment.getGatewayId()==13L){
864
                                if(payment.getGatewayId()==13L){
846
									attr1.setValue("Refund By Innoviti Gatway: "+comments);
865
                                    attr1.setValue("Refund By Innoviti Gatway: "+comments);
847
									attrList.add(attr1);
866
                                    attrList.add(attr1);
848
									attr2.setValue(refundAmountGateway);
867
                                    attr2.setValue(refundAmountGateway);
849
									attrList.add(attr2);
868
                                    attrList.add(attr2);
850
									attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
869
                                    attr3.setValue(timestmapFormat.format(Calendar.getInstance().getTime()));
851
									attrList.add(attr3);
870
                                    attrList.add(attr3);
852
									transactionClient.setOrderAttributes(t_order.getId(), attrList);
871
                                    transactionClient.setOrderAttributes(t_order.getId(), attrList);
853
									successmsg = "Refund Marked Successful: Through Innoviti Payment Gateway.";
872
                                    successmsg = "Refund Marked Successful: Through Innoviti Payment Gateway.";
854
									return "physical-refund-result";
873
                                    return "physical-refund-result";
855
								}
874
                                }
856
								errorMsg ="Refund Unsuccessful: at Payment Gateway ";
875
                                errorMsg ="Refund Unsuccessful: at Payment Gateway ";
857
								return "physical-refund-result";
876
                                return "physical-refund-result";
858
							}
877
                            }
859
						}
878
                        }
860
						else{
879
                        else{
861
							errorMsg ="Refund Unsuccessful: Due to refund Amount is greater than Payment Gateway Amount ";
880
                            errorMsg ="Refund Unsuccessful: Due to refund Amount is greater than Payment Gateway Amount ";
862
							return "physical-refund-result";
881
                            return "physical-refund-result";
863
						}
882
                        }
864
					}
883
                    }
865
					errorMsg ="Refund Unsuccessful: There is no Payment to be refunded ";
884
                    errorMsg ="Refund Unsuccessful: There is no Payment to be refunded ";
866
				}
885
                }
867
				else{
886
                else{
868
					errorMsg ="Refund Unsuccessful: Due to either comments or refund amount is blank ";
887
                    errorMsg ="Refund Unsuccessful: Due to either comments or refund amount is blank ";
869
					return "physical-refund-result";
888
                    return "physical-refund-result";
870
				}
889
                }
871
				
890
 
872
			}
891
            }
873
			
892
 
874
		}
893
        }
875
		catch(Exception e){
894
        catch(Exception e){
876
			log.error(e);
895
            log.error(e);
877
		}
896
        }
878
		return "physical-refund-result";
897
        return "physical-refund-result";
879
	}
898
    }
880
		
899
 
881
	public int getRefundEnabledStatus(){
900
    public int getRefundEnabledStatus(){
882
		try{
901
        try{
883
			TransactionClient transactionServiceClient = new TransactionClient();
902
            TransactionClient transactionServiceClient = new TransactionClient();
884
			in.shop2020.model.v1.order.TransactionService.Client transactionClient
903
            in.shop2020.model.v1.order.TransactionService.Client transactionClient
885
		    = transactionServiceClient.getClient();
904
            = transactionServiceClient.getClient();
886
			in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
905
            in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
887
			if(OrderSource.WEBSITE.getValue()!=t_order.getSource()){
906
            if(OrderSource.WEBSITE.getValue()!=t_order.getSource()){
888
				return 1;
907
                return 1;
889
			}
908
            }
890
			String refundOption=transactionClient.getOrderAttributeValue(orderId, "Refund_Option");
909
            String refundOption=transactionClient.getOrderAttributeValue(orderId, "Refund_Option");
891
			String refundAmount=transactionClient.getOrderAttributeValue(orderId, "Refund_Amount");
910
            String refundAmount=transactionClient.getOrderAttributeValue(orderId, "Refund_Amount");
892
			String refundTimeStamp = transactionClient.getOrderAttributeValue(orderId, "Refund_TimeStamp");
911
            String refundTimeStamp = transactionClient.getOrderAttributeValue(orderId, "Refund_TimeStamp");
893
			List<String> details = new ArrayList<String>();
912
            List<String> details = new ArrayList<String>();
894
			if(refundOption!=null && !("").equalsIgnoreCase(refundOption)){
913
            if(refundOption!=null && !("").equalsIgnoreCase(refundOption)){
895
				details.add("Refund Option:- "+refundOption);
914
                details.add("Refund Option:- "+refundOption);
896
			}
915
            }
897
			
916
 
898
			if(refundAmount!=null && !("").equalsIgnoreCase(refundAmount)){
917
            if(refundAmount!=null && !("").equalsIgnoreCase(refundAmount)){
899
				details.add("Refund Amount:- "+refundAmount);
918
                details.add("Refund Amount:- "+refundAmount);
900
			}
919
            }
901
			
920
 
902
			if(refundTimeStamp!=null && !("").equalsIgnoreCase(refundTimeStamp)){
921
            if(refundTimeStamp!=null && !("").equalsIgnoreCase(refundTimeStamp)){
903
				details.add("Refund TimeStamp:- "+refundTimeStamp);
922
                details.add("Refund TimeStamp:- "+refundTimeStamp);
904
			}
923
            }
905
			setPhysicalRefundDetails(details);
924
            setPhysicalRefundDetails(details);
906
			
925
 
907
			if((refundOption!=null && refundAmount!=null) && (!("").equalsIgnoreCase(refundOption)) && !("").equalsIgnoreCase(refundAmount)){
926
            if((refundOption!=null && refundAmount!=null) && (!("").equalsIgnoreCase(refundOption)) && !("").equalsIgnoreCase(refundAmount)){
908
				System.out.println("Into the Refund Condition");
927
                System.out.println("Into the Refund Condition");
909
				return 0;
928
                return 0;
910
			}
929
            }
911
			
930
 
912
			else if(t_order.isCod()){
931
            else if(t_order.isCod()){
913
				if(setOfrefundableStates.contains(t_order.getStatus()) && SecurityUtils.getSubject().hasRole("TeamLead")){
932
                if(setOfrefundableStates.contains(t_order.getStatus()) && SecurityUtils.getSubject().hasRole("TeamLead")){
914
					System.out.println("Into the COD Status Condition");
933
                    System.out.println("Into the COD Status Condition");
915
					return 2;
934
                    return 2;
916
				}
935
                }
917
			}
936
            }
918
			else{
937
            else{
919
				if(( setOfprepaidrefundableStates.contains(t_order.getStatus()) || setOfrefundableStates.contains(t_order.getStatus()) ) && SecurityUtils.getSubject().hasRole("TeamLead") && (payments.get(0).getStatus() == PaymentStatus.SUCCESS || t_order.isSetOriginalOrderId())){
938
                if(( setOfprepaidrefundableStates.contains(t_order.getStatus()) || setOfrefundableStates.contains(t_order.getStatus()) ) && SecurityUtils.getSubject().hasRole("TeamLead") && (payments.get(0).getStatus() == PaymentStatus.SUCCESS || t_order.isSetOriginalOrderId())){
920
					System.out.println("Into the Prepaid Status Condition");
939
                    System.out.println("Into the Prepaid Status Condition");
921
					return 2;
940
                    return 2;
922
				}
941
                }
923
			}
942
            }
924
		}
943
        }
925
		catch(Exception e){
944
        catch(Exception e){
926
			log.error(e);
945
            log.error(e);
927
		}
946
        }
928
		return 1;
947
        return 1;
929
	}
948
    }
930
	
949
 
931
	public int checkForOriginalOrders(){
950
    public int checkForOriginalOrders(){
932
		try{
951
        try{
933
			TransactionClient transactionServiceClient = new TransactionClient();
952
            TransactionClient transactionServiceClient = new TransactionClient();
934
			in.shop2020.model.v1.order.TransactionService.Client transactionClient
953
            in.shop2020.model.v1.order.TransactionService.Client transactionClient
935
		    = transactionServiceClient.getClient();
954
            = transactionServiceClient.getClient();
936
			in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
955
            in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
937
			if(t_order.getOriginalOrderId()!=0l && t_order.getOriginalOrderId() > 0l){
956
            if(t_order.getOriginalOrderId()!=0l && t_order.getOriginalOrderId() > 0l){
938
				in.shop2020.model.v1.order.Order old_order = transactionClient.getOrder(t_order.getOriginalOrderId());
957
                in.shop2020.model.v1.order.Order old_order = transactionClient.getOrder(t_order.getOriginalOrderId());
939
				if(old_order.isCod()){
958
                if(old_order.isCod()){
940
					return 1;
959
                    return 1;
941
				}
960
                }
942
				else{
961
                else{
943
					return 2;
962
                    return 2;
944
				}
963
                }
945
			}
964
            }
946
		}
965
        }
947
		catch(Exception e){
966
        catch(Exception e){
948
			log.error(e);
967
            log.error(e);
949
		}
968
        }
950
		return 0;
969
        return 0;
951
	}
970
    }
952
	
971
 
953
	public void setPhysicalRefundDetails(List<String> details){
972
    public void setPhysicalRefundDetails(List<String> details){
954
		this.refundDetails = details;
973
        this.refundDetails = details;
955
	}
974
    }
956
	
975
 
957
	public List<String> getPhysicalRefundDetails(){
976
    public List<String> getPhysicalRefundDetails(){
958
		return this.refundDetails;
977
        return this.refundDetails;
959
	}
978
    }
960
	//End:- Added by Manish Sharma for Physical Refunds 	
979
    //End:- Added by Manish Sharma for Physical Refunds 	
961
 
980
 
962
	public void setOrderId(String orderId) {
981
    public void setOrderId(String orderId) {
963
		try {
982
        try {
964
			this.orderId = Long.parseLong(orderId);
983
            this.orderId = Long.parseLong(orderId);
965
		} catch (NumberFormatException e) {
984
        } catch (NumberFormatException e) {
966
			log.error(e);
985
            log.error(e);
967
		}
986
        }
968
	}
987
    }
969
 
988
 
970
	public List<Payment> getPayments() {
989
    public List<Payment> getPayments() {
971
		return payments;
990
        return payments;
972
	}
991
    }
973
 
992
 
974
	public List<ShipmentUpdate> getShipmentUpdates() {
993
    public List<ShipmentUpdate> getShipmentUpdates() {
975
		return shipmentUpdates;
994
        return shipmentUpdates;
976
	}
995
    }
977
 
996
 
978
	public void setShipmentUpdates(List<ShipmentUpdate> shipmentUpdates) {
997
    public void setShipmentUpdates(List<ShipmentUpdate> shipmentUpdates) {
979
		this.shipmentUpdates = shipmentUpdates;
998
        this.shipmentUpdates = shipmentUpdates;
980
	}
999
    }
981
 
1000
 
982
	public Order getOrder() {
1001
    public Order getOrder() {
983
		return order;
1002
        return order;
984
	}
1003
    }
985
 
1004
 
986
	public void setOrder(Order order) {
1005
    public void setOrder(Order order) {
987
		this.order = order;
1006
        this.order = order;
988
	}
1007
    }
989
 
1008
 
990
	public Long getCodTicketId() {
1009
    public Long getCodTicketId() {
991
		return codTicketId;
1010
        return codTicketId;
992
	}
1011
    }
993
 
1012
 
994
	public void setCodTicketId(Long codTicketId) {
1013
    public void setCodTicketId(Long codTicketId) {
995
		this.codTicketId = codTicketId;
1014
        this.codTicketId = codTicketId;
996
	}
1015
    }
997
 
1016
 
998
	public List<Address> getAddresses() {
1017
    public List<Address> getAddresses() {
999
		return addresses;
1018
        return addresses;
1000
	}
1019
    }
1001
 
1020
 
1002
	public void setAddresses(List<Address> addresses) {
1021
    public void setAddresses(List<Address> addresses) {
1003
		this.addresses = addresses;
1022
        this.addresses = addresses;
1004
	}
1023
    }
1005
 
1024
 
1006
	public String getOrderStatusDescription(Order order) {
1025
    public String getOrderStatusDescription(Order order) {
1007
		String status = order.getStatus().getDescription();
1026
        String status = order.getStatus().getDescription();
1008
 
1027
 
1009
		if (order.getStatus() == OrderStatus.DELIVERY_SUCCESS) {
1028
        if (order.getStatus() == OrderStatus.DELIVERY_SUCCESS) {
1010
			status = "Completed";
1029
            status = "Completed";
1011
		}
1030
        }
1012
 
1031
 
1013
		return status;
1032
        return status;
1014
	}
1033
    }
1015
 
1034
 
1016
	public String getCancellationInitiator() {
1035
    public String getCancellationInitiator() {
1017
		return cancellationInitiator;
1036
        return cancellationInitiator;
1018
	}
1037
    }
1019
 
1038
 
1020
	public void setCancellationInitiator(String cancellationInitiator) {
1039
    public void setCancellationInitiator(String cancellationInitiator) {
1021
		this.cancellationInitiator = cancellationInitiator;
1040
        this.cancellationInitiator = cancellationInitiator;
1022
	}
1041
    }
1023
 
1042
 
1024
	public String getCancelReason() {
1043
    public String getCancelReason() {
1025
		return cancelReason;
1044
        return cancelReason;
1026
	}
1045
    }
1027
 
1046
 
1028
	public void setCancelReason(String cancelReason) {
1047
    public void setCancelReason(String cancelReason) {
1029
		this.cancelReason = cancelReason;
1048
        this.cancelReason = cancelReason;
1030
	}
1049
    }
1031
 
1050
 
1032
	public String getBody() {
1051
    public String getBody() {
1033
		return body;
1052
        return body;
1034
	}
1053
    }
1035
 
1054
 
1036
	public void setBody(String body) {
1055
    public void setBody(String body) {
1037
		this.body = body;
1056
        this.body = body;
1038
	}
1057
    }
1039
 
1058
 
1040
	public String getLine1() {
1059
    public String getLine1() {
1041
		return line1;
1060
        return line1;
1042
	}
1061
    }
1043
 
1062
 
1044
	public void setLine1(String line1) {
1063
    public void setLine1(String line1) {
1045
		this.line1 = line1;
1064
        this.line1 = line1;
1046
	}
1065
    }
1047
 
1066
 
1048
	public String getLine2() {
1067
    public String getLine2() {
1049
		return line2;
1068
        return line2;
1050
	}
1069
    }
1051
 
1070
 
1052
	public void setLine2(String line2) {
1071
    public void setLine2(String line2) {
1053
		this.line2 = line2;
1072
        this.line2 = line2;
1054
	}
1073
    }
1055
 
1074
 
1056
	public String getCity() {
1075
    public String getCity() {
1057
		return city;
1076
        return city;
1058
	}
1077
    }
1059
 
1078
 
1060
	public void setCity(String city) {
1079
    public void setCity(String city) {
1061
		this.city = city;
1080
        this.city = city;
1062
	}
1081
    }
1063
 
1082
 
1064
	public String getState() {
1083
    public String getState() {
1065
		return state;
1084
        return state;
1066
	}
1085
    }
1067
 
1086
 
1068
	public void setState(String state) {
1087
    public void setState(String state) {
1069
		this.state = state;
1088
        this.state = state;
1070
	}
1089
    }
1071
 
1090
 
1072
	public String getPin() {
1091
    public String getPin() {
1073
		return pin;
1092
        return pin;
1074
	}
1093
    }
1075
 
1094
 
1076
	public void setPin(String pin) {
1095
    public void setPin(String pin) {
1077
		this.pin = pin;
1096
        this.pin = pin;
1078
	}
1097
    }
1079
 
1098
 
1080
	public String getFreebieItem() {
1099
    public String getFreebieItem() {
1081
		return freebieItem;
1100
        return freebieItem;
1082
	}
1101
    }
1083
 
1102
 
1084
	public void setFreebieItem(String freebieItem) {
1103
    public void setFreebieItem(String freebieItem) {
1085
		this.freebieItem = freebieItem;
1104
        this.freebieItem = freebieItem;
1086
	}
1105
    }
1087
 
1106
 
1088
	public String getDealText() {
1107
    public String getDealText() {
1089
		return dealText;
1108
        return dealText;
1090
	}
1109
    }
1091
 
1110
 
1092
	public void setDealText(String dealText) {
1111
    public void setDealText(String dealText) {
1093
		this.dealText = dealText;
1112
        this.dealText = dealText;
1094
	}
1113
    }
1095
 
1114
 
1096
	public String getParentOrderIdForFreebieOrder() {
1115
    public String getParentOrderIdForFreebieOrder() {
1097
		return parentOrderIdForFreebieOrder;
1116
        return parentOrderIdForFreebieOrder;
1098
	}
1117
    }
1099
 
1118
 
1100
	public void setParentOrderIdForFreebieOrder(String parentOrderIdForFreebieOrder) {
1119
    public void setParentOrderIdForFreebieOrder(String parentOrderIdForFreebieOrder) {
1101
		this.parentOrderIdForFreebieOrder = parentOrderIdForFreebieOrder;
1120
        this.parentOrderIdForFreebieOrder = parentOrderIdForFreebieOrder;
1102
	}
1121
    }
1103
 
1122
 
1104
	public String getFreebieOrderId() {
1123
    public String getFreebieOrderId() {
1105
		return freebieOrderId;
1124
        return freebieOrderId;
1106
	}
1125
    }
1107
 
1126
 
1108
	public void setFreebieOrderId(String freebieOrderId) {
1127
    public void setFreebieOrderId(String freebieOrderId) {
1109
		this.freebieOrderId = freebieOrderId;
1128
        this.freebieOrderId = freebieOrderId;
1110
	}
1129
    }
1111
 
1130
 
1112
    public void setCashAmount(double cashAmount) {
1131
    public void setCashAmount(double cashAmount) {
1113
        this.cashAmount = cashAmount;
1132
        this.cashAmount = cashAmount;
1114
    }
1133
    }
1115
 
1134
 
Line 1138... Line 1157...
1138
    }
1157
    }
1139
 
1158
 
1140
    public void setStoreOrderDetail(StoreOrderDetail storeOrderDetail) {
1159
    public void setStoreOrderDetail(StoreOrderDetail storeOrderDetail) {
1141
        this.storeOrderDetail = storeOrderDetail;
1160
        this.storeOrderDetail = storeOrderDetail;
1142
    }
1161
    }
1143
    
1162
 
1144
  //Start:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
1163
    //Start:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
1145
    public AmazonOrder getAmazonOrder() {
1164
    public AmazonOrder getAmazonOrder() {
1146
		return amazonOrder;
1165
        return amazonOrder;
1147
	}
1166
    }
1148
 
1167
 
1149
	public void setAmazonOrder(AmazonOrder amazonOrder) {
1168
    public void setAmazonOrder(AmazonOrder amazonOrder) {
1150
		this.amazonOrder = amazonOrder;
1169
        this.amazonOrder = amazonOrder;
1151
	}
1170
    }
1152
 
1171
 
1153
	//End:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
1172
    //End:- Added by Manish Sharma for Displaying Logistics Provider Id and Amazon Order Id on 25-Jul-2013
1154
 
1173
 
1155
    public void setProviderName(String providerName) {
1174
    public void setProviderName(String providerName) {
1156
        this.providerName = providerName;
1175
        this.providerName = providerName;
1157
    }
1176
    }
1158
 
1177
 
1159
    public String getProviderName() {
1178
    public String getProviderName() {
1160
        return providerName;
1179
        return providerName;
1161
    }
1180
    }
1162
    
1181
 
1163
    public static void main(String[] args) {
1182
    public static void main(String[] args) {
1164
    	
1183
 
1165
    }
1184
    }
1166
 
1185
 
1167
	public void setGvAmount(long gvAmount) {
1186
    public void setGvAmount(long gvAmount) {
1168
		this.gvAmount = gvAmount;
1187
        this.gvAmount = gvAmount;
1169
	}
1188
    }
1170
 
1189
 
1171
	public long getGvAmount() {
1190
    public long getGvAmount() {
1172
		return gvAmount;
1191
        return gvAmount;
1173
	}
1192
    }
1174
	//Start:- Added by Manish Sharma for Physical Refunds 
1193
    //Start:- Added by Manish Sharma for Physical Refunds 
1175
	public String getRfdRadio() {
1194
    public String getRfdRadio() {
1176
		return rfdRadio;
1195
        return rfdRadio;
1177
	}
1196
    }
1178
 
1197
 
1179
 
1198
 
1180
	public void setRfdRadio(String rfdRadio) {
1199
    public void setRfdRadio(String rfdRadio) {
1181
		this.rfdRadio = rfdRadio;
1200
        this.rfdRadio = rfdRadio;
1182
	}
1201
    }
1183
 
1202
 
1184
 
1203
 
1185
	public String getCouponDetails() {
1204
    public String getCouponDetails() {
1186
		return couponDetails;
1205
        return couponDetails;
1187
	}
1206
    }
1188
 
1207
 
1189
 
1208
 
1190
	public void setCouponDetails(String couponDetails) {
1209
    public void setCouponDetails(String couponDetails) {
1191
		this.couponDetails = couponDetails;
1210
        this.couponDetails = couponDetails;
1192
	}
1211
    }
1193
 
1212
 
1194
 
1213
 
1195
	public String getRefundAmountCoupon() {
1214
    public String getRefundAmountCoupon() {
1196
		return refundAmountCoupon;
1215
        return refundAmountCoupon;
1197
	}
1216
    }
1198
 
1217
 
1199
 
1218
 
1200
	public void setRefundAmountCoupon(String refundAmountCoupon) {
1219
    public void setRefundAmountCoupon(String refundAmountCoupon) {
1201
		this.refundAmountCoupon = refundAmountCoupon;
1220
        this.refundAmountCoupon = refundAmountCoupon;
1202
	}
1221
    }
1203
 
1222
 
1204
 
1223
 
1205
	public String getChequeDetails() {
1224
    public String getChequeDetails() {
1206
		return chequeDetails;
1225
        return chequeDetails;
1207
	}
1226
    }
1208
 
1227
 
1209
 
1228
 
1210
	public void setChequeDetails(String chequeDetails) {
1229
    public void setChequeDetails(String chequeDetails) {
1211
		this.chequeDetails = chequeDetails;
1230
        this.chequeDetails = chequeDetails;
1212
	}
1231
    }
1213
 
1232
 
1214
 
1233
 
1215
	public String getRefundAmountCheque() {
1234
    public String getRefundAmountCheque() {
1216
		return refundAmountCheque;
1235
        return refundAmountCheque;
1217
	}
1236
    }
1218
 
1237
 
1219
 
1238
 
1220
	public void setRefundAmountCheque(String refundAmountCheque) {
1239
    public void setRefundAmountCheque(String refundAmountCheque) {
1221
		this.refundAmountCheque = refundAmountCheque;
1240
        this.refundAmountCheque = refundAmountCheque;
1222
	}
1241
    }
1223
 
1242
 
1224
 
1243
 
1225
	public String getRefundAmountGateway() {
1244
    public String getRefundAmountGateway() {
1226
		return refundAmountGateway;
1245
        return refundAmountGateway;
1227
	}
1246
    }
1228
 
1247
 
1229
 
1248
 
1230
	public void setRefundAmountGateway(String refundAmountGateway) {
1249
    public void setRefundAmountGateway(String refundAmountGateway) {
1231
		this.refundAmountGateway = refundAmountGateway;
1250
        this.refundAmountGateway = refundAmountGateway;
1232
	}
1251
    }
1233
 
1252
 
1234
 
1253
 
1235
	public String getComments() {
1254
    public String getComments() {
1236
		return comments;
1255
        return comments;
1237
	}
1256
    }
1238
 
1257
 
1239
 
1258
 
1240
	public void setComments(String comments) {
1259
    public void setComments(String comments) {
1241
		this.comments = comments;
1260
        this.comments = comments;
1242
	}
1261
    }
1243
	
1262
 
1244
	public String getErrorMsg(){
1263
    public String getErrorMsg(){
1245
        return this.errorMsg;
1264
        return this.errorMsg;
1246
    }
1265
    }
1247
	
1266
 
1248
	public String getSuccessMessage(){
1267
    public String getSuccessMessage(){
1249
		return this.successmsg ;
1268
        return this.successmsg ;
-
 
1269
    }
1250
	}
1270
 
-
 
1271
    public void setBillingWarehouseName(String billingWarehouseName) {
1251
	//End:- Added by Manish Sharma for Physical Refunds 
1272
        this.billingWarehouseName = billingWarehouseName;
-
 
1273
    }
-
 
1274
 
-
 
1275
    public String getBillingWarehouseName() {
-
 
1276
        return billingWarehouseName;
-
 
1277
    }
-
 
1278
    
-
 
1279
    
1252
}
1280
}
1253
1281