public async static Task <SpotRate> GetSpotPrice(string currency = null) { var url = GetSpotRateUrl(currency); var spotPriceJObject = await GetUnauthenticatedJResource(url); return(new SpotRate(PriceUnit.FromJToken(spotPriceJObject))); }
public async Task <PriceUnit> GetBalance() { var url = GetAccountBalanceUrl(); var response = await this.GetAuthenticatedResource(url); return(PriceUnit.FromJToken(response)); }
public PriceHandler(List <IPrice> prices, PriceUnit priceUnit, Goods goods) { _prices = prices; _priceUnit = priceUnit; _goods = goods; _isVolume = priceUnit.UnitType == UnitTypeEnum.LF; _isWeight = !_isVolume; }
/// <summary> /// Override of the get hash code method. /// </summary> /// <returns></returns> public override int GetHashCode() { //Get hash code for the nullable fields. int hashName = Name == null ? 0 : Name.GetHashCode(); int hashCategories = Categories == null ? 0 : Categories.Distinct().Aggregate(0, (x, y) => x.GetHashCode() ^ y.GetHashCode());; //Calculate the hash code for the GPOPolicy. return(_id.GetHashCode() ^ BaseQuantity.GetHashCode() ^ PriceUnit.GetHashCode() ^ hashName ^ hashCategories); }
public static DictionaryItemDto ToDictionaryItemDto(this PriceUnit entity) { return(entity == null ? null : new DictionaryItemDto { Key = entity.Id.ToString(), Value = entity.PriceUnitNo, DisplayText = entity.PriceUnitName }); }
/// <summary> /// Override of the equality method. /// </summary> /// <param name="o"></param> /// <returns></returns> public bool Equals(Ingredients o) { //Check whether the compared object is null. if (ReferenceEquals(o, null)) { return(false); } //Check whether the compared object references the same data. if (ReferenceEquals(this, o)) { return(true); } //Check whether the Ingredients' properties are equal. return(_id.Equals(o._id) && BaseQuantity.Equals(o.BaseQuantity) && PriceUnit.Equals(o.PriceUnit) && Name.Equals(o.Name) && Tools.SequenceEqual(Categories, o.Categories)); }
public async Task <ActionResult> Details(PricePlanDetailsViewModel pricePlanDetailsViewModel) { var currentUserId = await _customerIdService.GetCustomerId(); var priceUnit = new PriceUnit { Name = pricePlanDetailsViewModel.PricePlan.Name, CustomerId = currentUserId, Height = pricePlanDetailsViewModel.PriceUnitViewModel.Height, Width = pricePlanDetailsViewModel.PriceUnitViewModel.Width, Price = pricePlanDetailsViewModel.PriceUnitViewModel.Price }; var currentPricePlanId = pricePlanDetailsViewModel.PricePlan.Id; var currentPricePlan = await _pricePlanRepository.GetByIdAsync(currentPricePlanId); currentPricePlan.PriceUnits.Add(priceUnit); await _pricePlanRepository.Update(currentPricePlan); return(RedirectToAction("Details", new { id = currentPricePlanId })); }
public async static Task <PriceBuyResponse> GetBitcoinBuyPrice(decimal bitcoinQuantity = 1, string currency = null) { if (bitcoinQuantity < 0) { throw new ArgumentOutOfRangeException("bitcoinQuantity", "Argument bitcoinQuantity must be a non-negative value."); } // Do not validate currency. var url = GetBuyPricesUrl(bitcoinQuantity, currency); var priceJObject = await GetUnauthenticatedJResource(url); var subtotal = PriceUnit.FromJToken(priceJObject["subtotal"]); var fees = priceJObject["fees"] .SelectMany(t => t) .Cast <JProperty>() .Select(jProperty => new CoinbaseFee(jProperty.Name, PriceUnit.FromJToken(jProperty.Value) )); var total = PriceUnit.FromJToken(priceJObject["total"]); return(new PriceBuyResponse(subtotal, fees, total)); }
private double GetPrice(PriceUnit price) { if (price == null) { return(0); } double result = 0; string priceStr; var priceRange = price.Price.Split('-'); if (priceRange.Count() == 2) { priceStr = priceRange[0]; } else { priceStr = price.Price; } double.TryParse(priceStr, out result); return(result); }
public SpotRate(PriceUnit price) { this.Price = price; }
public CoinbaseFee(string description, PriceUnit priceUnit) { this.Description = description; this.Price = priceUnit; }
public CoinbaseFee(string description, PriceUnit priceUnit) { this.Description = description; this.Price = priceUnit; }
public SpotRate(PriceUnit price) { this.Price = price; }