Пример #1
0
        private ShippingAddressResponse ToShippingAddressResponse(WebCart cart)
        {
            var address = new ShippingAddressResponse
            {
                PostShippingAddress = string.Format("http://{0}/shipping", HttpContext.Current.Request.Url.Authority)
            };

            if (cart.ShippingAddress != null)
            {
                address.Address1  = cart.ShippingAddress.Address1;
                address.Address2  = cart.ShippingAddress.Address2;
                address.City      = cart.ShippingAddress.City;
                address.FirstName = cart.ShippingAddress.FirstName;
                address.LastName  = cart.ShippingAddress.LastName;
                address.State     = cart.ShippingAddress.State;
                address.Zip       = cart.ShippingAddress.Zip;
            }

            return(address);
        }
Пример #2
0
        public UserResponse GetClient()
        {
            var addressJson = _claimsPrincipal.FindFirstValue(JwtClaimTypes.Address);

            ShippingAddressResponse address = null;

            if (!string.IsNullOrEmpty(addressJson))
            {
                address = JsonConvert.DeserializeObject <ShippingAddressResponse>(addressJson);
            }

            var userResponse = new UserResponse
            {
                BusinessId = _claimsPrincipal.FindFirstValue("business_id"),
                Subject    = _claimsPrincipal.FindFirstValue(JwtClaimTypes.Subject),
                Name       = _claimsPrincipal.FindFirstValue(JwtClaimTypes.Name),
                GivenName  = _claimsPrincipal.FindFirstValue(JwtClaimTypes.GivenName),
                Email      = _claimsPrincipal.FindFirstValue(JwtClaimTypes.Email),
                Document   = _claimsPrincipal.FindFirstValue("document"),
                ClientShippingAddressApp = address
            };

            return(userResponse);
        }