public Item(char sku, decimal unitPrice, IPricing promotion = null) { if (unitPrice <= 0) { throw new ArgumentException("Unit price must be greater than zero", nameof(unitPrice)); } PRODUCT = sku; UnitPrice = unitPrice; Promotion = promotion; }
public CartController( ICarts carts, IPricing pricing, ILogger <CartController> logger, IServiceProvider serviceProvider) { _carts = carts; _pricing = pricing; _logger = logger; _pricing = pricing; _serviceProvider = serviceProvider; }
public CartController( ICarts carts, IPricing pricing, IEventEmitter eventEmitter, ILogger <CartController> logger) { _carts = carts; _eventEmitter = eventEmitter; _pricing = pricing; _logger = logger; _pricing = pricing; }
/// <summary> /// Gets price information for a variation as a Price object. You can get the monetary price from the UnitPrice member. /// </summary> /// <param name="pricing">The variation.</param> /// <param name="market">The market.</param> /// <returns></returns> public static Price GetPrice(this IPricing pricing, IMarket market) { if (pricing == null) { return(null); } IMarket currentMarket = market; if (market == null) { currentMarket = _currentMarket.Service.GetCurrentMarket(); } return(pricing.GetPrices(injectedPriceLoader.Service).FirstOrDefault(x => x.MarketId == currentMarket.MarketId)); }
public static Price GetPrice(IPricing pricing) { return(pricing.GetPrices(injectedPriceLoader.Service).FirstOrDefault(x => x.MarketId == injectedMarketService.Service.GetCurrentMarket().MarketId)); }
public PointOfSaleTerminal(ICart cart, IPricing prices, IPricingAlgorithm priceCalulationAlgorithm) { this.prices = prices; this.priceCalulationAlgorithm = priceCalulationAlgorithm; this.cart = cart; }
protected Price GetPrice(IPricing pricing) { return(pricing.GetPrices(PricingLoader).FirstOrDefault(x => x.MarketId == CurrentMarket.GetCurrentMarket().MarketId)); }
// Extra tax for Stockholm protected override Money CalculateTaxTotal( IOrderGroup orderGroup , IMarket market , Currency currency) { // may have use of this // could have Cart/PO-property like ... "CheckTaxStandAlone" for forking code (used with the bogus-cart) this._orderGroup = orderGroup; decimal d = 0; if (market.MarketId.Value == "sv") { // need the shipment with the new stuff... else coding against the old stuff manually IShipment ship = orderGroup.GetFirstShipment(); List <ITaxValue> taxValues = new List <ITaxValue>(); // Could have a generic "sv"-tax and... and onther higher for Stockholm (address.city) // .. but then the below is not needed // could set the City, Country etc. based on a IP-LookUp or something Market-wise // Could have the "Stockholm Market" where taxes and prices are higher // ...just for testing if (ship.ShippingAddress == null) { this.address = _orderGroupFactory.Service.CreateOrderAddress(orderGroup); address.CountryCode = "sv"; address.CountryName = "sv"; // Like The Netherlands tourist accommodation tax ... differs between cities // when you set the city in CM-->Admin-->Taxes ... it gets excluded // and no tax is applied... have to find a "WorkAround" // the rest works... address.City = "Stockholm"; address.Id = "DummyAddress"; ship.ShippingAddress = address; } if (ship.ShippingAddress.City == "Stockholm") { // this.peopleFromStockholm = true; } // Extra tax ... if (ship.ShippingAddress.City == "Stockholm") { foreach (var item in orderGroup.GetAllLineItems()) { ContentReference contentLink = _referenceConverter.GetContentLink(item.Code); IPricing pricing = _contentRepository.Get <EntryContentBase>(contentLink) as IPricing; int i = (int)pricing.TaxCategoryId; // An address have to be there if using this ... so we can match the different properties taxValues.AddRange(GetTaxValues(CatalogTaxManager.GetTaxCategoryNameById(i), "sv", address)); foreach (var item2 in taxValues) { // extra tax when shipped to Stockholm 10% more d += (decimal)(item2.Percentage + 0.10) * (item.PlacedPrice * item.Quantity); } } //var liAmount = orderGroup.Forms.Sum(x => x.GetAllLineItems().Sum(l => l.PlacedPrice * l.Quantity)); } else { foreach (var item in orderGroup.GetAllLineItems()) { ContentReference contentLink = _referenceConverter.GetContentLink(item.Code); IPricing pricing = _contentRepository.Get <EntryContentBase>(contentLink) as IPricing; int i = (int)pricing.TaxCategoryId; // An address have to be there taxValues.AddRange(GetTaxValues(CatalogTaxManager.GetTaxCategoryNameById(i), "sv", address)); foreach (var item2 in taxValues) { // not Stockholm, so no extra tax d += (decimal)(item2.Percentage) * (item.PlacedPrice * item.Quantity); } } } return(new Money(d, market.DefaultCurrency) / 100); } else { return(base.CalculateTaxTotal(orderGroup, market, currency)); } }
public CheckoutController(IUnitRepository unitRepository, IPricing pricingService) //todo: inject logging { _unitRepository = unitRepository; _pricing = pricingService; }
public CheckoutTest() { _pricingService = new PricingController(_ruleRepository); _checkout = new CheckoutController(_mockRepository, _pricingService); }
public Checkout(IPricing pricing) { _pricing = pricing ?? throw new ArgumentException("Invalid null value", "pricing"); _lineItems = new List <LineItem>(); }
public PricingTest() { _pricing = new PricingController(_mockRuleRepository); }
public CreateOfferCommandHandler(IMapper mapper, IOfferRepository offerRepository, IPricing pricingService) { this._mapper = mapper; this._pricingService = pricingService; this._offerRepository = offerRepository; }
public Facade(IGenerateHistory generateHistory, IPricing pricing) { this.generateHistory = generateHistory; this.pricing = pricing; }
public BasketPricingVM() { basket = new BasketPricingModel(); }
public VanillaCallPricingVM() { vanillaCall = new VanillaCallPricingModel(); }