Subversion Repositories SmartDukaan

Rev

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

Rev 3010 Rev 3046
Line 6... Line 6...
6
import in.shop2020.model.v1.order.Transaction;
6
import in.shop2020.model.v1.order.Transaction;
7
import in.shop2020.model.v1.order.TransactionServiceException;
7
import in.shop2020.model.v1.order.TransactionServiceException;
8
import in.shop2020.model.v1.user.ShoppingCartException;
8
import in.shop2020.model.v1.user.ShoppingCartException;
9
import in.shop2020.payment.domain.Payment;
9
import in.shop2020.payment.domain.Payment;
10
import in.shop2020.payments.Attribute;
10
import in.shop2020.payments.Attribute;
-
 
11
import in.shop2020.payments.PaymentException;
11
import in.shop2020.payments.PaymentStatus;
12
import in.shop2020.payments.PaymentStatus;
12
import in.shop2020.thrift.clients.TransactionServiceClient;
13
import in.shop2020.thrift.clients.TransactionServiceClient;
13
import in.shop2020.thrift.clients.config.ConfigClient;
14
import in.shop2020.thrift.clients.config.ConfigClient;
14
 
15
 
15
import java.util.ArrayList;
16
import java.util.ArrayList;
Line 154... Line 155...
154
		
155
		
155
		try {
156
		try {
156
			if(pipe.performPaymentInitialization() != e24PaymentPipe.SUCCESS) {
157
			if(pipe.performPaymentInitialization() != e24PaymentPipe.SUCCESS) {
157
				log.error("Error sending Payment Initialization Request: ");
158
				log.error("Error sending Payment Initialization Request: ");
158
				handler.updatePaymentDetails(merchantPaymentId, null, "", "", pipe.getErrorMsg(), "", "", "", "", PaymentStatus.INIT, "", attributes);
159
				handler.updatePaymentDetails(merchantPaymentId, null, "", "", pipe.getErrorMsg(), "", "", "", "", PaymentStatus.INIT, "", attributes);
159
				redirectURL = errorURL + "?paymentId="+ merchantPaymentId + "&ErrorText="+pipe.getErrorMsg();
-
 
160
			} else {
160
			} else {
161
				log.info("Payment Initialization Request processed successfully for payment Id: " + merchantPaymentId);
161
				log.info("Payment Initialization Request processed successfully for payment Id: " + merchantPaymentId);
162
				String paymentID = pipe.getPaymentId();
162
				String paymentID = pipe.getPaymentId();
163
				handler.updatePaymentDetails(merchantPaymentId, paymentID, "", "", "", "", "", "", "", PaymentStatus.INIT, "", attributes);
163
				handler.updatePaymentDetails(merchantPaymentId, paymentID, "", "", "", "", "", "", "", PaymentStatus.INIT, "", attributes);
164
				
164
				
165
				String payURL = pipe.getPaymentPage();
165
				String payURL = pipe.getPaymentPage();
166
				redirectURL = payURL + "?PaymentID=" + paymentID;
166
				return payURL + "?PaymentID=" + paymentID;
167
			}
167
			}
168
			return redirectURL;
-
 
169
		} catch (NotEnoughDataException e) {
168
		} catch (NotEnoughDataException e) {
170
			log.error("Error while initializing payment.", e);
169
			log.error("Error while initializing payment.", e);
171
		}catch (Exception e) {
170
		}catch (Exception e) {
172
			log.error("Error while initializing payment.", e);
171
			log.error("Error while initializing payment.", e);
173
		}
172
		}
174
		
-
 
175
		redirectURL = errorURL + "?paymentId="+merchantPaymentId + "?ErrorText=Error while initializing payment.";
173
		//If the code reaches here, the payment initialization was not successful and we've not returned the redirect URL.
176
		return redirectURL;
174
		//Throw the exception so that any failovers can happen.
-
 
175
		throw new PaymentException(115, "Unable to initialize HDFC payment");
177
	}
176
	}
178
	
177
	
179
	private static List<Attribute> getAttributesAndSetUdfs(e24PaymentPipe pipe, long txnId) throws TransactionServiceException, TException{
178
	private static List<Attribute> getAttributesAndSetUdfs(e24PaymentPipe pipe, long txnId) throws TransactionServiceException, TException{
180
		StringBuilder orderDetails = new StringBuilder();
179
		StringBuilder orderDetails = new StringBuilder();
181
		StringBuilder billingAddress = new StringBuilder();
180
		StringBuilder billingAddress = new StringBuilder();