internal static void Read(XmlReader reader, TransactionSearchResult result)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(TransactionSearchResultSerializer.TransactionSearchResult);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, TransactionSearchResultSerializer.TransactionSearchResult))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case TransactionSearchResultSerializer.Date:
                        result.Date = reader.ReadElementContentAsDateTime();
                        break;

                    case TransactionSearchResultSerializer.CurrentPage:
                        result.CurrentPage = reader.ReadElementContentAsInt();
                        break;

                    case TransactionSearchResultSerializer.TotalPages:
                        result.TotalPages = reader.ReadElementContentAsInt();
                        break;

                    case TransactionSummaryListSerializer.Transactions:
                        TransactionSummaryListSerializer.Read(reader, result.Items);
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
        internal static void Read(XmlReader reader, Sender sender)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (sender == null)
            {
                throw new ArgumentNullException("sender");
            }

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(SenderSerializer.Sender);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, SenderSerializer.Sender))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case SenderSerializer.Name:
                        sender.Name = reader.ReadElementContentAsString();
                        break;

                    case SenderSerializer.Email:
                        sender.Email = reader.ReadElementContentAsString();
                        break;

                    case PhoneSerializer.Phone:
                        Phone phone = new Phone();
                        PhoneSerializer.Read(reader, phone);
                        sender.Phone = phone;
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
        internal static void Read(XmlReader reader, Shipping shipping)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (shipping == null)
            {
                throw new ArgumentNullException("shipping");
            }

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(ShippingSerializer.Shipping);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, ShippingSerializer.Shipping))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case ShippingSerializer.ShippingType:
                        shipping.ShippingType = reader.ReadElementContentAsInt();
                        break;

                    case ShippingSerializer.Cost:
                        shipping.Cost = reader.ReadElementContentAsDecimal();
                        break;

                    case AddressSerializer.Address:
                        Address address = new Address();
                        AddressSerializer.Read(reader, address);
                        shipping.Address = address;
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
        internal static PagSeguroServiceError Read(XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }

            string code    = String.Empty;
            String message = String.Empty;

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return(new PagSeguroServiceError(code, message));
            }

            reader.ReadStartElement(PagSeguroErrorSerializer.Error);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, PagSeguroErrorSerializer.Error))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case PagSeguroErrorSerializer.Code:
                        code = reader.ReadElementContentAsString();
                        break;

                    case PagSeguroErrorSerializer.Message:
                        message = reader.ReadElementContentAsString();
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }

            PagSeguroServiceError error = new PagSeguroServiceError(code, message);

            return(error);
        }
