| Line 21... |
Line 21... |
| 21 |
import java.util.Date;
|
21 |
import java.util.Date;
|
| 22 |
import java.util.HashMap;
|
22 |
import java.util.HashMap;
|
| 23 |
import java.util.List;
|
23 |
import java.util.List;
|
| 24 |
import java.util.Map;
|
24 |
import java.util.Map;
|
| 25 |
|
25 |
|
| - |
|
26 |
import org.apache.commons.logging.Log;
|
| - |
|
27 |
import org.apache.commons.logging.LogFactory;
|
| 26 |
import org.apache.thrift.TException;
|
28 |
import org.apache.thrift.TException;
|
| 27 |
import org.slf4j.Logger;
|
- |
|
| 28 |
import org.slf4j.LoggerFactory;
|
- |
|
| 29 |
import org.springframework.context.ApplicationContext;
|
29 |
import org.springframework.context.ApplicationContext;
|
| 30 |
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
30 |
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
| 31 |
|
31 |
|
| 32 |
public class PaymentServiceHandler implements Iface {
|
32 |
public class PaymentServiceHandler implements Iface {
|
| 33 |
|
33 |
|
| 34 |
private static Logger logger = LoggerFactory.getLogger(PaymentServiceHandler.class);
|
34 |
private static final Log logger = LogFactory.getLog(PaymentServiceHandler.class);
|
| - |
|
35 |
|
| 35 |
|
36 |
|
| 36 |
/**
|
37 |
/**
|
| 37 |
* Enum of all statuses that can be returned by the HDFC gateway
|
38 |
* Enum of all statuses that can be returned by the HDFC gateway
|
| 38 |
*
|
39 |
*
|
| 39 |
* @author Chandranshu
|
40 |
* @author Chandranshu
|
| Line 368... |
Line 369... |
| 368 |
refund.setAttempts(0);
|
369 |
refund.setAttempts(0);
|
| 369 |
return refundHandler.createRefund(refund);
|
370 |
return refundHandler.createRefund(refund);
|
| 370 |
}
|
371 |
}
|
| 371 |
|
372 |
|
| 372 |
@Override
|
373 |
@Override
|
| 373 |
public synchronized boolean capturePayment(long merchantTxnId) throws PaymentException, TException {
|
374 |
public synchronized boolean capturePayment(long merchantTxnId, boolean isDigital) throws PaymentException, TException {
|
| 374 |
logger.info("Attempting to capture payment corresponding to our transaction " + merchantTxnId);
|
375 |
logger.info("Attempting to capture payment corresponding to our transaction " + merchantTxnId + " and Is Digital is:" + isDigital);
|
| - |
|
376 |
List<in.shop2020.payment.domain.Payment> payments;
|
| - |
|
377 |
if(isDigital){
|
| - |
|
378 |
payments = paymentHandler.getPaymentForRechargeTxn(merchantTxnId);
|
| - |
|
379 |
}else{
|
| 375 |
List<in.shop2020.payment.domain.Payment> payments = paymentHandler.getPaymentForTxn(merchantTxnId);
|
380 |
payments = paymentHandler.getPaymentForTxn(merchantTxnId);
|
| - |
|
381 |
}
|
| 376 |
if(payments ==null || payments.isEmpty())
|
382 |
if(payments ==null || payments.isEmpty())
|
| 377 |
throw new PaymentException(104, "No payments found corresponding to the merchant txn " + merchantTxnId);
|
383 |
throw new PaymentException(104, "No payments found corresponding to the merchant txn " + merchantTxnId);
|
| 378 |
|
384 |
|
| 379 |
in.shop2020.payment.domain.Payment payment = payments.get(0);
|
385 |
in.shop2020.payment.domain.Payment payment = payments.get(0);
|
| 380 |
switch(PaymentStatus.findByValue(payment.getStatus())){
|
386 |
switch(PaymentStatus.findByValue(payment.getStatus())){
|