Subversion Repositories SmartDukaan

Rev

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

Rev 2707 Rev 2758
Line 2... Line 2...
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.HashMap;
4
import java.util.HashMap;
5
import java.util.List;
5
import java.util.List;
6
import java.util.Map;
6
import java.util.Map;
7
import java.util.Random;
-
 
8
 
7
 
9
import org.apache.log4j.Logger;
8
import org.apache.log4j.Logger;
10
import org.apache.thrift.TException;
-
 
11
 
9
 
12
import in.shop2020.config.ConfigException;
-
 
13
import in.shop2020.model.v1.order.LineItem;
-
 
14
import in.shop2020.model.v1.order.Order;
-
 
15
import in.shop2020.model.v1.order.Transaction;
-
 
16
import in.shop2020.model.v1.order.TransactionServiceException;
-
 
17
import in.shop2020.model.v1.user.ShoppingCartException;
-
 
18
import in.shop2020.payments.Attribute;
10
import in.shop2020.payments.Attribute;
19
import in.shop2020.payments.Payment;
11
import in.shop2020.payments.Payment;
20
import in.shop2020.payments.PaymentStatus;
12
import in.shop2020.payments.PaymentStatus;
21
import in.shop2020.payments.PaymentService.Client;
13
import in.shop2020.payments.PaymentService.Client;
22
import in.shop2020.thrift.clients.PaymentServiceClient;
14
import in.shop2020.thrift.clients.PaymentServiceClient;
23
import in.shop2020.thrift.clients.TransactionServiceClient;
-
 
24
import in.shop2020.thrift.clients.config.ConfigClient;
-
 
25
 
15
 
26
import com.aciworldwide.commerce.gateway.plugins.NotEnoughDataException;
-
 
27
import com.aciworldwide.commerce.gateway.plugins.e24PaymentPipe;
-
 
28
import com.aciworldwide.commerce.gateway.plugins.e24TranPipe;
-
 
29
 
16
 
