Subversion Repositories SmartDukaan

Rev

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

Rev 7836 Rev 7942
Line 31... Line 31...
31
import in.shop2020.serving.auth.CRMAuthorizingRealm;
31
import in.shop2020.serving.auth.CRMAuthorizingRealm;
32
import in.shop2020.serving.model.ShipmentUpdate;
32
import in.shop2020.serving.model.ShipmentUpdate;
33
import in.shop2020.serving.services.AramexTrackingService;
33
import in.shop2020.serving.services.AramexTrackingService;
34
import in.shop2020.serving.services.BlueDartTrackingService;
34
import in.shop2020.serving.services.BlueDartTrackingService;
35
import in.shop2020.serving.services.DelhiveryTrackingService;
35
import in.shop2020.serving.services.DelhiveryTrackingService;
-
 
36
import in.shop2020.serving.services.FedExTrackingService;
36
import in.shop2020.serving.services.RedExpressTrackingService;
37
import in.shop2020.serving.services.RedExpressTrackingService;
37
import in.shop2020.thrift.clients.CRMClient;
38
import in.shop2020.thrift.clients.CRMClient;
38
import in.shop2020.thrift.clients.CatalogClient;
39
import in.shop2020.thrift.clients.CatalogClient;
39
import in.shop2020.thrift.clients.HelperClient;
40
import in.shop2020.thrift.clients.HelperClient;
40
import in.shop2020.thrift.clients.LogisticsClient;
41
import in.shop2020.thrift.clients.LogisticsClient;
41
import in.shop2020.thrift.clients.PaymentClient;
42
import in.shop2020.thrift.clients.PaymentClient;
42
import in.shop2020.thrift.clients.TransactionClient;
43
import in.shop2020.thrift.clients.TransactionClient;
43
import in.shop2020.thrift.clients.UserClient;
44
import in.shop2020.thrift.clients.UserClient;
44
import in.shop2020.thrift.clients.config.ConfigClient;
45
import in.shop2020.thrift.clients.config.ConfigClient;
-
 
46
import in.shop2020.utils.FedExShipAccountInfo;
45
import in.shop2020.utils.ModelUtils;
47
import in.shop2020.utils.ModelUtils;
46
import in.shop2020.warehouse.WarehouseService;
48
import in.shop2020.warehouse.WarehouseService;
47
 
49
 
48
import java.io.BufferedInputStream;
50
import java.io.BufferedInputStream;
49
import java.io.File;
51
import java.io.File;
Line 72... Line 74...
72
import org.apache.commons.lang.StringUtils;
74
import org.apache.commons.lang.StringUtils;
73
import org.apache.log4j.Logger;
75
import org.apache.log4j.Logger;
74
import org.apache.thrift.TException;
76
import org.apache.thrift.TException;
75
import org.apache.thrift.transport.TTransportException;
77
import org.apache.thrift.transport.TTransportException;
76
 
78
 
-
 
79
import com.ShipWebServiceClient;
-
 
80
import com.fedex.ship.stub.CompletedPackageDetail;
-
 
81
import com.fedex.ship.stub.CompletedShipmentDetail;
-
 
82
import com.fedex.ship.stub.ProcessShipmentReply;
-
 
83
import com.fedex.ship.stub.TrackingId;
-
 
84
 
77
/**
85
/**
78
 * @author vikas
86
 * @author vikas
79
 * 
87
 * 
80
 */
88
 */
81
@SuppressWarnings("serial")
89
@SuppressWarnings("serial")
Line 83... Line 91...
83
	private static Logger                  log                     = Logger.getLogger(Class.class);
91
	private static Logger                  log                     = Logger.getLogger(Class.class);
84
	private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
92
	private static BlueDartTrackingService blueDartTrackingService = new BlueDartTrackingService();
85
	private static AramexTrackingService aramexTrackingService     = new AramexTrackingService();
93
	private static AramexTrackingService aramexTrackingService     = new AramexTrackingService();
86
	private static DelhiveryTrackingService delhiveryTrackingService     = new DelhiveryTrackingService();
94
	private static DelhiveryTrackingService delhiveryTrackingService     = new DelhiveryTrackingService();
87
	private static RedExpressTrackingService redexpressTrackingService = new RedExpressTrackingService();
95
	private static RedExpressTrackingService redexpressTrackingService = new RedExpressTrackingService();
-
 
96
	//Start:- Added by Manish Sharma for fedex Integration- Shipment Tracking on 31-Jul-2013
