Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
8182 amar.kumar 1
package in.shop2020.support.controllers;
2
 
3
import java.io.File;
4
import java.io.FileInputStream;
5
import java.text.SimpleDateFormat;
6
import java.util.ArrayList;
7
import java.util.Calendar;
8
import java.util.Collection;
9
import java.util.Collections;
10
import java.util.Date;
11
import java.util.List;
12
 
13
import in.shop2020.logistics.DeliveryType;
14
import in.shop2020.logistics.LogisticsInfo;
15
import in.shop2020.logistics.LogisticsService;
16
import in.shop2020.logistics.PickUpType;
17
import in.shop2020.model.v1.catalog.CatalogService;
18
import in.shop2020.model.v1.catalog.CatalogServiceException;
19
import in.shop2020.model.v1.catalog.EbayItem;
20
import in.shop2020.model.v1.catalog.Item;
21
import in.shop2020.model.v1.inventory.InventoryService;
22
import in.shop2020.model.v1.inventory.InventoryServiceException;
8892 amar.kumar 23
import in.shop2020.model.v1.inventory.InventoryType;
8291 amar.kumar 24
import in.shop2020.model.v1.inventory.VendorItemPricing;
8182 amar.kumar 25
import in.shop2020.model.v1.inventory.Warehouse;
8892 amar.kumar 26
import in.shop2020.model.v1.inventory.WarehouseType;
8182 amar.kumar 27
import in.shop2020.model.v1.order.EbayOrder;
28
import in.shop2020.model.v1.order.LineItem;
29
import in.shop2020.model.v1.order.Order;
30
import in.shop2020.model.v1.order.OrderSource;
31
import in.shop2020.model.v1.order.OrderStatus;
32
import in.shop2020.model.v1.order.OrderType;
33
import in.shop2020.model.v1.order.SourceDetail;
34
import in.shop2020.model.v1.order.Transaction;
35
import in.shop2020.model.v1.order.TransactionStatus;
36
import in.shop2020.model.v1.order.TransactionService.Client;
37
import in.shop2020.model.v1.user.Address;
38
import in.shop2020.model.v1.user.User;
39
import in.shop2020.payments.Attribute;
40
import in.shop2020.payments.PaymentException;
41
import in.shop2020.payments.PaymentStatus;
42
import in.shop2020.thrift.clients.CatalogClient;
43
import in.shop2020.thrift.clients.InventoryClient;
44
import in.shop2020.thrift.clients.LogisticsClient;
45
import in.shop2020.thrift.clients.PaymentClient;
46
import in.shop2020.thrift.clients.TransactionClient;
47
import in.shop2020.thrift.clients.UserClient;
48
import in.shop2020.support.utils.ReportsUtils;
49
 
50
import javax.servlet.http.HttpServletRequest;
51
import javax.servlet.http.HttpSession;
52
 
53
import org.apache.commons.io.FileUtils;
54
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
55
import org.apache.poi.ss.usermodel.Cell;
56
import org.apache.poi.ss.usermodel.Row;
57
import org.apache.poi.ss.usermodel.Sheet;
58
import org.apache.poi.ss.usermodel.Workbook;
59
import org.apache.struts2.convention.annotation.InterceptorRef;
60
import org.apache.struts2.convention.annotation.InterceptorRefs;
61
import org.apache.struts2.convention.annotation.Result;
62
import org.apache.struts2.convention.annotation.Results;
63
import org.apache.struts2.interceptor.ServletRequestAware;
64
import org.apache.thrift.TException;
65
import org.slf4j.Logger;
66
import org.slf4j.LoggerFactory;
67
 
68
import com.opensymphony.xwork2.ActionSupport;
69
 
