/// <summary> /// This is the default constuctor. /// </summary> /// <param name="TripID"></param> /// <param name="ArrivalTime"></param> /// <param name="DepartureTime"></param> /// <param name="StopID"></param> /// <param name="StopSequence"></param> /// <param name="StopHeadSign"></param> /// <param name="PickUpType"></param> /// <param name="DropOffType"></param> /// <param name="ShapeDistTraveled"></param> public StopTime( string TripID, TimeSpan ArrivalTime, TimeSpan DepartureTime, string StopID, int StopSequence, string StopHeadSign, PickUpType PickUpType, DropOffType DropOffType, string ShapeDistTraveled ) { mTripID = TripID; mArrivalTime = ArrivalTime; mDepartureTime = DepartureTime; mStopID = StopID; mStopSequence = StopSequence; mStopHeadSign = StopHeadSign; mPickUpType = PickUpType; mDropOffType = DropOffType; mShapeDistTraveled = ShapeDistTraveled; }
private static DropoffType GetDropOffType(DropOffType dropType) { var result = DropoffType.BUSINESS_SERVICE_CENTER; switch (dropType) { case DropOffType.BUSINESSSERVICECENTER: return(DropoffType.BUSINESS_SERVICE_CENTER); case DropOffType.DROPBOX: return(DropoffType.DROP_BOX); case DropOffType.REGULARPICKUP: return(DropoffType.REGULAR_PICKUP); case DropOffType.REQUESTCOURIER: return(DropoffType.REQUEST_COURIER); case DropOffType.STATION: return(DropoffType.STATION); } return(result); }
private static MerchantTribe.Shipping.FedEx.FedExRateServices.DropoffType GetDropOffType(DropOffType dropType) { DropoffType result = DropoffType.BUSINESS_SERVICE_CENTER; switch (dropType) { case DropOffType.BUSINESSSERVICECENTER: return DropoffType.BUSINESS_SERVICE_CENTER; case DropOffType.DROPBOX: return DropoffType.DROP_BOX; case DropOffType.REGULARPICKUP: return DropoffType.REGULAR_PICKUP; case DropOffType.REQUESTCOURIER: return DropoffType.REQUEST_COURIER; case DropOffType.STATION: return DropoffType.STATION; } return result; }
private XmlDocument BuildProviderRequest(Warehouse warehouse, Address destination, Package package) { ProviderUnits pUnits = GetProviderUnits(warehouse.Country); //CREATE PROVIDER REQUEST DOCUMENT XmlDocument providerRequest = new XmlDocument(); providerRequest.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\" ?><FDXRateAvailableServicesRequest xmlns:api=\"http://www.fedex.com/fsmapi\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"FDXRateAvailableServicesRequest.xsd\"></FDXRateAvailableServicesRequest>"); XmlElement nodRequestHeader = (XmlElement)providerRequest.DocumentElement.AppendChild(providerRequest.CreateElement("RequestHeader")); XmlUtility.SetElementValue(nodRequestHeader, "AccountNumber", this.AccountNumber); XmlUtility.SetElementValue(nodRequestHeader, "MeterNumber", this.MeterNumber); //update the shipment settings XmlUtility.SetElementValue(providerRequest.DocumentElement, "ShipDate", DateTime.Now.ToString("yyyy'-'MM'-'dd")); XmlUtility.SetElementValue(providerRequest.DocumentElement, "DropoffType", DropOffType.ToString()); XmlUtility.SetElementValue(providerRequest.DocumentElement, "Packaging", PackagingType.ToString()); XmlUtility.SetElementValue(providerRequest.DocumentElement, "WeightUnits", GetWeightUnitCode(pUnits.WeightUnit)); XmlUtility.SetElementValue(providerRequest.DocumentElement, "Weight", String.Format("{0:F1}", package.Weight)); XmlElement nodOriginAddress = (XmlElement)providerRequest.DocumentElement.AppendChild(providerRequest.CreateElement("OriginAddress")); XmlUtility.SetElementValue(nodOriginAddress, "StateOrProvinceCode", StringHelper.Truncate(warehouse.Province, 2)); XmlUtility.SetElementValue(nodOriginAddress, "PostalCode", warehouse.PostalCode); XmlUtility.SetElementValue(nodOriginAddress, "CountryCode", warehouse.CountryCode); //set the destination XmlElement nodDestinationAddress = (XmlElement)providerRequest.DocumentElement.AppendChild(providerRequest.CreateElement("DestinationAddress")); XmlUtility.SetElementValue(nodDestinationAddress, "StateOrProvinceCode", StringHelper.Truncate(destination.Province, 2)); XmlUtility.SetElementValue(nodDestinationAddress, "PostalCode", destination.PostalCode); XmlUtility.SetElementValue(nodDestinationAddress, "CountryCode", destination.CountryCode); //set payment type XmlUtility.SetElementValue(providerRequest.DocumentElement, "Payment/PayorType", "SENDER"); if (PackagingType == FDXPackagingType.YOURPACKAGING) { //set the package dimensions LSDecimal decPkgLength = package.Length; LSDecimal decPkgWidth = package.Width; LSDecimal decPkgHeight = package.Height; if (decPkgLength > 0 && decPkgWidth > 0 && decPkgHeight > 0) { //REORDER DIMENSIONS LSDecimal[] arrDims = new LSDecimal[3]; arrDims[0] = decPkgLength; arrDims[1] = decPkgWidth; arrDims[2] = decPkgHeight; Array.Sort(arrDims); //length is longest dimension; decPkgLength = arrDims[2]; //width is middle dimension decPkgWidth = arrDims[1]; //height is shortest dimension decPkgHeight = arrDims[0]; //trial and error, these were the smallest supported dimensions I could find if (decPkgHeight < LocaleHelper.ConvertMeasurement(MeasurementUnit.Inches, 2, pUnits.MeasurementUnit)) { decPkgHeight = LocaleHelper.ConvertMeasurement(MeasurementUnit.Inches, 2, pUnits.MeasurementUnit); } if (decPkgLength < LocaleHelper.ConvertMeasurement(MeasurementUnit.Inches, 7, pUnits.MeasurementUnit)) { decPkgLength = LocaleHelper.ConvertMeasurement(MeasurementUnit.Inches, 7, pUnits.MeasurementUnit); } if (decPkgWidth < LocaleHelper.ConvertMeasurement(MeasurementUnit.Inches, 4, pUnits.MeasurementUnit)) { decPkgWidth = LocaleHelper.ConvertMeasurement(MeasurementUnit.Inches, 4, pUnits.MeasurementUnit); } XmlElement nodDimensions = (XmlElement)providerRequest.DocumentElement.AppendChild(providerRequest.CreateElement("Dimensions")); XmlUtility.SetElementValue(nodDimensions, "Length", "" + ((int)decPkgLength)); XmlUtility.SetElementValue(nodDimensions, "Width", "" + ((int)decPkgWidth)); XmlUtility.SetElementValue(nodDimensions, "Height", "" + ((int)decPkgHeight)); XmlUtility.SetElementValue(nodDimensions, "Units", GetMeasurementUnitCode(pUnits.MeasurementUnit)); } } //CHECK DECLARED VALUE OPTION if (this.IncludeDeclaredValue) { //SET DECLARED VALUE OF SHIPMENT, USE BASE CURRENCY OF STORE XmlElement nodDeclaredValue = (XmlElement)providerRequest.DocumentElement.AppendChild(providerRequest.CreateElement("DeclaredValue")); XmlUtility.SetElementValue(nodDeclaredValue, "Value", String.Format("{0:F2}", package.RetailValue)); string currencyCode = Token.Instance.Store.BaseCurrency.ISOCode; if (currencyCode.Length != 3) { currencyCode = "USD"; } XmlUtility.SetElementValue(nodDeclaredValue, "CurrencyCode", currencyCode); } //SET RESIDENTIAL FLAG if (destination.Residence) { XmlUtility.SetElementValue(providerRequest.DocumentElement, "SpecialServices/ResidentialDelivery", "1"); } XmlUtility.SetElementValue(providerRequest.DocumentElement, "PackageCount", "1"); //RETURN THE REQUEST return(providerRequest); }
/// <summary> /// This is the default constuctor. /// </summary> /// <param name="TripID"></param> /// <param name="ArrivalTime"></param> /// <param name="DepartureTime"></param> /// <param name="StopID"></param> /// <param name="StopSequence"></param> /// <param name="StopHeadSign"></param> /// <param name="PickUpType"></param> /// <param name="DropOffType"></param> /// <param name="ShapeDistTraveled"></param> public StopTime( string TripID, TimeSpan ArrivalTime, TimeSpan DepartureTime, string StopID, int StopSequence, string StopHeadSign, PickUpType PickUpType, DropOffType DropOffType, string ShapeDistTraveled ) { mTripID=TripID ; mArrivalTime=ArrivalTime ; mDepartureTime=DepartureTime ; mStopID=StopID ; mStopSequence=StopSequence ; mStopHeadSign=StopHeadSign ; mPickUpType=PickUpType ; mDropOffType=DropOffType ; mShapeDistTraveled=ShapeDistTraveled ; }
private static MerchantTribe.Shipping.FedEx.FedExRateServices.DropoffType GetDropOffType(DropOffType dropType) { DropoffType result = DropoffType.BUSINESS_SERVICE_CENTER; switch (dropType) { case DropOffType.BUSINESSSERVICECENTER: return(DropoffType.BUSINESS_SERVICE_CENTER); case DropOffType.DROPBOX: return(DropoffType.DROP_BOX); case DropOffType.REGULARPICKUP: return(DropoffType.REGULAR_PICKUP); case DropOffType.REQUESTCOURIER: return(DropoffType.REQUEST_COURIER); case DropOffType.STATION: return(DropoffType.STATION); } return(result); }