Subversion Repositories SmartDukaan

Rev

Rev 3126 | Rev 3209 | 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;
3126 rajveer 7
import in.shop2020.thrift.clients.PaymentClient;
8
import in.shop2020.thrift.clients.TransactionClient;
9
import in.shop2020.thrift.clients.UserClient;
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);
3126 rajveer 28
	PaymentClient pclient = null;
29
	TransactionClient tsc = null;
30
	UserClient 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 {
3126 rajveer 39
			pclient = new PaymentClient();
40
			tsc = new TransactionClient();
41
			usc = new UserClient();
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.";
2692 rajveer 49
		String merchantPaymentIdString = this.request.getParameter("paymentId");
50
		if(merchantPaymentIdString!=null){
51
			merchantPaymentId = Long.parseLong(merchantPaymentIdString);
52
		}
3185 vikas 53
    	DataLogger.logData(EventType.PAYMENT_FAILURE, getSessionId(), userinfo.getUserId(), userinfo.getEmail(),  Long.toString(merchantPaymentId));
719 rajveer 54
    	return "index";
428 ashish 55
	}
56
 
719 rajveer 57
 
58
	public String getMessage(){
59
		return this.message;
428 ashish 60
	}
719 rajveer 61
 
428 ashish 62
}