70
@SuppressWarnings("serial")
71
@InterceptorRefs({
72
    @InterceptorRef("defaultStack"),
73
    @InterceptorRef("login")
74
})
75
@Results({
76
    @Result(name="authfail", type="redirectAction", params = {"actionName" , "reports"})
77
})
78
public class EbayPsOrderCreatorController extends ActionSupport implements ServletRequestAware {
79
 
80
	private static Logger logger = LoggerFactory.getLogger(EbayPsOrderCreatorController.class);
81
 
82
	private HttpServletRequest request;
83
    private HttpSession session;
84
 
85
    private static final int EBAY_SOURCE_ID = 6;
86
 
87
    private static final int SALES_RECORD_NUM_INDEX = 0;
88
    private static final int QUANTITY_INDEX = 2;
89
    private static final int AMOUNT_INDEX = 3;
90
    private static final int TRANSACTION_DATE_INDEX = 4;
91
    private static final int SHIP_DATE_INDEX = 5;
92
    private static final int PAISAPAY_ID_INDEX = 7;
93
    private static final int COURIER_INDEX = 8;
94
    private static final int CUST_MOBILE_INDEX = 13;
95
    private static final int EBAY_LISTINGID_INDEX = 14;
96
    private static final int AWB_INDEX = 15;
97
    private static final int WAREHOUSE_ID_INDEX = 17;
8488 amar.kumar 98
    private static final int OVERRIDE_BILLING_PRICE_INDEX = 18;
8182 amar.kumar 99
 
100
 
8196 amar.kumar 101
    private static final int EBAY_GATEWAY_ID = 16;
8182 amar.kumar 102
 
103
    private static final String bluedart = "BLUE DART";
104
    private static final String aramex = "ARAMEX";
105
    private static final String dtdc = "DTDC";
106
    private static final String fedex = "FEDEX";
8574 amar.kumar 107
    private static final String dotzot = "DOTZOT";
8182 amar.kumar 108
 
109
    private SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy");
110
 
111
    private File orderDataFile;
112
    private String orderDataFileName;
113
    private String transactionId;
114
    private String errorMsg = "";
115
    private Long rowId = 0L;
116
 
117
    public String create() throws TException {
118
        File fileToCreate = null;
119
        orderDataFileName = "OrderSheet_"+EBAY_SOURCE_ID+"_"+(new Date().toString());
120
        try {
121
            fileToCreate = new File("/tmp/", this.orderDataFileName);
122
            FileUtils.copyFile(this.orderDataFile, fileToCreate);
123
        } catch (Exception e) {
124
           logger.error("Error while writing order data file to the local file system for Ebay", e);
125
           addActionError("Error while writing order data file to the local file system");
126
        }
127
 
128
 
129
        if(checkForErrors())
130
            return "authsuccess";
131
 
132
        //Parse the file and submit the data for update to the transaction service
133
        Workbook wb = null;
134
        try {
135
            wb = new HSSFWorkbook(new FileInputStream(fileToCreate));
136
        } catch (Exception e) {
137
            logger.error("Unable to open the File for Order Creation for Ebay ", e);
8303 amar.kumar 138
            setErrorMsg(getErrorMsg() + "Error in opening File for Order creation");
8182 amar.kumar 139
            addActionError("Unable to open the File for Order creation");
140
        }
141
        if(checkForErrors())
142
            return "authsuccess";
143
 
144
        SourceDetail sourceDetail = null;
145
        User user = null;
146
        TransactionClient tsc = null;
147
        try {
148
            tsc = new TransactionClient();
149
			sourceDetail = tsc.getClient().getSourceDetail(EBAY_SOURCE_ID);
150
        } catch (Exception e) {
151
            logger.error("Unable to establish connection to the transaction service", e);
8303 amar.kumar 152
            setErrorMsg(getErrorMsg() + "Error in Order Service while getting Ebay Source Detail");
153
            addActionError("Error in Order Service");
8182 amar.kumar 154
		}
155
 
156
        if(checkForErrors())
157
            return "authsuccess";
158
 
159
	    try {   
160
	        in.shop2020.model.v1.user.UserContextService.Client userClient = new UserClient().getClient();
161
	        user = userClient.getUserByEmail(sourceDetail.getEmail());
162
	    } catch (Exception e) {
163
	        logger.error("Unable to establish connection to the User service", e);
8303 amar.kumar 164
	        setErrorMsg(getErrorMsg() + "Unable to get Default Email for Ebay ");
165
	        addActionError("Unable to get Default Email for Ebay ");
8182 amar.kumar 166
		}
167
 
168
        if(checkForErrors())
169
            return "authsuccess";
170
 
171
        Sheet sheet = wb.getSheetAt(0);
172
        Row firstRow = sheet.getRow(0);
173
        for (Row row : sheet) {
174
        	long orderCountForRow = 0;
8303 amar.kumar 175
        	rowId++;
8182 amar.kumar 176
            if(row.equals(firstRow))
177
                continue;
178
        	try {
8303 amar.kumar 179
	            Transaction txn = new Transaction();
180
	            txn.setShoppingCartid(user.getActiveCartId());
181
	            txn.setCustomer_id(user.getUserId());
182
	            txn.setCreatedOn(new Date().getTime());
183
	            txn.setTransactionStatus(TransactionStatus.INIT);
184
	            txn.setStatusDescription("Order for Ebay ");
185
 
186
	            List<Order> orders = new ArrayList<Order>();
187
 
188
	            row.getCell(EBAY_LISTINGID_INDEX).setCellType(Cell.CELL_TYPE_STRING);
189
	            String ebayListingId = row.getCell(EBAY_LISTINGID_INDEX).getStringCellValue();
190
	    		CatalogService.Client catalogClient = new CatalogClient().getClient();
191
	    		EbayItem ebayItem = catalogClient.getEbayItem(ebayListingId);
192
	    		double listingPrice = 0;
193
	    		double overriddenPrice = 0;
194
	    		double totalPrice = 0;
8488 amar.kumar 195
	    		Cell overriddenPriceCell = row.getCell(OVERRIDE_BILLING_PRICE_INDEX);
8303 amar.kumar 196
	        	if(overriddenPriceCell  != null && overriddenPriceCell .getCellType() != Cell.CELL_TYPE_BLANK) {
8488 amar.kumar 197
	        		overriddenPrice = row.getCell(OVERRIDE_BILLING_PRICE_INDEX).getNumericCellValue();
8303 amar.kumar 198
	        	}
199
 
200
	    		long quantity = new Double(row.getCell(QUANTITY_INDEX).getNumericCellValue()).longValue();
201
	    		String totalPriceString = row.getCell(AMOUNT_INDEX).getStringCellValue();
202
	    		if(overriddenPrice>=1) {
203
	    			totalPrice = overriddenPrice*quantity;
204
	    			listingPrice = (Double.parseDouble(totalPriceString.substring(3).replace(",","")))/quantity;
205
	    		} else {
206
	    			totalPrice = Double.parseDouble(totalPriceString.substring(3).replace(",",""));
207
	    			listingPrice = totalPrice/quantity;
208
	    		}
209
 
210
	        	LineItem lineItem = null;
211
	        	try {
212
	        		lineItem = createLineItem(ebayItem.getItemId(), quantity, totalPrice);
8569 amar.kumar 213
	        		Double salesRecordNumber = row.getCell(SALES_RECORD_NUM_INDEX).getNumericCellValue();
214
	        		row.getCell(PAISAPAY_ID_INDEX).setCellType(Cell.CELL_TYPE_STRING);
215
	            	String paisaPayId = row.getCell(PAISAPAY_ID_INDEX).getStringCellValue();
216
	        		lineItem.setExtra_info("PaisaPayId = " + paisaPayId + " SalesRecordNumber = " + salesRecordNumber);
8303 amar.kumar 217
	        	} catch (Exception tex) {
218
	        		logger.error("Unable to create order for sales Rec Number " + row.getCell(SALES_RECORD_NUM_INDEX).getNumericCellValue(), tex);
219
	        		setErrorMsg(getErrorMsg() + "<br>Unable to create lineitem using catalog info for RowId " + rowId);
220
	    	        addActionError("Unable to create order for sales Rec Number " + row.getCell(SALES_RECORD_NUM_INDEX).getNumericCellValue());
221
	    	        continue;
222
	        	}
223
	            Order t_order = new Order();
224
	            t_order.setCustomer_id(user.getUserId());
225
	            t_order.setCustomer_email(sourceDetail.getEmail());
226
	        	t_order.setCustomer_name("Ebay");
227
	            try {
228
	            	row.getCell(CUST_MOBILE_INDEX).setCellType(Cell.CELL_TYPE_STRING);
229
	            	t_order.setCustomer_mobilenumber(row.getCell(CUST_MOBILE_INDEX).getStringCellValue());
230
	            } catch (Exception e) {
231
	            	addActionError("Error in reading mobile Number for rowNumber " + row.getRowNum());
232
	            	setErrorMsg(getErrorMsg() + "<br>Unable to create lineitem using catalog info for RowId " + rowId);
233
	            	logger.error("Error in reading mobile Number for rowNumber " + row.getRowNum());
234
	            }	
235
	            //t_order.setTotal_amount(lineItem.getTotal_price());            
236
	            t_order.setTotal_weight(lineItem.getTotal_weight());
237
	            t_order.setLineitems(Collections.singletonList(lineItem));            
238
	            t_order.setStatus(OrderStatus.PAYMENT_PENDING);
239
	            t_order.setStatusDescription("Payment Pending");
240
	            t_order.setCreated_timestamp(new Date().getTime());
241
	            t_order.setCod(false);
242
	            try {
8925 amar.kumar 243
	            	//Date shippingDate = interchangeDateAndMonth(row.getCell(SHIP_DATE_INDEX).getDateCellValue());
244
	            	Date shippingDate = row.getCell(SHIP_DATE_INDEX).getDateCellValue();
8303 amar.kumar 245
	            	t_order.setPromised_shipping_time(shippingDate.getTime());
246
	            	t_order.setExpected_shipping_time(shippingDate.getTime());
247
	            	/*t_order.setPromised_shipping_time(sdf.parse(row.getCell(SHIP_DATE_INDEX).getStringCellValue()).getTime());
248
	            	t_order.setExpected_shipping_time(sdf.parse(row.getCell(SHIP_DATE_INDEX).getStringCellValue()).getTime());*/
249
	            	Calendar time = Calendar.getInstance();
250
	            	time.setTimeInMillis(t_order.getExpected_shipping_time());
251
	            	time.add(Calendar.DAY_OF_MONTH, 3);
252
	            	t_order.setPromised_delivery_time(time.getTimeInMillis());
253
	            	t_order.setExpected_delivery_time(time.getTimeInMillis());
254
	            } catch(Exception e) {
255
	            	addActionError("Error in updating Shipping Time for row number " + rowId);
256
	            	logger.error("Error in updating Shipping Time for row number " + rowId,e);
8343 amar.kumar 257
	            	continue;
8303 amar.kumar 258
	            }
259
 
260
	            //TODO Delivery time
261
	            InventoryService.Client inventoryClient = null;
262
	            Warehouse fulfillmentWarehouse= null; 
263
	            try {
264
	            	inventoryClient = new InventoryClient().getClient();
265
	            	Cell warehouseCell = row.getCell(WAREHOUSE_ID_INDEX);
266
	            	if(warehouseCell != null && warehouseCell.getCellType() != Cell.CELL_TYPE_BLANK) { 
267
	            		fulfillmentWarehouse = inventoryClient.getWarehouse(new Double(row.getCell(WAREHOUSE_ID_INDEX).getNumericCellValue()).longValue());
268
 
269
	            	} else if (ebayItem.getDefaultWarehouseId()!=0 ){
270
	            		fulfillmentWarehouse = inventoryClient.getWarehouse(ebayItem.getDefaultWarehouseId());
271
	            	} else {
272
	            		List<Long> itemAvailability = inventoryClient.getItemAvailabilityAtLocation(ebayItem.getItemId(), 1);
273
	            		fulfillmentWarehouse = inventoryClient.getWarehouse(itemAvailability.get(0));
274
	            	}
275
	            	t_order.setFulfilmentWarehouseId(fulfillmentWarehouse.getId());
8892 amar.kumar 276
					long billingWarehouseId = 0;
277
					if(fulfillmentWarehouse.getBillingWarehouseId()== 0) {
278
						inventoryClient = new InventoryClient().getClient();
279
						List<Warehouse> warehouses = inventoryClient.getWarehouses(WarehouseType.OURS, InventoryType.GOOD, fulfillmentWarehouse.getVendor().getId(), 0, 0);
280
						for(Warehouse warehouse : warehouses) {
281
							if(warehouse.getBillingWarehouseId()!=0) {
282
								billingWarehouseId = warehouse.getBillingWarehouseId();
283
				                break;
284
							}
285
						}
286
					}else {
287
						billingWarehouseId = fulfillmentWarehouse.getBillingWarehouseId();
288
					}
289
 
290
					t_order.setWarehouse_id(billingWarehouseId);
291
	        		//t_order.setWarehouse_id(fulfillmentWarehouse.getBillingWarehouseId());
8303 amar.kumar 292
	        		VendorItemPricing vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), fulfillmentWarehouse.getVendor().getId());
293
	        		t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
294
	        		t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
295
				} catch (InventoryServiceException e) {
296
					addActionError("Error in updating WarehouseId for row number " + rowId);
297
					setErrorMsg(getErrorMsg() + "<br>Error in updating WarehouseId for row number  " + rowId);
298
	            	logger.error("Error in updating WarehouseId for row number " + rowId,e);
8488 amar.kumar 299
	            	continue;
8303 amar.kumar 300
				}
301
 
302
				String provider = row.getCell(COURIER_INDEX).getStringCellValue();
303
				if(provider.equals(bluedart)) {
304
					t_order.setLogistics_provider_id(8);
305
				} else if(provider.equals(aramex)) {
306
					t_order.setLogistics_provider_id(9);
307
				} else if(provider.equals(dtdc)) {
308
					t_order.setLogistics_provider_id(10);
309
				} else if(provider.equals(fedex)) {
310
					t_order.setLogistics_provider_id(11);
8574 amar.kumar 311
				} else if(provider.equals(dotzot)) {
312
					t_order.setLogistics_provider_id(15);
8303 amar.kumar 313
				} else {
8573 amar.kumar 314
					setErrorMsg(getErrorMsg() + "<br>Unknown logistics provider found for row number " + rowId);
315
	            	logger.error("Unknown logistics provider found for row number " + rowId);
316
	            	continue;
8303 amar.kumar 317
				}
318
 
319
				row.getCell(AWB_INDEX).setCellType(Cell.CELL_TYPE_STRING);
320
				t_order.setAirwaybill_no(row.getCell(AWB_INDEX).getStringCellValue());
321
				t_order.setTracking_id(row.getCell(AWB_INDEX).getStringCellValue());
322
	            t_order.setTotal_amount(totalPrice);
323
	            t_order.setOrderType(OrderType.B2C);
324
	            t_order.setSource(EBAY_SOURCE_ID);
325
	            orders.add(t_order);
326
	            orderCountForRow++;
327
 
328
	            txn.setOrders(orders);
329
	            Client transaction_client = new TransactionClient().getClient();
330
	            try {
331
	            	long salesRecNumber = new Double(row.getCell(SALES_RECORD_NUM_INDEX).getNumericCellValue()).longValue();
332
	            	if(transaction_client.ebayOrderExists(salesRecNumber, ebayItem.getEbayListingId())) {
333
	            		setErrorMsg(getErrorMsg() + "<br>Duplicate order for salesRecNumber " + salesRecNumber + " and listingId " + ebayItem.getEbayListingId() + " for row number  " + rowId);
334
	            		logger.error("Duplicate order for salesRecNumber " + salesRecNumber + " and listingId " + ebayItem.getEbayListingId());
8342 amar.kumar 335
	            		continue;
8303 amar.kumar 336
	            	}
337
 
338
	            	transactionId =  String.valueOf(transaction_client.createTransaction(txn));
339
	            	row.getCell(PAISAPAY_ID_INDEX).setCellType(Cell.CELL_TYPE_STRING);
340
	            	String paisaPayId = row.getCell(PAISAPAY_ID_INDEX).getStringCellValue();
341
	            	createPayment(user, paisaPayId, totalPrice);
342
 
343
	                logger.info("Successfully created transaction: " + transactionId + " for amount: " + totalPrice);
344
 
345
	                Transaction transaction = transaction_client.getTransaction(Long.parseLong(transactionId));
346
	                Order order = transaction.getOrders().get(0);
347
 
348
	                inventoryClient.reserveItemInWarehouse(ebayItem.getItemId(), fulfillmentWarehouse.getId(), 1, 
349
	                		order.getId(), order.getCreated_timestamp(), order.getPromised_shipping_time(), order.getLineitems().get(0).getQuantity());
350
 
351
	                EbayOrder ebayOrder = new EbayOrder();
352
	                ebayOrder.setEbayListingId(ebayItem.getEbayListingId());
353
	                ebayOrder.setSalesRecordNumber(new Double(row.getCell(SALES_RECORD_NUM_INDEX).getNumericCellValue()).longValue());
354
	                try {
8925 amar.kumar 355
	                	//Date ebayTransactionDate = interchangeDateAndMonth(row.getCell(TRANSACTION_DATE_INDEX).getDateCellValue());
356
	                	Date ebayTransactionDate = row.getCell(TRANSACTION_DATE_INDEX).getDateCellValue();
8303 amar.kumar 357
	                	ebayOrder.setEbayTxnDate(ebayTransactionDate.getTime());
358
	                } catch (Exception e) {
359
	                	logger.error("Error in setting transaction date for Ebay Order with OrderId : " + order.getId());
360
	                }
361
	                ebayOrder.setOrderId(order.getId());
362
	                ebayOrder.setPaisaPayId(paisaPayId);
363
	                ebayOrder.setListingName(ebayItem.getListingName());
364
	                ebayOrder.setSubsidyAmount(ebayItem.getSubsidy()*quantity);
365
	                ebayOrder.setListingPrice(listingPrice);
366
	                transaction_client.createEbayOrder(ebayOrder);
367
	            } catch (Exception e) {
368
	                logger.error("Error while creating order for rowId " + rowId, e);
369
	                addActionError("Error while creating order for rowId " + rowId);
370
	                setErrorMsg(getErrorMsg() + "<br>Error while creating order for row number " + rowId);
371
	                continue;
372
	    		}
373
        	} catch (Exception e) {
8372 amar.kumar 374
        		logger.error("Error while creating order for row number " + rowId, e);
8303 amar.kumar 375
        		setErrorMsg(getErrorMsg() + "<br>Error while creating order for row number " + rowId);
376
        		continue;
8182 amar.kumar 377
        	}
378
        }
