Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
428 ashish 1
package in.shop2020.serving.controllers;
2
 
719 rajveer 3
import java.io.IOException;
4
import java.util.HashMap;
5
import java.util.List;
6
import java.util.Map;
7
 
8
import org.apache.struts2.convention.annotation.Result;
9
import org.apache.struts2.convention.annotation.Results;
10
import org.apache.thrift.TException;
11
 
12
import in.shop2020.model.v1.order.Order;
13
import in.shop2020.model.v1.order.TransactionServiceException;
14
import in.shop2020.payments.PaymentException;
428 ashish 15
import in.shop2020.thrift.clients.PaymentServiceClient;
719 rajveer 16
import in.shop2020.thrift.clients.TransactionServiceClient;
17
import in.shop2020.thrift.clients.UserContextServiceClient;
18
import in.shop2020.utils.Logger;
428 ashish 19
 
719 rajveer 20
@Results({
21
    @Result(name="redirect", type="redirectAction", 
22
    		params = {"actionName" , "login"})
23
})
428 ashish 24
 
517 rajveer 25
public class PayErrorController extends BaseController{
719 rajveer 26
	private static final long serialVersionUID = 1L;
27
	PaymentServiceClient pclient = null;
28
	TransactionServiceClient tsc = null;
29
	UserContextServiceClient usc = null;
428 ashish 30
 
719 rajveer 31
	long merchantPaymentId;
32
	List<Order> orders = null;
33
	String message = null;
428 ashish 34
 
517 rajveer 35
	public PayErrorController(){
719 rajveer 36
		super();
428 ashish 37
		try {
38
			pclient = new PaymentServiceClient();
719 rajveer 39
			tsc = new TransactionServiceClient();
40
			usc = new UserContextServiceClient();
428 ashish 41
		} catch (Exception e) {
719 rajveer 42
			Logger.log("Could not initialize the paymentservice client", this);
428 ashish 43
		}
44
	}
45
 
719 rajveer 46
	public String index() throws IOException, SecurityException, PaymentException, TException, TransactionServiceException{
47
		this.message = "Payment failed at the payment gateway. Please pay again.";
428 ashish 48
 
719 rajveer 49
    	if(!userinfo.isLoggedIn()){
50
    		System.out.println("Inside user is not logged in");
51
    		setRedirectUrl();
52
    		return "redirect";
53
    	}
54
    	merchantPaymentId = Long.parseLong(this.request.getParameter("paymentId"));
55
    	return "index";
428 ashish 56
	}
57
 
719 rajveer 58
 
59
	public String getMessage(){
60
		return this.message;
428 ashish 61
	}
719 rajveer 62
 
428 ashish 63
}