Ejemplo n.º 1
0
 public static CommerceBuilder.Users.Address GetAcAddress(CommerceBuilder.Payments.Providers.GoogleCheckout.AutoGen.Address gcAddress)
 {
     CommerceBuilder.Users.Address addr = new CommerceBuilder.Users.Address();
     addr.Address1    = gcAddress.address1;
     addr.Address2    = gcAddress.address2;
     addr.City        = gcAddress.city;
     addr.Company     = gcAddress.companyname;
     addr.CountryCode = gcAddress.countrycode;
     addr.FullName    = gcAddress.contactname;
     addr.Email       = gcAddress.email;
     addr.Fax         = gcAddress.fax;
     addr.Phone       = gcAddress.phone;
     addr.PostalCode  = gcAddress.postalcode;
     addr.Province    = gcAddress.region;
     //TODO
     //GoogleCheckout does not tell us whether an address is residence or commercial.
     //We assume by default that it is commercial. This should probably be a
     //configuration parameter
     addr.Residence = false;
     return(addr);
 }
Ejemplo n.º 2
0
        public static CommerceBuilder.Users.Address GetAcAddress(CommerceBuilder.Users.User user, CommerceBuilder.Payments.Providers.GoogleCheckout.AutoGen.Address gcAddress)
        {
            if (user == null || user.Addresses.Count == 0)
            {
                return(GetAcAddress(gcAddress));
            }
            string gcAddressHash = GetAddressHash(gcAddress);

            foreach (Users.Address addr in user.Addresses)
            {
                if (gcAddressHash == GetAddressHash(addr))
                {
                    return(addr);
                }
            }
            return(GetAcAddress(gcAddress));
        }