Пример #1
0
            public void Apply(Order order)
            {
                var amountUnit = AmountUnit.ToDomainModel <AmountUnit>();

                order.AddItem(
                    ProductUnit.Of(
                        Products.ProductId.From(ProductId),
                        amountUnit),
                    Products.Amount.Of(
                        Amount,
                        amountUnit));
            }
Пример #2
0
            public void Apply(Order order)
            {
                var quotes = new List <Quote>();

                foreach (var priceConfirmation in PriceConfirmations)
                {
                    var productId = ProductId.From(priceConfirmation.ProductId);
                    var amount    = Amount.Of(
                        priceConfirmation.Amount,
                        priceConfirmation.AmountUnit.ToDomainModel <AmountUnit>());
                    order._items.Add(
                        ProductUnit.Of(
                            productId,
                            priceConfirmation.AmountUnit.ToDomainModel <AmountUnit>()),
                        amount);
                    quotes.Add(Quote.For(
                                   ProductAmount.Of(productId, amount),
                                   Money.Of(
                                       priceConfirmation.Price,
                                       priceConfirmation.Currency.ToDomainModel <Currency>())));
                }
                order._priceAgreement = PriceAgreement.Final(quotes.ToImmutableArray());
            }