Ejemplo n.º 1
0
        public static VerifyAddressResponse VerifyAddress(Address address)
        {
            var result             = new VerifyAddressResponse();
            result.OriginalAddress = address;
            result.IsValid         = false;

            try
            {
                if (address.Country.ToUpper() == "US" && address.IsComplete)
                {
                    var verifiedAddress = Exigo.WebService().VerifyAddress(new VerifyAddressRequest
                    {
                        Address = address.AddressDisplay,
                        City    = address.City,
                        State   = address.State,
                        Zip     = address.Zip,
                        Country = address.Country
                    });

                    result.VerifiedAddress = new Address()
                    {
                        Address1 = verifiedAddress.Address,
                        Address2 = string.Empty,
                        City     = verifiedAddress.City,
                        State    = verifiedAddress.State,
                        Zip      = verifiedAddress.Zip,
                        Country  = verifiedAddress.Country
                    };

                    result.IsValid = true;
                }
            }
            catch
            {
                return result;
            }

            return result;
        }
Ejemplo n.º 2
0
        public static Address SetCustomerAddressOnFile(int customerID, Address address, AddressType type)
        {
            var saveAddress = false;
            var request = new UpdateCustomerRequest();
            request.CustomerID = customerID;

            // New Addresses
            if (type == AddressType.New)
            {
                return Exigo.SaveNewCustomerAddress(customerID, address);
            }

            // Main address
            if (type == AddressType.Main)
            {
                saveAddress          = true;
                request.MainAddress1 = address.Address1;
                request.MainAddress2 = address.Address2 ?? string.Empty;
                request.MainCity     = address.City;
                request.MainState    = address.State;
                request.MainZip      = address.Zip;
                request.MainCountry  = address.Country;
            }

            // Mailing address
            if (type == AddressType.Mailing)
            {
                saveAddress          = true;
                request.MailAddress1 = address.Address1;
                request.MailAddress2 = address.Address2 ?? string.Empty;
                request.MailCity     = address.City;
                request.MailState    = address.State;
                request.MailZip      = address.Zip;
                request.MailCountry  = address.Country;
            }

            // Other address
            if (type == AddressType.Other)
            {
                saveAddress           = true;
                request.OtherAddress1 = address.Address1;
                request.OtherAddress2 = address.Address2 ?? string.Empty;
                request.OtherCity     = address.City;
                request.OtherState    = address.State;
                request.OtherZip      = address.Zip;
                request.OtherCountry  = address.Country;
            }

            if (saveAddress)
            {
                Exigo.WebService().UpdateCustomer(request);
            }

            return address;
        }
Ejemplo n.º 3
0
        public static Address SaveNewCustomerAddress(int customerID, Address address)
        {
            var addressesOnFile = Exigo.GetCustomerAddresses(customerID).Where(c => c.IsComplete);

            // Do any of the addresses on file match the one we are using?
            // If not, save this address to the next available slot
            if (!addressesOnFile.Any(c => c.Equals(address)))
            {
                var saveAddress = false;
                var request = new UpdateCustomerRequest();
                request.CustomerID = customerID;

                // Main address
                if (!addressesOnFile.Any(c => c.AddressType == AddressType.Main))
                {
                    saveAddress          = true;
                    address.AddressType  = AddressType.Main;
                    request.MainAddress1 = address.Address1;
                    request.MainAddress2 = address.Address2;
                    request.MainCity     = address.City;
                    request.MainState    = address.State;
                    request.MainZip      = address.Zip;
                    request.MainCountry  = address.Country;
                }

                // Mailing address
                else if (!addressesOnFile.Any(c => c.AddressType == AddressType.Mailing))
                {
                    saveAddress          = true;
                    address.AddressType  = AddressType.Mailing;
                    request.MailAddress1 = address.Address1;
                    request.MailAddress2 = address.Address2;
                    request.MailCity     = address.City;
                    request.MailState    = address.State;
                    request.MailZip      = address.Zip;
                    request.MailCountry  = address.Country;
                }

                // Other address
                else
                {
                    saveAddress           = true;
                    address.AddressType   = AddressType.Other;
                    request.OtherAddress1 = address.Address1;
                    request.OtherAddress2 = address.Address2;
                    request.OtherCity     = address.City;
                    request.OtherState    = address.State;
                    request.OtherZip      = address.Zip;
                    request.OtherCountry  = address.Country;
                }

                if (saveAddress)
                {
                    Exigo.WebService().UpdateCustomer(request);
                }
            }

            return address;
        }
Ejemplo n.º 4
0
 public static Address SetCustomerAddressOnFile(int customerID, Address address)
 {
     return SetCustomerAddressOnFile(customerID, address, address.AddressType);
 }
Ejemplo n.º 5
0
 public BankAccount(BankAccountType type)
 {
     Type = type;
     BillingAddress = new Address();
 }