30
public class HdfcPaymentService implements IPaymentService {
17
public class HdfcPaymentService implements IPaymentService {
31
	private static final long serialVersionUID = 1L;
18
	private static final long serialVersionUID = 1L;
32
	private static Logger log = Logger.getLogger(Class.class);
19
	private static Logger log = Logger.getLogger(Class.class);
33
	
20
	
34
	private static String resourceFilePath;
21
//	private static String resourceFilePath;
35
	private static String aliasName;
22
//	private static String aliasName;
36
	private static String responseURL;
23
//	private static String responseURL;
37
	private static String errorURL;
24
//	private static String errorURL;
38
	private static final String regex = "[^a-zA-Z0-9\\s\\-\\@\\/\\.]";
25
//	private static final String regex = "[^a-zA-Z0-9\\s\\-\\@\\/\\.]";
39
	private static final String replacement = " ";
26
//	private static final String replacement = " ";
40
	private static final int MAX_UDF_LENGTH = 30;
27
//	private static final int MAX_UDF_LENGTH = 30;
41
	private static final String currencyCode = "356";
28
//	private static final String currencyCode = "356";
42
	private String redirectURL;
29
	private String redirectURL;
43
	private e24PaymentPipe pipe = null;
30
//	private e24PaymentPipe pipe = null;
44
	
31
	
45
	private double amount;
32
//	private double amount;
46
	private int gatewayId=1;
33
	private static int gatewayId=1;
47
	
34
	
48
	private long paymentId;
35
//	private long paymentId;
49
	
36
	
50
	private enum ActionType{
37
//	private enum ActionType{
51
		PURCHASE("1"),
38
//		PURCHASE("1"),
52
		AUTH ("4"),
39
//		AUTH ("4"),
53
		CAPTURE("5");
40
//		CAPTURE("5");
54
		private String value;
41
//		private String value;
55
		ActionType(String value) {
42
//		ActionType(String value) {
56
			this.value = value;
43
//			this.value = value;
57
		}
44
//		}
58
		public String value(){
45
//		public String value(){
59
			return this.value;
46
//			return this.value;
60
		}
47
//		}
61
	}
48
//	}
62
	
49
	
63
	public HdfcPaymentService() {
50
	public HdfcPaymentService() {
64
	
51
	
65
	}
52
	}
66
	
53
	
67
	static{
54
//	static{
68
		try {
55
//		try {
69
			resourceFilePath = ConfigClient.getClient().get("payment_resource_file_path");
56
//			resourceFilePath = ConfigClient.getClient().get("payment_resource_file_path");
70
			aliasName  = ConfigClient.getClient().get("payment_alias_name");
57
//			aliasName  = ConfigClient.getClient().get("payment_alias_name");
71
			responseURL = ConfigClient.getClient().get("payment_response_url");
58
//			responseURL = ConfigClient.getClient().get("payment_response_url");
72
			errorURL = ConfigClient.getClient().get("payment_error_url");
59
//			errorURL = ConfigClient.getClient().get("payment_error_url");
73
		} catch (ConfigException e) {
60
//		} catch (ConfigException e) {
74
			log.error("Unable to get data from config server.");
61
//			log.error("Unable to get data from config server.");
75
		}
62
//		}
76
	}
63
//	}
77
	
64
	
78
	
65
	
79
	public long createPayment(long currentCartId, long userId, long txnId, String paymentOption){
66
	public long createPayment(long currentCartId, long userId, long txnId, String paymentOption){
80
		log.info("Creating payment for the txn#: " + txnId + " for the user: " + userId + " for processing through HDFC");
67
		log.info("Creating payment for the txn#: " + txnId + " for the user: " + userId + " for processing through HDFC");
81
		CommonPaymentService cps = new CommonPaymentService();
68
		CommonPaymentService cps = new CommonPaymentService();
82
		if(!cps.createPayment(currentCartId, userId, txnId, gatewayId)){
69
		if(!cps.createPayment(currentCartId, userId, txnId, gatewayId)){
83
			log.error("Error while creating the basic payment");
70
			log.error("Error while creating the basic payment");
84
			return PAYMENT_NOT_CREATED;
71
			return PAYMENT_NOT_CREATED;
-
 
72
		}else{
-
 
73
			return initializePayment(cps.getPaymentId(), paymentOption);
85
		}
74
		}
86
		
75
	}
87
		paymentId = cps.getPaymentId();
-
 
88
		amount = cps.getAmount();
-
 
89
		
76
	
90
		try {
-
 
91
			initializePayment(paymentId, amount);
77
	private long initializePayment(long merchantPaymentId, String paymentOption){
92
		} catch (ShoppingCartException e1) {
-
 
93
			log.error("Error while creating hdfc payment.");
-
 
94
			e1.printStackTrace();
-
 
95
			return PAYMENT_NOT_CREATED;
-
 
96
		} catch (TException e1) {
-
 
97
			log.error("Error while creating hdfc payment.");
-
 
98
			e1.printStackTrace();
-
 
99
			return PAYMENT_NOT_CREATED;
-
 
100
		}
-
 
101
		
-
 
102
		List<Attribute> attributes = null;
78
		List<Attribute> attributes = new ArrayList<Attribute>();
103
		try {
-
 
104
			attributes = getAttributesAndSetUdfs(txnId);
-
 
105
			attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
79
		attributes.add(new Attribute(IPaymentService.PAYMENT_METHOD, paymentOption));
106
		} catch (TransactionServiceException e1) {
-
 
107
			log.error("Error while setting udfs to payment.");
-
 
108
			e1.printStackTrace();
-
 
109
			return PAYMENT_NOT_CREATED;
-
 
110
		} catch (TException e1) {
-
 
111
			log.error("Error while setting udfs to payment.");
-
 
112
			e1.printStackTrace();
-
 
113
			return PAYMENT_NOT_CREATED;
-
 
114
		}
-
 
115
		
-
 
116
		PaymentServiceClient paymentServiceClient = null;
80
		PaymentServiceClient paymentServiceClient = null;
117
		try {
81
		try {
118
			paymentServiceClient = new PaymentServiceClient();
82
			paymentServiceClient = new PaymentServiceClient();
119
		} catch (Exception e) {
83
		} catch (Exception e) {
120
			log.error("Error while getting payment client");
84
			log.error("Error while getting payment client", e);
121
			e.printStackTrace();
-
 
122
			return PAYMENT_NOT_CREATED;
85
			return PAYMENT_NOT_CREATED;
123
		}
86
		}
124
		
87
		
125
		try {
88
		try {
126
			//TODO: Put this in a timed block.
-
 
127
			short status = pipe.performPaymentInitialization();
-
 
128
			if(status != e24PaymentPipe.SUCCESS) {
-
 
129
				log.error("Error sending Payment Initialization Request: ");
-
 
130
				paymentServiceClient.getClient().updatePaymentDetails(paymentId, null, "", "", pipe.getErrorMsg(), "", "", "", "", PaymentStatus.INIT, "", attributes);
89
			paymentServiceClient.getClient().updatePaymentDetails(merchantPaymentId, null, null, null, null, null, null, null, null, PaymentStatus.INIT, null, attributes);
131
				redirectURL = errorURL + "?paymentId="+ paymentId + "&ErrorText="+pipe.getErrorMsg();
-
 
132
				return PAYMENT_NOT_CREATED;
-
 
133
			} else {
-
 
134
				log.info("Payment Initialization Request processed successfully for payment Id: " + paymentId);
90
			this.redirectURL = paymentServiceClient.getClient().initializeHdfcPayment(merchantPaymentId);
135
				String paymentID = pipe.getPaymentId();
-
 
136
				paymentServiceClient.getClient().updatePaymentDetails(paymentId, paymentID, "", "", "", "", "", "", "", PaymentStatus.INIT, "", attributes);
-
 
137
				
-
 
138
				String payURL = pipe.getPaymentPage();
-
 
139
				redirectURL = payURL + "?PaymentID=" + paymentID;
-
 
140
				return paymentId;
91
			return merchantPaymentId;
141
			}
-
 
142
		} catch (NotEnoughDataException e) {
-
 
143
			log.error("Error while initializing payment.", e);
-
 
144
		}catch (Exception e) {
92
		}catch (Exception e) {
145
			log.error("Error while initializing payment.", e);
93
			log.error("Error while initializing payment.", e);
-
 
94
			return PAYMENT_NOT_CREATED;
146
		}
95
		}
147
		
-
 
148
		redirectURL = errorURL + "?paymentId="+paymentId + "?ErrorText=Error while initializing payment.";
-
 
149
		return PAYMENT_NOT_CREATED;
-
 
150
	}
96
	}
151
	
97
	
152
	public static Map<String, String> capturePayment(Payment payment, String gatewayTxnId){
98
	public static Map<String, String> capturePayment(Payment payment, String gatewayTxnId){
153
		String amount = "" + payment.getAmount();
99
		String amount = "" + payment.getAmount();
154
		String gatewayPaymentId = payment.getGatewayPaymentId();
100
		String gatewayPaymentId = payment.getGatewayPaymentId();
Line 167... Line 113...
167
			resultMap.put(ERR_CODE, Errors.CONN_FAILURE.code);
113
			resultMap.put(ERR_CODE, Errors.CONN_FAILURE.code);
168
			resultMap.put(ERROR, "Unable to capture transaction.");
114
			resultMap.put(ERROR, "Unable to capture transaction.");
169
		}
115
		}
170
		
116
		
171
		return resultMap;
117
		return resultMap;
-
 
118
	}
-
 
119
	
-
 
120
//	private List<Attribute> getAttributesAndSetUdfs(long txnId) throws TransactionServiceException, TException{
-
 
121
//		StringBuilder orderDetails = new StringBuilder();
-
 
122
//		StringBuilder billingAddress = new StringBuilder();
-
 
123
//		String email = "";
-
 
124
//		String contactNumber = "";
172
//		
125
//		
-
 
126
//		//get udfs
-
 
127
//		Transaction transaction;
-
 
128
//		TransactionServiceClient transactionServiceClient = null;
-
 
129
//		try {
-
 
130
//			transactionServiceClient = new TransactionServiceClient();
-
 
131
//		} catch (Exception e) {
-
 
132
//			// TODO Auto-generated catch block
-
 
133
//			e.printStackTrace();
-
 
134
//		}
173
//		
135
//		
-
 
136
//		in.shop2020.model.v1.order.TransactionService.Client txnClient = transactionServiceClient.getClient();
-
 
137
//		transaction = txnClient.getTransaction(txnId);
-
 
138
//		orderDetails.append(transaction.getOrdersSize() + " ");
-
 
139
//		for (Order order : transaction.getOrders()) {
-
 
140
//			contactNumber= order.getCustomer_mobilenumber();
-
 
141
//			email = order.getCustomer_email();
-
 
142
//			billingAddress.append(" ");
-
 
143
//			if(order.getCustomer_pincode()!=null){
-
 
144
//				billingAddress.append(order.getCustomer_pincode());
-
 
145
//			}
-
 
146
//			if(order.getCustomer_city()!=null){
-
 
147
//				billingAddress.append(" " + order.getCustomer_city());
-
 
148
//			}
-
 
149
//			if(order.getCustomer_address1()!=null){
-
 
150
//				billingAddress.append(" " + order.getCustomer_address1());
-
 
151
//			}
-
 
152
//			if(order.getCustomer_address2()!=null){
-
 
153
//				billingAddress.append(" " + order.getCustomer_address2());
-
 
154
//			}
-
 
155
//			if(order.getCustomer_state()!=null){
-
 
156
//				billingAddress.append(" " + order.getCustomer_state());
-
 
157
//			}
-
 
158
//			
-
 
159
//
-
 
160
//			for(LineItem line: order.getLineitems()){
-
 
161
//				if(line.getBrand() != null){
-
 
162
//					orderDetails.append(line.getBrand());
-
 
163
//				}
-
 
164
//				if(line.getModel_name() != null){
-
 
165
//					orderDetails.append(line.getModel_name()); 
-
 
166
//				}
-
 
167
//				if(line.getModel_number() != null){
-
 
168
//					orderDetails.append(line.getModel_number());
-
 
169
//				}
-
 
170
//				if(line.getColor() != null){
-
 
171
//					orderDetails.append(line.getColor());
-
 
172
//				}
-
 
173
//				orderDetails.append(" ");
-
 
174
//			}
-
 
175
//			
-
 
176
//		}
174
//		
177
//		
-
 
178
//		Random random = new Random();
-
 
179
//		String merchantInfo = ""+random.nextLong(); 
-
 
180
//		
-
 
181
//	    String udf1 = formatUdf(orderDetails.toString()); 
-
 
182
//	    String udf2 = formatUdf(email);
-
 
183
//	    String udf3 = formatUdf(contactNumber);
-
 
184
//	    String udf4 = formatUdf(billingAddress.toString());
-
 
185
//	    String udf5 = merchantInfo;
-
 
186
//
-
 
187
//	    log.info("udf1:"  + udf1);
-
 
188
//	    log.info("udf2:"  + udf2);
-
 
189
//	    log.info("udf3:"  + udf3);
-
 
190
//	    log.info("udf4:"  + udf4);
-
 
191
//	    log.info("udf5:"  + udf5);
-
 
192
//	    
175
//
193
//
-
 
194
//	    pipe.setUdf1(udf1);       //	UDF 1 - Order details
-
 
195
//		pipe.setUdf2(udf2);        	  				//	UDF 2 - Email ID
-
 
196
//		pipe.setUdf3(udf3);      			//	UDF 3 - Contact Number. 
-
 
197
//		pipe.setUdf4(udf4);     //	UDF 4 - Billing Address
-
 
198
//		pipe.setUdf5(udf5);		  						//	UDF 5 - Merchant specific
176
//	    
199
//	    
177
//		e24TranPipe pipe = new e24TranPipe();
200
//		List<Attribute> attributes = new ArrayList<Attribute>();
178
//		pipe.setResourcePath(resourceFilePath);
201
//		Attribute attribute1 = new Attribute("udf1",udf1);
179
//		pipe.setAlias(aliasName);
-
 
180
//		pipe.setAction(ActionType.CAPTURE.value());
202
//		Attribute attribute2 = new Attribute("udf2",udf2);
181
//		pipe.setAmt(amount);
-
 
182
//		pipe.setTrackId("" + payment.getPaymentId());
203
//		Attribute attribute3 = new Attribute("udf3",udf3);
183
//		pipe.setMember("SAHOLIC");
-
 
184
//		pipe.setCurrencyCode(currencyCode);
204
//		Attribute attribute4 = new Attribute("udf4",udf4);
185
//		pipe.setTransId(gatewayTxnId);
205
//		Attribute attribute5 = new Attribute("udf5",udf5);
186
//		
206
//		
187
//		//Check if the values have been set properly
207
//		attributes.add(attribute1);
188
//		log.info("Pipe Amount: " + pipe.getAmt());
208
//		attributes.add(attribute2);
189
//		log.info("Pipe Action Code: " + pipe.getAction());
209
//		attributes.add(attribute3);
190
//		log.info("Pipe Currency Code: " + pipe.getCurrencyCode());
-
 
191
//		log.info("Pipe Track Id: " + pipe.getTrackId());
210
//		attributes.add(attribute4);
192
//		log.info("Pipe Trans Id:" + pipe.getTransId());
211
//		attributes.add(attribute5);
193
//		
212
//		
194
//		int captureStatus = e24TranPipe.FAILURE;
-
 
195
//		try {
-
 
196
//			captureStatus = pipe.performTransaction();
-
 
197
//			
-
 
198
//			log.info("Capture Status: " + captureStatus);
-
 
199
//			log.info("Gateway Txn Status: " + pipe.getResult());
-
 
200
//			log.info("Debug Msg: " + pipe.getDebugMsg());
-
 
201
//			log.info("Auth: " + pipe.getAuth());
-
 
202
//			log.info("Ref: " + pipe.getRef());
-
 
203
//			log.info("TransId:" + pipe.getTransId());
-
 
204
//			log.info("Amount: " + pipe.getAmt());
-
 
205
//			
-
 
206
//			resultMap.put(STATUS, "" + captureStatus);
-
 
207
//			String result = pipe.getResult();
-
 
208
//			resultMap.put(GATEWAY_STATUS, result.substring(0, Math.min(result.length(), 20)).trim());		//This will return the result of the transaction. (Successful or Failed)
-
 
209
//			if(captureStatus != e24TranPipe.SUCCESS || !"CAPTURED".equals(result)){
-
 
210
//				resultMap.put(ERROR, pipe.getErrorMsg());				// In case of any error, we only need to get the error message
-
 
211
//			}else{
-
 
212
//				resultMap.put(CAPTURE_AUTH_ID, pipe.getAuth());			// Unique ID generated by Authorizer of the transaction
-
 
213
//				resultMap.put(CAPTURE_REF_ID, pipe.getRef());			// Unique reference number generated during the transaction
-
 
214
//				resultMap.put(CAPTURE_TXN_ID, pipe.getTransId());		// Unique Transaction ID generated after every successful transaction
-
 
215
//				resultMap.put(CAPTURE_AMNT, pipe.getAmt());			// Original Amount of the transaction
-
 
216
//			}
-
 
217
//		} catch (NotEnoughDataException e) {
-
 
218
//			log.error("Unable to capture payment", e);
-
 
219
//			resultMap.put(ERR_CODE, Errors.CONN_FAILURE.code);
-
 
220
//			resultMap.put(ERROR, "Unable to capture transaction.");
-
 
221
//		}
-
 
222
//		        		
-
 
223
//		return resultMap;
213
//		return attributes;
224
	}
