public static PriceDetail ExtractUSDPrice(IapItem iapItem) { List <PriceDetail> prices = iapItem.priceSets.PurchaseFee.priceMap.DEFAULT; foreach (var price in prices) { if (price.currency == "USD") { return(price); } } PriceDetail newUSDPrice = new PriceDetail(); newUSDPrice.currency = "USD"; prices.Add(newUSDPrice); return(newUSDPrice); }
public static PriceSets FillUsdToPriceSet(string price) { var priceDetail = new PriceDetail() { currency = "USD", price = price }; var priceList = new List <PriceDetail>() { priceDetail }; var priceMap = new PriceMap() { DEFAULT = priceList }; var priceSet = new PriceSets() { PurchaseFee = new PurchaseFee() { priceMap = priceMap } }; return(priceSet); }