379
 
380
        checkForErrors();
381
        return "authsuccess";
382
    }
383
 
8925 amar.kumar 384
    /*private Date interchangeDateAndMonth(Date date) {
8281 amar.kumar 385
		Date updatedDate = new Date(date.getTime());
8286 amar.kumar 386
		updatedDate.setDate(date.getMonth() + 1);
387
		updatedDate.setMonth(date.getDate() - 1);
8281 amar.kumar 388
		return updatedDate;
8925 amar.kumar 389
	}*/
8281 amar.kumar 390
 
391
	private LineItem createLineItem(long itemId, long quantity, double amount) throws CatalogServiceException, TException {
8182 amar.kumar 392
    	LineItem lineItem = new LineItem();
393
    	CatalogService.Client catalogClient = new CatalogClient().getClient();
394
    	Item item = catalogClient.getItem(itemId);
395
 
396
    	lineItem.setProductGroup(item.getProductGroup());
397
        lineItem.setBrand(item.getBrand());
398
        lineItem.setModel_number(item.getModelNumber());
399
        lineItem.setModel_name(item.getModelName());
400
        lineItem.setExtra_info(item.getFeatureDescription());
401
        lineItem.setQuantity(quantity);
402
        lineItem.setItem_id(item.getId());
8241 amar.kumar 403
        lineItem.setUnit_weight(item.getWeight());
404
        lineItem.setTotal_weight(item.getWeight()*quantity);
8182 amar.kumar 405
        lineItem.setUnit_price(amount/quantity);
406
        lineItem.setTotal_price(amount);
407
 
408
        if (item.getColor() == null || "NA".equals(item.getColor())) {
409
            lineItem.setColor("");
410
        } else {
411
            lineItem.setColor(item.getColor());
412
        }
413
    	return lineItem;
414
	}
