Subversion Repositories SmartDukaan

Rev

Rev 741 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 741 Rev 762
Line 13... Line 13...
13
import org.apache.struts2.rest.DefaultHttpHeaders;
13
import org.apache.struts2.rest.DefaultHttpHeaders;
14
import org.apache.struts2.rest.HttpHeaders;
14
import org.apache.struts2.rest.HttpHeaders;
15
import org.apache.thrift.TException;
15
import org.apache.thrift.TException;
16
 
16
 
17
import in.shop2020.config.ConfigException;
17
import in.shop2020.config.ConfigException;
-
 
18
import in.shop2020.model.v1.order.LineItem;
-
 
19
import in.shop2020.model.v1.order.Order;
-
 
20
import in.shop2020.model.v1.order.Transaction;
-
 
21
import in.shop2020.model.v1.user.ShoppingCartException;
18
import in.shop2020.payments.Attribute;
22
import in.shop2020.payments.Attribute;
19
import in.shop2020.payments.PaymentException;
23
import in.shop2020.payments.PaymentException;
20
import in.shop2020.payments.PaymentStatus;
24
import in.shop2020.payments.PaymentStatus;
21
import in.shop2020.serving.utils.Utils;
25
import in.shop2020.serving.utils.Utils;
22
import in.shop2020.thrift.clients.PaymentServiceClient;
26
import in.shop2020.thrift.clients.PaymentServiceClient;
-
 
27
import in.shop2020.thrift.clients.TransactionServiceClient;
23
import in.shop2020.thrift.clients.config.ConfigClient;
28
import in.shop2020.thrift.clients.config.ConfigClient;
24
 
29
 
25
 
30
 
26
 
31
 
27
import com.aciworldwide.commerce.gateway.plugins.NotEnoughDataException;
32
import com.aciworldwide.commerce.gateway.plugins.NotEnoughDataException;
Line 149... Line 154...
149
		String p=pipe.getLanguage();
154
		String p=pipe.getLanguage();
150
		System.out.println("Language="+p+ "<br>");
155
		System.out.println("Language="+p+ "<br>");
151
        
156
        
152
		pipe.setTrackId(merchantPaymentId);
157
		pipe.setTrackId(merchantPaymentId);
153
		
158
		
-
 
159
		//get udfs
-
 
160
		Transaction transaction;
-
 
161
		try {
-
 
162
			TransactionServiceClient transactionServiceClient = new TransactionServiceClient();
-
 
163
			in.shop2020.model.v1.order.TransactionService.Client txnClient = transactionServiceClient.getClient();
-
 
164
			transaction = txnClient.getTransaction(txnId);
-
 
165
			orderDetails = orderDetails + transaction.getOrdersSize() + " ";
-
 
166
			for (Order order : transaction.getOrders()) {
-
 
167
				contactNumber = order.getCustomer_mobilenumber();
-
 
168
				email = order.getCustomer_email();
-
 
169
				billingAddress = " ";
-
 
170
				if(order.getCustomer_pincode()!=null){
-
 
171
					billingAddress = billingAddress + order.getCustomer_pincode();
-
 
172
				}
-
 
173
				if(order.getCustomer_city()!=null){
-
 
174
					billingAddress = billingAddress + " " + order.getCustomer_city();
-
 
175
				}
-
 
176
				if(order.getCustomer_address1()!=null){
-
 
177
					billingAddress = billingAddress + " " + order.getCustomer_address1();
-
 
178
				}
-
 
179
				if(order.getCustomer_address2()!=null){
-
 
180
					billingAddress = billingAddress + order.getCustomer_address2();
-
 
181
				}
-
 
182
				if(order.getCustomer_state()!=null){
-
 
183
					billingAddress = billingAddress + order.getCustomer_state();
-
 
184
				}
-
 
185
				
154
 
186
 
-
 
187
				for(LineItem line: order.getLineitems()){
-
 
188
					if(line.getBrand() != null){
155
		orderDetails = Utils.getOrderDetails(txnId);
189
						orderDetails = orderDetails + line.getBrand();
-
 
190
					}
-
 
191
					if(line.getModel_name() != null){
156
		email = Utils.getEmailId(userinfo.getUserId());
192
						orderDetails = orderDetails + line.getModel_name(); 
-
 
193
					}
-
 
194
					if(line.getModel_number() != null){
157
		contactNumber = Utils.getContactNumber(txnId);
195
						orderDetails = orderDetails + line.getModel_number();
-
 
196
					}
-
 
197
					if(line.getColor() != null){
158
		billingAddress = Utils.getBillingAddress(txnId);
198
						orderDetails = orderDetails + line.getColor();
-
 
199
					}
-
 
200
					orderDetails = orderDetails + " ";
-
 
201
				}
-
 
202
				
-
 
203
			}
-
 
204
		} catch (TException e) {
-
 
205
			e.printStackTrace();
-
 
206
		} catch (Exception e) {
-
 
207
			e.printStackTrace();
-
 
208
		}
159
		
209
		
-
 
210
	
160
		String regex = "[^a-zA-Z0-9\\s\\-\\@\\/\\.]";
211
		String regex = "[^a-zA-Z0-9\\s\\-\\@\\/\\.]";
161
		String replacement = " ";
212
		String replacement = " ";
162
		
213
		
163
		orderDetails = orderDetails.replaceAll(regex, replacement);
214
		orderDetails = orderDetails.replaceAll(regex, replacement);
164
		email = email.replaceAll(regex, replacement);
215
		email = email.replaceAll(regex, replacement);
165
		contactNumber = replacement.replaceAll(regex, replacement);
216
		//contactNumber = replacement.replaceAll(regex, replacement);
166
		billingAddress = billingAddress.replaceAll(regex, replacement);
217
		billingAddress = billingAddress.replaceAll(regex, replacement);
167
		if(orderDetails.length() > 250){
218
		if(email.length() > 30){
168
			orderDetails = orderDetails.substring(0, 249);
219
			email = email.substring(0, 30);
169
		}
220
		}
-
 
221
		if(contactNumber.length() > 30){
-
 
222
			contactNumber = contactNumber.substring(0, 30);
-
 
223
		}
-
 
224
		if(orderDetails.length() > 30){
-
 
225
			orderDetails = orderDetails.substring(0, 30);
-
 
226
		}
170
		if(billingAddress.length() > 250){
227
		if(billingAddress.length() > 30){
171
			billingAddress = billingAddress.substring(0, 249);
228
			billingAddress = billingAddress.substring(0, 30);
172
		}
229
		}
173
		Random random = new Random();
230
		Random random = new Random();
174
		merchantInfo = ""+random.nextLong(); 
231
		merchantInfo = ""+random.nextLong(); 
175
		
232
		
176
		
233
		
Line 255... Line 312...
255
	
312
	
256
	String getUrl(){
313
	String getUrl(){
257
		return this.redirectURL;
314
		return this.redirectURL;
258
	}
315
	}
259
 
316
 
-
 
317
 
260
}
318
}
261
 
319