Subversion Repositories SmartDukaan

Rev

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

Rev 10941 Rev 10944
Line 336... Line 336...
336
	            	}
336
	            	}
337
	            	
337
	            	
338
	            	transactionId =  String.valueOf(transaction_client.createTransaction(txn));
338
	            	transactionId =  String.valueOf(transaction_client.createTransaction(txn));
339
	            	row.getCell(PAISAPAY_ID_INDEX).setCellType(Cell.CELL_TYPE_STRING);
339
	            	row.getCell(PAISAPAY_ID_INDEX).setCellType(Cell.CELL_TYPE_STRING);
340
	            	String paisaPayId = row.getCell(PAISAPAY_ID_INDEX).getStringCellValue();
340
	            	String paisaPayId = row.getCell(PAISAPAY_ID_INDEX).getStringCellValue();
341
	            	createPayment(user, paisaPayId, totalPrice);
341
	            	long paymentId = createPayment(user, paisaPayId, totalPrice);
342
	            	
342
	            	
343
	                logger.info("Successfully created transaction: " + transactionId + " for amount: " + totalPrice);
343
	                logger.info("Successfully created transaction: " + transactionId + " for amount: " + totalPrice);
344
	                
344
	                
345
	                Transaction transaction = transaction_client.getTransaction(Long.parseLong(transactionId));
345
	                Transaction transaction = transaction_client.getTransaction(Long.parseLong(transactionId));
346
	                Order order = transaction.getOrders().get(0);
346
	                Order order = transaction.getOrders().get(0);
Line 362... Line 362...
362
	                ebayOrder.setPaisaPayId(paisaPayId);
362
	                ebayOrder.setPaisaPayId(paisaPayId);
363
	                ebayOrder.setListingName(ebayItem.getListingName());
363
	                ebayOrder.setListingName(ebayItem.getListingName());
364
	                ebayOrder.setSubsidyAmount(ebayItem.getSubsidy()*quantity);
364
	                ebayOrder.setSubsidyAmount(ebayItem.getSubsidy()*quantity);
365
	                ebayOrder.setListingPrice(listingPrice);
365
	                ebayOrder.setListingPrice(listingPrice);
366
	                transaction_client.createEbayOrder(ebayOrder);
366
	                transaction_client.createEbayOrder(ebayOrder);
-
 
367
	                in.shop2020.payments.PaymentService.Client client = new PaymentClient().getClient();
-
 
368
	                client.updatePaymentDetails(paymentId, null, null, null, null, null, null, paisaPayId, null, PaymentStatus.SUCCESS, null, null);
367
	            } catch (Exception e) {
369
	            } catch (Exception e) {
368
	                logger.error("Error while creating order for rowId " + rowId, e);
370
	                logger.error("Error while creating order for rowId " + rowId, e);
369
	                addActionError("Error while creating order for rowId " + rowId);
371
	                addActionError("Error while creating order for rowId " + rowId);
370
	                setErrorMsg(getErrorMsg() + "<br>Error while creating order for row number " + rowId);
372
	                setErrorMsg(getErrorMsg() + "<br>Error while creating order for row number " + rowId);
371
	                continue;
373
	                continue;
Line 411... Line 413...
411
            lineItem.setColor(item.getColor());
413
            lineItem.setColor(item.getColor());
412
        }
414
        }
413
    	return lineItem;
415
    	return lineItem;
414
	}
416
	}
415
    
417
    
416
    private void createPayment(User user, String paisaPayId, double amount) throws NumberFormatException, PaymentException, TException {
418
    private long createPayment(User user, String paisaPayId, double amount) throws NumberFormatException, PaymentException, TException {
417
        in.shop2020.payments.PaymentService.Client client = new PaymentClient().getClient();
419
        in.shop2020.payments.PaymentService.Client client = new PaymentClient().getClient();
418
        long paymentId = client.createPayment(user.getUserId(), amount, EBAY_GATEWAY_ID, Long.valueOf(transactionId), false);
420
        return 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.SUCCESS, null, null);
-
 
420
    }   
421
    }   
421
    
422
    
422
	public String index() {
423
	public String index() {
423
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), "/ebay-dashboard"))
424
        if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), "/ebay-dashboard"))
424
            return "authfail";
425
            return "authfail";