示例#1
0
 public AccountOrderDetailResponse()
 {
     Items         = new List <CartItem>();
     ShippingInfo  = new AddressBase();
     BillingInfo   = new List <string>();
     PaymentMethod = new List <string>();
     Summary       = new CartSummaryBase();
 }
示例#2
0
        public ReviewInfo()
        {
            Shipping = new List <string>();
            Billing  = new List <string>();
            Payment  = new List <string>();

            Summary       = new CartSummaryBase();
            CheckoutItems = new List <CartItem>();
        }
示例#3
0
        private CartSummaryBase ParseCartSummary(XElement container)
        {
            CartSummaryBase result = new CartSummaryBase();

            try
            {
                var total = container.Descendants(_ns + "tr")
                            .WhereAttributeEquals("class", "order-total")
                            .FirstOrNewXElement()
                            .ElementValue();

                var subTotal = container.Descendants(_ns + "tr")
                               .WhereAttributeEquals("class", "order-subtotal")
                               .FirstOrNewXElement()
                               .ElementValue();

                var discount = container.Descendants(_ns + "tr")
                               .WhereAttributeEquals("class", "order-discount discount")
                               .FirstOrNewXElement()
                               .ElementValue();

                var shipping = container.Descendants(_ns + "tr")
                               .WhereAttributeEquals("class", "order-shipping")
                               .FirstOrNewXElement()
                               .ElementValue();

                var shippingDiscount = container.Descendants(_ns + "tr")
                                       .WhereAttributeEquals("class", "order-shipping-discount discount")
                                       .FirstOrNewXElement()
                                       .ElementValue();

                var tax = container.Descendants(_ns + "tr")
                          .WhereAttributeEquals("class", "order-sales-tax")
                          .FirstOrNewXElement()
                          .ElementValue();

                result.Total = new Price(total)
                {
                    Label = "Estimated Total"
                };

                result.Costs = new List <Price>();

                result.Costs.Add(new Price(subTotal)
                {
                    Label = "Subtotal"
                });

                if (!string.IsNullOrEmpty(discount))
                {
                    result.Costs.Add(new Price(discount)
                    {
                        Label = "Order Discount"
                    });
                }

                if (!shipping.Contains("N/A"))
                {
                    result.Costs.Add(new Price(shipping)
                    {
                        Label = "Shipping"
                    });
                }

                if (!string.IsNullOrEmpty(shippingDiscount))
                {
                    result.Costs.Add(new Price(shippingDiscount)
                    {
                        Label = "Shipping Discount"
                    });
                }

                if (!tax.Contains("N/A"))
                {
                    result.Costs.Add(new Price(tax)
                    {
                        Label = "Sales Tax"
                    });
                }
            }
            catch (Exception ex)
            {
                _errors.Add(ex.Handle(
                                "MadServ.CartService.ParseCartSummary",
                                ErrorSeverity.FollowUp,
                                ErrorType.Parsing
                                ));
            }

            return(result);
        }