415
 
416
    private void createPayment(User user, String paisaPayId, double amount) throws NumberFormatException, PaymentException, TException {
417
        in.shop2020.payments.PaymentService.Client client = new PaymentClient().getClient();
418
        long paymentId = client.createPayment(user.getUserId(), amount, EBAY_GATEWAY_ID, Long.valueOf(transactionId), false);
419
        client.updatePaymentDetails(paymentId, null, null, null, null, null, null, paisaPayId, null, PaymentStatus.PENDING, null, null);
420
    }   
421
 
422
	public String index() {
423
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), "/ebay-dashboard"))
424
            return "authfail";
425
        checkForErrors();
426
        return "authsuccess";
427
    }
428
 
429
	private boolean checkForErrors(){
430
        Collection<String> actionErrors = getActionErrors();
431
        if(actionErrors != null && !actionErrors.isEmpty()){
432
            for (String str : actionErrors) {
433
                errorMsg += "<BR/>" + str;
434
            }
435
            return true;
436
        }
437
        return false;
438
    }
439
 
440
	@Override
441
	public void setServletRequest(HttpServletRequest request) {
442
		this.request = request;
443
        this.session = request.getSession();
444
	}
445
 
446
	public String getErrorMsg() {
447
		return errorMsg;
448
	}
449
 
450
	public void setErrorMsg(String errorMsg) {
451
		this.errorMsg = errorMsg;
452
	}
453
 
454
	public Long getRowId() {
455
		return rowId;
456
	}
457
 
458
	public void setRowId(Long rowId) {
459
		this.rowId = rowId;
460
	}
461
 
462
	public File getOrderDataFile() {
463
		return orderDataFile;
464
	}
465
 
466
	public void setOrderDataFile(File orderDataFile) {
467
		this.orderDataFile = orderDataFile;
468
	}
469
 
8303 amar.kumar 470
 
8182 amar.kumar 471
 
472
}