示例#5
0
        internal static void Read(XmlReader reader, PaymentRequestResponse paymentResponse)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (paymentResponse == null)
            {
                throw new ArgumentNullException("paymentResponse");
            }

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            string rootElement = reader.Name;

            reader.ReadStartElement();
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, rootElement))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case PaymentRequestResponseSerializer.Date:
                        paymentResponse.RegistrationDate = reader.ReadElementContentAsDateTime();
                        break;

                    case PaymentRequestResponseSerializer.Code:
                        paymentResponse.Code = reader.ReadElementContentAsString();
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
示例#6
0
        internal static void Read(XmlReader reader, Phone phone)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (phone == null)
            {
                throw new ArgumentNullException("phone");
            }

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(PhoneSerializer.Phone);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, PhoneSerializer.Phone))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case PhoneSerializer.AreaCode:
                        phone.AreaCode = reader.ReadElementContentAsString();
                        break;

                    case PhoneSerializer.Number:
                        phone.Number = reader.ReadElementContentAsString();
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
示例#7
0
        internal static void Read(XmlReader reader, PaymentMethod paymentMethod)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (paymentMethod == null)
            {
                throw new ArgumentNullException("paymentMethod");
            }

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(PaymentMethodSerializer.PaymentMethod);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, PaymentMethodSerializer.PaymentMethod))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case PaymentMethodSerializer.PaymentMethodType:
                        paymentMethod.PaymentMethodType = reader.ReadElementContentAsInt();
                        break;

                    case PaymentMethodSerializer.PaymentMethodCode:
                        paymentMethod.PaymentMethodCode = reader.ReadElementContentAsInt();
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
示例#8
0
        internal static void Read(XmlReader reader, IList <TransactionSummary> transactions)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (transactions == null)
            {
                throw new ArgumentNullException("transactions");
            }

            transactions.Clear();

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
            }

            reader.ReadStartElement(TransactionSummaryListSerializer.Transactions);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, TransactionSummaryListSerializer.Transactions))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case TransactionSerializerHelper.Transaction:
                        TransactionSummary transaction = new TransactionSummary();
                        TransactionSummarySerializer.Read(reader, transaction);
                        transactions.Add(transaction);
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
示例#9
0
        internal static void Read(XmlReader reader, IList <Item> items)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }

            items.Clear();

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
            }

            reader.ReadStartElement(ItemListSerializer.Items);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, ItemListSerializer.Items))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case ItemSerializer.Item:
                        Item item = new Item();
                        ItemSerializer.Read(reader, item);
                        items.Add(item);
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
示例#10
0
        internal static void Read(XmlReader reader, IList <PagSeguroServiceError> errors)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (errors == null)
            {
                throw new ArgumentNullException("errors");
            }

            errors.Clear();

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
            }

            reader.ReadStartElement(PagSeguroErrorsSerializer.Errors);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, PagSeguroErrorsSerializer.Errors))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case PagSeguroErrorSerializer.Error:
                        errors.Add(PagSeguroErrorSerializer.Read(reader));
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
        internal static void Read(XmlReader reader, Address address)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(AddressSerializer.Address);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, AddressSerializer.Address))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case AddressSerializer.Country:
                        address.Country = reader.ReadElementContentAsString();
                        break;

                    case AddressSerializer.State:
                        address.State = reader.ReadElementContentAsString();
                        break;

                    case AddressSerializer.City:
                        address.City = reader.ReadElementContentAsString();
                        break;

                    case AddressSerializer.District:
                        address.District = reader.ReadElementContentAsString();
                        break;

                    case AddressSerializer.PostalCode:
                        address.PostalCode = reader.ReadElementContentAsString();
                        break;

                    case AddressSerializer.Street:
                        address.Street = reader.ReadElementContentAsString();
                        break;

                    case AddressSerializer.Number:
                        address.Number = reader.ReadElementContentAsString();
                        break;

                    case AddressSerializer.Complement:
                        address.Complement = reader.ReadElementContentAsString();
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
        internal static void Read(XmlReader reader, TransactionSummary transaction)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (transaction == null)
            {
                throw new ArgumentNullException("transaction");
            }

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(TransactionSerializerHelper.Transaction);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, TransactionSerializerHelper.Transaction))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case TransactionSerializerHelper.Code:
                        transaction.Code = reader.ReadElementContentAsString();
                        break;

                    case TransactionSerializerHelper.Date:
                        transaction.Date = reader.ReadElementContentAsDateTime();
                        break;

                    case TransactionSerializerHelper.Reference:
                        transaction.Reference = reader.ReadElementContentAsString();
                        break;

                    case TransactionSerializerHelper.TransactionType:
                        transaction.TransactionType = reader.ReadElementContentAsInt();
                        break;

                    case TransactionSerializerHelper.TransactionStatus:
                        transaction.TransactionStatus = reader.ReadElementContentAsInt();
                        break;

                    case TransactionSerializerHelper.GrossAmount:
                        transaction.GrossAmount = reader.ReadElementContentAsDecimal();
                        break;

                    case TransactionSerializerHelper.DiscountAmount:
                        transaction.DiscountAmount = reader.ReadElementContentAsDecimal();
                        break;

                    case TransactionSerializerHelper.FeeAmount:
                        transaction.FeeAmount = reader.ReadElementContentAsDecimal();
                        break;

                    case TransactionSerializerHelper.NetAmount:
                        transaction.NetAmount = reader.ReadElementContentAsDecimal();
                        break;

                    case TransactionSerializerHelper.ExtraAmount:
                        transaction.ExtraAmount = reader.ReadElementContentAsDecimal();
                        break;

                    case TransactionSerializerHelper.LastEventDate:
                        transaction.LastEventDate = reader.ReadElementContentAsDateTime();
                        break;

                    case PaymentMethodSerializer.PaymentMethod:
                        PaymentMethod paymentMethod = new PaymentMethod();
                        PaymentMethodSerializer.Read(reader, paymentMethod);
                        transaction.PaymentMethod = paymentMethod;
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
示例#13
0
        internal static void Read(XmlReader reader, Item item)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(ItemSerializer.Item);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, ItemSerializer.Item))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case ItemSerializer.Id:
                        item.Id = reader.ReadElementContentAsString();
                        break;

                    case ItemSerializer.Description:
                        item.Description = reader.ReadElementContentAsString();
                        break;

                    case ItemSerializer.Quantity:
                        item.Quantity = reader.ReadElementContentAsInt();
                        break;

                    case ItemSerializer.Amount:
                        item.Amount = reader.ReadElementContentAsDecimal();
                        break;

                    case ItemSerializer.Weight:
                        item.Weight = reader.ReadElementContentAsLong();
                        break;

                    case ItemSerializer.ShippingCost:
                        item.ShippingCost = reader.ReadElementContentAsDecimal();
                        break;

                    default:
                        SerializationHelper.SkipElement(reader);
                        break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }