Subversion Repositories SmartDukaan

Rev

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

Rev 2577 Rev 3126
Line 15... Line 15...
15
import in.shop2020.model.v1.order.Order;
15
import in.shop2020.model.v1.order.Order;
16
import in.shop2020.model.v1.order.Transaction;
16
import in.shop2020.model.v1.order.Transaction;
17
import in.shop2020.payments.Attribute;
17
import in.shop2020.payments.Attribute;
18
import in.shop2020.payments.Payment;
18
import in.shop2020.payments.Payment;
19
import in.shop2020.serving.services.IPaymentService;
19
import in.shop2020.serving.services.IPaymentService;
20
import in.shop2020.thrift.clients.PaymentServiceClient;
20
import in.shop2020.thrift.clients.PaymentClient;
21
import in.shop2020.thrift.clients.TransactionServiceClient;
21
import in.shop2020.thrift.clients.TransactionClient;
22
import in.shop2020.thrift.clients.config.ConfigClient;
22
import in.shop2020.thrift.clients.config.ConfigClient;
23
 
23
 
24
@SuppressWarnings("serial")
24
@SuppressWarnings("serial")
25
@InterceptorRefs({
25
@InterceptorRefs({
26
    @InterceptorRef("myDefault"),
26
    @InterceptorRef("myDefault"),
Line 60... Line 60...
60
	private double amount;
60
	private double amount;
61
	
61
	
62
	private ContactDetails billingDetails;
62
	private ContactDetails billingDetails;
63
	
63
	
64
	public String show(){
64
	public String show(){
65
		PaymentServiceClient paymentServiceClient = null;
65
		PaymentClient paymentServiceClient = null;
66
		Payment payment = null;
66
		Payment payment = null;
67
		try {
67
		try {
68
			long paymentId = Long.parseLong(this.id);
68
			long paymentId = Long.parseLong(this.id);
69
			paymentServiceClient = new PaymentServiceClient();
69
			paymentServiceClient = new PaymentClient();
70
			payment = paymentServiceClient.getClient().getPayment(paymentId);
70
			payment = paymentServiceClient.getClient().getPayment(paymentId);
71
		} catch (Exception e) {
71
		} catch (Exception e) {
72
			log.error("Error while getting payment client", e);
72
			log.error("Error while getting payment client", e);
73
			addActionError("We are experiencing some problems. Please try later.");
73
			addActionError("We are experiencing some problems. Please try later.");
74
			return "shipping-redirect";
74
			return "shipping-redirect";
75
		}
75
		}
76
		
76
		
77
		Order order = null;
77
		Order order = null;
78
		try {
78
		try {
79
			long txnId = payment.getMerchantTxnId();
79
			long txnId = payment.getMerchantTxnId();
80
			TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
80
			TransactionClient transactionServiceClient = new TransactionClient();
81
			in.shop2020.model.v1.order.TransactionService.Client txnClient = transactionServiceClient.getClient();
81
			in.shop2020.model.v1.order.TransactionService.Client txnClient = transactionServiceClient.getClient();
82
			Transaction transaction = txnClient.getTransaction(txnId);
82
			Transaction transaction = txnClient.getTransaction(txnId);
83
			order = transaction.getOrders().get(0);
83
			order = transaction.getOrders().get(0);
84
		} catch (Exception e) {
84
		} catch (Exception e) {
85
			log.error("Error while getting transaction information", e);
85
			log.error("Error while getting transaction information", e);