public void SetCheckoutBillingAddress()
    {
        Customer customer = StoreContext.Customer;

        Address billingAddress = new Vevo.Base.Domain.Address(
            customer.BillingAddress.FirstName,
            customer.BillingAddress.LastName,
            customer.BillingAddress.Company,
            customer.BillingAddress.Address1,
            customer.BillingAddress.Address2,
            customer.BillingAddress.City,
            customer.BillingAddress.State,
            customer.BillingAddress.Zip,
            customer.BillingAddress.Country,
            customer.BillingAddress.Phone,
            customer.BillingAddress.Fax);

        StoreContext.CheckoutDetails.SetBillingDetails(billingAddress, customer.Email);
    }
Example #2
0
    public void SetCheckoutBillingAddress()
    {
        if (Page.User.Identity.IsAuthenticated)
        {
            Customer customer = DataAccessContext.CustomerRepository.GetOne(
                DataAccessContext.CustomerRepository.GetIDFromUserName(Membership.GetUser().UserName));

            Address billingAddress = new Vevo.Base.Domain.Address(
                customer.BillingAddress.FirstName,
                customer.BillingAddress.LastName,
                customer.BillingAddress.Company,
                customer.BillingAddress.Address1,
                customer.BillingAddress.Address2,
                customer.BillingAddress.City,
                customer.BillingAddress.State,
                customer.BillingAddress.Zip,
                customer.BillingAddress.Country,
                customer.BillingAddress.Phone,
                customer.BillingAddress.Fax);

            StoreContext.CheckoutDetails.SetBillingDetails(billingAddress, customer.Email);
        }
    }
    private void BuildShoppingCart(string requestXml, NewOrderNotification notification)
    {
        foreach (Item item in notification.shoppingcart.items)
        {
            XmlNode[] node = item.merchantprivateitemdata.Any;

            Product product = DataAccessContext.ProductRepository.GetOne(
                StoreContext.Culture,
                item.merchantitemid,
                new StoreRetriever().GetCurrentStoreID()
                );

            if (node.Length <= 1)
            {
                StoreContext.ShoppingCart.AddItem(
                    product, item.quantity);
            }
            else
            {
                // Creating option item from google checkout is not details of option type is text.
                OptionItemValueCollection optionCollection = OptionItemValueCollection.Null;
                if (!String.IsNullOrEmpty(node[1].InnerText))
                {
                    optionCollection = new OptionItemValueCollection(
                        StoreContext.Culture, node[1].InnerText, item.merchantitemid);
                }

                StoreContext.ShoppingCart.AddItem(
                    product, item.quantity, optionCollection);
            }
        }

        Log.Debug("SetShippingDetails");
        Vevo.Base.Domain.Address address = new Vevo.Base.Domain.Address(
            notification.buyershippingaddress.contactname,
            "",
            notification.buyerbillingaddress.companyname,
            notification.buyershippingaddress.address1,
            notification.buyershippingaddress.address2,
            notification.buyershippingaddress.city,
            notification.buyershippingaddress.region,
            notification.buyershippingaddress.postalcode,
            notification.buyershippingaddress.countrycode,
            notification.buyerbillingaddress.phone,
            notification.buyerbillingaddress.fax);

        StoreContext.CheckoutDetails.ShippingAddress = new ShippingAddress(address, false);

        Log.Debug("Set Shipping ");
        MerchantCalculatedShippingAdjustment shippingAdjust = (MerchantCalculatedShippingAdjustment)notification.orderadjustment.shipping.Item;

        string         shippingID = DataAccessContext.ShippingOptionRepository.GetIDFromName(shippingAdjust.shippingname);
        ShippingMethod shipping   = ShippingFactory.CreateShipping(shippingID);

        shipping.Name = shippingAdjust.shippingname;
        StoreContext.CheckoutDetails.SetShipping(shipping);
        StoreContext.CheckoutDetails.SetCustomerComments("");

        PaymentOption paymentOption = DataAccessContext.PaymentOptionRepository.GetOne(
            StoreContext.Culture, PaymentOption.GoogleCheckout);

        StoreContext.CheckoutDetails.SetPaymentMethod(
            paymentOption.CreatePaymentMethod());

        Log.Debug("Set Coupon ID");
        StoreContext.CheckoutDetails.SetCouponID(GetCouponCode(notification.orderadjustment.merchantcodes.Items));

        Log.Debug("Set Gift");
        string giftID = GetGiftCertificateCode(notification.orderadjustment.merchantcodes.Items);

        if (giftID != String.Empty)
        {
            StoreContext.CheckoutDetails.SetGiftCertificate(giftID);
        }

        StoreContext.CheckoutDetails.SetGiftRegistryID("0");
        StoreContext.CheckoutDetails.SetShowShippingAddress(true);
    }