214
//	}
225
	
215
	
226
	private List<Attribute> getAttributesAndSetUdfs(long txnId) throws TransactionServiceException, TException{
-
 
227
		StringBuilder orderDetails = new StringBuilder();
-
 
228
		StringBuilder billingAddress = new StringBuilder();
-
 
229
		String email = "";
-
 
230
		String contactNumber = "";
-
 
231
		
-
 
232
		//get udfs
-
 
233
		Transaction transaction;
-
 
234
		TransactionServiceClient transactionServiceClient = null;
-
 
235
		try {
-
 
236
			transactionServiceClient = new TransactionServiceClient();
-
 
237
		} catch (Exception e) {
-
 
238
			// TODO Auto-generated catch block
-
 
239
			e.printStackTrace();
-
 
240
		}
-
 
241
		
-
 
242
		in.shop2020.model.v1.order.TransactionService.Client txnClient = transactionServiceClient.getClient();
-
 
243
		transaction = txnClient.getTransaction(txnId);
-
 
244
		orderDetails.append(transaction.getOrdersSize() + " ");
-
 
245
		for (Order order : transaction.getOrders()) {
-
 
246
			contactNumber= order.getCustomer_mobilenumber();
-
 
247
			email = order.getCustomer_email();
-
 
248
			billingAddress.append(" ");
-
 
249
			if(order.getCustomer_pincode()!=null){
-
 
250
				billingAddress.append(order.getCustomer_pincode());
-
 
251
			}
-
 
252
			if(order.getCustomer_city()!=null){
-
 
253
				billingAddress.append(" " + order.getCustomer_city());
-
 
254
			}
-
 
255
			if(order.getCustomer_address1()!=null){
-
 
256
				billingAddress.append(" " + order.getCustomer_address1());
-
 
257
			}
-
 
258
			if(order.getCustomer_address2()!=null){
-
 
259
				billingAddress.append(" " + order.getCustomer_address2());
-
 
260
			}
-
 
261
			if(order.getCustomer_state()!=null){
-
 
262
				billingAddress.append(" " + order.getCustomer_state());
-
 
263
			}
-
 
264
			
-
 
265
 
-
 
266
			for(LineItem line: order.getLineitems()){
-
 
267
				if(line.getBrand() != null){
-
 
268
					orderDetails.append(line.getBrand());
-
 
269
				}
-
 
270
				if(line.getModel_name() != null){
-
 
271
					orderDetails.append(line.getModel_name()); 
-
 
272
				}
-
 
273
				if(line.getModel_number() != null){
-
 
274
					orderDetails.append(line.getModel_number());
-
 
275
				}
-
 
276
				if(line.getColor() != null){
-
 
277
					orderDetails.append(line.getColor());
-
 
278
				}
-
 
279
				orderDetails.append(" ");
-
 
280
			}
-
 
281
			
-
 
282
		}
-
 
283
		
-
 
284
		Random random = new Random();
-
 
285
		String merchantInfo = ""+random.nextLong(); 
-
 
286
		
-
 
287
	    String udf1 = formatUdf(orderDetails.toString()); 
-
 
288
	    String udf2 = formatUdf(email);
-
 
289
	    String udf3 = formatUdf(contactNumber);
-
 
290
	    String udf4 = formatUdf(billingAddress.toString());
-
 
291
	    String udf5 = merchantInfo;
-
 
292
 
-
 
293
	    log.info("udf1:"  + udf1);
-
 
294
	    log.info("udf2:"  + udf2);
-
 
295
	    log.info("udf3:"  + udf3);
-
 
296
	    log.info("udf4:"  + udf4);
-
 
297
	    log.info("udf5:"  + udf5);
-
 
298
	    
-
 
299
 
-
 
300
	    pipe.setUdf1(udf1);       //	UDF 1 - Order details
-
 
301
		pipe.setUdf2(udf2);        	  				//	UDF 2 - Email ID
-
 
302
		pipe.setUdf3(udf3);      			//	UDF 3 - Contact Number. 
-
 
303
		pipe.setUdf4(udf4);     //	UDF 4 - Billing Address
-
 
304
		pipe.setUdf5(udf5);		  						//	UDF 5 - Merchant specific
-
 
305
	    
-
 
306
		List<Attribute> attributes = new ArrayList<Attribute>();
-
 
307
		Attribute attribute1 = new Attribute("udf1",udf1);
-
 
308
		Attribute attribute2 = new Attribute("udf2",udf2);
-
 
309
		Attribute attribute3 = new Attribute("udf3",udf3);
-
 
310
		Attribute attribute4 = new Attribute("udf4",udf4);
-
 
311
		Attribute attribute5 = new Attribute("udf5",udf5);
-
 
312
		
-
 
313
		attributes.add(attribute1);
-
 
314
		attributes.add(attribute2);
-
 
315
		attributes.add(attribute3);
-
 
316
		attributes.add(attribute4);
-
 
317
		attributes.add(attribute5);
-
 
318
		
-
 
319
		return attributes;
-
 
320
	}
