private static void SetAddress(AddressValidationRequest request, AddressInfo clsAddress, String OrderNumber)
        {
            request.AddressesToValidate    = new AddressToValidate[1];
            request.AddressesToValidate[0] = new AddressToValidate();
            request.AddressesToValidate[0].ClientReferenceId = OrderNumber;
            request.AddressesToValidate[0].Address           = new Address();

            if (string.IsNullOrEmpty(clsAddress.Line2))
            {
                request.AddressesToValidate[0].Address.StreetLines = new String[1] {
                    RemoveDiacritics.RemoveAccent(clsAddress.Line1)
                };
            }
            else
            {
                request.AddressesToValidate[0].Address.StreetLines = new String[2] {
                    RemoveDiacritics.RemoveAccent(clsAddress.Line1), RemoveDiacritics.RemoveAccent(clsAddress.Line2)
                };
            }

            request.AddressesToValidate[0].Address.PostalCode          = clsAddress.PostalCode;
            request.AddressesToValidate[0].Address.City                = RemoveDiacritics.RemoveAccent(clsAddress.City);
            request.AddressesToValidate[0].Address.StateOrProvinceCode = clsAddress.State;
            request.AddressesToValidate[0].Address.CountryCode         = clsAddress.CountryCode;

            #region  ###Test Address###

            /*
             * request.AddressesToValidate = new AddressToValidate[2];
             * request.AddressesToValidate[0] = new AddressToValidate();
             * request.AddressesToValidate[0].ClientReferenceId = "ClientReferenceId1";
             * request.AddressesToValidate[0].Address = new Address();
             * request.AddressesToValidate[0].Address.StreetLines = new String[1] { "100 Nickerson RD" };
             * request.AddressesToValidate[0].Address.PostalCode = "01752";
             * request.AddressesToValidate[0].Address.City = "Marlborough";
             * request.AddressesToValidate[0].Address.StateOrProvinceCode = "MA";
             * request.AddressesToValidate[0].Address.CountryCode = "US";
             * //
             * request.AddressesToValidate[1] = new AddressToValidate();
             * request.AddressesToValidate[1].ClientReferenceId = "ClientReferenceId2";
             * request.AddressesToValidate[1].Address = new Address();
             * request.AddressesToValidate[1].Address.StreetLines = new String[2] { "400 S WESTMORELAND AVE", "APT 413" };
             * request.AddressesToValidate[1].Address.PostalCode = "90020";
             * request.AddressesToValidate[1].Address.City = "LOS ANGELES";
             * request.AddressesToValidate[1].Address.CountryCode = "US";
             *
             * //request.AddressesToValidate[2] = new AddressToValidate();
             * //request.AddressesToValidate[2].ClientReferenceId = "ClientReferenceId3";
             * //request.AddressesToValidate[2].Address = new Address();
             * //request.AddressesToValidate[2].Address.StreetLines = new String[2] { "3 WATCHMOOR POINT", "WATCHMOOR ROAD" };
             * //request.AddressesToValidate[2].Address.PostalCode = "GU153AQ";
             * //request.AddressesToValidate[2].Address.City = "CAMBERLEY";
             * //request.AddressesToValidate[2].Address.CountryCode = "GB";
             */
            #endregion
        }
Exemplo n.º 2
0
        private static void SetRecipient(ProcessShipmentRequest request, AddressInfo clsAddress, ServiceType shipServiceType)
        {
            request.RequestedShipment.Recipient                    = new Party();
            request.RequestedShipment.Recipient.Contact            = new Contact();
            request.RequestedShipment.Recipient.Contact.PersonName = RemoveDiacritics.RemoveAccent(clsAddress.ReceiveName);
            //request.RequestedShipment.Recipient.Contact.CompanyName = "Recipient Company Name";
            request.RequestedShipment.Recipient.Contact.PhoneNumber = clsAddress.PhoneNumber;

            request.RequestedShipment.Recipient.Address = new Address();

            if (string.IsNullOrEmpty(clsAddress.Line2))
            {
                request.RequestedShipment.Recipient.Address.StreetLines = new string[1] {
                    RemoveDiacritics.RemoveAccent(clsAddress.Line1)
                };
            }
            else
            {
                request.RequestedShipment.Recipient.Address.StreetLines = new string[2] {
                    RemoveDiacritics.RemoveAccent(clsAddress.Line1), RemoveDiacritics.RemoveAccent(clsAddress.Line2)
                };
            }

            request.RequestedShipment.Recipient.Address.City = RemoveDiacritics.RemoveAccent(clsAddress.City);
            request.RequestedShipment.Recipient.Address.StateOrProvinceCode = clsAddress.State;
            request.RequestedShipment.Recipient.Address.PostalCode          = clsAddress.PostalCode;
            request.RequestedShipment.Recipient.Address.CountryCode         = clsAddress.CountryCode;

            // ***체크 사항 (V17 에는 없는 값임 -  Ground 와 Home Delivery 를 체크 하는 값인지 확인)
            if (ServiceType.GROUND_HOME_DELIVERY == shipServiceType)
            {
                request.RequestedShipment.Recipient.Address.Residential          = true; // ShipWebServiceClient\Express 에서도 사용 함.
                request.RequestedShipment.Recipient.Address.ResidentialSpecified = true; // Test

                //request.RequestedShipment.SpecialServicesRequested.HomeDeliveryPremiumDetail = new HomeDeliveryPremiumDetail();
                //request.RequestedShipment.SpecialServicesRequested.HomeDeliveryPremiumDetail.HomeDeliveryPremiumType = HomeDeliveryPremiumType.DATE_CERTAIN;
                //request.RequestedShipment.SpecialServicesRequested.HomeDeliveryPremiumDetail.Date = DateTime.Now;
                //request.RequestedShipment.SpecialServicesRequested.HomeDeliveryPremiumDetail.PhoneNumber = clsAddress.PhoneNumber;
            }
        }