示例#1
0
        /// <summary>
        ///     Sets the receiving address on the tracking record based on the UPS Track API response.
        /// </summary>
        /// <param name="trackingRecord">Object containing tracking data that will be written to UPS Integration DB.</param>
        /// <param name="upsResponse">Response object from the UPS Track API.</param>
        public void SetDestinationAddress(UPSTracking trackingRecord, UPSResponse upsResponse)
        {
            var destinationAddress = TrackAPI.GetAddressByType(upsResponse, "ShipTo Address");

            trackingRecord.DestinationCity  = destinationAddress?.Address.City;
            trackingRecord.DestinationState = destinationAddress?.Address.StateProvinceCode;
            trackingRecord.DestinationZip   = destinationAddress?.Address.PostalCode;
        }
示例#2
0
        /// <summary>
        ///     Sets the sender address on the tracking record based on the UPS Track API response.
        /// </summary>
        /// <param name="trackingRecord">Object containing tracking data that will be written to UPS Integration DB.</param>
        /// <param name="upsResponse">Response object from the UPS Track API.</param>
        public void SetOriginAddress(UPSTracking trackingRecord, UPSResponse upsResponse)
        {
            var originAddress = TrackAPI.GetAddressByType(upsResponse, "Shipper Address");

            trackingRecord.OriginAddress = originAddress?.Address.AddressLine;
            trackingRecord.OriginCity    = originAddress?.Address.City;
            trackingRecord.OriginState   = originAddress?.Address.StateProvinceCode;
            var originZip = originAddress?.Address.PostalCode;

            // Format with hyphen after first 5 digits
            if (originZip.Length > 5)
            {
                originZip = originZip.Insert(5, "-");
            }

            trackingRecord.OriginZip = originZip;
        }