| Line 32... |
Line 32... |
| 32 |
import java.text.SimpleDateFormat;
|
32 |
import java.text.SimpleDateFormat;
|
| 33 |
import java.util.ArrayList;
|
33 |
import java.util.ArrayList;
|
| 34 |
import java.util.Calendar;
|
34 |
import java.util.Calendar;
|
| 35 |
import java.util.Collections;
|
35 |
import java.util.Collections;
|
| 36 |
import java.util.Date;
|
36 |
import java.util.Date;
|
| - |
|
37 |
import java.util.GregorianCalendar;
|
| 37 |
import java.util.List;
|
38 |
import java.util.List;
|
| 38 |
import javax.xml.bind.JAXBContext;
|
39 |
import javax.xml.bind.JAXBContext;
|
| 39 |
import javax.xml.bind.JAXBException;
|
40 |
import javax.xml.bind.JAXBException;
|
| 40 |
import javax.xml.bind.Marshaller;
|
41 |
import javax.xml.bind.Marshaller;
|
| 41 |
import javax.xml.bind.Unmarshaller;
|
42 |
import javax.xml.bind.Unmarshaller;
|
| 42 |
|
43 |
|
| 43 |
import org.apache.thrift.TException;
|
44 |
import org.apache.thrift.TException;
|
| 44 |
import org.apache.thrift.transport.TTransportException;
|
45 |
import org.apache.thrift.transport.TTransportException;
|
| 45 |
import org.slf4j.Logger;
|
46 |
import org.slf4j.Logger;
|
| 46 |
import org.slf4j.LoggerFactory;
|
47 |
import org.slf4j.LoggerFactory;
|
| - |
|
48 |
import in.shop2020.utils.GmailUtils;
|
| 47 |
|
49 |
|
| 48 |
import order.SaholicAPI;
|
50 |
import order.SaholicAPI;
|
| 49 |
import order.SaholicAPI.Order;
|
51 |
import order.SaholicAPI.Order;
|
| 50 |
|
52 |
|
| 51 |
public class ProcessSnapdealOrder {
|
53 |
public class ProcessSnapdealOrder {
|
| Line 91... |
Line 93... |
| 91 |
TransactionClient tsc = null;
|
93 |
TransactionClient tsc = null;
|
| 92 |
try {
|
94 |
try {
|
| 93 |
tsc = new TransactionClient();
|
95 |
tsc = new TransactionClient();
|
| 94 |
sourceDetail = tsc.getClient().getSourceDetail(SNAPDEAL_SOURCE_ID);
|
96 |
sourceDetail = tsc.getClient().getSourceDetail(SNAPDEAL_SOURCE_ID);
|
| 95 |
} catch (Exception e) {
|
97 |
} catch (Exception e) {
|
| 96 |
logger.error("Unable to establish connection to the transaction service while getting Snapdeal Source Detail", e);
|
98 |
logger.error("Unable to establish connection to the transaction service while getting Snapdeal Source Detail ", e);
|
| 97 |
}
|
99 |
}
|
| 98 |
try {
|
100 |
try {
|
| 99 |
in.shop2020.model.v1.user.UserContextService.Client userClient = new UserClient().getClient();
|
101 |
in.shop2020.model.v1.user.UserContextService.Client userClient = new UserClient().getClient();
|
| 100 |
user = userClient.getUserByEmail(sourceDetail.getEmail());
|
102 |
user = userClient.getUserByEmail(sourceDetail.getEmail());
|
| 101 |
} catch (Exception e) {
|
103 |
} catch (Exception e) {
|
| 102 |
logger.error("Unable to establish connection to the User service", e);
|
104 |
logger.error("Unable to establish connection to the User service ", e);
|
| 103 |
}
|
105 |
}
|
| - |
|
106 |
int total_orders = 0;
|
| - |
|
107 |
int processed_orders = 0;
|
| - |
|
108 |
StringBuffer sb = new StringBuffer();
|
| 104 |
for(Order order:orders.getOrder()){
|
109 |
for(Order order:orders.getOrder()){
|
| 105 |
long subOrderId = (long) order.getSuborderId();
|
110 |
long subOrderId = (long) order.getSuborderId();
|
| 106 |
Client transaction_client = null;
|
111 |
Client transaction_client = null;
|
| 107 |
try {
|
112 |
try {
|
| 108 |
transaction_client = new TransactionClient().getClient();
|
113 |
transaction_client = new TransactionClient().getClient();
|
| 109 |
System.out.println("Suborder id " + subOrderId);
|
- |
|
| 110 |
if(transaction_client.snapdealOrderExists(subOrderId)) {
|
114 |
if(transaction_client.snapdealOrderExists(subOrderId)) {
|
| 111 |
logger.error("Snapdeal suborder id exists " + subOrderId);
|
115 |
logger.error("Snapdeal suborder id exists " + subOrderId);
|
| 112 |
System.out.println("Suborder id exists");
|
- |
|
| 113 |
continue;
|
116 |
continue;
|
| 114 |
}
|
117 |
}
|
| 115 |
|
118 |
|
| 116 |
} catch (TTransportException e1) {
|
119 |
} catch (TTransportException e1) {
|
| 117 |
// TODO Auto-generated catch block
|
120 |
logger.error("Problem with Transaction service " , e1);
|
| 118 |
e1.printStackTrace();
|
121 |
e1.printStackTrace();
|
| 119 |
} catch (TException e) {
|
122 |
} catch (TException e) {
|
| 120 |
// TODO Auto-generated catch block
|
123 |
logger.error("Problem.. thrift exception with Transaction service " , e);
|
| 121 |
e.printStackTrace();
|
124 |
e.printStackTrace();
|
| 122 |
}
|
125 |
}
|
| 123 |
//System.out.println("Inside Order Parsing");
|
126 |
total_orders++;
|
| 124 |
Transaction txn = new Transaction();
|
127 |
Transaction txn = new Transaction();
|
| 125 |
//System.out.println("User details are " + user.getActiveCartId());
|
- |
|
| 126 |
txn.setShoppingCartid(user.getActiveCartId());
|
128 |
txn.setShoppingCartid(user.getActiveCartId());
|
| 127 |
//System.out.println("creating transaction");
|
- |
|
| 128 |
txn.setCustomer_id(user.getUserId());
|
129 |
txn.setCustomer_id(user.getUserId());
|
| 129 |
System.out.println("User Id is " + user.getUserId());
|
130 |
System.out.println("User Id is " + user.getUserId());
|
| 130 |
txn.setCreatedOn(new Date().getTime());
|
131 |
txn.setCreatedOn(new Date().getTime());
|
| 131 |
txn.setTransactionStatus(TransactionStatus.INIT);
|
132 |
txn.setTransactionStatus(TransactionStatus.INIT);
|
| 132 |
txn.setStatusDescription("Order for Snapdeal ");
|
133 |
txn.setStatusDescription("Order for Snapdeal ");
|
| Line 143... |
Line 144... |
| 143 |
}
|
144 |
}
|
| 144 |
else{
|
145 |
else{
|
| 145 |
SellingPrice = order.getSellingPricePerItem();
|
146 |
SellingPrice = order.getSellingPricePerItem();
|
| 146 |
}
|
147 |
}
|
| 147 |
lineItem = createLineItem(order.getSKUCode(),SellingPrice);
|
148 |
lineItem = createLineItem(order.getSKUCode(),SellingPrice);
|
| - |
|
149 |
if(lineItem == null){
|
| - |
|
150 |
sb.append(order.getSuborderId() +" "+"SKU not found" + "\n");
|
| - |
|
151 |
continue;
|
| - |
|
152 |
}
|
| 148 |
System.out.println("Line item created");
|
153 |
System.out.println("Line item created");
|
| 149 |
} catch (CatalogServiceException e) {
|
154 |
} catch (CatalogServiceException e) {
|
| 150 |
logger.error("Unable to create order for suborderid " + order.getSuborderId());
|
155 |
logger.error("Unable to create order for suborderid " + order.getSuborderId() , e);
|
| 151 |
e.printStackTrace();
|
156 |
e.printStackTrace();
|
| - |
|
157 |
sb.append(order.getSuborderId() + " " + "Problem with catalog service" + "\n");
|
| 152 |
continue;
|
158 |
continue;
|
| 153 |
} catch (TException e) {
|
159 |
} catch (TException e) {
|
| 154 |
logger.error("Unable to create order for suborderid " + order.getSuborderId());
|
160 |
logger.error("Unable to create order for suborderid " + order.getSuborderId() , e);
|
| 155 |
e.printStackTrace();
|
161 |
e.printStackTrace();
|
| - |
|
162 |
sb.append(order.getSuborderId() + " " + "Thrift Exception in Catalog Service" + "\n");
|
| 156 |
continue;
|
163 |
continue;
|
| 157 |
}
|
164 |
}
|
| 158 |
in.shop2020.model.v1.order.Order t_order = new in.shop2020.model.v1.order.Order();
|
165 |
in.shop2020.model.v1.order.Order t_order = new in.shop2020.model.v1.order.Order();
|
| 159 |
t_order.setCustomer_id(user.getUserId());
|
166 |
t_order.setCustomer_id(user.getUserId());
|
| 160 |
t_order.setCustomer_email(sourceDetail.getEmail());
|
167 |
t_order.setCustomer_email(sourceDetail.getEmail());
|
| Line 177... |
Line 184... |
| 177 |
SimpleDateFormat istFormatter = new SimpleDateFormat("yyyy-MM-dd");
|
184 |
SimpleDateFormat istFormatter = new SimpleDateFormat("yyyy-MM-dd");
|
| 178 |
Date shipDate = null;
|
185 |
Date shipDate = null;
|
| 179 |
try {
|
186 |
try {
|
| 180 |
shipDate= istFormatter.parse(order.getShipByDate());
|
187 |
shipDate= istFormatter.parse(order.getShipByDate());
|
| 181 |
} catch (ParseException e) {
|
188 |
} catch (ParseException e) {
|
| 182 |
logger.error("Could not parse order ship date from file ");
|
189 |
logger.error("Could not parse order ship date from file " , e);
|
| 183 |
e.printStackTrace();
|
190 |
e.printStackTrace();
|
| - |
|
191 |
sb.append(order.getSuborderId() + "Could not parse ship date" + " " + "\n");
|
| 184 |
continue;
|
192 |
continue;
|
| 185 |
}
|
193 |
}
|
| 186 |
Calendar time = Calendar.getInstance();
|
194 |
Calendar time = Calendar.getInstance();
|
| 187 |
t_order.setPromised_shipping_time(shipDate.getTime());
|
195 |
t_order.setPromised_shipping_time(shipDate.getTime());
|
| 188 |
t_order.setExpected_shipping_time(shipDate.getTime());
|
196 |
t_order.setExpected_shipping_time(shipDate.getTime());
|
| Line 190... |
Line 198... |
| 190 |
t_order.setPromised_delivery_time(time.getTimeInMillis());
|
198 |
t_order.setPromised_delivery_time(time.getTimeInMillis());
|
| 191 |
t_order.setExpected_delivery_time(time.getTimeInMillis());
|
199 |
t_order.setExpected_delivery_time(time.getTimeInMillis());
|
| 192 |
System.out.println("Dates set in transaction");
|
200 |
System.out.println("Dates set in transaction");
|
| 193 |
} catch(Exception e) {
|
201 |
} catch(Exception e) {
|
| 194 |
logger.error("Error in updating Shipping or Delivery Time for suborderid " + order.getSuborderId());
|
202 |
logger.error("Error in updating Shipping or Delivery Time for suborderid " + order.getSuborderId());
|
| - |
|
203 |
sb.append(order.getSuborderId() + "Could not update delivery time" + " " + "\n");
|
| 195 |
continue;
|
204 |
continue;
|
| 196 |
}
|
205 |
}
|
| 197 |
InventoryService.Client inventoryClient = null;
|
206 |
InventoryService.Client inventoryClient = null;
|
| 198 |
Warehouse fulfillmentWarehouse= null;
|
207 |
Warehouse fulfillmentWarehouse= null;
|
| 199 |
try {
|
208 |
try {
|
| Line 211... |
Line 220... |
| 211 |
VendorItemPricing vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), fulfillmentWarehouse.getVendor().getId());
|
220 |
VendorItemPricing vendorItemPricing = inventoryClient.getItemPricing(lineItem.getItem_id(), fulfillmentWarehouse.getVendor().getId());
|
| 212 |
t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
|
221 |
t_order.getLineitems().get(0).setTransfer_price(vendorItemPricing.getTransferPrice());
|
| 213 |
t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
|
222 |
t_order.getLineitems().get(0).setNlc(vendorItemPricing.getNlc());
|
| 214 |
} catch (InventoryServiceException e) {
|
223 |
} catch (InventoryServiceException e) {
|
| 215 |
logger.error("Error connecting inventory service for suborderid " + order.getSuborderId());
|
224 |
logger.error("Error connecting inventory service for suborderid " + order.getSuborderId());
|
| - |
|
225 |
sb.append(order.getSuborderId() + "Inventory Service Exception" + " " + "\n");
|
| 216 |
continue;
|
226 |
continue;
|
| 217 |
} catch (TTransportException e) {
|
227 |
} catch (TTransportException e) {
|
| 218 |
// TODO Auto-generated catch block
|
228 |
logger.error("Transport Exception with Inventory Service for suborderid " + order.getSuborderId() , e);
|
| 219 |
e.printStackTrace();
|
229 |
sb.append(order.getSuborderId() + "Transport Exception with Inventory Service" + " " + "\n");
|
| 220 |
continue;
|
230 |
continue;
|
| 221 |
} catch (TException e) {
|
231 |
} catch (TException e) {
|
| 222 |
// TODO Auto-generated catch block
|
232 |
logger.error("Exception with Inventory Service for suborderid " + order.getSuborderId() , e);
|
| 223 |
e.printStackTrace();
|
233 |
sb.append(order.getSuborderId() + "Exception in Inventory Service" + " " + "\n");
|
| 224 |
continue;
|
234 |
continue;
|
| 225 |
}
|
235 |
}
|
| 226 |
if(order.getCourier().equalsIgnoreCase(FIRSTFLIGHT)) {
|
236 |
if(order.getCourier().equalsIgnoreCase(FIRSTFLIGHT)) {
|
| 227 |
t_order.setLogistics_provider_id(12);
|
237 |
t_order.setLogistics_provider_id(12);
|
| 228 |
} else if(order.getCourier().equalsIgnoreCase(DELHIVERY)) {
|
238 |
} else if(order.getCourier().equalsIgnoreCase(DELHIVERY)) {
|
| Line 292... |
Line 302... |
| 292 |
else if(order.getCourier().equalsIgnoreCase(GATI_AIR)){
|
302 |
else if(order.getCourier().equalsIgnoreCase(GATI_AIR)){
|
| 293 |
t_order.setLogistics_provider_id(36);
|
303 |
t_order.setLogistics_provider_id(36);
|
| 294 |
}
|
304 |
}
|
| 295 |
else {
|
305 |
else {
|
| 296 |
logger.error("Error No Courier Match please add courier to our system for suborderid " + order.getSuborderId() + "Courier Name " + order.getCourier());
|
306 |
logger.error("Error No Courier Match please add courier to our system for suborderid " + order.getSuborderId() + "Courier Name " + order.getCourier());
|
| - |
|
307 |
sb.append(order.getSuborderId() + " Error No Courier Match " + order.getCourier() +"\n");
|
| 297 |
continue;
|
308 |
continue;
|
| 298 |
}
|
309 |
}
|
| 299 |
|
310 |
|
| 300 |
t_order.setAirwaybill_no(String.valueOf(order.getAWBNumber()));
|
311 |
t_order.setAirwaybill_no(String.valueOf(order.getAWBNumber()));
|
| 301 |
t_order.setTracking_id(String.valueOf(order.getAWBNumber()));
|
312 |
t_order.setTracking_id(String.valueOf(order.getAWBNumber()));
|
| Line 310... |
Line 321... |
| 310 |
SimpleDateFormat istFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
321 |
SimpleDateFormat istFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| 311 |
Date snapdealTxnDate = null;
|
322 |
Date snapdealTxnDate = null;
|
| 312 |
try {
|
323 |
try {
|
| 313 |
snapdealTxnDate = istFormatter.parse(order.getOrderPlacedDate());
|
324 |
snapdealTxnDate = istFormatter.parse(order.getOrderPlacedDate());
|
| 314 |
} catch (ParseException e) {
|
325 |
} catch (ParseException e) {
|
| 315 |
logger.error("Could not parse snapdeal order date from file ");
|
326 |
logger.error(order.getSuborderId() + " Could not parse snapdeal order date from file " , e);
|
| 316 |
e.printStackTrace();
|
327 |
sb.append(order.getSuborderId() + " Could not parse order date" +"\n");
|
| 317 |
continue;
|
328 |
continue;
|
| 318 |
}
|
329 |
}
|
| 319 |
try {
|
330 |
try {
|
| 320 |
transactionId = String.valueOf(transaction_client.createTransaction(txn));
|
331 |
transactionId = String.valueOf(transaction_client.createTransaction(txn));
|
| 321 |
} catch (TransactionServiceException e) {
|
332 |
} catch (TransactionServiceException e) {
|
| 322 |
logger.error("Could not create transaction ");
|
333 |
logger.error(order.getSuborderId() + " Could not create transaction " , e);
|
| 323 |
e.printStackTrace();
|
334 |
sb.append(order.getSuborderId() + " Could not create transaction" +"\n");
|
| 324 |
continue;
|
335 |
continue;
|
| 325 |
} catch (TException e) {
|
336 |
} catch (TException e) {
|
| 326 |
logger.error("Problem with transaction service while creating transaction");
|
337 |
logger.error("Problem with transaction service while creating transaction", e);
|
| 327 |
e.printStackTrace();
|
338 |
sb.append(order.getSuborderId() + "Transaction Service Exception could not create transaction" +"\n");
|
| 328 |
continue;
|
339 |
continue;
|
| 329 |
}
|
340 |
}
|
| 330 |
createPayment(user, (new Long(subOrderId)).toString(),lineItem.getTotal_price());
|
341 |
createPayment(user, (new Long(subOrderId)).toString(),lineItem.getTotal_price());
|
| 331 |
|
- |
|
| 332 |
Transaction transaction = null;
|
342 |
Transaction transaction = null;
|
| 333 |
try {
|
343 |
try {
|
| 334 |
transaction = transaction_client.getTransaction(Long.parseLong(transactionId));
|
344 |
transaction = transaction_client.getTransaction(Long.parseLong(transactionId));
|
| 335 |
} catch (NumberFormatException e) {
|
345 |
} catch (NumberFormatException e) {
|
| 336 |
logger.error("Problem parsing transaction id " + transactionId);
|
346 |
logger.error("Problem parsing transaction id " + transactionId);
|
| - |
|
347 |
sb.append(order.getSuborderId() + " Problem parsing transaction id "+ transactionId +"\n");
|
| 337 |
e.printStackTrace();
|
348 |
e.printStackTrace();
|
| 338 |
continue;
|
349 |
continue;
|
| 339 |
} catch (TransactionServiceException e) {
|
350 |
} catch (TransactionServiceException e) {
|
| 340 |
logger.error("Problem getting transaction from service transaction id " + transactionId);
|
351 |
logger.error("Problem getting transaction from service transaction id " + transactionId);
|
| - |
|
352 |
sb.append(order.getSuborderId() + " Problem getting transaction id "+ transactionId +"\n");
|
| 341 |
e.printStackTrace();
|
353 |
e.printStackTrace();
|
| 342 |
continue;
|
354 |
continue;
|
| 343 |
} catch (TException e) {
|
355 |
} catch (TException e) {
|
| 344 |
logger.error("Problem with transaction service while getting transaction id " + transactionId);
|
356 |
logger.error("Problem with transaction service while getting transaction id " + transactionId);
|
| - |
|
357 |
sb.append(order.getSuborderId() + " Problem with transaction service while getting transaction id "+ transactionId +"\n");
|
| 345 |
e.printStackTrace();
|
358 |
e.printStackTrace();
|
| 346 |
continue;
|
359 |
continue;
|
| 347 |
}
|
360 |
}
|
| 348 |
in.shop2020.model.v1.order.Order snapdealorder = transaction.getOrders().get(0);
|
361 |
in.shop2020.model.v1.order.Order snapdealorder = transaction.getOrders().get(0);
|
| 349 |
try {
|
362 |
try {
|
| 350 |
inventoryClient.reserveItemInWarehouse(lineItem.getItem_id(), fulfillmentWarehouse.getId(), 1,
|
363 |
inventoryClient.reserveItemInWarehouse(lineItem.getItem_id(), fulfillmentWarehouse.getId(), 1,
|
| 351 |
snapdealorder.getId(), snapdealorder.getCreated_timestamp(), snapdealorder.getPromised_shipping_time(), snapdealorder.getLineitems().get(0).getQuantity());
|
364 |
snapdealorder.getId(), snapdealorder.getCreated_timestamp(), snapdealorder.getPromised_shipping_time(), snapdealorder.getLineitems().get(0).getQuantity());
|
| 352 |
} catch (InventoryServiceException e1) {
|
365 |
} catch (InventoryServiceException e1) {
|
| 353 |
logger.error("Problem while reserving item in inventory service" + snapdealorder.getId());
|
366 |
logger.error("Problem while reserving item in inventory service" + snapdealorder.getId());
|
| 354 |
e1.printStackTrace();
|
367 |
sb.append(order.getSuborderId() + " Could not reserve inventory for sku "+ order.getSKUCode() +"\n");
|
| 355 |
continue;
|
368 |
continue;
|
| 356 |
} catch (TException e1) {
|
369 |
} catch (TException e1) {
|
| 357 |
logger.error("Problem with inventory service" + snapdealorder.getId());
|
370 |
logger.error("Problem with inventory service" + snapdealorder.getId());
|
| 358 |
e1.printStackTrace();
|
371 |
sb.append(order.getSuborderId() + " Problem with inventory service while reserving inventory for sku "+ order.getSKUCode() +"\n");
|
| 359 |
continue;
|
372 |
continue;
|
| 360 |
}
|
373 |
}
|
| 361 |
SnapdealOrder snapdealOrder = new SnapdealOrder();
|
374 |
SnapdealOrder snapdealOrder = new SnapdealOrder();
|
| 362 |
snapdealOrder.setOrderId(snapdealorder.getId());
|
375 |
snapdealOrder.setOrderId(snapdealorder.getId());
|
| 363 |
snapdealOrder.setSubOrderId(subOrderId);
|
376 |
snapdealOrder.setSubOrderId(subOrderId);
|
| Line 367... |
Line 380... |
| 367 |
snapdealOrder.setListingPrice(order.getSellingPricePerItem());
|
380 |
snapdealOrder.setListingPrice(order.getSellingPricePerItem());
|
| 368 |
try {
|
381 |
try {
|
| 369 |
transaction_client.createSnapdealOrder(snapdealOrder);
|
382 |
transaction_client.createSnapdealOrder(snapdealOrder);
|
| 370 |
} catch (TException e) {
|
383 |
} catch (TException e) {
|
| 371 |
logger.error("Could not create Snapdeal Order");
|
384 |
logger.error("Could not create Snapdeal Order");
|
| - |
|
385 |
sb.append(order.getSuborderId() + " Could not create snapdeal order"+"\n");
|
| - |
|
386 |
}
|
| 372 |
e.printStackTrace();
|
387 |
processed_orders++;
|
| - |
|
388 |
|
| - |
|
389 |
}
|
| - |
|
390 |
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
|
| - |
|
391 |
Calendar cal=GregorianCalendar.getInstance();
|
| - |
|
392 |
String emailFromAddress = "build@shop2020.in";
|
| - |
|
393 |
String password = "cafe@nes";
|
| - |
|
394 |
GmailUtils mailer = new GmailUtils();
|
| - |
|
395 |
try {
|
| - |
|
396 |
if(total_orders==processed_orders){
|
| - |
|
397 |
String emailSubjectTxt = total_orders + " Snapdeal Orders Created Successfully "+sdf.format(cal.getTime());
|
| - |
|
398 |
String text = "Order is now available for processing on Order Management Dashboard";
|
| - |
|
399 |
String sendTo[] = new String[]{"vikram.raghav@shop2020.in"};
|
| - |
|
400 |
//String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in","khushal.bhatia@shop2020.in","rajveer.singh@saholic.com","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com"};
|
| - |
|
401 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt, text, emailFromAddress, password, new ArrayList<File>());
|
| - |
|
402 |
}
|
| 373 |
continue;
|
403 |
else{
|
| - |
|
404 |
int failed_orders = total_orders - processed_orders;
|
| - |
|
405 |
String emailSubjectTxt = failed_orders + " Snapdeal Orders Failed while creation "+sdf.format(cal.getTime());
|
| - |
|
406 |
String text = sb.toString();
|
| - |
|
407 |
String sendTo[] = new String[]{"vikram.raghav@shop2020.in"};
|
| - |
|
408 |
//String sendTo[] = new String[]{ "sandeep.sachdeva@shop2020.in", "vikram.raghav@shop2020.in", "rajneesh.arora@shop2020.in","khushal.bhatia@shop2020.in","rajveer.singh@saholic.com","manoj.kumar@saholic.com","chaitnaya.vats@saholic.com"};
|
| - |
|
409 |
mailer.sendSSLMessage(sendTo, emailSubjectTxt, text, emailFromAddress, password, new ArrayList<File>());
|
| 374 |
}
|
410 |
}
|
| - |
|
411 |
}
|
| - |
|
412 |
catch (Exception e) {
|
| - |
|
413 |
e.printStackTrace();
|
| - |
|
414 |
}
|
| - |
|
415 |
|
| 375 |
|
416 |
|
| 376 |
}
|
- |
|
| 377 |
|
417 |
|
| 378 |
}
|
418 |
}
|
| 379 |
|
419 |
|
| 380 |
public static void createPayment(User user, String subOrderId, double amount) {
|
420 |
public static void createPayment(User user, String subOrderId, double amount) {
|
| 381 |
in.shop2020.payments.PaymentService.Client client = null;
|
421 |
in.shop2020.payments.PaymentService.Client client = null;
|
| Line 411... |
Line 451... |
| 411 |
|
451 |
|
| 412 |
public static LineItem createLineItem(long itemId, double amount) throws CatalogServiceException, TException {
|
452 |
public static LineItem createLineItem(long itemId, double amount) throws CatalogServiceException, TException {
|
| 413 |
LineItem lineItem = new LineItem();
|
453 |
LineItem lineItem = new LineItem();
|
| 414 |
CatalogService.Client catalogClient = new CatalogClient().getClient();
|
454 |
CatalogService.Client catalogClient = new CatalogClient().getClient();
|
| 415 |
Item item = catalogClient.getItem(itemId);
|
455 |
Item item = catalogClient.getItem(itemId);
|
| - |
|
456 |
if(item.getId()==0){
|
| - |
|
457 |
//in case item id is incorrect..
|
| - |
|
458 |
return null;
|
| - |
|
459 |
}
|
| 416 |
|
460 |
|
| 417 |
lineItem.setProductGroup(item.getProductGroup());
|
461 |
lineItem.setProductGroup(item.getProductGroup());
|
| 418 |
lineItem.setBrand(item.getBrand());
|
462 |
lineItem.setBrand(item.getBrand());
|
| 419 |
lineItem.setModel_number(item.getModelNumber());
|
463 |
lineItem.setModel_number(item.getModelNumber());
|
| 420 |
lineItem.setModel_name(item.getModelName());
|
464 |
lineItem.setModel_name(item.getModelName());
|