Ejemplo n.º 1
0
        private void parsedRefundNodes(XmlNodeList refundNodes, List <SettlementRefundDto> refundList, string settlementId)
        {
            foreach (XmlNode refundNode in refundNodes)
            {
                var extractor = new NodeValueExtractor(refundNode);

                var refund = new SettlementRefundDto
                {
                    SettlementId = settlementId,
                    OrderId      = extractor.GetValue <string>("AmazonOrderID"),
                    AdjustmentId = extractor.GetValue <string>("AdjustmentID"),
                    Marketplace  = extractor.GetValue <string>("MarketplaceName"),
                };

                refund.MerchantFulfillmentId = refundNode.SelectSingleNode("./Fulfillment/MerchantFulfillmentID").InnerText;
                refund.PostedDate            = Convert.ToDateTime(refundNode.SelectSingleNode("./Fulfillment/PostedDate").InnerText);

                // get the item nodes and add it to the list
                var itemNodes = refundNode.SelectNodes("./Fulfillment/AdjustedItem");
                foreach (XmlNode itemNode in itemNodes)
                {
                    extractor = new NodeValueExtractor(itemNode);
                    var item = new SettlementItemDto
                    {
                        OrderId                  = refund.OrderId,
                        OrderItemCode            = extractor.GetValue <string>("AmazonOrderItemCode"),
                        SKU                      = extractor.GetValue <string>("SKU"),
                        MerchantAdjustmentItemId = extractor.GetValue <string>("MerchantAdjustmentItemID"),
                    };

                    // get item fees and price nodes
                    var itemPriceNodes = itemNode.SelectNodes("./ItemPriceAdjustments");
                    var itemFeeNodes   = itemNode.SelectNodes("./ItemFeeAdjustments");

                    // parse the item prices and fees
                    item.ItemPrices = getParsedItemPrices(itemPriceNodes, item.OrderItemCode);
                    item.ItemFees   = getParsedItemFees(itemFeeNodes, item.OrderItemCode);

                    // and, add it to the list
                    refund.Items.Add(item);
                }

                // add it to the list
                refundList.Add(refund);
            }
        }
Ejemplo n.º 2
0
        private void parsedOderNodes(XmlNodeList orderNodes, List <SettlementOrderDto> ordersList, string settlementId)
        {
            foreach (XmlNode orderNode in orderNodes)
            {
                var extractor = new NodeValueExtractor(orderNode);
                var order     = new SettlementOrderDto
                {
                    SettlementId = settlementId,
                    OrderId      = extractor.GetValue <string>("AmazonOrderID"),
                    ShipmentId   = extractor.GetValue <string>("ShipmentID"),
                    Marketplace  = extractor.GetValue <string>("MarketplaceName"),
                };

                order.MerchantFulfillmentId = orderNode.SelectSingleNode("./Fulfillment/MerchantFulfillmentID").InnerText;
                order.PostedDate            = Convert.ToDateTime(orderNode.SelectSingleNode("./Fulfillment/PostedDate").InnerText);

                // get the item nodes and add it to the list
                var itemNodes = orderNode.SelectNodes("./Fulfillment/Item");
                foreach (XmlNode itemNode in itemNodes)
                {
                    extractor = new NodeValueExtractor(itemNode);
                    var item = new SettlementItemDto
                    {
                        OrderId       = order.OrderId,
                        OrderItemCode = extractor.GetValue <string>("AmazonOrderItemCode"),
                        SKU           = extractor.GetValue <string>("SKU"),
                        Quantity      = extractor.GetValue <int>("Quantity")
                    };

                    // get item fees and price nodes
                    var itemPriceNodes = itemNode.SelectNodes("./ItemPrice");
                    var itemFeeNodes   = itemNode.SelectNodes("./ItemFees");

                    // parse the item prices and fees
                    item.ItemPrices = getParsedItemPrices(itemPriceNodes, item.OrderItemCode);
                    item.ItemFees   = getParsedItemFees(itemFeeNodes, item.OrderItemCode);

                    // and, add it to the list
                    order.Items.Add(item);
                }

                // add it to the list
                ordersList.Add(order);
            }
        }