Subversion Repositories SmartDukaan

Rev

Rev 8872 | Rev 8896 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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