private BillingProfileResponse ToBillingProfileResponse(WebCart cart)
        {
            var billing = new BillingProfileResponse
            {
                BillingPostRequest = string.Format("http://{0}/billing", HttpContext.Current.Request.Url.Authority),
                TokenRequest       = string.Format("http://{0}/tokenUrlStuff", HttpContext.Current.Request.Url.Authority)
            };

            if (cart.BillingProfile != null)
            {
                billing.State      = cart.BillingProfile.State;
                billing.City       = cart.BillingProfile.City;
                billing.Zip        = cart.BillingProfile.Zip;
                billing.FirstName  = cart.BillingProfile.FirstName;
                billing.LastName   = cart.BillingProfile.LastName;
                billing.Address2   = cart.BillingProfile.Address2;
                billing.Address1   = cart.BillingProfile.Address1;
                billing.Expiration = cart.BillingProfile.Expiration;
                billing.FullName   = cart.BillingProfile.FullName;
                billing.Number     = cart.BillingProfile.Number;
                billing.Pin        = cart.BillingProfile.Pin;
            }

            return(billing);
        }
 private CompleteProductResponse CreateProductsResponse(WebCart cart)
 {
     return(new CompleteProductResponse
     {
         Products = cart.Products.Select(ToProductResponse).ToList(),
         CartId = cart.Id,
         AddProductLink = string.Format("http://{0}/product", HttpContext.Current.Request.Url.Authority)
     });
 }
 private WebCartResponse ToCartResponse(WebCart cart)
 {
     return(new WebCartResponse
     {
         CartId = cart.Id,
         CartItemsInformation = string.Format("http://{0}/product", HttpContext.Current.Request.Url.Authority),
         ShippingProfile = string.Format("http://{0}/shipping", HttpContext.Current.Request.Url.Authority),
         BillingProfile = string.Format("http://{0}/billing", HttpContext.Current.Request.Url.Authority),
         PersonalInformation = string.Format("http://{0}/personalinformation", HttpContext.Current.Request.Url.Authority)
     });
 }
예제 #4
0
        public WebCart CreateCart()
        {
            var cartId = Guid.NewGuid().ToString();
            var cart   = new WebCart {
                Id = cartId
            };

            Db.StringSet(cartId, JsonConvert.SerializeObject(cart));

            return(cart);
        }
예제 #5
0
        private PersonalInformationResponse ToPersonalInformationResponse(WebCart cart)
        {
            var personalInformation = new PersonalInformationResponse
            {
                PersonalInformationPostUrl = string.Format("http://{0}/personalinformation", HttpContext.Current.Request.Url.Authority)
            };

            if (cart.PersonalInformation != null)
            {
                personalInformation.Email = cart.PersonalInformation.Email;
                personalInformation.Phone = cart.PersonalInformation.Phone;
            }

            return(personalInformation);
        }
예제 #6
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);
        }