public void GetUSPSTrackingByStamps(string trackingNumber) { using (var db = _dbFactory.GetRWDb()) { var shipmentProviderInfo = db.ShipmentProviders.GetByCompanyId(_company.Id) .FirstOrDefault(p => p.Type == (int)ShipmentProviderType.Stamps); var trackList = new List <string>() { trackingNumber }; var stateList = RetryHelper.ActionWithRetries( () => StampComService.TrackShipment(trackList, shipmentProviderInfo), _log, 1, 1000, RetryModeType.Normal, true); Console.WriteLine(stateList); } }
public CheckResult <AddressDTO> CheckAddress(CallSource callSource, AddressDTO inputAddress) { _log.Info("StampsAddressCheckService, inputAddress=" + inputAddress); try { var status = RetryHelper.ActionWithRetries(() => StampComService.ValidateAddress( _log, _addressProviderInfo, inputAddress), _log, throwException: true); return(new CheckResult <AddressDTO>() { Status = (int)status, AdditionalData = new List <string>() { OrderNotifyType.AddressCheckStamps.ToString() }, }); } catch (FaultException ex) { if (ExceptionHelper.IsStampsConversationSyncEx(ex) || ExceptionHelper.IsStampsCommunicationEx(ex)) { return(new CheckResult <AddressDTO>() { Status = (int)AddressValidationStatus.ExceptionCommunication, Message = ex.Message, AdditionalData = new List <string>() { OrderNotifyType.AddressCheckStamps.ToString() } }); } return(new CheckResult <AddressDTO>() { Status = (int)AddressValidationStatus.Exception, Message = ex.Message, AdditionalData = new List <string>() { OrderNotifyType.AddressCheckStamps.ToString() } }); } catch (Exception ex) { var message = ex.Message; if (message.Contains("First and Last Name, with two chars each or Full Name with two char First and Last Name or Company Name with two chars is required for both sender and recipient")) { return(new CheckResult <AddressDTO>() { Status = (int)AddressValidationStatus.InvalidRecipientName, Message = ex.Message, AdditionalData = new List <string>() { OrderNotifyType.AddressCheckStamps.ToString() } }); } return(new CheckResult <AddressDTO>() { Status = (int)AddressValidationStatus.Exception, Message = ex.Message, AdditionalData = new List <string>() { OrderNotifyType.AddressCheckStamps.ToString() } }); } }