Subversion Repositories SmartDukaan

Rev

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

Rev 2907 Rev 3126
Line 2... Line 2...
2
 
2
 
3
import in.shop2020.payments.Attribute;
3
import in.shop2020.payments.Attribute;
4
import in.shop2020.payments.Payment;
4
import in.shop2020.payments.Payment;
5
import in.shop2020.payments.PaymentStatus;
5
import in.shop2020.payments.PaymentStatus;
6
import in.shop2020.payments.PaymentService.Client;
6
import in.shop2020.payments.PaymentService.Client;
7
import in.shop2020.thrift.clients.PaymentServiceClient;
7
import in.shop2020.thrift.clients.PaymentClient;
8
 
8
 
9
import java.util.ArrayList;
9
import java.util.ArrayList;
10
import java.util.HashMap;
10
import java.util.HashMap;
11
import java.util.List;
11
import java.util.List;
12
import java.util.Map;
12
import java.util.Map;
Line 41... Line 41...
41
		if(paymentOption != null){
41
		if(paymentOption != null){
42
			List<Attribute> attributes = new ArrayList<Attribute>();
42
			List<Attribute> attributes = new ArrayList<Attribute>();
43
			attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
43
			attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
44
			
44
			
45
			try {
45
			try {
46
				PaymentServiceClient paymentServiceClient = new PaymentServiceClient();
46
				PaymentClient paymentServiceClient = new PaymentClient();
47
				paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
47
				paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
48
			} catch (Exception e) {
48
			} catch (Exception e) {
49
				log.error("Error while saving payment option attribute", e);
49
				log.error("Error while saving payment option attribute", e);
50
				// TODO: We've already created the payment. We could allow the
50
				// TODO: We've already created the payment. We could allow the
51
				// payment to go through. The customer will be a little
51
				// payment to go through. The customer will be a little
Line 80... Line 80...
80
 
80
 
81
	    //Prepare resultMap to elicit failure behaviour in case anything goes wrong.
81
	    //Prepare resultMap to elicit failure behaviour in case anything goes wrong.
82
	    resultMap.put(STATUS, "");
82
	    resultMap.put(STATUS, "");
83
	    
83
	    
84
		try {
84
		try {
85
			PaymentServiceClient paymentServiceClient = new PaymentServiceClient();
85
			PaymentClient paymentServiceClient = new PaymentClient();
86
			Client paymentClient = paymentServiceClient.getClient();
86
			Client paymentClient = paymentServiceClient.getClient();
87
			resultMap = paymentClient.captureEbsPayment(payment.getPaymentId());
87
			resultMap = paymentClient.captureEbsPayment(payment.getPaymentId());
88
		} catch (Exception e) {
88
		} catch (Exception e) {
89
			log.error("Unable to capture payment", e);
89
			log.error("Unable to capture payment", e);
90
			resultMap.put(ERR_CODE, Errors.CONN_FAILURE.code);
90
			resultMap.put(ERR_CODE, Errors.CONN_FAILURE.code);