mirror of https://github.com/EasyAbp/EShop.git
31 changed files with 311 additions and 39 deletions
@ -0,0 +1,11 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using EasyAbp.EShop.Orders.Orders.Dtos; |
||||
|
using EasyAbp.EShop.Products.Products.Dtos; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Orders.Orders; |
||||
|
|
||||
|
public interface IOrderLinePriceOverrider |
||||
|
{ |
||||
|
Task<decimal?> GetUnitPriceOrNullAsync(CreateOrderDto input, CreateOrderLineDto inputOrderLine, ProductDto product, |
||||
|
ProductSkuDto productSku); |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
using EasyAbp.EShop.Orders.Orders.Dtos; |
||||
|
using EasyAbp.EShop.Products.Products.Dtos; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Orders.Orders; |
||||
|
|
||||
|
public class TestOrderLinePriceOverrider : IOrderLinePriceOverrider, ITransientDependency |
||||
|
{ |
||||
|
public static decimal Sku2UnitPrice { get; set; } = 100m; |
||||
|
|
||||
|
public async Task<decimal?> GetUnitPriceOrNullAsync(CreateOrderDto input, CreateOrderLineDto inputOrderLine, |
||||
|
ProductDto product, ProductSkuDto productSku) |
||||
|
{ |
||||
|
if (inputOrderLine.ProductSkuId == OrderTestData.ProductSku2Id) |
||||
|
{ |
||||
|
return Sku2UnitPrice; |
||||
|
} |
||||
|
|
||||
|
return null; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace EasyAbp.EShop.Products.Products |
||||
|
{ |
||||
|
public class ProductSkuIncorrectAttributeOptionsException : BusinessException |
||||
|
{ |
||||
|
public ProductSkuIncorrectAttributeOptionsException(Guid productId, string serializedAttributeOptionIds) : base(ProductsErrorCodes.ProductSkuIncorrectAttributeOptions) |
||||
|
{ |
||||
|
WithData(nameof(productId), productId); |
||||
|
WithData(nameof(serializedAttributeOptionIds), serializedAttributeOptionIds); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue