Beispiel #1
0
        public virtual OrderRowEntity AddRow(ProductEntity product, double quantity, IProductPricePolicy pricePolicy)
        {
            var row = OrderRowEntity.Create(this, product, quantity, pricePolicy);

            AddRow(row);

            return(row);
        }
Beispiel #2
0
 public PrestaShopSynchronizeOrder(
     ILogger <PrestaShopSynchronizeOrder> _logger,
     IUnitOfWorkProvider _unitOfWorkProvider,
     ISynchronizeStampRepository _synchronizeStampRepository,
     ICustomerRepository _customerRepository,
     IOrderRepository _orderRepository,
     IOrderStatusRepository _orderStatusRepository,
     IProductRepository _productRepository,
     IPrestaShopClient _prestaShopClient,
     IPsOrderRepository _psOrderRepository,
     IProductPricePolicy _pricePolicy)
 {
     logger                     = _logger;
     unitOfWorkProvider         = _unitOfWorkProvider;
     synchronizeStampRepository = _synchronizeStampRepository;
     customerRepository         = _customerRepository;
     orderRepository            = _orderRepository;
     orderStatusRepository      = _orderStatusRepository;
     productRepository          = _productRepository;
     prestaShopClient           = _prestaShopClient;
     psOrderRepository          = _psOrderRepository;
     pricePolicy                = _pricePolicy;
 }
Beispiel #3
0
        public static OrderRowEntity Create(OrderEntity order, ProductEntity product, double quantity, IProductPricePolicy pricePolicy)
        {
            Guard.NotNull(order, nameof(order));
            Guard.NotNull(order.Customer, nameof(order.Customer));
            Guard.NotNull(product, nameof(product));

            var priceInfo = pricePolicy.GetProductPriceInfoForCustomer(product, order.Customer);

            return(new OrderRowEntity
            {
                Order = order,
                Product = product,
                Quantity = quantity,
                OrginalQuantity = quantity,
                Price = priceInfo.Price,
                Rebate = priceInfo.Rebate,
                TaxName = product.Tax?.Name,
                TaxValue = (product.Tax?.Rate ?? 0) / 100M
            });
        }