-
 
97
	private static FedExTrackingService fedexTrackingService = new FedExTrackingService();
-
 
98
	//End:- Added by Manish Sharma for fedex Integration- Shipment Tracking on 31-Jul-2013
88
 
99
	
89
	private long                 orderId;
100
	private long                 orderId;
90
	private Order                order;
101
	private Order                order;
91
	private List<Payment>        payments;
102
	private List<Payment>        payments;
92
	private List<ShipmentUpdate> shipmentUpdates = new ArrayList<ShipmentUpdate>();
103
	private List<ShipmentUpdate> shipmentUpdates = new ArrayList<ShipmentUpdate>();
93
	private Long                 codTicketId;
104
	private Long                 codTicketId;
Line 203... Line 214...
203
						shipmentUpdates = delhiveryTrackingService.getUpdates(order.getAirwaybill_no());
214
						shipmentUpdates = delhiveryTrackingService.getUpdates(order.getAirwaybill_no());
204
					}
215
					}
205
					else if (order.getLogistics_provider_id() == 6) {
216
					else if (order.getLogistics_provider_id() == 6) {
206
						shipmentUpdates = redexpressTrackingService.getUpdates(order.getAirwaybill_no());
217
						shipmentUpdates = redexpressTrackingService.getUpdates(order.getAirwaybill_no());
207
					}
218
					}
-
 
219
					//Start:- Added by Manish Sharma for fedex Integration- Shipment Tracking on 31-Jul-2013
-
 
220
					else if (order.getLogistics_provider_id() == 7) {
-
 
221
						shipmentUpdates = fedexTrackingService.getUpdates(order.getAirwaybill_no());
-
 
222
					}
-
 
223
					//End:- Added by Manish Sharma for fedex Integration- Shipment Tracking on 31-Jul-2013
208
					else {
224
					else {
209
						shipmentUpdates = new ArrayList<ShipmentUpdate>();
225
						shipmentUpdates = new ArrayList<ShipmentUpdate>();
210
						log.error("Error : providerId = " + order.getLogistics_provider_id() + "for orderId : " + order.getId());
226
						log.error("Error : providerId = " + order.getLogistics_provider_id() + "for orderId : " + order.getId());
211
					}
227
					}
212
					return true;
228
					return true;
Line 523... Line 539...
523
	}
539
	}
524
 
540
 
525
	public String changeShippingAddress() {
541
	public String changeShippingAddress() {
526
		try {
542
		try {
527
			TransactionClient transactionServiceClient = new TransactionClient();
543
			TransactionClient transactionServiceClient = new TransactionClient();
-
 
544
			in.shop2020.model.v1.order.TransactionService.Client transactionClient
-
 
545
		    = transactionServiceClient.getClient();
528
			transactionServiceClient.getClient().changeShippingAddress(orderId, line1, line2, city, state, pin);
546
			transactionClient.changeShippingAddress(orderId, line1, line2, city, state, pin);
-
 
547
			in.shop2020.model.v1.order.Order t_order = transactionClient.getOrder(orderId);
-
 
548
			if(t_order.getLogistics_provider_id()==7L){
-
 
549
				FedExShipAccountInfo fedexAccountInfo = FedExShipAccountInfo.getFedExInfo();
-
 
550
				ProcessShipmentReply  processShipmentReply = ShipWebServiceClient.getShipmentCreationReply(t_order,fedexAccountInfo.getClientDetail(),fedexAccountInfo.getWad(),fedexAccountInfo.getEndPointAddress());
-
 
551
				CompletedShipmentDetail completedShipmentDetails = processShipmentReply.getCompletedShipmentDetail();
-
 
552
				CompletedPackageDetail completedPackageDetails =  completedShipmentDetails.getCompletedPackageDetails(0);
-
 
553
				TrackingId  trackId= completedPackageDetails.getTrackingIds(0);
-
 
554
				t_order = transactionClient.updateOrderAWB(t_order.getId(), trackId.getTrackingNumber());
-
 
555
			}
529
		} catch(Exception e) {
556
		} catch(Exception e) {
530
			log.error("Unable to update address for orderId : " + orderId + "and address : " + 
557
			log.error("Unable to update address for orderId : " + orderId + "and address : " + 
531
					line1 + ", " + line2+ ", " + city + ", " + state + ", " + pin, e);
558
					line1 + ", " + line2+ ", " + city + ", " + state + ", " + pin, e);
532
		}
559
		}
533
		return null;
560
		return null;