-
 
321
	
-
 
322
	private void initializePayment(long merchantPaymentId, double amounta) throws ShoppingCartException, TException{
216
//	private void initializePayment(long merchantPaymentId, double amounta) throws ShoppingCartException, TException{
323
		String amount;
217
//		String amount;
324
		
218
//		
325
		amount = (new Double(amounta)).toString();
219
//		amount = (new Double(amounta)).toString();
326
		
220
//		
327
		//Following is the code which initilize e24PaymentPipe with proper value		
221
//		//Following is the code which initilize e24PaymentPipe with proper value		
328
		pipe=new e24PaymentPipe();
222
//		pipe=new e24PaymentPipe();
329
		pipe.setResourcePath(resourceFilePath);	//mandatory 
223
//		pipe.setResourcePath(resourceFilePath);	//mandatory 
330
		String as = pipe.getResourcePath();
224
//		String as = pipe.getResourcePath();
331
		log.info("Resource= " +as);
225
//		log.info("Resource= " +as);
332
		
226
//		
333
		pipe.setAlias(aliasName);			//mandatory 
227
//		pipe.setAlias(aliasName);			//mandatory 
334
		String ab=pipe.getAlias();
228
//		String ab=pipe.getAlias();
335
		log.info("Alias= " +ab);
229
//		log.info("Alias= " +ab);
336
	
230
//	
337
		pipe.setAction(ActionType.AUTH.value());			//mandatory 
231
//		pipe.setAction(ActionType.AUTH.value());			//mandatory 
338
		String ac=pipe.getAction();
232
//		String ac=pipe.getAction();
339
		log.info("Action= " +ac);
233
//		log.info("Action= " +ac);
340
	
234
//	
341
		pipe.setResponseURL( responseURL );	//mandatory
235
//		pipe.setResponseURL( responseURL );	//mandatory
342
		String at=pipe.getResponseURL();
236
//		String at=pipe.getResponseURL();
343
		log.info("ResponseURL= "+at);
237
//		log.info("ResponseURL= "+at);
344
	
238
//	
345
		// Removed payment url parameter, as adding parameters stops payment from initialisation with hdfc jar.
239
//		// Removed payment url parameter, as adding parameters stops payment from initialisation with hdfc jar.
346
		// It gives following error. 
240
//		// It gives following error. 
347
		// Payment Initialization returned an invalid response: !ERROR!-PY20011-Invalid Merchant Error URL.
241
//		// Payment Initialization returned an invalid response: !ERROR!-PY20011-Invalid Merchant Error URL.
348
		pipe.setErrorURL( errorURL );		//mandatory
242
//		pipe.setErrorURL( errorURL );		//mandatory
349
	    String ak=pipe.getErrorURL();
243
//	    String ak=pipe.getErrorURL();
350
	    log.info("ErrorURL= " + ak);
244
//	    log.info("ErrorURL= " + ak);
351
	
245
//	
352
	
246
//	
353
		pipe.setAmt(amount);		
247
//		pipe.setAmt(amount);		
354
		String ap=pipe.getAmt();
248
//		String ap=pipe.getAmt();
355
		log.info("Amt= " + ap);
249
//		log.info("Amt= " + ap);
356
	
250
//	
357
		pipe.setCurrency(currencyCode);
251
//		pipe.setCurrency(currencyCode);
358
		String a=pipe.getCurrency();
252
//		String a=pipe.getCurrency();
359
		log.info("Currency= " + a);
253
//		log.info("Currency= " + a);
360
	
254
//	
361
		pipe.setLanguage("USA");
255
//		pipe.setLanguage("USA");
362
		String p=pipe.getLanguage();
256
//		String p=pipe.getLanguage();
363
		log.info("Language= "+ p);
257
//		log.info("Language= "+ p);
364
	    
258
//	    
365
		pipe.setTrackId((new Long(merchantPaymentId)).toString());
259
//		pipe.setTrackId((new Long(merchantPaymentId)).toString());
366
	
260
//	
367
	}
261
//	}
368
	
262
	
369
	String formatUdf(String udfString){
263
//	String formatUdf(String udfString){
370
		udfString = udfString.replaceAll(regex, replacement);
264
//		udfString = udfString.replaceAll(regex, replacement);
371
		if(udfString.length() > MAX_UDF_LENGTH){
265
//		if(udfString.length() > MAX_UDF_LENGTH){
372
			udfString = udfString.substring(0, MAX_UDF_LENGTH);
266
//			udfString = udfString.substring(0, MAX_UDF_LENGTH);
373
		}
267
//		}
374
		return udfString;
268
//		return udfString;
375
	}
269
//	}
376
	
270
	
377
	public String getRedirectUrl(){
271
	public String getRedirectUrl(){
378
		return this.redirectURL;
272
		return this.redirectURL;
379
	}
273
	}
380
	
274