Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
428 ashish 1
package in.shop2020.serving.controllers;
2
 
2263 vikas 3
import in.shop2020.datalogger.EventType;
4
import in.shop2020.model.v1.order.Order;
5
import in.shop2020.model.v1.order.TransactionServiceException;
6
import in.shop2020.payments.PaymentException;
7
import in.shop2020.thrift.clients.PaymentServiceClient;
8
import in.shop2020.thrift.clients.TransactionServiceClient;
9
import in.shop2020.thrift.clients.UserContextServiceClient;
2511 vikas 10
import in.shop2020.utils.DataLogger;
2263 vikas 11
 
719 rajveer 12
import java.io.IOException;
13
import java.util.List;
14
 
2087 vikas 15
import org.apache.log4j.Logger;
822 vikas 16
import org.apache.struts2.convention.annotation.InterceptorRef;
17
import org.apache.struts2.convention.annotation.InterceptorRefs;
719 rajveer 18
import org.apache.thrift.TException;
19
 
822 vikas 20
@InterceptorRefs({
21
    @InterceptorRef("myDefault"),
22
    @InterceptorRef("login")
719 rajveer 23
})
428 ashish 24
 
517 rajveer 25
public class PayErrorController extends BaseController{
719 rajveer 26
	private static final long serialVersionUID = 1L;
2087 vikas 27
	private static Logger log = Logger.getLogger(Class.class);
719 rajveer 28
	PaymentServiceClient pclient = null;
29
	TransactionServiceClient tsc = null;
30
	UserContextServiceClient usc = null;
428 ashish 31
 
719 rajveer 32
	long merchantPaymentId;
33
	List<Order> orders = null;
34
	String message = null;
428 ashish 35
 
517 rajveer 36
	public PayErrorController(){
719 rajveer 37
		super();
428 ashish 38
		try {
39
			pclient = new PaymentServiceClient();
719 rajveer 40
			tsc = new TransactionServiceClient();
41
			usc = new UserContextServiceClient();
428 ashish 42
		} catch (Exception e) {
2087 vikas 43
		    log.error("Could not initialize the paymentservice client");
428 ashish 44
		}
45
	}
46
 
719 rajveer 47
	public String index() throws IOException, SecurityException, PaymentException, TException, TransactionServiceException{
48
		this.message = "Payment failed at the payment gateway. Please pay again.";
428 ashish 49
 
719 rajveer 50
    	merchantPaymentId = Long.parseLong(this.request.getParameter("paymentId"));
2419 vikas 51
    	DataLogger.logData(EventType.PAYMENT_FAILURE, session.getId(), userinfo.getUserId(), userinfo.getEmail(),  Long.toString(merchantPaymentId));
719 rajveer 52
    	return "index";
428 ashish 53
	}
54
 
719 rajveer 55
 
56
	public String getMessage(){
57
		return this.message;
428 ashish 58
	}
719 rajveer 59
 
428 ashish 60
}